@timardex/cluemart-server-shared 2.2.12 → 2.2.21

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate } from '@timardex/cluemart-shared';
3
3
  export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
4
4
  import * as mongoose from 'mongoose';
5
5
  import mongoose__default from 'mongoose';
@@ -116,6 +116,10 @@ interface AuthUser {
116
116
  email: string;
117
117
  roles: EnumUserRole[];
118
118
  userId: ObjectId;
119
+ /** Set when this token represents an impersonation session. */
120
+ impersonationSessionId?: string;
121
+ /** The SUPER_ADMIN who started the impersonation session. */
122
+ impersonatorUserId?: ObjectId;
119
123
  }
120
124
  interface SubscriptionPayload {
121
125
  getChatMessage?: SchemaChatType;
@@ -894,6 +898,36 @@ declare const CouponModel: mongoose__default.Model<CouponDocument, {}, {}, {}, m
894
898
  __v: number;
895
899
  }, any>;
896
900
 
901
+ type SchemaImpersonationSessionType = {
902
+ /** The SUPER_ADMIN who is impersonating. */
903
+ impersonatorUserId: ObjectId;
904
+ /** The resource owner being impersonated. */
905
+ impersonatedUserId: ObjectId;
906
+ /** Hashed impersonation refresh token (stored here, not on the User doc). */
907
+ refreshToken: string;
908
+ expiresAt: Date;
909
+ };
910
+ declare const ImpersonationSessionModel: mongoose__default.Model<SchemaImpersonationSessionType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationSessionType, {}, {}> & SchemaImpersonationSessionType & {
911
+ _id: mongoose__default.Types.ObjectId;
912
+ } & {
913
+ __v: number;
914
+ }, any>;
915
+ type SchemaImpersonationAuditType = {
916
+ action: "start" | "end";
917
+ /** Reason for an `end` record (manual, logout, reuse_revoked, expired). */
918
+ endReason?: string | null;
919
+ impersonatedUserId: ObjectId;
920
+ impersonatorUserId: ObjectId;
921
+ resourceId?: ObjectId | null;
922
+ resourceType?: EnumResourceType | null;
923
+ sessionId: ObjectId;
924
+ };
925
+ declare const ImpersonationAuditModel: mongoose__default.Model<SchemaImpersonationAuditType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationAuditType, {}, {}> & SchemaImpersonationAuditType & {
926
+ _id: mongoose__default.Types.ObjectId;
927
+ } & {
928
+ __v: number;
929
+ }, any>;
930
+
897
931
  /**
898
932
  * Checks whether an affiliate code is already taken by an active, non-deleted affiliate.
899
933
  *
@@ -1378,4 +1412,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1378
1412
  resourceType: EnumResourceType;
1379
1413
  }): Promise<void>;
1380
1414
 
1381
- export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
1415
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
- import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, EnumAdShowOn, AdSettingsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate } from '@timardex/cluemart-shared';
3
3
  export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
4
4
  import * as mongoose from 'mongoose';
5
5
  import mongoose__default from 'mongoose';
@@ -116,6 +116,10 @@ interface AuthUser {
116
116
  email: string;
117
117
  roles: EnumUserRole[];
118
118
  userId: ObjectId;
119
+ /** Set when this token represents an impersonation session. */
120
+ impersonationSessionId?: string;
121
+ /** The SUPER_ADMIN who started the impersonation session. */
122
+ impersonatorUserId?: ObjectId;
119
123
  }
120
124
  interface SubscriptionPayload {
121
125
  getChatMessage?: SchemaChatType;
@@ -894,6 +898,36 @@ declare const CouponModel: mongoose__default.Model<CouponDocument, {}, {}, {}, m
894
898
  __v: number;
895
899
  }, any>;
896
900
 
901
+ type SchemaImpersonationSessionType = {
902
+ /** The SUPER_ADMIN who is impersonating. */
903
+ impersonatorUserId: ObjectId;
904
+ /** The resource owner being impersonated. */
905
+ impersonatedUserId: ObjectId;
906
+ /** Hashed impersonation refresh token (stored here, not on the User doc). */
907
+ refreshToken: string;
908
+ expiresAt: Date;
909
+ };
910
+ declare const ImpersonationSessionModel: mongoose__default.Model<SchemaImpersonationSessionType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationSessionType, {}, {}> & SchemaImpersonationSessionType & {
911
+ _id: mongoose__default.Types.ObjectId;
912
+ } & {
913
+ __v: number;
914
+ }, any>;
915
+ type SchemaImpersonationAuditType = {
916
+ action: "start" | "end";
917
+ /** Reason for an `end` record (manual, logout, reuse_revoked, expired). */
918
+ endReason?: string | null;
919
+ impersonatedUserId: ObjectId;
920
+ impersonatorUserId: ObjectId;
921
+ resourceId?: ObjectId | null;
922
+ resourceType?: EnumResourceType | null;
923
+ sessionId: ObjectId;
924
+ };
925
+ declare const ImpersonationAuditModel: mongoose__default.Model<SchemaImpersonationAuditType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaImpersonationAuditType, {}, {}> & SchemaImpersonationAuditType & {
926
+ _id: mongoose__default.Types.ObjectId;
927
+ } & {
928
+ __v: number;
929
+ }, any>;
930
+
897
931
  /**
898
932
  * Checks whether an affiliate code is already taken by an active, non-deleted affiliate.
899
933
  *
@@ -1378,4 +1412,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1378
1412
  resourceType: EnumResourceType;
1379
1413
  }): Promise<void>;
1380
1414
 
1381
- export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
1415
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, APP_SETTINGS_ID, AdBillingCatalogModel, AdBookingModel, type AdImpressionEntry, AdImpressionModel, AdModel, AdSettingsModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, DEFAULT_AD_SETTINGS, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAppSettingsType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
package/dist/index.mjs CHANGED
@@ -2521,6 +2521,62 @@ schema24.index({ active: 1, deletedAt: 1, "owner.userId": 1 });
2521
2521
  schema24.index({ "couponData.participantUsers.userId": 1 });
2522
2522
  var CouponModel = mongoose32.models.Coupon || mongoose32.model("Coupon", schema24);
2523
2523
 
2524
+ // src/mongoose/Impersonation.ts
2525
+ import { EnumResourceType as EnumResourceType8 } from "@timardex/cluemart-shared";
2526
+ import mongoose33 from "mongoose";
2527
+ var MongooseSchema28 = mongoose33.Schema;
2528
+ var impersonationSessionSchema = new MongooseSchema28(
2529
+ {
2530
+ expiresAt: { expires: 0, required: true, type: Date },
2531
+ impersonatedUserId: {
2532
+ index: true,
2533
+ ref: "User",
2534
+ required: true,
2535
+ type: mongoose33.Schema.Types.ObjectId
2536
+ },
2537
+ impersonatorUserId: {
2538
+ index: true,
2539
+ ref: "User",
2540
+ required: true,
2541
+ type: mongoose33.Schema.Types.ObjectId
2542
+ },
2543
+ refreshToken: { required: true, type: String }
2544
+ },
2545
+ { timestamps: true }
2546
+ );
2547
+ var ImpersonationSessionModel = mongoose33.models.ImpersonationSession || mongoose33.model(
2548
+ "ImpersonationSession",
2549
+ impersonationSessionSchema
2550
+ );
2551
+ var impersonationAuditSchema = new MongooseSchema28(
2552
+ {
2553
+ action: { enum: ["start", "end"], required: true, type: String },
2554
+ endReason: { type: String },
2555
+ impersonatedUserId: {
2556
+ ref: "User",
2557
+ required: true,
2558
+ type: mongoose33.Schema.Types.ObjectId
2559
+ },
2560
+ impersonatorUserId: {
2561
+ ref: "User",
2562
+ required: true,
2563
+ type: mongoose33.Schema.Types.ObjectId
2564
+ },
2565
+ resourceId: { type: mongoose33.Schema.Types.ObjectId },
2566
+ resourceType: { enum: Object.values(EnumResourceType8), type: String },
2567
+ sessionId: {
2568
+ ref: "ImpersonationSession",
2569
+ required: true,
2570
+ type: mongoose33.Schema.Types.ObjectId
2571
+ }
2572
+ },
2573
+ { timestamps: true }
2574
+ );
2575
+ var ImpersonationAuditModel = mongoose33.models.ImpersonationAudit || mongoose33.model(
2576
+ "ImpersonationAudit",
2577
+ impersonationAuditSchema
2578
+ );
2579
+
2524
2580
  // src/service/promoCode/constants.ts
2525
2581
  var ACTIVE_NOT_DELETED_FILTER = {
2526
2582
  active: true,
@@ -2540,7 +2596,7 @@ async function activeAffiliateCodeExists(affiliateCode) {
2540
2596
  import {
2541
2597
  EnumNotificationResourceType as EnumNotificationResourceType3,
2542
2598
  EnumNotificationType as EnumNotificationType2,
2543
- EnumResourceType as EnumResourceType8
2599
+ EnumResourceType as EnumResourceType9
2544
2600
  } from "@timardex/cluemart-shared";
2545
2601
  import { createAffiliateReward } from "@timardex/cluemart-shared/utils";
2546
2602
 
@@ -2759,7 +2815,7 @@ function getSubscriptionRewardPeriodBounds(now = /* @__PURE__ */ new Date()) {
2759
2815
 
2760
2816
  // src/service/affiliate/awardAffiliateVendorSubscriptionRewards.ts
2761
2817
  function isEligibleVendorResource(resource) {
2762
- return resource.resourceType === EnumResourceType8.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2818
+ return resource.resourceType === EnumResourceType9.VENDOR && resource.resourceActive === true && resource.resourceDeletedAt == null;
2763
2819
  }
2764
2820
  async function findAffiliatesWithActiveVendorReferrals() {
2765
2821
  return await AffiliateModel.find({
@@ -2768,7 +2824,7 @@ async function findAffiliatesWithActiveVendorReferrals() {
2768
2824
  $elemMatch: {
2769
2825
  resourceActive: true,
2770
2826
  resourceDeletedAt: null,
2771
- resourceType: EnumResourceType8.VENDOR
2827
+ resourceType: EnumResourceType9.VENDOR
2772
2828
  }
2773
2829
  },
2774
2830
  deletedAt: null
@@ -2835,7 +2891,7 @@ async function tryAwardSubscriptionReward({
2835
2891
  resourceActive: true,
2836
2892
  resourceDeletedAt: null,
2837
2893
  resourceId: resource.resourceId,
2838
- resourceType: EnumResourceType8.VENDOR,
2894
+ resourceType: EnumResourceType9.VENDOR,
2839
2895
  rewards: {
2840
2896
  $not: {
2841
2897
  $elemMatch: {
@@ -2956,7 +3012,7 @@ function normalizeAffiliatePromoCodes(promoCodes) {
2956
3012
  }
2957
3013
 
2958
3014
  // src/service/database.ts
2959
- import mongoose33 from "mongoose";
3015
+ import mongoose34 from "mongoose";
2960
3016
  var connectToDatabase = async ({
2961
3017
  appName,
2962
3018
  dbName,
@@ -2969,7 +3025,7 @@ var connectToDatabase = async ({
2969
3025
  // Fallback to MongoDB Atlas connection string
2970
3026
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
2971
3027
  );
2972
- await mongoose33.connect(mongoUri);
3028
+ await mongoose34.connect(mongoUri);
2973
3029
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
2974
3030
  console.log(
2975
3031
  `${connectionType} connected from server/src/service/database.ts`
@@ -2982,7 +3038,7 @@ var connectToDatabase = async ({
2982
3038
 
2983
3039
  // src/types/index.ts
2984
3040
  import express from "express";
2985
- import mongoose34 from "mongoose";
3041
+ import mongoose35 from "mongoose";
2986
3042
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
2987
3043
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
2988
3044
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -3103,15 +3159,15 @@ async function updateAdStatuses() {
3103
3159
  }
3104
3160
 
3105
3161
  // src/service/objectIdToString.ts
3106
- import mongoose35 from "mongoose";
3162
+ import mongoose36 from "mongoose";
3107
3163
  function isValidObjectId(value) {
3108
- return mongoose35.Types.ObjectId.isValid(value);
3164
+ return mongoose36.Types.ObjectId.isValid(value);
3109
3165
  }
3110
3166
  function convertObjectIdsToStrings(obj) {
3111
3167
  if (obj === null || obj === void 0) {
3112
3168
  return obj;
3113
3169
  }
3114
- if (obj instanceof mongoose35.Types.ObjectId) {
3170
+ if (obj instanceof mongoose36.Types.ObjectId) {
3115
3171
  return obj.toString();
3116
3172
  }
3117
3173
  if (obj instanceof Date) {
@@ -3648,7 +3704,7 @@ import dayjs4 from "dayjs";
3648
3704
 
3649
3705
  // src/service/license/models.ts
3650
3706
  import {
3651
- EnumResourceType as EnumResourceType9,
3707
+ EnumResourceType as EnumResourceType10,
3652
3708
  EnumUserLicence as EnumUserLicence8,
3653
3709
  isNonVisitorResourceType,
3654
3710
  LicenceExpiryDate
@@ -3844,11 +3900,11 @@ async function checkOwnerHasLicence({
3844
3900
  const owner = await UserModel.findById(userId);
3845
3901
  if (!owner) throw new GraphQLError("Owner not found");
3846
3902
  const categoryByResource = {
3847
- [EnumResourceType9.EVENT]: "event" /* EVENT */,
3848
- [EnumResourceType9.PARTNER]: "partner" /* PARTNER */,
3849
- [EnumResourceType9.VENDOR]: "vendor" /* VENDOR */,
3850
- [EnumResourceType9.AFFILIATE]: "affiliate" /* AFFILIATE */,
3851
- [EnumResourceType9.SCHOOL]: "school" /* SCHOOL */
3903
+ [EnumResourceType10.EVENT]: "event" /* EVENT */,
3904
+ [EnumResourceType10.PARTNER]: "partner" /* PARTNER */,
3905
+ [EnumResourceType10.VENDOR]: "vendor" /* VENDOR */,
3906
+ [EnumResourceType10.AFFILIATE]: "affiliate" /* AFFILIATE */,
3907
+ [EnumResourceType10.SCHOOL]: "school" /* SCHOOL */
3852
3908
  };
3853
3909
  if (!isNonVisitorResourceType(resourceType)) {
3854
3910
  throw new GraphQLError(`Invalid resource type: ${resourceType}.`);
@@ -4544,6 +4600,8 @@ export {
4544
4600
  EventModel,
4545
4601
  GameModel,
4546
4602
  GoogleImportedMarketModel,
4603
+ ImpersonationAuditModel,
4604
+ ImpersonationSessionModel,
4547
4605
  LicenceCategory,
4548
4606
  NotificationModel,
4549
4607
  OwnerTypeSchema,
@@ -4606,7 +4664,7 @@ export {
4606
4664
  locationGeoSchema,
4607
4665
  locationsSchema,
4608
4666
  mapVendorLicenceToSubscriptionRewardType,
4609
- mongoose34 as mongoose,
4667
+ mongoose35 as mongoose,
4610
4668
  normalizeAffiliatePromoCodes,
4611
4669
  normalizePromoCode,
4612
4670
  notifyUsers,