@timardex/cluemart-server-shared 2.2.1 → 2.2.2
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/{Affiliate-i11rkfv5.d.mts → Affiliate-6AEy-gNx.d.mts} +1 -1
- package/dist/{Affiliate-BSF7Wm6O.d.ts → Affiliate-D40kRxO_.d.ts} +1 -1
- package/dist/{chunk-ZKHRT2PV.mjs → chunk-TIGQ6F5T.mjs} +60 -2
- package/dist/chunk-TIGQ6F5T.mjs.map +1 -0
- package/dist/{chunk-6PNG5BI5.mjs → chunk-TMPPPLIW.mjs} +1 -1
- package/dist/chunk-TMPPPLIW.mjs.map +1 -0
- package/dist/{index-Bq-lT7a2.d.mts → index-CmtBYjpi.d.mts} +4 -0
- package/dist/{index-Bq-lT7a2.d.ts → index-CmtBYjpi.d.ts} +4 -0
- package/dist/index.cjs +183 -189
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +38 -11
- package/dist/index.d.ts +38 -11
- package/dist/index.mjs +82 -91
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +60 -0
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +36 -6
- package/dist/mongoose/index.d.ts +36 -6
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +178 -188
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +5 -12
- package/dist/service/index.d.ts +5 -12
- package/dist/service/index.mjs +9 -76
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-6PNG5BI5.mjs.map +0 -1
- package/dist/chunk-ZKHRT2PV.mjs.map +0 -1
package/dist/service/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as mongoose from 'mongoose';
|
|
2
2
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
3
3
|
import { PromoCodeType, EnumAffiliateRewardType, DateTimeType, EventListItemType, DateTimeWithPriceType, EnumUserLicence as EnumUserLicence$1, UserLicenceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
4
|
+
export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
|
|
5
|
+
import { d as SchemaAffiliateResourceType, S as SchemaOwnerType, g as SchemaRelationType, j as SchemaUserType } from '../Affiliate-6AEy-gNx.mjs';
|
|
6
|
+
import { O as ObjectId, G as GraphQLContext, e as SchemaCreateBulkNotificationInput } from '../index-CmtBYjpi.mjs';
|
|
7
7
|
import { DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
|
|
8
8
|
import { EnumUserLicence } from '@timardex/cluemart-shared/enums';
|
|
9
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
9
10
|
import 'express';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -158,14 +159,6 @@ declare function isValidObjectId(value: string): boolean;
|
|
|
158
159
|
*/
|
|
159
160
|
declare function convertObjectIdsToStrings(obj: any): any;
|
|
160
161
|
|
|
161
|
-
/**
|
|
162
|
-
* Updates the dateStatus field for a single DateTimeType object based on the current date/time.
|
|
163
|
-
* Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
|
|
164
|
-
* @param dateTime The date-time object to update
|
|
165
|
-
* @returns A new object with an updated dateStatus value, or the original
|
|
166
|
-
* object when the stored status is a manual override
|
|
167
|
-
*/
|
|
168
|
-
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
|
|
169
162
|
/**
|
|
170
163
|
* Recomputes dateStatus for every dateTime slot on events and google imported
|
|
171
164
|
* markets, moves ended event date slots into the event date archive, and keeps
|
|
@@ -500,4 +493,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
500
493
|
resourceType: EnumResourceType;
|
|
501
494
|
}): Promise<void>;
|
|
502
495
|
|
|
503
|
-
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,
|
|
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 };
|
package/dist/service/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as mongoose from 'mongoose';
|
|
2
2
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
3
3
|
import { PromoCodeType, EnumAffiliateRewardType, DateTimeType, EventListItemType, DateTimeWithPriceType, EnumUserLicence as EnumUserLicence$1, UserLicenceType, EnumNotificationResourceType, EnumNotificationType, EnumResourceType, LicenceExpiryDate } from '@timardex/cluemart-shared';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
4
|
+
export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
|
|
5
|
+
import { d as SchemaAffiliateResourceType, S as SchemaOwnerType, g as SchemaRelationType, j as SchemaUserType } from '../Affiliate-D40kRxO_.js';
|
|
6
|
+
import { O as ObjectId, G as GraphQLContext, e as SchemaCreateBulkNotificationInput } from '../index-CmtBYjpi.js';
|
|
7
7
|
import { DateTimeType as DateTimeType$1 } from '@timardex/cluemart-shared/types';
|
|
8
8
|
import { EnumUserLicence } from '@timardex/cluemart-shared/enums';
|
|
9
|
+
import dayjs, { Dayjs } from 'dayjs';
|
|
9
10
|
import 'express';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -158,14 +159,6 @@ declare function isValidObjectId(value: string): boolean;
|
|
|
158
159
|
*/
|
|
159
160
|
declare function convertObjectIdsToStrings(obj: any): any;
|
|
160
161
|
|
|
161
|
-
/**
|
|
162
|
-
* Updates the dateStatus field for a single DateTimeType object based on the current date/time.
|
|
163
|
-
* Manual statuses (CANCELED, RE_SCHEDULED) are preserved and returned as-is.
|
|
164
|
-
* @param dateTime The date-time object to update
|
|
165
|
-
* @returns A new object with an updated dateStatus value, or the original
|
|
166
|
-
* object when the stored status is a manual override
|
|
167
|
-
*/
|
|
168
|
-
declare function updateSingleDateTimeStatus<T extends DateTimeType>(dateTime: T, now?: dayjs.Dayjs): T;
|
|
169
162
|
/**
|
|
170
163
|
* Recomputes dateStatus for every dateTime slot on events and google imported
|
|
171
164
|
* markets, moves ended event date slots into the event date archive, and keeps
|
|
@@ -500,4 +493,4 @@ declare function checkOwnerHasLicence({ userId, resourceType, }: {
|
|
|
500
493
|
resourceType: EnumResourceType;
|
|
501
494
|
}): Promise<void>;
|
|
502
495
|
|
|
503
|
-
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,
|
|
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 };
|
package/dist/service/index.mjs
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
PushTokenModel,
|
|
11
11
|
UserModel,
|
|
12
12
|
VendorModel
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
} from "../chunk-TIGQ6F5T.mjs";
|
|
14
|
+
import "../chunk-TMPPPLIW.mjs";
|
|
15
15
|
|
|
16
16
|
// src/service/promoCode/constants.ts
|
|
17
17
|
var ACTIVE_NOT_DELETED_FILTER = {
|
|
@@ -613,14 +613,11 @@ function convertObjectIdsToStrings(obj) {
|
|
|
613
613
|
|
|
614
614
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
615
615
|
import {
|
|
616
|
-
dateFormat,
|
|
617
616
|
EnumEventDateStatus as EnumEventDateStatus2,
|
|
618
617
|
filterDatesByFutureStatus,
|
|
619
|
-
|
|
618
|
+
updateSingleDateTimeStatus
|
|
620
619
|
} from "@timardex/cluemart-shared";
|
|
621
620
|
import dayjs2 from "dayjs";
|
|
622
|
-
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
623
|
-
import isoWeek from "dayjs/plugin/isoWeek";
|
|
624
621
|
|
|
625
622
|
// src/service/event/archiveEndedEventDates.ts
|
|
626
623
|
import { EnumEventDateStatus } from "@timardex/cluemart-shared";
|
|
@@ -663,73 +660,6 @@ async function persistArchivedEventDates(eventId, slots) {
|
|
|
663
660
|
}
|
|
664
661
|
|
|
665
662
|
// src/service/event/updateAllEventDateTimeStatuses.ts
|
|
666
|
-
dayjs2.extend(customParseFormat);
|
|
667
|
-
dayjs2.extend(isoWeek);
|
|
668
|
-
var MANUAL_DATE_STATUSES = /* @__PURE__ */ new Set([
|
|
669
|
-
EnumEventDateStatus2.CANCELED,
|
|
670
|
-
EnumEventDateStatus2.RE_SCHEDULED
|
|
671
|
-
]);
|
|
672
|
-
function getFutureEventStatus(startDateTime, now) {
|
|
673
|
-
const hoursUntilStart = startDateTime.diff(now, "hour", true);
|
|
674
|
-
if (hoursUntilStart > 0 && hoursUntilStart <= 4) {
|
|
675
|
-
return EnumEventDateStatus2.STARTING_SOON;
|
|
676
|
-
}
|
|
677
|
-
if (startDateTime.isSame(now, "day")) {
|
|
678
|
-
return EnumEventDateStatus2.TODAY;
|
|
679
|
-
}
|
|
680
|
-
if (startDateTime.isSame(now.add(1, "day"), "day")) {
|
|
681
|
-
return EnumEventDateStatus2.TOMORROW;
|
|
682
|
-
}
|
|
683
|
-
if (startDateTime.isSame(now, "isoWeek")) {
|
|
684
|
-
return EnumEventDateStatus2.THIS_WEEK;
|
|
685
|
-
}
|
|
686
|
-
if (startDateTime.isSame(now.add(1, "week"), "isoWeek")) {
|
|
687
|
-
return EnumEventDateStatus2.NEXT_WEEK;
|
|
688
|
-
}
|
|
689
|
-
return EnumEventDateStatus2.UPCOMING;
|
|
690
|
-
}
|
|
691
|
-
function updateSingleDateTimeStatus(dateTime, now = dayjs2()) {
|
|
692
|
-
if (MANUAL_DATE_STATUSES.has(dateTime.dateStatus)) {
|
|
693
|
-
return dateTime;
|
|
694
|
-
}
|
|
695
|
-
const dateTimeFormat = `${dateFormat} ${timeFormat}`;
|
|
696
|
-
const startDateTime = dayjs2(
|
|
697
|
-
`${dateTime.startDate} ${dateTime.startTime}`,
|
|
698
|
-
dateTimeFormat,
|
|
699
|
-
true
|
|
700
|
-
);
|
|
701
|
-
const endDateTime = dayjs2(
|
|
702
|
-
`${dateTime.endDate} ${dateTime.endTime}`,
|
|
703
|
-
dateTimeFormat,
|
|
704
|
-
true
|
|
705
|
-
);
|
|
706
|
-
if (!startDateTime.isValid() || !endDateTime.isValid()) {
|
|
707
|
-
return {
|
|
708
|
-
...dateTime,
|
|
709
|
-
dateStatus: EnumEventDateStatus2.INVALID
|
|
710
|
-
};
|
|
711
|
-
}
|
|
712
|
-
if (endDateTime.isBefore(startDateTime)) {
|
|
713
|
-
return {
|
|
714
|
-
...dateTime,
|
|
715
|
-
dateStatus: EnumEventDateStatus2.INVALID
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
let dateStatus;
|
|
719
|
-
if (endDateTime.isAfter(now)) {
|
|
720
|
-
if (startDateTime.isAfter(now)) {
|
|
721
|
-
dateStatus = getFutureEventStatus(startDateTime, now);
|
|
722
|
-
} else {
|
|
723
|
-
dateStatus = EnumEventDateStatus2.STARTED;
|
|
724
|
-
}
|
|
725
|
-
} else {
|
|
726
|
-
dateStatus = EnumEventDateStatus2.ENDED;
|
|
727
|
-
}
|
|
728
|
-
return {
|
|
729
|
-
...dateTime,
|
|
730
|
-
dateStatus
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
663
|
var dateTimeStatusFilter = {
|
|
734
664
|
dateTime: { $ne: [], $type: "array" },
|
|
735
665
|
deletedAt: null
|
|
@@ -908,6 +838,9 @@ async function updateAllEventDateTimeStatuses() {
|
|
|
908
838
|
}
|
|
909
839
|
}
|
|
910
840
|
|
|
841
|
+
// src/service/index.ts
|
|
842
|
+
import { updateSingleDateTimeStatus as updateSingleDateTimeStatus2 } from "@timardex/cluemart-shared";
|
|
843
|
+
|
|
911
844
|
// src/service/event/findEventOrImportedMarketById.ts
|
|
912
845
|
async function findEventOrImportedMarketById(resourceId) {
|
|
913
846
|
if (!resourceId) {
|
|
@@ -1799,7 +1732,7 @@ var REMINDER_WINDOW_MAX_HOURS = 7.5 * 24;
|
|
|
1799
1732
|
|
|
1800
1733
|
// src/service/license/reminder/utils.ts
|
|
1801
1734
|
import {
|
|
1802
|
-
dateFormat
|
|
1735
|
+
dateFormat,
|
|
1803
1736
|
EnumNotificationResourceType as EnumNotificationResourceType4,
|
|
1804
1737
|
EnumNotificationType as EnumNotificationType4,
|
|
1805
1738
|
EnumUserLicence as EnumUserLicence8,
|
|
@@ -1944,7 +1877,7 @@ function getLicenceExpiryMode(licenceType) {
|
|
|
1944
1877
|
}
|
|
1945
1878
|
async function sendLicenseReminder(user, licence) {
|
|
1946
1879
|
const licenceName = getLicenseName(licence.licenceType);
|
|
1947
|
-
const expiryDate = dayjs7(licence.expiryDate).format(
|
|
1880
|
+
const expiryDate = dayjs7(licence.expiryDate).format(dateFormat);
|
|
1948
1881
|
const userId = String(user._id);
|
|
1949
1882
|
const resourceInfo = await getLicenseResourceInfo(user, licence);
|
|
1950
1883
|
if (!resourceInfo) {
|
|
@@ -2129,7 +2062,7 @@ export {
|
|
|
2129
2062
|
updateAdStatuses,
|
|
2130
2063
|
updateAllEventDateTimeStatuses,
|
|
2131
2064
|
updateRelationDatesToUnavailable,
|
|
2132
|
-
updateSingleDateTimeStatus,
|
|
2065
|
+
updateSingleDateTimeStatus2 as updateSingleDateTimeStatus,
|
|
2133
2066
|
upgradeUserToLicence,
|
|
2134
2067
|
vendorOwnerHasProLicence
|
|
2135
2068
|
};
|