@timardex/cluemart-server-shared 1.0.2 → 1.0.4
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/Chat-CR7oHSji.d.mts +89 -0
- package/dist/Chat-CR7oHSji.d.ts +89 -0
- package/dist/chunk-OKDYM6JS.mjs +938 -0
- package/dist/chunk-OKDYM6JS.mjs.map +1 -0
- package/dist/index.cjs +42 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.mjs +38 -2
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +959 -0
- package/dist/mongoose/index.cjs.map +1 -0
- package/dist/mongoose/index.d.mts +415 -0
- package/dist/mongoose/index.d.ts +415 -0
- package/dist/mongoose/index.mjs +51 -0
- package/dist/mongoose/index.mjs.map +1 -0
- package/dist/service/index.cjs +1139 -0
- package/dist/service/index.cjs.map +1 -0
- package/dist/service/index.d.mts +32 -0
- package/dist/service/index.d.ts +32 -0
- package/dist/service/index.mjs +226 -0
- package/dist/service/index.mjs.map +1 -0
- package/dist/types/index.cjs +53 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.d.mts +5 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.mjs +16 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +5 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CreateBulkNotificationInput, NotificationType, ChatMessageType, ParticipantType, ChatType } from '@timardex/cluemart-shared';
|
|
2
|
+
import mongoose from 'mongoose';
|
|
3
|
+
import { NotificationCount } from '@timardex/cluemart-shared/types';
|
|
4
|
+
import express from 'express';
|
|
5
|
+
|
|
6
|
+
type SchemaCreateBulkNotificationInput = Omit<CreateBulkNotificationInput, "userIds"> & {
|
|
7
|
+
userIds: ObjectId[];
|
|
8
|
+
};
|
|
9
|
+
type SchemaNotificationType = Omit<NotificationType, "userId"> & {
|
|
10
|
+
userId: ObjectId;
|
|
11
|
+
};
|
|
12
|
+
declare const NotificationModel: mongoose.Model<SchemaNotificationType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaNotificationType, {}, {}> & Omit<NotificationType, "userId"> & {
|
|
13
|
+
userId: ObjectId;
|
|
14
|
+
} & Required<{
|
|
15
|
+
_id: string;
|
|
16
|
+
}> & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}, any>;
|
|
19
|
+
|
|
20
|
+
type ObjectId = mongoose.Schema.Types.ObjectId;
|
|
21
|
+
declare enum EnumPubSubEvents {
|
|
22
|
+
GET_CHAT_MESSAGE = "GET_CHAT_MESSAGE",
|
|
23
|
+
GET_NOTIFICATIONS = "GET_NOTIFICATIONS",
|
|
24
|
+
GET_NOTIFICATIONS_COUNT = "GET_NOTIFICATIONS_COUNT",
|
|
25
|
+
USER_TYPING = "USER_TYPING"
|
|
26
|
+
}
|
|
27
|
+
interface AuthUser {
|
|
28
|
+
email: string;
|
|
29
|
+
role: string;
|
|
30
|
+
userId: ObjectId;
|
|
31
|
+
}
|
|
32
|
+
interface SubscriptionPayload {
|
|
33
|
+
getChatMessage?: SchemaChatType;
|
|
34
|
+
userTyping?: SchemaChatType;
|
|
35
|
+
getNotifications?: SchemaNotificationType[];
|
|
36
|
+
getNotificationsUserId?: ObjectId;
|
|
37
|
+
getNotificationsCount?: NotificationCount & {
|
|
38
|
+
userId: ObjectId;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface GraphQLContext {
|
|
42
|
+
user: AuthUser | null;
|
|
43
|
+
pubsub: {
|
|
44
|
+
publish: (eventName: EnumPubSubEvents, payload: SubscriptionPayload) => void;
|
|
45
|
+
subscribe: (eventName: EnumPubSubEvents) => AsyncIterable<any>;
|
|
46
|
+
};
|
|
47
|
+
request: express.Request;
|
|
48
|
+
response: express.Response;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type SchemaChatMessageType = Omit<ChatMessageType, "senderId"> & {
|
|
52
|
+
senderId: ObjectId;
|
|
53
|
+
};
|
|
54
|
+
type SchemaParticipantType = Omit<ParticipantType, "userId"> & {
|
|
55
|
+
userId: ObjectId;
|
|
56
|
+
};
|
|
57
|
+
type SchemaChatType = Omit<ChatType, "participants" | "messages" | "resourceInfo"> & {
|
|
58
|
+
participants: SchemaParticipantType[];
|
|
59
|
+
messages: SchemaChatMessageType[];
|
|
60
|
+
resourceInfo: {
|
|
61
|
+
eventId: ObjectId;
|
|
62
|
+
vendorId: ObjectId;
|
|
63
|
+
} | null;
|
|
64
|
+
};
|
|
65
|
+
declare const ParticipantSchema: mongoose.Schema<SchemaParticipantType, mongoose.Model<SchemaParticipantType, any, any, any, mongoose.Document<unknown, any, SchemaParticipantType, any, {}> & Omit<ParticipantType, "userId"> & {
|
|
66
|
+
userId: ObjectId;
|
|
67
|
+
} & {
|
|
68
|
+
_id: mongoose.Types.ObjectId;
|
|
69
|
+
} & {
|
|
70
|
+
__v: number;
|
|
71
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SchemaParticipantType, mongoose.Document<unknown, {}, mongoose.FlatRecord<SchemaParticipantType>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<SchemaParticipantType> & {
|
|
72
|
+
_id: mongoose.Types.ObjectId;
|
|
73
|
+
} & {
|
|
74
|
+
__v: number;
|
|
75
|
+
}>;
|
|
76
|
+
declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaChatType, {}, {}> & Omit<ChatType, "participants" | "messages" | "resourceInfo"> & {
|
|
77
|
+
participants: SchemaParticipantType[];
|
|
78
|
+
messages: SchemaChatMessageType[];
|
|
79
|
+
resourceInfo: {
|
|
80
|
+
eventId: ObjectId;
|
|
81
|
+
vendorId: ObjectId;
|
|
82
|
+
} | null;
|
|
83
|
+
} & Required<{
|
|
84
|
+
_id: string;
|
|
85
|
+
}> & {
|
|
86
|
+
__v: number;
|
|
87
|
+
}, any>;
|
|
88
|
+
|
|
89
|
+
export { type AuthUser as A, ChatModel as C, EnumPubSubEvents as E, type GraphQLContext as G, NotificationModel as N, type ObjectId as O, ParticipantSchema as P, type SchemaChatMessageType as S, type SchemaParticipantType as a, type SchemaChatType as b, type SchemaCreateBulkNotificationInput as c, type SchemaNotificationType as d, type SubscriptionPayload as e };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { CreateBulkNotificationInput, NotificationType, ChatMessageType, ParticipantType, ChatType } from '@timardex/cluemart-shared';
|
|
2
|
+
import mongoose from 'mongoose';
|
|
3
|
+
import { NotificationCount } from '@timardex/cluemart-shared/types';
|
|
4
|
+
import express from 'express';
|
|
5
|
+
|
|
6
|
+
type SchemaCreateBulkNotificationInput = Omit<CreateBulkNotificationInput, "userIds"> & {
|
|
7
|
+
userIds: ObjectId[];
|
|
8
|
+
};
|
|
9
|
+
type SchemaNotificationType = Omit<NotificationType, "userId"> & {
|
|
10
|
+
userId: ObjectId;
|
|
11
|
+
};
|
|
12
|
+
declare const NotificationModel: mongoose.Model<SchemaNotificationType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaNotificationType, {}, {}> & Omit<NotificationType, "userId"> & {
|
|
13
|
+
userId: ObjectId;
|
|
14
|
+
} & Required<{
|
|
15
|
+
_id: string;
|
|
16
|
+
}> & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}, any>;
|
|
19
|
+
|
|
20
|
+
type ObjectId = mongoose.Schema.Types.ObjectId;
|
|
21
|
+
declare enum EnumPubSubEvents {
|
|
22
|
+
GET_CHAT_MESSAGE = "GET_CHAT_MESSAGE",
|
|
23
|
+
GET_NOTIFICATIONS = "GET_NOTIFICATIONS",
|
|
24
|
+
GET_NOTIFICATIONS_COUNT = "GET_NOTIFICATIONS_COUNT",
|
|
25
|
+
USER_TYPING = "USER_TYPING"
|
|
26
|
+
}
|
|
27
|
+
interface AuthUser {
|
|
28
|
+
email: string;
|
|
29
|
+
role: string;
|
|
30
|
+
userId: ObjectId;
|
|
31
|
+
}
|
|
32
|
+
interface SubscriptionPayload {
|
|
33
|
+
getChatMessage?: SchemaChatType;
|
|
34
|
+
userTyping?: SchemaChatType;
|
|
35
|
+
getNotifications?: SchemaNotificationType[];
|
|
36
|
+
getNotificationsUserId?: ObjectId;
|
|
37
|
+
getNotificationsCount?: NotificationCount & {
|
|
38
|
+
userId: ObjectId;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface GraphQLContext {
|
|
42
|
+
user: AuthUser | null;
|
|
43
|
+
pubsub: {
|
|
44
|
+
publish: (eventName: EnumPubSubEvents, payload: SubscriptionPayload) => void;
|
|
45
|
+
subscribe: (eventName: EnumPubSubEvents) => AsyncIterable<any>;
|
|
46
|
+
};
|
|
47
|
+
request: express.Request;
|
|
48
|
+
response: express.Response;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
type SchemaChatMessageType = Omit<ChatMessageType, "senderId"> & {
|
|
52
|
+
senderId: ObjectId;
|
|
53
|
+
};
|
|
54
|
+
type SchemaParticipantType = Omit<ParticipantType, "userId"> & {
|
|
55
|
+
userId: ObjectId;
|
|
56
|
+
};
|
|
57
|
+
type SchemaChatType = Omit<ChatType, "participants" | "messages" | "resourceInfo"> & {
|
|
58
|
+
participants: SchemaParticipantType[];
|
|
59
|
+
messages: SchemaChatMessageType[];
|
|
60
|
+
resourceInfo: {
|
|
61
|
+
eventId: ObjectId;
|
|
62
|
+
vendorId: ObjectId;
|
|
63
|
+
} | null;
|
|
64
|
+
};
|
|
65
|
+
declare const ParticipantSchema: mongoose.Schema<SchemaParticipantType, mongoose.Model<SchemaParticipantType, any, any, any, mongoose.Document<unknown, any, SchemaParticipantType, any, {}> & Omit<ParticipantType, "userId"> & {
|
|
66
|
+
userId: ObjectId;
|
|
67
|
+
} & {
|
|
68
|
+
_id: mongoose.Types.ObjectId;
|
|
69
|
+
} & {
|
|
70
|
+
__v: number;
|
|
71
|
+
}, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SchemaParticipantType, mongoose.Document<unknown, {}, mongoose.FlatRecord<SchemaParticipantType>, {}, mongoose.ResolveSchemaOptions<mongoose.DefaultSchemaOptions>> & mongoose.FlatRecord<SchemaParticipantType> & {
|
|
72
|
+
_id: mongoose.Types.ObjectId;
|
|
73
|
+
} & {
|
|
74
|
+
__v: number;
|
|
75
|
+
}>;
|
|
76
|
+
declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaChatType, {}, {}> & Omit<ChatType, "participants" | "messages" | "resourceInfo"> & {
|
|
77
|
+
participants: SchemaParticipantType[];
|
|
78
|
+
messages: SchemaChatMessageType[];
|
|
79
|
+
resourceInfo: {
|
|
80
|
+
eventId: ObjectId;
|
|
81
|
+
vendorId: ObjectId;
|
|
82
|
+
} | null;
|
|
83
|
+
} & Required<{
|
|
84
|
+
_id: string;
|
|
85
|
+
}> & {
|
|
86
|
+
__v: number;
|
|
87
|
+
}, any>;
|
|
88
|
+
|
|
89
|
+
export { type AuthUser as A, ChatModel as C, EnumPubSubEvents as E, type GraphQLContext as G, NotificationModel as N, type ObjectId as O, ParticipantSchema as P, type SchemaChatMessageType as S, type SchemaParticipantType as a, type SchemaChatType as b, type SchemaCreateBulkNotificationInput as c, type SchemaNotificationType as d, type SubscriptionPayload as e };
|