@zyacreatives/shared 2.0.37 → 2.0.39
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.
- package/dist/constants.d.ts +10 -0
- package/dist/constants.js +10 -1
- package/dist/schemas/chat.d.ts +32 -0
- package/dist/schemas/chat.js +22 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/message.d.ts +127 -0
- package/dist/schemas/message.js +103 -0
- package/dist/types/chat.d.ts +6 -0
- package/dist/types/chat.js +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/message.d.ts +7 -0
- package/dist/types/message.js +2 -0
- package/package.json +1 -1
- package/src/constants.ts +11 -0
- package/src/schemas/chat.ts +23 -0
- package/src/schemas/index.ts +2 -0
- package/src/schemas/message.ts +109 -0
- package/src/types/chat.ts +15 -0
- package/src/types/index.ts +2 -0
- package/src/types/message.ts +20 -0
package/dist/constants.d.ts
CHANGED
|
@@ -146,6 +146,15 @@ export declare const JOB_LOCATIONS: {
|
|
|
146
146
|
readonly GLOBAL: "Global";
|
|
147
147
|
readonly OTHER: "Other";
|
|
148
148
|
};
|
|
149
|
+
export declare const MESSAGE_TYPES: {
|
|
150
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
151
|
+
readonly PROJECT: "PROJECT";
|
|
152
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
153
|
+
readonly DEFAULT_MESSAGE: "DEFAULT_MESSAGE";
|
|
154
|
+
readonly MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS";
|
|
155
|
+
readonly MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA";
|
|
156
|
+
readonly MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS";
|
|
157
|
+
};
|
|
149
158
|
export type JobLocation = (typeof JOB_LOCATIONS)[keyof typeof JOB_LOCATIONS];
|
|
150
159
|
export declare const GIG_TYPE: {
|
|
151
160
|
readonly ONE_TIME: "One Time";
|
|
@@ -199,6 +208,7 @@ export type EmploymentType = (typeof EMPLOYMENT_TYPE)[keyof typeof EMPLOYMENT_TY
|
|
|
199
208
|
export type JobAvailabilityTypes = (typeof JOB_AVAILABILITY_TYPES)[keyof typeof JOB_AVAILABILITY_TYPES];
|
|
200
209
|
export type WageTypes = (typeof WAGE_TYPES)[keyof typeof WAGE_TYPES];
|
|
201
210
|
export type PostType = (typeof POST_TYPES)[keyof typeof POST_TYPES];
|
|
211
|
+
export type MessageType = (typeof MESSAGE_TYPES)[keyof typeof MESSAGE_TYPES];
|
|
202
212
|
export type ActivityParentType = (typeof ACTIVITY_PARENT_TYPES)[keyof typeof ACTIVITY_PARENT_TYPES];
|
|
203
213
|
export type UserStatus = (typeof USER_STATUSES)[keyof typeof USER_STATUSES];
|
|
204
214
|
export type ClientType = (typeof CLIENT_TYPES)[keyof typeof CLIENT_TYPES];
|
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.ACTIVITY_TYPES = exports.POST_BADGE_TYPES = exports.JOB_STATUS = exports.WAGES_CURRENCY = exports.GIG_TYPE = exports.JOB_LOCATIONS = exports.JOB_SECTIONS = exports.WAGE_TYPES = exports.JOB_AVAILABILITY_TYPES = exports.EMPLOYMENT_TYPE = exports.WORK_MODE = exports.JOB_TYPE = exports.POST_TYPES = exports.ACTIVITY_PARENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
|
|
3
|
+
exports.DEFAULT_DISCIPLINES = exports.API_ROUTES = exports.ACTIVITY_TYPES = exports.POST_BADGE_TYPES = exports.JOB_STATUS = exports.WAGES_CURRENCY = exports.GIG_TYPE = exports.MESSAGE_TYPES = exports.JOB_LOCATIONS = exports.JOB_SECTIONS = exports.WAGE_TYPES = exports.JOB_AVAILABILITY_TYPES = exports.EMPLOYMENT_TYPE = exports.WORK_MODE = exports.JOB_TYPE = exports.POST_TYPES = exports.ACTIVITY_PARENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_TYPES = exports.INVESTOR_VERIFICATION_DOCUMENT_STATUSES = exports.GEOGRAPHIC_FOCUS = exports.INVESTMENT_SIZES = exports.INVESTOR_TYPES = exports.ONBOARDING_PAGES = exports.EXPERIENCE_LEVELS = exports.CLIENT_TYPES = exports.USER_STATUSES = exports.ROLES = void 0;
|
|
4
4
|
exports.ROLES = {
|
|
5
5
|
CREATIVE: "CREATIVE",
|
|
6
6
|
BRAND: "BRAND",
|
|
@@ -149,6 +149,15 @@ exports.JOB_LOCATIONS = {
|
|
|
149
149
|
GLOBAL: "Global",
|
|
150
150
|
OTHER: "Other",
|
|
151
151
|
};
|
|
152
|
+
exports.MESSAGE_TYPES = {
|
|
153
|
+
MARKETPLACE: "MARKETPLACE",
|
|
154
|
+
PROJECT: "PROJECT",
|
|
155
|
+
JOB_OPENING: "JOB_OPENING",
|
|
156
|
+
DEFAULT_MESSAGE: "DEFAULT_MESSAGE",
|
|
157
|
+
MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS",
|
|
158
|
+
MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA",
|
|
159
|
+
MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS",
|
|
160
|
+
};
|
|
152
161
|
exports.GIG_TYPE = {
|
|
153
162
|
ONE_TIME: "One Time",
|
|
154
163
|
RECURRING: "Recurring",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const BaseChatEntitySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodCUID2;
|
|
4
|
+
senderId: z.ZodCUID2;
|
|
5
|
+
receiverId: z.ZodCUID2;
|
|
6
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
7
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
8
|
+
deletedAt: z.ZodCoercedDate<unknown>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export declare const ChatEntitySchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodCUID2;
|
|
12
|
+
senderId: z.ZodCUID2;
|
|
13
|
+
receiverId: z.ZodCUID2;
|
|
14
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
15
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
16
|
+
deletedAt: z.ZodCoercedDate<unknown>;
|
|
17
|
+
receiverImgUrl: z.ZodOptional<z.ZodString>;
|
|
18
|
+
receiverName: z.ZodString;
|
|
19
|
+
lastMessageSent: z.ZodString;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export declare const CreateChatInputSchema: z.ZodObject<{
|
|
22
|
+
senderId: z.ZodCUID2;
|
|
23
|
+
receiverId: z.ZodCUID2;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const CreateChatOutputSchema: z.ZodObject<{
|
|
26
|
+
id: z.ZodCUID2;
|
|
27
|
+
senderId: z.ZodCUID2;
|
|
28
|
+
receiverId: z.ZodCUID2;
|
|
29
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
30
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
31
|
+
deletedAt: z.ZodCoercedDate<unknown>;
|
|
32
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateChatOutputSchema = exports.CreateChatInputSchema = exports.ChatEntitySchema = exports.BaseChatEntitySchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
exports.BaseChatEntitySchema = zod_openapi_1.z.object({
|
|
6
|
+
id: zod_openapi_1.z.cuid2(),
|
|
7
|
+
senderId: zod_openapi_1.z.cuid2(),
|
|
8
|
+
receiverId: zod_openapi_1.z.cuid2(),
|
|
9
|
+
createdAt: zod_openapi_1.z.coerce.date(),
|
|
10
|
+
updatedAt: zod_openapi_1.z.coerce.date(),
|
|
11
|
+
deletedAt: zod_openapi_1.z.coerce.date(),
|
|
12
|
+
});
|
|
13
|
+
exports.ChatEntitySchema = exports.BaseChatEntitySchema.extend({
|
|
14
|
+
receiverImgUrl: zod_openapi_1.z.string().optional(),
|
|
15
|
+
receiverName: zod_openapi_1.z.string(),
|
|
16
|
+
lastMessageSent: zod_openapi_1.z.string(),
|
|
17
|
+
});
|
|
18
|
+
exports.CreateChatInputSchema = zod_openapi_1.z.object({
|
|
19
|
+
senderId: zod_openapi_1.z.cuid2(),
|
|
20
|
+
receiverId: zod_openapi_1.z.cuid2(),
|
|
21
|
+
});
|
|
22
|
+
exports.CreateChatOutputSchema = exports.BaseChatEntitySchema;
|
package/dist/schemas/index.d.ts
CHANGED
package/dist/schemas/index.js
CHANGED
|
@@ -25,5 +25,7 @@ __exportStar(require("./file"), exports);
|
|
|
25
25
|
__exportStar(require("./username"), exports);
|
|
26
26
|
__exportStar(require("./post"), exports);
|
|
27
27
|
__exportStar(require("./entity-stats"), exports);
|
|
28
|
+
__exportStar(require("./message"), exports);
|
|
29
|
+
__exportStar(require("./chat"), exports);
|
|
28
30
|
__exportStar(require("./job"), exports);
|
|
29
31
|
__exportStar(require("./job-application"), exports);
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
export declare const MessageEntitySchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodCUID2;
|
|
4
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
5
|
+
parentType: z.ZodOptional<z.ZodEnum<{
|
|
6
|
+
readonly PROJECT: "PROJECT";
|
|
7
|
+
readonly POST: "POST";
|
|
8
|
+
}>>;
|
|
9
|
+
replyToMessageId: z.ZodOptional<z.ZodCUID2>;
|
|
10
|
+
chatId: z.ZodCUID2;
|
|
11
|
+
senderId: z.ZodCUID2;
|
|
12
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
url: z.ZodURL;
|
|
14
|
+
title: z.ZodOptional<z.ZodString>;
|
|
15
|
+
description: z.ZodOptional<z.ZodString>;
|
|
16
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
content: z.ZodOptional<z.ZodString>;
|
|
19
|
+
messageType: z.ZodDefault<z.ZodEnum<{
|
|
20
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
21
|
+
readonly PROJECT: "PROJECT";
|
|
22
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
23
|
+
readonly DEFAULT_MESSAGE: "DEFAULT_MESSAGE";
|
|
24
|
+
readonly MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS";
|
|
25
|
+
readonly MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA";
|
|
26
|
+
readonly MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS";
|
|
27
|
+
}>>;
|
|
28
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
29
|
+
deletedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const MessageFileEntitySchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
messageId: z.ZodString;
|
|
34
|
+
fileId: z.ZodString;
|
|
35
|
+
order: z.ZodNumber;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export declare const MessageWithFilesEntitySchema: z.ZodObject<{
|
|
38
|
+
id: z.ZodCUID2;
|
|
39
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
40
|
+
parentType: z.ZodOptional<z.ZodEnum<{
|
|
41
|
+
readonly PROJECT: "PROJECT";
|
|
42
|
+
readonly POST: "POST";
|
|
43
|
+
}>>;
|
|
44
|
+
replyToMessageId: z.ZodOptional<z.ZodCUID2>;
|
|
45
|
+
chatId: z.ZodCUID2;
|
|
46
|
+
senderId: z.ZodCUID2;
|
|
47
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
48
|
+
url: z.ZodURL;
|
|
49
|
+
title: z.ZodOptional<z.ZodString>;
|
|
50
|
+
description: z.ZodOptional<z.ZodString>;
|
|
51
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
content: z.ZodOptional<z.ZodString>;
|
|
54
|
+
messageType: z.ZodDefault<z.ZodEnum<{
|
|
55
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
56
|
+
readonly PROJECT: "PROJECT";
|
|
57
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
58
|
+
readonly DEFAULT_MESSAGE: "DEFAULT_MESSAGE";
|
|
59
|
+
readonly MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS";
|
|
60
|
+
readonly MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA";
|
|
61
|
+
readonly MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS";
|
|
62
|
+
}>>;
|
|
63
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
64
|
+
deletedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
65
|
+
messageFiles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
messageId: z.ZodString;
|
|
68
|
+
fileId: z.ZodString;
|
|
69
|
+
order: z.ZodNumber;
|
|
70
|
+
url: z.ZodURL;
|
|
71
|
+
}, z.core.$strip>>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export declare const CreateMessageInputSchema: z.ZodObject<{
|
|
74
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
75
|
+
content: z.ZodOptional<z.ZodString>;
|
|
76
|
+
messageType: z.ZodDefault<z.ZodEnum<{
|
|
77
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
78
|
+
readonly PROJECT: "PROJECT";
|
|
79
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
80
|
+
readonly DEFAULT_MESSAGE: "DEFAULT_MESSAGE";
|
|
81
|
+
readonly MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS";
|
|
82
|
+
readonly MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA";
|
|
83
|
+
readonly MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS";
|
|
84
|
+
}>>;
|
|
85
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
86
|
+
key: z.ZodString;
|
|
87
|
+
mimeType: z.ZodString;
|
|
88
|
+
order: z.ZodDefault<z.ZodInt>;
|
|
89
|
+
}, z.core.$strip>>>;
|
|
90
|
+
chatId: z.ZodString;
|
|
91
|
+
senderId: z.ZodString;
|
|
92
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
url: z.ZodURL;
|
|
94
|
+
title: z.ZodOptional<z.ZodString>;
|
|
95
|
+
description: z.ZodOptional<z.ZodString>;
|
|
96
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
97
|
+
}, z.core.$strip>>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export declare const CreateMessageOutputSchema: z.ZodObject<{
|
|
100
|
+
id: z.ZodCUID2;
|
|
101
|
+
parentId: z.ZodOptional<z.ZodCUID2>;
|
|
102
|
+
parentType: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
readonly PROJECT: "PROJECT";
|
|
104
|
+
readonly POST: "POST";
|
|
105
|
+
}>>;
|
|
106
|
+
replyToMessageId: z.ZodOptional<z.ZodCUID2>;
|
|
107
|
+
chatId: z.ZodCUID2;
|
|
108
|
+
senderId: z.ZodCUID2;
|
|
109
|
+
linkMeta: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
url: z.ZodURL;
|
|
111
|
+
title: z.ZodOptional<z.ZodString>;
|
|
112
|
+
description: z.ZodOptional<z.ZodString>;
|
|
113
|
+
image: z.ZodOptional<z.ZodURL>;
|
|
114
|
+
}, z.core.$strip>>;
|
|
115
|
+
content: z.ZodOptional<z.ZodString>;
|
|
116
|
+
messageType: z.ZodDefault<z.ZodEnum<{
|
|
117
|
+
readonly MARKETPLACE: "MARKETPLACE";
|
|
118
|
+
readonly PROJECT: "PROJECT";
|
|
119
|
+
readonly JOB_OPENING: "JOB_OPENING";
|
|
120
|
+
readonly DEFAULT_MESSAGE: "DEFAULT_MESSAGE";
|
|
121
|
+
readonly MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS";
|
|
122
|
+
readonly MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA";
|
|
123
|
+
readonly MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS";
|
|
124
|
+
}>>;
|
|
125
|
+
createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
126
|
+
deletedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
|
|
127
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateMessageOutputSchema = exports.CreateMessageInputSchema = exports.MessageWithFilesEntitySchema = exports.MessageFileEntitySchema = exports.MessageEntitySchema = void 0;
|
|
4
|
+
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const file_1 = require("./file");
|
|
7
|
+
exports.MessageEntitySchema = zod_openapi_1.z.object({
|
|
8
|
+
id: zod_openapi_1.z.cuid2(),
|
|
9
|
+
parentId: zod_openapi_1.z.cuid2().optional(),
|
|
10
|
+
parentType: zod_openapi_1.z.enum(constants_1.ACTIVITY_PARENT_TYPES).optional(),
|
|
11
|
+
replyToMessageId: zod_openapi_1.z.cuid2().optional(),
|
|
12
|
+
chatId: zod_openapi_1.z.cuid2(),
|
|
13
|
+
senderId: zod_openapi_1.z.cuid2(),
|
|
14
|
+
linkMeta: zod_openapi_1.z
|
|
15
|
+
.object({
|
|
16
|
+
url: zod_openapi_1.z.url(),
|
|
17
|
+
title: zod_openapi_1.z.string().optional(),
|
|
18
|
+
description: zod_openapi_1.z.string().optional(),
|
|
19
|
+
image: zod_openapi_1.z.url().optional(),
|
|
20
|
+
})
|
|
21
|
+
.optional()
|
|
22
|
+
.openapi({
|
|
23
|
+
description: "Optional metadata for a single link in the message",
|
|
24
|
+
example: {
|
|
25
|
+
url: "https://example.com",
|
|
26
|
+
title: "Example Website",
|
|
27
|
+
description: "This is an example link",
|
|
28
|
+
image: "https://example.com/preview.jpg",
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
content: zod_openapi_1.z.string().optional(),
|
|
32
|
+
messageType: zod_openapi_1.z.enum(constants_1.MESSAGE_TYPES).default(constants_1.MESSAGE_TYPES.DEFAULT_MESSAGE),
|
|
33
|
+
createdAt: zod_openapi_1.z.coerce.date().optional(),
|
|
34
|
+
deletedAt: zod_openapi_1.z.coerce.date().optional(),
|
|
35
|
+
});
|
|
36
|
+
exports.MessageFileEntitySchema = zod_openapi_1.z
|
|
37
|
+
.object({
|
|
38
|
+
id: zod_openapi_1.z
|
|
39
|
+
.string()
|
|
40
|
+
.openapi({ description: "CUID2 of the project file record." }),
|
|
41
|
+
messageId: zod_openapi_1.z.string().openapi({
|
|
42
|
+
description: "CUID2 of the message this file belongs to.",
|
|
43
|
+
}),
|
|
44
|
+
fileId: zod_openapi_1.z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
45
|
+
order: zod_openapi_1.z.number().int().openapi({
|
|
46
|
+
description: "Order index of the file in the project.",
|
|
47
|
+
example: 1,
|
|
48
|
+
}),
|
|
49
|
+
})
|
|
50
|
+
.openapi({
|
|
51
|
+
title: "Message File Entity",
|
|
52
|
+
description: "Schema representing a file associated with a project.",
|
|
53
|
+
});
|
|
54
|
+
exports.MessageWithFilesEntitySchema = exports.MessageEntitySchema.extend({
|
|
55
|
+
messageFiles: zod_openapi_1.z
|
|
56
|
+
.array(exports.MessageFileEntitySchema.extend({
|
|
57
|
+
url: zod_openapi_1.z.url(),
|
|
58
|
+
}))
|
|
59
|
+
.optional()
|
|
60
|
+
.openapi({ description: "Files associated with the project." }),
|
|
61
|
+
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
62
|
+
exports.CreateMessageInputSchema = zod_openapi_1.z.object({
|
|
63
|
+
parentId: zod_openapi_1.z
|
|
64
|
+
.cuid2()
|
|
65
|
+
.optional()
|
|
66
|
+
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
67
|
+
content: zod_openapi_1.z
|
|
68
|
+
.string()
|
|
69
|
+
.openapi({
|
|
70
|
+
description: "Message content",
|
|
71
|
+
example: "New project announcement",
|
|
72
|
+
})
|
|
73
|
+
.optional(),
|
|
74
|
+
messageType: zod_openapi_1.z
|
|
75
|
+
.enum(constants_1.MESSAGE_TYPES)
|
|
76
|
+
.default("DEFAULT_MESSAGE")
|
|
77
|
+
.openapi({ description: "Message type", example: "PROJECT" }),
|
|
78
|
+
files: zod_openapi_1.z
|
|
79
|
+
.array(file_1.CreateFileInputSchema.extend({
|
|
80
|
+
order: zod_openapi_1.z.int().default(1),
|
|
81
|
+
}))
|
|
82
|
+
.optional(),
|
|
83
|
+
chatId: zod_openapi_1.z.string(),
|
|
84
|
+
senderId: zod_openapi_1.z.string(),
|
|
85
|
+
linkMeta: zod_openapi_1.z
|
|
86
|
+
.object({
|
|
87
|
+
url: zod_openapi_1.z.url(),
|
|
88
|
+
title: zod_openapi_1.z.string().optional(),
|
|
89
|
+
description: zod_openapi_1.z.string().optional(),
|
|
90
|
+
image: zod_openapi_1.z.url().optional(),
|
|
91
|
+
})
|
|
92
|
+
.optional()
|
|
93
|
+
.openapi({
|
|
94
|
+
description: "Optional metadata for a single link in the message",
|
|
95
|
+
example: {
|
|
96
|
+
url: "https://example.com",
|
|
97
|
+
title: "Example Website",
|
|
98
|
+
description: "This is an example link",
|
|
99
|
+
image: "https://example.com/preview.jpg",
|
|
100
|
+
},
|
|
101
|
+
}),
|
|
102
|
+
});
|
|
103
|
+
exports.CreateMessageOutputSchema = exports.MessageEntitySchema;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { BaseChatEntitySchema, ChatEntitySchema, CreateChatInputSchema, CreateChatOutputSchema } from "../schemas/chat";
|
|
3
|
+
export type BaseChatEntity = z.infer<typeof BaseChatEntitySchema>;
|
|
4
|
+
export type ChatEntity = z.infer<typeof ChatEntitySchema>;
|
|
5
|
+
export type CreateChatInput = z.infer<typeof CreateChatInputSchema>;
|
|
6
|
+
export type CreateChatOutput = z.infer<typeof CreateChatOutputSchema>;
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -27,4 +27,6 @@ __exportStar(require("./username"), exports);
|
|
|
27
27
|
__exportStar(require("./entity-stats"), exports);
|
|
28
28
|
__exportStar(require("./post"), exports);
|
|
29
29
|
__exportStar(require("./job-application"), exports);
|
|
30
|
+
__exportStar(require("./message"), exports);
|
|
31
|
+
__exportStar(require("./chat"), exports);
|
|
30
32
|
__exportStar(require("./job"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { CreateMessageInputSchema, CreateMessageOutputSchema, MessageEntitySchema, MessageFileEntitySchema, MessageWithFilesEntitySchema } from "../schemas/message";
|
|
3
|
+
export type MessageEntity = z.infer<typeof MessageEntitySchema>;
|
|
4
|
+
export type MessageFileEntity = z.infer<typeof MessageFileEntitySchema>;
|
|
5
|
+
export type MessageWithFilesEntity = z.infer<typeof MessageWithFilesEntitySchema>;
|
|
6
|
+
export type CreateMessageInput = z.infer<typeof CreateMessageInputSchema>;
|
|
7
|
+
export type CreateMessageOutput = z.infer<typeof CreateMessageOutputSchema>;
|
package/package.json
CHANGED
package/src/constants.ts
CHANGED
|
@@ -164,6 +164,16 @@ export const JOB_LOCATIONS = {
|
|
|
164
164
|
OTHER: "Other",
|
|
165
165
|
} as const;
|
|
166
166
|
|
|
167
|
+
export const MESSAGE_TYPES = {
|
|
168
|
+
MARKETPLACE: "MARKETPLACE",
|
|
169
|
+
PROJECT: "PROJECT",
|
|
170
|
+
JOB_OPENING: "JOB_OPENING",
|
|
171
|
+
DEFAULT_MESSAGE: "DEFAULT_MESSAGE",
|
|
172
|
+
MESSAGE_WITH_LINKS: "MESSAGE_WITH_LINKS",
|
|
173
|
+
MESSAGE_WITH_MEDIA: "MESSAGE_WITH_MEDIA",
|
|
174
|
+
MESSAGE_WITH_MEDIA_AND_LINKS: "MESSAGE_WITH_MEDIA_AND_LINKS",
|
|
175
|
+
} as const;
|
|
176
|
+
|
|
167
177
|
export type JobLocation = (typeof JOB_LOCATIONS)[keyof typeof JOB_LOCATIONS];
|
|
168
178
|
|
|
169
179
|
export const GIG_TYPE = {
|
|
@@ -226,6 +236,7 @@ export type JobAvailabilityTypes =
|
|
|
226
236
|
(typeof JOB_AVAILABILITY_TYPES)[keyof typeof JOB_AVAILABILITY_TYPES];
|
|
227
237
|
export type WageTypes = (typeof WAGE_TYPES)[keyof typeof WAGE_TYPES];
|
|
228
238
|
export type PostType = (typeof POST_TYPES)[keyof typeof POST_TYPES];
|
|
239
|
+
export type MessageType = (typeof MESSAGE_TYPES)[keyof typeof MESSAGE_TYPES];
|
|
229
240
|
export type ActivityParentType =
|
|
230
241
|
(typeof ACTIVITY_PARENT_TYPES)[keyof typeof ACTIVITY_PARENT_TYPES];
|
|
231
242
|
export type UserStatus = (typeof USER_STATUSES)[keyof typeof USER_STATUSES];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
|
|
3
|
+
export const BaseChatEntitySchema = z.object({
|
|
4
|
+
id: z.cuid2(),
|
|
5
|
+
senderId: z.cuid2(),
|
|
6
|
+
receiverId: z.cuid2(),
|
|
7
|
+
createdAt: z.coerce.date(),
|
|
8
|
+
updatedAt: z.coerce.date(),
|
|
9
|
+
deletedAt: z.coerce.date(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const ChatEntitySchema = BaseChatEntitySchema.extend({
|
|
13
|
+
receiverImgUrl: z.string().optional(),
|
|
14
|
+
receiverName: z.string(),
|
|
15
|
+
lastMessageSent: z.string(),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const CreateChatInputSchema = z.object({
|
|
19
|
+
senderId: z.cuid2(),
|
|
20
|
+
receiverId: z.cuid2(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const CreateChatOutputSchema = BaseChatEntitySchema;
|
package/src/schemas/index.ts
CHANGED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import { ACTIVITY_PARENT_TYPES, MESSAGE_TYPES } from "../constants";
|
|
3
|
+
import { CreateFileInputSchema } from "./file";
|
|
4
|
+
|
|
5
|
+
export const MessageEntitySchema = z.object({
|
|
6
|
+
id: z.cuid2(),
|
|
7
|
+
parentId: z.cuid2().optional(),
|
|
8
|
+
parentType: z.enum(ACTIVITY_PARENT_TYPES).optional(),
|
|
9
|
+
replyToMessageId: z.cuid2().optional(),
|
|
10
|
+
chatId: z.cuid2(),
|
|
11
|
+
senderId: z.cuid2(),
|
|
12
|
+
linkMeta: z
|
|
13
|
+
.object({
|
|
14
|
+
url: z.url(),
|
|
15
|
+
title: z.string().optional(),
|
|
16
|
+
description: z.string().optional(),
|
|
17
|
+
image: z.url().optional(),
|
|
18
|
+
})
|
|
19
|
+
.optional()
|
|
20
|
+
.openapi({
|
|
21
|
+
description: "Optional metadata for a single link in the message",
|
|
22
|
+
example: {
|
|
23
|
+
url: "https://example.com",
|
|
24
|
+
title: "Example Website",
|
|
25
|
+
description: "This is an example link",
|
|
26
|
+
image: "https://example.com/preview.jpg",
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
content: z.string().optional(),
|
|
30
|
+
messageType: z.enum(MESSAGE_TYPES).default(MESSAGE_TYPES.DEFAULT_MESSAGE),
|
|
31
|
+
createdAt: z.coerce.date().optional(),
|
|
32
|
+
deletedAt: z.coerce.date().optional(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const MessageFileEntitySchema = z
|
|
36
|
+
.object({
|
|
37
|
+
id: z
|
|
38
|
+
.string()
|
|
39
|
+
.openapi({ description: "CUID2 of the project file record." }),
|
|
40
|
+
messageId: z.string().openapi({
|
|
41
|
+
description: "CUID2 of the message this file belongs to.",
|
|
42
|
+
}),
|
|
43
|
+
fileId: z.string().openapi({ description: "CUID2 of the linked file." }),
|
|
44
|
+
order: z.number().int().openapi({
|
|
45
|
+
description: "Order index of the file in the project.",
|
|
46
|
+
example: 1,
|
|
47
|
+
}),
|
|
48
|
+
})
|
|
49
|
+
.openapi({
|
|
50
|
+
title: "Message File Entity",
|
|
51
|
+
description: "Schema representing a file associated with a project.",
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const MessageWithFilesEntitySchema = MessageEntitySchema.extend({
|
|
55
|
+
messageFiles: z
|
|
56
|
+
.array(
|
|
57
|
+
MessageFileEntitySchema.extend({
|
|
58
|
+
url: z.url(),
|
|
59
|
+
})
|
|
60
|
+
)
|
|
61
|
+
.optional()
|
|
62
|
+
.openapi({ description: "Files associated with the project." }),
|
|
63
|
+
}).openapi({ title: "ProjectWithFilesEntity" });
|
|
64
|
+
|
|
65
|
+
export const CreateMessageInputSchema = z.object({
|
|
66
|
+
parentId: z
|
|
67
|
+
.cuid2()
|
|
68
|
+
.optional()
|
|
69
|
+
.openapi({ description: "Parent id", example: "ckl1a2b3c0000abc" }),
|
|
70
|
+
content: z
|
|
71
|
+
.string()
|
|
72
|
+
.openapi({
|
|
73
|
+
description: "Message content",
|
|
74
|
+
example: "New project announcement",
|
|
75
|
+
})
|
|
76
|
+
.optional(),
|
|
77
|
+
messageType: z
|
|
78
|
+
.enum(MESSAGE_TYPES)
|
|
79
|
+
.default("DEFAULT_MESSAGE")
|
|
80
|
+
.openapi({ description: "Message type", example: "PROJECT" }),
|
|
81
|
+
files: z
|
|
82
|
+
.array(
|
|
83
|
+
CreateFileInputSchema.extend({
|
|
84
|
+
order: z.int().default(1),
|
|
85
|
+
})
|
|
86
|
+
)
|
|
87
|
+
.optional(),
|
|
88
|
+
chatId: z.string(),
|
|
89
|
+
senderId: z.string(),
|
|
90
|
+
linkMeta: z
|
|
91
|
+
.object({
|
|
92
|
+
url: z.url(),
|
|
93
|
+
title: z.string().optional(),
|
|
94
|
+
description: z.string().optional(),
|
|
95
|
+
image: z.url().optional(),
|
|
96
|
+
})
|
|
97
|
+
.optional()
|
|
98
|
+
.openapi({
|
|
99
|
+
description: "Optional metadata for a single link in the message",
|
|
100
|
+
example: {
|
|
101
|
+
url: "https://example.com",
|
|
102
|
+
title: "Example Website",
|
|
103
|
+
description: "This is an example link",
|
|
104
|
+
image: "https://example.com/preview.jpg",
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
export const CreateMessageOutputSchema = MessageEntitySchema;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import {
|
|
3
|
+
BaseChatEntitySchema,
|
|
4
|
+
ChatEntitySchema,
|
|
5
|
+
CreateChatInputSchema,
|
|
6
|
+
CreateChatOutputSchema,
|
|
7
|
+
} from "../schemas/chat";
|
|
8
|
+
|
|
9
|
+
export type BaseChatEntity = z.infer<typeof BaseChatEntitySchema>;
|
|
10
|
+
|
|
11
|
+
export type ChatEntity = z.infer<typeof ChatEntitySchema>;
|
|
12
|
+
|
|
13
|
+
export type CreateChatInput = z.infer<typeof CreateChatInputSchema>;
|
|
14
|
+
|
|
15
|
+
export type CreateChatOutput = z.infer<typeof CreateChatOutputSchema>;
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import {
|
|
3
|
+
CreateMessageInputSchema,
|
|
4
|
+
CreateMessageOutputSchema,
|
|
5
|
+
MessageEntitySchema,
|
|
6
|
+
MessageFileEntitySchema,
|
|
7
|
+
MessageWithFilesEntitySchema,
|
|
8
|
+
} from "../schemas/message";
|
|
9
|
+
|
|
10
|
+
export type MessageEntity = z.infer<typeof MessageEntitySchema>;
|
|
11
|
+
|
|
12
|
+
export type MessageFileEntity = z.infer<typeof MessageFileEntitySchema>;
|
|
13
|
+
|
|
14
|
+
export type MessageWithFilesEntity = z.infer<
|
|
15
|
+
typeof MessageWithFilesEntitySchema
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export type CreateMessageInput = z.infer<typeof CreateMessageInputSchema>;
|
|
19
|
+
|
|
20
|
+
export type CreateMessageOutput = z.infer<typeof CreateMessageOutputSchema>;
|