@tmlmobilidade/types 20250915.1331.9 → 20250915.1518.13
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/src/_common/comment.d.ts +168 -27
- package/dist/src/_common/comment.js +26 -5
- package/dist/src/file.d.ts +7 -7
- package/dist/src/rides/ride-audit.d.ts +15 -0
- package/dist/src/rides/ride-justification.d.ts +138 -475
- package/dist/src/rides/ride-justification.js +4 -22
- package/dist/src/stop.d.ts +126 -63
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const CommentTypeSchema: z.ZodEnum<["
|
|
2
|
+
export declare const CommentTypeSchema: z.ZodEnum<["status_changed", "note", "system_info"]>;
|
|
3
3
|
export type CommentType = z.infer<typeof CommentTypeSchema>;
|
|
4
4
|
export declare const NoteCommentSchema: z.ZodObject<{
|
|
5
5
|
_id: z.ZodString;
|
|
@@ -9,6 +9,7 @@ export declare const NoteCommentSchema: z.ZodObject<{
|
|
|
9
9
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
10
10
|
} & {
|
|
11
11
|
message: z.ZodString;
|
|
12
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
12
13
|
type: z.ZodLiteral<"note">;
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
14
15
|
_id: string;
|
|
@@ -22,6 +23,7 @@ export declare const NoteCommentSchema: z.ZodObject<{
|
|
|
22
23
|
type: "note";
|
|
23
24
|
created_by?: string | undefined;
|
|
24
25
|
updated_by?: string | undefined;
|
|
26
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
25
27
|
}, {
|
|
26
28
|
_id: string;
|
|
27
29
|
created_at: number;
|
|
@@ -30,6 +32,7 @@ export declare const NoteCommentSchema: z.ZodObject<{
|
|
|
30
32
|
type: "note";
|
|
31
33
|
created_by?: string | undefined;
|
|
32
34
|
updated_by?: string | undefined;
|
|
35
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
33
36
|
}>;
|
|
34
37
|
export declare const SystemInfoCommentSchema: z.ZodObject<{
|
|
35
38
|
_id: z.ZodString;
|
|
@@ -38,6 +41,7 @@ export declare const SystemInfoCommentSchema: z.ZodObject<{
|
|
|
38
41
|
} & {
|
|
39
42
|
created_by: z.ZodLiteral<"system">;
|
|
40
43
|
message: z.ZodString;
|
|
44
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
41
45
|
type: z.ZodLiteral<"system_info">;
|
|
42
46
|
updated_by: z.ZodLiteral<"system">;
|
|
43
47
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -52,6 +56,7 @@ export declare const SystemInfoCommentSchema: z.ZodObject<{
|
|
|
52
56
|
updated_by: "system";
|
|
53
57
|
message: string;
|
|
54
58
|
type: "system_info";
|
|
59
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
55
60
|
}, {
|
|
56
61
|
_id: string;
|
|
57
62
|
created_at: number;
|
|
@@ -60,6 +65,7 @@ export declare const SystemInfoCommentSchema: z.ZodObject<{
|
|
|
60
65
|
updated_by: "system";
|
|
61
66
|
message: string;
|
|
62
67
|
type: "system_info";
|
|
68
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
63
69
|
}>;
|
|
64
70
|
export declare const StatusChangedCommentSchema: z.ZodObject<{
|
|
65
71
|
_id: z.ZodString;
|
|
@@ -68,9 +74,10 @@ export declare const StatusChangedCommentSchema: z.ZodObject<{
|
|
|
68
74
|
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
69
75
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
70
76
|
} & {
|
|
71
|
-
curr_status: z.ZodString
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
curr_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
78
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
79
|
+
prev_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
80
|
+
type: z.ZodLiteral<"status_changed">;
|
|
74
81
|
}, "strip", z.ZodTypeAny, {
|
|
75
82
|
_id: string;
|
|
76
83
|
created_at: number & {
|
|
@@ -79,20 +86,22 @@ export declare const StatusChangedCommentSchema: z.ZodObject<{
|
|
|
79
86
|
updated_at: number & {
|
|
80
87
|
__brand: "UnixTimestamp";
|
|
81
88
|
};
|
|
82
|
-
type: "
|
|
83
|
-
curr_status: string;
|
|
84
|
-
prev_status: string;
|
|
89
|
+
type: "status_changed";
|
|
90
|
+
curr_status: string | boolean;
|
|
91
|
+
prev_status: string | boolean;
|
|
85
92
|
created_by?: string | undefined;
|
|
86
93
|
updated_by?: string | undefined;
|
|
94
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
87
95
|
}, {
|
|
88
96
|
_id: string;
|
|
89
97
|
created_at: number;
|
|
90
98
|
updated_at: number;
|
|
91
|
-
type: "
|
|
92
|
-
curr_status: string;
|
|
93
|
-
prev_status: string;
|
|
99
|
+
type: "status_changed";
|
|
100
|
+
curr_status: string | boolean;
|
|
101
|
+
prev_status: string | boolean;
|
|
94
102
|
created_by?: string | undefined;
|
|
95
103
|
updated_by?: string | undefined;
|
|
104
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
96
105
|
}>;
|
|
97
106
|
export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
98
107
|
_id: z.ZodString;
|
|
@@ -102,6 +111,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
102
111
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
103
112
|
} & {
|
|
104
113
|
message: z.ZodString;
|
|
114
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
105
115
|
type: z.ZodLiteral<"note">;
|
|
106
116
|
}, "strip", z.ZodTypeAny, {
|
|
107
117
|
_id: string;
|
|
@@ -115,6 +125,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
115
125
|
type: "note";
|
|
116
126
|
created_by?: string | undefined;
|
|
117
127
|
updated_by?: string | undefined;
|
|
128
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
118
129
|
}, {
|
|
119
130
|
_id: string;
|
|
120
131
|
created_at: number;
|
|
@@ -123,6 +134,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
123
134
|
type: "note";
|
|
124
135
|
created_by?: string | undefined;
|
|
125
136
|
updated_by?: string | undefined;
|
|
137
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
126
138
|
}>, z.ZodObject<{
|
|
127
139
|
_id: z.ZodString;
|
|
128
140
|
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
@@ -130,6 +142,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
130
142
|
} & {
|
|
131
143
|
created_by: z.ZodLiteral<"system">;
|
|
132
144
|
message: z.ZodString;
|
|
145
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
133
146
|
type: z.ZodLiteral<"system_info">;
|
|
134
147
|
updated_by: z.ZodLiteral<"system">;
|
|
135
148
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -144,6 +157,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
144
157
|
updated_by: "system";
|
|
145
158
|
message: string;
|
|
146
159
|
type: "system_info";
|
|
160
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
147
161
|
}, {
|
|
148
162
|
_id: string;
|
|
149
163
|
created_at: number;
|
|
@@ -152,6 +166,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
152
166
|
updated_by: "system";
|
|
153
167
|
message: string;
|
|
154
168
|
type: "system_info";
|
|
169
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
155
170
|
}>, z.ZodObject<{
|
|
156
171
|
_id: z.ZodString;
|
|
157
172
|
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
@@ -159,9 +174,10 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
159
174
|
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
160
175
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
161
176
|
} & {
|
|
162
|
-
curr_status: z.ZodString
|
|
163
|
-
|
|
164
|
-
|
|
177
|
+
curr_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
178
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
179
|
+
prev_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
180
|
+
type: z.ZodLiteral<"status_changed">;
|
|
165
181
|
}, "strip", z.ZodTypeAny, {
|
|
166
182
|
_id: string;
|
|
167
183
|
created_at: number & {
|
|
@@ -170,20 +186,22 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
170
186
|
updated_at: number & {
|
|
171
187
|
__brand: "UnixTimestamp";
|
|
172
188
|
};
|
|
173
|
-
type: "
|
|
174
|
-
curr_status: string;
|
|
175
|
-
prev_status: string;
|
|
189
|
+
type: "status_changed";
|
|
190
|
+
curr_status: string | boolean;
|
|
191
|
+
prev_status: string | boolean;
|
|
176
192
|
created_by?: string | undefined;
|
|
177
193
|
updated_by?: string | undefined;
|
|
194
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
178
195
|
}, {
|
|
179
196
|
_id: string;
|
|
180
197
|
created_at: number;
|
|
181
198
|
updated_at: number;
|
|
182
|
-
type: "
|
|
183
|
-
curr_status: string;
|
|
184
|
-
prev_status: string;
|
|
199
|
+
type: "status_changed";
|
|
200
|
+
curr_status: string | boolean;
|
|
201
|
+
prev_status: string | boolean;
|
|
185
202
|
created_by?: string | undefined;
|
|
186
203
|
updated_by?: string | undefined;
|
|
204
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
187
205
|
}>]>, {
|
|
188
206
|
_id: string;
|
|
189
207
|
created_at: number & {
|
|
@@ -196,6 +214,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
196
214
|
type: "note";
|
|
197
215
|
created_by?: string | undefined;
|
|
198
216
|
updated_by?: string | undefined;
|
|
217
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
199
218
|
} | {
|
|
200
219
|
_id: string;
|
|
201
220
|
created_at: number & {
|
|
@@ -208,6 +227,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
208
227
|
updated_by: "system";
|
|
209
228
|
message: string;
|
|
210
229
|
type: "system_info";
|
|
230
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
211
231
|
} | {
|
|
212
232
|
_id: string;
|
|
213
233
|
created_at: number & {
|
|
@@ -216,11 +236,12 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
216
236
|
updated_at: number & {
|
|
217
237
|
__brand: "UnixTimestamp";
|
|
218
238
|
};
|
|
219
|
-
type: "
|
|
220
|
-
curr_status: string;
|
|
221
|
-
prev_status: string;
|
|
239
|
+
type: "status_changed";
|
|
240
|
+
curr_status: string | boolean;
|
|
241
|
+
prev_status: string | boolean;
|
|
222
242
|
created_by?: string | undefined;
|
|
223
243
|
updated_by?: string | undefined;
|
|
244
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
224
245
|
}, {
|
|
225
246
|
_id: string;
|
|
226
247
|
created_at: number;
|
|
@@ -229,6 +250,7 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
229
250
|
type: "note";
|
|
230
251
|
created_by?: string | undefined;
|
|
231
252
|
updated_by?: string | undefined;
|
|
253
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
232
254
|
} | {
|
|
233
255
|
_id: string;
|
|
234
256
|
created_at: number;
|
|
@@ -237,16 +259,135 @@ export declare const CommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type",
|
|
|
237
259
|
updated_by: "system";
|
|
238
260
|
message: string;
|
|
239
261
|
type: "system_info";
|
|
262
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
240
263
|
} | {
|
|
241
264
|
_id: string;
|
|
242
265
|
created_at: number;
|
|
243
266
|
updated_at: number;
|
|
244
|
-
type: "
|
|
245
|
-
curr_status: string;
|
|
246
|
-
prev_status: string;
|
|
267
|
+
type: "status_changed";
|
|
268
|
+
curr_status: string | boolean;
|
|
269
|
+
prev_status: string | boolean;
|
|
247
270
|
created_by?: string | undefined;
|
|
248
271
|
updated_by?: string | undefined;
|
|
272
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
273
|
+
}>;
|
|
274
|
+
export declare const CreateCommentSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", [z.ZodObject<Omit<{
|
|
275
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
276
|
+
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
277
|
+
created_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
278
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
279
|
+
updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
280
|
+
message: z.ZodString;
|
|
281
|
+
type: z.ZodLiteral<"note">;
|
|
282
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
283
|
+
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
284
|
+
message: string;
|
|
285
|
+
type: "note";
|
|
286
|
+
_id?: string | undefined;
|
|
287
|
+
created_by?: string | undefined;
|
|
288
|
+
updated_by?: string | undefined;
|
|
289
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
290
|
+
}, {
|
|
291
|
+
message: string;
|
|
292
|
+
type: "note";
|
|
293
|
+
_id?: string | undefined;
|
|
294
|
+
created_by?: string | undefined;
|
|
295
|
+
updated_by?: string | undefined;
|
|
296
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
297
|
+
}>, z.ZodObject<Omit<{
|
|
298
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
299
|
+
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
300
|
+
created_by: z.ZodOptional<z.ZodLiteral<"system">>;
|
|
301
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
302
|
+
updated_by: z.ZodOptional<z.ZodLiteral<"system">>;
|
|
303
|
+
message: z.ZodString;
|
|
304
|
+
type: z.ZodLiteral<"system_info">;
|
|
305
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
306
|
+
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
307
|
+
message: string;
|
|
308
|
+
type: "system_info";
|
|
309
|
+
_id?: string | undefined;
|
|
310
|
+
created_by?: "system" | undefined;
|
|
311
|
+
updated_by?: "system" | undefined;
|
|
312
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
313
|
+
}, {
|
|
314
|
+
message: string;
|
|
315
|
+
type: "system_info";
|
|
316
|
+
_id?: string | undefined;
|
|
317
|
+
created_by?: "system" | undefined;
|
|
318
|
+
updated_by?: "system" | undefined;
|
|
319
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
320
|
+
}>, z.ZodObject<Omit<{
|
|
321
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
322
|
+
created_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
323
|
+
created_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
324
|
+
updated_at: z.ZodEffects<z.ZodNumber, import("./unix-timestamp.js").UnixTimestamp, number>;
|
|
325
|
+
updated_by: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
326
|
+
type: z.ZodLiteral<"status_changed">;
|
|
327
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
328
|
+
curr_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
329
|
+
prev_status: z.ZodUnion<[z.ZodString, z.ZodBoolean]>;
|
|
330
|
+
}, "created_at" | "updated_at">, "strip", z.ZodTypeAny, {
|
|
331
|
+
type: "status_changed";
|
|
332
|
+
curr_status: string | boolean;
|
|
333
|
+
prev_status: string | boolean;
|
|
334
|
+
_id?: string | undefined;
|
|
335
|
+
created_by?: string | undefined;
|
|
336
|
+
updated_by?: string | undefined;
|
|
337
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
338
|
+
}, {
|
|
339
|
+
type: "status_changed";
|
|
340
|
+
curr_status: string | boolean;
|
|
341
|
+
prev_status: string | boolean;
|
|
342
|
+
_id?: string | undefined;
|
|
343
|
+
created_by?: string | undefined;
|
|
344
|
+
updated_by?: string | undefined;
|
|
345
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
346
|
+
}>]>, {
|
|
347
|
+
message: string;
|
|
348
|
+
type: "note";
|
|
349
|
+
_id?: string | undefined;
|
|
350
|
+
created_by?: string | undefined;
|
|
351
|
+
updated_by?: string | undefined;
|
|
352
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
353
|
+
} | {
|
|
354
|
+
message: string;
|
|
355
|
+
type: "system_info";
|
|
356
|
+
_id?: string | undefined;
|
|
357
|
+
created_by?: "system" | undefined;
|
|
358
|
+
updated_by?: "system" | undefined;
|
|
359
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
360
|
+
} | {
|
|
361
|
+
type: "status_changed";
|
|
362
|
+
curr_status: string | boolean;
|
|
363
|
+
prev_status: string | boolean;
|
|
364
|
+
_id?: string | undefined;
|
|
365
|
+
created_by?: string | undefined;
|
|
366
|
+
updated_by?: string | undefined;
|
|
367
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
368
|
+
}, {
|
|
369
|
+
message: string;
|
|
370
|
+
type: "note";
|
|
371
|
+
_id?: string | undefined;
|
|
372
|
+
created_by?: string | undefined;
|
|
373
|
+
updated_by?: string | undefined;
|
|
374
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
375
|
+
} | {
|
|
376
|
+
message: string;
|
|
377
|
+
type: "system_info";
|
|
378
|
+
_id?: string | undefined;
|
|
379
|
+
created_by?: "system" | undefined;
|
|
380
|
+
updated_by?: "system" | undefined;
|
|
381
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
382
|
+
} | {
|
|
383
|
+
type: "status_changed";
|
|
384
|
+
curr_status: string | boolean;
|
|
385
|
+
prev_status: string | boolean;
|
|
386
|
+
_id?: string | undefined;
|
|
387
|
+
created_by?: string | undefined;
|
|
388
|
+
updated_by?: string | undefined;
|
|
389
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
249
390
|
}>;
|
|
250
391
|
export type Comment = z.infer<typeof CommentSchema>;
|
|
251
|
-
export type CreateCommentDto = z.infer<typeof
|
|
252
|
-
export type UpdateCommentDto = Partial<CreateCommentDto
|
|
392
|
+
export type CreateCommentDto = z.infer<typeof CreateCommentSchema>;
|
|
393
|
+
export type UpdateCommentDto = Partial<Omit<CreateCommentDto, '_id' | 'created_at' | 'created_by'>>;
|
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
import { DocumentSchema } from './document.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
/* * */
|
|
5
|
-
const COMMENT_TYPE_OPTIONS = ['
|
|
5
|
+
const COMMENT_TYPE_OPTIONS = ['status_changed', 'note', 'system_info'];
|
|
6
6
|
export const CommentTypeSchema = z.enum(COMMENT_TYPE_OPTIONS);
|
|
7
7
|
/* * */
|
|
8
8
|
export const NoteCommentSchema = DocumentSchema.extend({
|
|
9
9
|
message: z.string(),
|
|
10
|
+
metadata: z.record(z.unknown()).nullish(),
|
|
10
11
|
type: z.literal(CommentTypeSchema.enum.note),
|
|
11
12
|
});
|
|
12
13
|
export const SystemInfoCommentSchema = DocumentSchema.extend({
|
|
13
14
|
created_by: z.literal('system'),
|
|
14
15
|
message: z.string(),
|
|
16
|
+
metadata: z.record(z.unknown()).nullish(),
|
|
15
17
|
type: z.literal(CommentTypeSchema.enum.system_info),
|
|
16
18
|
updated_by: z.literal('system'),
|
|
17
19
|
});
|
|
18
20
|
export const StatusChangedCommentSchema = DocumentSchema.extend({
|
|
19
|
-
curr_status: z.string(),
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
curr_status: z.string().or(z.boolean()),
|
|
22
|
+
metadata: z.record(z.unknown()).nullish(),
|
|
23
|
+
prev_status: z.string().or(z.boolean()),
|
|
24
|
+
type: z.literal(CommentTypeSchema.enum.status_changed),
|
|
22
25
|
});
|
|
23
26
|
export const CommentSchema = z
|
|
24
27
|
.discriminatedUnion('type', [
|
|
@@ -27,7 +30,25 @@ export const CommentSchema = z
|
|
|
27
30
|
StatusChangedCommentSchema,
|
|
28
31
|
])
|
|
29
32
|
.superRefine((data, ctx) => {
|
|
30
|
-
if (data.type === CommentTypeSchema.enum.
|
|
33
|
+
if (data.type === CommentTypeSchema.enum.status_changed) {
|
|
34
|
+
const d = data;
|
|
35
|
+
if (d.curr_status === d.prev_status) {
|
|
36
|
+
ctx.addIssue({
|
|
37
|
+
code: z.ZodIssueCode.custom,
|
|
38
|
+
message: 'curr_status and prev_status must differ',
|
|
39
|
+
path: ['curr_status'],
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
export const CreateCommentSchema = z
|
|
45
|
+
.discriminatedUnion('type', [
|
|
46
|
+
NoteCommentSchema.partial({ _id: true, created_by: true, updated_by: true }).omit({ created_at: true, updated_at: true }),
|
|
47
|
+
SystemInfoCommentSchema.partial({ _id: true, created_by: true, updated_by: true }).omit({ created_at: true, updated_at: true }),
|
|
48
|
+
StatusChangedCommentSchema.partial({ _id: true, created_by: true, updated_by: true }).omit({ created_at: true, updated_at: true }),
|
|
49
|
+
])
|
|
50
|
+
.superRefine((data, ctx) => {
|
|
51
|
+
if (data.type === CommentTypeSchema.enum.status_changed) {
|
|
31
52
|
const d = data;
|
|
32
53
|
if (d.curr_status === d.prev_status) {
|
|
33
54
|
ctx.addIssue({
|
package/dist/src/file.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export declare const FileSchema: z.ZodObject<{
|
|
|
29
29
|
name: string;
|
|
30
30
|
resource_id: string;
|
|
31
31
|
size: number;
|
|
32
|
-
description?: string | null | undefined;
|
|
33
32
|
metadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
description?: string | null | undefined;
|
|
34
34
|
url?: string | null | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
_id: string;
|
|
@@ -43,8 +43,8 @@ export declare const FileSchema: z.ZodObject<{
|
|
|
43
43
|
name: string;
|
|
44
44
|
resource_id: string;
|
|
45
45
|
size: number;
|
|
46
|
-
description?: string | null | undefined;
|
|
47
46
|
metadata?: Record<string, unknown> | null | undefined;
|
|
47
|
+
description?: string | null | undefined;
|
|
48
48
|
url?: string | null | undefined;
|
|
49
49
|
}>;
|
|
50
50
|
export declare const CreateFileSchema: z.ZodObject<Omit<{
|
|
@@ -70,8 +70,8 @@ export declare const CreateFileSchema: z.ZodObject<Omit<{
|
|
|
70
70
|
name: string;
|
|
71
71
|
resource_id: string;
|
|
72
72
|
size: number;
|
|
73
|
-
description?: string | null | undefined;
|
|
74
73
|
metadata?: Record<string, unknown> | null | undefined;
|
|
74
|
+
description?: string | null | undefined;
|
|
75
75
|
url?: string | null | undefined;
|
|
76
76
|
}, {
|
|
77
77
|
created_by: string;
|
|
@@ -81,37 +81,37 @@ export declare const CreateFileSchema: z.ZodObject<Omit<{
|
|
|
81
81
|
name: string;
|
|
82
82
|
resource_id: string;
|
|
83
83
|
size: number;
|
|
84
|
-
description?: string | null | undefined;
|
|
85
84
|
metadata?: Record<string, unknown> | null | undefined;
|
|
85
|
+
description?: string | null | undefined;
|
|
86
86
|
url?: string | null | undefined;
|
|
87
87
|
}>;
|
|
88
88
|
export declare const UpdateFileSchema: z.ZodObject<{
|
|
89
89
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
90
90
|
type: z.ZodOptional<z.ZodString>;
|
|
91
|
+
metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
91
92
|
scope: z.ZodOptional<z.ZodString>;
|
|
92
93
|
name: z.ZodOptional<z.ZodString>;
|
|
93
94
|
description: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
94
|
-
metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
95
95
|
resource_id: z.ZodOptional<z.ZodString>;
|
|
96
96
|
size: z.ZodOptional<z.ZodNumber>;
|
|
97
97
|
url: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
98
98
|
}, "strict", z.ZodTypeAny, {
|
|
99
99
|
updated_by?: string | undefined;
|
|
100
100
|
type?: string | undefined;
|
|
101
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
101
102
|
scope?: string | undefined;
|
|
102
103
|
name?: string | undefined;
|
|
103
104
|
description?: string | null | undefined;
|
|
104
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
105
105
|
resource_id?: string | undefined;
|
|
106
106
|
size?: number | undefined;
|
|
107
107
|
url?: string | null | undefined;
|
|
108
108
|
}, {
|
|
109
109
|
updated_by?: string | undefined;
|
|
110
110
|
type?: string | undefined;
|
|
111
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
111
112
|
scope?: string | undefined;
|
|
112
113
|
name?: string | undefined;
|
|
113
114
|
description?: string | null | undefined;
|
|
114
|
-
metadata?: Record<string, unknown> | null | undefined;
|
|
115
115
|
resource_id?: string | undefined;
|
|
116
116
|
size?: number | undefined;
|
|
117
117
|
url?: string | null | undefined;
|
|
@@ -14,6 +14,7 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
14
14
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
15
15
|
} & {
|
|
16
16
|
message: z.ZodString;
|
|
17
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
17
18
|
type: z.ZodLiteral<"note">;
|
|
18
19
|
}, "strip", z.ZodTypeAny, {
|
|
19
20
|
_id: string;
|
|
@@ -27,6 +28,7 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
27
28
|
type: "note";
|
|
28
29
|
created_by?: string | undefined;
|
|
29
30
|
updated_by?: string | undefined;
|
|
31
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
30
32
|
}, {
|
|
31
33
|
_id: string;
|
|
32
34
|
created_at: number;
|
|
@@ -35,6 +37,7 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
35
37
|
type: "note";
|
|
36
38
|
created_by?: string | undefined;
|
|
37
39
|
updated_by?: string | undefined;
|
|
40
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
38
41
|
}>, "many">;
|
|
39
42
|
is_locked: z.ZodDefault<z.ZodBoolean>;
|
|
40
43
|
ride_id: z.ZodString;
|
|
@@ -59,6 +62,7 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
59
62
|
type: "note";
|
|
60
63
|
created_by?: string | undefined;
|
|
61
64
|
updated_by?: string | undefined;
|
|
65
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
62
66
|
}[];
|
|
63
67
|
ride_id: string;
|
|
64
68
|
created_by?: string | undefined;
|
|
@@ -75,6 +79,7 @@ export declare const RideAuditSchema: z.ZodObject<{
|
|
|
75
79
|
type: "note";
|
|
76
80
|
created_by?: string | undefined;
|
|
77
81
|
updated_by?: string | undefined;
|
|
82
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
78
83
|
}[];
|
|
79
84
|
ride_id: string;
|
|
80
85
|
created_by?: string | undefined;
|
|
@@ -96,6 +101,7 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
96
101
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
97
102
|
} & {
|
|
98
103
|
message: z.ZodString;
|
|
104
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
99
105
|
type: z.ZodLiteral<"note">;
|
|
100
106
|
}, "strip", z.ZodTypeAny, {
|
|
101
107
|
_id: string;
|
|
@@ -109,6 +115,7 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
109
115
|
type: "note";
|
|
110
116
|
created_by?: string | undefined;
|
|
111
117
|
updated_by?: string | undefined;
|
|
118
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
112
119
|
}, {
|
|
113
120
|
_id: string;
|
|
114
121
|
created_at: number;
|
|
@@ -117,6 +124,7 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
117
124
|
type: "note";
|
|
118
125
|
created_by?: string | undefined;
|
|
119
126
|
updated_by?: string | undefined;
|
|
127
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
120
128
|
}>, "many">;
|
|
121
129
|
ride_id: z.ZodString;
|
|
122
130
|
}, "created_at" | "updated_at">, "strict", z.ZodTypeAny, {
|
|
@@ -133,6 +141,7 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
133
141
|
type: "note";
|
|
134
142
|
created_by?: string | undefined;
|
|
135
143
|
updated_by?: string | undefined;
|
|
144
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
136
145
|
}[];
|
|
137
146
|
ride_id: string;
|
|
138
147
|
_id?: string | undefined;
|
|
@@ -147,6 +156,7 @@ export declare const CreateRideAuditSchema: z.ZodObject<Omit<{
|
|
|
147
156
|
type: "note";
|
|
148
157
|
created_by?: string | undefined;
|
|
149
158
|
updated_by?: string | undefined;
|
|
159
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
150
160
|
}[];
|
|
151
161
|
ride_id: string;
|
|
152
162
|
_id?: string | undefined;
|
|
@@ -166,6 +176,7 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
166
176
|
updated_by: z.ZodOptional<z.ZodString>;
|
|
167
177
|
} & {
|
|
168
178
|
message: z.ZodString;
|
|
179
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
169
180
|
type: z.ZodLiteral<"note">;
|
|
170
181
|
}, "strip", z.ZodTypeAny, {
|
|
171
182
|
_id: string;
|
|
@@ -179,6 +190,7 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
179
190
|
type: "note";
|
|
180
191
|
created_by?: string | undefined;
|
|
181
192
|
updated_by?: string | undefined;
|
|
193
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
182
194
|
}, {
|
|
183
195
|
_id: string;
|
|
184
196
|
created_at: number;
|
|
@@ -187,6 +199,7 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
187
199
|
type: "note";
|
|
188
200
|
created_by?: string | undefined;
|
|
189
201
|
updated_by?: string | undefined;
|
|
202
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
190
203
|
}>, "many">>;
|
|
191
204
|
ride_id: z.ZodOptional<z.ZodString>;
|
|
192
205
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -205,6 +218,7 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
205
218
|
type: "note";
|
|
206
219
|
created_by?: string | undefined;
|
|
207
220
|
updated_by?: string | undefined;
|
|
221
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
208
222
|
}[] | undefined;
|
|
209
223
|
ride_id?: string | undefined;
|
|
210
224
|
}, {
|
|
@@ -219,6 +233,7 @@ export declare const UpdateRideAuditSchema: z.ZodObject<{
|
|
|
219
233
|
type: "note";
|
|
220
234
|
created_by?: string | undefined;
|
|
221
235
|
updated_by?: string | undefined;
|
|
236
|
+
metadata?: Record<string, unknown> | null | undefined;
|
|
222
237
|
}[] | undefined;
|
|
223
238
|
ride_id?: string | undefined;
|
|
224
239
|
}>;
|