@zyacreatives/shared 2.0.24 → 2.0.26

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.
@@ -86,7 +86,7 @@ export declare const PostWithFilesEntitySchema: z.ZodObject<{
86
86
  }, z.core.$strip>;
87
87
  export declare const CreatePostInputSchema: z.ZodObject<{
88
88
  parentId: z.ZodOptional<z.ZodCUID2>;
89
- content: z.ZodString;
89
+ content: z.ZodOptional<z.ZodString>;
90
90
  postType: z.ZodDefault<z.ZodEnum<{
91
91
  readonly MARKETPLACE: "MARKETPLACE";
92
92
  readonly PROJECT: "PROJECT";
@@ -266,3 +266,59 @@ export declare const LinkPreviewOutputSchema: z.ZodObject<{
266
266
  image: z.ZodOptional<z.ZodString>;
267
267
  url: z.ZodOptional<z.ZodString>;
268
268
  }, z.core.$strip>;
269
+ export declare const FeedPostEntitySchema: z.ZodObject<{
270
+ id: z.ZodCUID2;
271
+ parentId: z.ZodOptional<z.ZodCUID2>;
272
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
273
+ badge: z.ZodOptional<z.ZodEnum<{
274
+ readonly NETWORKING: "Networking";
275
+ readonly FUNDING: "Funding";
276
+ readonly COLLABORATION: "Collaboration";
277
+ readonly OPPORTUNITIES: "Opportunities";
278
+ readonly SHOWCASE: "Showcase";
279
+ readonly LEARNING: "Learning";
280
+ readonly DISCUSSION: "Discussion";
281
+ readonly MENTORSHIP: "Mentorship";
282
+ }>>;
283
+ userId: z.ZodCUID2;
284
+ creatorUsername: z.ZodOptional<z.ZodString>;
285
+ creatorFullName: z.ZodOptional<z.ZodString>;
286
+ creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
287
+ content: z.ZodOptional<z.ZodString>;
288
+ postType: z.ZodEnum<{
289
+ readonly MARKETPLACE: "MARKETPLACE";
290
+ readonly PROJECT: "PROJECT";
291
+ readonly JOB_OPENING: "JOB_OPENING";
292
+ readonly DEFAULT_POST: "DEFAULT_POST";
293
+ readonly POST_WITH_LINKS: "POST_WITH_LINKS";
294
+ readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
295
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
296
+ }>;
297
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
298
+ linkMeta: z.ZodOptional<z.ZodObject<{
299
+ url: z.ZodURL;
300
+ title: z.ZodOptional<z.ZodString>;
301
+ description: z.ZodOptional<z.ZodString>;
302
+ image: z.ZodOptional<z.ZodURL>;
303
+ }, z.core.$strip>>;
304
+ postFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
305
+ id: z.ZodString;
306
+ postId: z.ZodString;
307
+ fileId: z.ZodString;
308
+ order: z.ZodNumber;
309
+ url: z.ZodURL;
310
+ }, z.core.$strip>>>;
311
+ stats: {
312
+ updatedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
313
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
314
+ parentId: z.ZodCUID2;
315
+ parentType: z.ZodEnum<{
316
+ readonly PROJECT: "PROJECT";
317
+ readonly POST: "POST";
318
+ }>;
319
+ likesCount: z.ZodNumber;
320
+ bookmarksCount: z.ZodNumber;
321
+ viewsCount: z.ZodNumber;
322
+ commentsCount: z.ZodNumber;
323
+ };
324
+ }, z.core.$strip>;
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.PostWithBookmarksEntitySchema = exports.PostWithCommentsEntitySchema = exports.PostWithLikesEntitySchema = exports.MinimalPostSchema = exports.PostIdSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.CreatePostInputSchema = exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = exports.PostEntitySchema = void 0;
3
+ exports.FeedPostEntitySchema = exports.LinkPreviewOutputSchema = exports.LinkPreviewInputSchema = exports.PostWithBookmarksEntitySchema = exports.PostWithCommentsEntitySchema = exports.PostWithLikesEntitySchema = exports.MinimalPostSchema = exports.PostIdSchema = exports.GetPostOutputSchema = exports.CreatePostOutputSchema = exports.CreatePostInputSchema = exports.PostWithFilesEntitySchema = exports.PostFileEntitySchema = 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");
7
7
  const bookmark_1 = require("./bookmark");
8
8
  const comment_1 = require("./comment");
9
9
  const like_1 = require("./like");
10
+ const entity_stats_1 = require("./entity-stats");
10
11
  exports.PostEntitySchema = zod_openapi_1.z.object({
11
12
  id: zod_openapi_1.z
12
13
  .cuid2()
@@ -81,10 +82,13 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
81
82
  .cuid2()
82
83
  .optional()
83
84
  .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
84
- content: zod_openapi_1.z.string().openapi({
85
+ content: zod_openapi_1.z
86
+ .string()
87
+ .openapi({
85
88
  description: "Post content",
86
89
  example: "New project announcement",
87
- }),
90
+ })
91
+ .optional(),
88
92
  postType: zod_openapi_1.z
89
93
  .enum(constants_1.POST_TYPES)
90
94
  .default("DEFAULT_POST")
@@ -147,3 +151,6 @@ exports.LinkPreviewOutputSchema = zod_openapi_1.z.object({
147
151
  image: zod_openapi_1.z.string().optional(),
148
152
  url: zod_openapi_1.z.string().optional(),
149
153
  });
154
+ exports.FeedPostEntitySchema = exports.PostWithFilesEntitySchema.extend({
155
+ stats: entity_stats_1.EntityStatsSchema.shape,
156
+ });
@@ -1,5 +1,5 @@
1
1
  import { z } from "@hono/zod-openapi";
2
- import { CreatePostInputSchema, CreatePostOutputSchema, GetPostOutputSchema, LinkPreviewInputSchema, LinkPreviewOutputSchema, PostEntitySchema, PostFileEntitySchema, PostIdSchema, PostWithBookmarksEntitySchema, PostWithCommentsEntitySchema, PostWithFilesEntitySchema, PostWithLikesEntitySchema } from "../schemas/post";
2
+ import { CreatePostInputSchema, CreatePostOutputSchema, FeedPostEntitySchema, GetPostOutputSchema, LinkPreviewInputSchema, LinkPreviewOutputSchema, PostEntitySchema, PostFileEntitySchema, PostIdSchema, PostWithBookmarksEntitySchema, PostWithCommentsEntitySchema, PostWithFilesEntitySchema, PostWithLikesEntitySchema } from "../schemas/post";
3
3
  export type PostEntity = z.infer<typeof PostEntitySchema>;
4
4
  export type PostFileEntity = z.infer<typeof PostFileEntitySchema>;
5
5
  export type PostWithFilesEntity = z.infer<typeof PostWithFilesEntitySchema>;
@@ -12,3 +12,4 @@ export type PostWithPostCommentsEntity = z.infer<typeof PostWithCommentsEntitySc
12
12
  export type GetPostOutput = z.infer<typeof GetPostOutputSchema>;
13
13
  export type LinkPreviewInput = z.infer<typeof LinkPreviewInputSchema>;
14
14
  export type LinkPreviewOutput = z.infer<typeof LinkPreviewOutputSchema>;
15
+ export type FeedPostEntity = z.infer<typeof FeedPostEntitySchema>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.0.24",
3
+ "version": "2.0.26",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -4,6 +4,7 @@ import { CreateFileInputSchema, FileEntitySchema } from "./file";
4
4
  import { BookmarkEntitySchema } from "./bookmark";
5
5
  import { CommentEntitySchema } from "./comment";
6
6
  import { LikeEntitySchema } from "./like";
7
+ import { EntityStatsSchema } from "./entity-stats";
7
8
 
8
9
  export const PostEntitySchema = z.object({
9
10
  id: z
@@ -19,7 +20,6 @@ export const PostEntitySchema = z.object({
19
20
  userId: z
20
21
  .cuid2()
21
22
  .openapi({ description: "User id", example: "ckj1a2b3c0000def" }),
22
-
23
23
  creatorUsername: z.string().optional().openapi({ description: "Username" }),
24
24
  creatorFullName: z.string().optional(),
25
25
  creatorImageUrl: z.cuid2().optional().openapi({ description: "Username" }),
@@ -88,10 +88,13 @@ export const CreatePostInputSchema = z.object({
88
88
  .cuid2()
89
89
  .optional()
90
90
  .openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
91
- content: z.string().openapi({
92
- description: "Post content",
93
- example: "New project announcement",
94
- }),
91
+ content: z
92
+ .string()
93
+ .openapi({
94
+ description: "Post content",
95
+ example: "New project announcement",
96
+ })
97
+ .optional(),
95
98
  postType: z
96
99
  .enum(POST_TYPES)
97
100
  .default("DEFAULT_POST")
@@ -162,3 +165,7 @@ export const LinkPreviewOutputSchema = z.object({
162
165
  image: z.string().optional(),
163
166
  url: z.string().optional(),
164
167
  });
168
+
169
+ export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
170
+ stats: EntityStatsSchema.shape,
171
+ });
package/src/types/post.ts CHANGED
@@ -2,6 +2,7 @@ import { z } from "@hono/zod-openapi";
2
2
  import {
3
3
  CreatePostInputSchema,
4
4
  CreatePostOutputSchema,
5
+ FeedPostEntitySchema,
5
6
  GetPostOutputSchema,
6
7
  LinkPreviewInputSchema,
7
8
  LinkPreviewOutputSchema,
@@ -30,3 +31,4 @@ export type PostWithPostCommentsEntity = z.infer<
30
31
  export type GetPostOutput = z.infer<typeof GetPostOutputSchema>;
31
32
  export type LinkPreviewInput = z.infer<typeof LinkPreviewInputSchema>;
32
33
  export type LinkPreviewOutput = z.infer<typeof LinkPreviewOutputSchema>;
34
+ export type FeedPostEntity = z.infer<typeof FeedPostEntitySchema>;