@timardex/cluemart-server-shared 2.2.0 → 2.2.12

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,13 +1,14 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
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';
3
+ export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
3
4
  import * as mongoose from 'mongoose';
4
5
  import mongoose__default from 'mongoose';
5
6
  export { default as mongoose } from 'mongoose';
6
7
  import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
7
8
  import express from 'express';
8
9
  export { default as express } from 'express';
9
- import dayjs, { Dayjs } from 'dayjs';
10
10
  import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
11
+ import dayjs, { Dayjs } from 'dayjs';
11
12
 
12
13
  declare const schemaAdresource: mongoose__default.Schema<_timardex_cluemart_shared.AdResource, mongoose__default.Model<_timardex_cluemart_shared.AdResource, any, any, any, mongoose__default.Document<unknown, any, _timardex_cluemart_shared.AdResource, any, {}> & _timardex_cluemart_shared.AdResource & {
13
14
  _id: mongoose__default.Types.ObjectId;
@@ -1012,9 +1013,8 @@ declare function publishNotificationEvents(userId: ObjectId, pubsub: Notificatio
1012
1013
  * is provided) publishes GraphQL subscription events for each affected user.
1013
1014
  *
1014
1015
  * Errors are logged and swallowed; this function never throws. Instead it
1015
- * returns `false` when notifications were not confirmed (an error was thrown,
1016
- * or `saveNotificationsInDb` failed to persist any rows for a non-empty
1017
- * `userIds`), so callers can gate success logs/metrics on the result.
1016
+ * returns `false` when notifications were not confirmed, so callers can gate
1017
+ * success logs/metrics on the result.
1018
1018
  */
1019
1019
  declare function notifyUsers({ payload, pubsub, }: {
1020
1020
  payload: SchemaCreateBulkNotificationInput;
@@ -1044,14 +1044,6 @@ declare function isValidObjectId(value: string): boolean;
1044
1044
  */
1045
1045
  declare function convertObjectIdsToStrings(obj: any): any;
1046
1046
 
1047
- /**
1048
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time.
1049
- * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
1050
- * @param dateTime The date-time object to update
1051
- * @returns A new object with an updated dateStatus value, or the original
1052
- * object when the stored status is a manual override
1053
- */
1054
- declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
1055
1047
  /**
1056
1048
  * Recomputes dateStatus for every dateTime slot on events and google imported
1057
1049
  * markets, moves ended event date slots into the event date archive, and keeps
@@ -1386,4 +1378,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1386
1378
  resourceType: EnumResourceType;
1387
1379
  }): Promise<void>;
1388
1380
 
1389
- 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, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
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 };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
2
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';
3
+ export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
3
4
  import * as mongoose from 'mongoose';
4
5
  import mongoose__default from 'mongoose';
5
6
  export { default as mongoose } from 'mongoose';
6
7
  import { NotificationCount, DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
7
8
  import express from 'express';
8
9
  export { default as express } from 'express';
9
- import dayjs, { Dayjs } from 'dayjs';
10
10
  import { EnumUserLicence as EnumUserLicence$1 } from '@timardex/cluemart-shared/enums';
11
+ import dayjs, { Dayjs } from 'dayjs';
11
12
 
12
13
  declare const schemaAdresource: mongoose__default.Schema<_timardex_cluemart_shared.AdResource, mongoose__default.Model<_timardex_cluemart_shared.AdResource, any, any, any, mongoose__default.Document<unknown, any, _timardex_cluemart_shared.AdResource, any, {}> & _timardex_cluemart_shared.AdResource & {
13
14
  _id: mongoose__default.Types.ObjectId;
@@ -1012,9 +1013,8 @@ declare function publishNotificationEvents(userId: ObjectId, pubsub: Notificatio
1012
1013
  * is provided) publishes GraphQL subscription events for each affected user.
1013
1014
  *
1014
1015
  * Errors are logged and swallowed; this function never throws. Instead it
1015
- * returns `false` when notifications were not confirmed (an error was thrown,
1016
- * or `saveNotificationsInDb` failed to persist any rows for a non-empty
1017
- * `userIds`), so callers can gate success logs/metrics on the result.
1016
+ * returns `false` when notifications were not confirmed, so callers can gate
1017
+ * success logs/metrics on the result.
1018
1018
  */
1019
1019
  declare function notifyUsers({ payload, pubsub, }: {
1020
1020
  payload: SchemaCreateBulkNotificationInput;
@@ -1044,14 +1044,6 @@ declare function isValidObjectId(value: string): boolean;
1044
1044
  */
1045
1045
  declare function convertObjectIdsToStrings(obj: any): any;
1046
1046
 
1047
- /**
1048
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time.
1049
- * Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
1050
- * @param dateTime The date-time object to update
1051
- * @returns A new object with an updated dateStatus value, or the original
1052
- * object when the stored status is a manual override
1053
- */
1054
- declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
1055
1047
  /**
1056
1048
  * Recomputes dateStatus for every dateTime slot on events and google imported
1057
1049
  * markets, moves ended event date slots into the event date archive, and keeps
@@ -1386,4 +1378,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1386
1378
  resourceType: EnumResourceType;
1387
1379
  }): Promise<void>;
1388
1380
 
1389
- 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, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
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 };
package/dist/index.mjs CHANGED
@@ -1083,16 +1083,24 @@ import {
1083
1083
  } from "@timardex/cluemart-shared";
1084
1084
  import mongoose11 from "mongoose";
1085
1085
  var MongooseSchema7 = mongoose11.Schema;
1086
+ var notificationDataSchema = new MongooseSchema7(
1087
+ {
1088
+ resourceId: { required: true, type: String },
1089
+ resourceName: { required: true, type: String },
1090
+ resourceType: {
1091
+ enum: Object.values(EnumNotificationResourceType),
1092
+ required: true,
1093
+ type: String
1094
+ }
1095
+ },
1096
+ { _id: false }
1097
+ );
1086
1098
  var schema8 = new MongooseSchema7(
1087
1099
  {
1088
1100
  data: {
1089
- resourceId: { required: true, type: String },
1090
- resourceName: { required: true, type: String },
1091
- resourceType: {
1092
- enum: Object.values(EnumNotificationResourceType),
1093
- required: true,
1094
- type: String
1095
- }
1101
+ default: null,
1102
+ required: false,
1103
+ type: notificationDataSchema
1096
1104
  },
1097
1105
  isRead: { default: false, index: true, required: true, type: Boolean },
1098
1106
  message: { required: true, type: String },
@@ -2539,25 +2547,24 @@ import { createAffiliateReward } from "@timardex/cluemart-shared/utils";
2539
2547
  // src/service/saveNotificationsInDb.ts
2540
2548
  async function saveNotificationsInDb(payload) {
2541
2549
  const { data, message, title, type, userIds } = payload;
2542
- console.log("NOTIFICATION DATA", JSON.stringify(payload, null, 2));
2550
+ const notifications = userIds.map((userId) => ({
2551
+ data,
2552
+ isRead: false,
2553
+ message,
2554
+ title,
2555
+ type,
2556
+ userId
2557
+ }));
2543
2558
  try {
2544
- const notifications = userIds.map((userId) => ({
2545
- data,
2546
- isRead: false,
2547
- message,
2548
- title,
2549
- type,
2550
- userId
2551
- }));
2552
2559
  await NotificationModel.insertMany(notifications);
2553
- console.log(
2554
- `Created ${notifications.length} notifications for ${userIds.length} users`
2555
- );
2556
- return [...new Set(userIds)];
2557
2560
  } catch (error) {
2558
2561
  console.error("Failed to create notifications:", error);
2559
- return [];
2562
+ throw error;
2560
2563
  }
2564
+ console.log(
2565
+ `Created ${notifications.length} notifications for ${userIds.length} users`
2566
+ );
2567
+ return [...new Set(userIds)];
2561
2568
  }
2562
2569
 
2563
2570
  // src/service/sendPushNotifications.ts
@@ -2581,7 +2588,7 @@ function createPushMessages({
2581
2588
  }
2582
2589
  messages.push({
2583
2590
  body: message,
2584
- data: { ...data },
2591
+ ...data ? { data: { ...data } } : {},
2585
2592
  sound: "tui.wav",
2586
2593
  title,
2587
2594
  to: token
@@ -2636,7 +2643,6 @@ async function sendPushNotifications({
2636
2643
  }) {
2637
2644
  const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
2638
2645
  const expoTokens = pushTokens.map((token) => token.token);
2639
- if (!data) return;
2640
2646
  const { messages, invalidTokens } = createPushMessages({
2641
2647
  data,
2642
2648
  message,
@@ -3126,14 +3132,11 @@ function convertObjectIdsToStrings(obj) {
3126
3132
 
3127
3133
  // src/service/event/updateAllEventDateTimeStatuses.ts
3128
3134
  import {
3129
- dateFormat,
3130
3135
  EnumEventDateStatus as EnumEventDateStatus7,
3131
3136
  filterDatesByFutureStatus,
3132
- timeFormat
3137
+ updateSingleDateTimeStatus
3133
3138
  } from "@timardex/cluemart-shared";
3134
3139
  import dayjs2 from "dayjs";
3135
- import customParseFormat from "dayjs/plugin/customParseFormat";
3136
- import isoWeek from "dayjs/plugin/isoWeek";
3137
3140
 
3138
3141
  // src/service/event/archiveEndedEventDates.ts
3139
3142
  import { EnumEventDateStatus as EnumEventDateStatus6 } from "@timardex/cluemart-shared";
@@ -3176,73 +3179,6 @@ async function persistArchivedEventDates(eventId, slots) {
3176
3179
  }
3177
3180
 
3178
3181
  // src/service/event/updateAllEventDateTimeStatuses.ts
3179
- dayjs2.extend(customParseFormat);
3180
- dayjs2.extend(isoWeek);
3181
- var MANUAL_DATE_STATUSES = /* @__PURE__ */ new Set([
3182
- EnumEventDateStatus7.CANCELED,
3183
- EnumEventDateStatus7.RE_SCHEDULED
3184
- ]);
3185
- function getFutureEventStatus(startDateTime, now) {
3186
- const hoursUntilStart = startDateTime.diff(now, "hour", true);
3187
- if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
3188
- return EnumEventDateStatus7.STARTING_SOON;
3189
- }
3190
- if (startDateTime.isSame(now, "day")) {
3191
- return EnumEventDateStatus7.TODAY;
3192
- }
3193
- if (startDateTime.isSame(now.add(1, "day"), "day")) {
3194
- return EnumEventDateStatus7.TOMORROW;
3195
- }
3196
- if (startDateTime.isSame(now, "isoWeek")) {
3197
- return EnumEventDateStatus7.THIS_WEEK;
3198
- }
3199
- if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
3200
- return EnumEventDateStatus7.NEXT_WEEK;
3201
- }
3202
- return EnumEventDateStatus7.UPCOMING;
3203
- }
3204
- function updateSingleDateTimeStatus(dateTime, now = dayjs2()) {
3205
- if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {
3206
- return dateTime;
3207
- }
3208
- const dateTimeFormat = `${dateFormat} ${timeFormat}`;
3209
- const startDateTime = dayjs2(
3210
- `${dateTime.startDate} ${dateTime.startTime}`,
3211
- dateTimeFormat,
3212
- true
3213
- );
3214
- const endDateTime = dayjs2(
3215
- `${dateTime.endDate} ${dateTime.endTime}`,
3216
- dateTimeFormat,
3217
- true
3218
- );
3219
- if (!startDateTime.isValid() || !endDateTime.isValid()) {
3220
- return {
3221
- ...dateTime,
3222
- dateStatus: EnumEventDateStatus7.INVALID
3223
- };
3224
- }
3225
- if (endDateTime.isBefore(startDateTime)) {
3226
- return {
3227
- ...dateTime,
3228
- dateStatus: EnumEventDateStatus7.INVALID
3229
- };
3230
- }
3231
- let dateStatus;
3232
- if (endDateTime.isAfter(now)) {
3233
- if (startDateTime.isAfter(now)) {
3234
- dateStatus = getFutureEventStatus(startDateTime, now);
3235
- } else {
3236
- dateStatus = EnumEventDateStatus7.STARTED;
3237
- }
3238
- } else {
3239
- dateStatus = EnumEventDateStatus7.ENDED;
3240
- }
3241
- return {
3242
- ...dateTime,
3243
- dateStatus
3244
- };
3245
- }
3246
3182
  var dateTimeStatusFilter = {
3247
3183
  dateTime: { $ne: [], $type: "array" },
3248
3184
  deletedAt: null
@@ -3421,6 +3357,9 @@ async function updateAllEventDateTimeStatuses() {
3421
3357
  }
3422
3358
  }
3423
3359
 
3360
+ // src/service/index.ts
3361
+ import { updateSingleDateTimeStatus as updateSingleDateTimeStatus2 } from "@timardex/cluemart-shared";
3362
+
3424
3363
  // src/service/event/findEventOrImportedMarketById.ts
3425
3364
  async function findEventOrImportedMarketById(resourceId) {
3426
3365
  if (!resourceId) {
@@ -4312,7 +4251,7 @@ var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
4312
4251
 
4313
4252
  // src/service/license/reminder/utils.ts
4314
4253
  import {
4315
- dateFormat as dateFormat2,
4254
+ dateFormat,
4316
4255
  EnumNotificationResourceType as EnumNotificationResourceType6,
4317
4256
  EnumNotificationType as EnumNotificationType5,
4318
4257
  EnumUserLicence as EnumUserLicence11,
@@ -4457,7 +4396,7 @@ function getLicenceExpiryMode(licenceType) {
4457
4396
  }
4458
4397
  async function sendLicenseReminder(user, licence) {
4459
4398
  const licenceName = getLicenseName(licence.licenceType);
4460
- const expiryDate = dayjs7(licence.expiryDate).format(dateFormat2);
4399
+ const expiryDate = dayjs7(licence.expiryDate).format(dateFormat);
4461
4400
  const userId = String(user._id);
4462
4401
  const resourceInfo = await getLicenseResourceInfo(user, licence);
4463
4402
  if (!resourceInfo) {
@@ -4696,7 +4635,7 @@ export {
4696
4635
  updateAdStatuses,
4697
4636
  updateAllEventDateTimeStatuses,
4698
4637
  updateRelationDatesToUnavailable,
4699
- updateSingleDateTimeStatus,
4638
+ updateSingleDateTimeStatus2 as updateSingleDateTimeStatus,
4700
4639
  upgradeUserToLicence,
4701
4640
  userLicenseSchema,
4702
4641
  vendorOwnerHasProLicence,