@_henriquewilson/gabirubi-domain 1.5.2 → 1.5.4
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/model/iugu/iugu-charge.d.mts +2 -2
- package/dist/model/iugu/iugu-charge.d.ts +2 -2
- package/dist/model/iugu/iugu-client.d.mts +12 -12
- package/dist/model/iugu/iugu-client.d.ts +12 -12
- package/dist/model/journey/chat.d.mts +18 -0
- package/dist/model/journey/chat.d.ts +18 -0
- package/dist/model/journey/chat.js +2 -2
- package/dist/model/journey/chat.js.map +1 -1
- package/dist/model/journey/chat.mjs +2 -2
- package/dist/model/journey/chat.mjs.map +1 -1
- package/dist/model/purchase.d.mts +8 -0
- package/dist/model/purchase.d.ts +8 -0
- package/dist/model/purchase.js +1 -0
- package/dist/model/purchase.js.map +1 -1
- package/dist/model/purchase.mjs +1 -0
- package/dist/model/purchase.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -27,9 +27,9 @@ declare const IuguChargeSchema: z.ZodObject<{
|
|
|
27
27
|
pdf: string;
|
|
28
28
|
invoice_id: string;
|
|
29
29
|
LR: string;
|
|
30
|
-
reversible?: string | null | undefined;
|
|
31
30
|
brand?: string | null | undefined;
|
|
32
31
|
bin?: string | null | undefined;
|
|
32
|
+
reversible?: string | null | undefined;
|
|
33
33
|
last4?: string | null | undefined;
|
|
34
34
|
issuer?: string | null | undefined;
|
|
35
35
|
identification?: string | null | undefined;
|
|
@@ -44,9 +44,9 @@ declare const IuguChargeSchema: z.ZodObject<{
|
|
|
44
44
|
pdf: string;
|
|
45
45
|
invoice_id: string;
|
|
46
46
|
LR: string;
|
|
47
|
-
reversible?: string | null | undefined;
|
|
48
47
|
brand?: string | null | undefined;
|
|
49
48
|
bin?: string | null | undefined;
|
|
49
|
+
reversible?: string | null | undefined;
|
|
50
50
|
last4?: string | null | undefined;
|
|
51
51
|
issuer?: string | null | undefined;
|
|
52
52
|
identification?: string | null | undefined;
|
|
@@ -27,9 +27,9 @@ declare const IuguChargeSchema: z.ZodObject<{
|
|
|
27
27
|
pdf: string;
|
|
28
28
|
invoice_id: string;
|
|
29
29
|
LR: string;
|
|
30
|
-
reversible?: string | null | undefined;
|
|
31
30
|
brand?: string | null | undefined;
|
|
32
31
|
bin?: string | null | undefined;
|
|
32
|
+
reversible?: string | null | undefined;
|
|
33
33
|
last4?: string | null | undefined;
|
|
34
34
|
issuer?: string | null | undefined;
|
|
35
35
|
identification?: string | null | undefined;
|
|
@@ -44,9 +44,9 @@ declare const IuguChargeSchema: z.ZodObject<{
|
|
|
44
44
|
pdf: string;
|
|
45
45
|
invoice_id: string;
|
|
46
46
|
LR: string;
|
|
47
|
-
reversible?: string | null | undefined;
|
|
48
47
|
brand?: string | null | undefined;
|
|
49
48
|
bin?: string | null | undefined;
|
|
49
|
+
reversible?: string | null | undefined;
|
|
50
50
|
last4?: string | null | undefined;
|
|
51
51
|
issuer?: string | null | undefined;
|
|
52
52
|
identification?: string | null | undefined;
|
|
@@ -12,9 +12,9 @@ declare const dataSchema: z.ZodObject<{
|
|
|
12
12
|
masked_number: z.ZodString;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
brand: string;
|
|
15
|
-
bin: string;
|
|
16
15
|
holder_name: string;
|
|
17
16
|
display_number: string;
|
|
17
|
+
bin: string;
|
|
18
18
|
year: number;
|
|
19
19
|
month: number;
|
|
20
20
|
last_digits: string;
|
|
@@ -22,9 +22,9 @@ declare const dataSchema: z.ZodObject<{
|
|
|
22
22
|
masked_number: string;
|
|
23
23
|
}, {
|
|
24
24
|
brand: string;
|
|
25
|
-
bin: string;
|
|
26
25
|
holder_name: string;
|
|
27
26
|
display_number: string;
|
|
27
|
+
bin: string;
|
|
28
28
|
year: number;
|
|
29
29
|
month: number;
|
|
30
30
|
last_digits: string;
|
|
@@ -47,9 +47,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
47
47
|
masked_number: z.ZodString;
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
49
|
brand: string;
|
|
50
|
-
bin: string;
|
|
51
50
|
holder_name: string;
|
|
52
51
|
display_number: string;
|
|
52
|
+
bin: string;
|
|
53
53
|
year: number;
|
|
54
54
|
month: number;
|
|
55
55
|
last_digits: string;
|
|
@@ -57,9 +57,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
57
57
|
masked_number: string;
|
|
58
58
|
}, {
|
|
59
59
|
brand: string;
|
|
60
|
-
bin: string;
|
|
61
60
|
holder_name: string;
|
|
62
61
|
display_number: string;
|
|
62
|
+
bin: string;
|
|
63
63
|
year: number;
|
|
64
64
|
month: number;
|
|
65
65
|
last_digits: string;
|
|
@@ -72,9 +72,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
72
72
|
item_type: string;
|
|
73
73
|
data: {
|
|
74
74
|
brand: string;
|
|
75
|
-
bin: string;
|
|
76
75
|
holder_name: string;
|
|
77
76
|
display_number: string;
|
|
77
|
+
bin: string;
|
|
78
78
|
year: number;
|
|
79
79
|
month: number;
|
|
80
80
|
last_digits: string;
|
|
@@ -87,9 +87,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
87
87
|
item_type: string;
|
|
88
88
|
data: {
|
|
89
89
|
brand: string;
|
|
90
|
-
bin: string;
|
|
91
90
|
holder_name: string;
|
|
92
91
|
display_number: string;
|
|
92
|
+
bin: string;
|
|
93
93
|
year: number;
|
|
94
94
|
month: number;
|
|
95
95
|
last_digits: string;
|
|
@@ -139,9 +139,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
139
139
|
masked_number: z.ZodString;
|
|
140
140
|
}, "strip", z.ZodTypeAny, {
|
|
141
141
|
brand: string;
|
|
142
|
-
bin: string;
|
|
143
142
|
holder_name: string;
|
|
144
143
|
display_number: string;
|
|
144
|
+
bin: string;
|
|
145
145
|
year: number;
|
|
146
146
|
month: number;
|
|
147
147
|
last_digits: string;
|
|
@@ -149,9 +149,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
149
149
|
masked_number: string;
|
|
150
150
|
}, {
|
|
151
151
|
brand: string;
|
|
152
|
-
bin: string;
|
|
153
152
|
holder_name: string;
|
|
154
153
|
display_number: string;
|
|
154
|
+
bin: string;
|
|
155
155
|
year: number;
|
|
156
156
|
month: number;
|
|
157
157
|
last_digits: string;
|
|
@@ -164,9 +164,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
164
164
|
item_type: string;
|
|
165
165
|
data: {
|
|
166
166
|
brand: string;
|
|
167
|
-
bin: string;
|
|
168
167
|
holder_name: string;
|
|
169
168
|
display_number: string;
|
|
169
|
+
bin: string;
|
|
170
170
|
year: number;
|
|
171
171
|
month: number;
|
|
172
172
|
last_digits: string;
|
|
@@ -179,9 +179,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
179
179
|
item_type: string;
|
|
180
180
|
data: {
|
|
181
181
|
brand: string;
|
|
182
|
-
bin: string;
|
|
183
182
|
holder_name: string;
|
|
184
183
|
display_number: string;
|
|
184
|
+
bin: string;
|
|
185
185
|
year: number;
|
|
186
186
|
month: number;
|
|
187
187
|
last_digits: string;
|
|
@@ -216,9 +216,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
216
216
|
item_type: string;
|
|
217
217
|
data: {
|
|
218
218
|
brand: string;
|
|
219
|
-
bin: string;
|
|
220
219
|
holder_name: string;
|
|
221
220
|
display_number: string;
|
|
221
|
+
bin: string;
|
|
222
222
|
year: number;
|
|
223
223
|
month: number;
|
|
224
224
|
last_digits: string;
|
|
@@ -253,9 +253,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
253
253
|
item_type: string;
|
|
254
254
|
data: {
|
|
255
255
|
brand: string;
|
|
256
|
-
bin: string;
|
|
257
256
|
holder_name: string;
|
|
258
257
|
display_number: string;
|
|
258
|
+
bin: string;
|
|
259
259
|
year: number;
|
|
260
260
|
month: number;
|
|
261
261
|
last_digits: string;
|
|
@@ -12,9 +12,9 @@ declare const dataSchema: z.ZodObject<{
|
|
|
12
12
|
masked_number: z.ZodString;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
brand: string;
|
|
15
|
-
bin: string;
|
|
16
15
|
holder_name: string;
|
|
17
16
|
display_number: string;
|
|
17
|
+
bin: string;
|
|
18
18
|
year: number;
|
|
19
19
|
month: number;
|
|
20
20
|
last_digits: string;
|
|
@@ -22,9 +22,9 @@ declare const dataSchema: z.ZodObject<{
|
|
|
22
22
|
masked_number: string;
|
|
23
23
|
}, {
|
|
24
24
|
brand: string;
|
|
25
|
-
bin: string;
|
|
26
25
|
holder_name: string;
|
|
27
26
|
display_number: string;
|
|
27
|
+
bin: string;
|
|
28
28
|
year: number;
|
|
29
29
|
month: number;
|
|
30
30
|
last_digits: string;
|
|
@@ -47,9 +47,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
47
47
|
masked_number: z.ZodString;
|
|
48
48
|
}, "strip", z.ZodTypeAny, {
|
|
49
49
|
brand: string;
|
|
50
|
-
bin: string;
|
|
51
50
|
holder_name: string;
|
|
52
51
|
display_number: string;
|
|
52
|
+
bin: string;
|
|
53
53
|
year: number;
|
|
54
54
|
month: number;
|
|
55
55
|
last_digits: string;
|
|
@@ -57,9 +57,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
57
57
|
masked_number: string;
|
|
58
58
|
}, {
|
|
59
59
|
brand: string;
|
|
60
|
-
bin: string;
|
|
61
60
|
holder_name: string;
|
|
62
61
|
display_number: string;
|
|
62
|
+
bin: string;
|
|
63
63
|
year: number;
|
|
64
64
|
month: number;
|
|
65
65
|
last_digits: string;
|
|
@@ -72,9 +72,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
72
72
|
item_type: string;
|
|
73
73
|
data: {
|
|
74
74
|
brand: string;
|
|
75
|
-
bin: string;
|
|
76
75
|
holder_name: string;
|
|
77
76
|
display_number: string;
|
|
77
|
+
bin: string;
|
|
78
78
|
year: number;
|
|
79
79
|
month: number;
|
|
80
80
|
last_digits: string;
|
|
@@ -87,9 +87,9 @@ declare const PaymentMethodSchema: z.ZodObject<{
|
|
|
87
87
|
item_type: string;
|
|
88
88
|
data: {
|
|
89
89
|
brand: string;
|
|
90
|
-
bin: string;
|
|
91
90
|
holder_name: string;
|
|
92
91
|
display_number: string;
|
|
92
|
+
bin: string;
|
|
93
93
|
year: number;
|
|
94
94
|
month: number;
|
|
95
95
|
last_digits: string;
|
|
@@ -139,9 +139,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
139
139
|
masked_number: z.ZodString;
|
|
140
140
|
}, "strip", z.ZodTypeAny, {
|
|
141
141
|
brand: string;
|
|
142
|
-
bin: string;
|
|
143
142
|
holder_name: string;
|
|
144
143
|
display_number: string;
|
|
144
|
+
bin: string;
|
|
145
145
|
year: number;
|
|
146
146
|
month: number;
|
|
147
147
|
last_digits: string;
|
|
@@ -149,9 +149,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
149
149
|
masked_number: string;
|
|
150
150
|
}, {
|
|
151
151
|
brand: string;
|
|
152
|
-
bin: string;
|
|
153
152
|
holder_name: string;
|
|
154
153
|
display_number: string;
|
|
154
|
+
bin: string;
|
|
155
155
|
year: number;
|
|
156
156
|
month: number;
|
|
157
157
|
last_digits: string;
|
|
@@ -164,9 +164,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
164
164
|
item_type: string;
|
|
165
165
|
data: {
|
|
166
166
|
brand: string;
|
|
167
|
-
bin: string;
|
|
168
167
|
holder_name: string;
|
|
169
168
|
display_number: string;
|
|
169
|
+
bin: string;
|
|
170
170
|
year: number;
|
|
171
171
|
month: number;
|
|
172
172
|
last_digits: string;
|
|
@@ -179,9 +179,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
179
179
|
item_type: string;
|
|
180
180
|
data: {
|
|
181
181
|
brand: string;
|
|
182
|
-
bin: string;
|
|
183
182
|
holder_name: string;
|
|
184
183
|
display_number: string;
|
|
184
|
+
bin: string;
|
|
185
185
|
year: number;
|
|
186
186
|
month: number;
|
|
187
187
|
last_digits: string;
|
|
@@ -216,9 +216,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
216
216
|
item_type: string;
|
|
217
217
|
data: {
|
|
218
218
|
brand: string;
|
|
219
|
-
bin: string;
|
|
220
219
|
holder_name: string;
|
|
221
220
|
display_number: string;
|
|
221
|
+
bin: string;
|
|
222
222
|
year: number;
|
|
223
223
|
month: number;
|
|
224
224
|
last_digits: string;
|
|
@@ -253,9 +253,9 @@ declare const IuguClientSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
253
253
|
item_type: string;
|
|
254
254
|
data: {
|
|
255
255
|
brand: string;
|
|
256
|
-
bin: string;
|
|
257
256
|
holder_name: string;
|
|
258
257
|
display_number: string;
|
|
258
|
+
bin: string;
|
|
259
259
|
year: number;
|
|
260
260
|
month: number;
|
|
261
261
|
last_digits: string;
|
|
@@ -519,6 +519,8 @@ declare const ChatSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
519
519
|
senderId?: unknown;
|
|
520
520
|
sentAt?: unknown;
|
|
521
521
|
}>>;
|
|
522
|
+
isOpen: z.ZodDefault<z.ZodBoolean>;
|
|
523
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
522
524
|
unreadCount: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
523
525
|
isMuted: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
524
526
|
isArchived: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -539,6 +541,8 @@ declare const ChatSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
539
541
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
540
542
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
541
543
|
}[];
|
|
544
|
+
isOpen: boolean;
|
|
545
|
+
enabled: boolean;
|
|
542
546
|
unreadCount: Record<string, number>;
|
|
543
547
|
isMuted: Record<string, boolean>;
|
|
544
548
|
isArchived: boolean;
|
|
@@ -593,6 +597,8 @@ declare const ChatSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
593
597
|
senderId?: unknown;
|
|
594
598
|
sentAt?: unknown;
|
|
595
599
|
} | undefined;
|
|
600
|
+
isOpen?: boolean | undefined;
|
|
601
|
+
enabled?: boolean | undefined;
|
|
596
602
|
unreadCount?: Record<string, number> | undefined;
|
|
597
603
|
isMuted?: Record<string, boolean> | undefined;
|
|
598
604
|
isArchived?: boolean | undefined;
|
|
@@ -680,6 +686,8 @@ declare const CreateChatSchema: z.ZodObject<Omit<z.objectUtil.extendShape<Omit<{
|
|
|
680
686
|
senderId?: unknown;
|
|
681
687
|
sentAt?: unknown;
|
|
682
688
|
}>>;
|
|
689
|
+
isOpen: z.ZodDefault<z.ZodBoolean>;
|
|
690
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
683
691
|
unreadCount: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
684
692
|
isMuted: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
685
693
|
isArchived: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -699,6 +707,8 @@ declare const CreateChatSchema: z.ZodObject<Omit<z.objectUtil.extendShape<Omit<{
|
|
|
699
707
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
700
708
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
701
709
|
}[];
|
|
710
|
+
isOpen: boolean;
|
|
711
|
+
enabled: boolean;
|
|
702
712
|
createdBy: string | number;
|
|
703
713
|
photoURL?: string | undefined;
|
|
704
714
|
name?: string | undefined;
|
|
@@ -721,6 +731,8 @@ declare const CreateChatSchema: z.ZodObject<Omit<z.objectUtil.extendShape<Omit<{
|
|
|
721
731
|
photoURL?: string | undefined;
|
|
722
732
|
name?: string | undefined;
|
|
723
733
|
description?: string | undefined;
|
|
734
|
+
isOpen?: boolean | undefined;
|
|
735
|
+
enabled?: boolean | undefined;
|
|
724
736
|
createdBy?: unknown;
|
|
725
737
|
}>;
|
|
726
738
|
type CreateChat = z.infer<typeof CreateChatSchema>;
|
|
@@ -857,6 +869,8 @@ declare const safeParseChat: (data: unknown) => z.SafeParseReturnType<{
|
|
|
857
869
|
senderId?: unknown;
|
|
858
870
|
sentAt?: unknown;
|
|
859
871
|
} | undefined;
|
|
872
|
+
isOpen?: boolean | undefined;
|
|
873
|
+
enabled?: boolean | undefined;
|
|
860
874
|
unreadCount?: Record<string, number> | undefined;
|
|
861
875
|
isMuted?: Record<string, boolean> | undefined;
|
|
862
876
|
isArchived?: boolean | undefined;
|
|
@@ -877,6 +891,8 @@ declare const safeParseChat: (data: unknown) => z.SafeParseReturnType<{
|
|
|
877
891
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
878
892
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
879
893
|
}[];
|
|
894
|
+
isOpen: boolean;
|
|
895
|
+
enabled: boolean;
|
|
880
896
|
unreadCount: Record<string, number>;
|
|
881
897
|
isMuted: Record<string, boolean>;
|
|
882
898
|
isArchived: boolean;
|
|
@@ -952,6 +968,8 @@ declare const validateChat: (data: unknown) => {
|
|
|
952
968
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
953
969
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
954
970
|
}[];
|
|
971
|
+
isOpen: boolean;
|
|
972
|
+
enabled: boolean;
|
|
955
973
|
unreadCount: Record<string, number>;
|
|
956
974
|
isMuted: Record<string, boolean>;
|
|
957
975
|
isArchived: boolean;
|
|
@@ -519,6 +519,8 @@ declare const ChatSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
519
519
|
senderId?: unknown;
|
|
520
520
|
sentAt?: unknown;
|
|
521
521
|
}>>;
|
|
522
|
+
isOpen: z.ZodDefault<z.ZodBoolean>;
|
|
523
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
522
524
|
unreadCount: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
523
525
|
isMuted: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
524
526
|
isArchived: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -539,6 +541,8 @@ declare const ChatSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
539
541
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
540
542
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
541
543
|
}[];
|
|
544
|
+
isOpen: boolean;
|
|
545
|
+
enabled: boolean;
|
|
542
546
|
unreadCount: Record<string, number>;
|
|
543
547
|
isMuted: Record<string, boolean>;
|
|
544
548
|
isArchived: boolean;
|
|
@@ -593,6 +597,8 @@ declare const ChatSchema: z.ZodObject<z.objectUtil.extendShape<Omit<{
|
|
|
593
597
|
senderId?: unknown;
|
|
594
598
|
sentAt?: unknown;
|
|
595
599
|
} | undefined;
|
|
600
|
+
isOpen?: boolean | undefined;
|
|
601
|
+
enabled?: boolean | undefined;
|
|
596
602
|
unreadCount?: Record<string, number> | undefined;
|
|
597
603
|
isMuted?: Record<string, boolean> | undefined;
|
|
598
604
|
isArchived?: boolean | undefined;
|
|
@@ -680,6 +686,8 @@ declare const CreateChatSchema: z.ZodObject<Omit<z.objectUtil.extendShape<Omit<{
|
|
|
680
686
|
senderId?: unknown;
|
|
681
687
|
sentAt?: unknown;
|
|
682
688
|
}>>;
|
|
689
|
+
isOpen: z.ZodDefault<z.ZodBoolean>;
|
|
690
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
683
691
|
unreadCount: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
684
692
|
isMuted: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
685
693
|
isArchived: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -699,6 +707,8 @@ declare const CreateChatSchema: z.ZodObject<Omit<z.objectUtil.extendShape<Omit<{
|
|
|
699
707
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
700
708
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
701
709
|
}[];
|
|
710
|
+
isOpen: boolean;
|
|
711
|
+
enabled: boolean;
|
|
702
712
|
createdBy: string | number;
|
|
703
713
|
photoURL?: string | undefined;
|
|
704
714
|
name?: string | undefined;
|
|
@@ -721,6 +731,8 @@ declare const CreateChatSchema: z.ZodObject<Omit<z.objectUtil.extendShape<Omit<{
|
|
|
721
731
|
photoURL?: string | undefined;
|
|
722
732
|
name?: string | undefined;
|
|
723
733
|
description?: string | undefined;
|
|
734
|
+
isOpen?: boolean | undefined;
|
|
735
|
+
enabled?: boolean | undefined;
|
|
724
736
|
createdBy?: unknown;
|
|
725
737
|
}>;
|
|
726
738
|
type CreateChat = z.infer<typeof CreateChatSchema>;
|
|
@@ -857,6 +869,8 @@ declare const safeParseChat: (data: unknown) => z.SafeParseReturnType<{
|
|
|
857
869
|
senderId?: unknown;
|
|
858
870
|
sentAt?: unknown;
|
|
859
871
|
} | undefined;
|
|
872
|
+
isOpen?: boolean | undefined;
|
|
873
|
+
enabled?: boolean | undefined;
|
|
860
874
|
unreadCount?: Record<string, number> | undefined;
|
|
861
875
|
isMuted?: Record<string, boolean> | undefined;
|
|
862
876
|
isArchived?: boolean | undefined;
|
|
@@ -877,6 +891,8 @@ declare const safeParseChat: (data: unknown) => z.SafeParseReturnType<{
|
|
|
877
891
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
878
892
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
879
893
|
}[];
|
|
894
|
+
isOpen: boolean;
|
|
895
|
+
enabled: boolean;
|
|
880
896
|
unreadCount: Record<string, number>;
|
|
881
897
|
isMuted: Record<string, boolean>;
|
|
882
898
|
isArchived: boolean;
|
|
@@ -952,6 +968,8 @@ declare const validateChat: (data: unknown) => {
|
|
|
952
968
|
joinedAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
953
969
|
lastSeenAt?: FirebaseFirestore.Timestamp | null | undefined;
|
|
954
970
|
}[];
|
|
971
|
+
isOpen: boolean;
|
|
972
|
+
enabled: boolean;
|
|
955
973
|
unreadCount: Record<string, number>;
|
|
956
974
|
isMuted: Record<string, boolean>;
|
|
957
975
|
isArchived: boolean;
|
|
@@ -234,13 +234,13 @@ var ChatSchema = ModelSchema.omit({
|
|
|
234
234
|
}).extend({
|
|
235
235
|
type: ChatTypeSchema,
|
|
236
236
|
name: import_zod3.z.string().min(1).optional(),
|
|
237
|
-
// obrigatório para grupos
|
|
238
237
|
description: import_zod3.z.string().max(500).optional(),
|
|
239
238
|
photoURL: import_zod3.z.string().url().optional(),
|
|
240
239
|
participantIds: import_zod3.z.array(IdModelProcess).min(2).max(100),
|
|
241
240
|
participants: import_zod3.z.array(ParticipantSchema),
|
|
242
241
|
lastMessage: LastMessageSchema.optional(),
|
|
243
|
-
|
|
242
|
+
isOpen: import_zod3.z.boolean().default(true),
|
|
243
|
+
enabled: import_zod3.z.boolean().default(true),
|
|
244
244
|
unreadCount: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number()).default({}),
|
|
245
245
|
// { [userId]: true } — chats silenciados por usuário
|
|
246
246
|
isMuted: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.boolean()).default({}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/journey/chat.js","../../../src/model/journey/chat.ts","../../../src/model/shared.ts","../../../src/model.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","chat_exports","AttachmentSchema","ChatSchema","ChatTypeSchema","CreateChatSchema","CreateMessageSchema","LastMessageSchema","MessageSchema","MessageStatusSchema","MessageTypeSchema","ParticipantSchema","ReplyToSchema","TypingIndicatorSchema","safeParseChat","safeParseMessage","validateChat","validateMessage","module","exports","import_zod","require","import_firestore","TimestampOrNow","z","preprocess","arg","Timestamp","now","custom","nullish","optional","import_cuid","generateFirestoreId","cuid","IdModelSchema","import_zod2","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","import_zod3","enum","userId","displayName","min","photoURL","url","nullable","role","default","joinedAt","lastSeenAt","size","positive","mimeType","thumbnailUrl","messageId","senderId","senderName","content","max","type","omit","chatId","senderPhotoURL","attachment","status","readBy","replyTo","editedAt","deletedAt","sentAt","participantIds","participants","lastMessage","unreadCount","record","isMuted","isArchived","createdBy","startedAt","data","safeParse","parse"],"mappings":"AAAA;AACA,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,wBAAwB;AACtD,IAAIC,oBAAoBN,OAAOO,mBAAmB;AAClD,IAAIC,eAAeR,OAAOS,cAAc;AACxC,IAAIC,eAAeV,OAAOW,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,SAACC,QAAQC;IACtB,IAAK,IAAIC,QAAQD,IACfb,UAAUY,QAAQE,MAAM;QAAEC,KAAKF,GAAG,CAACC,KAAK;QAAEE,YAAY;IAAK;AAC/D;AACA,IAAIC,cAAc,SAACC,IAA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;AACjE,IAAMnF,kBAAmB,SAACmF;WAAkB5F,cAAc8F,KAAA,CAAMF;;AAChE,IAAMpF,eAAmB,SAACoF;WAAkBjG,WAAWmG,KAAA,CAAMF;;ADYpE,6DAA6D;AAC7D,KAAMlF,CAAAA,OAAOC,OAAO,GAAG;IACrBjB,kBAAAA;IACAC,YAAAA;IACAC,gBAAAA;IACAC,kBAAAA;IACAC,qBAAAA;IACAC,mBAAAA;IACAC,eAAAA;IACAC,qBAAAA;IACAC,mBAAAA;IACAC,mBAAAA;IACAC,eAAAA;IACAC,uBAAAA;IACAC,eAAAA;IACAC,kBAAAA;IACAC,cAAAA;IACAC,iBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/model/journey/chat.ts\nvar chat_exports = {};\n__export(chat_exports, {\n AttachmentSchema: () => AttachmentSchema,\n ChatSchema: () => ChatSchema,\n ChatTypeSchema: () => ChatTypeSchema,\n CreateChatSchema: () => CreateChatSchema,\n CreateMessageSchema: () => CreateMessageSchema,\n LastMessageSchema: () => LastMessageSchema,\n MessageSchema: () => MessageSchema,\n MessageStatusSchema: () => MessageStatusSchema,\n MessageTypeSchema: () => MessageTypeSchema,\n ParticipantSchema: () => ParticipantSchema,\n ReplyToSchema: () => ReplyToSchema,\n TypingIndicatorSchema: () => TypingIndicatorSchema,\n safeParseChat: () => safeParseChat,\n safeParseMessage: () => safeParseMessage,\n validateChat: () => validateChat,\n validateMessage: () => validateMessage\n});\nmodule.exports = __toCommonJS(chat_exports);\nvar import_zod3 = require(\"zod\");\n\n// src/model/shared.ts\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar import_zod = require(\"zod\");\nvar TimestampOrNow = import_zod.z.preprocess(\n (arg) => arg === void 0 ? import_firestore.Timestamp.now() : arg,\n import_zod.z.custom()\n).nullish().optional();\n\n// src/model.ts\nvar import_zod2 = require(\"zod\");\nvar import_cuid = __toESM(require(\"cuid\"));\nvar generateFirestoreId = () => {\n return (0, import_cuid.default)();\n};\nvar IdModelSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]);\nvar IdModelProcess = import_zod2.z.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = import_zod2.z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: import_zod2.z.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: import_zod2.z.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = import_zod2.z.object({\n enabled: import_zod2.z.boolean().optional()\n});\nvar DocumentHistorySchema = import_zod2.z.object({\n createdAt: TimestampOrNow,\n description: import_zod2.z.string().optional()\n});\n\n// src/model/journey/chat.ts\nvar MessageTypeSchema = import_zod3.z.enum([\"text\", \"image\", \"file\", \"audio\"]);\nvar ChatTypeSchema = import_zod3.z.enum([\"direct\", \"group\"]);\nvar MessageStatusSchema = import_zod3.z.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nvar ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: import_zod3.z.string().min(1),\n photoURL: import_zod3.z.string().url().nullable().optional(),\n role: import_zod3.z.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow\n});\nvar AttachmentSchema = ModelSchema.extend({\n url: import_zod3.z.string().url(),\n name: import_zod3.z.string(),\n size: import_zod3.z.number().positive(),\n // bytes\n mimeType: import_zod3.z.string(),\n thumbnailUrl: import_zod3.z.string().url().optional()\n});\nvar ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: import_zod3.z.string(),\n content: import_zod3.z.string().max(200),\n type: MessageTypeSchema\n});\nvar MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: import_zod3.z.string().min(1),\n senderPhotoURL: import_zod3.z.string().url().nullable().optional(),\n type: MessageTypeSchema,\n content: import_zod3.z.string().min(1).max(4e3),\n attachment: AttachmentSchema.optional(),\n status: MessageStatusSchema.default(\"sending\"),\n readBy: import_zod3.z.array(import_zod3.z.string()).default([]),\n // array de userIds\n replyTo: ReplyToSchema.optional(),\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow\n});\nvar CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true\n});\nvar LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: import_zod3.z.string(),\n senderId: IdModelProcess,\n senderName: import_zod3.z.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow\n});\nvar ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: import_zod3.z.string().min(1).optional(),\n // obrigatório para grupos\n description: import_zod3.z.string().max(500).optional(),\n photoURL: import_zod3.z.string().url().optional(),\n participantIds: import_zod3.z.array(IdModelProcess).min(2).max(100),\n participants: import_zod3.z.array(ParticipantSchema),\n lastMessage: LastMessageSchema.optional(),\n // { [userId]: count } — quantas msgs não lidas por usuário\n unreadCount: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number()).default({}),\n // { [userId]: true } — chats silenciados por usuário\n isMuted: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.boolean()).default({}),\n isArchived: import_zod3.z.boolean().default(false),\n createdBy: IdModelProcess\n});\nvar CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true\n});\nvar TypingIndicatorSchema = ModelSchema.extend({\n userId: import_zod3.z.string(),\n displayName: import_zod3.z.string(),\n startedAt: import_zod3.z.number()\n // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nvar safeParseMessage = (data) => MessageSchema.safeParse(data);\nvar safeParseChat = (data) => ChatSchema.safeParse(data);\nvar validateMessage = (data) => MessageSchema.parse(data);\nvar validateChat = (data) => ChatSchema.parse(data);\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AttachmentSchema,\n ChatSchema,\n ChatTypeSchema,\n CreateChatSchema,\n CreateMessageSchema,\n LastMessageSchema,\n MessageSchema,\n MessageStatusSchema,\n MessageTypeSchema,\n ParticipantSchema,\n ReplyToSchema,\n TypingIndicatorSchema,\n safeParseChat,\n safeParseMessage,\n validateChat,\n validateMessage\n});\n","import { z } from \"zod\";\nimport {TimestampOrNow} from \"../shared\";\nimport {IdModelProcess, ModelSchema} from \"../../model\";\n\n// ─────────────────────────────────────────────\n// Enums\n// ─────────────────────────────────────────────\n\nexport const MessageTypeSchema = z.enum([\"text\", \"image\", \"file\", \"audio\"]);\nexport type MessageType = z.infer<typeof MessageTypeSchema>;\n\nexport const ChatTypeSchema = z.enum([\"direct\", \"group\"]);\nexport type ChatType = z.infer<typeof ChatTypeSchema>;\n\nexport const MessageStatusSchema = z.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nexport type MessageStatus = z.infer<typeof MessageStatusSchema>;\n\n// ─────────────────────────────────────────────\n// Participant\n// Não estende ModelSchema pois é sub-documento (não tem coleção própria)\n// ─────────────────────────────────────────────\n\nexport const ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: z.string().min(1),\n photoURL: z.string().url().nullable().optional(),\n role: z.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow,\n});\nexport type Participant = z.infer<typeof ParticipantSchema>;\n\n// ─────────────────────────────────────────────\n// Attachment\n// Sub-documento, sem id próprio\n// ─────────────────────────────────────────────\n\nexport const AttachmentSchema = ModelSchema.extend({\n url: z.string().url(),\n name: z.string(),\n size: z.number().positive(), // bytes\n mimeType: z.string(),\n thumbnailUrl: z.string().url().optional(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\n// ─────────────────────────────────────────────\n// ReplyTo\n// Snapshot da mensagem original (evita lookup extra)\n// ─────────────────────────────────────────────\n\nexport const ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string(),\n content: z.string().max(200),\n type: MessageTypeSchema,\n});\nexport type ReplyTo = z.infer<typeof ReplyToSchema>;\n\n// ─────────────────────────────────────────────\n// Message\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string().min(1),\n senderPhotoURL: z.string().url().nullable().optional(),\n\n type: MessageTypeSchema,\n content: z.string().min(1).max(4000),\n\n attachment: AttachmentSchema.optional(),\n\n status: MessageStatusSchema.default(\"sending\"),\n readBy: z.array(z.string()).default([]), // array de userIds\n\n replyTo: ReplyToSchema.optional(),\n\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow,\n});\nexport type Message = z.infer<typeof MessageSchema>;\n\n// Para criar — omite campos gerados automaticamente pelo ModelSchema/servidor\nexport const CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true,\n});\nexport type CreateMessage = z.infer<typeof CreateMessageSchema>;\n\n// ─────────────────────────────────────────────\n// LastMessage\n// Snapshot da última mensagem para preview na lista de chats\n// ─────────────────────────────────────────────\n\nexport const LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: z.string(),\n senderId: IdModelProcess,\n senderName: z.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow,\n});\nexport type LastMessage = z.infer<typeof LastMessageSchema>;\n\n// ─────────────────────────────────────────────\n// Chat\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: z.string().min(1).optional(), // obrigatório para grupos\n description: z.string().max(500).optional(),\n photoURL: z.string().url().optional(),\n\n participantIds: z.array(IdModelProcess).min(2).max(100),\n participants: z.array(ParticipantSchema),\n\n lastMessage: LastMessageSchema.optional(),\n\n // { [userId]: count } — quantas msgs não lidas por usuário\n unreadCount: z.record(z.string(), z.number()).default({}),\n\n // { [userId]: true } — chats silenciados por usuário\n isMuted: z.record(z.string(), z.boolean()).default({}),\n\n isArchived: z.boolean().default(false),\n\n createdBy: IdModelProcess,\n});\nexport type Chat = z.infer<typeof ChatSchema>;\n\nexport const CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true,\n});\nexport type CreateChat = z.infer<typeof CreateChatSchema>;\n\n// ─────────────────────────────────────────────\n// Typing Indicator\n// Persistido no Realtime Database (não no Firestore)\n// Não usa ModelSchema pois não é documento Firestore\n// ─────────────────────────────────────────────\n\nexport const TypingIndicatorSchema = ModelSchema.extend({\n userId: z.string(),\n displayName: z.string(),\n startedAt: z.number(), // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nexport type TypingIndicator = z.infer<typeof TypingIndicatorSchema>;\n\n// ─────────────────────────────────────────────\n// Helpers de validação\n// ─────────────────────────────────────────────\n\nexport const safeParseMessage = (data: unknown) => MessageSchema.safeParse(data);\nexport const safeParseChat = (data: unknown) => ChatSchema.safeParse(data);\nexport const validateMessage = (data: unknown) => MessageSchema.parse(data);\nexport const validateChat = (data: unknown) => ChatSchema.parse(data);\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/journey/chat.js","../../../src/model/journey/chat.ts","../../../src/model/shared.ts","../../../src/model.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","chat_exports","AttachmentSchema","ChatSchema","ChatTypeSchema","CreateChatSchema","CreateMessageSchema","LastMessageSchema","MessageSchema","MessageStatusSchema","MessageTypeSchema","ParticipantSchema","ReplyToSchema","TypingIndicatorSchema","safeParseChat","safeParseMessage","validateChat","validateMessage","module","exports","import_zod","require","import_firestore","TimestampOrNow","z","preprocess","arg","Timestamp","now","custom","nullish","optional","import_cuid","generateFirestoreId","cuid","IdModelSchema","import_zod2","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","import_zod3","enum","userId","displayName","min","photoURL","url","nullable","role","default","joinedAt","lastSeenAt","size","positive","mimeType","thumbnailUrl","messageId","senderId","senderName","content","max","type","omit","chatId","senderPhotoURL","attachment","status","readBy","replyTo","editedAt","deletedAt","sentAt","participantIds","participants","lastMessage","isOpen","unreadCount","record","isMuted","isArchived","createdBy","startedAt","data","safeParse","parse"],"mappings":"AAAA;AACA,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,wBAAwB;AACtD,IAAIC,oBAAoBN,OAAOO,mBAAmB;AAClD,IAAIC,eAAeR,OAAOS,cAAc;AACxC,IAAIC,eAAeV,OAAOW,SAAS,CAACC,cAAc;AAClD,IA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,MAAA,CAAO;IACtDW,QAAQF,YAAAnC,CAAA,CAAEc,MAAA;IACVwB,aAAaH,YAAAnC,CAAA,CAAEc,MAAA;IACf8D,WAAWzC,YAAAnC,CAAA,CAAEe,MAAA;AACf;AAOO,IAAMxB,mBAAmB,SAACsF;WAAkB7F,cAAc8F,SAAA,CAAUD;;AACpE,IAAMvF,gBAAmB,SAACuF;WAAkBlG,WAAWmG,SAAA,CAAUD;;AACjE,IAAMpF,kBAAmB,SAACoF;WAAkB7F,cAAc+F,KAAA,CAAMF;;AAChE,IAAMrF,eAAmB,SAACqF;WAAkBlG,WAAWoG,KAAA,CAAMF;;ADWpE,6DAA6D;AAC7D,KAAMnF,CAAAA,OAAOC,OAAO,GAAG;IACrBjB,kBAAAA;IACAC,YAAAA;IACAC,gBAAAA;IACAC,kBAAAA;IACAC,qBAAAA;IACAC,mBAAAA;IACAC,eAAAA;IACAC,qBAAAA;IACAC,mBAAAA;IACAC,mBAAAA;IACAC,eAAAA;IACAC,uBAAAA;IACAC,eAAAA;IACAC,kBAAAA;IACAC,cAAAA;IACAC,iBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/model/journey/chat.ts\nvar chat_exports = {};\n__export(chat_exports, {\n AttachmentSchema: () => AttachmentSchema,\n ChatSchema: () => ChatSchema,\n ChatTypeSchema: () => ChatTypeSchema,\n CreateChatSchema: () => CreateChatSchema,\n CreateMessageSchema: () => CreateMessageSchema,\n LastMessageSchema: () => LastMessageSchema,\n MessageSchema: () => MessageSchema,\n MessageStatusSchema: () => MessageStatusSchema,\n MessageTypeSchema: () => MessageTypeSchema,\n ParticipantSchema: () => ParticipantSchema,\n ReplyToSchema: () => ReplyToSchema,\n TypingIndicatorSchema: () => TypingIndicatorSchema,\n safeParseChat: () => safeParseChat,\n safeParseMessage: () => safeParseMessage,\n validateChat: () => validateChat,\n validateMessage: () => validateMessage\n});\nmodule.exports = __toCommonJS(chat_exports);\nvar import_zod3 = require(\"zod\");\n\n// src/model/shared.ts\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar import_zod = require(\"zod\");\nvar TimestampOrNow = import_zod.z.preprocess(\n (arg) => arg === void 0 ? import_firestore.Timestamp.now() : arg,\n import_zod.z.custom()\n).nullish().optional();\n\n// src/model.ts\nvar import_zod2 = require(\"zod\");\nvar import_cuid = __toESM(require(\"cuid\"));\nvar generateFirestoreId = () => {\n return (0, import_cuid.default)();\n};\nvar IdModelSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]);\nvar IdModelProcess = import_zod2.z.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = import_zod2.z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: import_zod2.z.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: import_zod2.z.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = import_zod2.z.object({\n enabled: import_zod2.z.boolean().optional()\n});\nvar DocumentHistorySchema = import_zod2.z.object({\n createdAt: TimestampOrNow,\n description: import_zod2.z.string().optional()\n});\n\n// src/model/journey/chat.ts\nvar MessageTypeSchema = import_zod3.z.enum([\"text\", \"image\", \"file\", \"audio\"]);\nvar ChatTypeSchema = import_zod3.z.enum([\"direct\", \"group\"]);\nvar MessageStatusSchema = import_zod3.z.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nvar ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: import_zod3.z.string().min(1),\n photoURL: import_zod3.z.string().url().nullable().optional(),\n role: import_zod3.z.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow\n});\nvar AttachmentSchema = ModelSchema.extend({\n url: import_zod3.z.string().url(),\n name: import_zod3.z.string(),\n size: import_zod3.z.number().positive(),\n // bytes\n mimeType: import_zod3.z.string(),\n thumbnailUrl: import_zod3.z.string().url().optional()\n});\nvar ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: import_zod3.z.string(),\n content: import_zod3.z.string().max(200),\n type: MessageTypeSchema\n});\nvar MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: import_zod3.z.string().min(1),\n senderPhotoURL: import_zod3.z.string().url().nullable().optional(),\n type: MessageTypeSchema,\n content: import_zod3.z.string().min(1).max(4e3),\n attachment: AttachmentSchema.optional(),\n status: MessageStatusSchema.default(\"sending\"),\n readBy: import_zod3.z.array(import_zod3.z.string()).default([]),\n // array de userIds\n replyTo: ReplyToSchema.optional(),\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow\n});\nvar CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true\n});\nvar LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: import_zod3.z.string(),\n senderId: IdModelProcess,\n senderName: import_zod3.z.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow\n});\nvar ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: import_zod3.z.string().min(1).optional(),\n description: import_zod3.z.string().max(500).optional(),\n photoURL: import_zod3.z.string().url().optional(),\n participantIds: import_zod3.z.array(IdModelProcess).min(2).max(100),\n participants: import_zod3.z.array(ParticipantSchema),\n lastMessage: LastMessageSchema.optional(),\n isOpen: import_zod3.z.boolean().default(true),\n enabled: import_zod3.z.boolean().default(true),\n unreadCount: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.number()).default({}),\n // { [userId]: true } — chats silenciados por usuário\n isMuted: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.boolean()).default({}),\n isArchived: import_zod3.z.boolean().default(false),\n createdBy: IdModelProcess\n});\nvar CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true\n});\nvar TypingIndicatorSchema = ModelSchema.extend({\n userId: import_zod3.z.string(),\n displayName: import_zod3.z.string(),\n startedAt: import_zod3.z.number()\n // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nvar safeParseMessage = (data) => MessageSchema.safeParse(data);\nvar safeParseChat = (data) => ChatSchema.safeParse(data);\nvar validateMessage = (data) => MessageSchema.parse(data);\nvar validateChat = (data) => ChatSchema.parse(data);\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n AttachmentSchema,\n ChatSchema,\n ChatTypeSchema,\n CreateChatSchema,\n CreateMessageSchema,\n LastMessageSchema,\n MessageSchema,\n MessageStatusSchema,\n MessageTypeSchema,\n ParticipantSchema,\n ReplyToSchema,\n TypingIndicatorSchema,\n safeParseChat,\n safeParseMessage,\n validateChat,\n validateMessage\n});\n","import { z } from \"zod\";\nimport {TimestampOrNow} from \"../shared\";\nimport {IdModelProcess, ModelSchema} from \"../../model\";\n\n// ─────────────────────────────────────────────\n// Enums\n// ─────────────────────────────────────────────\n\nexport const MessageTypeSchema = z.enum([\"text\", \"image\", \"file\", \"audio\"]);\nexport type MessageType = z.infer<typeof MessageTypeSchema>;\n\nexport const ChatTypeSchema = z.enum([\"direct\", \"group\"]);\nexport type ChatType = z.infer<typeof ChatTypeSchema>;\n\nexport const MessageStatusSchema = z.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nexport type MessageStatus = z.infer<typeof MessageStatusSchema>;\n\n// ─────────────────────────────────────────────\n// Participant\n// Não estende ModelSchema pois é sub-documento (não tem coleção própria)\n// ─────────────────────────────────────────────\n\nexport const ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: z.string().min(1),\n photoURL: z.string().url().nullable().optional(),\n role: z.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow,\n});\nexport type Participant = z.infer<typeof ParticipantSchema>;\n\n// ─────────────────────────────────────────────\n// Attachment\n// Sub-documento, sem id próprio\n// ─────────────────────────────────────────────\n\nexport const AttachmentSchema = ModelSchema.extend({\n url: z.string().url(),\n name: z.string(),\n size: z.number().positive(), // bytes\n mimeType: z.string(),\n thumbnailUrl: z.string().url().optional(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\n// ─────────────────────────────────────────────\n// ReplyTo\n// Snapshot da mensagem original (evita lookup extra)\n// ─────────────────────────────────────────────\n\nexport const ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string(),\n content: z.string().max(200),\n type: MessageTypeSchema,\n});\nexport type ReplyTo = z.infer<typeof ReplyToSchema>;\n\n// ─────────────────────────────────────────────\n// Message\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string().min(1),\n senderPhotoURL: z.string().url().nullable().optional(),\n\n type: MessageTypeSchema,\n content: z.string().min(1).max(4000),\n\n attachment: AttachmentSchema.optional(),\n\n status: MessageStatusSchema.default(\"sending\"),\n readBy: z.array(z.string()).default([]), // array de userIds\n\n replyTo: ReplyToSchema.optional(),\n\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow,\n});\nexport type Message = z.infer<typeof MessageSchema>;\n\n// Para criar — omite campos gerados automaticamente pelo ModelSchema/servidor\nexport const CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true,\n});\nexport type CreateMessage = z.infer<typeof CreateMessageSchema>;\n\n// ─────────────────────────────────────────────\n// LastMessage\n// Snapshot da última mensagem para preview na lista de chats\n// ─────────────────────────────────────────────\n\nexport const LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: z.string(),\n senderId: IdModelProcess,\n senderName: z.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow,\n});\nexport type LastMessage = z.infer<typeof LastMessageSchema>;\n\n// ─────────────────────────────────────────────\n// Chat\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: z.string().min(1).optional(),\n description: z.string().max(500).optional(),\n photoURL: z.string().url().optional(),\n\n participantIds: z.array(IdModelProcess).min(2).max(100),\n participants: z.array(ParticipantSchema),\n\n lastMessage: LastMessageSchema.optional(),\n\n isOpen: z.boolean().default(true),\n enabled: z.boolean().default(true),\n unreadCount: z.record(z.string(), z.number()).default({}),\n\n // { [userId]: true } — chats silenciados por usuário\n isMuted: z.record(z.string(), z.boolean()).default({}),\n\n isArchived: z.boolean().default(false),\n\n createdBy: IdModelProcess,\n});\nexport type Chat = z.infer<typeof ChatSchema>;\n\nexport const CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true,\n});\nexport type CreateChat = z.infer<typeof CreateChatSchema>;\n\n// ─────────────────────────────────────────────\n// Typing Indicator\n// Persistido no Realtime Database (não no Firestore)\n// Não usa ModelSchema pois não é documento Firestore\n// ─────────────────────────────────────────────\n\nexport const TypingIndicatorSchema = ModelSchema.extend({\n userId: z.string(),\n displayName: z.string(),\n startedAt: z.number(), // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nexport type TypingIndicator = z.infer<typeof TypingIndicatorSchema>;\n\n// ─────────────────────────────────────────────\n// Helpers de validação\n// ─────────────────────────────────────────────\n\nexport const safeParseMessage = (data: unknown) => MessageSchema.safeParse(data);\nexport const safeParseChat = (data: unknown) => ChatSchema.safeParse(data);\nexport const validateMessage = (data: unknown) => MessageSchema.parse(data);\nexport const validateChat = (data: unknown) => ChatSchema.parse(data);\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n"]}
|
|
@@ -123,13 +123,13 @@ var ChatSchema = ModelSchema.omit({
|
|
|
123
123
|
}).extend({
|
|
124
124
|
type: ChatTypeSchema,
|
|
125
125
|
name: z3.string().min(1).optional(),
|
|
126
|
-
// obrigatório para grupos
|
|
127
126
|
description: z3.string().max(500).optional(),
|
|
128
127
|
photoURL: z3.string().url().optional(),
|
|
129
128
|
participantIds: z3.array(IdModelProcess).min(2).max(100),
|
|
130
129
|
participants: z3.array(ParticipantSchema),
|
|
131
130
|
lastMessage: LastMessageSchema.optional(),
|
|
132
|
-
|
|
131
|
+
isOpen: z3.boolean().default(true),
|
|
132
|
+
enabled: z3.boolean().default(true),
|
|
133
133
|
unreadCount: z3.record(z3.string(), z3.number()).default({}),
|
|
134
134
|
// { [userId]: true } — chats silenciados por usuário
|
|
135
135
|
isMuted: z3.record(z3.string(), z3.boolean()).default({}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/journey/chat.mjs","../../../src/model/journey/chat.ts","../../../src/model/shared.ts","../../../src/model.ts"],"names":["z","Timestamp","TimestampOrNow","preprocess","arg","now","custom","nullish","optional","cuid","generateFirestoreId","IdModelSchema","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","MessageTypeSchema","enum","ChatTypeSchema","MessageStatusSchema","ParticipantSchema","userId","displayName","min","photoURL","url","nullable","role","default","joinedAt","lastSeenAt","AttachmentSchema","name","size","positive","mimeType","thumbnailUrl","ReplyToSchema","messageId","senderId","senderName","content","max","type","MessageSchema","omit","chatId","senderPhotoURL","attachment","status","readBy","replyTo","editedAt","deletedAt","CreateMessageSchema","LastMessageSchema","sentAt","ChatSchema","participantIds","participants","lastMessage","unreadCount","record","isMuted","isArchived","createdBy","CreateChatSchema","TypingIndicatorSchema","startedAt","safeParseMessage","data","safeParse","safeParseChat","validateMessage","parse","validateChat"],"mappings":"AAAA,4BAA4B;ACA5B,SAASA,KAAAA,EAAAA,QAAS,MAAA;ADGlB,sBAAsB;AEHtB,SAASC,SAAA,QAAiB,0BAAA;AAC1B,SAAQD,CAAA,QAAQ,MAAA;AAET,IAAME,iBAAiBF,EAC3BG,UAAA,CACC,SAACC;WAASA,QAAQ,KAAA,IAAYH,UAAUI,GAAA,KAAQD;GAChDJ,EAAEM,MAAA,IAEHC,OAAA,GAAUC,QAAA;AFGb,eAAe;AGXf,SAAQR,KAAAA,EAAAA,QAAQ,MAAA;AAEhB,OAAOS,UAAU,OAAA;AAEV,IAAMC,sBAAsB;IACjC,OAAOD;AACT;AAEO,IAAME,gBAAgBX,GAAEY,KAAA,CAAM;IAACZ,GAAEa,MAAA;IAAUb,GAAEc,MAAA;CAAS;AAEtD,IAAMC,iBAAiBf,GAAEG,UAAA,CAAW,SAACa;IAC1C,IAAIA,QAAQ,KAAA,KAAaA,QAAQ,MAAM;QACrC,OAAON;IACT;IACA,OAAOM;AACT,GAAGL;AAEI,IAAMM,cAAcjB,GAAEkB,MAAA,CAAO;IAClCC,IAAIJ;IACJK,WAAWlB;IACXmB,WAAWnB;IACXoB,OAAOtB,GAAEuB,MAAA,CAAOT,MAAA,GAASP,OAAA,GAAUC,QAAA;AACrC;AAEO,IAAMgB,iBAAiBP,YAAYQ,MAAA,CAAO;IAC/CC,UAAU1B,GAAE2B,IAAA,CAAK;eAAMV,YAAYW,KAAA,GAAQp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I;IACnDiB,cAAc7E,GAAE4B,KAAA,CAAMU;IAEtBwC,aAAaL,kBAAkBjE,QAAA;IAAS,2DAAA;IAGxCuE,aAAa/E,GAAEgF,MAAA,CAAOhF,GAAEa,MAAA,IAAUb,GAAEc,MAAA,IAAUgC,OAAA,CAAQ,CAAC;IAAC,qDAAA;IAGxDmC,SAASjF,GAAEgF,MAAA,CAAOhF,GAAEa,MAAA,IAAUb,GAAE+B,OAAA,IAAWe,OAAA,CAAQ,CAAC;IAEpDoC,YAAYlF,GAAE+B,OAAA,GAAUe,OAAA,CAAQ;IAEhCqC,WAAWpE;AACb;AAGO,IAAMqE,mBAAmBT,WAAWZ,IAAA,CAAK;IAC9C5C,IAAI;IACJC,WAAW;IACXC,WAAW;IACXyD,aAAa;IACbC,aAAa;IACbE,SAAS;IACTC,YAAY;AACd;AASO,IAAMG,wBAAwBpE,YAAYQ,MAAA,CAAO;IACtDc,QAAQvC,GAAEa,MAAA;IACV2B,aAAaxC,GAAEa,MAAA;IACfyE,WAAWtF,GAAEc,MAAA;AACf;AAOO,IAAMyE,mBAAmB,SAACC;WAAkB1B,cAAc2B,SAAA,CAAUD;;AACpE,IAAME,gBAAmB,SAACF;WAAkBb,WAAWc,SAAA,CAAUD;;AACjE,IAAMG,kBAAmB,SAACH;WAAkB1B,cAAc8B,KAAA,CAAMJ;;AAChE,IAAMK,eAAmB,SAACL;WAAkBb,WAAWiB,KAAA,CAAMJ;;ADrCpE,SACEvC,gBAAgB,EAChB0B,UAAU,EACVvC,cAAc,EACdgD,gBAAgB,EAChBZ,mBAAmB,EACnBC,iBAAiB,EACjBX,aAAa,EACbzB,mBAAmB,EACnBH,iBAAiB,EACjBI,iBAAiB,EACjBiB,aAAa,EACb8B,qBAAqB,EACrBK,aAAa,EACbH,gBAAgB,EAChBM,YAAY,EACZF,eAAe,GACf","sourcesContent":["// src/model/journey/chat.ts\nimport { z as z3 } from \"zod\";\n\n// src/model/shared.ts\nimport { Timestamp } from \"@google-cloud/firestore\";\nimport { z } from \"zod\";\nvar TimestampOrNow = z.preprocess(\n (arg) => arg === void 0 ? Timestamp.now() : arg,\n z.custom()\n).nullish().optional();\n\n// src/model.ts\nimport { z as z2 } from \"zod\";\nimport cuid from \"cuid\";\nvar generateFirestoreId = () => {\n return cuid();\n};\nvar IdModelSchema = z2.union([z2.string(), z2.number()]);\nvar IdModelProcess = z2.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = z2.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z2.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: z2.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = z2.object({\n enabled: z2.boolean().optional()\n});\nvar DocumentHistorySchema = z2.object({\n createdAt: TimestampOrNow,\n description: z2.string().optional()\n});\n\n// src/model/journey/chat.ts\nvar MessageTypeSchema = z3.enum([\"text\", \"image\", \"file\", \"audio\"]);\nvar ChatTypeSchema = z3.enum([\"direct\", \"group\"]);\nvar MessageStatusSchema = z3.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nvar ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: z3.string().min(1),\n photoURL: z3.string().url().nullable().optional(),\n role: z3.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow\n});\nvar AttachmentSchema = ModelSchema.extend({\n url: z3.string().url(),\n name: z3.string(),\n size: z3.number().positive(),\n // bytes\n mimeType: z3.string(),\n thumbnailUrl: z3.string().url().optional()\n});\nvar ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z3.string(),\n content: z3.string().max(200),\n type: MessageTypeSchema\n});\nvar MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z3.string().min(1),\n senderPhotoURL: z3.string().url().nullable().optional(),\n type: MessageTypeSchema,\n content: z3.string().min(1).max(4e3),\n attachment: AttachmentSchema.optional(),\n status: MessageStatusSchema.default(\"sending\"),\n readBy: z3.array(z3.string()).default([]),\n // array de userIds\n replyTo: ReplyToSchema.optional(),\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow\n});\nvar CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true\n});\nvar LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: z3.string(),\n senderId: IdModelProcess,\n senderName: z3.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow\n});\nvar ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: z3.string().min(1).optional(),\n // obrigatório para grupos\n description: z3.string().max(500).optional(),\n photoURL: z3.string().url().optional(),\n participantIds: z3.array(IdModelProcess).min(2).max(100),\n participants: z3.array(ParticipantSchema),\n lastMessage: LastMessageSchema.optional(),\n // { [userId]: count } — quantas msgs não lidas por usuário\n unreadCount: z3.record(z3.string(), z3.number()).default({}),\n // { [userId]: true } — chats silenciados por usuário\n isMuted: z3.record(z3.string(), z3.boolean()).default({}),\n isArchived: z3.boolean().default(false),\n createdBy: IdModelProcess\n});\nvar CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true\n});\nvar TypingIndicatorSchema = ModelSchema.extend({\n userId: z3.string(),\n displayName: z3.string(),\n startedAt: z3.number()\n // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nvar safeParseMessage = (data) => MessageSchema.safeParse(data);\nvar safeParseChat = (data) => ChatSchema.safeParse(data);\nvar validateMessage = (data) => MessageSchema.parse(data);\nvar validateChat = (data) => ChatSchema.parse(data);\nexport {\n AttachmentSchema,\n ChatSchema,\n ChatTypeSchema,\n CreateChatSchema,\n CreateMessageSchema,\n LastMessageSchema,\n MessageSchema,\n MessageStatusSchema,\n MessageTypeSchema,\n ParticipantSchema,\n ReplyToSchema,\n TypingIndicatorSchema,\n safeParseChat,\n safeParseMessage,\n validateChat,\n validateMessage\n};\n","import { z } from \"zod\";\nimport {TimestampOrNow} from \"../shared\";\nimport {IdModelProcess, ModelSchema} from \"../../model\";\n\n// ─────────────────────────────────────────────\n// Enums\n// ─────────────────────────────────────────────\n\nexport const MessageTypeSchema = z.enum([\"text\", \"image\", \"file\", \"audio\"]);\nexport type MessageType = z.infer<typeof MessageTypeSchema>;\n\nexport const ChatTypeSchema = z.enum([\"direct\", \"group\"]);\nexport type ChatType = z.infer<typeof ChatTypeSchema>;\n\nexport const MessageStatusSchema = z.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nexport type MessageStatus = z.infer<typeof MessageStatusSchema>;\n\n// ─────────────────────────────────────────────\n// Participant\n// Não estende ModelSchema pois é sub-documento (não tem coleção própria)\n// ─────────────────────────────────────────────\n\nexport const ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: z.string().min(1),\n photoURL: z.string().url().nullable().optional(),\n role: z.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow,\n});\nexport type Participant = z.infer<typeof ParticipantSchema>;\n\n// ─────────────────────────────────────────────\n// Attachment\n// Sub-documento, sem id próprio\n// ─────────────────────────────────────────────\n\nexport const AttachmentSchema = ModelSchema.extend({\n url: z.string().url(),\n name: z.string(),\n size: z.number().positive(), // bytes\n mimeType: z.string(),\n thumbnailUrl: z.string().url().optional(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\n// ─────────────────────────────────────────────\n// ReplyTo\n// Snapshot da mensagem original (evita lookup extra)\n// ─────────────────────────────────────────────\n\nexport const ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string(),\n content: z.string().max(200),\n type: MessageTypeSchema,\n});\nexport type ReplyTo = z.infer<typeof ReplyToSchema>;\n\n// ─────────────────────────────────────────────\n// Message\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string().min(1),\n senderPhotoURL: z.string().url().nullable().optional(),\n\n type: MessageTypeSchema,\n content: z.string().min(1).max(4000),\n\n attachment: AttachmentSchema.optional(),\n\n status: MessageStatusSchema.default(\"sending\"),\n readBy: z.array(z.string()).default([]), // array de userIds\n\n replyTo: ReplyToSchema.optional(),\n\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow,\n});\nexport type Message = z.infer<typeof MessageSchema>;\n\n// Para criar — omite campos gerados automaticamente pelo ModelSchema/servidor\nexport const CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true,\n});\nexport type CreateMessage = z.infer<typeof CreateMessageSchema>;\n\n// ─────────────────────────────────────────────\n// LastMessage\n// Snapshot da última mensagem para preview na lista de chats\n// ─────────────────────────────────────────────\n\nexport const LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: z.string(),\n senderId: IdModelProcess,\n senderName: z.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow,\n});\nexport type LastMessage = z.infer<typeof LastMessageSchema>;\n\n// ─────────────────────────────────────────────\n// Chat\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: z.string().min(1).optional(), // obrigatório para grupos\n description: z.string().max(500).optional(),\n photoURL: z.string().url().optional(),\n\n participantIds: z.array(IdModelProcess).min(2).max(100),\n participants: z.array(ParticipantSchema),\n\n lastMessage: LastMessageSchema.optional(),\n\n // { [userId]: count } — quantas msgs não lidas por usuário\n unreadCount: z.record(z.string(), z.number()).default({}),\n\n // { [userId]: true } — chats silenciados por usuário\n isMuted: z.record(z.string(), z.boolean()).default({}),\n\n isArchived: z.boolean().default(false),\n\n createdBy: IdModelProcess,\n});\nexport type Chat = z.infer<typeof ChatSchema>;\n\nexport const CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true,\n});\nexport type CreateChat = z.infer<typeof CreateChatSchema>;\n\n// ─────────────────────────────────────────────\n// Typing Indicator\n// Persistido no Realtime Database (não no Firestore)\n// Não usa ModelSchema pois não é documento Firestore\n// ─────────────────────────────────────────────\n\nexport const TypingIndicatorSchema = ModelSchema.extend({\n userId: z.string(),\n displayName: z.string(),\n startedAt: z.number(), // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nexport type TypingIndicator = z.infer<typeof TypingIndicatorSchema>;\n\n// ─────────────────────────────────────────────\n// Helpers de validação\n// ─────────────────────────────────────────────\n\nexport const safeParseMessage = (data: unknown) => MessageSchema.safeParse(data);\nexport const safeParseChat = (data: unknown) => ChatSchema.safeParse(data);\nexport const validateMessage = (data: unknown) => MessageSchema.parse(data);\nexport const validateChat = (data: unknown) => ChatSchema.parse(data);\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/journey/chat.mjs","../../../src/model/journey/chat.ts","../../../src/model/shared.ts","../../../src/model.ts"],"names":["z","Timestamp","TimestampOrNow","preprocess","arg","now","custom","nullish","optional","cuid","generateFirestoreId","IdModelSchema","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","MessageTypeSchema","enum","ChatTypeSchema","MessageStatusSchema","ParticipantSchema","userId","displayName","min","photoURL","url","nullable","role","default","joinedAt","lastSeenAt","AttachmentSchema","name","size","positive","mimeType","thumbnailUrl","ReplyToSchema","messageId","senderId","senderName","content","max","type","MessageSchema","omit","chatId","senderPhotoURL","attachment","status","readBy","replyTo","editedAt","deletedAt","CreateMessageSchema","LastMessageSchema","sentAt","ChatSchema","participantIds","participants","lastMessage","isOpen","unreadCount","record","isMuted","isArchived","createdBy","CreateChatSchema","TypingIndicatorSchema","startedAt","safeParseMessage","data","safeParse","safeParseChat","validateMessage","parse","validateChat"],"mappings":"AAAA,4BAA4B;ACA5B,SAASA,KAAAA,EAAAA,QAAS,MAAA;ADGlB,sBAAsB;AEHtB,SAASC,SAAA,QAAiB,0BAAA;AAC1B,SAAQD,CAAA,QA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IAAMsE,mBAAmBV,WAAWZ,IAAA,CAAK;IAC9C5C,IAAI;IACJC,WAAW;IACXC,WAAW;IACXyD,aAAa;IACbE,aAAa;IACbE,SAAS;IACTC,YAAY;AACd;AASO,IAAMG,wBAAwBrE,YAAYQ,MAAA,CAAO;IACtDc,QAAQvC,GAAEa,MAAA;IACV2B,aAAaxC,GAAEa,MAAA;IACf0E,WAAWvF,GAAEc,MAAA;AACf;AAOO,IAAM0E,mBAAmB,SAACC;WAAkB3B,cAAc4B,SAAA,CAAUD;;AACpE,IAAME,gBAAmB,SAACF;WAAkBd,WAAWe,SAAA,CAAUD;;AACjE,IAAMG,kBAAmB,SAACH;WAAkB3B,cAAc+B,KAAA,CAAMJ;;AAChE,IAAMK,eAAmB,SAACL;WAAkBd,WAAWkB,KAAA,CAAMJ;;ADtCpE,SACExC,gBAAgB,EAChB0B,UAAU,EACVvC,cAAc,EACdiD,gBAAgB,EAChBb,mBAAmB,EACnBC,iBAAiB,EACjBX,aAAa,EACbzB,mBAAmB,EACnBH,iBAAiB,EACjBI,iBAAiB,EACjBiB,aAAa,EACb+B,qBAAqB,EACrBK,aAAa,EACbH,gBAAgB,EAChBM,YAAY,EACZF,eAAe,GACf","sourcesContent":["// src/model/journey/chat.ts\nimport { z as z3 } from \"zod\";\n\n// src/model/shared.ts\nimport { Timestamp } from \"@google-cloud/firestore\";\nimport { z } from \"zod\";\nvar TimestampOrNow = z.preprocess(\n (arg) => arg === void 0 ? Timestamp.now() : arg,\n z.custom()\n).nullish().optional();\n\n// src/model.ts\nimport { z as z2 } from \"zod\";\nimport cuid from \"cuid\";\nvar generateFirestoreId = () => {\n return cuid();\n};\nvar IdModelSchema = z2.union([z2.string(), z2.number()]);\nvar IdModelProcess = z2.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = z2.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z2.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: z2.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = z2.object({\n enabled: z2.boolean().optional()\n});\nvar DocumentHistorySchema = z2.object({\n createdAt: TimestampOrNow,\n description: z2.string().optional()\n});\n\n// src/model/journey/chat.ts\nvar MessageTypeSchema = z3.enum([\"text\", \"image\", \"file\", \"audio\"]);\nvar ChatTypeSchema = z3.enum([\"direct\", \"group\"]);\nvar MessageStatusSchema = z3.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nvar ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: z3.string().min(1),\n photoURL: z3.string().url().nullable().optional(),\n role: z3.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow\n});\nvar AttachmentSchema = ModelSchema.extend({\n url: z3.string().url(),\n name: z3.string(),\n size: z3.number().positive(),\n // bytes\n mimeType: z3.string(),\n thumbnailUrl: z3.string().url().optional()\n});\nvar ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z3.string(),\n content: z3.string().max(200),\n type: MessageTypeSchema\n});\nvar MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z3.string().min(1),\n senderPhotoURL: z3.string().url().nullable().optional(),\n type: MessageTypeSchema,\n content: z3.string().min(1).max(4e3),\n attachment: AttachmentSchema.optional(),\n status: MessageStatusSchema.default(\"sending\"),\n readBy: z3.array(z3.string()).default([]),\n // array de userIds\n replyTo: ReplyToSchema.optional(),\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow\n});\nvar CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true\n});\nvar LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: z3.string(),\n senderId: IdModelProcess,\n senderName: z3.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow\n});\nvar ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: z3.string().min(1).optional(),\n description: z3.string().max(500).optional(),\n photoURL: z3.string().url().optional(),\n participantIds: z3.array(IdModelProcess).min(2).max(100),\n participants: z3.array(ParticipantSchema),\n lastMessage: LastMessageSchema.optional(),\n isOpen: z3.boolean().default(true),\n enabled: z3.boolean().default(true),\n unreadCount: z3.record(z3.string(), z3.number()).default({}),\n // { [userId]: true } — chats silenciados por usuário\n isMuted: z3.record(z3.string(), z3.boolean()).default({}),\n isArchived: z3.boolean().default(false),\n createdBy: IdModelProcess\n});\nvar CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true\n});\nvar TypingIndicatorSchema = ModelSchema.extend({\n userId: z3.string(),\n displayName: z3.string(),\n startedAt: z3.number()\n // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nvar safeParseMessage = (data) => MessageSchema.safeParse(data);\nvar safeParseChat = (data) => ChatSchema.safeParse(data);\nvar validateMessage = (data) => MessageSchema.parse(data);\nvar validateChat = (data) => ChatSchema.parse(data);\nexport {\n AttachmentSchema,\n ChatSchema,\n ChatTypeSchema,\n CreateChatSchema,\n CreateMessageSchema,\n LastMessageSchema,\n MessageSchema,\n MessageStatusSchema,\n MessageTypeSchema,\n ParticipantSchema,\n ReplyToSchema,\n TypingIndicatorSchema,\n safeParseChat,\n safeParseMessage,\n validateChat,\n validateMessage\n};\n","import { z } from \"zod\";\nimport {TimestampOrNow} from \"../shared\";\nimport {IdModelProcess, ModelSchema} from \"../../model\";\n\n// ─────────────────────────────────────────────\n// Enums\n// ─────────────────────────────────────────────\n\nexport const MessageTypeSchema = z.enum([\"text\", \"image\", \"file\", \"audio\"]);\nexport type MessageType = z.infer<typeof MessageTypeSchema>;\n\nexport const ChatTypeSchema = z.enum([\"direct\", \"group\"]);\nexport type ChatType = z.infer<typeof ChatTypeSchema>;\n\nexport const MessageStatusSchema = z.enum([\"sending\", \"sent\", \"delivered\", \"read\", \"failed\"]);\nexport type MessageStatus = z.infer<typeof MessageStatusSchema>;\n\n// ─────────────────────────────────────────────\n// Participant\n// Não estende ModelSchema pois é sub-documento (não tem coleção própria)\n// ─────────────────────────────────────────────\n\nexport const ParticipantSchema = ModelSchema.extend({\n userId: IdModelProcess,\n displayName: z.string().min(1),\n photoURL: z.string().url().nullable().optional(),\n role: z.enum([\"admin\", \"member\"]).default(\"member\"),\n joinedAt: TimestampOrNow,\n lastSeenAt: TimestampOrNow,\n});\nexport type Participant = z.infer<typeof ParticipantSchema>;\n\n// ─────────────────────────────────────────────\n// Attachment\n// Sub-documento, sem id próprio\n// ─────────────────────────────────────────────\n\nexport const AttachmentSchema = ModelSchema.extend({\n url: z.string().url(),\n name: z.string(),\n size: z.number().positive(), // bytes\n mimeType: z.string(),\n thumbnailUrl: z.string().url().optional(),\n});\nexport type Attachment = z.infer<typeof AttachmentSchema>;\n\n// ─────────────────────────────────────────────\n// ReplyTo\n// Snapshot da mensagem original (evita lookup extra)\n// ─────────────────────────────────────────────\n\nexport const ReplyToSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string(),\n content: z.string().max(200),\n type: MessageTypeSchema,\n});\nexport type ReplyTo = z.infer<typeof ReplyToSchema>;\n\n// ─────────────────────────────────────────────\n// Message\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const MessageSchema = ModelSchema.omit({ order: true }).extend({\n chatId: IdModelProcess,\n senderId: IdModelProcess,\n senderName: z.string().min(1),\n senderPhotoURL: z.string().url().nullable().optional(),\n\n type: MessageTypeSchema,\n content: z.string().min(1).max(4000),\n\n attachment: AttachmentSchema.optional(),\n\n status: MessageStatusSchema.default(\"sending\"),\n readBy: z.array(z.string()).default([]), // array de userIds\n\n replyTo: ReplyToSchema.optional(),\n\n editedAt: TimestampOrNow,\n deletedAt: TimestampOrNow,\n});\nexport type Message = z.infer<typeof MessageSchema>;\n\n// Para criar — omite campos gerados automaticamente pelo ModelSchema/servidor\nexport const CreateMessageSchema = MessageSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n status: true,\n readBy: true,\n editedAt: true,\n deletedAt: true,\n});\nexport type CreateMessage = z.infer<typeof CreateMessageSchema>;\n\n// ─────────────────────────────────────────────\n// LastMessage\n// Snapshot da última mensagem para preview na lista de chats\n// ─────────────────────────────────────────────\n\nexport const LastMessageSchema = ModelSchema.extend({\n messageId: IdModelProcess,\n content: z.string(),\n senderId: IdModelProcess,\n senderName: z.string(),\n type: MessageTypeSchema,\n sentAt: TimestampOrNow,\n});\nexport type LastMessage = z.infer<typeof LastMessageSchema>;\n\n// ─────────────────────────────────────────────\n// Chat\n// Estende ModelSchema — herda id, createdAt, updatedAt, order\n// ─────────────────────────────────────────────\n\nexport const ChatSchema = ModelSchema.omit({ order: true }).extend({\n type: ChatTypeSchema,\n name: z.string().min(1).optional(),\n description: z.string().max(500).optional(),\n photoURL: z.string().url().optional(),\n\n participantIds: z.array(IdModelProcess).min(2).max(100),\n participants: z.array(ParticipantSchema),\n\n lastMessage: LastMessageSchema.optional(),\n\n isOpen: z.boolean().default(true),\n enabled: z.boolean().default(true),\n unreadCount: z.record(z.string(), z.number()).default({}),\n\n // { [userId]: true } — chats silenciados por usuário\n isMuted: z.record(z.string(), z.boolean()).default({}),\n\n isArchived: z.boolean().default(false),\n\n createdBy: IdModelProcess,\n});\nexport type Chat = z.infer<typeof ChatSchema>;\n\nexport const CreateChatSchema = ChatSchema.omit({\n id: true,\n createdAt: true,\n updatedAt: true,\n lastMessage: true,\n unreadCount: true,\n isMuted: true,\n isArchived: true,\n});\nexport type CreateChat = z.infer<typeof CreateChatSchema>;\n\n// ─────────────────────────────────────────────\n// Typing Indicator\n// Persistido no Realtime Database (não no Firestore)\n// Não usa ModelSchema pois não é documento Firestore\n// ─────────────────────────────────────────────\n\nexport const TypingIndicatorSchema = ModelSchema.extend({\n userId: z.string(),\n displayName: z.string(),\n startedAt: z.number(), // Unix timestamp — RTDB não usa Timestamp do Firestore\n});\nexport type TypingIndicator = z.infer<typeof TypingIndicatorSchema>;\n\n// ─────────────────────────────────────────────\n// Helpers de validação\n// ─────────────────────────────────────────────\n\nexport const safeParseMessage = (data: unknown) => MessageSchema.safeParse(data);\nexport const safeParseChat = (data: unknown) => ChatSchema.safeParse(data);\nexport const validateMessage = (data: unknown) => MessageSchema.parse(data);\nexport const validateChat = (data: unknown) => ChatSchema.parse(data);\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n"]}
|
|
@@ -8,6 +8,7 @@ declare const ActivityProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
8
8
|
order: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
9
9
|
}, {
|
|
10
10
|
completionPercentage: z.ZodNumber;
|
|
11
|
+
startsWith: z.ZodOptional<z.ZodNumber>;
|
|
11
12
|
lastChange: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
|
|
12
13
|
}>, "strip", z.ZodTypeAny, {
|
|
13
14
|
id: string | number;
|
|
@@ -16,6 +17,7 @@ declare const ActivityProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
16
17
|
createdAt?: Timestamp | null | undefined;
|
|
17
18
|
updatedAt?: Timestamp | null | undefined;
|
|
18
19
|
order?: number | null | undefined;
|
|
20
|
+
startsWith?: number | undefined;
|
|
19
21
|
}, {
|
|
20
22
|
lastChange: Timestamp;
|
|
21
23
|
completionPercentage: number;
|
|
@@ -23,6 +25,7 @@ declare const ActivityProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
23
25
|
createdAt?: unknown;
|
|
24
26
|
updatedAt?: unknown;
|
|
25
27
|
order?: number | null | undefined;
|
|
28
|
+
startsWith?: number | undefined;
|
|
26
29
|
}>;
|
|
27
30
|
declare const ModuleProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
28
31
|
id: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string | number, unknown>;
|
|
@@ -59,6 +62,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
59
62
|
order: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
60
63
|
}, {
|
|
61
64
|
completionPercentage: z.ZodNumber;
|
|
65
|
+
startsWith: z.ZodOptional<z.ZodNumber>;
|
|
62
66
|
lastChange: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
|
|
63
67
|
}>, "strip", z.ZodTypeAny, {
|
|
64
68
|
id: string | number;
|
|
@@ -67,6 +71,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
67
71
|
createdAt?: Timestamp | null | undefined;
|
|
68
72
|
updatedAt?: Timestamp | null | undefined;
|
|
69
73
|
order?: number | null | undefined;
|
|
74
|
+
startsWith?: number | undefined;
|
|
70
75
|
}, {
|
|
71
76
|
lastChange: Timestamp;
|
|
72
77
|
completionPercentage: number;
|
|
@@ -74,6 +79,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
74
79
|
createdAt?: unknown;
|
|
75
80
|
updatedAt?: unknown;
|
|
76
81
|
order?: number | null | undefined;
|
|
82
|
+
startsWith?: number | undefined;
|
|
77
83
|
}>, "many">;
|
|
78
84
|
}>, "strip", z.ZodTypeAny, {
|
|
79
85
|
id: string | number;
|
|
@@ -84,6 +90,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
84
90
|
createdAt?: Timestamp | null | undefined;
|
|
85
91
|
updatedAt?: Timestamp | null | undefined;
|
|
86
92
|
order?: number | null | undefined;
|
|
93
|
+
startsWith?: number | undefined;
|
|
87
94
|
}[];
|
|
88
95
|
completionCounter: number;
|
|
89
96
|
createdAt?: Timestamp | null | undefined;
|
|
@@ -97,6 +104,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
97
104
|
createdAt?: unknown;
|
|
98
105
|
updatedAt?: unknown;
|
|
99
106
|
order?: number | null | undefined;
|
|
107
|
+
startsWith?: number | undefined;
|
|
100
108
|
}[];
|
|
101
109
|
completionCounter: number;
|
|
102
110
|
id?: unknown;
|
package/dist/model/purchase.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ declare const ActivityProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
8
8
|
order: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
9
9
|
}, {
|
|
10
10
|
completionPercentage: z.ZodNumber;
|
|
11
|
+
startsWith: z.ZodOptional<z.ZodNumber>;
|
|
11
12
|
lastChange: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
|
|
12
13
|
}>, "strip", z.ZodTypeAny, {
|
|
13
14
|
id: string | number;
|
|
@@ -16,6 +17,7 @@ declare const ActivityProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
16
17
|
createdAt?: Timestamp | null | undefined;
|
|
17
18
|
updatedAt?: Timestamp | null | undefined;
|
|
18
19
|
order?: number | null | undefined;
|
|
20
|
+
startsWith?: number | undefined;
|
|
19
21
|
}, {
|
|
20
22
|
lastChange: Timestamp;
|
|
21
23
|
completionPercentage: number;
|
|
@@ -23,6 +25,7 @@ declare const ActivityProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
|
23
25
|
createdAt?: unknown;
|
|
24
26
|
updatedAt?: unknown;
|
|
25
27
|
order?: number | null | undefined;
|
|
28
|
+
startsWith?: number | undefined;
|
|
26
29
|
}>;
|
|
27
30
|
declare const ModuleProgressSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
28
31
|
id: z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, string | number, unknown>;
|
|
@@ -59,6 +62,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
59
62
|
order: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
60
63
|
}, {
|
|
61
64
|
completionPercentage: z.ZodNumber;
|
|
65
|
+
startsWith: z.ZodOptional<z.ZodNumber>;
|
|
62
66
|
lastChange: z.ZodType<Timestamp, z.ZodTypeDef, Timestamp>;
|
|
63
67
|
}>, "strip", z.ZodTypeAny, {
|
|
64
68
|
id: string | number;
|
|
@@ -67,6 +71,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
67
71
|
createdAt?: Timestamp | null | undefined;
|
|
68
72
|
updatedAt?: Timestamp | null | undefined;
|
|
69
73
|
order?: number | null | undefined;
|
|
74
|
+
startsWith?: number | undefined;
|
|
70
75
|
}, {
|
|
71
76
|
lastChange: Timestamp;
|
|
72
77
|
completionPercentage: number;
|
|
@@ -74,6 +79,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
74
79
|
createdAt?: unknown;
|
|
75
80
|
updatedAt?: unknown;
|
|
76
81
|
order?: number | null | undefined;
|
|
82
|
+
startsWith?: number | undefined;
|
|
77
83
|
}>, "many">;
|
|
78
84
|
}>, "strip", z.ZodTypeAny, {
|
|
79
85
|
id: string | number;
|
|
@@ -84,6 +90,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
84
90
|
createdAt?: Timestamp | null | undefined;
|
|
85
91
|
updatedAt?: Timestamp | null | undefined;
|
|
86
92
|
order?: number | null | undefined;
|
|
93
|
+
startsWith?: number | undefined;
|
|
87
94
|
}[];
|
|
88
95
|
completionCounter: number;
|
|
89
96
|
createdAt?: Timestamp | null | undefined;
|
|
@@ -97,6 +104,7 @@ declare const ModuleProgressWithActivitiesSchema: z.ZodObject<z.objectUtil.exten
|
|
|
97
104
|
createdAt?: unknown;
|
|
98
105
|
updatedAt?: unknown;
|
|
99
106
|
order?: number | null | undefined;
|
|
107
|
+
startsWith?: number | undefined;
|
|
100
108
|
}[];
|
|
101
109
|
completionCounter: number;
|
|
102
110
|
id?: unknown;
|
package/dist/model/purchase.js
CHANGED
|
@@ -119,6 +119,7 @@ var DocumentHistorySchema = import_zod2.z.object({
|
|
|
119
119
|
var import_zod3 = require("zod");
|
|
120
120
|
var ActivityProgressSchema = ModelSchema.extend({
|
|
121
121
|
completionPercentage: import_zod3.z.coerce.number(),
|
|
122
|
+
startsWith: import_zod3.z.coerce.number().optional(),
|
|
122
123
|
lastChange: import_zod3.z.custom()
|
|
123
124
|
});
|
|
124
125
|
var ModuleProgressSchema = ModelSchema.extend({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.js","../../src/model/purchase.ts","../../src/model.ts","../../src/model/shared.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","purchase_exports","ActivityProgressSchema","ModuleProgressSchema","ModuleProgressWithActivitiesSchema","PurchaseSchema","module","exports","import_zod","require","import_firestore","TimestampOrNow","z","preprocess","arg","Timestamp","now","custom","nullish","optional","import_cuid","generateFirestoreId","cuid","IdModelSchema","import_zod2","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","completionPercentage","import_zod3","lastChange","completionCounter","activities","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA;AACA,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,wBAAwB;AACtD,IAAIC,oBAAoBN,OAAOO,mBAAmB;AAClD,IAAIC,eAAeR,OAAOS,cAAc;AACxC,IAAIC,eAAeV,OAAOW,SAAS,CAACC,cAAc;AAClD,IAAIC,WAAW,SAACC,QAAQC;IACtB,IAAK,IAAIC,QAAQD,IACfb,UAAUY,QAAQE,MAAM;QAAEC,KAAKF,GAAG,CAACC,KAAK;QAAEE,YAAY;IAAK;AAC/D;AACA,IAAIC,cAAc,SAACC,IAAIC,MAAMC,QAAQC;IACnC,IAAIF,QAAQ,OAAOA,SAAS,YAAY,OAAOA,SAAS,YAAY;YAC7D,kCAAA,2BAAA;;;gBA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d,uBAAuB2B,YAAYQ,MAAA,CAAO;IACrDY,mBAAmBF,YAAApC,CAAA,CAAEwB,MAAA,CAAOT,MAAA;AAC9B;AAEO,IAAMvB,qCAAqCD,qBAAqBmC,MAAA,CAAO;IAC5Ea,YAAYjD,uBAAuBuC,KAAA;AACrC;AAEO,IAAMpC,iBAAiByB,YAAYQ,MAAA,CAAO;IAC/Cc,gBAAgBJ,YAAApC,CAAA,CAAEc,MAAA,GAASP,QAAA;IAC3BkC,cAAcL,YAAApC,CAAA,CAAEc,MAAA,GAASP,QAAA;IACzBmC,gBAAgBN,YAAApC,CAAA,CAAEc,MAAA,GAASe,KAAA,GAAQtB,QAAA;AACrC;AD2EA,6DAA6D;AAC7D,KAAMb,CAAAA,OAAOC,OAAO,GAAG;IACrBL,wBAAAA;IACAC,sBAAAA;IACAC,oCAAAA;IACAC,gBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/model/purchase.ts\nvar purchase_exports = {};\n__export(purchase_exports, {\n ActivityProgressSchema: () => ActivityProgressSchema,\n ModuleProgressSchema: () => ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema: () => ModuleProgressWithActivitiesSchema,\n PurchaseSchema: () => PurchaseSchema\n});\nmodule.exports = __toCommonJS(purchase_exports);\n\n// src/model.ts\nvar import_zod2 = require(\"zod\");\n\n// src/model/shared.ts\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar import_zod = require(\"zod\");\nvar TimestampOrNow = import_zod.z.preprocess(\n (arg) => arg === void 0 ? import_firestore.Timestamp.now() : arg,\n import_zod.z.custom()\n).nullish().optional();\n\n// src/model.ts\nvar import_cuid = __toESM(require(\"cuid\"));\nvar generateFirestoreId = () => {\n return (0, import_cuid.default)();\n};\nvar IdModelSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]);\nvar IdModelProcess = import_zod2.z.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = import_zod2.z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: import_zod2.z.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: import_zod2.z.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = import_zod2.z.object({\n enabled: import_zod2.z.boolean().optional()\n});\nvar DocumentHistorySchema = import_zod2.z.object({\n createdAt: TimestampOrNow,\n description: import_zod2.z.string().optional()\n});\n\n// src/model/purchase.ts\nvar import_zod3 = require(\"zod\");\nvar ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: import_zod3.z.coerce.number(),\n lastChange: import_zod3.z.custom()\n});\nvar ModuleProgressSchema = ModelSchema.extend({\n completionCounter: import_zod3.z.coerce.number()\n});\nvar ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n});\nvar PurchaseSchema = ModelSchema.extend({\n nextActivityId: import_zod3.z.string().optional(),\n nextModuleId: import_zod3.z.string().optional(),\n modulesAllowed: import_zod3.z.string().array().optional()\n});\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n ActivityProgressSchema,\n ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema,\n PurchaseSchema\n});\n","import {ModelSchema} from \"../model\";\nimport {z} from \"zod\";\nimport {Timestamp} from \"@google-cloud/firestore\";\n\nexport const ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z.coerce.number(),\n lastChange: z.custom<Timestamp>()\n})\n\nexport const ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z.coerce.number()\n})\n\nexport const ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n})\n\nexport const PurchaseSchema = ModelSchema.extend({\n nextActivityId: z.string().optional(),\n nextModuleId: z.string().optional(),\n modulesAllowed: z.string().array().optional()\n})\n\nexport type ActivityProgress = z.infer<typeof ActivityProgressSchema>\nexport type ModuleProgress = z.infer<typeof ModuleProgressSchema>\nexport type ModuleProgressWithActivities = z.infer<typeof ModuleProgressWithActivitiesSchema>\nexport type Purchase = z.infer<typeof PurchaseSchema>\n\n\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n"]}
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.js","../../src/model/purchase.ts","../../src/model.ts","../../src/model/shared.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toESM","mod","isNodeMode","__esModule","value","__toCommonJS","purchase_exports","ActivityProgressSchema","ModuleProgressSchema","ModuleProgressWithActivitiesSchema","PurchaseSchema","module","exports","import_zod","require","import_firestore","TimestampOrNow","z","preprocess","arg","Timestamp","now","custom","nullish","optional","import_cuid","generateFirestoreId","cuid","IdModelSchema","import_zod2","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","completionPercentage","import_zod3","startsWith","lastChange","completionCounter","activities","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA;AACA,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,w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AASnB,YAAAZ,CAAA,CAAEgC,OAAA,GAAUzB,QAAA;AACvB;AAEO,IAAM0B,wBAAwBrB,YAAAZ,CAAA,CAAEmB,MAAA,CAAO;IAC5CE,WAAWtB;IACXmC,aAAatB,YAAAZ,CAAA,CAAEc,MAAA,GAASP,QAAA;AAC1B;AF4CA,wBAAwB;AC9ExB,IAAAX,cAAgBC,QAAA;AAGT,IAAMP,yBAAyB4B,YAAYQ,MAAA,CAAO;IACvDS,sBAAsBC,YAAApC,CAAA,CAAEwB,MAAA,CAAOT,MAAA;IAC/BsB,YAAYD,YAAApC,CAAA,CAAEwB,MAAA,CAAOT,MAAA,GAASR,QAAA;IAC9B+B,YAAYF,YAAApC,CAAA,CAAEK,MAAA;AAChB;AAEO,IAAMd,uBAAuB2B,YAAYQ,MAAA,CAAO;IACrDa,mBAAmBH,YAAApC,CAAA,CAAEwB,MAAA,CAAOT,MAAA;AAC9B;AAEO,IAAMvB,qCAAqCD,qBAAqBmC,MAAA,CAAO;IAC5Ec,YAAYlD,uBAAuBuC,KAAA;AACrC;AAEO,IAAMpC,iBAAiByB,YAAYQ,MAAA,CAAO;IAC/Ce,gBAAgBL,YAAApC,CAAA,CAAEc,MAAA,GAASP,QAAA;IAC3BmC,cAAcN,YAAApC,CAAA,CAAEc,MAAA,GAASP,QAAA;IACzBoC,gBAAgBP,YAAApC,CAAA,CAAEc,MAAA,GAASe,KAAA,GAAQtB,QAAA;AACrC;AD2EA,6DAA6D;AAC7D,KAAMb,CAAAA,OAAOC,OAAO,GAAG;IACrBL,wBAAAA;IACAC,sBAAAA;IACAC,oCAAAA;IACAC,gBAAAA;AACF,CAAA","sourcesContent":["\"use strict\";\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n// src/model/purchase.ts\nvar purchase_exports = {};\n__export(purchase_exports, {\n ActivityProgressSchema: () => ActivityProgressSchema,\n ModuleProgressSchema: () => ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema: () => ModuleProgressWithActivitiesSchema,\n PurchaseSchema: () => PurchaseSchema\n});\nmodule.exports = __toCommonJS(purchase_exports);\n\n// src/model.ts\nvar import_zod2 = require(\"zod\");\n\n// src/model/shared.ts\nvar import_firestore = require(\"@google-cloud/firestore\");\nvar import_zod = require(\"zod\");\nvar TimestampOrNow = import_zod.z.preprocess(\n (arg) => arg === void 0 ? import_firestore.Timestamp.now() : arg,\n import_zod.z.custom()\n).nullish().optional();\n\n// src/model.ts\nvar import_cuid = __toESM(require(\"cuid\"));\nvar generateFirestoreId = () => {\n return (0, import_cuid.default)();\n};\nvar IdModelSchema = import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number()]);\nvar IdModelProcess = import_zod2.z.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = import_zod2.z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: import_zod2.z.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: import_zod2.z.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = import_zod2.z.object({\n enabled: import_zod2.z.boolean().optional()\n});\nvar DocumentHistorySchema = import_zod2.z.object({\n createdAt: TimestampOrNow,\n description: import_zod2.z.string().optional()\n});\n\n// src/model/purchase.ts\nvar import_zod3 = require(\"zod\");\nvar ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: import_zod3.z.coerce.number(),\n startsWith: import_zod3.z.coerce.number().optional(),\n lastChange: import_zod3.z.custom()\n});\nvar ModuleProgressSchema = ModelSchema.extend({\n completionCounter: import_zod3.z.coerce.number()\n});\nvar ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n});\nvar PurchaseSchema = ModelSchema.extend({\n nextActivityId: import_zod3.z.string().optional(),\n nextModuleId: import_zod3.z.string().optional(),\n modulesAllowed: import_zod3.z.string().array().optional()\n});\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n ActivityProgressSchema,\n ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema,\n PurchaseSchema\n});\n","import {ModelSchema} from \"../model\";\nimport {z} from \"zod\";\nimport {Timestamp} from \"@google-cloud/firestore\";\n\nexport const ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z.coerce.number(),\n startsWith: z.coerce.number().optional(),\n lastChange: z.custom<Timestamp>()\n})\n\nexport const ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z.coerce.number()\n})\n\nexport const ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n})\n\nexport const PurchaseSchema = ModelSchema.extend({\n nextActivityId: z.string().optional(),\n nextModuleId: z.string().optional(),\n modulesAllowed: z.string().array().optional()\n})\n\nexport type ActivityProgress = z.infer<typeof ActivityProgressSchema>\nexport type ModuleProgress = z.infer<typeof ModuleProgressSchema>\nexport type ModuleProgressWithActivities = z.infer<typeof ModuleProgressWithActivitiesSchema>\nexport type Purchase = z.infer<typeof PurchaseSchema>\n\n\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n"]}
|
package/dist/model/purchase.mjs
CHANGED
|
@@ -43,6 +43,7 @@ var DocumentHistorySchema = z2.object({
|
|
|
43
43
|
import { z as z3 } from "zod";
|
|
44
44
|
var ActivityProgressSchema = ModelSchema.extend({
|
|
45
45
|
completionPercentage: z3.coerce.number(),
|
|
46
|
+
startsWith: z3.coerce.number().optional(),
|
|
46
47
|
lastChange: z3.custom()
|
|
47
48
|
});
|
|
48
49
|
var ModuleProgressSchema = ModelSchema.extend({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.mjs","../../src/model.ts","../../src/model/shared.ts","../../src/model/purchase.ts"],"names":["z","Timestamp","TimestampOrNow","preprocess","arg","now","custom","nullish","optional","cuid","generateFirestoreId","IdModelSchema","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","ActivityProgressSchema","completionPercentage","lastChange","ModuleProgressSchema","completionCounter","ModuleProgressWithActivitiesSchema","activities","PurchaseSchema","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA,eAAe;ACAf,SAAQA,KAAAA,EAAAA,QAAQ,MAAA;ADGhB,sBAAsB;AEHtB,SAASC,SAAA,QAAiB,0BAAA;AAC1B,SAAQD,CAAA,QAAQ,MAAA;AAET,IAAME,iBAAiBF,EAC3BG,UAAA,CACC,SAACC;WAASA,QAAQ,KAAA,IAAYH,UAAUI,GAAA,KAAQD;GAChDJ,EAAEM,MAAA,IAEHC,OAAA,GAAUC,QAAA;AFGb,eAAe;ACTf,OAAOC,UAAU,OAAA;AAEV,IAAMC,sBAAsB;IACjC,OAAOD;AACT;AAEO,IAAME,gBAAgBX,GAAEY,KAAA,CAAM;IAACZ,GAAEa,MAAA;IAAUb,GAAEc,MAAA;CAAS;AAEtD,IAAMC,iBAAiBf,GAAEG,UAAA,CAAW,SAACa;IAC1C,IAAIA,QAAQ,KAAA,KAAaA,QAAQ,MAAM;QACrC,OAAON;IACT;IACA,OAAOM;AACT,GAAGL;AAEI,IAAMM,cAAcjB,GAAEkB,MAAA,CAAO;IAClCC,IAAIJ;IACJK,WAAWlB;IACXmB,WAAWnB;IACXoB,OAAOtB,GAAEuB,MAAA,CAAOT,MAAA,GAASP,OAAA,GAAUC,QAAA;AACrC;AAEO,IAAMgB,iBAAiBP,YAAYQ,MAAA,CAAO;IAC/CC,UAAU1B,GAAE2B,IAAA,CAAK;eAAMV,YAAYW,KAAA,GAAQpB,QAAA;;AAC7C;AAEO,IAAMqB,gBAAgB7B,GAAEkB,MAAA,CAAO;IACpCY,SAAS9B,GAAE+B,OAAA,GAAUvB,QAAA;AACvB;AAEO,IAAMwB,wBAAwBhC,GAAEkB,MAAA,CAAO;IAC5CE,WAAWlB;IACX+B,aAAajC,GAAEa,MAAA,GAASL,QAAA;AAC1B;ADKA,wBAAwB;AGvCxB,SAAQR,KAAAA,EAAAA,QAAQ,MAAA;AAGT,IAAMkC,yBAAyBjB,YAAYQ,MAAA,CAAO;IACvDU,sBAAsBnC,GAAEuB,MAAA,CAAOT,MAAA;IAC/BsB,YAAYpC,GAAEM,MAAA;AAChB;AAEO,
|
|
1
|
+
{"version":3,"sources":["/Users/henriquewilson/Developer/Projects/gabirubi-domain/dist/model/purchase.mjs","../../src/model.ts","../../src/model/shared.ts","../../src/model/purchase.ts"],"names":["z","Timestamp","TimestampOrNow","preprocess","arg","now","custom","nullish","optional","cuid","generateFirestoreId","IdModelSchema","union","string","number","IdModelProcess","val","ModelSchema","object","id","createdAt","updatedAt","order","coerce","PreviousSchema","extend","previous","lazy","array","EnabledSchema","enabled","boolean","DocumentHistorySchema","description","ActivityProgressSchema","completionPercentage","startsWith","lastChange","ModuleProgressSchema","completionCounter","ModuleProgressWithActivitiesSchema","activities","PurchaseSchema","nextActivityId","nextModuleId","modulesAllowed"],"mappings":"AAAA,eAAe;ACAf,SAAQA,KAAAA,EAAAA,QAAQ,MAAA;ADGhB,sBAAsB;AEHtB,SAASC,SAAA,QAAiB,0BAAA;AAC1B,SAAQD,CAAA,QAAQ,MAAA;AAET,IAAME,iBAAiBF,EAC3BG,UAAA,CACC,SAACC;WAASA,QAAQ,KAAA,IAAYH,UAAUI,GAAA,KAAQD;GAChDJ,EAAEM,MAAA,IAEHC,OAAA,GAAUC,QAAA;AFGb,eAAe;ACTf,OA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Q,MAAA,CAAO;IAC/CkB,gBAAgB3C,GAAEa,MAAA,GAASL,QAAA;IAC3BoC,cAAc5C,GAAEa,MAAA,GAASL,QAAA;IACzBqC,gBAAgB7C,GAAEa,MAAA,GAASe,KAAA,GAAQpB,QAAA;AACrC;AHoCA,SACE0B,sBAAsB,EACtBI,oBAAoB,EACpBE,kCAAkC,EAClCE,cAAc,GACd","sourcesContent":["// src/model.ts\nimport { z as z2 } from \"zod\";\n\n// src/model/shared.ts\nimport { Timestamp } from \"@google-cloud/firestore\";\nimport { z } from \"zod\";\nvar TimestampOrNow = z.preprocess(\n (arg) => arg === void 0 ? Timestamp.now() : arg,\n z.custom()\n).nullish().optional();\n\n// src/model.ts\nimport cuid from \"cuid\";\nvar generateFirestoreId = () => {\n return cuid();\n};\nvar IdModelSchema = z2.union([z2.string(), z2.number()]);\nvar IdModelProcess = z2.preprocess((val) => {\n if (val === void 0 || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\nvar ModelSchema = z2.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z2.coerce.number().nullish().optional()\n});\nvar PreviousSchema = ModelSchema.extend({\n previous: z2.lazy(() => ModelSchema.array().optional())\n});\nvar EnabledSchema = z2.object({\n enabled: z2.boolean().optional()\n});\nvar DocumentHistorySchema = z2.object({\n createdAt: TimestampOrNow,\n description: z2.string().optional()\n});\n\n// src/model/purchase.ts\nimport { z as z3 } from \"zod\";\nvar ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z3.coerce.number(),\n startsWith: z3.coerce.number().optional(),\n lastChange: z3.custom()\n});\nvar ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z3.coerce.number()\n});\nvar ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n});\nvar PurchaseSchema = ModelSchema.extend({\n nextActivityId: z3.string().optional(),\n nextModuleId: z3.string().optional(),\n modulesAllowed: z3.string().array().optional()\n});\nexport {\n ActivityProgressSchema,\n ModuleProgressSchema,\n ModuleProgressWithActivitiesSchema,\n PurchaseSchema\n};\n","import {z} from \"zod\";\nimport {TimestampOrNow} from \"./model/shared\";\nimport cuid from 'cuid';\n\nexport const generateFirestoreId = () => {\n return cuid();\n}\n\nexport const IdModelSchema = z.union([z.string(), z.number()])\n\nexport const IdModelProcess = z.preprocess((val) => {\n if (val === undefined || val === null) {\n return generateFirestoreId();\n }\n return val;\n}, IdModelSchema);\n\nexport const ModelSchema = z.object({\n id: IdModelProcess,\n createdAt: TimestampOrNow,\n updatedAt: TimestampOrNow,\n order: z.coerce.number().nullish().optional()\n});\n\nexport const PreviousSchema = ModelSchema.extend({\n previous: z.lazy(() => ModelSchema.array().optional())\n})\n\nexport const EnabledSchema = z.object({\n enabled: z.boolean().optional()\n})\n\nexport const DocumentHistorySchema = z.object({\n createdAt: TimestampOrNow,\n description: z.string().optional(),\n})\n\nexport type IdModel = z.infer<typeof IdModelSchema>;\nexport type Model = z.infer<typeof ModelSchema>;\nexport type Previous = z.infer<typeof PreviousSchema>;\nexport type Enabled = z.infer<typeof EnabledSchema>;\nexport type PartialWithId<T extends Model> = Partial<T> & {\n id: NonNullable<T['id']>\n}\n\n\n","import { Timestamp } from '@google-cloud/firestore';\nimport {z} from \"zod\";\n\nexport const TimestampOrNow = z\n .preprocess(\n (arg) => (arg === undefined ? Timestamp.now() : arg),\n z.custom<Timestamp>(),\n )\n .nullish().optional();\n","import {ModelSchema} from \"../model\";\nimport {z} from \"zod\";\nimport {Timestamp} from \"@google-cloud/firestore\";\n\nexport const ActivityProgressSchema = ModelSchema.extend({\n completionPercentage: z.coerce.number(),\n startsWith: z.coerce.number().optional(),\n lastChange: z.custom<Timestamp>()\n})\n\nexport const ModuleProgressSchema = ModelSchema.extend({\n completionCounter: z.coerce.number()\n})\n\nexport const ModuleProgressWithActivitiesSchema = ModuleProgressSchema.extend({\n activities: ActivityProgressSchema.array()\n})\n\nexport const PurchaseSchema = ModelSchema.extend({\n nextActivityId: z.string().optional(),\n nextModuleId: z.string().optional(),\n modulesAllowed: z.string().array().optional()\n})\n\nexport type ActivityProgress = z.infer<typeof ActivityProgressSchema>\nexport type ModuleProgress = z.infer<typeof ModuleProgressSchema>\nexport type ModuleProgressWithActivities = z.infer<typeof ModuleProgressWithActivitiesSchema>\nexport type Purchase = z.infer<typeof PurchaseSchema>\n\n\n"]}
|