@tmlmobilidade/types 20250827.1644.13 → 20250827.1858.35

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.
@@ -0,0 +1,311 @@
1
+ import { z } from 'zod';
2
+ export declare const ACCEPTANCE_STATUS_OPTIONS: readonly ["justification_required", "under_review", "accepted", "rejected"];
3
+ export declare const AcceptanceStatusSchema: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
4
+ export declare const RideJustificationSchema: z.ZodObject<{
5
+ comments: z.ZodDefault<z.ZodArray<z.ZodObject<{
6
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
7
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
8
+ } & {
9
+ _id: z.ZodString;
10
+ text: z.ZodString;
11
+ user_id: z.ZodString;
12
+ }, "strict", z.ZodTypeAny, {
13
+ _id: string;
14
+ text: string;
15
+ user_id: string;
16
+ created_at?: (number & {
17
+ __brand: "UnixTimestamp";
18
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
19
+ updated_at?: (number & {
20
+ __brand: "UnixTimestamp";
21
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
22
+ }, {
23
+ _id: string;
24
+ text: string;
25
+ user_id: string;
26
+ created_at?: number | null | undefined;
27
+ updated_at?: number | null | undefined;
28
+ }>, "many">>;
29
+ file_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
30
+ pto_message: z.ZodDefault<z.ZodString>;
31
+ updated_trip_id: z.ZodNullable<z.ZodString>;
32
+ }, "strict", z.ZodTypeAny, {
33
+ file_ids: string[];
34
+ comments: {
35
+ _id: string;
36
+ text: string;
37
+ user_id: string;
38
+ created_at?: (number & {
39
+ __brand: "UnixTimestamp";
40
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
41
+ updated_at?: (number & {
42
+ __brand: "UnixTimestamp";
43
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
44
+ }[];
45
+ pto_message: string;
46
+ updated_trip_id: string | null;
47
+ }, {
48
+ updated_trip_id: string | null;
49
+ file_ids?: string[] | undefined;
50
+ comments?: {
51
+ _id: string;
52
+ text: string;
53
+ user_id: string;
54
+ created_at?: number | null | undefined;
55
+ updated_at?: number | null | undefined;
56
+ }[] | undefined;
57
+ pto_message?: string | undefined;
58
+ }>;
59
+ export type RideJustification = z.infer<typeof RideJustificationSchema>;
60
+ export declare const RidePaymentSchema: z.ZodObject<{
61
+ acceptance_status: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
62
+ comments: z.ZodDefault<z.ZodArray<z.ZodObject<{
63
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
64
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
65
+ } & {
66
+ _id: z.ZodString;
67
+ text: z.ZodString;
68
+ user_id: z.ZodString;
69
+ }, "strict", z.ZodTypeAny, {
70
+ _id: string;
71
+ text: string;
72
+ user_id: string;
73
+ created_at?: (number & {
74
+ __brand: "UnixTimestamp";
75
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
76
+ updated_at?: (number & {
77
+ __brand: "UnixTimestamp";
78
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
79
+ }, {
80
+ _id: string;
81
+ text: string;
82
+ user_id: string;
83
+ created_at?: number | null | undefined;
84
+ updated_at?: number | null | undefined;
85
+ }>, "many">>;
86
+ file_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
87
+ pto_message: z.ZodDefault<z.ZodString>;
88
+ updated_trip_id: z.ZodNullable<z.ZodString>;
89
+ }, "strict", z.ZodTypeAny, {
90
+ file_ids: string[];
91
+ comments: {
92
+ _id: string;
93
+ text: string;
94
+ user_id: string;
95
+ created_at?: (number & {
96
+ __brand: "UnixTimestamp";
97
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
98
+ updated_at?: (number & {
99
+ __brand: "UnixTimestamp";
100
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
101
+ }[];
102
+ pto_message: string;
103
+ updated_trip_id: string | null;
104
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
105
+ }, {
106
+ updated_trip_id: string | null;
107
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
108
+ file_ids?: string[] | undefined;
109
+ comments?: {
110
+ _id: string;
111
+ text: string;
112
+ user_id: string;
113
+ created_at?: number | null | undefined;
114
+ updated_at?: number | null | undefined;
115
+ }[] | undefined;
116
+ pto_message?: string | undefined;
117
+ }>;
118
+ export type RidePayment = z.infer<typeof RidePaymentSchema>;
119
+ export declare const RideAnnotationSchema: z.ZodObject<{
120
+ _id: z.ZodString;
121
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
122
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
123
+ } & {
124
+ acceptance_status: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
125
+ justification: z.ZodObject<{
126
+ comments: z.ZodDefault<z.ZodArray<z.ZodObject<{
127
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
128
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
129
+ } & {
130
+ _id: z.ZodString;
131
+ text: z.ZodString;
132
+ user_id: z.ZodString;
133
+ }, "strict", z.ZodTypeAny, {
134
+ _id: string;
135
+ text: string;
136
+ user_id: string;
137
+ created_at?: (number & {
138
+ __brand: "UnixTimestamp";
139
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
140
+ updated_at?: (number & {
141
+ __brand: "UnixTimestamp";
142
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
143
+ }, {
144
+ _id: string;
145
+ text: string;
146
+ user_id: string;
147
+ created_at?: number | null | undefined;
148
+ updated_at?: number | null | undefined;
149
+ }>, "many">>;
150
+ file_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
151
+ pto_message: z.ZodDefault<z.ZodString>;
152
+ updated_trip_id: z.ZodNullable<z.ZodString>;
153
+ }, "strict", z.ZodTypeAny, {
154
+ file_ids: string[];
155
+ comments: {
156
+ _id: string;
157
+ text: string;
158
+ user_id: string;
159
+ created_at?: (number & {
160
+ __brand: "UnixTimestamp";
161
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
162
+ updated_at?: (number & {
163
+ __brand: "UnixTimestamp";
164
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
165
+ }[];
166
+ pto_message: string;
167
+ updated_trip_id: string | null;
168
+ }, {
169
+ updated_trip_id: string | null;
170
+ file_ids?: string[] | undefined;
171
+ comments?: {
172
+ _id: string;
173
+ text: string;
174
+ user_id: string;
175
+ created_at?: number | null | undefined;
176
+ updated_at?: number | null | undefined;
177
+ }[] | undefined;
178
+ pto_message?: string | undefined;
179
+ }>;
180
+ payment: z.ZodObject<{
181
+ acceptance_status: z.ZodEnum<["justification_required", "under_review", "accepted", "rejected"]>;
182
+ comments: z.ZodDefault<z.ZodArray<z.ZodObject<{
183
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
184
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodBranded<z.ZodEffects<z.ZodNumber, import("../_common/unix-timestamp.js").UnixTimestamp, number>, "UnixTimestamp">>>;
185
+ } & {
186
+ _id: z.ZodString;
187
+ text: z.ZodString;
188
+ user_id: z.ZodString;
189
+ }, "strict", z.ZodTypeAny, {
190
+ _id: string;
191
+ text: string;
192
+ user_id: string;
193
+ created_at?: (number & {
194
+ __brand: "UnixTimestamp";
195
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
196
+ updated_at?: (number & {
197
+ __brand: "UnixTimestamp";
198
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
199
+ }, {
200
+ _id: string;
201
+ text: string;
202
+ user_id: string;
203
+ created_at?: number | null | undefined;
204
+ updated_at?: number | null | undefined;
205
+ }>, "many">>;
206
+ file_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
207
+ pto_message: z.ZodDefault<z.ZodString>;
208
+ updated_trip_id: z.ZodNullable<z.ZodString>;
209
+ }, "strict", z.ZodTypeAny, {
210
+ file_ids: string[];
211
+ comments: {
212
+ _id: string;
213
+ text: string;
214
+ user_id: string;
215
+ created_at?: (number & {
216
+ __brand: "UnixTimestamp";
217
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
218
+ updated_at?: (number & {
219
+ __brand: "UnixTimestamp";
220
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
221
+ }[];
222
+ pto_message: string;
223
+ updated_trip_id: string | null;
224
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
225
+ }, {
226
+ updated_trip_id: string | null;
227
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
228
+ file_ids?: string[] | undefined;
229
+ comments?: {
230
+ _id: string;
231
+ text: string;
232
+ user_id: string;
233
+ created_at?: number | null | undefined;
234
+ updated_at?: number | null | undefined;
235
+ }[] | undefined;
236
+ pto_message?: string | undefined;
237
+ }>;
238
+ }, "strict", z.ZodTypeAny, {
239
+ _id: string;
240
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
241
+ justification: {
242
+ file_ids: string[];
243
+ comments: {
244
+ _id: string;
245
+ text: string;
246
+ user_id: string;
247
+ created_at?: (number & {
248
+ __brand: "UnixTimestamp";
249
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
250
+ updated_at?: (number & {
251
+ __brand: "UnixTimestamp";
252
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
253
+ }[];
254
+ pto_message: string;
255
+ updated_trip_id: string | null;
256
+ };
257
+ payment: {
258
+ file_ids: string[];
259
+ comments: {
260
+ _id: string;
261
+ text: string;
262
+ user_id: string;
263
+ created_at?: (number & {
264
+ __brand: "UnixTimestamp";
265
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
266
+ updated_at?: (number & {
267
+ __brand: "UnixTimestamp";
268
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
269
+ }[];
270
+ pto_message: string;
271
+ updated_trip_id: string | null;
272
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
273
+ };
274
+ created_at?: (number & {
275
+ __brand: "UnixTimestamp";
276
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
277
+ updated_at?: (number & {
278
+ __brand: "UnixTimestamp";
279
+ } & z.BRAND<"UnixTimestamp">) | null | undefined;
280
+ }, {
281
+ _id: string;
282
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
283
+ justification: {
284
+ updated_trip_id: string | null;
285
+ file_ids?: string[] | undefined;
286
+ comments?: {
287
+ _id: string;
288
+ text: string;
289
+ user_id: string;
290
+ created_at?: number | null | undefined;
291
+ updated_at?: number | null | undefined;
292
+ }[] | undefined;
293
+ pto_message?: string | undefined;
294
+ };
295
+ payment: {
296
+ updated_trip_id: string | null;
297
+ acceptance_status: "accepted" | "justification_required" | "under_review" | "rejected";
298
+ file_ids?: string[] | undefined;
299
+ comments?: {
300
+ _id: string;
301
+ text: string;
302
+ user_id: string;
303
+ created_at?: number | null | undefined;
304
+ updated_at?: number | null | undefined;
305
+ }[] | undefined;
306
+ pto_message?: string | undefined;
307
+ };
308
+ created_at?: number | null | undefined;
309
+ updated_at?: number | null | undefined;
310
+ }>;
311
+ export type RideAnnotation = z.infer<typeof RideAnnotationSchema>;
@@ -0,0 +1,42 @@
1
+ /* * */
2
+ import { CommentSchema } from '../_common/comment.js';
3
+ import { DocumentSchema } from '../_common/document.js';
4
+ import { z } from 'zod';
5
+ /* * */
6
+ export const ACCEPTANCE_STATUS_OPTIONS = ['justification_required', 'under_review', 'accepted', 'rejected'];
7
+ export const AcceptanceStatusSchema = z.enum(ACCEPTANCE_STATUS_OPTIONS);
8
+ /* * */
9
+ export const RideJustificationSchema = z.object({
10
+ comments: z.array(CommentSchema).default([]),
11
+ file_ids: z.array(z.string()).default([]),
12
+ pto_message: z.string().min(2).max(5000).default(''),
13
+ updated_trip_id: z.string().min(2).max(100).nullable(),
14
+ }).strict();
15
+ /* * */
16
+ export const RidePaymentSchema = z.object({
17
+ acceptance_status: AcceptanceStatusSchema,
18
+ comments: z.array(CommentSchema).default([]),
19
+ file_ids: z.array(z.string()).default([]),
20
+ pto_message: z.string().min(2).max(5000).default(''),
21
+ updated_trip_id: z.string().min(2).max(100).nullable(),
22
+ }).strict();
23
+ /* * */
24
+ export const RideAnnotationSchema = DocumentSchema.extend({
25
+ acceptance_status: AcceptanceStatusSchema,
26
+ justification: RideJustificationSchema,
27
+ payment: RidePaymentSchema,
28
+ }).strict();
29
+ /**
30
+ * Uma ride-annotation é gerada 3 dias depois da hora prevista de conclusão.
31
+ *
32
+ */
33
+ const rideAnnotation = {
34
+ _id: 'some-id',
35
+ _ride_id: '123',
36
+ justification: {
37
+ comments: [],
38
+ file_ids: [],
39
+ pto_message: '',
40
+ updated_trip_id: null,
41
+ },
42
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmlmobilidade/types",
3
- "version": "20250827.1644.13",
3
+ "version": "20250827.1858.35",
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",