@tmlmobilidade/types 20251001.1613.56 → 20251001.1658.38

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/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './src/file.js';
6
6
  export * from './src/gtfs.js';
7
7
  export * from './src/gtfs/index.js';
8
8
  export * from './src/locations.js';
9
+ export * from './src/notification.js';
9
10
  export * from './src/organization.js';
10
11
  export * from './src/pcgi/index.js';
11
12
  export * from './src/plans/index.js';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from './src/file.js';
9
9
  export * from './src/gtfs.js';
10
10
  export * from './src/gtfs/index.js';
11
11
  export * from './src/locations.js';
12
+ export * from './src/notification.js';
12
13
  export * from './src/organization.js';
13
14
  export * from './src/pcgi/index.js';
14
15
  export * from './src/plans/index.js';
@@ -9,6 +9,7 @@ export declare const UserSchema: z.ZodObject<{
9
9
  updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
10
10
  updated_by: z.ZodOptional<z.ZodString>;
11
11
  } & {
12
+ active_notifications: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
12
13
  avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
14
  bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
15
  email: z.ZodString;
@@ -34,6 +35,7 @@ export declare const UserSchema: z.ZodObject<{
34
35
  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">]>>>>>;
35
36
  role_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
36
37
  session_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
38
+ subscribed_topics: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
37
39
  theme_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
40
  verification_token_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
39
41
  }, "strict", z.ZodTypeAny, {
@@ -50,10 +52,12 @@ export declare const UserSchema: z.ZodObject<{
50
52
  scope: string;
51
53
  resource?: Record<string, any> | null | undefined;
52
54
  }[];
55
+ active_notifications: string[];
53
56
  first_name: string;
54
57
  last_name: string;
55
58
  role_ids: string[];
56
59
  session_ids: string[];
60
+ subscribed_topics: string[];
57
61
  verification_token_ids: string[];
58
62
  created_by?: string | undefined;
59
63
  updated_by?: string | undefined;
@@ -80,6 +84,7 @@ export declare const UserSchema: z.ZodObject<{
80
84
  created_by?: string | undefined;
81
85
  updated_by?: string | undefined;
82
86
  phone?: string | null | undefined;
87
+ active_notifications?: string[] | undefined;
83
88
  avatar?: string | null | undefined;
84
89
  bio?: string | null | undefined;
85
90
  email_verified?: number | null | undefined;
@@ -88,6 +93,7 @@ export declare const UserSchema: z.ZodObject<{
88
93
  preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
89
94
  role_ids?: string[] | undefined;
90
95
  session_ids?: string[] | undefined;
96
+ subscribed_topics?: string[] | undefined;
91
97
  theme_id?: string | null | undefined;
92
98
  verification_token_ids?: string[] | undefined;
93
99
  }>;
@@ -98,6 +104,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
98
104
  updated_at: z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>;
99
105
  updated_by: z.ZodOptional<z.ZodString>;
100
106
  } & {
107
+ active_notifications: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
101
108
  avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
102
109
  bio: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
110
  email: z.ZodString;
@@ -123,6 +130,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
123
130
  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">]>>>>>;
124
131
  role_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
125
132
  session_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
133
+ subscribed_topics: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
126
134
  theme_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
135
  verification_token_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
128
136
  }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
@@ -132,10 +140,12 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
132
140
  scope: string;
133
141
  resource?: Record<string, any> | null | undefined;
134
142
  }[];
143
+ active_notifications: string[];
135
144
  first_name: string;
136
145
  last_name: string;
137
146
  role_ids: string[];
138
147
  session_ids: string[];
148
+ subscribed_topics: string[];
139
149
  verification_token_ids: string[];
140
150
  created_by?: string | undefined;
141
151
  updated_by?: string | undefined;
@@ -159,6 +169,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
159
169
  created_by?: string | undefined;
160
170
  updated_by?: string | undefined;
161
171
  phone?: string | null | undefined;
172
+ active_notifications?: string[] | undefined;
162
173
  avatar?: string | null | undefined;
163
174
  bio?: string | null | undefined;
164
175
  email_verified?: number | null | undefined;
@@ -167,6 +178,7 @@ export declare const CreateUserSchema: z.ZodObject<Omit<{
167
178
  preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
168
179
  role_ids?: string[] | undefined;
169
180
  session_ids?: string[] | undefined;
181
+ subscribed_topics?: string[] | undefined;
170
182
  theme_id?: string | null | undefined;
171
183
  verification_token_ids?: string[] | undefined;
172
184
  }>;
@@ -187,6 +199,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
187
199
  scope: string;
188
200
  resource?: Record<string, any> | null | undefined;
189
201
  }>, "many">>;
202
+ active_notifications: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
190
203
  avatar: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
191
204
  bio: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
192
205
  email_verified: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>>>>;
@@ -197,6 +210,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
197
210
  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">]>>>>>>;
198
211
  role_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
199
212
  session_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
213
+ subscribed_topics: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
200
214
  theme_id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
201
215
  verification_token_ids: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
202
216
  }, "strict", z.ZodTypeAny, {
@@ -208,6 +222,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
208
222
  scope: string;
209
223
  resource?: Record<string, any> | null | undefined;
210
224
  }[] | undefined;
225
+ active_notifications?: string[] | undefined;
211
226
  avatar?: string | null | undefined;
212
227
  bio?: string | null | undefined;
213
228
  email_verified?: import("../_common/unix-timestamp.js").UnixTimestamp | null | undefined;
@@ -218,6 +233,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
218
233
  preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
219
234
  role_ids?: string[] | undefined;
220
235
  session_ids?: string[] | undefined;
236
+ subscribed_topics?: string[] | undefined;
221
237
  theme_id?: string | null | undefined;
222
238
  verification_token_ids?: string[] | undefined;
223
239
  }, {
@@ -229,6 +245,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
229
245
  scope: string;
230
246
  resource?: Record<string, any> | null | undefined;
231
247
  }[] | undefined;
248
+ active_notifications?: string[] | undefined;
232
249
  avatar?: string | null | undefined;
233
250
  bio?: string | null | undefined;
234
251
  email_verified?: number | null | undefined;
@@ -239,6 +256,7 @@ export declare const UpdateUserSchema: z.ZodObject<{
239
256
  preferences?: Record<string, Record<string, string | number | boolean | string[] | number[]>> | null | undefined;
240
257
  role_ids?: string[] | undefined;
241
258
  session_ids?: string[] | undefined;
259
+ subscribed_topics?: string[] | undefined;
242
260
  theme_id?: string | null | undefined;
243
261
  verification_token_ids?: string[] | undefined;
244
262
  }>;
@@ -13,6 +13,7 @@ export const UserPreferenceValueSchema = z.union([
13
13
  ]);
14
14
  /* * */
15
15
  export const UserSchema = DocumentSchema.extend({
16
+ active_notifications: z.array(z.string()).default([]),
16
17
  avatar: z.string().nullish(),
17
18
  bio: z.string().nullish(),
18
19
  email: z.string().email(),
@@ -26,6 +27,7 @@ export const UserSchema = DocumentSchema.extend({
26
27
  preferences: z.record(z.record(UserPreferenceValueSchema)).nullish(),
27
28
  role_ids: z.array(z.string()).default([]),
28
29
  session_ids: z.array(z.string()).default([]),
30
+ subscribed_topics: z.array(z.string()).default([]),
29
31
  theme_id: z.string().nullish(),
30
32
  verification_token_ids: z.array(z.string()).default([]),
31
33
  }).strict();
@@ -0,0 +1,187 @@
1
+ import { z } from 'zod';
2
+ export type Notification = z.infer<typeof NotificationSchema>;
3
+ export declare const NotificationSchema: z.ZodObject<{
4
+ _id: z.ZodString;
5
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
6
+ created_by: z.ZodOptional<z.ZodString>;
7
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
8
+ updated_by: z.ZodOptional<z.ZodString>;
9
+ } & {
10
+ is_read: z.ZodBoolean;
11
+ needs_email: z.ZodDefault<z.ZodBoolean>;
12
+ payload: z.ZodObject<{
13
+ body: z.ZodString;
14
+ href: z.ZodOptional<z.ZodString>;
15
+ icon: z.ZodOptional<z.ZodString>;
16
+ title: z.ZodString;
17
+ }, "strip", z.ZodTypeAny, {
18
+ title: string;
19
+ body: string;
20
+ href?: string | undefined;
21
+ icon?: string | undefined;
22
+ }, {
23
+ title: string;
24
+ body: string;
25
+ href?: string | undefined;
26
+ icon?: string | undefined;
27
+ }>;
28
+ priority: z.ZodDefault<z.ZodEnum<["high", "normal", "low"]>>;
29
+ scope: z.ZodString;
30
+ topic: z.ZodString;
31
+ user_id: z.ZodOptional<z.ZodString>;
32
+ }, "strict", z.ZodTypeAny, {
33
+ _id: string;
34
+ created_at: number & {
35
+ __brand: "UnixTimestamp";
36
+ };
37
+ updated_at: number & {
38
+ __brand: "UnixTimestamp";
39
+ };
40
+ scope: string;
41
+ is_read: boolean;
42
+ needs_email: boolean;
43
+ payload: {
44
+ title: string;
45
+ body: string;
46
+ href?: string | undefined;
47
+ icon?: string | undefined;
48
+ };
49
+ priority: "high" | "normal" | "low";
50
+ topic: string;
51
+ created_by?: string | undefined;
52
+ updated_by?: string | undefined;
53
+ user_id?: string | undefined;
54
+ }, {
55
+ _id: string;
56
+ created_at: number;
57
+ updated_at: number;
58
+ scope: string;
59
+ is_read: boolean;
60
+ payload: {
61
+ title: string;
62
+ body: string;
63
+ href?: string | undefined;
64
+ icon?: string | undefined;
65
+ };
66
+ topic: string;
67
+ created_by?: string | undefined;
68
+ updated_by?: string | undefined;
69
+ user_id?: string | undefined;
70
+ needs_email?: boolean | undefined;
71
+ priority?: "high" | "normal" | "low" | undefined;
72
+ }>;
73
+ export declare const CreateNotificationSchema: z.ZodObject<Omit<{
74
+ _id: z.ZodString;
75
+ created_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
76
+ created_by: z.ZodOptional<z.ZodString>;
77
+ updated_at: z.ZodEffects<z.ZodNumber, import("./_common/unix-timestamp.js").UnixTimestamp, number>;
78
+ updated_by: z.ZodOptional<z.ZodString>;
79
+ } & {
80
+ is_read: z.ZodBoolean;
81
+ needs_email: z.ZodDefault<z.ZodBoolean>;
82
+ payload: z.ZodObject<{
83
+ body: z.ZodString;
84
+ href: z.ZodOptional<z.ZodString>;
85
+ icon: z.ZodOptional<z.ZodString>;
86
+ title: z.ZodString;
87
+ }, "strip", z.ZodTypeAny, {
88
+ title: string;
89
+ body: string;
90
+ href?: string | undefined;
91
+ icon?: string | undefined;
92
+ }, {
93
+ title: string;
94
+ body: string;
95
+ href?: string | undefined;
96
+ icon?: string | undefined;
97
+ }>;
98
+ priority: z.ZodDefault<z.ZodEnum<["high", "normal", "low"]>>;
99
+ scope: z.ZodString;
100
+ topic: z.ZodString;
101
+ user_id: z.ZodOptional<z.ZodString>;
102
+ }, "_id" | "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
103
+ scope: string;
104
+ is_read: boolean;
105
+ needs_email: boolean;
106
+ payload: {
107
+ title: string;
108
+ body: string;
109
+ href?: string | undefined;
110
+ icon?: string | undefined;
111
+ };
112
+ priority: "high" | "normal" | "low";
113
+ topic: string;
114
+ created_by?: string | undefined;
115
+ updated_by?: string | undefined;
116
+ user_id?: string | undefined;
117
+ }, {
118
+ scope: string;
119
+ is_read: boolean;
120
+ payload: {
121
+ title: string;
122
+ body: string;
123
+ href?: string | undefined;
124
+ icon?: string | undefined;
125
+ };
126
+ topic: string;
127
+ created_by?: string | undefined;
128
+ updated_by?: string | undefined;
129
+ user_id?: string | undefined;
130
+ needs_email?: boolean | undefined;
131
+ priority?: "high" | "normal" | "low" | undefined;
132
+ }>;
133
+ export declare const UpdateNotificationSchema: z.ZodObject<{
134
+ updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
135
+ scope: z.ZodOptional<z.ZodString>;
136
+ user_id: z.ZodOptional<z.ZodOptional<z.ZodString>>;
137
+ is_read: z.ZodOptional<z.ZodBoolean>;
138
+ needs_email: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
139
+ payload: z.ZodOptional<z.ZodObject<{
140
+ body: z.ZodString;
141
+ href: z.ZodOptional<z.ZodString>;
142
+ icon: z.ZodOptional<z.ZodString>;
143
+ title: z.ZodString;
144
+ }, "strip", z.ZodTypeAny, {
145
+ title: string;
146
+ body: string;
147
+ href?: string | undefined;
148
+ icon?: string | undefined;
149
+ }, {
150
+ title: string;
151
+ body: string;
152
+ href?: string | undefined;
153
+ icon?: string | undefined;
154
+ }>>;
155
+ priority: z.ZodOptional<z.ZodDefault<z.ZodEnum<["high", "normal", "low"]>>>;
156
+ topic: z.ZodOptional<z.ZodString>;
157
+ }, "strict", z.ZodTypeAny, {
158
+ updated_by?: string | undefined;
159
+ scope?: string | undefined;
160
+ user_id?: string | undefined;
161
+ is_read?: boolean | undefined;
162
+ needs_email?: boolean | undefined;
163
+ payload?: {
164
+ title: string;
165
+ body: string;
166
+ href?: string | undefined;
167
+ icon?: string | undefined;
168
+ } | undefined;
169
+ priority?: "high" | "normal" | "low" | undefined;
170
+ topic?: string | undefined;
171
+ }, {
172
+ updated_by?: string | undefined;
173
+ scope?: string | undefined;
174
+ user_id?: string | undefined;
175
+ is_read?: boolean | undefined;
176
+ needs_email?: boolean | undefined;
177
+ payload?: {
178
+ title: string;
179
+ body: string;
180
+ href?: string | undefined;
181
+ icon?: string | undefined;
182
+ } | undefined;
183
+ priority?: "high" | "normal" | "low" | undefined;
184
+ topic?: string | undefined;
185
+ }>;
186
+ export type CreateNotificationDto = z.infer<typeof CreateNotificationSchema>;
187
+ export type UpdateNotificationDto = z.infer<typeof UpdateNotificationSchema>;
@@ -0,0 +1,21 @@
1
+ /* * */
2
+ import { DocumentSchema } from './_common/document.js';
3
+ import { z } from 'zod';
4
+ export const NotificationSchema = DocumentSchema.extend({
5
+ is_read: z.boolean(),
6
+ needs_email: z.boolean().default(false),
7
+ payload: z.object({
8
+ body: z.string().min(1),
9
+ href: z.string().url().optional(),
10
+ icon: z.string().optional(),
11
+ title: z.string().min(1),
12
+ }),
13
+ priority: z.enum(['high', 'normal', 'low']).default('normal'),
14
+ scope: z.string().min(1), // e.g., 'agencies', 'alerts', 'auth'
15
+ topic: z.string().min(1), // e.g., 'new_alert', 'plan_update'
16
+ user_id: z.string().optional(), // Id of the user this notification belongs to
17
+ }).strict();
18
+ /* * */
19
+ export const CreateNotificationSchema = NotificationSchema.omit({ _id: true, created_at: true, updated_at: true });
20
+ export const UpdateNotificationSchema = CreateNotificationSchema.omit({ created_by: true }).partial();
21
+ /* * */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20251001.1613.56",
3
+ "version": "20251001.1658.38",
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",