@timardex/cluemart-server-shared 2.2.22 → 2.2.23
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.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -1
- package/dist/service/index.cjs +12 -0
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +14 -1
- package/dist/service/index.d.ts +14 -1
- package/dist/service/index.mjs +12 -0
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/service/index.d.mts
CHANGED
|
@@ -207,11 +207,24 @@ type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
|
|
|
207
207
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
208
208
|
|
|
209
209
|
type EventDateSlot = Pick<DateTimeType$1, "startDate" | "startTime">;
|
|
210
|
+
type StartedDateSlot = Pick<DateTimeType$1, "dateStatus" | "startDate" | "startTime">;
|
|
210
211
|
/**
|
|
211
212
|
* Returns true when at least one startDate/startTime slot from the previous
|
|
212
213
|
* schedule is absent from the next schedule (i.e. a date was removed).
|
|
213
214
|
*/
|
|
214
215
|
declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | undefined, nextDateTime: EventDateSlot[] | undefined): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Returns true when a slot that was `STARTED` in the previous schedule is no
|
|
218
|
+
* longer `STARTED` in the next schedule (e.g. canceled or rescheduled).
|
|
219
|
+
*
|
|
220
|
+
* This catches the `STARTED → CANCELED` transition that
|
|
221
|
+
* {@link didRemoveAnyEventDates} misses: that function only compares
|
|
222
|
+
* `startDate`/`startTime` presence, so a slot that still exists but whose
|
|
223
|
+
* `dateStatus` changed is not flagged. (Its callers filter to future-only
|
|
224
|
+
* schedules, which also drop `STARTED`.) Without this extra status check, a
|
|
225
|
+
* started slot that gets canceled would leave its relation dates untouched.
|
|
226
|
+
*/
|
|
227
|
+
declare function didRemoveAnyStartedDates(previousDateTime: StartedDateSlot[] | undefined, nextDateTime: StartedDateSlot[] | undefined): boolean;
|
|
215
228
|
/**
|
|
216
229
|
* Helper: Update relationDates based on event's dateTime
|
|
217
230
|
* Marks dates as UNAVAILABLE if they no longer exist in the event's dateTime.
|
|
@@ -493,4 +506,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
493
506
|
resourceType: EnumResourceType;
|
|
494
507
|
}): Promise<void>;
|
|
495
508
|
|
|
496
|
-
export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, splitEventDatesForArchive, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, vendorOwnerHasProLicence };
|
|
509
|
+
export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, didRemoveAnyStartedDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, splitEventDatesForArchive, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, vendorOwnerHasProLicence };
|
package/dist/service/index.d.ts
CHANGED
|
@@ -207,11 +207,24 @@ type EventOrMarket = (Pick<EventListItemType, "_id" | "name" | "dateTime"> & {
|
|
|
207
207
|
declare function findEventOrImportedMarketById(resourceId: ObjectId | string | null | undefined): Promise<EventOrMarket>;
|
|
208
208
|
|
|
209
209
|
type EventDateSlot = Pick<DateTimeType$1, "startDate" | "startTime">;
|
|
210
|
+
type StartedDateSlot = Pick<DateTimeType$1, "dateStatus" | "startDate" | "startTime">;
|
|
210
211
|
/**
|
|
211
212
|
* Returns true when at least one startDate/startTime slot from the previous
|
|
212
213
|
* schedule is absent from the next schedule (i.e. a date was removed).
|
|
213
214
|
*/
|
|
214
215
|
declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | undefined, nextDateTime: EventDateSlot[] | undefined): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Returns true when a slot that was `STARTED` in the previous schedule is no
|
|
218
|
+
* longer `STARTED` in the next schedule (e.g. canceled or rescheduled).
|
|
219
|
+
*
|
|
220
|
+
* This catches the `STARTED → CANCELED` transition that
|
|
221
|
+
* {@link didRemoveAnyEventDates} misses: that function only compares
|
|
222
|
+
* `startDate`/`startTime` presence, so a slot that still exists but whose
|
|
223
|
+
* `dateStatus` changed is not flagged. (Its callers filter to future-only
|
|
224
|
+
* schedules, which also drop `STARTED`.) Without this extra status check, a
|
|
225
|
+
* started slot that gets canceled would leave its relation dates untouched.
|
|
226
|
+
*/
|
|
227
|
+
declare function didRemoveAnyStartedDates(previousDateTime: StartedDateSlot[] | undefined, nextDateTime: StartedDateSlot[] | undefined): boolean;
|
|
215
228
|
/**
|
|
216
229
|
* Helper: Update relationDates based on event's dateTime
|
|
217
230
|
* Marks dates as UNAVAILABLE if they no longer exist in the event's dateTime.
|
|
@@ -493,4 +506,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
493
506
|
resourceType: EnumResourceType;
|
|
494
507
|
}): Promise<void>;
|
|
495
508
|
|
|
496
|
-
export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, splitEventDatesForArchive, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, vendorOwnerHasProLicence };
|
|
509
|
+
export { ACTIVE_NOT_DELETED_FILTER, type AwardAffiliateVendorSubscriptionRewardsResult, LicenceCategory, type NotificationPubSub, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, SUBSCRIPTION_REWARD_TIMEZONE, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, buildLicenceExpiryPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dedupeArchivedSlotsByStartDateTime, didRemoveAnyEventDates, didRemoveAnyStartedDates, downgradeVendorProFeatures, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getVendorResourceInfo, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasValidLicence, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, splitEventDatesForArchive, syncUserLicencesAfterExpiry, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, upgradeUserToLicence, vendorOwnerHasProLicence };
|
package/dist/service/index.mjs
CHANGED
|
@@ -894,6 +894,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
894
894
|
|
|
895
895
|
// src/service/relations.ts
|
|
896
896
|
import {
|
|
897
|
+
EnumEventDateStatus as EnumEventDateStatus3,
|
|
897
898
|
EnumInviteStatus
|
|
898
899
|
} from "@timardex/cluemart-shared";
|
|
899
900
|
function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
@@ -906,6 +907,16 @@ function didRemoveAnyEventDates(previousDateTime, nextDateTime) {
|
|
|
906
907
|
)
|
|
907
908
|
);
|
|
908
909
|
}
|
|
910
|
+
function didRemoveAnyStartedDates(previousDateTime, nextDateTime) {
|
|
911
|
+
if (!previousDateTime?.length) {
|
|
912
|
+
return false;
|
|
913
|
+
}
|
|
914
|
+
return previousDateTime.some(
|
|
915
|
+
(prev) => prev.dateStatus === EnumEventDateStatus3.STARTED && !nextDateTime?.some(
|
|
916
|
+
(next) => next.startDate === prev.startDate && next.startTime === prev.startTime && next.dateStatus === EnumEventDateStatus3.STARTED
|
|
917
|
+
)
|
|
918
|
+
);
|
|
919
|
+
}
|
|
909
920
|
function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
910
921
|
return relationDates.map((relationDate) => {
|
|
911
922
|
const existsInEvent = eventDateTime?.some(
|
|
@@ -2053,6 +2064,7 @@ export {
|
|
|
2053
2064
|
createLicenceObject,
|
|
2054
2065
|
dedupeArchivedSlotsByStartDateTime,
|
|
2055
2066
|
didRemoveAnyEventDates,
|
|
2067
|
+
didRemoveAnyStartedDates,
|
|
2056
2068
|
downgradeVendorProFeatures,
|
|
2057
2069
|
ensureUserLicenseCompliance,
|
|
2058
2070
|
ensureUserLicenseComplianceForUser,
|