@timardex/cluemart-server-shared 5.1.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, 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 } 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';
@@ -896,6 +896,19 @@ declare const vendorProductTypeSchema: mongoose__default.Schema<VendorProductLis
896
896
  type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenceType" | "adIds" | "associates" | "unregisteredVendorId"> & {
897
897
  adIds?: ObjectId[];
898
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;
899
912
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
900
913
  categoriesNames?: string[];
901
914
  owner: SchemaOwnerType;
@@ -907,6 +920,19 @@ type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenc
907
920
  declare const VendorModel: mongoose__default.Model<SchemaVendorType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaVendorType, {}, {}> & Omit<VendorType, "adIds" | "associates" | "owner" | "ownerLicenceType" | "vendorInfoId" | "unregisteredVendorId"> & {
908
921
  adIds?: ObjectId[];
909
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;
910
936
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
911
937
  categoriesNames?: string[];
912
938
  owner: SchemaOwnerType;
@@ -1322,6 +1348,67 @@ declare function getAssociateAccessMeta(resourceType: AssociableResourceType): {
1322
1348
  associatedPath: string;
1323
1349
  associateRole: EnumUserRole;
1324
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;
1325
1412
  /** The users a resource currently grants associate access to. */
1326
1413
  declare function acceptedAssociateUserIds(associates?: SchemaAssociateType[] | null): ObjectId[];
1327
1414
  /**
@@ -1387,6 +1474,9 @@ declare function grantAssociateGrants({ resourceId, resourceType, userIds, }: {
1387
1474
  * instead makes the call idempotent and convergent — the same call repairs a
1388
1475
  * removal whose side effect was lost, whether it comes from a retry, the next
1389
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.
1390
1480
  */
1391
1481
  declare function detachStaleAssociateGrants({ acceptedUserIds, resourceId, resourceType, }: {
1392
1482
  /** Users the resource currently lists as `ACCEPTED`. */
@@ -1880,10 +1970,7 @@ declare function syncUserLicencesAfterExpiry(userId: ObjectId, licenceTypes: Enu
1880
1970
  * Checks if user has a valid licence of the given types
1881
1971
  */
1882
1972
  declare function hasValidLicence(licences: UserLicenceType[], licenceTypes: EnumUserLicence[], now: dayjs.Dayjs): boolean;
1883
- /**
1884
- * Sends a deactivation notification to the user
1885
- */
1886
- declare function sendDeactivationNotification(payload: {
1973
+ type DeactivationNotificationPayload = {
1887
1974
  data: {
1888
1975
  resourceId: string;
1889
1976
  resourceName: string;
@@ -1893,7 +1980,17 @@ declare function sendDeactivationNotification(payload: {
1893
1980
  title: string;
1894
1981
  type: EnumNotificationType;
1895
1982
  userIds: ObjectId[];
1896
- }, 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>;
1897
1994
  /**
1898
1995
  * Processes license compliance for a single user
1899
1996
  */
@@ -2024,10 +2121,23 @@ declare enum LicenceCategory {
2024
2121
  }
2025
2122
  declare const licenceCategoryMapping: Record<EnumUserLicence, LicenceCategory>;
2026
2123
  declare const licencePriority: Record<EnumUserLicence, number>;
2027
- declare const standardLicences: readonly [EnumUserLicence.STANDARD_VENDOR, EnumUserLicence.STANDARD_EVENT, EnumUserLicence.STANDARD_PARTNER];
2028
- declare function isStandardLicence(licence: EnumUserLicence): licence is (typeof standardLicences)[number];
2029
- declare const proLicences: readonly [EnumUserLicence.PRO_EVENT, EnumUserLicence.PRO_PLUS_EVENT, EnumUserLicence.PRO_VENDOR, EnumUserLicence.PRO_PLUS_VENDOR];
2030
- 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;
2031
2141
  type LicenceUpgradeArgs = {
2032
2142
  expiryDate: LicenceExpiryDate;
2033
2143
  licenceType: EnumUserLicence;
@@ -2109,4 +2219,4 @@ declare function hasActiveProLicenceForResource({ includeStripeProtected, userId
2109
2219
  resourceType: EnumResourceType;
2110
2220
  }): Promise<boolean>;
2111
2221
 
2112
- 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, 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 } 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';
@@ -896,6 +896,19 @@ declare const vendorProductTypeSchema: mongoose__default.Schema<VendorProductLis
896
896
  type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenceType" | "adIds" | "associates" | "unregisteredVendorId"> & {
897
897
  adIds?: ObjectId[];
898
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;
899
912
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
900
913
  categoriesNames?: string[];
901
914
  owner: SchemaOwnerType;
@@ -907,6 +920,19 @@ type SchemaVendorType = Omit<VendorType, "vendorInfoId" | "owner" | "ownerLicenc
907
920
  declare const VendorModel: mongoose__default.Model<SchemaVendorType, {}, {}, {}, mongoose__default.Document<unknown, {}, SchemaVendorType, {}, {}> & Omit<VendorType, "adIds" | "associates" | "owner" | "ownerLicenceType" | "vendorInfoId" | "unregisteredVendorId"> & {
908
921
  adIds?: ObjectId[];
909
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;
910
936
  /** Mirror of `categories[].name` for $text search (see vendorSearch). */
911
937
  categoriesNames?: string[];
912
938
  owner: SchemaOwnerType;
@@ -1322,6 +1348,67 @@ declare function getAssociateAccessMeta(resourceType: AssociableResourceType): {
1322
1348
  associatedPath: string;
1323
1349
  associateRole: EnumUserRole;
1324
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;
1325
1412
  /** The users a resource currently grants associate access to. */
1326
1413
  declare function acceptedAssociateUserIds(associates?: SchemaAssociateType[] | null): ObjectId[];
1327
1414
  /**
@@ -1387,6 +1474,9 @@ declare function grantAssociateGrants({ resourceId, resourceType, userIds, }: {
1387
1474
  * instead makes the call idempotent and convergent — the same call repairs a
1388
1475
  * removal whose side effect was lost, whether it comes from a retry, the next
1389
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.
1390
1480
  */
1391
1481
  declare function detachStaleAssociateGrants({ acceptedUserIds, resourceId, resourceType, }: {
1392
1482
  /** Users the resource currently lists as `ACCEPTED`. */
@@ -1880,10 +1970,7 @@ declare function syncUserLicencesAfterExpiry(userId: ObjectId, licenceTypes: Enu
1880
1970
  * Checks if user has a valid licence of the given types
1881
1971
  */
1882
1972
  declare function hasValidLicence(licences: UserLicenceType[], licenceTypes: EnumUserLicence[], now: dayjs.Dayjs): boolean;
1883
- /**
1884
- * Sends a deactivation notification to the user
1885
- */
1886
- declare function sendDeactivationNotification(payload: {
1973
+ type DeactivationNotificationPayload = {
1887
1974
  data: {
1888
1975
  resourceId: string;
1889
1976
  resourceName: string;
@@ -1893,7 +1980,17 @@ declare function sendDeactivationNotification(payload: {
1893
1980
  title: string;
1894
1981
  type: EnumNotificationType;
1895
1982
  userIds: ObjectId[];
1896
- }, 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>;
1897
1994
  /**
1898
1995
  * Processes license compliance for a single user
1899
1996
  */
@@ -2024,10 +2121,23 @@ declare enum LicenceCategory {
2024
2121
  }
2025
2122
  declare const licenceCategoryMapping: Record<EnumUserLicence, LicenceCategory>;
2026
2123
  declare const licencePriority: Record<EnumUserLicence, number>;
2027
- declare const standardLicences: readonly [EnumUserLicence.STANDARD_VENDOR, EnumUserLicence.STANDARD_EVENT, EnumUserLicence.STANDARD_PARTNER];
2028
- declare function isStandardLicence(licence: EnumUserLicence): licence is (typeof standardLicences)[number];
2029
- declare const proLicences: readonly [EnumUserLicence.PRO_EVENT, EnumUserLicence.PRO_PLUS_EVENT, EnumUserLicence.PRO_VENDOR, EnumUserLicence.PRO_PLUS_VENDOR];
2030
- 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;
2031
2141
  type LicenceUpgradeArgs = {
2032
2142
  expiryDate: LicenceExpiryDate;
2033
2143
  licenceType: EnumUserLicence;
@@ -2109,4 +2219,4 @@ declare function hasActiveProLicenceForResource({ includeStripeProtected, userId
2109
2219
  resourceType: EnumResourceType;
2110
2220
  }): Promise<boolean>;
2111
2221
 
2112
- 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 };