@zyacreatives/shared 2.2.34 → 2.2.36
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/schemas/chat.d.ts +70 -4
- package/dist/schemas/chat.js +12 -2
- package/package.json +1 -1
- package/src/schemas/chat.ts +16 -1
package/dist/schemas/chat.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const BaseChatEntitySchema: z.ZodObject<{
|
|
|
12
12
|
acceptedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
13
13
|
declinedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
14
14
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
15
|
-
updatedAt: z.ZodCoercedDate<unknown
|
|
15
|
+
updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
16
16
|
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
17
17
|
}, z.core.$strip>;
|
|
18
18
|
export declare const ChatEntitySchema: z.ZodObject<{
|
|
@@ -28,7 +28,7 @@ export declare const ChatEntitySchema: z.ZodObject<{
|
|
|
28
28
|
acceptedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
29
29
|
declinedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
30
30
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
31
|
-
updatedAt: z.ZodCoercedDate<unknown
|
|
31
|
+
updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
32
32
|
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
33
33
|
senderName: z.ZodString;
|
|
34
34
|
senderUsername: z.ZodString;
|
|
@@ -58,7 +58,7 @@ export declare const CreateChatOutputSchema: z.ZodObject<{
|
|
|
58
58
|
acceptedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
59
59
|
declinedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
60
60
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
61
|
-
updatedAt: z.ZodCoercedDate<unknown
|
|
61
|
+
updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
62
62
|
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
63
63
|
}, z.core.$strip>;
|
|
64
64
|
export declare const ChatIdSchema: z.ZodObject<{
|
|
@@ -77,7 +77,7 @@ export declare const GetChatsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
77
77
|
acceptedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
78
78
|
declinedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
79
79
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
80
|
-
updatedAt: z.ZodCoercedDate<unknown
|
|
80
|
+
updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
81
81
|
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
82
82
|
senderName: z.ZodString;
|
|
83
83
|
senderUsername: z.ZodString;
|
|
@@ -90,3 +90,69 @@ export declare const GetChatsOutputSchema: z.ZodArray<z.ZodObject<{
|
|
|
90
90
|
unreadCount: z.ZodDefault<z.ZodNumber>;
|
|
91
91
|
isOnline: z.ZodDefault<z.ZodBoolean>;
|
|
92
92
|
}, z.core.$strip>>;
|
|
93
|
+
export declare const GetChatsForUserOutputSchema: z.ZodObject<{
|
|
94
|
+
chats: z.ZodArray<z.ZodObject<{
|
|
95
|
+
id: z.ZodCUID2;
|
|
96
|
+
senderId: z.ZodCUID2;
|
|
97
|
+
receiverId: z.ZodCUID2;
|
|
98
|
+
isMessageRequest: z.ZodDefault<z.ZodBoolean>;
|
|
99
|
+
messageRequestStatus: z.ZodDefault<z.ZodEnum<{
|
|
100
|
+
readonly PENDING: "PENDING";
|
|
101
|
+
readonly ACCEPTED: "ACCEPTED";
|
|
102
|
+
readonly DECLINED: "DECLINED";
|
|
103
|
+
}>>;
|
|
104
|
+
acceptedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
105
|
+
declinedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
106
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
107
|
+
updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
108
|
+
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
109
|
+
senderName: z.ZodString;
|
|
110
|
+
senderUsername: z.ZodString;
|
|
111
|
+
senderImgUrl: z.ZodNullable<z.ZodString>;
|
|
112
|
+
receiverName: z.ZodString;
|
|
113
|
+
receiverUsername: z.ZodString;
|
|
114
|
+
receiverImgUrl: z.ZodNullable<z.ZodString>;
|
|
115
|
+
lastMessageSent: z.ZodNullable<z.ZodString>;
|
|
116
|
+
lastMessageAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
117
|
+
unreadCount: z.ZodDefault<z.ZodNumber>;
|
|
118
|
+
isOnline: z.ZodDefault<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
export declare const GetMessageRequestsForUserOutputSchema: z.ZodObject<{
|
|
123
|
+
chats: z.ZodArray<z.ZodObject<{
|
|
124
|
+
id: z.ZodCUID2;
|
|
125
|
+
senderId: z.ZodCUID2;
|
|
126
|
+
receiverId: z.ZodCUID2;
|
|
127
|
+
isMessageRequest: z.ZodDefault<z.ZodBoolean>;
|
|
128
|
+
messageRequestStatus: z.ZodDefault<z.ZodEnum<{
|
|
129
|
+
readonly PENDING: "PENDING";
|
|
130
|
+
readonly ACCEPTED: "ACCEPTED";
|
|
131
|
+
readonly DECLINED: "DECLINED";
|
|
132
|
+
}>>;
|
|
133
|
+
acceptedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
134
|
+
declinedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
135
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
136
|
+
updatedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
137
|
+
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
138
|
+
senderName: z.ZodString;
|
|
139
|
+
senderUsername: z.ZodString;
|
|
140
|
+
senderImgUrl: z.ZodNullable<z.ZodString>;
|
|
141
|
+
receiverName: z.ZodString;
|
|
142
|
+
receiverUsername: z.ZodString;
|
|
143
|
+
receiverImgUrl: z.ZodNullable<z.ZodString>;
|
|
144
|
+
lastMessageSent: z.ZodNullable<z.ZodString>;
|
|
145
|
+
lastMessageAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
146
|
+
unreadCount: z.ZodDefault<z.ZodNumber>;
|
|
147
|
+
isOnline: z.ZodDefault<z.ZodBoolean>;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
150
|
+
}, z.core.$strip>;
|
|
151
|
+
export declare const AcceptMessageRequestInput: z.ZodObject<{
|
|
152
|
+
chatId: z.ZodCUID2;
|
|
153
|
+
userId: z.ZodCUID2;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
export declare const DeclineMessageRequestInput: z.ZodObject<{
|
|
156
|
+
chatId: z.ZodCUID2;
|
|
157
|
+
userId: z.ZodCUID2;
|
|
158
|
+
}, z.core.$strip>;
|
package/dist/schemas/chat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetChatsOutputSchema = exports.ChatIdSchema = exports.CreateChatOutputSchema = exports.CreateChatInputSchema = exports.ChatEntitySchema = exports.BaseChatEntitySchema = void 0;
|
|
3
|
+
exports.DeclineMessageRequestInput = exports.AcceptMessageRequestInput = exports.GetMessageRequestsForUserOutputSchema = exports.GetChatsForUserOutputSchema = exports.GetChatsOutputSchema = exports.ChatIdSchema = exports.CreateChatOutputSchema = exports.CreateChatInputSchema = exports.ChatEntitySchema = exports.BaseChatEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
// 1. DB Representation (What is actually in Postgres)
|
|
@@ -13,7 +13,7 @@ exports.BaseChatEntitySchema = zod_openapi_1.z.object({
|
|
|
13
13
|
acceptedAt: zod_openapi_1.z.coerce.date().nullable(),
|
|
14
14
|
declinedAt: zod_openapi_1.z.coerce.date().nullable(),
|
|
15
15
|
createdAt: zod_openapi_1.z.coerce.date(),
|
|
16
|
-
updatedAt: zod_openapi_1.z.coerce.date(),
|
|
16
|
+
updatedAt: zod_openapi_1.z.coerce.date().nullable(),
|
|
17
17
|
deletedAt: zod_openapi_1.z.coerce.date().nullable(),
|
|
18
18
|
});
|
|
19
19
|
// 2. API Representation (Enriched with Redis/User data)
|
|
@@ -40,3 +40,13 @@ exports.ChatIdSchema = zod_openapi_1.z.object({
|
|
|
40
40
|
chatId: zod_openapi_1.z.cuid2(),
|
|
41
41
|
});
|
|
42
42
|
exports.GetChatsOutputSchema = zod_openapi_1.z.array(exports.ChatEntitySchema);
|
|
43
|
+
exports.GetChatsForUserOutputSchema = zod_openapi_1.z.object({
|
|
44
|
+
chats: zod_openapi_1.z.array(exports.ChatEntitySchema),
|
|
45
|
+
nextCursor: zod_openapi_1.z.string().nullable(),
|
|
46
|
+
});
|
|
47
|
+
exports.GetMessageRequestsForUserOutputSchema = exports.GetChatsForUserOutputSchema;
|
|
48
|
+
exports.AcceptMessageRequestInput = zod_openapi_1.z.object({
|
|
49
|
+
chatId: zod_openapi_1.z.cuid2(),
|
|
50
|
+
userId: zod_openapi_1.z.cuid2(),
|
|
51
|
+
});
|
|
52
|
+
exports.DeclineMessageRequestInput = exports.AcceptMessageRequestInput;
|
package/package.json
CHANGED
package/src/schemas/chat.ts
CHANGED
|
@@ -11,7 +11,7 @@ export const BaseChatEntitySchema = z.object({
|
|
|
11
11
|
acceptedAt: z.coerce.date().nullable(),
|
|
12
12
|
declinedAt: z.coerce.date().nullable(),
|
|
13
13
|
createdAt: z.coerce.date(),
|
|
14
|
-
updatedAt: z.coerce.date(),
|
|
14
|
+
updatedAt: z.coerce.date().nullable(),
|
|
15
15
|
deletedAt: z.coerce.date().nullable(),
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -45,3 +45,18 @@ export const ChatIdSchema = z.object({
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
export const GetChatsOutputSchema = z.array(ChatEntitySchema);
|
|
48
|
+
|
|
49
|
+
export const GetChatsForUserOutputSchema = z.object({
|
|
50
|
+
chats: z.array(ChatEntitySchema),
|
|
51
|
+
nextCursor: z.string().nullable(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const GetMessageRequestsForUserOutputSchema =
|
|
55
|
+
GetChatsForUserOutputSchema;
|
|
56
|
+
|
|
57
|
+
export const AcceptMessageRequestInput = z.object({
|
|
58
|
+
chatId: z.cuid2(),
|
|
59
|
+
userId: z.cuid2(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const DeclineMessageRequestInput = AcceptMessageRequestInput;
|