@timardex/cluemart-shared 1.2.32 → 1.2.33
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/{ad-Cv1V8lgJ.d.ts → ad-BZylIpez.d.ts} +1 -1
- package/dist/{ad-IVwm5MLY.d.mts → ad-CiYcsJB7.d.mts} +1 -1
- package/dist/{auth-BCxQp_CF.d.ts → auth-CmaB99NK.d.ts} +1 -1
- package/dist/{auth-BczaOu28.d.mts → auth-DDtMJHZw.d.mts} +1 -1
- package/dist/formFields/index.d.mts +1 -1
- package/dist/formFields/index.d.ts +1 -1
- package/dist/{global-Bnr6l_NH.d.ts → global-DVYSZ6LR.d.ts} +4 -4
- package/dist/{global-_89-F0iL.d.mts → global-ExJZRDGR.d.mts} +4 -4
- package/dist/graphql/index.d.mts +2 -2
- package/dist/graphql/index.d.ts +2 -2
- package/dist/hooks/index.d.mts +3 -3
- package/dist/hooks/index.d.ts +3 -3
- package/dist/index.cjs +12 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +6 -13
- package/dist/index.d.ts +6 -13
- package/dist/index.mjs +10 -38
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.d.mts +3 -3
- package/dist/mongoose/index.d.ts +3 -3
- package/dist/mongoose/index.mjs +4 -4
- package/dist/service/index.cjs +17 -49
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +4 -11
- package/dist/service/index.d.ts +4 -11
- package/dist/service/index.mjs +10 -40
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnumOSPlatform, EnumResourceType, EnumUserLicence, EnumUserRole } from './enums/index.js';
|
|
2
|
-
import { C as Category,
|
|
2
|
+
import { C as Category, a1 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-DVYSZ6LR.js';
|
|
3
3
|
|
|
4
4
|
interface TestersFormData {
|
|
5
5
|
categories?: Category[] | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EnumOSPlatform, EnumResourceType, EnumUserLicence, EnumUserRole } from './enums/index.mjs';
|
|
2
|
-
import { C as Category,
|
|
2
|
+
import { C as Category, a1 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-ExJZRDGR.mjs';
|
|
3
3
|
|
|
4
4
|
interface TestersFormData {
|
|
5
5
|
categories?: Category[] | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-
|
|
1
|
+
import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-ExJZRDGR.mjs';
|
|
2
2
|
import 'express';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'react-hook-form';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-
|
|
1
|
+
import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-DVYSZ6LR.js';
|
|
2
2
|
import 'express';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'react-hook-form';
|
|
@@ -235,11 +235,11 @@ type NotificationCount = {
|
|
|
235
235
|
unread: number;
|
|
236
236
|
};
|
|
237
237
|
type CreateBulkNotificationInput = {
|
|
238
|
-
|
|
239
|
-
title: string;
|
|
238
|
+
data: NotificationDataType | null;
|
|
240
239
|
message: string;
|
|
240
|
+
title: string;
|
|
241
241
|
type: EnumNotificationType;
|
|
242
|
-
|
|
242
|
+
userIds: string[];
|
|
243
243
|
};
|
|
244
244
|
|
|
245
245
|
type SchemaChatMessageType = Omit<ChatMessageType, "senderId"> & {
|
|
@@ -475,4 +475,4 @@ interface GraphQLContext {
|
|
|
475
475
|
response: Response;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
export { type
|
|
478
|
+
export { type Subcategory as $, ChatModel as A, type BaseResourceTypeFormData as B, type Category as C, type DeviceInfo as D, type EventType as E, type FormField as F, type SchemaCreateBulkNotificationInput as G, type SchemaNotificationType as H, NotificationModel as I, type ParticipantType as J, type ChatMessageInput as K, type LocationType as L, type ChatMessageType as M, type NotificationType as N, type OptionItem as O, type PartnerType as P, type Nullable as Q, type Requirement as R, type StallType as S, type TermsAgreement as T, type BaseResourceType as U, type VendorType as V, type DateTimeType as W, type Region as X, type GeocodeLocation as Y, type MapMultiLocation as Z, type SubcategoryItems as _, type FormDateField as a, type ImageObjectType as a0, type CreateFormData as a1, EnumPubSubEvents as a2, type AuthUser as a3, type SubscriptionPayload as a4, type GraphQLContext as a5, type DateTimeWithPriceType as a6, type PaymentInfoType as a7, type NotificationDataType as a8, type CreateBulkNotificationInput as a9, type VendorLocation as aa, type VendorMenuType as ab, type VendorAttributes as ac, type ChatType as b, type EventInfoType as c, type NotificationCount as d, type RelationType as e, type ResourceConnectionsType as f, type VendorInfoType as g, type VendorFormData as h, type CreateVendorFormData as i, type VendorInfoFormData as j, type CreateVendorInfoFormData as k, type EventFormData as l, type CreateEventFormData as m, type EventInfoFormData as n, type CreateEventInfoFormData as o, type OwnerType as p, type ObjectId as q, type SocialMediaType as r, type ResourceImageType as s, type ResourceContactDetailsType as t, type PosterUsageType as u, type RelationDate as v, type SchemaChatMessageType as w, type SchemaParticipantType as x, type SchemaChatType as y, ParticipantSchema as z };
|
|
@@ -235,11 +235,11 @@ type NotificationCount = {
|
|
|
235
235
|
unread: number;
|
|
236
236
|
};
|
|
237
237
|
type CreateBulkNotificationInput = {
|
|
238
|
-
|
|
239
|
-
title: string;
|
|
238
|
+
data: NotificationDataType | null;
|
|
240
239
|
message: string;
|
|
240
|
+
title: string;
|
|
241
241
|
type: EnumNotificationType;
|
|
242
|
-
|
|
242
|
+
userIds: string[];
|
|
243
243
|
};
|
|
244
244
|
|
|
245
245
|
type SchemaChatMessageType = Omit<ChatMessageType, "senderId"> & {
|
|
@@ -475,4 +475,4 @@ interface GraphQLContext {
|
|
|
475
475
|
response: Response;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
export { type
|
|
478
|
+
export { type Subcategory as $, ChatModel as A, type BaseResourceTypeFormData as B, type Category as C, type DeviceInfo as D, type EventType as E, type FormField as F, type SchemaCreateBulkNotificationInput as G, type SchemaNotificationType as H, NotificationModel as I, type ParticipantType as J, type ChatMessageInput as K, type LocationType as L, type ChatMessageType as M, type NotificationType as N, type OptionItem as O, type PartnerType as P, type Nullable as Q, type Requirement as R, type StallType as S, type TermsAgreement as T, type BaseResourceType as U, type VendorType as V, type DateTimeType as W, type Region as X, type GeocodeLocation as Y, type MapMultiLocation as Z, type SubcategoryItems as _, type FormDateField as a, type ImageObjectType as a0, type CreateFormData as a1, EnumPubSubEvents as a2, type AuthUser as a3, type SubscriptionPayload as a4, type GraphQLContext as a5, type DateTimeWithPriceType as a6, type PaymentInfoType as a7, type NotificationDataType as a8, type CreateBulkNotificationInput as a9, type VendorLocation as aa, type VendorMenuType as ab, type VendorAttributes as ac, type ChatType as b, type EventInfoType as c, type NotificationCount as d, type RelationType as e, type ResourceConnectionsType as f, type VendorInfoType as g, type VendorFormData as h, type CreateVendorFormData as i, type VendorInfoFormData as j, type CreateVendorInfoFormData as k, type EventFormData as l, type CreateEventFormData as m, type EventInfoFormData as n, type CreateEventInfoFormData as o, type OwnerType as p, type ObjectId as q, type SocialMediaType as r, type ResourceImageType as s, type ResourceContactDetailsType as t, type PosterUsageType as u, type RelationDate as v, type SchemaChatMessageType as w, type SchemaParticipantType as x, type SchemaChatType as y, ParticipantSchema as z };
|
package/dist/graphql/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _apollo_client from '@apollo/client';
|
|
2
|
-
import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-
|
|
2
|
+
import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-ExJZRDGR.mjs';
|
|
3
3
|
import { EnumResourceType } from '../enums/index.mjs';
|
|
4
|
-
import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-
|
|
4
|
+
import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-CiYcsJB7.mjs';
|
|
5
5
|
import { R as ResourceActivityType } from '../resourceActivities-BIjtlOGp.mjs';
|
|
6
6
|
import 'express';
|
|
7
7
|
import 'mongoose';
|
package/dist/graphql/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _apollo_client from '@apollo/client';
|
|
2
|
-
import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-
|
|
2
|
+
import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-DVYSZ6LR.js';
|
|
3
3
|
import { EnumResourceType } from '../enums/index.js';
|
|
4
|
-
import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-
|
|
4
|
+
import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-BZylIpez.js';
|
|
5
5
|
import { R as ResourceActivityType } from '../resourceActivities-B4roVKtQ.js';
|
|
6
6
|
import 'express';
|
|
7
7
|
import 'mongoose';
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-
|
|
2
|
-
import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-
|
|
3
|
-
import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-
|
|
1
|
+
import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-ExJZRDGR.mjs';
|
|
2
|
+
import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-CiYcsJB7.mjs';
|
|
3
|
+
import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-DDtMJHZw.mjs';
|
|
4
4
|
import 'express';
|
|
5
5
|
import 'mongoose';
|
|
6
6
|
import 'react-hook-form';
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-
|
|
2
|
-
import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-
|
|
3
|
-
import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-
|
|
1
|
+
import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-DVYSZ6LR.js';
|
|
2
|
+
import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-BZylIpez.js';
|
|
3
|
+
import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-CmaB99NK.js';
|
|
4
4
|
import 'express';
|
|
5
5
|
import 'mongoose';
|
|
6
6
|
import 'react-hook-form';
|
package/dist/index.cjs
CHANGED
|
@@ -87,7 +87,6 @@ __export(index_exports, {
|
|
|
87
87
|
companyContactFields: () => companyContactFields,
|
|
88
88
|
connectToDatabase: () => connectToDatabase,
|
|
89
89
|
contactUsFields: () => contactUsFields,
|
|
90
|
-
createNotifications: () => createNotifications,
|
|
91
90
|
darkColors: () => darkColors,
|
|
92
91
|
dateFormat: () => dateFormat,
|
|
93
92
|
defaultEventFormValues: () => defaultEventFormValues,
|
|
@@ -120,14 +119,14 @@ __export(index_exports, {
|
|
|
120
119
|
producedIngOptions: () => producedIngOptions,
|
|
121
120
|
productLabelGroups: () => productLabelGroups,
|
|
122
121
|
profileFields: () => profileFields,
|
|
123
|
-
publishNotificationEvents: () => publishNotificationEvents,
|
|
124
122
|
registerFields: () => registerFields,
|
|
125
123
|
relationDatesSchema: () => relationDatesSchema,
|
|
126
124
|
removeTypename: () => removeTypename,
|
|
127
125
|
requestPasswordResetFields: () => requestPasswordResetFields,
|
|
128
126
|
requirementsOptions: () => requirementsOptions,
|
|
129
127
|
resetPasswordFields: () => resetPasswordFields,
|
|
130
|
-
|
|
128
|
+
saveNotificationsInDb: () => saveNotificationsInDb,
|
|
129
|
+
sendPushNotifications: () => sendPushNotifications,
|
|
131
130
|
socialMediaFields: () => socialMediaFields,
|
|
132
131
|
sortDatesChronologically: () => sortDatesChronologically,
|
|
133
132
|
stallTypeOptions: () => stallTypeOptions,
|
|
@@ -7123,32 +7122,8 @@ var connectToDatabase = async ({
|
|
|
7123
7122
|
}
|
|
7124
7123
|
};
|
|
7125
7124
|
|
|
7126
|
-
// src/service/
|
|
7127
|
-
async function
|
|
7128
|
-
try {
|
|
7129
|
-
const userNotifications = await NotificationModel.find({
|
|
7130
|
-
userId
|
|
7131
|
-
}).sort({ createdAt: -1 });
|
|
7132
|
-
const [total, unread] = await Promise.all([
|
|
7133
|
-
NotificationModel.countDocuments({ userId }),
|
|
7134
|
-
NotificationModel.countDocuments({ isRead: false, userId })
|
|
7135
|
-
]);
|
|
7136
|
-
context.pubsub.publish("GET_NOTIFICATIONS" /* GET_NOTIFICATIONS */, {
|
|
7137
|
-
getNotifications: userNotifications,
|
|
7138
|
-
getNotificationsUserId: userId
|
|
7139
|
-
});
|
|
7140
|
-
context.pubsub.publish("GET_NOTIFICATIONS_COUNT" /* GET_NOTIFICATIONS_COUNT */, {
|
|
7141
|
-
getNotificationsCount: { total, unread, userId }
|
|
7142
|
-
});
|
|
7143
|
-
console.log(`Published notification events for user: ${String(userId)}`);
|
|
7144
|
-
} catch (error) {
|
|
7145
|
-
console.error(
|
|
7146
|
-
`Failed to publish notification events for user ${String(userId)}:`,
|
|
7147
|
-
error
|
|
7148
|
-
);
|
|
7149
|
-
}
|
|
7150
|
-
}
|
|
7151
|
-
async function createNotifications(payload, context) {
|
|
7125
|
+
// src/service/saveNotificationsInDb.ts
|
|
7126
|
+
async function saveNotificationsInDb(payload) {
|
|
7152
7127
|
const { data, message, title, type, userIds } = payload;
|
|
7153
7128
|
try {
|
|
7154
7129
|
const notifications = userIds.map((userId) => ({
|
|
@@ -7159,22 +7134,18 @@ async function createNotifications(payload, context) {
|
|
|
7159
7134
|
type,
|
|
7160
7135
|
userId
|
|
7161
7136
|
}));
|
|
7162
|
-
|
|
7137
|
+
await NotificationModel.insertMany(notifications);
|
|
7163
7138
|
console.log(
|
|
7164
|
-
`Created ${
|
|
7139
|
+
`Created ${notifications.length} notifications for ${userIds.length} users`
|
|
7165
7140
|
);
|
|
7166
|
-
|
|
7167
|
-
for (const userId of uniqueUserIds) {
|
|
7168
|
-
await publishNotificationEvents(userId, context);
|
|
7169
|
-
}
|
|
7170
|
-
return savedNotifications;
|
|
7141
|
+
return [...new Set(userIds)];
|
|
7171
7142
|
} catch (error) {
|
|
7172
7143
|
console.error("Failed to create notifications:", error);
|
|
7173
7144
|
return [];
|
|
7174
7145
|
}
|
|
7175
7146
|
}
|
|
7176
7147
|
|
|
7177
|
-
// src/service/
|
|
7148
|
+
// src/service/sendPushNotifications.ts
|
|
7178
7149
|
var import_expo_server_sdk = require("expo-server-sdk");
|
|
7179
7150
|
var expo = new import_expo_server_sdk.Expo();
|
|
7180
7151
|
function extractTokensFromMessage(message) {
|
|
@@ -7242,7 +7213,7 @@ async function sendChunk(chunk, chunkIndex) {
|
|
|
7242
7213
|
return { failedTokens: [], successCount: 0 };
|
|
7243
7214
|
}
|
|
7244
7215
|
}
|
|
7245
|
-
async function
|
|
7216
|
+
async function sendPushNotifications({
|
|
7246
7217
|
data,
|
|
7247
7218
|
message,
|
|
7248
7219
|
title,
|
|
@@ -7250,6 +7221,7 @@ async function sendPushNotification({
|
|
|
7250
7221
|
}) {
|
|
7251
7222
|
const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
|
|
7252
7223
|
const expoTokens = pushTokens.map((token) => token.token);
|
|
7224
|
+
if (!data) return;
|
|
7253
7225
|
const { messages, invalidTokens } = createPushMessages({
|
|
7254
7226
|
data,
|
|
7255
7227
|
message,
|
|
@@ -7385,7 +7357,6 @@ var fonts = {
|
|
|
7385
7357
|
companyContactFields,
|
|
7386
7358
|
connectToDatabase,
|
|
7387
7359
|
contactUsFields,
|
|
7388
|
-
createNotifications,
|
|
7389
7360
|
darkColors,
|
|
7390
7361
|
dateFormat,
|
|
7391
7362
|
defaultEventFormValues,
|
|
@@ -7418,14 +7389,14 @@ var fonts = {
|
|
|
7418
7389
|
producedIngOptions,
|
|
7419
7390
|
productLabelGroups,
|
|
7420
7391
|
profileFields,
|
|
7421
|
-
publishNotificationEvents,
|
|
7422
7392
|
registerFields,
|
|
7423
7393
|
relationDatesSchema,
|
|
7424
7394
|
removeTypename,
|
|
7425
7395
|
requestPasswordResetFields,
|
|
7426
7396
|
requirementsOptions,
|
|
7427
7397
|
resetPasswordFields,
|
|
7428
|
-
|
|
7398
|
+
saveNotificationsInDb,
|
|
7399
|
+
sendPushNotifications,
|
|
7429
7400
|
socialMediaFields,
|
|
7430
7401
|
sortDatesChronologically,
|
|
7431
7402
|
stallTypeOptions,
|