@zyacreatives/shared 2.0.23 → 2.0.25

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.
@@ -91,6 +91,7 @@ export declare const POST_TYPES: {
91
91
  readonly DEFAULT_POST: "DEFAULT_POST";
92
92
  readonly POST_WITH_LINKS: "POST_WITH_LINKS";
93
93
  readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
94
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
94
95
  };
95
96
  export declare const JOB_TYPE: {
96
97
  readonly GIG: "GIG";
package/dist/constants.js CHANGED
@@ -94,6 +94,7 @@ exports.POST_TYPES = {
94
94
  DEFAULT_POST: "DEFAULT_POST",
95
95
  POST_WITH_LINKS: "POST_WITH_LINKS",
96
96
  POST_WITH_MEDIA: "POST_WITH_MEDIA",
97
+ POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS",
97
98
  };
98
99
  exports.JOB_TYPE = {
99
100
  GIG: "GIG",
@@ -17,8 +17,7 @@ export declare const PostEntitySchema: z.ZodObject<{
17
17
  creatorUsername: z.ZodOptional<z.ZodString>;
18
18
  creatorFullName: z.ZodOptional<z.ZodString>;
19
19
  creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
20
- content: z.ZodString;
21
- title: z.ZodOptional<z.ZodString>;
20
+ content: z.ZodOptional<z.ZodString>;
22
21
  postType: z.ZodEnum<{
23
22
  readonly MARKETPLACE: "MARKETPLACE";
24
23
  readonly PROJECT: "PROJECT";
@@ -26,6 +25,7 @@ export declare const PostEntitySchema: z.ZodObject<{
26
25
  readonly DEFAULT_POST: "DEFAULT_POST";
27
26
  readonly POST_WITH_LINKS: "POST_WITH_LINKS";
28
27
  readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
28
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
29
29
  }>;
30
30
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
31
31
  linkMeta: z.ZodOptional<z.ZodObject<{
@@ -59,8 +59,7 @@ export declare const PostWithFilesEntitySchema: z.ZodObject<{
59
59
  creatorUsername: z.ZodOptional<z.ZodString>;
60
60
  creatorFullName: z.ZodOptional<z.ZodString>;
61
61
  creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
62
- content: z.ZodString;
63
- title: z.ZodOptional<z.ZodString>;
62
+ content: z.ZodOptional<z.ZodString>;
64
63
  postType: z.ZodEnum<{
65
64
  readonly MARKETPLACE: "MARKETPLACE";
66
65
  readonly PROJECT: "PROJECT";
@@ -68,6 +67,7 @@ export declare const PostWithFilesEntitySchema: z.ZodObject<{
68
67
  readonly DEFAULT_POST: "DEFAULT_POST";
69
68
  readonly POST_WITH_LINKS: "POST_WITH_LINKS";
70
69
  readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
70
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
71
71
  }>;
72
72
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
73
73
  linkMeta: z.ZodOptional<z.ZodObject<{
@@ -87,7 +87,6 @@ export declare const PostWithFilesEntitySchema: z.ZodObject<{
87
87
  export declare const CreatePostInputSchema: z.ZodObject<{
88
88
  parentId: z.ZodOptional<z.ZodCUID2>;
89
89
  content: z.ZodString;
90
- title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
90
  postType: z.ZodDefault<z.ZodEnum<{
92
91
  readonly MARKETPLACE: "MARKETPLACE";
93
92
  readonly PROJECT: "PROJECT";
@@ -95,6 +94,7 @@ export declare const CreatePostInputSchema: z.ZodObject<{
95
94
  readonly DEFAULT_POST: "DEFAULT_POST";
96
95
  readonly POST_WITH_LINKS: "POST_WITH_LINKS";
97
96
  readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
97
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
98
98
  }>>;
99
99
  files: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
100
  key: z.ZodString;
@@ -137,8 +137,7 @@ export declare const CreatePostOutputSchema: z.ZodObject<{
137
137
  creatorUsername: z.ZodOptional<z.ZodString>;
138
138
  creatorFullName: z.ZodOptional<z.ZodString>;
139
139
  creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
140
- content: z.ZodString;
141
- title: z.ZodOptional<z.ZodString>;
140
+ content: z.ZodOptional<z.ZodString>;
142
141
  postType: z.ZodEnum<{
143
142
  readonly MARKETPLACE: "MARKETPLACE";
144
143
  readonly PROJECT: "PROJECT";
@@ -146,6 +145,7 @@ export declare const CreatePostOutputSchema: z.ZodObject<{
146
145
  readonly DEFAULT_POST: "DEFAULT_POST";
147
146
  readonly POST_WITH_LINKS: "POST_WITH_LINKS";
148
147
  readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
148
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
149
149
  }>;
150
150
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
151
151
  linkMeta: z.ZodOptional<z.ZodObject<{
@@ -173,8 +173,7 @@ export declare const GetPostOutputSchema: z.ZodObject<{
173
173
  creatorUsername: z.ZodOptional<z.ZodString>;
174
174
  creatorFullName: z.ZodOptional<z.ZodString>;
175
175
  creatorImageUrl: z.ZodOptional<z.ZodCUID2>;
176
- content: z.ZodString;
177
- title: z.ZodOptional<z.ZodString>;
176
+ content: z.ZodOptional<z.ZodString>;
178
177
  postType: z.ZodEnum<{
179
178
  readonly MARKETPLACE: "MARKETPLACE";
180
179
  readonly PROJECT: "PROJECT";
@@ -182,6 +181,7 @@ export declare const GetPostOutputSchema: z.ZodObject<{
182
181
  readonly DEFAULT_POST: "DEFAULT_POST";
183
182
  readonly POST_WITH_LINKS: "POST_WITH_LINKS";
184
183
  readonly POST_WITH_MEDIA: "POST_WITH_MEDIA";
184
+ readonly POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS";
185
185
  }>;
186
186
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
187
187
  linkMeta: z.ZodOptional<z.ZodObject<{
@@ -203,15 +203,13 @@ export declare const PostIdSchema: z.ZodObject<{
203
203
  }, z.core.$strip>;
204
204
  export declare const MinimalPostSchema: z.ZodObject<{
205
205
  id: z.ZodCUID2;
206
- title: z.ZodOptional<z.ZodString>;
207
206
  parentId: z.ZodOptional<z.ZodCUID2>;
208
- content: z.ZodString;
207
+ content: z.ZodOptional<z.ZodString>;
209
208
  }, z.core.$strip>;
210
209
  export declare const PostWithLikesEntitySchema: z.ZodObject<{
211
210
  id: z.ZodCUID2;
212
- title: z.ZodOptional<z.ZodString>;
213
211
  parentId: z.ZodOptional<z.ZodCUID2>;
214
- content: z.ZodString;
212
+ content: z.ZodOptional<z.ZodString>;
215
213
  likes: z.ZodArray<z.ZodObject<{
216
214
  id: z.ZodCUID2;
217
215
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
@@ -225,9 +223,8 @@ export declare const PostWithLikesEntitySchema: z.ZodObject<{
225
223
  }, z.core.$strip>;
226
224
  export declare const PostWithCommentsEntitySchema: z.ZodObject<{
227
225
  id: z.ZodCUID2;
228
- title: z.ZodOptional<z.ZodString>;
229
226
  parentId: z.ZodOptional<z.ZodCUID2>;
230
- content: z.ZodString;
227
+ content: z.ZodOptional<z.ZodString>;
231
228
  comments: z.ZodArray<z.ZodObject<{
232
229
  id: z.ZodCUID2;
233
230
  userId: z.ZodCUID2;
@@ -247,9 +244,8 @@ export declare const PostWithCommentsEntitySchema: z.ZodObject<{
247
244
  }, z.core.$strip>;
248
245
  export declare const PostWithBookmarksEntitySchema: z.ZodObject<{
249
246
  id: z.ZodCUID2;
250
- title: z.ZodOptional<z.ZodString>;
251
247
  parentId: z.ZodOptional<z.ZodCUID2>;
252
- content: z.ZodString;
248
+ content: z.ZodOptional<z.ZodString>;
253
249
  bookmarks: z.ZodArray<z.ZodObject<{
254
250
  id: z.ZodCUID2;
255
251
  createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
@@ -270,3 +266,59 @@ export declare const LinkPreviewOutputSchema: z.ZodObject<{
270
266
  image: z.ZodOptional<z.ZodString>;
271
267
  url: z.ZodOptional<z.ZodString>;
272
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()
@@ -24,12 +25,9 @@ exports.PostEntitySchema = zod_openapi_1.z.object({
24
25
  creatorFullName: zod_openapi_1.z.string().optional(),
25
26
  creatorImageUrl: zod_openapi_1.z.cuid2().optional().openapi({ description: "Username" }),
26
27
  content: zod_openapi_1.z
27
- .string()
28
- .openapi({ description: "Post content", example: "Hello world" }),
29
- title: zod_openapi_1.z
30
28
  .string()
31
29
  .optional()
32
- .openapi({ description: "Optional title", example: "My first post" }),
30
+ .openapi({ description: "Post content", example: "Hello world" }),
33
31
  postType: zod_openapi_1.z.enum(constants_1.POST_TYPES).openapi({
34
32
  description: "Type of the post entity this statistic belongs to.",
35
33
  title: "Post Type",
@@ -88,11 +86,6 @@ exports.CreatePostInputSchema = zod_openapi_1.z.object({
88
86
  description: "Post content",
89
87
  example: "New project announcement",
90
88
  }),
91
- title: zod_openapi_1.z
92
- .string()
93
- .nullable()
94
- .optional()
95
- .openapi({ description: "Optional title", example: "Project launch" }),
96
89
  postType: zod_openapi_1.z
97
90
  .enum(constants_1.POST_TYPES)
98
91
  .default("DEFAULT_POST")
@@ -155,3 +148,6 @@ exports.LinkPreviewOutputSchema = zod_openapi_1.z.object({
155
148
  image: zod_openapi_1.z.string().optional(),
156
149
  url: zod_openapi_1.z.string().optional(),
157
150
  });
151
+ exports.FeedPostEntitySchema = exports.PostWithFilesEntitySchema.extend({
152
+ stats: entity_stats_1.EntityStatsSchema.shape
153
+ });
@@ -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.23",
3
+ "version": "2.0.25",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/constants.ts CHANGED
@@ -102,6 +102,7 @@ export const POST_TYPES = {
102
102
  DEFAULT_POST: "DEFAULT_POST",
103
103
  POST_WITH_LINKS: "POST_WITH_LINKS",
104
104
  POST_WITH_MEDIA: "POST_WITH_MEDIA",
105
+ POST_WITH_MEDIA_AND_LINKS: "POST_WITH_MEDIA_AND_LINKS",
105
106
  } as const;
106
107
 
107
108
  export const JOB_TYPE = {
@@ -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
@@ -24,14 +25,9 @@ export const PostEntitySchema = z.object({
24
25
  creatorFullName: z.string().optional(),
25
26
  creatorImageUrl: z.cuid2().optional().openapi({ description: "Username" }),
26
27
  content: z
27
- .string()
28
- .openapi({ description: "Post content", example: "Hello world" }),
29
-
30
- title: z
31
28
  .string()
32
29
  .optional()
33
- .openapi({ description: "Optional title", example: "My first post" }),
34
-
30
+ .openapi({ description: "Post content", example: "Hello world" }),
35
31
  postType: z.enum(POST_TYPES).openapi({
36
32
  description: "Type of the post entity this statistic belongs to.",
37
33
  title: "Post Type",
@@ -97,11 +93,6 @@ export const CreatePostInputSchema = z.object({
97
93
  description: "Post content",
98
94
  example: "New project announcement",
99
95
  }),
100
- title: z
101
- .string()
102
- .nullable()
103
- .optional()
104
- .openapi({ description: "Optional title", example: "Project launch" }),
105
96
  postType: z
106
97
  .enum(POST_TYPES)
107
98
  .default("DEFAULT_POST")
@@ -172,3 +163,8 @@ export const LinkPreviewOutputSchema = z.object({
172
163
  image: z.string().optional(),
173
164
  url: z.string().optional(),
174
165
  });
166
+
167
+
168
+ export const FeedPostEntitySchema = PostWithFilesEntitySchema.extend({
169
+ stats: EntityStatsSchema.shape
170
+ })
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>;