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