@timardex/cluemart-server-shared 5.0.0 → 5.3.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, AdMetricsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, AssociateType, EnumAssociateStatus, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, AiImportedMarket, EnumImportedMarketDeactivationReason, EnumAiImportRunStatus, AiImportUsage, ScrapeSite, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EnumPointType, UserOverallPointsEntry, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, AdMetricsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, AssociateType, EnumAssociateStatus, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, EnumImportedMarketDeactivationReason, AiImportedMarket, EnumAiImportRunStatus, AiImportUsage, ScrapeSite, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EnumPointType, UserOverallPointsEntry, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate, isProLicenceType, isStandardLicenceType } from '@timardex/cluemart-shared';
3
3
  export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
4
4
  import * as mongoose from 'mongoose';
5
5
  import mongoose__default from 'mongoose';
@@ -522,6 +522,14 @@ declare const baseResourceFields: {
522
522
  type SchemaGoogleImportedMarket = Omit<GoogleImportedMarket, "eventId" | "claimedByUserId"> & {
523
523
  eventId?: mongoose__default.Types.ObjectId;
524
524
  claimedByUserId?: mongoose__default.Types.ObjectId;
525
+ /**
526
+ * Why an inactive market was switched off: `STALE` when the source reported the
527
+ * place as no longer operational (only the crawler may switch it back on),
528
+ * `ADMIN` when an admin did it (the crawler must leave it alone). Absent on
529
+ * markets deactivated before the reason existed, which are treated as
530
+ * admin-owned — the conservative default.
531
+ */
532
+ deactivatedReason?: EnumImportedMarketDeactivationReason | null;
525
533
  /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */
526
534
  searchName?: string;
527
535
  /** Indexed earliest `dateTime` start instant for chronological pagination. */
@@ -530,6 +538,14 @@ type SchemaGoogleImportedMarket = Omit<GoogleImportedMarket, "eventId" | "claime
530
538
  declare const GoogleImportedMarketModel: mongoose__default.Model<SchemaGoogleImportedMarket, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaGoogleImportedMarket, {}, {}> & Omit<GoogleImportedMarket, "eventId" | "claimedByUserId"> & {
531
539
  eventId?: mongoose__default.Types.ObjectId;
532
540
  claimedByUserId?: mongoose__default.Types.ObjectId;
541
+ /**
542
+ * Why an inactive market was switched off: `STALE` when the source reported the
543
+ * place as no longer operational (only the crawler may switch it back on),
544
+ * `ADMIN` when an admin did it (the crawler must leave it alone). Absent on
545
+ * markets deactivated before the reason existed, which are treated as
546
+ * admin-owned — the conservative default.
547
+ */
548
+ deactivatedReason?: EnumImportedMarketDeactivationReason | null;
533
549
  /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */
534
550
  searchName?: string;
535
551
  /** Indexed earliest `dateTime` start instant for chronological pagination. */
@@ -880,6 +896,19 @@ declare const vendorProductTypeSchema: mongoose__default.Schema<VendorProductLis
880
896
  type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenceType" | "adIds" | "associates" | "unregisteredVendorId"> & {
881
897
  adIds?: ObjectId[];
882
898
  associates?: SchemaAssociateType[] | null;
899
+ /** When the owner was told their vendor licence was downgraded. */
900
+ downgradeNotifiedAt?: Date | null;
901
+ /**
902
+ * True while the vendor runs the downgraded feature set. Written by the
903
+ * downgrade and cleared by the upgrade, so a second downgrade can tell it has
904
+ * nothing left to do instead of snapshotting the already-downgraded state.
905
+ */
906
+ featuresDowngraded?: boolean;
907
+ /**
908
+ * Bumped by every licence-driven feature write (downgrade and restore), so a
909
+ * downgrade can tell whether an upgrade landed after it read the vendor.
910
+ */
911
+ licenceEpoch?: number;
883
912
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
884
913
  categoriesNames?: string[];
885
914
  owner: SchemaOwnerType;
@@ -891,6 +920,19 @@ type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenc
891
920
  declare const VendorModel: mongoose__default.Model<SchemaVendorType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaVendorType, {}, {}> & Omit<VendorType, "adIds" | "associates" | "owner" | "ownerLicenceType" | "vendorInfoId" | "unregisteredVendorId"> & {
892
921
  adIds?: ObjectId[];
893
922
  associates?: SchemaAssociateType[] | null;
923
+ /** When the owner was told their vendor licence was downgraded. */
924
+ downgradeNotifiedAt?: Date | null;
925
+ /**
926
+ * True while the vendor runs the downgraded feature set. Written by the
927
+ * downgrade and cleared by the upgrade, so a second downgrade can tell it has
928
+ * nothing left to do instead of snapshotting the already-downgraded state.
929
+ */
930
+ featuresDowngraded?: boolean;
931
+ /**
932
+ * Bumped by every licence-driven feature write (downgrade and restore), so a
933
+ * downgrade can tell whether an upgrade landed after it read the vendor.
934
+ */
935
+ licenceEpoch?: number;
894
936
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
895
937
  categoriesNames?: string[];
896
938
  owner: SchemaOwnerType;
@@ -1306,6 +1348,67 @@ declare function getAssociateAccessMeta(resourceType: AssociableResourceType): {
1306
1348
  associatedPath: string;
1307
1349
  associateRole: EnumUserRole;
1308
1350
  };
1351
+ /**
1352
+ * A pinned bookkeeping timestamp for a concurrency filter.
1353
+ *
1354
+ * - `null` matches both a stored `null` and a missing path, so a legacy entry
1355
+ * that never wrote the field still matches.
1356
+ * - A date is pinned together with `null` (`$in`) because mongoose hydrates the
1357
+ * schema default for a missing path: without the `null` alternative, an entry
1358
+ * written before the field existed could never be matched again. A re-created
1359
+ * invitation always carries a fresh non-null `addedAt`, so the alternative
1360
+ * cannot hide a replacement.
1361
+ */
1362
+ type PinnedAssociateTimestamp = Date | null | {
1363
+ $in: Array<Date | null>;
1364
+ };
1365
+ declare function pinAssociateTimestamp(value: Date | null | undefined): PinnedAssociateTimestamp;
1366
+ type AssociatesWriteGuard = {
1367
+ /** Conditions the stored document must still satisfy for the write to apply. */
1368
+ filter: {
1369
+ associates?: {
1370
+ $size: number;
1371
+ };
1372
+ $and?: Array<{
1373
+ associates: {
1374
+ $elemMatch: {
1375
+ addedAt: PinnedAssociateTimestamp;
1376
+ respondedAt: PinnedAssociateTimestamp;
1377
+ status: SchemaAssociateType["status"];
1378
+ userId: SchemaAssociateType["userId"];
1379
+ };
1380
+ };
1381
+ }>;
1382
+ $or?: Array<{
1383
+ associates: {
1384
+ $size: number;
1385
+ };
1386
+ } | {
1387
+ associates: null;
1388
+ }>;
1389
+ };
1390
+ /** The associate list to persist. */
1391
+ update: {
1392
+ associates: SchemaAssociateType[];
1393
+ };
1394
+ };
1395
+ /**
1396
+ * Builds the `associates` half of a resource update, or `null` when the array
1397
+ * must not be written at all: the actor may not manage it, or the payload did
1398
+ * not carry an `associates` field (clients that omit it keep the stored list).
1399
+ *
1400
+ * Access grants are never written from a stale snapshot. The returned filter
1401
+ * pins membership, statuses **and** the invitation timestamps to what the caller
1402
+ * validated against, so a concurrent acceptance, removal or replacement makes
1403
+ * the update miss instead of resurrecting revoked access or reverting an
1404
+ * accepted invitation. Treat a miss as a conflict (see
1405
+ * {@link throwAssociatesChangedError}).
1406
+ */
1407
+ declare function buildAssociatesWriteGuard({ canManage, nextAssociates, snapshot, }: {
1408
+ canManage: boolean;
1409
+ nextAssociates: SchemaAssociateType[];
1410
+ snapshot?: SchemaAssociateType[] | null;
1411
+ }): AssociatesWriteGuard | null;
1309
1412
  /** The users a resource currently grants associate access to. */
1310
1413
  declare function acceptedAssociateUserIds(associates?: SchemaAssociateType[] | null): ObjectId[];
1311
1414
  /**
@@ -1371,6 +1474,9 @@ declare function grantAssociateGrants({ resourceId, resourceType, userIds, }: {
1371
1474
  * instead makes the call idempotent and convergent — the same call repairs a
1372
1475
  * removal whose side effect was lost, whether it comes from a retry, the next
1373
1476
  * edit of the resource, or the cron reconciliation job.
1477
+ *
1478
+ * The grant of a user the resource still accepts is handed back, so a caller's
1479
+ * stale `acceptedUserIds` never strips access the resource grants.
1374
1480
  */
1375
1481
  declare function detachStaleAssociateGrants({ acceptedUserIds, resourceId, resourceType, }: {
1376
1482
  /** Users the resource currently lists as `ACCEPTED`. */
@@ -1864,10 +1970,7 @@ declare function syncUserLicencesAfterExpiry(userId: ObjectId, licenceTypes: Enu
1864
1970
  * Checks if user has a valid licence of the given types
1865
1971
  */
1866
1972
  declare function hasValidLicence(licences: UserLicenceType[], licenceTypes: EnumUserLicence[], now: dayjs.Dayjs): boolean;
1867
- /**
1868
- * Sends a deactivation notification to the user
1869
- */
1870
- declare function sendDeactivationNotification(payload: {
1973
+ type DeactivationNotificationPayload = {
1871
1974
  data: {
1872
1975
  resourceId: string;
1873
1976
  resourceName: string;
@@ -1877,7 +1980,17 @@ declare function sendDeactivationNotification(payload: {
1877
1980
  title: string;
1878
1981
  type: EnumNotificationType;
1879
1982
  userIds: ObjectId[];
1880
- }, userId: ObjectId, resourceName: string, resourceType: string): Promise<void>;
1983
+ };
1984
+ /**
1985
+ * Sends a deactivation notification to the user.
1986
+ *
1987
+ * `retryOf` is the previous attempt's timestamp: when the stored in-app notice
1988
+ * from that attempt (or later) already exists, the notice is not sent again, so
1989
+ * a retried run does not duplicate it.
1990
+ *
1991
+ * Returns whether the notice is stored.
1992
+ */
1993
+ declare function sendDeactivationNotification(payload: DeactivationNotificationPayload, userId: ObjectId, resourceName: string, resourceType: string, retryOf?: Date | null): Promise<boolean>;
1881
1994
  /**
1882
1995
  * Processes license compliance for a single user
1883
1996
  */
@@ -2008,10 +2121,23 @@ declare enum LicenceCategory {
2008
2121
  }
2009
2122
  declare const licenceCategoryMapping: Record<EnumUserLicence, LicenceCategory>;
2010
2123
  declare const licencePriority: Record<EnumUserLicence, number>;
2011
- declare const standardLicences: readonly [EnumUserLicence.STANDARD_VENDOR, EnumUserLicence.STANDARD_EVENT, EnumUserLicence.STANDARD_PARTNER];
2012
- declare function isStandardLicence(licence: EnumUserLicence): licence is (typeof standardLicences)[number];
2013
- declare const proLicences: readonly [EnumUserLicence.PRO_EVENT, EnumUserLicence.PRO_PLUS_EVENT, EnumUserLicence.PRO_VENDOR, EnumUserLicence.PRO_PLUS_VENDOR];
2014
- declare function isProLicence(licence: EnumUserLicence): licence is (typeof proLicences)[number];
2124
+ /**
2125
+ * True for the STANDARD tier of Event, Partner or Vendor.
2126
+ *
2127
+ * Defined once in `cluemart-shared` (`isStandardLicenceType`), next to the
2128
+ * `isProLicenceType` rule, and re-exported here under this historical name for
2129
+ * existing importers of `@timardex/cluemart-server-shared`.
2130
+ */
2131
+ declare const isStandardLicence: typeof isStandardLicenceType;
2132
+ /**
2133
+ * True for the paid PRO / PRO_PLUS tiers of any resource category.
2134
+ *
2135
+ * The rule itself is defined once, in `cluemart-shared` (`isProLicenceType`),
2136
+ * and reused here so the mobile client, this package and the server cannot
2137
+ * disagree about what counts as PRO. This name is kept for existing importers of
2138
+ * `@timardex/cluemart-server-shared`.
2139
+ */
2140
+ declare const isProLicence: typeof isProLicenceType;
2015
2141
  type LicenceUpgradeArgs = {
2016
2142
  expiryDate: LicenceExpiryDate;
2017
2143
  licenceType: EnumUserLicence;
@@ -2093,4 +2219,4 @@ declare function hasActiveProLicenceForResource({ includeStripeProtected, userId
2093
2219
  resourceType: EnumResourceType;
2094
2220
  }): Promise<boolean>;
2095
2221
 
2096
- export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, AI_IMPORT_RUN_LOCK_KEY, APP_SETTINGS_ID, type ActiveLicenceOptions, AdBillingCatalogModel, AdBookingModel, AdMetricsModel, AdModel, AdPurchaseModel, AffiliateModel, AiImportRunLockModel, AiImportRunModel, type AiImportRunStatus, type AiImportSiteResult, AiImportedMarketModel, type AiImportedMarketReference, AppSettingModel, type AssociableResourceType, AssociateTypeSchema, AuthHandoffTokenModel, type AuthHandoffTokenType, type AuthTokenClient, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, type DetachedAssociateGrants, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, type EventOrImportedMarketLookupOptions, type EventOrImportedMarketMatch, type EventOrImportedMarketReferenceMatch, type EventReference, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, type ImportedMarketReference, type IndexBuildFailure, type IndexableModel, LIVE_RESOURCE_FILTER, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, type ReconcileAssociateGrantsResult, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SCRAPE_SITES_CONFIG_ID, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAiImportRun, type SchemaAiImportedMarket, type SchemaAppSettingsType, type SchemaAssociateType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserAssociatedResourcesType, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, ScrapeSiteConfigModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, acceptedAssociateUserIds, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, buildUserHasEnoughPointsFilter, buildUserPointAwardEntry, buildUserPointCreditFilter, buildUserPointDebitPipeline, buildUserPointEntryRemovalPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, detachAssociateGrantsForResources, detachStaleAssociateGrants, detachUsersFromResource, didRemoveAnyEventDates, didRemoveAnyStartedDates, downgradeVendorProFeatures, ensureDatabaseIndexes, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, findEventOrImportedMarketDetailsById, getActiveLicenceForResource, getAssociateAccessMeta, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getUserIdsWithActiveProLicence, getVendorResourceInfo, grantAssociateGrants, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasActiveProLicenceForResource, hasValidLicence, isAssociableResourceType, isLiveResource, isProLicence, isProtectedByCurrentStripeSubscription, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, reconcileAssociateGrants, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToCanceled, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
2222
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, AI_IMPORT_RUN_LOCK_KEY, APP_SETTINGS_ID, type ActiveLicenceOptions, AdBillingCatalogModel, AdBookingModel, AdMetricsModel, AdModel, AdPurchaseModel, AffiliateModel, AiImportRunLockModel, AiImportRunModel, type AiImportRunStatus, type AiImportSiteResult, AiImportedMarketModel, type AiImportedMarketReference, AppSettingModel, type AssociableResourceType, AssociateTypeSchema, type AssociatesWriteGuard, AuthHandoffTokenModel, type AuthHandoffTokenType, type AuthTokenClient, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, type DetachedAssociateGrants, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, type EventOrImportedMarketLookupOptions, type EventOrImportedMarketMatch, type EventOrImportedMarketReferenceMatch, type EventReference, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, type ImportedMarketReference, type IndexBuildFailure, type IndexableModel, LIVE_RESOURCE_FILTER, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, type PinnedAssociateTimestamp, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, type ReconcileAssociateGrantsResult, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SCRAPE_SITES_CONFIG_ID, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAiImportRun, type SchemaAiImportedMarket, type SchemaAppSettingsType, type SchemaAssociateType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserAssociatedResourcesType, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, ScrapeSiteConfigModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, acceptedAssociateUserIds, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildAssociatesWriteGuard, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, buildUserHasEnoughPointsFilter, buildUserPointAwardEntry, buildUserPointCreditFilter, buildUserPointDebitPipeline, buildUserPointEntryRemovalPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, detachAssociateGrantsForResources, detachStaleAssociateGrants, detachUsersFromResource, didRemoveAnyEventDates, didRemoveAnyStartedDates, downgradeVendorProFeatures, ensureDatabaseIndexes, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, findEventOrImportedMarketDetailsById, getActiveLicenceForResource, getAssociateAccessMeta, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getUserIdsWithActiveProLicence, getVendorResourceInfo, grantAssociateGrants, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasActiveProLicenceForResource, hasValidLicence, isAssociableResourceType, isLiveResource, isProLicence, isProtectedByCurrentStripeSubscription, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, pinAssociateTimestamp, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, reconcileAssociateGrants, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToCanceled, 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, AdMetricsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, AssociateType, EnumAssociateStatus, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, AiImportedMarket, EnumImportedMarketDeactivationReason, EnumAiImportRunStatus, AiImportUsage, ScrapeSite, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EnumPointType, UserOverallPointsEntry, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate } from '@timardex/cluemart-shared';
2
+ import { AdType, AdDailyPriceType, AdBookingType, AdMetricsType, ChatType, ParticipantType, ChatMessageType, NotificationType, CreateBulkNotificationInput, EnumUserRole, BillingCatalogEntryType, BillingCatalogPriceHistoryEntry, EnumBillingPeriod, EnumUserLicence, BILLING_CATALOG_KEYS, ReportChatUser, OwnerType, AssociateType, EnumAssociateStatus, Category, ResourceContactDetailsType, ResourceImageType, RelatedPostType, SocialMediaType, PosterUsageType, SocialShareResourceType, TermsAgreement, DateTimeType, LocationGeoType, LocationType, UserLicenceType, GoogleImportedMarket, EnumImportedMarketDeactivationReason, AiImportedMarket, EnumAiImportRunStatus, AiImportUsage, ScrapeSite, PushTokenType, RelationType, RelationDate, ResourceActivityType, StripeSubscription, UserActivityEvent, UserType, VendorType, VendorProductList, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, EventInfoType, StallType, RefundPolicy, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameDocType, GameType, SchoolType, AffiliateType, AffiliateResourceType, AffiliateRewardType, CouponType, CouponDataType, CouponParticipantUserType, EnumResourceType, PromoCodeType, EnumAffiliateRewardType, EnumPointType, UserOverallPointsEntry, DateTimeWithPriceType, EnumNotificationResourceType, EnumNotificationType, LicenceExpiryDate, isProLicenceType, isStandardLicenceType } from '@timardex/cluemart-shared';
3
3
  export { updateSingleDateTimeStatus } from '@timardex/cluemart-shared';
4
4
  import * as mongoose from 'mongoose';
5
5
  import mongoose__default from 'mongoose';
@@ -522,6 +522,14 @@ declare const baseResourceFields: {
522
522
  type SchemaGoogleImportedMarket = Omit<GoogleImportedMarket, "eventId" | "claimedByUserId"> & {
523
523
  eventId?: mongoose__default.Types.ObjectId;
524
524
  claimedByUserId?: mongoose__default.Types.ObjectId;
525
+ /**
526
+ * Why an inactive market was switched off: `STALE` when the source reported the
527
+ * place as no longer operational (only the crawler may switch it back on),
528
+ * `ADMIN` when an admin did it (the crawler must leave it alone). Absent on
529
+ * markets deactivated before the reason existed, which are treated as
530
+ * admin-owned — the conservative default.
531
+ */
532
+ deactivatedReason?: EnumImportedMarketDeactivationReason | null;
525
533
  /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */
526
534
  searchName?: string;
527
535
  /** Indexed earliest `dateTime` start instant for chronological pagination. */
@@ -530,6 +538,14 @@ type SchemaGoogleImportedMarket = Omit<GoogleImportedMarket, "eventId" | "claime
530
538
  declare const GoogleImportedMarketModel: mongoose__default.Model<SchemaGoogleImportedMarket, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaGoogleImportedMarket, {}, {}> & Omit<GoogleImportedMarket, "eventId" | "claimedByUserId"> & {
531
539
  eventId?: mongoose__default.Types.ObjectId;
532
540
  claimedByUserId?: mongoose__default.Types.ObjectId;
541
+ /**
542
+ * Why an inactive market was switched off: `STALE` when the source reported the
543
+ * place as no longer operational (only the crawler may switch it back on),
544
+ * `ADMIN` when an admin did it (the crawler must leave it alone). Absent on
545
+ * markets deactivated before the reason existed, which are treated as
546
+ * admin-owned — the conservative default.
547
+ */
548
+ deactivatedReason?: EnumImportedMarketDeactivationReason | null;
533
549
  /** Lowercase `name` mirror for prefix type-ahead (see searchNamePlugin). */
534
550
  searchName?: string;
535
551
  /** Indexed earliest `dateTime` start instant for chronological pagination. */
@@ -880,6 +896,19 @@ declare const vendorProductTypeSchema: mongoose__default.Schema<VendorProductLis
880
896
  type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenceType" | "adIds" | "associates" | "unregisteredVendorId"> & {
881
897
  adIds?: ObjectId[];
882
898
  associates?: SchemaAssociateType[] | null;
899
+ /** When the owner was told their vendor licence was downgraded. */
900
+ downgradeNotifiedAt?: Date | null;
901
+ /**
902
+ * True while the vendor runs the downgraded feature set. Written by the
903
+ * downgrade and cleared by the upgrade, so a second downgrade can tell it has
904
+ * nothing left to do instead of snapshotting the already-downgraded state.
905
+ */
906
+ featuresDowngraded?: boolean;
907
+ /**
908
+ * Bumped by every licence-driven feature write (downgrade and restore), so a
909
+ * downgrade can tell whether an upgrade landed after it read the vendor.
910
+ */
911
+ licenceEpoch?: number;
883
912
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
884
913
  categoriesNames?: string[];
885
914
  owner: SchemaOwnerType;
@@ -891,6 +920,19 @@ type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenc
891
920
  declare const VendorModel: mongoose__default.Model<SchemaVendorType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaVendorType, {}, {}> & Omit<VendorType, "adIds" | "associates" | "owner" | "ownerLicenceType" | "vendorInfoId" | "unregisteredVendorId"> & {
892
921
  adIds?: ObjectId[];
893
922
  associates?: SchemaAssociateType[] | null;
923
+ /** When the owner was told their vendor licence was downgraded. */
924
+ downgradeNotifiedAt?: Date | null;
925
+ /**
926
+ * True while the vendor runs the downgraded feature set. Written by the
927
+ * downgrade and cleared by the upgrade, so a second downgrade can tell it has
928
+ * nothing left to do instead of snapshotting the already-downgraded state.
929
+ */
930
+ featuresDowngraded?: boolean;
931
+ /**
932
+ * Bumped by every licence-driven feature write (downgrade and restore), so a
933
+ * downgrade can tell whether an upgrade landed after it read the vendor.
934
+ */
935
+ licenceEpoch?: number;
894
936
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
895
937
  categoriesNames?: string[];
896
938
  owner: SchemaOwnerType;
@@ -1306,6 +1348,67 @@ declare function getAssociateAccessMeta(resourceType: AssociableResourceType): {
1306
1348
  associatedPath: string;
1307
1349
  associateRole: EnumUserRole;
1308
1350
  };
1351
+ /**
1352
+ * A pinned bookkeeping timestamp for a concurrency filter.
1353
+ *
1354
+ * - `null` matches both a stored `null` and a missing path, so a legacy entry
1355
+ * that never wrote the field still matches.
1356
+ * - A date is pinned together with `null` (`$in`) because mongoose hydrates the
1357
+ * schema default for a missing path: without the `null` alternative, an entry
1358
+ * written before the field existed could never be matched again. A re-created
1359
+ * invitation always carries a fresh non-null `addedAt`, so the alternative
1360
+ * cannot hide a replacement.
1361
+ */
1362
+ type PinnedAssociateTimestamp = Date | null | {
1363
+ $in: Array<Date | null>;
1364
+ };
1365
+ declare function pinAssociateTimestamp(value: Date | null | undefined): PinnedAssociateTimestamp;
1366
+ type AssociatesWriteGuard = {
1367
+ /** Conditions the stored document must still satisfy for the write to apply. */
1368
+ filter: {
1369
+ associates?: {
1370
+ $size: number;
1371
+ };
1372
+ $and?: Array<{
1373
+ associates: {
1374
+ $elemMatch: {
1375
+ addedAt: PinnedAssociateTimestamp;
1376
+ respondedAt: PinnedAssociateTimestamp;
1377
+ status: SchemaAssociateType["status"];
1378
+ userId: SchemaAssociateType["userId"];
1379
+ };
1380
+ };
1381
+ }>;
1382
+ $or?: Array<{
1383
+ associates: {
1384
+ $size: number;
1385
+ };
1386
+ } | {
1387
+ associates: null;
1388
+ }>;
1389
+ };
1390
+ /** The associate list to persist. */
1391
+ update: {
1392
+ associates: SchemaAssociateType[];
1393
+ };
1394
+ };
1395
+ /**
1396
+ * Builds the `associates` half of a resource update, or `null` when the array
1397
+ * must not be written at all: the actor may not manage it, or the payload did
1398
+ * not carry an `associates` field (clients that omit it keep the stored list).
1399
+ *
1400
+ * Access grants are never written from a stale snapshot. The returned filter
1401
+ * pins membership, statuses **and** the invitation timestamps to what the caller
1402
+ * validated against, so a concurrent acceptance, removal or replacement makes
1403
+ * the update miss instead of resurrecting revoked access or reverting an
1404
+ * accepted invitation. Treat a miss as a conflict (see
1405
+ * {@link throwAssociatesChangedError}).
1406
+ */
1407
+ declare function buildAssociatesWriteGuard({ canManage, nextAssociates, snapshot, }: {
1408
+ canManage: boolean;
1409
+ nextAssociates: SchemaAssociateType[];
1410
+ snapshot?: SchemaAssociateType[] | null;
1411
+ }): AssociatesWriteGuard | null;
1309
1412
  /** The users a resource currently grants associate access to. */
1310
1413
  declare function acceptedAssociateUserIds(associates?: SchemaAssociateType[] | null): ObjectId[];
1311
1414
  /**
@@ -1371,6 +1474,9 @@ declare function grantAssociateGrants({ resourceId, resourceType, userIds, }: {
1371
1474
  * instead makes the call idempotent and convergent — the same call repairs a
1372
1475
  * removal whose side effect was lost, whether it comes from a retry, the next
1373
1476
  * edit of the resource, or the cron reconciliation job.
1477
+ *
1478
+ * The grant of a user the resource still accepts is handed back, so a caller's
1479
+ * stale `acceptedUserIds` never strips access the resource grants.
1374
1480
  */
1375
1481
  declare function detachStaleAssociateGrants({ acceptedUserIds, resourceId, resourceType, }: {
1376
1482
  /** Users the resource currently lists as `ACCEPTED`. */
@@ -1864,10 +1970,7 @@ declare function syncUserLicencesAfterExpiry(userId: ObjectId, licenceTypes: Enu
1864
1970
  * Checks if user has a valid licence of the given types
1865
1971
  */
1866
1972
  declare function hasValidLicence(licences: UserLicenceType[], licenceTypes: EnumUserLicence[], now: dayjs.Dayjs): boolean;
1867
- /**
1868
- * Sends a deactivation notification to the user
1869
- */
1870
- declare function sendDeactivationNotification(payload: {
1973
+ type DeactivationNotificationPayload = {
1871
1974
  data: {
1872
1975
  resourceId: string;
1873
1976
  resourceName: string;
@@ -1877,7 +1980,17 @@ declare function sendDeactivationNotification(payload: {
1877
1980
  title: string;
1878
1981
  type: EnumNotificationType;
1879
1982
  userIds: ObjectId[];
1880
- }, userId: ObjectId, resourceName: string, resourceType: string): Promise<void>;
1983
+ };
1984
+ /**
1985
+ * Sends a deactivation notification to the user.
1986
+ *
1987
+ * `retryOf` is the previous attempt's timestamp: when the stored in-app notice
1988
+ * from that attempt (or later) already exists, the notice is not sent again, so
1989
+ * a retried run does not duplicate it.
1990
+ *
1991
+ * Returns whether the notice is stored.
1992
+ */
1993
+ declare function sendDeactivationNotification(payload: DeactivationNotificationPayload, userId: ObjectId, resourceName: string, resourceType: string, retryOf?: Date | null): Promise<boolean>;
1881
1994
  /**
1882
1995
  * Processes license compliance for a single user
1883
1996
  */
@@ -2008,10 +2121,23 @@ declare enum LicenceCategory {
2008
2121
  }
2009
2122
  declare const licenceCategoryMapping: Record<EnumUserLicence, LicenceCategory>;
2010
2123
  declare const licencePriority: Record<EnumUserLicence, number>;
2011
- declare const standardLicences: readonly [EnumUserLicence.STANDARD_VENDOR, EnumUserLicence.STANDARD_EVENT, EnumUserLicence.STANDARD_PARTNER];
2012
- declare function isStandardLicence(licence: EnumUserLicence): licence is (typeof standardLicences)[number];
2013
- declare const proLicences: readonly [EnumUserLicence.PRO_EVENT, EnumUserLicence.PRO_PLUS_EVENT, EnumUserLicence.PRO_VENDOR, EnumUserLicence.PRO_PLUS_VENDOR];
2014
- declare function isProLicence(licence: EnumUserLicence): licence is (typeof proLicences)[number];
2124
+ /**
2125
+ * True for the STANDARD tier of Event, Partner or Vendor.
2126
+ *
2127
+ * Defined once in `cluemart-shared` (`isStandardLicenceType`), next to the
2128
+ * `isProLicenceType` rule, and re-exported here under this historical name for
2129
+ * existing importers of `@timardex/cluemart-server-shared`.
2130
+ */
2131
+ declare const isStandardLicence: typeof isStandardLicenceType;
2132
+ /**
2133
+ * True for the paid PRO / PRO_PLUS tiers of any resource category.
2134
+ *
2135
+ * The rule itself is defined once, in `cluemart-shared` (`isProLicenceType`),
2136
+ * and reused here so the mobile client, this package and the server cannot
2137
+ * disagree about what counts as PRO. This name is kept for existing importers of
2138
+ * `@timardex/cluemart-server-shared`.
2139
+ */
2140
+ declare const isProLicence: typeof isProLicenceType;
2015
2141
  type LicenceUpgradeArgs = {
2016
2142
  expiryDate: LicenceExpiryDate;
2017
2143
  licenceType: EnumUserLicence;
@@ -2093,4 +2219,4 @@ declare function hasActiveProLicenceForResource({ includeStripeProtected, userId
2093
2219
  resourceType: EnumResourceType;
2094
2220
  }): Promise<boolean>;
2095
2221
 
2096
- export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, AI_IMPORT_RUN_LOCK_KEY, APP_SETTINGS_ID, type ActiveLicenceOptions, AdBillingCatalogModel, AdBookingModel, AdMetricsModel, AdModel, AdPurchaseModel, AffiliateModel, AiImportRunLockModel, AiImportRunModel, type AiImportRunStatus, type AiImportSiteResult, AiImportedMarketModel, type AiImportedMarketReference, AppSettingModel, type AssociableResourceType, AssociateTypeSchema, AuthHandoffTokenModel, type AuthHandoffTokenType, type AuthTokenClient, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, type DetachedAssociateGrants, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, type EventOrImportedMarketLookupOptions, type EventOrImportedMarketMatch, type EventOrImportedMarketReferenceMatch, type EventReference, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, type ImportedMarketReference, type IndexBuildFailure, type IndexableModel, LIVE_RESOURCE_FILTER, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, type ReconcileAssociateGrantsResult, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SCRAPE_SITES_CONFIG_ID, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAiImportRun, type SchemaAiImportedMarket, type SchemaAppSettingsType, type SchemaAssociateType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserAssociatedResourcesType, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, ScrapeSiteConfigModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, acceptedAssociateUserIds, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, buildUserHasEnoughPointsFilter, buildUserPointAwardEntry, buildUserPointCreditFilter, buildUserPointDebitPipeline, buildUserPointEntryRemovalPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, detachAssociateGrantsForResources, detachStaleAssociateGrants, detachUsersFromResource, didRemoveAnyEventDates, didRemoveAnyStartedDates, downgradeVendorProFeatures, ensureDatabaseIndexes, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, findEventOrImportedMarketDetailsById, getActiveLicenceForResource, getAssociateAccessMeta, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getUserIdsWithActiveProLicence, getVendorResourceInfo, grantAssociateGrants, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasActiveProLicenceForResource, hasValidLicence, isAssociableResourceType, isLiveResource, isProLicence, isProtectedByCurrentStripeSubscription, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, reconcileAssociateGrants, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToCanceled, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };
2222
+ export { ACTIVE_NOT_DELETED_FILTER, AD_BILLING_CATALOG_COLLECTION_NAME, AI_IMPORT_RUN_LOCK_KEY, APP_SETTINGS_ID, type ActiveLicenceOptions, AdBillingCatalogModel, AdBookingModel, AdMetricsModel, AdModel, AdPurchaseModel, AffiliateModel, AiImportRunLockModel, AiImportRunModel, type AiImportRunStatus, type AiImportSiteResult, AiImportedMarketModel, type AiImportedMarketReference, AppSettingModel, type AssociableResourceType, AssociateTypeSchema, type AssociatesWriteGuard, AuthHandoffTokenModel, type AuthHandoffTokenType, type AuthTokenClient, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, BILLING_CATALOG_COLLECTION_NAME, BillingCatalogModel, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, type CouponDocument, CouponModel, type DetachedAssociateGrants, EnumPubSubEvents, EventDateArchiveModel, EventInfoModel, EventModel, type EventOrImportedMarketLookupOptions, type EventOrImportedMarketMatch, type EventOrImportedMarketReferenceMatch, type EventReference, GameModel, GoogleImportedMarketModel, type GraphQLContext, ImpersonationAuditModel, ImpersonationSessionModel, type ImportedMarketReference, type IndexBuildFailure, type IndexableModel, LIVE_RESOURCE_FILTER, LicenceCategory, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, type PinnedAssociateTimestamp, PostModel, PushTokenModel, REMINDER_WINDOW_MAX_HOURS, REMINDER_WINDOW_MIN_HOURS, type ReconcileAssociateGrantsResult, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, SCRAPE_SITES_CONFIG_ID, SUBSCRIPTION_REWARD_TIMEZONE, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaAiImportRun, type SchemaAiImportedMarket, type SchemaAppSettingsType, type SchemaAssociateType, type SchemaBillingCatalogEntry, type SchemaBillingCatalogPriceHistoryEntry, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventDateArchiveType, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaImpersonationAuditType, type SchemaImpersonationSessionType, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaStripeSubscription, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserAssociatedResourcesType, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, ScrapeSiteConfigModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, acceptedAssociateUserIds, activeAffiliateCodeExists, awardAffiliateVendorSubscriptionRewards, baseResourceFields, buildAssociatesWriteGuard, buildInitialBillingCatalogEntries, buildLicenceExpiryPipeline, buildUserHasEnoughPointsFilter, buildUserPointAwardEntry, buildUserPointCreditFilter, buildUserPointDebitPipeline, buildUserPointEntryRemovalPipeline, checkOwnerHasLicence, connectToDatabase, convertObjectIdsToStrings, createLicenceObject, dateTimeSchema, dedupeArchivedSlotsByStartDateTime, detachAssociateGrantsForResources, detachStaleAssociateGrants, detachUsersFromResource, didRemoveAnyEventDates, didRemoveAnyStartedDates, downgradeVendorProFeatures, ensureDatabaseIndexes, ensureUserLicenseCompliance, ensureUserLicenseComplianceForUser, eventLicences, findAffiliateByPromoCode, findEventOrImportedMarketById, findEventOrImportedMarketDetailsById, getActiveLicenceForResource, getAssociateAccessMeta, getBillingCatalogDefinition, getEventResourceInfo, getHighestLicenceForCategory, getLicenceCategory, getLicenceExpiryMode, getPartnerResourceInfo, getPayingEventStripeSubscriptionPlan, getPayingStripeSubscriptionPlan, getPayingVendorStripeSubscriptionPlan, getSubscriptionRewardPeriodBounds, getUserIdsWithActiveProLicence, getVendorResourceInfo, grantAssociateGrants, handleEventLicenceCompliance, handlePartnerLicenceCompliance, handleVendorLicenceCompliance, hasActiveProLicenceForResource, hasValidLicence, isAssociableResourceType, isLiveResource, isProLicence, isProtectedByCurrentStripeSubscription, isStandardLicence, isValidObjectId, licenceCategoryMapping, licencePriority, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, partnerLicences, persistArchivedEventDates, pinAssociateTimestamp, processLicenseReminder, processUserCompliance, processUserLicenseReminders, publishNotificationEvents, reconcileAssociateGrants, refundPolicySchema, relatedPostSchema, relationDatesSchema, remindUsersAboutLicenseExpiration, replaceUserLicenceWithObject, restoreVendorProFeatures, saveNotificationsInDb, schemaAdresource, sendDeactivationNotification, sendLicenseReminder, sendPushNotifications, sendReminderSafely, socialShareResourceSchema, splitEventDatesForArchive, syncUserLicencesAfterExpiry, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToCanceled, upgradeUserToLicence, userLicenseSchema, vendorOwnerHasProLicence, vendorProductTypeSchema };