@zyacreatives/shared 2.5.54 → 2.5.55

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.
Files changed (111) hide show
  1. package/dist/index.d.ts +0 -1
  2. package/dist/index.js +0 -1
  3. package/dist/schemas/activity.d.ts +1 -0
  4. package/dist/schemas/auth.d.ts +2 -0
  5. package/dist/schemas/bookmark.d.ts +62 -7
  6. package/dist/schemas/bookmark.js +32 -30
  7. package/dist/schemas/brand.d.ts +3 -3
  8. package/dist/schemas/chat.d.ts +96 -52
  9. package/dist/schemas/chat.js +44 -18
  10. package/dist/schemas/comment.d.ts +65 -21
  11. package/dist/schemas/comment.js +48 -54
  12. package/dist/schemas/common.d.ts +15 -11
  13. package/dist/schemas/creative.d.ts +3 -3
  14. package/dist/schemas/discipline.d.ts +63 -12
  15. package/dist/schemas/discipline.js +62 -65
  16. package/dist/schemas/entity-stats.d.ts +35 -3
  17. package/dist/schemas/entity-stats.js +24 -38
  18. package/dist/schemas/feed.d.ts +50 -3
  19. package/dist/schemas/feed.js +43 -13
  20. package/dist/schemas/file.d.ts +65 -24
  21. package/dist/schemas/file.js +60 -49
  22. package/dist/schemas/index.d.ts +1 -0
  23. package/dist/schemas/index.js +1 -0
  24. package/dist/schemas/investor-shortlist.d.ts +68 -11
  25. package/dist/schemas/investor-shortlist.js +46 -24
  26. package/dist/schemas/investor-signal.d.ts +52 -12
  27. package/dist/schemas/investor-signal.js +59 -39
  28. package/dist/schemas/investor.d.ts +3 -3
  29. package/dist/schemas/job-application.d.ts +291 -279
  30. package/dist/schemas/job-application.js +59 -95
  31. package/dist/schemas/job.d.ts +200 -659
  32. package/dist/schemas/job.js +98 -231
  33. package/dist/schemas/like.d.ts +3 -0
  34. package/dist/schemas/message.d.ts +125 -94
  35. package/dist/schemas/message.js +54 -55
  36. package/dist/schemas/notification.d.ts +99 -32
  37. package/dist/schemas/notification.js +46 -42
  38. package/dist/schemas/payout-method.d.ts +51 -31
  39. package/dist/schemas/payout-method.js +48 -58
  40. package/dist/schemas/post.d.ts +295 -204
  41. package/dist/schemas/post.js +148 -272
  42. package/dist/schemas/product.d.ts +308 -229
  43. package/dist/schemas/product.js +111 -94
  44. package/dist/schemas/project.d.ts +75 -107
  45. package/dist/schemas/project.js +1 -5
  46. package/dist/schemas/seller.d.ts +10 -10
  47. package/dist/schemas/user-strike.d.ts +3 -0
  48. package/dist/schemas/user.d.ts +114 -123
  49. package/dist/schemas/username.d.ts +1 -0
  50. package/dist/schemas/view.d.ts +1 -0
  51. package/dist/types/activity.d.ts +1 -3
  52. package/dist/types/auth.d.ts +1 -4
  53. package/dist/types/bookmark.d.ts +1 -3
  54. package/dist/types/chat.d.ts +1 -11
  55. package/dist/types/comment.d.ts +1 -5
  56. package/dist/types/common.d.ts +2 -8
  57. package/dist/types/discipline.d.ts +1 -11
  58. package/dist/types/entity-stats.d.ts +1 -3
  59. package/dist/types/feed.d.ts +1 -5
  60. package/dist/types/investor-shortlist.d.ts +1 -6
  61. package/dist/types/investor-signal.d.ts +1 -7
  62. package/dist/types/like.d.ts +1 -3
  63. package/dist/types/message.d.ts +1 -9
  64. package/dist/types/notification.d.ts +1 -9
  65. package/dist/types/user-strike.d.ts +1 -5
  66. package/dist/types/username.d.ts +1 -3
  67. package/package.json +1 -1
  68. package/src/index.ts +4 -5
  69. package/src/schemas/activity.ts +5 -4
  70. package/src/schemas/auth.ts +14 -10
  71. package/src/schemas/bookmark.ts +48 -29
  72. package/src/schemas/chat.ts +79 -18
  73. package/src/schemas/comment.ts +63 -49
  74. package/src/schemas/common.ts +8 -3
  75. package/src/schemas/discipline.ts +103 -71
  76. package/src/schemas/entity-stats.ts +32 -38
  77. package/src/schemas/feed.ts +62 -15
  78. package/src/schemas/file.ts +85 -58
  79. package/src/schemas/index.ts +1 -0
  80. package/src/schemas/investor-shortlist.ts +57 -8
  81. package/src/schemas/investor-signal.ts +79 -27
  82. package/src/schemas/job-application.ts +81 -115
  83. package/src/schemas/job.ts +160 -301
  84. package/src/schemas/like.ts +5 -1
  85. package/src/schemas/message.ts +71 -64
  86. package/src/schemas/notification.ts +63 -51
  87. package/src/schemas/payout-method.ts +47 -63
  88. package/src/schemas/post.ts +211 -272
  89. package/src/schemas/product.ts +202 -139
  90. package/src/schemas/project.ts +7 -10
  91. package/src/schemas/user-strike.ts +7 -1
  92. package/src/schemas/user.ts +2 -6
  93. package/src/schemas/username.ts +5 -3
  94. package/src/schemas/view.ts +0 -50
  95. package/src/types/activity.ts +0 -4
  96. package/src/types/auth.ts +0 -5
  97. package/src/types/bookmark.ts +0 -4
  98. package/src/types/chat.ts +0 -31
  99. package/src/types/comment.ts +0 -12
  100. package/src/types/common.ts +0 -14
  101. package/src/types/discipline.ts +0 -32
  102. package/src/types/entity-stats.ts +0 -4
  103. package/src/types/feed.ts +0 -10
  104. package/src/types/index.ts +0 -16
  105. package/src/types/investor-shortlist.ts +0 -18
  106. package/src/types/investor-signal.ts +0 -26
  107. package/src/types/like.ts +0 -4
  108. package/src/types/message.ts +0 -26
  109. package/src/types/notification.ts +0 -34
  110. package/src/types/user-strike.ts +0 -10
  111. package/src/types/username.ts +0 -4
@@ -1,100 +1,107 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+
2
3
  import { ACTIVITY_PARENT_TYPES, MESSAGE_TYPES } from "../constants";
3
- import { CreateFileInputSchema } from "./file";
4
4
 
5
- // 1. Base primitives
6
- export const LinkMetaSchema = z.object({
7
- url: z.url(),
8
- title: z.string().optional(),
9
- description: z.string().optional(),
10
- image: z.url().optional(),
11
- });
5
+ /**
6
+ * --------------------------------
7
+ * SHAPE
8
+ * --------------------------------
9
+ */
12
10
 
13
- // 2. The API Output Schema (Enriched)
14
- export const MessageEntitySchema = z.object({
15
- id: z.cuid2(),
11
+ const MessageShape = z.object({
16
12
  chatId: z.cuid2(),
17
- senderId: z.cuid2(),
18
- receiverId: z.cuid2(),
19
-
20
- // Content & Type
21
- content: z.string().optional().default(""),
13
+ content: z.string().optional(),
22
14
  messageType: z.enum(MESSAGE_TYPES).default("DEFAULT_MESSAGE"),
23
15
 
24
- // Parent/Threading
25
16
  parentId: z.cuid2().optional(),
26
17
  parentType: z.enum(ACTIVITY_PARENT_TYPES).optional(),
27
18
 
28
- // Reply Context
29
19
  replyToMessageId: z.cuid2().optional(),
30
- replyToContent: z.string().optional(),
31
- replyToImages: z.array(z.url()).optional(),
32
- replyToLinkMeta: LinkMetaSchema.optional(),
33
-
34
- // Metadata
35
- linkMeta: LinkMetaSchema.optional(),
36
- createdAt: z.coerce.date(),
37
- updatedAt: z.coerce.date().optional(),
38
- deletedBySender: z.boolean().default(false),
39
- deletedByReceiver: z.boolean().default(false),
40
- isEdited: z.boolean().default(false),
41
- deletedAt: z.coerce.date().optional(),
42
- });
43
20
 
44
- export const DeleteMessagesInputSchema = z.object({
45
- messageIds: z.array(z.cuid2()),
46
- deleteForEveryone: z.boolean().default(false),
21
+ linkMeta: z
22
+ .object({
23
+ url: z.url(),
24
+ title: z.string().optional(),
25
+ description: z.string().optional(),
26
+ image: z.url().optional(),
27
+ })
28
+ .optional(),
47
29
  });
48
30
 
31
+ export type MessageShapeType = z.infer<typeof MessageShape>;
32
+
33
+ /**
34
+ * --------------------------------
35
+ * BASE ENTITY
36
+ * --------------------------------
37
+ */
38
+
39
+ export const MessageEntitySchema = z
40
+ .object({
41
+ id: z.cuid2(),
42
+ senderId: z.cuid2(),
43
+ receiverId: z.cuid2(),
44
+
45
+ ...MessageShape.shape,
46
+
47
+ replyToContent: z.string().optional(),
48
+ replyToImages: z.array(z.url()).optional(),
49
+ replyToLinkMeta: MessageShape.shape.linkMeta,
50
+
51
+ deletedBySender: z.boolean().default(false),
52
+ deletedByReceiver: z.boolean().default(false),
53
+ isEdited: z.boolean().default(false),
54
+
55
+ createdAt: z.iso.datetime(),
56
+ updatedAt: z.iso.datetime().optional(),
57
+ deletedAt: z.iso.datetime().optional(),
58
+ })
59
+ .openapi("Message");
60
+
61
+ export type MessageEntity = z.infer<typeof MessageEntitySchema>;
62
+
49
63
  export const MessageFileEntitySchema = z.object({
50
64
  id: z.cuid2(),
51
65
  messageId: z.cuid2(),
52
66
  fileId: z.cuid2(),
53
67
  url: z.url(),
54
- order: z.number().int().default(0),
68
+ order: z.int(),
55
69
  });
56
70
 
57
71
  export const MessageWithFilesEntitySchema = MessageEntitySchema.extend({
58
- messageFiles: z.array(MessageFileEntitySchema).default([]),
72
+ messageFiles: z.array(MessageFileEntitySchema),
59
73
  });
60
74
 
61
- // 3. Inputs
62
- export const CreateMessageInputSchema = z.object({
63
- id: z.cuid2(),
64
- chatId: z.cuid2(),
65
- senderId: z.cuid2(),
66
- receiverId: z.cuid2(),
67
-
68
- content: z.string().optional(),
69
- messageType: z.enum(MESSAGE_TYPES).default("DEFAULT_MESSAGE"),
75
+ /**
76
+ * --------------------------------
77
+ * INPUTS
78
+ * --------------------------------
79
+ */
70
80
 
71
- parentId: z.cuid2().optional(),
72
- replyToMessageId: z.cuid2().optional(),
73
-
74
- linkMeta: LinkMetaSchema.optional(),
81
+ export const CreateMessageInputSchema = MessageShape.extend({
75
82
  files: z
76
- .array(CreateFileInputSchema.extend({ order: z.number().int() }))
83
+ .array(
84
+ z.object({
85
+ key: z.string(),
86
+ mimeType: z.string(),
87
+ order: z.int(),
88
+ }),
89
+ )
77
90
  .optional(),
78
91
  });
79
92
 
80
93
  export const EditMessageInputSchema = z.object({
81
- id: z.cuid2(),
82
- chatId: z.cuid2(),
83
- senderId: z.cuid2(),
84
- receiverId: z.cuid2(),
94
+ messageId: z.cuid2(),
85
95
  content: z.string().optional(),
86
- isEdited: z.boolean().default(true),
87
96
  });
88
97
 
98
+ /**
99
+ * --------------------------------
100
+ * OUTPUTS
101
+ * --------------------------------
102
+ */
103
+
89
104
  export const GetMessagesOutputSchema = z.object({
90
105
  messages: z.array(MessageWithFilesEntitySchema),
91
- nextCursor: z.string().nullable(),
92
- });
93
-
94
- export const MessageIdSchema = z.object({
95
- messageId: z.cuid2(),
96
- });
97
-
98
- export const ChatIdParamSchema = z.object({
99
- chatId: z.cuid2(),
106
+ nextCursor: z.string().optional(),
100
107
  });
@@ -1,70 +1,82 @@
1
1
  import { z } from "@hono/zod-openapi";
2
+
2
3
  import { ACTIVITY_PARENT_TYPES, NOTIFICATION_TYPES } from "../constants";
3
4
  import { MinimalUserSchema } from "./user";
4
5
 
5
- export const NotificationEntitySchema = z
6
- .object({
7
- id: z.cuid2().openapi({ example: "not_cksd0v6q0000s9a5y8z7p3x9" }),
8
- recipientId: z.cuid2().openapi({ example: "user_recipient_123" }),
9
- actorId: z.cuid2().openapi({ example: "user_actor_456" }),
10
- type: z.enum(NOTIFICATION_TYPES).openapi({ example: "LIKE" }),
11
- entityId: z.cuid2().optional().openapi({ example: "entity_789" }),
12
- parentId: z
13
- .cuid2()
14
- .optional()
15
- .nullable()
16
- .openapi({ example: "parent_456" }),
17
- parentType: z.enum(ACTIVITY_PARENT_TYPES).optional().nullable(),
18
- rootId: z.cuid2().openapi({ example: "root_123" }),
19
- rootType: z.enum(ACTIVITY_PARENT_TYPES),
6
+ /**
7
+ * --------------------------------
8
+ * SHAPE
9
+ * --------------------------------
10
+ */
20
11
 
21
- isRead: z.boolean().default(false).openapi({ example: false }),
22
- createdAt: z.coerce
23
- .date()
24
- .openapi({ example: "2026-01-05T09:00:00.000Z" }),
25
- deletedAt: z.coerce.date().optional().nullable(),
26
- })
27
- .openapi("NotificationEntity");
12
+ const NotificationShape = z.object({
13
+ actorId: z.cuid2(),
14
+ recipientId: z.cuid2(),
15
+ type: z.enum(NOTIFICATION_TYPES),
28
16
 
29
- export const MinimalNotificationEntitySchema = z.object({
30
- id: z.cuid2(),
31
- recipientId: z.cuid2(),
32
- actorId: z.cuid2(),
17
+ entityId: z.cuid2().optional(),
18
+ parentId: z.cuid2().nullable().optional(),
19
+ parentType: z.enum(ACTIVITY_PARENT_TYPES).nullable().optional(),
20
+
21
+ rootId: z.cuid2(),
22
+ rootType: z.enum(ACTIVITY_PARENT_TYPES),
33
23
  });
34
24
 
25
+ export type NotificationShapeType = z.infer<typeof NotificationShape>;
26
+
27
+ /**
28
+ * --------------------------------
29
+ * ENTITY
30
+ * --------------------------------
31
+ */
32
+
33
+ export const NotificationEntitySchema = z
34
+ .object({
35
+ id: z.cuid2(),
36
+ ...NotificationShape.shape,
37
+ isRead: z.boolean().default(false),
38
+ createdAt: z.iso.datetime(),
39
+ deletedAt: z.iso.datetime().optional(),
40
+ })
41
+ .openapi("Notification");
42
+
35
43
  export const NotificationDetailsEntitySchema = NotificationEntitySchema.extend({
36
- actor: MinimalUserSchema,
37
- recipient: MinimalUserSchema,
38
- itemTitle: z.string().optional(),
39
- itemContent: z.string().optional(),
40
- itemImgUrl: z.string().optional(),
41
- itemStatus: z.string().optional(),
44
+ actor: MinimalUserSchema,
45
+ recipient: MinimalUserSchema,
46
+ itemTitle: z.string().optional(),
47
+ itemContent: z.string().optional(),
48
+ itemImgUrl: z.string().optional(),
49
+ itemStatus: z.string().optional(),
42
50
  });
43
51
 
44
- export const ListNotificationsInputSchema = z
45
- .object({
46
- type: z
47
- .enum(NOTIFICATION_TYPES)
48
- .openapi({ example: "LIKE" })
49
- .optional(),
50
- cursor: z.string().optional(),
51
- unreadOnly: z
52
- .preprocess((val) => val === "true" || val === true, z.boolean())
53
- .optional()
54
- .default(false),
55
- })
56
- .openapi("ListNotificationsInput");
52
+ /**
53
+ * --------------------------------
54
+ * INPUTS
55
+ * --------------------------------
56
+ */
57
57
 
58
- export const ListNotificationsOutputSchema = z.object({
59
- notifications: z.array(NotificationDetailsEntitySchema),
60
- nextCursor: z.string().optional().nullable(),
61
- unreadCount: z.number().int().openapi({ example: 5 }),
58
+ export const ListNotificationsInputSchema = z.object({
59
+ type: z.enum(NOTIFICATION_TYPES).optional(),
60
+ cursor: z.string().optional(),
61
+ unreadOnly: z.boolean().optional().default(false),
62
62
  });
63
63
 
64
64
  export const MarkReadInputSchema = z.object({
65
- notificationIds: z.array(z.cuid2()).min(1),
65
+ notificationIds: z.array(z.cuid2()).min(1),
66
+ });
67
+
68
+ /**
69
+ * --------------------------------
70
+ * OUTPUTS
71
+ * --------------------------------
72
+ */
73
+
74
+ export const ListNotificationsOutputSchema = z.object({
75
+ notifications: z.array(NotificationDetailsEntitySchema),
76
+ nextCursor: z.string().optional(),
77
+ unreadCount: z.int(),
66
78
  });
67
79
 
68
80
  export const NotificationCountOutputSchema = z.object({
69
- unreadCount: z.number().int().openapi({ example: 12 }),
81
+ unreadCount: z.int(),
70
82
  });
@@ -1,83 +1,67 @@
1
- import z from "zod";
1
+ import { z } from "@hono/zod-openapi";
2
+
2
3
  import { GATEWAY_PROVIDER, PAYMENT_METHOD_STATUS } from "../constants";
3
- export const PayoutMethodEntitySchema = z.object({
4
- id: z.cuid2(),
5
- sellerId: z.cuid2(),
4
+
5
+ /**
6
+ * --------------------------------
7
+ * SHAPE
8
+ * --------------------------------
9
+ */
10
+
11
+ const PayoutMethodShape = z.object({
6
12
  provider: z.enum(GATEWAY_PROVIDER),
7
- currency: z.string(),
8
13
  bankName: z.string(),
9
14
  accountLast4: z.string(),
10
15
  accountName: z.string(),
11
16
  externalBankId: z.string().nullable(),
12
17
  isDefault: z.boolean(),
13
- status: z.enum(PAYMENT_METHOD_STATUS).default(PAYMENT_METHOD_STATUS.PENDING),
14
- createdAt: z.coerce.date(),
15
- updatedAt: z.coerce.date(),
16
18
  });
17
- export type PayoutMethodEntity = z.infer<typeof PayoutMethodEntitySchema>;
18
19
 
19
- export const CreatePayoutMethodEntitySchema = z.object({
20
- provider: z.enum(GATEWAY_PROVIDER),
21
- bankName: z.string(),
22
- accountLast4: z.string(),
23
- accountName: z.string(),
24
- isDefault: z.boolean(),
25
- });
26
- export type CreatePayoutMethodInput = z.infer<
27
- typeof CreatePayoutMethodEntitySchema
28
- >;
20
+ export type PayoutMethodShapeType = z.infer<typeof PayoutMethodShape>;
21
+
22
+ /**
23
+ * --------------------------------
24
+ * ENTITY
25
+ * --------------------------------
26
+ */
29
27
 
30
- export const UpdatePayoutMethodEntitySchema = z
28
+ export const PayoutMethodEntitySchema = z
31
29
  .object({
32
- bankName: z.string(),
33
- accountLast4: z.string(),
34
- accountName: z.string(),
35
- isDefault: z.boolean(),
30
+ id: z.cuid2(),
31
+ sellerId: z.cuid2(),
32
+ currency: z.string(),
33
+ ...PayoutMethodShape.shape,
36
34
  status: z.enum(PAYMENT_METHOD_STATUS),
37
- externalBankId: z.string().nullable(),
35
+ createdAt: z.iso.datetime(),
36
+ updatedAt: z.iso.datetime(),
38
37
  })
39
- .partial();
38
+ .openapi("PayoutMethod");
40
39
 
41
- export type UpdatePayoutMethodInput = z.infer<
42
- typeof UpdatePayoutMethodEntitySchema
43
- >;
40
+ /**
41
+ * --------------------------------
42
+ * INPUTS
43
+ * --------------------------------
44
+ */
44
45
 
45
- export const GetBanksInputSchema = z.object({
46
- country: z
47
- .string()
48
- .default("nigeria")
49
- .openapi({
50
- param: { in: "query", name: "country" },
51
- example: "nigeria",
52
- }),
46
+ export const CreatePayoutMethodInputSchema = PayoutMethodShape.omit({
47
+ externalBankId: true,
53
48
  });
54
49
 
55
- export type GetBanksInput = z.infer<typeof GetBanksInputSchema>;
50
+ export const UpdatePayoutMethodInputSchema = PayoutMethodShape.partial();
56
51
 
57
- export const VerifyAccountInputSchema = z
58
- .object({
59
- accountNumber: z.string().length(10, "Account number must be 10 digits"),
60
- bankCode: z.string().min(1, "Bank code is required"),
61
- })
62
- .openapi("VerifyAccountInput");
63
-
64
- export type VerifyAccountInput = z.infer<typeof VerifyAccountInputSchema>;
52
+ /**
53
+ * --------------------------------
54
+ * OUTPUTS
55
+ * --------------------------------
56
+ */
65
57
 
66
- export const VerifyAccountOutputSchema = z
67
- .object({
68
- accountName: z.string(),
69
- })
70
- .openapi("VerifyAccountOutput");
71
-
72
- export type VerifyAccountOutput = z.infer<typeof VerifyAccountOutputSchema>;
73
-
74
- export const BankListOutputSchema = z
75
- .array(
76
- z.object({
77
- name: z.string(),
78
- code: z.string(),
79
- }),
80
- )
81
- .openapi("BankListOutput");
58
+ export const VerifyAccountOutputSchema = z.object({
59
+ accountName: z.string(),
60
+ });
82
61
 
83
- export type BankListOutput = z.infer<typeof BankListOutputSchema>;
62
+ export const BankListOutputSchema = z.array(
63
+ z.object({
64
+ name: z.string(),
65
+ code: z.string(),
66
+ }),
67
+ );