@zyacreatives/shared 2.2.37 → 2.2.39

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.
@@ -38,7 +38,7 @@ export declare const ChatEntitySchema: z.ZodObject<{
38
38
  receiverImgUrl: z.ZodNullable<z.ZodString>;
39
39
  lastMessageSent: z.ZodNullable<z.ZodString>;
40
40
  lastMessageAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
41
- unreadCount: z.ZodDefault<z.ZodNumber>;
41
+ isUnread: z.ZodDefault<z.ZodBoolean>;
42
42
  isOnline: z.ZodDefault<z.ZodBoolean>;
43
43
  }, z.core.$strip>;
44
44
  export declare const CreateChatInputSchema: z.ZodObject<{
@@ -87,7 +87,7 @@ export declare const GetChatsOutputSchema: z.ZodArray<z.ZodObject<{
87
87
  receiverImgUrl: z.ZodNullable<z.ZodString>;
88
88
  lastMessageSent: z.ZodNullable<z.ZodString>;
89
89
  lastMessageAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
90
- unreadCount: z.ZodDefault<z.ZodNumber>;
90
+ isUnread: z.ZodDefault<z.ZodBoolean>;
91
91
  isOnline: z.ZodDefault<z.ZodBoolean>;
92
92
  }, z.core.$strip>>;
93
93
  export declare const GetChatsForUserOutputSchema: z.ZodObject<{
@@ -114,7 +114,7 @@ export declare const GetChatsForUserOutputSchema: z.ZodObject<{
114
114
  receiverImgUrl: z.ZodNullable<z.ZodString>;
115
115
  lastMessageSent: z.ZodNullable<z.ZodString>;
116
116
  lastMessageAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
117
- unreadCount: z.ZodDefault<z.ZodNumber>;
117
+ isUnread: z.ZodDefault<z.ZodBoolean>;
118
118
  isOnline: z.ZodDefault<z.ZodBoolean>;
119
119
  }, z.core.$strip>>;
120
120
  nextCursor: z.ZodNullable<z.ZodString>;
@@ -143,7 +143,7 @@ export declare const GetMessageRequestsForUserOutputSchema: z.ZodObject<{
143
143
  receiverImgUrl: z.ZodNullable<z.ZodString>;
144
144
  lastMessageSent: z.ZodNullable<z.ZodString>;
145
145
  lastMessageAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
146
- unreadCount: z.ZodDefault<z.ZodNumber>;
146
+ isUnread: z.ZodDefault<z.ZodBoolean>;
147
147
  isOnline: z.ZodDefault<z.ZodBoolean>;
148
148
  }, z.core.$strip>>;
149
149
  nextCursor: z.ZodNullable<z.ZodString>;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeclineMessageRequestInputSchema = exports.AcceptMessageRequestInputSchema = 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
- // 1. DB Representation (What is actually in Postgres)
7
6
  exports.BaseChatEntitySchema = zod_openapi_1.z.object({
8
7
  id: zod_openapi_1.z.cuid2(),
9
8
  senderId: zod_openapi_1.z.cuid2(),
@@ -16,19 +15,16 @@ exports.BaseChatEntitySchema = zod_openapi_1.z.object({
16
15
  updatedAt: zod_openapi_1.z.coerce.date().nullable(),
17
16
  deletedAt: zod_openapi_1.z.coerce.date().nullable(),
18
17
  });
19
- // 2. API Representation (Enriched with Redis/User data)
20
18
  exports.ChatEntitySchema = exports.BaseChatEntitySchema.extend({
21
- // User Details (Joined)
22
19
  senderName: zod_openapi_1.z.string(),
23
20
  senderUsername: zod_openapi_1.z.string(),
24
21
  senderImgUrl: zod_openapi_1.z.string().nullable(),
25
22
  receiverName: zod_openapi_1.z.string(),
26
23
  receiverUsername: zod_openapi_1.z.string(),
27
24
  receiverImgUrl: zod_openapi_1.z.string().nullable(),
28
- // Ephemeral/Cached Data
29
25
  lastMessageSent: zod_openapi_1.z.string().nullable(),
30
- lastMessageAt: zod_openapi_1.z.coerce.date().nullable(), // Important for UI sorting
31
- unreadCount: zod_openapi_1.z.number().int().default(0),
26
+ lastMessageAt: zod_openapi_1.z.coerce.date().nullable(),
27
+ isUnread: zod_openapi_1.z.boolean().default(false),
32
28
  isOnline: zod_openapi_1.z.boolean().default(false),
33
29
  });
34
30
  exports.CreateChatInputSchema = zod_openapi_1.z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.37",
3
+ "version": "2.2.39",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,7 +1,6 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
  import { MESSAGE_REQUEST_STATUS } from "../constants";
3
3
 
4
- // 1. DB Representation (What is actually in Postgres)
5
4
  export const BaseChatEntitySchema = z.object({
6
5
  id: z.cuid2(),
7
6
  senderId: z.cuid2(),
@@ -15,9 +14,7 @@ export const BaseChatEntitySchema = z.object({
15
14
  deletedAt: z.coerce.date().nullable(),
16
15
  });
17
16
 
18
- // 2. API Representation (Enriched with Redis/User data)
19
17
  export const ChatEntitySchema = BaseChatEntitySchema.extend({
20
- // User Details (Joined)
21
18
  senderName: z.string(),
22
19
  senderUsername: z.string(),
23
20
  senderImgUrl: z.string().nullable(),
@@ -26,10 +23,9 @@ export const ChatEntitySchema = BaseChatEntitySchema.extend({
26
23
  receiverUsername: z.string(),
27
24
  receiverImgUrl: z.string().nullable(),
28
25
 
29
- // Ephemeral/Cached Data
30
26
  lastMessageSent: z.string().nullable(),
31
- lastMessageAt: z.coerce.date().nullable(), // Important for UI sorting
32
- unreadCount: z.number().int().default(0),
27
+ lastMessageAt: z.coerce.date().nullable(),
28
+ isUnread: z.boolean().default(false),
33
29
  isOnline: z.boolean().default(false),
34
30
  });
35
31