@zyacreatives/shared 2.3.6 → 2.3.8

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PostSearchDocumentSchema = exports.PostAnalyticsOutputSchema = exports.ReportPostInputSchema = exports.SearchPostOutputSchema = exports.SearchPostInputSchema = exports.GetFeedOutputSchema = exports.GetFeedInputSchema = exports.FeedPostEntitySchema = exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.GetPostWithBookmarksOutputSchema = exports.PostWithBookmarksEntitySchema = exports.GetPostWithCommentsOutputSchema = exports.PostWithCommentsEntitySchema = exports.GetPostWithLikesOutputSchema = exports.PostWithLikesEntitySchema = exports.MinimalPostSchema = exports.PostIdSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.CreatePostInputSchema = exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = exports.PostEntitySchema = void 0;
3
+ exports.PostSearchDocumentSchema = exports.PostAnalyticsOutputSchema = exports.SearchPostOutputSchema = exports.GetFeedOutputSchema = exports.GetPostWithBookmarksOutputSchema = exports.GetPostWithCommentsOutputSchema = exports.GetPostWithLikesOutputSchema = exports.LinkPreviewOutputSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.SearchPostInputSchema = exports.GetFeedInputSchema = exports.ReportPostInputSchema = exports.LinkPreviewInputSchema = exports.PostIdSchema = exports.CreatePostInputSchema = exports.PostWithBookmarksEntitySchema = exports.PostWithCommentsEntitySchema = exports.PostWithLikesEntitySchema = exports.FeedPostEntitySchema = exports.MinimalPostSchema = exports.PostWithFilesEntitySchema = exports.PostEntitySchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  const file_1 = require("./file");
@@ -26,9 +26,7 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
26
26
  id: zod_openapi_1.z.int().openapi({ example: 101 }),
27
27
  }))
28
28
  .optional()
29
- .openapi({
30
- example: [{ name: "javascript", id: 101 }],
31
- }),
29
+ .openapi({ example: [{ name: "javascript", id: 101 }] }),
32
30
  badge: zod_openapi_1.z.enum(constants_1.POST_BADGE_TYPES).optional().openapi({ example: "FEATURED" }),
33
31
  userId: zod_openapi_1.z
34
32
  .cuid2()
@@ -50,12 +48,10 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
50
48
  return true;
51
49
  const plainText = (0, clean_html_1.cleanHtml)(val, Number.MAX_SAFE_INTEGER);
52
50
  return plainText.length <= 300;
53
- }, {
54
- message: "Post content cannot exceed 300 characters",
55
- })
51
+ }, { message: "Post content cannot exceed 300 characters" })
56
52
  .openapi({ example: "Check out my new portfolio update!" }),
57
53
  postType: zod_openapi_1.z.enum(constants_1.POST_TYPES).openapi({
58
- description: "Type of the post entity this statistic belongs to.",
54
+ description: "Type of the post entity",
59
55
  title: "Post Type",
60
56
  example: "PROJECT",
61
57
  }),
@@ -79,56 +75,43 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
79
75
  .optional()
80
76
  .openapi({
81
77
  description: "Optional metadata for a single link in the post",
82
- example: {
83
- url: "https://example.com",
84
- title: "Example Website",
85
- description: "This is an example link",
86
- image: "https://example.com/preview.jpg",
87
- },
88
78
  }),
89
79
  });
90
- exports.PostFileEntitySchema = zod_openapi_1.z
91
- .object({
92
- id: zod_openapi_1.z.cuid2().openapi({
93
- description: "CUID2 of the project file record.",
94
- example: "cxy1a2b3c0000qwe",
95
- }),
96
- postId: zod_openapi_1.z.cuid2().openapi({
97
- description: "CUID2 of the post this file belongs to.",
98
- example: "ckj1a2b3c0000xyz",
99
- }),
100
- fileId: zod_openapi_1.z.cuid2().openapi({
101
- description: "CUID2 of the linked file.",
102
- example: "cvb1a2b3c0000rty",
103
- }),
104
- order: zod_openapi_1.z.number().int().openapi({
105
- description: "Order index of the file in the project.",
106
- example: 1,
107
- }),
108
- })
109
- .openapi({
110
- title: "Post File Entity",
111
- description: "Schema representing a file associated with a project.",
112
- });
80
+ // ─── Composed ─────────────────────────────────────────────────────────────────
113
81
  exports.PostWithFilesEntitySchema = exports.PostEntitySchema.extend({
114
- postFiles: zod_openapi_1.z
115
- .array(exports.PostFileEntitySchema.extend({
116
- url: zod_openapi_1.z.url().openapi({ example: "https://cdn.example.com/image.png" }),
117
- }))
118
- .optional()
119
- .openapi({
120
- description: "Files associated with the project.",
121
- example: [
122
- {
123
- id: "cxy1a2b3c0000qwe",
124
- postId: "ckj1a2b3c0000xyz",
125
- fileId: "cvb1a2b3c0000rty",
126
- order: 1,
127
- url: "https://cdn.example.com/image.png",
128
- },
129
- ],
82
+ files: zod_openapi_1.z.array(file_1.FileEntitySchema).optional().openapi({
83
+ description: "Files attached to the post",
84
+ example: [],
130
85
  }),
131
86
  });
87
+ exports.MinimalPostSchema = exports.PostEntitySchema.pick({
88
+ id: true,
89
+ parentId: true,
90
+ content: true,
91
+ });
92
+ exports.FeedPostEntitySchema = exports.PostWithFilesEntitySchema.extend({
93
+ stats: entity_stats_1.EntityStatsSchema,
94
+ score: zod_openapi_1.z.number().openapi({ example: 98.5 }),
95
+ isLiked: zod_openapi_1.z.boolean().optional().openapi({ example: true }),
96
+ isFollowing: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
97
+ isBookmarked: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
98
+ });
99
+ // ─── Interactions ─────────────────────────────────────────────────────────────
100
+ exports.PostWithLikesEntitySchema = exports.MinimalPostSchema.extend({
101
+ likes: zod_openapi_1.z
102
+ .array(activity_1.ActivitySchema.extend({
103
+ followsYou: zod_openapi_1.z.boolean().optional().openapi({ example: true }),
104
+ isFollowing: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
105
+ }))
106
+ .openapi({ example: [] }),
107
+ }).openapi({ title: "PostWithPostLikesEntity" });
108
+ exports.PostWithCommentsEntitySchema = exports.MinimalPostSchema.extend({
109
+ comments: zod_openapi_1.z.array(comment_1.CommentEntitySchema).openapi({ example: [] }),
110
+ }).openapi({ title: "PostWithPostCommentsEntity" });
111
+ exports.PostWithBookmarksEntitySchema = exports.MinimalPostSchema.extend({
112
+ bookmarks: zod_openapi_1.z.array(activity_1.ActivitySchema).openapi({ example: [] }),
113
+ }).openapi({ title: "PostWithPostBookmarksEntity" });
114
+ // ─── Inputs ───────────────────────────────────────────────────────────────────
132
115
  exports.CreatePostInputSchema = zod_openapi_1.z.object({
133
116
  id: zod_openapi_1.z.cuid2().openapi({ example: "ckj1a2b3c0000xyz" }),
134
117
  parentId: zod_openapi_1.z
@@ -159,11 +142,19 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
159
142
  .max(5, { message: "File order cannot exceed 5" })
160
143
  .default(1)
161
144
  .openapi({ example: 1 }),
145
+ isThumbnail: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
162
146
  }))
163
147
  .max(5, { message: "Cannot attach more than 5 files" })
164
148
  .optional()
165
149
  .openapi({
166
- example: [{ fileId: "cvb1a2b3c0000rty", order: 1 }],
150
+ example: [
151
+ {
152
+ key: "uploads/img.png",
153
+ mimeType: "image/png",
154
+ order: 1,
155
+ isThumbnail: false,
156
+ },
157
+ ],
167
158
  }),
168
159
  tags: zod_openapi_1.z
169
160
  .array(zod_openapi_1.z
@@ -186,9 +177,7 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
186
177
  .openapi({ example: "Example Website" }),
187
178
  description: zod_openapi_1.z
188
179
  .string()
189
- .max(500, {
190
- message: "Description cannot exceed 500 characters",
191
- })
180
+ .max(500, { message: "Description cannot exceed 500 characters" })
192
181
  .optional()
193
182
  .openapi({ example: "This is an example link" }),
194
183
  image: zod_openapi_1.z
@@ -199,64 +188,35 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
199
188
  .optional()
200
189
  .openapi({
201
190
  description: "Optional metadata for a single link in the post",
202
- example: {
203
- url: "https://example.com",
204
- title: "Example Website",
205
- description: "This is an example link",
206
- image: "https://example.com/preview.jpg",
207
- },
208
191
  }),
209
192
  });
210
- exports.CreatePostOutputSchema = exports.PostEntitySchema;
211
- exports.GetPostOutputSchema = exports.PostWithFilesEntitySchema;
212
193
  exports.PostIdSchema = zod_openapi_1.z.object({
213
194
  postId: zod_openapi_1.z.cuid2().openapi({ example: "ckj1a2b3c0000xyz" }),
214
195
  });
215
- exports.MinimalPostSchema = exports.PostEntitySchema.pick({
216
- id: true,
217
- parentId: true,
218
- content: true,
219
- });
220
- exports.PostWithLikesEntitySchema = exports.MinimalPostSchema.extend({
221
- likes: zod_openapi_1.z
222
- .array(activity_1.ActivitySchema.extend({
223
- followsYou: zod_openapi_1.z.boolean().optional().openapi({ example: true }),
224
- isFollowing: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
225
- }))
226
- .openapi({ example: [] }),
227
- }).openapi({
228
- title: "PostWithPostLikesEntity",
196
+ exports.LinkPreviewInputSchema = zod_openapi_1.z.object({
197
+ url: zod_openapi_1.z.url().openapi({ example: "https://example.com/article" }),
229
198
  });
230
- exports.GetPostWithLikesOutputSchema = exports.PostWithLikesEntitySchema.extend({
231
- nextCursor: zod_openapi_1.z
199
+ exports.ReportPostInputSchema = zod_openapi_1.z.object({
200
+ complaint: zod_openapi_1.z
232
201
  .string()
233
- .optional()
234
- .nullable()
235
- .openapi({ example: "ckj1a2b3c0000nxt" }),
202
+ .max(200, { error: "Complaint cannot be longer than 200 characters" })
203
+ .openapi({ example: "This post contains spam." }),
236
204
  });
237
- exports.PostWithCommentsEntitySchema = exports.MinimalPostSchema.extend({
238
- comments: zod_openapi_1.z.array(comment_1.CommentEntitySchema).openapi({ example: [] }),
239
- }).openapi({
240
- title: "PostWithPostCommentsEntity",
205
+ exports.GetFeedInputSchema = zod_openapi_1.z.object({
206
+ limit: zod_openapi_1.z.number().int().optional().openapi({ example: 20 }),
207
+ cursor: zod_openapi_1.z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
241
208
  });
242
- exports.GetPostWithCommentsOutputSchema = exports.PostWithCommentsEntitySchema.extend({
243
- nextCursor: zod_openapi_1.z
209
+ exports.SearchPostInputSchema = zod_openapi_1.z.object({
210
+ queryString: zod_openapi_1.z
244
211
  .string()
245
- .optional()
246
- .nullable()
247
- .openapi({ example: "ckj1a2b3c0000nxt" }),
248
- });
249
- exports.PostWithBookmarksEntitySchema = exports.MinimalPostSchema.extend({
250
- bookmarks: zod_openapi_1.z.array(activity_1.ActivitySchema).openapi({ example: [] }),
251
- }).openapi({
252
- title: "PostWithPostBookmarksEntity",
253
- });
254
- exports.GetPostWithBookmarksOutputSchema = exports.PostWithBookmarksEntitySchema.extend({
255
- totalNo: zod_openapi_1.z.number().int().openapi({ example: 42 }),
256
- });
257
- exports.LinkPreviewInputSchema = zod_openapi_1.z.object({
258
- url: zod_openapi_1.z.url().openapi({ example: "https://example.com/article" }),
212
+ .min(1, { message: "Search string cannot be empty" })
213
+ .max(200, { message: "Search string cannot exceed 200 characters" })
214
+ .openapi({ example: "typescript utility types" }),
215
+ cursor: zod_openapi_1.z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
259
216
  });
217
+ // ─── Outputs ──────────────────────────────────────────────────────────────────
218
+ exports.CreatePostOutputSchema = exports.PostEntitySchema;
219
+ exports.GetPostOutputSchema = exports.PostWithFilesEntitySchema;
260
220
  exports.LinkPreviewOutputSchema = zod_openapi_1.z.object({
261
221
  title: zod_openapi_1.z.string().openapi({ example: "Great Article" }),
262
222
  description: zod_openapi_1.z
@@ -272,16 +232,22 @@ exports.LinkPreviewOutputSchema = zod_openapi_1.z.object({
272
232
  .optional()
273
233
  .openapi({ example: "https://example.com/article" }),
274
234
  });
275
- exports.FeedPostEntitySchema = exports.PostWithFilesEntitySchema.extend({
276
- stats: entity_stats_1.EntityStatsSchema,
277
- score: zod_openapi_1.z.number().openapi({ example: 98.5 }),
278
- isLiked: zod_openapi_1.z.boolean().optional().openapi({ example: true }),
279
- isFollowing: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
280
- isBookmarked: zod_openapi_1.z.boolean().optional().openapi({ example: false }),
235
+ exports.GetPostWithLikesOutputSchema = exports.PostWithLikesEntitySchema.extend({
236
+ nextCursor: zod_openapi_1.z
237
+ .string()
238
+ .optional()
239
+ .nullable()
240
+ .openapi({ example: "ckj1a2b3c0000nxt" }),
281
241
  });
282
- exports.GetFeedInputSchema = zod_openapi_1.z.object({
283
- limit: zod_openapi_1.z.number().int().optional().openapi({ example: 20 }),
284
- cursor: zod_openapi_1.z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
242
+ exports.GetPostWithCommentsOutputSchema = exports.PostWithCommentsEntitySchema.extend({
243
+ nextCursor: zod_openapi_1.z
244
+ .string()
245
+ .optional()
246
+ .nullable()
247
+ .openapi({ example: "ckj1a2b3c0000nxt" }),
248
+ });
249
+ exports.GetPostWithBookmarksOutputSchema = exports.PostWithBookmarksEntitySchema.extend({
250
+ totalNo: zod_openapi_1.z.number().int().openapi({ example: 42 }),
285
251
  });
286
252
  exports.GetFeedOutputSchema = zod_openapi_1.z.object({
287
253
  feed: zod_openapi_1.z.array(exports.FeedPostEntitySchema).openapi({ example: [] }),
@@ -291,14 +257,6 @@ exports.GetFeedOutputSchema = zod_openapi_1.z.object({
291
257
  .nullable()
292
258
  .openapi({ example: "ckj1a2b3c0000nxt" }),
293
259
  });
294
- exports.SearchPostInputSchema = zod_openapi_1.z.object({
295
- queryString: zod_openapi_1.z
296
- .string()
297
- .min(1, { message: "Search string cannot be empty" })
298
- .max(200, { message: "Search string cannot exceed 200 characters" })
299
- .openapi({ example: "typescript utility types" }),
300
- cursor: zod_openapi_1.z.string().optional().openapi({ example: "ckj1a2b3c0000cur" }),
301
- });
302
260
  exports.SearchPostOutputSchema = zod_openapi_1.z.object({
303
261
  posts: zod_openapi_1.z.array(exports.FeedPostEntitySchema).openapi({ example: [] }),
304
262
  nextCursor: zod_openapi_1.z
@@ -307,12 +265,7 @@ exports.SearchPostOutputSchema = zod_openapi_1.z.object({
307
265
  .nullable()
308
266
  .openapi({ example: "ckj1a2b3c0000nxt" }),
309
267
  });
310
- exports.ReportPostInputSchema = zod_openapi_1.z.object({
311
- complaint: zod_openapi_1.z
312
- .string()
313
- .max(200, { error: "Complaint cannot be longer than 200 characters" })
314
- .openapi({ example: "This post contains spam." }),
315
- });
268
+ // ─── Analytics ────────────────────────────────────────────────────────────────
316
269
  const AnalyticsChartItemSchema = zod_openapi_1.z.object({
317
270
  x: zod_openapi_1.z.string().openapi({ example: "2026-03-11" }),
318
271
  y: zod_openapi_1.z.number().openapi({ example: 150 }),
@@ -351,6 +304,7 @@ exports.PostAnalyticsOutputSchema = zod_openapi_1.z.object({
351
304
  }),
352
305
  }),
353
306
  });
307
+ // ─── Search Index ─────────────────────────────────────────────────────────────
354
308
  exports.PostSearchDocumentSchema = zod_openapi_1.z
355
309
  .object({
356
310
  id: zod_openapi_1.z.cuid2().openapi({ example: "ckj1a2b3c0000doc" }),
@@ -384,24 +338,7 @@ exports.PostSearchDocumentSchema = zod_openapi_1.z
384
338
  .url()
385
339
  .nullable()
386
340
  .openapi({ example: "https://github.com/image.png" }),
387
- postFiles: zod_openapi_1.z
388
- .array(exports.PostFileEntitySchema.extend({
389
- url: zod_openapi_1.z
390
- .url()
391
- .openapi({ example: "https://cdn.example.com/file1.png" }),
392
- }))
393
- .nullable()
394
- .openapi({
395
- example: [
396
- {
397
- id: "cxy1a2b3c0000qwe",
398
- postId: "ckj1a2b3c0000doc",
399
- fileId: "cvb1a2b3c0000rty",
400
- order: 1,
401
- url: "https://cdn.example.com/file1.png",
402
- },
403
- ],
404
- }),
341
+ files: zod_openapi_1.z.array(file_1.FileEntitySchema).nullable().openapi({ example: [] }),
405
342
  createdAt: zod_openapi_1.z
406
343
  .string()
407
344
  .nullable()
@@ -336,12 +336,27 @@ export declare const UserWithPostsEntitySchema: z.ZodObject<{
336
336
  description: z.ZodOptional<z.ZodString>;
337
337
  image: z.ZodOptional<z.ZodURL>;
338
338
  }, z.core.$strip>>;
339
- postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
339
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
340
340
  id: z.ZodCUID2;
341
- postId: z.ZodCUID2;
342
- fileId: z.ZodCUID2;
343
- order: z.ZodNumber;
341
+ key: z.ZodString;
342
+ mimeType: z.ZodString;
344
343
  url: z.ZodURL;
344
+ userId: z.ZodCUID2;
345
+ parentId: z.ZodNullable<z.ZodCUID2>;
346
+ parentType: z.ZodNullable<z.ZodEnum<{
347
+ readonly PROJECT: "PROJECT";
348
+ readonly USER: "USER";
349
+ readonly JOB: "JOB";
350
+ readonly POST: "POST";
351
+ readonly PRODUCT: "PRODUCT";
352
+ readonly COMMENT: "COMMENT";
353
+ readonly JOB_APPLICATION: "JOB_APPLICATION";
354
+ }>>;
355
+ isThumbnail: z.ZodNullable<z.ZodBoolean>;
356
+ order: z.ZodNumber;
357
+ createdAt: z.ZodCoercedDate<unknown>;
358
+ updatedAt: z.ZodCoercedDate<unknown>;
359
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
345
360
  }, z.core.$strip>>>;
346
361
  }, z.core.$strip>>;
347
362
  }, z.core.$strip>;
@@ -627,12 +642,27 @@ export declare const UserWithPostBookmarksEntitySchema: z.ZodObject<{
627
642
  description: z.ZodOptional<z.ZodString>;
628
643
  image: z.ZodOptional<z.ZodURL>;
629
644
  }, z.core.$strip>>;
630
- postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
645
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
631
646
  id: z.ZodCUID2;
632
- postId: z.ZodCUID2;
633
- fileId: z.ZodCUID2;
634
- order: z.ZodNumber;
647
+ key: z.ZodString;
648
+ mimeType: z.ZodString;
635
649
  url: z.ZodURL;
650
+ userId: z.ZodCUID2;
651
+ parentId: z.ZodNullable<z.ZodCUID2>;
652
+ parentType: z.ZodNullable<z.ZodEnum<{
653
+ readonly PROJECT: "PROJECT";
654
+ readonly USER: "USER";
655
+ readonly JOB: "JOB";
656
+ readonly POST: "POST";
657
+ readonly PRODUCT: "PRODUCT";
658
+ readonly COMMENT: "COMMENT";
659
+ readonly JOB_APPLICATION: "JOB_APPLICATION";
660
+ }>>;
661
+ isThumbnail: z.ZodNullable<z.ZodBoolean>;
662
+ order: z.ZodNumber;
663
+ createdAt: z.ZodCoercedDate<unknown>;
664
+ updatedAt: z.ZodCoercedDate<unknown>;
665
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
636
666
  }, z.core.$strip>>>;
637
667
  }, z.core.$strip>;
638
668
  }, z.core.$strip>>;
@@ -923,12 +953,27 @@ export declare const GetUserWithPostBookmarksOutputSchema: z.ZodObject<{
923
953
  description: z.ZodOptional<z.ZodString>;
924
954
  image: z.ZodOptional<z.ZodURL>;
925
955
  }, z.core.$strip>>;
926
- postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
956
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
927
957
  id: z.ZodCUID2;
928
- postId: z.ZodCUID2;
929
- fileId: z.ZodCUID2;
930
- order: z.ZodNumber;
958
+ key: z.ZodString;
959
+ mimeType: z.ZodString;
931
960
  url: z.ZodURL;
961
+ userId: z.ZodCUID2;
962
+ parentId: z.ZodNullable<z.ZodCUID2>;
963
+ parentType: z.ZodNullable<z.ZodEnum<{
964
+ readonly PROJECT: "PROJECT";
965
+ readonly USER: "USER";
966
+ readonly JOB: "JOB";
967
+ readonly POST: "POST";
968
+ readonly PRODUCT: "PRODUCT";
969
+ readonly COMMENT: "COMMENT";
970
+ readonly JOB_APPLICATION: "JOB_APPLICATION";
971
+ }>>;
972
+ isThumbnail: z.ZodNullable<z.ZodBoolean>;
973
+ order: z.ZodNumber;
974
+ createdAt: z.ZodCoercedDate<unknown>;
975
+ updatedAt: z.ZodCoercedDate<unknown>;
976
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
932
977
  }, z.core.$strip>>>;
933
978
  stats: z.ZodObject<{
934
979
  updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
@@ -5,7 +5,6 @@ export * from "./like";
5
5
  export * from "./common";
6
6
  export * from "./creative";
7
7
  export * from "./discipline";
8
- export * from "./file";
9
8
  export * from "./investor";
10
9
  export * from "./project";
11
10
  export * from "./user";
@@ -14,7 +13,6 @@ export * from "./username";
14
13
  export * from "./entity-stats";
15
14
  export * from "./feed";
16
15
  export * from "./activity";
17
- export * from "./post";
18
16
  export * from "./job-application";
19
17
  export * from "./message";
20
18
  export * from "./chat";
@@ -21,7 +21,6 @@ __exportStar(require("./like"), exports);
21
21
  __exportStar(require("./common"), exports);
22
22
  __exportStar(require("./creative"), exports);
23
23
  __exportStar(require("./discipline"), exports);
24
- __exportStar(require("./file"), exports);
25
24
  __exportStar(require("./investor"), exports);
26
25
  __exportStar(require("./project"), exports);
27
26
  __exportStar(require("./user"), exports);
@@ -30,7 +29,6 @@ __exportStar(require("./username"), exports);
30
29
  __exportStar(require("./entity-stats"), exports);
31
30
  __exportStar(require("./feed"), exports);
32
31
  __exportStar(require("./activity"), exports);
33
- __exportStar(require("./post"), exports);
34
32
  __exportStar(require("./job-application"), exports);
35
33
  __exportStar(require("./message"), exports);
36
34
  __exportStar(require("./chat"), exports);
@@ -0,0 +1 @@
1
+ export declare const generateFileUrl: (key: string, isProd?: boolean) => string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateFileUrl = void 0;
4
+ const generateFileUrl = (key, isProd) => {
5
+ return `https//cdn.tryzya.date/${key}`;
6
+ };
7
+ exports.generateFileUrl = generateFileUrl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.3.6",
3
+ "version": "2.3.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,61 +1,104 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+ import { ACTIVITY_PARENT_TYPES } from "../constants";
2
3
 
3
4
  export const FileEntitySchema = z
4
5
  .object({
5
6
  id: z.cuid2().openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
6
7
  key: z.string().openapi({ example: "profile-pic-12345" }),
7
8
  mimeType: z.string().openapi({ example: "image/jpeg" }),
8
- url: z
9
- .url()
10
- .optional()
11
- .openapi({ example: "https://example.com/file.jpg" }),
9
+ url: z.url().openapi({ example: "https://example.com/file.jpg" }),
12
10
  userId: z
13
11
  .cuid2()
14
12
  .openapi({ example: "u123e4567-e89b-12d3-a456-426614174000" }),
13
+ parentId: z.cuid2().nullable().openapi({ example: "ckj1a2b3c0000xyz" }),
14
+ parentType: z
15
+ .enum(ACTIVITY_PARENT_TYPES)
16
+ .nullable()
17
+ .openapi({ example: "POST" }),
18
+ isThumbnail: z.boolean().nullable().openapi({ example: false }),
19
+ order: z.number().int().openapi({ example: 0 }),
15
20
  createdAt: z.coerce.date().openapi({ example: "2025-10-14T08:00:00.000Z" }),
16
21
  updatedAt: z.coerce.date().openapi({ example: "2025-10-14T09:00:00.000Z" }),
22
+ deletedAt: z.coerce.date().nullable().openapi({ example: null }),
17
23
  })
18
24
  .openapi({ title: "FileEntity" });
25
+ export type FileEntity = z.infer<typeof FileEntitySchema>;
19
26
 
20
- export const FileUpdateInputSchema = z
21
- .object({
22
- id: z
23
- .string()
24
- .openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
25
- })
26
- .openapi({ title: "FileUpdateInput" });
27
+ // ─── Inputs ───────────────────────────────────────────────────────────────────
27
28
 
28
29
  export const CreateFileInputSchema = z.object({
29
30
  key: z.string().openapi({ example: "uploads/audio/podcast789.mp3" }),
30
31
  mimeType: z.string().openapi({ example: "audio/mpeg" }),
32
+ parentId: z.cuid2().optional().openapi({ example: "ckj1a2b3c0000xyz" }),
33
+ parentType: z
34
+ .enum(ACTIVITY_PARENT_TYPES)
35
+ .optional()
36
+ .openapi({ example: "POST" }),
37
+ isThumbnail: z.boolean().optional().openapi({ example: false }),
38
+ order: z.number().int().optional().default(0).openapi({ example: 0 }),
31
39
  });
40
+ export type CreateFileInput = z.infer<typeof CreateFileInputSchema>;
32
41
 
33
- export const CreateFileOutputSchema = FileEntitySchema;
42
+ export const FileUpdateInputSchema = z
43
+ .object({
44
+ id: z.cuid2().openapi({ example: "f123e4567-e89b-12d3-a456-426614174000" }),
45
+ parentId: z.cuid2().optional().openapi({ example: "ckj1a2b3c0000xyz" }),
46
+ parentType: z
47
+ .enum(ACTIVITY_PARENT_TYPES)
48
+ .optional()
49
+ .openapi({ example: "POST" }),
50
+ isThumbnail: z.boolean().optional().openapi({ example: false }),
51
+ order: z.number().int().optional().openapi({ example: 1 }),
52
+ })
53
+ .openapi({ title: "FileUpdateInput" });
54
+ export type FileUpdateEntity = z.infer<typeof FileUpdateInputSchema>;
34
55
 
35
56
  export const DeleteFileInputSchema = z.object({
36
57
  fileId: z.cuid2().optional().openapi({ example: "0irjif0qur09481u90r1u" }),
37
- key: z.cuid2().optional(),
58
+ key: z.string().optional(),
38
59
  });
60
+ export type DeleteFileInput = z.infer<typeof DeleteFileInputSchema>;
61
+
62
+ export const FileKeySchema = z.object({
63
+ key: z
64
+ .string()
65
+ .max(400, { error: "Key should not be longer than 400 characters" }),
66
+ });
67
+ export type FileKeyInput = z.infer<typeof FileKeySchema>;
68
+
69
+ // ─── Outputs ──────────────────────────────────────────────────────────────────
70
+
71
+ export const CreateFileOutputSchema = FileEntitySchema;
72
+ export type CreateFileOutput = z.infer<typeof CreateFileOutputSchema>;
39
73
 
40
74
  export const DeleteFileOutputSchema = z.object({
41
75
  id: z.cuid2().openapi({ example: "r90rjnaneifijhi31" }),
42
76
  });
77
+ export type DeleteFileOutput = z.infer<typeof DeleteFileOutputSchema>;
43
78
 
44
79
  export const GetPresignedUploadUrlInputSchema = z.object({
45
80
  key: z.string().openapi({ example: "/users/123/pfp" }),
46
81
  });
82
+ export type GetPresignedUploadUrlInput = z.infer<
83
+ typeof GetPresignedUploadUrlInputSchema
84
+ >;
47
85
 
48
86
  export const GetPresignedUploadUrlOutputSchema = z.object({
49
87
  url: z.url().openapi({ example: "https://www.cloudflare.img" }),
50
88
  });
89
+ export type GetPresignedUploadUrlOutput = z.infer<
90
+ typeof GetPresignedUploadUrlOutputSchema
91
+ >;
51
92
 
52
93
  export const GetPresignedDownloadUrlInputSchema = z.object({
53
94
  fileId: z.cuid2().openapi({ example: "0irjif0qur09481u90r1u" }),
54
95
  });
96
+ export type GetPresignedDownloadUrlInput = z.infer<
97
+ typeof GetPresignedDownloadUrlInputSchema
98
+ >;
55
99
 
56
100
  export const GetPresignedDownloadUrlOutputSchema =
57
101
  GetPresignedUploadUrlOutputSchema;
58
-
59
- export const FileKeySchema = z.object({
60
- key: z.string().max(400, {error: "Key should not be longner than 400 characters"}),
61
- });
102
+ export type GetPresignedDownloadUrlOutput = z.infer<
103
+ typeof GetPresignedDownloadUrlOutputSchema
104
+ >;