@timardex/cluemart-server-shared 2.1.8 → 2.2.0

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, RelationDate, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, 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, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
3
3
  import * as mongoose from 'mongoose';
4
4
  import mongoose__default from 'mongoose';
5
5
  export { default as mongoose } from 'mongoose';
@@ -264,36 +264,6 @@ declare const termsAgreementSchema: mongoose__default.Schema<TermsAgreement, mon
264
264
  } & {
265
265
  __v: number;
266
266
  }>;
267
- declare const resourceRelationsSchema: mongoose__default.Schema<{
268
- relationId: ObjectId;
269
- relationDates: RelationDate[];
270
- }, mongoose__default.Model<{
271
- relationId: ObjectId;
272
- relationDates: RelationDate[];
273
- }, any, any, any, mongoose__default.Document<unknown, any, {
274
- relationId: ObjectId;
275
- relationDates: RelationDate[];
276
- }, any, {}> & {
277
- relationId: ObjectId;
278
- relationDates: RelationDate[];
279
- } & {
280
- _id: mongoose__default.Types.ObjectId;
281
- } & {
282
- __v: number;
283
- }, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, {
284
- relationId: ObjectId;
285
- relationDates: RelationDate[];
286
- }, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<{
287
- relationId: ObjectId;
288
- relationDates: RelationDate[];
289
- }>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<{
290
- relationId: ObjectId;
291
- relationDates: RelationDate[];
292
- }> & {
293
- _id: mongoose__default.Types.ObjectId;
294
- } & {
295
- __v: number;
296
- }>;
297
267
  declare const dateTimeSchema: mongoose__default.Schema<DateTimeType, mongoose__default.Model<DateTimeType, any, any, any, mongoose__default.Document<unknown, any, DateTimeType, any, {}> & DateTimeType & {
298
268
  _id: mongoose__default.Types.ObjectId;
299
269
  } & {
@@ -796,6 +766,16 @@ declare const EventInfoModel: mongoose__default.Model<SchemaEventInfoType, {}, {
796
766
  __v: number;
797
767
  }, any>;
798
768
 
769
+ type SchemaEventDateArchiveType = {
770
+ dateTime: DateTimeType[];
771
+ eventId: ObjectId;
772
+ };
773
+ declare const EventDateArchiveModel: mongoose__default.Model<SchemaEventDateArchiveType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaEventDateArchiveType, {}, {}> & SchemaEventDateArchiveType & {
774
+ _id: mongoose__default.Types.ObjectId;
775
+ } & {
776
+ __v: number;
777
+ }, any>;
778
+
799
779
  type SchemaPartnerType = Omit<PartnerType, "owner" | "adIds"> & {
800
780
  adIds?: ObjectId[];
801
781
  owner: SchemaOwnerType;
@@ -1065,16 +1045,46 @@ declare function isValidObjectId(value: string): boolean;
1065
1045
  declare function convertObjectIdsToStrings(obj: any): any;
1066
1046
 
1067
1047
  /**
1068
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time
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.
1069
1050
  * @param dateTime The date-time object to update
1070
- * @returns A new object with updated dateStatus value
1051
+ * @returns A new object with an updated dateStatus value, or the original
1052
+ * object when the stored status is a manual override
1071
1053
  */
1072
1054
  declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
1073
1055
  /**
1074
- * Recomputes dateStatus for every dateTime slot on events and google imported markets.
1056
+ * Recomputes dateStatus for every dateTime slot on events and google imported
1057
+ * markets, moves ended event date slots into the event date archive, and keeps
1058
+ * `EventInfo.dateTime` future-only.
1075
1059
  */
1076
1060
  declare function updateAllEventDateTimeStatuses(): Promise<void>;
1077
1061
 
1062
+ /**
1063
+ * Splits a recomputed event schedule into three buckets: slots to keep on the
1064
+ * Event document (future + STARTED), ended slots to archive (`ENDED`), and
1065
+ * invalid slots to discard (`INVALID` — removed from the Event but *not*
1066
+ * archived). `Event.dateTime` may become empty once an event has no future or
1067
+ * in-progress dates.
1068
+ */
1069
+ declare function splitEventDatesForArchive(dateTime: DateTimeType[]): {
1070
+ archive: DateTimeType[];
1071
+ discard: DateTimeType[];
1072
+ keep: DateTimeType[];
1073
+ };
1074
+ /**
1075
+ * De-duplicates the *input* slots on (startDate, startTime), keeping the first
1076
+ * occurrence. This prevents a single write from appending near-duplicate
1077
+ * history (the archive's `$addToSet` only de-dupes by deep equality, not by
1078
+ * startDate/startTime). It does not scan or clean duplicates already stored in
1079
+ * the archive document.
1080
+ */
1081
+ declare function dedupeArchivedSlotsByStartDateTime(slots: DateTimeType[]): DateTimeType[];
1082
+ /**
1083
+ * Persists archived slots into the event's archive document. Idempotent: the
1084
+ * archive document is keyed per event and slots are appended with `$addToSet`.
1085
+ */
1086
+ declare function persistArchivedEventDates(eventId: ObjectId | string, slots: DateTimeType[]): Promise<void>;
1087
+
1078
1088
  type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
1079
1089
  /** Present on owned EventModel docs; absent on Google-imported markets. */
1080
1090
  owner?: SchemaOwnerType;
@@ -1376,4 +1386,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1376
1386
  resourceType: EnumResourceType;
1377
1387
  }): Promise<void>;
1378
1388
 
1379
- 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, 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 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, 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, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
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 };
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, RelationDate, UserLicenceType, GoogleImportedMarket, PushTokenType, RelationType, 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, PromoCodeType, EnumAffiliateRewardType, EventListItemType, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
3
3
  import * as mongoose from 'mongoose';
4
4
  import mongoose__default from 'mongoose';
5
5
  export { default as mongoose } from 'mongoose';
@@ -264,36 +264,6 @@ declare const termsAgreementSchema: mongoose__default.Schema<TermsAgreement, mon
264
264
  } & {
265
265
  __v: number;
266
266
  }>;
267
- declare const resourceRelationsSchema: mongoose__default.Schema<{
268
- relationId: ObjectId;
269
- relationDates: RelationDate[];
270
- }, mongoose__default.Model<{
271
- relationId: ObjectId;
272
- relationDates: RelationDate[];
273
- }, any, any, any, mongoose__default.Document<unknown, any, {
274
- relationId: ObjectId;
275
- relationDates: RelationDate[];
276
- }, any, {}> & {
277
- relationId: ObjectId;
278
- relationDates: RelationDate[];
279
- } & {
280
- _id: mongoose__default.Types.ObjectId;
281
- } & {
282
- __v: number;
283
- }, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, {
284
- relationId: ObjectId;
285
- relationDates: RelationDate[];
286
- }, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<{
287
- relationId: ObjectId;
288
- relationDates: RelationDate[];
289
- }>, {}, mongoose__default.DefaultSchemaOptions> & mongoose__default.FlatRecord<{
290
- relationId: ObjectId;
291
- relationDates: RelationDate[];
292
- }> & {
293
- _id: mongoose__default.Types.ObjectId;
294
- } & {
295
- __v: number;
296
- }>;
297
267
  declare const dateTimeSchema: mongoose__default.Schema<DateTimeType, mongoose__default.Model<DateTimeType, any, any, any, mongoose__default.Document<unknown, any, DateTimeType, any, {}> & DateTimeType & {
298
268
  _id: mongoose__default.Types.ObjectId;
299
269
  } & {
@@ -796,6 +766,16 @@ declare const EventInfoModel: mongoose__default.Model<SchemaEventInfoType, {}, {
796
766
  __v: number;
797
767
  }, any>;
798
768
 
769
+ type SchemaEventDateArchiveType = {
770
+ dateTime: DateTimeType[];
771
+ eventId: ObjectId;
772
+ };
773
+ declare const EventDateArchiveModel: mongoose__default.Model<SchemaEventDateArchiveType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaEventDateArchiveType, {}, {}> & SchemaEventDateArchiveType & {
774
+ _id: mongoose__default.Types.ObjectId;
775
+ } & {
776
+ __v: number;
777
+ }, any>;
778
+
799
779
  type SchemaPartnerType = Omit<PartnerType, "owner" | "adIds"> & {
800
780
  adIds?: ObjectId[];
801
781
  owner: SchemaOwnerType;
@@ -1065,16 +1045,46 @@ declare function isValidObjectId(value: string): boolean;
1065
1045
  declare function convertObjectIdsToStrings(obj: any): any;
1066
1046
 
1067
1047
  /**
1068
- * Updates the dateStatus field for a single DateTimeType object based on the current date/time
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.
1069
1050
  * @param dateTime The date-time object to update
1070
- * @returns A new object with updated dateStatus value
1051
+ * @returns A new object with an updated dateStatus value, or the original
1052
+ * object when the stored status is a manual override
1071
1053
  */
1072
1054
  declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
1073
1055
  /**
1074
- * Recomputes dateStatus for every dateTime slot on events and google imported markets.
1056
+ * Recomputes dateStatus for every dateTime slot on events and google imported
1057
+ * markets, moves ended event date slots into the event date archive, and keeps
1058
+ * `EventInfo.dateTime` future-only.
1075
1059
  */
1076
1060
  declare function updateAllEventDateTimeStatuses(): Promise<void>;
1077
1061
 
1062
+ /**
1063
+ * Splits a recomputed event schedule into three buckets: slots to keep on the
1064
+ * Event document (future + STARTED), ended slots to archive (`ENDED`), and
1065
+ * invalid slots to discard (`INVALID` — removed from the Event but *not*
1066
+ * archived). `Event.dateTime` may become empty once an event has no future or
1067
+ * in-progress dates.
1068
+ */
1069
+ declare function splitEventDatesForArchive(dateTime: DateTimeType[]): {
1070
+ archive: DateTimeType[];
1071
+ discard: DateTimeType[];
1072
+ keep: DateTimeType[];
1073
+ };
1074
+ /**
1075
+ * De-duplicates the *input* slots on (startDate, startTime), keeping the first
1076
+ * occurrence. This prevents a single write from appending near-duplicate
1077
+ * history (the archive's `$addToSet` only de-dupes by deep equality, not by
1078
+ * startDate/startTime). It does not scan or clean duplicates already stored in
1079
+ * the archive document.
1080
+ */
1081
+ declare function dedupeArchivedSlotsByStartDateTime(slots: DateTimeType[]): DateTimeType[];
1082
+ /**
1083
+ * Persists archived slots into the event's archive document. Idempotent: the
1084
+ * archive document is keyed per event and slots are appended with `$addToSet`.
1085
+ */
1086
+ declare function persistArchivedEventDates(eventId: ObjectId | string, slots: DateTimeType[]): Promise<void>;
1087
+
1078
1088
  type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
1079
1089
  /** Present on owned EventModel docs; absent on Google-imported markets. */
1080
1090
  owner?: SchemaOwnerType;
@@ -1376,4 +1386,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
1376
1386
  resourceType: EnumResourceType;
1377
1387
  }): Promise<void>;
1378
1388
 
1379
- 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, 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 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, 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, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, resourceRelationsSchema, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
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 };