@timardex/cluemart-shared 1.2.31 → 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.
Files changed (38) hide show
  1. package/dist/{ad-Cv1V8lgJ.d.ts → ad-BZylIpez.d.ts} +1 -1
  2. package/dist/{ad-IVwm5MLY.d.mts → ad-CiYcsJB7.d.mts} +1 -1
  3. package/dist/{auth-BCxQp_CF.d.ts → auth-CmaB99NK.d.ts} +1 -1
  4. package/dist/{auth-BczaOu28.d.mts → auth-DDtMJHZw.d.mts} +1 -1
  5. package/dist/{chunk-O6LVIQFK.mjs → chunk-NPHPFWQH.mjs} +3 -6
  6. package/dist/chunk-NPHPFWQH.mjs.map +1 -0
  7. package/dist/formFields/index.d.mts +1 -1
  8. package/dist/formFields/index.d.ts +1 -1
  9. package/dist/{global-Bnr6l_NH.d.ts → global-DVYSZ6LR.d.ts} +4 -4
  10. package/dist/{global-_89-F0iL.d.mts → global-ExJZRDGR.d.mts} +4 -4
  11. package/dist/graphql/index.d.mts +2 -2
  12. package/dist/graphql/index.d.ts +2 -2
  13. package/dist/hooks/index.d.mts +3 -3
  14. package/dist/hooks/index.d.ts +3 -3
  15. package/dist/index.cjs +25 -69
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.mts +8 -23
  18. package/dist/index.d.ts +8 -23
  19. package/dist/index.mjs +23 -66
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/mongoose/index.cjs +13 -28
  22. package/dist/mongoose/index.cjs.map +1 -1
  23. package/dist/mongoose/index.d.mts +5 -13
  24. package/dist/mongoose/index.d.ts +5 -13
  25. package/dist/mongoose/index.mjs +15 -27
  26. package/dist/mongoose/index.mjs.map +1 -1
  27. package/dist/service/index.cjs +18 -53
  28. package/dist/service/index.cjs.map +1 -1
  29. package/dist/service/index.d.mts +4 -11
  30. package/dist/service/index.d.ts +4 -11
  31. package/dist/service/index.mjs +11 -41
  32. package/dist/service/index.mjs.map +1 -1
  33. package/dist/types/index.d.mts +3 -3
  34. package/dist/types/index.d.ts +3 -3
  35. package/dist/utils/index.d.mts +1 -1
  36. package/dist/utils/index.d.ts +1 -1
  37. package/package.json +1 -1
  38. package/dist/chunk-O6LVIQFK.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { EnumOSPlatform, EnumResourceType, EnumUserLicence, EnumUserRole } from './enums/index.js';
2
- import { C as Category, a3 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-Bnr6l_NH.js';
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, a3 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-_89-F0iL.mjs';
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 { a3 as CreateFormData, T as TermsAgreement } from './global-Bnr6l_NH.js';
1
+ import { a1 as CreateFormData, T as TermsAgreement } from './global-DVYSZ6LR.js';
2
2
  import { EnumOSPlatform } from './enums/index.js';
3
3
 
4
4
  type ContactUsFormData = {
@@ -1,4 +1,4 @@
1
- import { a3 as CreateFormData, T as TermsAgreement } from './global-_89-F0iL.mjs';
1
+ import { a1 as CreateFormData, T as TermsAgreement } from './global-ExJZRDGR.mjs';
2
2
  import { EnumOSPlatform } from './enums/index.mjs';
3
3
 
4
4
  type ContactUsFormData = {
@@ -37,10 +37,7 @@ var schema = new MongooseSchema(
37
37
  );
38
38
  schema.index({ isRead: 1, userId: 1 });
39
39
  schema.index({ createdAt: -1, userId: 1 });
40
- var NotificationModel = mongoose.model(
41
- "Notification",
42
- schema
43
- );
40
+ var NotificationModel = mongoose.models.Notification || mongoose.model("Notification", schema);
44
41
 
45
42
  // src/mongoose/PushToken.ts
46
43
  import mongoose2 from "mongoose";
@@ -57,10 +54,10 @@ var schema2 = new MongooseSchema2(
57
54
  },
58
55
  { timestamps: true }
59
56
  );
60
- var PushTokenModel = mongoose2.model("PushToken", schema2);
57
+ var PushTokenModel = mongoose2.models.PushToken || mongoose2.model("PushToken", schema2);
61
58
 
62
59
  export {
63
60
  NotificationModel,
64
61
  PushTokenModel
65
62
  };
66
- //# sourceMappingURL=chunk-O6LVIQFK.mjs.map
63
+ //# sourceMappingURL=chunk-NPHPFWQH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mongoose/Notification.ts","../src/mongoose/PushToken.ts"],"sourcesContent":["import mongoose from \"mongoose\";\n\nimport { EnumNotificationResourceType, EnumNotificationType } from \"src/enums\";\nimport {\n CreateBulkNotificationInput,\n NotificationType,\n ObjectId,\n} from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaCreateBulkNotificationInput = Omit<\n CreateBulkNotificationInput,\n \"userIds\"\n> & {\n userIds: ObjectId[];\n};\n\nexport type SchemaNotificationType = Omit<NotificationType, \"userId\"> & {\n userId: ObjectId;\n};\n/**\n * Schema for storing in-app notifications\n * Each notification is tied to a specific user and can be marked as read/unread\n */\nconst schema = new MongooseSchema<SchemaNotificationType>(\n {\n data: {\n resourceId: { required: true, type: String },\n resourceName: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumNotificationResourceType),\n required: true,\n type: String,\n },\n },\n isRead: { default: false, index: true, required: true, type: Boolean },\n message: { required: true, type: String },\n title: { required: true, type: String },\n type: {\n default: EnumNotificationType.SYSTEM,\n enum: Object.values(EnumNotificationType),\n required: true,\n type: String,\n },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\n// Compound index for efficient queries\nschema.index({ isRead: 1, userId: 1 });\nschema.index({ createdAt: -1, userId: 1 });\n\nexport const NotificationModel =\n (mongoose.models.Notification as mongoose.Model<SchemaNotificationType>) ||\n mongoose.model<SchemaNotificationType>(\"Notification\", schema);\n","import mongoose from \"mongoose\";\n\nimport { EnumOSPlatform } from \"src/enums\";\nimport { ObjectId } from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\ntype PushTokenType = {\n _id: string;\n createdAt: Date;\n platform: EnumOSPlatform;\n token: string;\n updatedAt: Date;\n userId: string;\n};\n\nexport type SchemaPushTokenType = Omit<PushTokenType, \"userId\"> & {\n userId: ObjectId;\n};\n\n/**\n * This is the schema for the push token type.\n * It is used to define the structure of the push token type in the database.\n * The schema is used by Mongoose to create a model for the push token type.\n */\nconst schema = new MongooseSchema<SchemaPushTokenType>(\n {\n platform: {\n enum: Object.values(EnumOSPlatform),\n required: true,\n type: String,\n },\n token: { required: true, type: String },\n userId: { required: true, type: mongoose.Schema.Types.ObjectId },\n },\n { timestamps: true },\n);\n\nexport const PushTokenModel =\n (mongoose.models.PushToken as mongoose.Model<SchemaPushTokenType>) ||\n mongoose.model<SchemaPushTokenType>(\"PushToken\", schema);\n"],"mappings":";;;;;;;AAAA,OAAO,cAAc;AASrB,IAAM,iBAAiB,SAAS;AAgBhC,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,IACE,MAAM;AAAA,MACJ,YAAY,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,MAC3C,cAAc,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,MAC7C,cAAc;AAAA,QACZ,MAAM,OAAO,OAAO,4BAA4B;AAAA,QAChD,UAAU;AAAA,QACV,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,QAAQ,EAAE,SAAS,OAAO,OAAO,MAAM,UAAU,MAAM,MAAM,QAAQ;AAAA,IACrE,SAAS,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,IACxC,OAAO,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,IACtC,MAAM;AAAA,MACJ;AAAA,MACA,MAAM,OAAO,OAAO,oBAAoB;AAAA,MACxC,UAAU;AAAA,MACV,MAAM;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACN,KAAK;AAAA,MACL,UAAU;AAAA,MACV,MAAM,SAAS,OAAO,MAAM;AAAA,IAC9B;AAAA,EACF;AAAA,EACA,EAAE,YAAY,KAAK;AACrB;AAGA,OAAO,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;AACrC,OAAO,MAAM,EAAE,WAAW,IAAI,QAAQ,EAAE,CAAC;AAElC,IAAM,oBACV,SAAS,OAAO,gBACjB,SAAS,MAA8B,gBAAgB,MAAM;;;AC5D/D,OAAOA,eAAc;AAKrB,IAAMC,kBAAiBC,UAAS;AAoBhC,IAAMC,UAAS,IAAIF;AAAA,EACjB;AAAA,IACE,UAAU;AAAA,MACR,MAAM,OAAO,OAAO,cAAc;AAAA,MAClC,UAAU;AAAA,MACV,MAAM;AAAA,IACR;AAAA,IACA,OAAO,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,IACtC,QAAQ,EAAE,UAAU,MAAM,MAAMC,UAAS,OAAO,MAAM,SAAS;AAAA,EACjE;AAAA,EACA,EAAE,YAAY,KAAK;AACrB;AAEO,IAAM,iBACVA,UAAS,OAAO,aACjBA,UAAS,MAA2B,aAAaC,OAAM;","names":["mongoose","MongooseSchema","mongoose","schema"]}
@@ -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-_89-F0iL.mjs';
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-Bnr6l_NH.js';
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
- userIds: string[];
239
- title: string;
238
+ data: NotificationDataType | null;
240
239
  message: string;
240
+ title: string;
241
241
  type: EnumNotificationType;
242
- data: NotificationDataType | null;
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 MapMultiLocation 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 GraphQLContext as J, type NotificationDataType as K, type LocationType as L, type ParticipantType as M, type NotificationType as N, type OptionItem as O, type PartnerType as P, type ChatMessageInput as Q, type Requirement as R, type StallType as S, type TermsAgreement as T, type ChatMessageType as U, type VendorType as V, type Nullable as W, type BaseResourceType as X, type DateTimeType as Y, type Region as Z, type GeocodeLocation as _, type FormDateField as a, type SubcategoryItems as a0, type Subcategory as a1, type ImageObjectType as a2, type CreateFormData as a3, EnumPubSubEvents as a4, type AuthUser as a5, type SubscriptionPayload as a6, type DateTimeWithPriceType as a7, type PaymentInfoType 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 };
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
- userIds: string[];
239
- title: string;
238
+ data: NotificationDataType | null;
240
239
  message: string;
240
+ title: string;
241
241
  type: EnumNotificationType;
242
- data: NotificationDataType | null;
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 MapMultiLocation 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 GraphQLContext as J, type NotificationDataType as K, type LocationType as L, type ParticipantType as M, type NotificationType as N, type OptionItem as O, type PartnerType as P, type ChatMessageInput as Q, type Requirement as R, type StallType as S, type TermsAgreement as T, type ChatMessageType as U, type VendorType as V, type Nullable as W, type BaseResourceType as X, type DateTimeType as Y, type Region as Z, type GeocodeLocation as _, type FormDateField as a, type SubcategoryItems as a0, type Subcategory as a1, type ImageObjectType as a2, type CreateFormData as a3, EnumPubSubEvents as a4, type AuthUser as a5, type SubscriptionPayload as a6, type DateTimeWithPriceType as a7, type PaymentInfoType 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 };
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 };
@@ -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-_89-F0iL.mjs';
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-IVwm5MLY.mjs';
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';
@@ -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-Bnr6l_NH.js';
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-Cv1V8lgJ.js';
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';
@@ -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-_89-F0iL.mjs';
2
- import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-IVwm5MLY.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-BczaOu28.mjs';
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';
@@ -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-Bnr6l_NH.js';
2
- import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-Cv1V8lgJ.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-BCxQp_CF.js';
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
- sendPushNotification: () => sendPushNotification,
128
+ saveNotificationsInDb: () => saveNotificationsInDb,
129
+ sendPushNotifications: () => sendPushNotifications,
131
130
  socialMediaFields: () => socialMediaFields,
132
131
  sortDatesChronologically: () => sortDatesChronologically,
133
132
  stallTypeOptions: () => stallTypeOptions,
@@ -6293,10 +6292,7 @@ var schema = new MongooseSchema(
6293
6292
  },
6294
6293
  { timestamps: true }
6295
6294
  );
6296
- var EventInfoModel = import_mongoose2.default.model(
6297
- "EventInfo",
6298
- schema
6299
- );
6295
+ var EventInfoModel = import_mongoose2.default.models.EventInfo || import_mongoose2.default.model("EventInfo", schema);
6300
6296
 
6301
6297
  // src/mongoose/Relation.ts
6302
6298
  var MongooseSchema2 = import_mongoose3.default.Schema;
@@ -6356,10 +6352,7 @@ RelationTypeSchema.index({
6356
6352
  "relationDates.startTime": 1,
6357
6353
  "relationDates.status": 1
6358
6354
  });
6359
- var RelationModel = import_mongoose3.default.model(
6360
- "Relation",
6361
- RelationTypeSchema
6362
- );
6355
+ var RelationModel = import_mongoose3.default.models.Relation || import_mongoose3.default.model("Relation", RelationTypeSchema);
6363
6356
 
6364
6357
  // src/mongoose/global.ts
6365
6358
  var MongooseSchema3 = import_mongoose4.default.Schema;
@@ -6574,7 +6567,7 @@ schema2.index({
6574
6567
  start: 1,
6575
6568
  status: 1
6576
6569
  });
6577
- var AdModel = import_mongoose5.default.model("Ad", schema2);
6570
+ var AdModel = import_mongoose5.default.models.Ad || import_mongoose5.default.model("Ad", schema2);
6578
6571
 
6579
6572
  // src/mongoose/Chat.ts
6580
6573
  var import_mongoose6 = __toESM(require("mongoose"));
@@ -6634,7 +6627,7 @@ var ChatSchema = new MongooseSchema5(
6634
6627
  timestamps: true
6635
6628
  }
6636
6629
  );
6637
- var ChatModel = import_mongoose6.default.model("Chat", ChatSchema);
6630
+ var ChatModel = import_mongoose6.default.models.Chat || import_mongoose6.default.model("Chat", ChatSchema);
6638
6631
 
6639
6632
  // src/mongoose/Notification.ts
6640
6633
  var import_mongoose7 = __toESM(require("mongoose"));
@@ -6669,10 +6662,7 @@ var schema3 = new MongooseSchema6(
6669
6662
  );
6670
6663
  schema3.index({ isRead: 1, userId: 1 });
6671
6664
  schema3.index({ createdAt: -1, userId: 1 });
6672
- var NotificationModel = import_mongoose7.default.model(
6673
- "Notification",
6674
- schema3
6675
- );
6665
+ var NotificationModel = import_mongoose7.default.models.Notification || import_mongoose7.default.model("Notification", schema3);
6676
6666
 
6677
6667
  // src/mongoose/PushToken.ts
6678
6668
  var import_mongoose8 = __toESM(require("mongoose"));
@@ -6689,7 +6679,7 @@ var schema4 = new MongooseSchema7(
6689
6679
  },
6690
6680
  { timestamps: true }
6691
6681
  );
6692
- var PushTokenModel = import_mongoose8.default.model("PushToken", schema4);
6682
+ var PushTokenModel = import_mongoose8.default.models.PushToken || import_mongoose8.default.model("PushToken", schema4);
6693
6683
 
6694
6684
  // src/mongoose/ResourceActivity.ts
6695
6685
  var import_mongoose9 = __toESM(require("mongoose"));
@@ -6739,7 +6729,7 @@ var schema5 = new MongooseSchema8(
6739
6729
  );
6740
6730
  schema5.index({ resourceId: 1, resourceType: 1 }, { unique: true });
6741
6731
  schema5.index({ "views.location": "2dsphere" });
6742
- var ResourceActivityModel = import_mongoose9.default.model("ResourceActivity", schema5);
6732
+ var ResourceActivityModel = import_mongoose9.default.models.ResourceActivity || import_mongoose9.default.model("ResourceActivity", schema5);
6743
6733
 
6744
6734
  // src/mongoose/Testers.ts
6745
6735
  var import_mongoose10 = __toESM(require("mongoose"));
@@ -6768,7 +6758,7 @@ var TesterSchema = new MongooseSchema9(
6768
6758
  timestamps: true
6769
6759
  }
6770
6760
  );
6771
- var TesterModel = import_mongoose10.default.model("Tester", TesterSchema);
6761
+ var TesterModel = import_mongoose10.default.models.Tester || import_mongoose10.default.model("Tester", TesterSchema);
6772
6762
 
6773
6763
  // src/mongoose/User.ts
6774
6764
  var import_mongoose11 = __toESM(require("mongoose"));
@@ -6868,7 +6858,7 @@ var schema6 = new MongooseSchema10(
6868
6858
  { timestamps: true }
6869
6859
  );
6870
6860
  schema6.index({ "partners.email": 1 });
6871
- var UserModel = import_mongoose11.default.model("User", schema6);
6861
+ var UserModel = import_mongoose11.default.models.User || import_mongoose11.default.model("User", schema6);
6872
6862
 
6873
6863
  // src/mongoose/VerificationToken.ts
6874
6864
  var import_mongoose12 = __toESM(require("mongoose"));
@@ -6888,10 +6878,7 @@ var schema7 = new MongooseSchema11(
6888
6878
  },
6889
6879
  { timestamps: true }
6890
6880
  );
6891
- var VerificationTokenModel = import_mongoose12.default.model(
6892
- "VerificationToken",
6893
- schema7
6894
- );
6881
+ var VerificationTokenModel = import_mongoose12.default.models.VerificationToken || import_mongoose12.default.model("VerificationToken", schema7);
6895
6882
 
6896
6883
  // src/mongoose/vendor/Vendor.ts
6897
6884
  var import_mongoose13 = __toESM(require("mongoose"));
@@ -6965,7 +6952,7 @@ schema8.index({ description: 1 });
6965
6952
  schema8.index({ region: 1 });
6966
6953
  schema8.index({ "categories.name": 1 });
6967
6954
  schema8.index({ "partners.email": 1 });
6968
- var VendorModel = import_mongoose13.default.model("Vendor", schema8);
6955
+ var VendorModel = import_mongoose13.default.models.Vendor || import_mongoose13.default.model("Vendor", schema8);
6969
6956
 
6970
6957
  // src/mongoose/vendor/VendorInfo.ts
6971
6958
  var import_mongoose14 = __toESM(require("mongoose"));
@@ -7016,10 +7003,7 @@ var schema9 = new MongooseSchema13(
7016
7003
  },
7017
7004
  { timestamps: true }
7018
7005
  );
7019
- var VendorInfoModel = import_mongoose14.default.model(
7020
- "VendorInfo",
7021
- schema9
7022
- );
7006
+ var VendorInfoModel = import_mongoose14.default.models.VendorInfo || import_mongoose14.default.model("VendorInfo", schema9);
7023
7007
 
7024
7008
  // src/mongoose/event/Event.ts
7025
7009
  var import_mongoose15 = __toESM(require("mongoose"));
@@ -7089,7 +7073,7 @@ schema10.index({ region: 1 });
7089
7073
  schema10.index({ location: "2dsphere" });
7090
7074
  schema10.index({ tags: 1 });
7091
7075
  schema10.index({ "partners.email": 1 });
7092
- var EventModel = import_mongoose15.default.model("Event", schema10);
7076
+ var EventModel = import_mongoose15.default.models.Event || import_mongoose15.default.model("Event", schema10);
7093
7077
 
7094
7078
  // src/service/database.ts
7095
7079
  var import_mongoose16 = __toESM(require("mongoose"));
@@ -7138,32 +7122,8 @@ var connectToDatabase = async ({
7138
7122
  }
7139
7123
  };
7140
7124
 
7141
- // src/service/notificationService.ts
7142
- async function publishNotificationEvents(userId, context) {
7143
- try {
7144
- const userNotifications = await NotificationModel.find({
7145
- userId
7146
- }).sort({ createdAt: -1 });
7147
- const [total, unread] = await Promise.all([
7148
- NotificationModel.countDocuments({ userId }),
7149
- NotificationModel.countDocuments({ isRead: false, userId })
7150
- ]);
7151
- context.pubsub.publish("GET_NOTIFICATIONS" /* GET_NOTIFICATIONS */, {
7152
- getNotifications: userNotifications,
7153
- getNotificationsUserId: userId
7154
- });
7155
- context.pubsub.publish("GET_NOTIFICATIONS_COUNT" /* GET_NOTIFICATIONS_COUNT */, {
7156
- getNotificationsCount: { total, unread, userId }
7157
- });
7158
- console.log(`Published notification events for user: ${String(userId)}`);
7159
- } catch (error) {
7160
- console.error(
7161
- `Failed to publish notification events for user ${String(userId)}:`,
7162
- error
7163
- );
7164
- }
7165
- }
7166
- async function createNotifications(payload, context) {
7125
+ // src/service/saveNotificationsInDb.ts
7126
+ async function saveNotificationsInDb(payload) {
7167
7127
  const { data, message, title, type, userIds } = payload;
7168
7128
  try {
7169
7129
  const notifications = userIds.map((userId) => ({
@@ -7174,22 +7134,18 @@ async function createNotifications(payload, context) {
7174
7134
  type,
7175
7135
  userId
7176
7136
  }));
7177
- const savedNotifications = await NotificationModel.insertMany(notifications);
7137
+ await NotificationModel.insertMany(notifications);
7178
7138
  console.log(
7179
- `Created ${savedNotifications.length} notifications for ${userIds.length} users`
7139
+ `Created ${notifications.length} notifications for ${userIds.length} users`
7180
7140
  );
7181
- const uniqueUserIds = [...new Set(userIds)];
7182
- for (const userId of uniqueUserIds) {
7183
- await publishNotificationEvents(userId, context);
7184
- }
7185
- return savedNotifications;
7141
+ return [...new Set(userIds)];
7186
7142
  } catch (error) {
7187
7143
  console.error("Failed to create notifications:", error);
7188
7144
  return [];
7189
7145
  }
7190
7146
  }
7191
7147
 
7192
- // src/service/sendPushNotification.ts
7148
+ // src/service/sendPushNotifications.ts
7193
7149
  var import_expo_server_sdk = require("expo-server-sdk");
7194
7150
  var expo = new import_expo_server_sdk.Expo();
7195
7151
  function extractTokensFromMessage(message) {
@@ -7257,7 +7213,7 @@ async function sendChunk(chunk, chunkIndex) {
7257
7213
  return { failedTokens: [], successCount: 0 };
7258
7214
  }
7259
7215
  }
7260
- async function sendPushNotification({
7216
+ async function sendPushNotifications({
7261
7217
  data,
7262
7218
  message,
7263
7219
  title,
@@ -7265,6 +7221,7 @@ async function sendPushNotification({
7265
7221
  }) {
7266
7222
  const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
7267
7223
  const expoTokens = pushTokens.map((token) => token.token);
7224
+ if (!data) return;
7268
7225
  const { messages, invalidTokens } = createPushMessages({
7269
7226
  data,
7270
7227
  message,
@@ -7400,7 +7357,6 @@ var fonts = {
7400
7357
  companyContactFields,
7401
7358
  connectToDatabase,
7402
7359
  contactUsFields,
7403
- createNotifications,
7404
7360
  darkColors,
7405
7361
  dateFormat,
7406
7362
  defaultEventFormValues,
@@ -7433,14 +7389,14 @@ var fonts = {
7433
7389
  producedIngOptions,
7434
7390
  productLabelGroups,
7435
7391
  profileFields,
7436
- publishNotificationEvents,
7437
7392
  registerFields,
7438
7393
  relationDatesSchema,
7439
7394
  removeTypename,
7440
7395
  requestPasswordResetFields,
7441
7396
  requirementsOptions,
7442
7397
  resetPasswordFields,
7443
- sendPushNotification,
7398
+ saveNotificationsInDb,
7399
+ sendPushNotifications,
7444
7400
  socialMediaFields,
7445
7401
  sortDatesChronologically,
7446
7402
  stallTypeOptions,