@zyacreatives/shared 2.2.57 → 2.2.59

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.
@@ -972,6 +972,10 @@ export declare const SearchUsersOutputSchema: z.ZodObject<{
972
972
  INVESTOR: "INVESTOR";
973
973
  ADMIN: "ADMIN";
974
974
  }>;
975
+ isFollowing: z.ZodOptional<z.ZodBoolean>;
976
+ followsYou: z.ZodOptional<z.ZodBoolean>;
977
+ noOfFollowers: z.ZodOptional<z.ZodNumber>;
978
+ disciplines: z.ZodOptional<z.ZodArray<z.ZodString>>;
975
979
  }, z.core.$strip>>;
976
980
  nextCursor: z.ZodOptional<z.ZodString>;
977
981
  }, z.core.$strip>;
@@ -35,13 +35,9 @@ exports.UserEntitySchema = zod_openapi_1.z
35
35
  .openapi({
36
36
  example: "DONE",
37
37
  }),
38
- createdAt: zod_openapi_1.z.coerce
39
- .date()
40
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
38
+ createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
41
39
  version: zod_openapi_1.z.int(),
42
- updatedAt: zod_openapi_1.z.coerce
43
- .date()
44
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
40
+ updatedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
45
41
  })
46
42
  .openapi("BaseUserEntity");
47
43
  exports.MinimalUserSchema = exports.UserEntitySchema.pick({
@@ -191,19 +187,19 @@ exports.SearchUsersInputSchema = zod_openapi_1.z.object({
191
187
  description: "Search by name, email, username, or discipline",
192
188
  }),
193
189
  role: zod_openapi_1.z.enum(Object.values(constants_1.ROLES)).optional(),
194
- limit: zod_openapi_1.z.coerce
195
- .number()
196
- .min(1)
197
- .max(100)
198
- .default(20)
199
- .openapi({ example: 20 }),
190
+ limit: zod_openapi_1.z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
200
191
  cursor: zod_openapi_1.z.string().optional().openapi({
201
192
  example: 0,
202
193
  description: "The offset/cursor for pagination",
203
194
  }),
204
195
  });
205
196
  exports.SearchUsersOutputSchema = zod_openapi_1.z.object({
206
- users: zod_openapi_1.z.array(exports.MinimalUserSchema),
197
+ users: zod_openapi_1.z.array(exports.MinimalUserSchema.extend({
198
+ isFollowing: zod_openapi_1.z.boolean().optional(),
199
+ followsYou: zod_openapi_1.z.boolean().optional(),
200
+ noOfFollowers: zod_openapi_1.z.number().int().nonnegative().optional(),
201
+ disciplines: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
202
+ })),
207
203
  nextCursor: zod_openapi_1.z.string().optional().openapi({
208
204
  example: "abc123",
209
205
  description: "The next cursor for pagination",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.2.57",
3
+ "version": "2.2.59",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,18 +1,18 @@
1
1
  import { z } from "@hono/zod-openapi";
2
2
 
3
3
  import {
4
- ROLES,
5
- USER_STATUSES,
6
- ONBOARDING_PAGES,
7
- ACTIVITY_TYPES,
8
- ACTIVITY_PARENT_TYPES,
4
+ ROLES,
5
+ USER_STATUSES,
6
+ ONBOARDING_PAGES,
7
+ ACTIVITY_TYPES,
8
+ ACTIVITY_PARENT_TYPES,
9
9
  } from "../constants";
10
10
  import type {
11
- Role,
12
- UserStatus,
13
- OnboardingPage,
14
- ActivityType,
15
- ActivityParentType,
11
+ Role,
12
+ UserStatus,
13
+ OnboardingPage,
14
+ ActivityType,
15
+ ActivityParentType,
16
16
  } from "../constants";
17
17
  import { ProjectEntitySchema } from "./project";
18
18
  import { BookmarkEntitySchema } from "./bookmark";
@@ -23,261 +23,259 @@ import { InvestorEntitySchema } from "./investor";
23
23
  import { PostEntitySchema, PostWithFilesEntitySchema } from "./post";
24
24
 
25
25
  export const UserEntitySchema = z
26
- .object({
27
- id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
28
- email: z.email().openapi({ example: "user@example.com" }),
29
- emailVerified: z.boolean().openapi({ example: true }),
30
- name: z.string().optional().openapi({ example: "John Doe" }),
31
- image: z
32
- .string()
33
- .optional()
34
- .openapi({ example: "https://example.com/avatar.png" }),
35
- username: z.string().optional().openapi({ example: "johndoe" }),
36
- displayUsername: z.string().optional().openapi({ example: "@johndoe" }),
37
- role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).openapi({
38
- example: "CREATIVE",
39
- }),
40
- status: z
41
- .enum(Object.values(USER_STATUSES) as [UserStatus, ...UserStatus[]])
42
- .openapi({
43
- example: "ACTIVE",
44
- }),
45
- onboardingPage: z
46
- .enum(
47
- Object.values(ONBOARDING_PAGES) as [
48
- OnboardingPage,
49
- ...OnboardingPage[],
50
- ],
51
- )
52
- .openapi({
53
- example: "DONE",
54
- }),
55
- createdAt: z.coerce
56
- .date()
57
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
58
- version: z.int(),
59
- updatedAt: z.coerce
60
- .date()
61
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
62
- })
63
- .openapi("BaseUserEntity");
26
+ .object({
27
+ id: z.cuid2().openapi({ example: "cksd0v6q0000s9a5y8z7p3x9" }),
28
+ email: z.email().openapi({ example: "user@example.com" }),
29
+ emailVerified: z.boolean().openapi({ example: true }),
30
+ name: z.string().optional().openapi({ example: "John Doe" }),
31
+ image: z
32
+ .string()
33
+ .optional()
34
+ .openapi({ example: "https://example.com/avatar.png" }),
35
+ username: z.string().optional().openapi({ example: "johndoe" }),
36
+ displayUsername: z.string().optional().openapi({ example: "@johndoe" }),
37
+ role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).openapi({
38
+ example: "CREATIVE",
39
+ }),
40
+ status: z
41
+ .enum(Object.values(USER_STATUSES) as [UserStatus, ...UserStatus[]])
42
+ .openapi({
43
+ example: "ACTIVE",
44
+ }),
45
+ onboardingPage: z
46
+ .enum(
47
+ Object.values(ONBOARDING_PAGES) as [
48
+ OnboardingPage,
49
+ ...OnboardingPage[],
50
+ ],
51
+ )
52
+ .openapi({
53
+ example: "DONE",
54
+ }),
55
+ createdAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
56
+ version: z.int(),
57
+ updatedAt: z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
58
+ })
59
+ .openapi("BaseUserEntity");
64
60
 
65
61
  export const MinimalUserSchema = UserEntitySchema.pick({
66
- id: true,
67
- name: true,
68
- email: true,
69
- image: true,
70
- username: true,
71
- role: true,
62
+ id: true,
63
+ name: true,
64
+ email: true,
65
+ image: true,
66
+ username: true,
67
+ role: true,
72
68
  }).openapi("MinimalUser");
73
69
 
74
70
  export const UserStatsEntitySchema = z.object({
75
- followerCount: z.int(),
76
- followingCount: z.int(),
77
- followingIds: z.array(z.string()),
71
+ followerCount: z.int(),
72
+ followingCount: z.int(),
73
+ followingIds: z.array(z.string()),
78
74
  });
79
75
 
80
76
  export const UserProfileEntitySchema = UserEntitySchema.extend({
81
- profileType: z.enum(["creative", "brand", "investor"]).optional(),
82
- brand: BrandEntitySchema,
83
- creative: CreativeEntitySchema,
84
- investor: InvestorEntitySchema,
77
+ profileType: z.enum(["creative", "brand", "investor"]).optional(),
78
+ brand: BrandEntitySchema,
79
+ creative: CreativeEntitySchema,
80
+ investor: InvestorEntitySchema,
85
81
  }).openapi("UserProfileEntity");
86
82
 
87
83
  export const UserWithProjectsEntitySchema = z
88
- .object({
89
- userId: z.cuid2(),
90
- projects: z.array(ProjectEntitySchema.omit({ overview: true })),
91
- })
92
- .openapi("UserWithProjectsEntity");
84
+ .object({
85
+ userId: z.cuid2(),
86
+ projects: z.array(ProjectEntitySchema.omit({ overview: true })),
87
+ })
88
+ .openapi("UserWithProjectsEntity");
93
89
 
94
90
  export const UserWithProjectLikesEntitySchema = z.object({
95
- userId: z.cuid2(),
96
- projectLikes: z.array(
97
- LikeEntitySchema.extend({
98
- project: ProjectEntitySchema.pick({
99
- id: true,
100
- title: true,
101
- description: true,
102
- tags: true,
103
- startDate: true,
104
- endDate: true,
105
- imagePlaceholderUrl: true,
106
- }),
107
- }),
108
- ),
91
+ userId: z.cuid2(),
92
+ projectLikes: z.array(
93
+ LikeEntitySchema.extend({
94
+ project: ProjectEntitySchema.pick({
95
+ id: true,
96
+ title: true,
97
+ description: true,
98
+ tags: true,
99
+ startDate: true,
100
+ endDate: true,
101
+ imagePlaceholderUrl: true,
102
+ }),
103
+ }),
104
+ ),
109
105
  });
110
106
 
111
107
  export const UserWithPostLikesEntitySchema = z.object({
112
- userId: z.cuid2(),
113
- postLikes: z.array(
114
- LikeEntitySchema.extend({
115
- post: PostEntitySchema.pick({
116
- id: true,
117
- parentId: true,
118
- title: true,
119
- content: true,
120
- tags: true,
121
- createdAt: true,
122
- updatedAt: true,
123
- }),
124
- }),
125
- ),
108
+ userId: z.cuid2(),
109
+ postLikes: z.array(
110
+ LikeEntitySchema.extend({
111
+ post: PostEntitySchema.pick({
112
+ id: true,
113
+ parentId: true,
114
+ title: true,
115
+ content: true,
116
+ tags: true,
117
+ createdAt: true,
118
+ updatedAt: true,
119
+ }),
120
+ }),
121
+ ),
126
122
  });
127
123
 
128
124
  export const UserWithPostBookmarksEntitySchema = z.object({
129
- userId: z.cuid2(),
130
- postBookmarks: z.array(
131
- BookmarkEntitySchema.extend({
132
- post: PostEntitySchema.pick({
133
- id: true,
134
- parentId: true,
135
- title: true,
136
- content: true,
137
- tags: true,
138
- createdAt: true,
139
- updatedAt: true,
140
- }),
141
- }),
142
- ),
125
+ userId: z.cuid2(),
126
+ postBookmarks: z.array(
127
+ BookmarkEntitySchema.extend({
128
+ post: PostEntitySchema.pick({
129
+ id: true,
130
+ parentId: true,
131
+ title: true,
132
+ content: true,
133
+ tags: true,
134
+ createdAt: true,
135
+ updatedAt: true,
136
+ }),
137
+ }),
138
+ ),
143
139
  });
144
140
 
145
141
  export const UserWithProjectBookmarksEntitySchema = z
146
- .object({
147
- userId: z.cuid2(),
148
- projectBookmarks: z.array(
149
- BookmarkEntitySchema.extend({
150
- project: ProjectEntitySchema.pick({
151
- id: true,
152
- title: true,
153
- description: true,
154
- tags: true,
155
- startDate: true,
156
- endDate: true,
157
- imagePlaceholderUrl: true,
158
- }),
159
- }),
160
- ),
161
- })
162
- .openapi("UserWithProjectBookmarksEntity");
142
+ .object({
143
+ userId: z.cuid2(),
144
+ projectBookmarks: z.array(
145
+ BookmarkEntitySchema.extend({
146
+ project: ProjectEntitySchema.pick({
147
+ id: true,
148
+ title: true,
149
+ description: true,
150
+ tags: true,
151
+ startDate: true,
152
+ endDate: true,
153
+ imagePlaceholderUrl: true,
154
+ }),
155
+ }),
156
+ ),
157
+ })
158
+ .openapi("UserWithProjectBookmarksEntity");
163
159
 
164
160
  export const GetUserFollowingInputSchema = z.object({
165
- searchQuery: z.string().optional().openapi({ example: "design systems" }),
166
- offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
161
+ searchQuery: z.string().optional().openapi({ example: "design systems" }),
162
+ offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
167
163
  });
168
164
 
169
165
  export const GetUserFollowersInputSchema = z.object({
170
- searchQuery: z.string().optional().openapi({ example: "design systems" }),
171
- offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
166
+ searchQuery: z.string().optional().openapi({ example: "design systems" }),
167
+ offset: z.number().int().nonnegative().optional().openapi({ example: 20 }),
172
168
  });
173
169
  export const UserWithFollowingEntitySchema = MinimalUserSchema.extend({
174
- following: z
175
- .array(
176
- MinimalUserSchema.extend({
177
- isFollowing: z.boolean().optional(),
178
- followsYou: z.boolean().optional(),
179
- }),
180
- )
181
- .openapi({ description: "List of users this user is following." }),
170
+ following: z
171
+ .array(
172
+ MinimalUserSchema.extend({
173
+ isFollowing: z.boolean().optional(),
174
+ followsYou: z.boolean().optional(),
175
+ }),
176
+ )
177
+ .openapi({ description: "List of users this user is following." }),
182
178
  }).openapi("UserWithFollowingEntity");
183
179
 
184
180
  export const UserWithFollowersEntitySchema = MinimalUserSchema.extend({
185
- followers: z
186
- .array(
187
- MinimalUserSchema.extend({
188
- isFollowing: z.boolean().optional(),
189
- followsYou: z.boolean().optional(),
190
- }),
191
- )
192
- .openapi({ description: "List of users who follow this user." }),
181
+ followers: z
182
+ .array(
183
+ MinimalUserSchema.extend({
184
+ isFollowing: z.boolean().optional(),
185
+ followsYou: z.boolean().optional(),
186
+ }),
187
+ )
188
+ .openapi({ description: "List of users who follow this user." }),
193
189
  }).openapi("UserWithFollowersEntity");
194
190
 
195
191
  export const GetUserFollowersOutputSchema = z.object({
196
- nextCursor: z.string(),
197
- followers: z.array(
198
- MinimalUserSchema.extend({
199
- isFollowing: z.boolean().optional(),
200
- followsYou: z.boolean().optional(),
201
- }),
202
- ),
192
+ nextCursor: z.string(),
193
+ followers: z.array(
194
+ MinimalUserSchema.extend({
195
+ isFollowing: z.boolean().optional(),
196
+ followsYou: z.boolean().optional(),
197
+ }),
198
+ ),
203
199
  });
204
200
 
205
201
  export const GetUserFollowingOutputSchema = z.object({
206
- nextCursor: z.string(),
207
- following: z.array(
208
- MinimalUserSchema.extend({
209
- isFollowing: z.boolean().optional(),
210
- followsYou: z.boolean().optional(),
211
- }),
212
- ),
202
+ nextCursor: z.string(),
203
+ following: z.array(
204
+ MinimalUserSchema.extend({
205
+ isFollowing: z.boolean().optional(),
206
+ followsYou: z.boolean().optional(),
207
+ }),
208
+ ),
213
209
  });
214
210
 
215
211
  export const UserWithPostsEntitySchema = z
216
- .object({
217
- userId: z.cuid2(),
218
- posts: z.array(PostWithFilesEntitySchema),
219
- })
220
- .openapi("UserWithPostsEntity");
212
+ .object({
213
+ userId: z.cuid2(),
214
+ posts: z.array(PostWithFilesEntitySchema),
215
+ })
216
+ .openapi("UserWithPostsEntity");
221
217
 
222
218
  export const GetAuthenticatedUserOutputSchema = UserEntitySchema;
223
219
 
224
220
  export const GetAuthenticatedUserProfileOutputSchema = UserProfileEntitySchema;
225
221
 
226
222
  export const GetAuthenticatedUserWithProjectsOutputSchema =
227
- UserWithProjectsEntitySchema;
223
+ UserWithProjectsEntitySchema;
228
224
 
229
225
  export const GetAuthenticatedUserWithProjectBookmarksOutputSchema =
230
- UserWithProjectBookmarksEntitySchema;
226
+ UserWithProjectBookmarksEntitySchema;
231
227
 
232
228
  export const GetAuthenticatedUserWithUserFollowingOutputSchema =
233
- UserWithFollowingEntitySchema;
229
+ UserWithFollowingEntitySchema;
234
230
 
235
231
  export const GetAuthenticatedUserWithUserFollowersOutputSchema =
236
- UserWithFollowersEntitySchema;
232
+ UserWithFollowersEntitySchema;
237
233
 
238
234
  export const GetAuthenticatedUserWithProjectLikesOutputSchema =
239
- UserWithProjectLikesEntitySchema;
235
+ UserWithProjectLikesEntitySchema;
240
236
 
241
237
  export const GetUserActivityInputSchema = z.object({
242
- activityType: z.enum(
243
- Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]],
244
- ),
238
+ activityType: z.enum(
239
+ Object.values(ACTIVITY_TYPES) as [ActivityType, ...ActivityType[]],
240
+ ),
245
241
  });
246
242
 
247
243
  export const GetUserActivityOutputSchema = z.array(
248
- z.object({
249
- parentId: z.string(),
250
- parentType: z.enum(
251
- Object.values(ACTIVITY_PARENT_TYPES) as [
252
- ActivityParentType,
253
- ...ActivityParentType[],
254
- ],
255
- ),
256
- }),
244
+ z.object({
245
+ parentId: z.string(),
246
+ parentType: z.enum(
247
+ Object.values(ACTIVITY_PARENT_TYPES) as [
248
+ ActivityParentType,
249
+ ...ActivityParentType[],
250
+ ],
251
+ ),
252
+ }),
257
253
  );
258
254
 
259
255
  export const SearchUsersInputSchema = z.object({
260
- query: z.string().default("").openapi({
261
- example: "john",
262
- description: "Search by name, email, username, or discipline",
263
- }),
264
- role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).optional(),
265
- limit: z.coerce
266
- .number()
267
- .min(1)
268
- .max(100)
269
- .default(20)
270
- .openapi({ example: 20 }),
271
- cursor: z.string().optional().openapi({
272
- example: 0,
273
- description: "The offset/cursor for pagination",
274
- }),
256
+ query: z.string().default("").openapi({
257
+ example: "john",
258
+ description: "Search by name, email, username, or discipline",
259
+ }),
260
+ role: z.enum(Object.values(ROLES) as [Role, ...Role[]]).optional(),
261
+ limit: z.coerce.number().min(1).max(100).default(20).openapi({ example: 20 }),
262
+ cursor: z.string().optional().openapi({
263
+ example: 0,
264
+ description: "The offset/cursor for pagination",
265
+ }),
275
266
  });
276
267
 
277
268
  export const SearchUsersOutputSchema = z.object({
278
- users: z.array(MinimalUserSchema),
279
- nextCursor: z.string().optional().openapi({
280
- example: "abc123",
281
- description: "The next cursor for pagination",
269
+ users: z.array(
270
+ MinimalUserSchema.extend({
271
+ isFollowing: z.boolean().optional(),
272
+ followsYou: z.boolean().optional(),
273
+ noOfFollowers: z.number().int().nonnegative().optional(),
274
+ disciplines: z.array(z.string()).optional(),
282
275
  }),
276
+ ),
277
+ nextCursor: z.string().optional().openapi({
278
+ example: "abc123",
279
+ description: "The next cursor for pagination",
280
+ }),
283
281
  });