@timardex/cluemart-server-shared 1.0.287 → 1.0.291
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Affiliate-CmS0A1gU.d.mts → Affiliate-6XcZ131C.d.mts} +22 -10
- package/dist/{Affiliate-C_g6TdeG.d.ts → Affiliate-DCvdeKW7.d.ts} +22 -10
- package/dist/{chunk-6EDO734D.mjs → chunk-IGEC5D7N.mjs} +73 -45
- package/dist/chunk-IGEC5D7N.mjs.map +1 -0
- package/dist/chunk-YXUJ4VQU.mjs +17 -0
- package/dist/chunk-YXUJ4VQU.mjs.map +1 -0
- package/dist/index.cjs +134 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +41 -11
- package/dist/index.d.ts +41 -11
- package/dist/index.mjs +132 -59
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +71 -43
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +2 -2
- package/dist/mongoose/index.d.ts +2 -2
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +126 -47
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +21 -3
- package/dist/service/index.d.ts +21 -3
- package/dist/service/index.mjs +47 -1
- package/dist/service/index.mjs.map +1 -1
- package/dist/types/index.mjs +5 -10
- package/dist/types/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-6EDO734D.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
2
|
-
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType,
|
|
2
|
+
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, SocialShareResourceType, PosterUsageType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, AffiliateRewardType, AffiliateResourceType, AffiliateType, EnumAffiliateRewardType, PromoCodeType, EnumUserLicence, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
|
|
3
3
|
import * as mongoose from 'mongoose';
|
|
4
4
|
import mongoose__default from 'mongoose';
|
|
5
5
|
export { default as mongoose } from 'mongoose';
|
|
@@ -257,6 +257,15 @@ declare const relatedPostSchema: mongoose__default.Schema<SchemaRelatedPostType,
|
|
|
257
257
|
} & {
|
|
258
258
|
__v: number;
|
|
259
259
|
}>;
|
|
260
|
+
declare const socialShareResourceSchema: mongoose__default.Schema<SocialShareResourceType, mongoose__default.Model<SocialShareResourceType, any, any, any, mongoose__default.Document<unknown, any, SocialShareResourceType, any, {}> & SocialShareResourceType & {
|
|
261
|
+
_id: mongoose__default.Types.ObjectId;
|
|
262
|
+
} & {
|
|
263
|
+
__v: number;
|
|
264
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, SocialShareResourceType, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<SocialShareResourceType>, {}, mongoose__default.ResolveSchemaOptions<mongoose__default.DefaultSchemaOptions>> & mongoose__default.FlatRecord<SocialShareResourceType> & {
|
|
265
|
+
_id: mongoose__default.Types.ObjectId;
|
|
266
|
+
} & {
|
|
267
|
+
__v: number;
|
|
268
|
+
}>;
|
|
260
269
|
declare const baseResourceFields: {
|
|
261
270
|
active: {
|
|
262
271
|
default: boolean;
|
|
@@ -397,6 +406,18 @@ declare const baseResourceFields: {
|
|
|
397
406
|
required: boolean;
|
|
398
407
|
type: NumberConstructor;
|
|
399
408
|
};
|
|
409
|
+
sharePublic: {
|
|
410
|
+
required: boolean;
|
|
411
|
+
type: mongoose__default.Schema<SocialShareResourceType, mongoose__default.Model<SocialShareResourceType, any, any, any, mongoose__default.Document<unknown, any, SocialShareResourceType, any, {}> & SocialShareResourceType & {
|
|
412
|
+
_id: mongoose__default.Types.ObjectId;
|
|
413
|
+
} & {
|
|
414
|
+
__v: number;
|
|
415
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, SocialShareResourceType, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<SocialShareResourceType>, {}, mongoose__default.ResolveSchemaOptions<mongoose__default.DefaultSchemaOptions>> & mongoose__default.FlatRecord<SocialShareResourceType> & {
|
|
416
|
+
_id: mongoose__default.Types.ObjectId;
|
|
417
|
+
} & {
|
|
418
|
+
__v: number;
|
|
419
|
+
}>;
|
|
420
|
+
};
|
|
400
421
|
slug: {
|
|
401
422
|
required: boolean;
|
|
402
423
|
type: StringConstructor;
|
|
@@ -428,15 +449,6 @@ declare const baseResourceFields: {
|
|
|
428
449
|
}>;
|
|
429
450
|
};
|
|
430
451
|
};
|
|
431
|
-
declare const socialShareResourceSchema: mongoose__default.Schema<SocialShareResourceType, mongoose__default.Model<SocialShareResourceType, any, any, any, mongoose__default.Document<unknown, any, SocialShareResourceType, any, {}> & SocialShareResourceType & {
|
|
432
|
-
_id: mongoose__default.Types.ObjectId;
|
|
433
|
-
} & {
|
|
434
|
-
__v: number;
|
|
435
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, SocialShareResourceType, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<SocialShareResourceType>, {}, mongoose__default.ResolveSchemaOptions<mongoose__default.DefaultSchemaOptions>> & mongoose__default.FlatRecord<SocialShareResourceType> & {
|
|
436
|
-
_id: mongoose__default.Types.ObjectId;
|
|
437
|
-
} & {
|
|
438
|
-
__v: number;
|
|
439
|
-
}>;
|
|
440
452
|
|
|
441
453
|
type SchemaGoogleImportedMarket = Omit<GoogleImportedMarket, "eventId" | "claimedByUserId"> & {
|
|
442
454
|
eventId?: mongoose__default.Types.ObjectId;
|
|
@@ -878,6 +890,24 @@ declare const ACTIVE_NOT_DELETED_FILTER: {
|
|
|
878
890
|
|
|
879
891
|
declare function normalizePromoCode(decoratedPromoCode: string | null | undefined): string | null;
|
|
880
892
|
|
|
893
|
+
/**
|
|
894
|
+
* Publish-only pubsub used to emit GraphQL subscription events. Optional in
|
|
895
|
+
* {@link notifyUsers} because non-GraphQL processes (e.g. the cron worker) have
|
|
896
|
+
* no subscribers to publish to.
|
|
897
|
+
*/
|
|
898
|
+
type NotificationPubSub = Pick<GraphQLContext["pubsub"], "publish">;
|
|
899
|
+
/** Publishes notification list/count subscription events for a user. */
|
|
900
|
+
declare function publishNotificationEvents(userId: ObjectId, pubsub: NotificationPubSub): Promise<void>;
|
|
901
|
+
/**
|
|
902
|
+
* Sends push notifications, saves them in the database, and (when a `pubsub`
|
|
903
|
+
* is provided) publishes GraphQL subscription events for each affected user.
|
|
904
|
+
* Errors are logged and swallowed; this function never throws.
|
|
905
|
+
*/
|
|
906
|
+
declare function notifyUsers({ payload, pubsub, }: {
|
|
907
|
+
payload: SchemaCreateBulkNotificationInput;
|
|
908
|
+
pubsub?: NotificationPubSub;
|
|
909
|
+
}): Promise<void>;
|
|
910
|
+
|
|
881
911
|
/**
|
|
882
912
|
* Create notifications in the database for multiple users
|
|
883
913
|
* This is typically called when sending push notifications
|
|
@@ -933,4 +963,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
933
963
|
*/
|
|
934
964
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
935
965
|
|
|
936
|
-
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, awardAffiliateVendorSubscriptionRewards, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
966
|
+
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, awardAffiliateVendorSubscriptionRewards, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _timardex_cluemart_shared from '@timardex/cluemart-shared';
|
|
2
|
-
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType,
|
|
2
|
+
import { AdType, CreateBulkNotificationInput, NotificationType, EnumUserRole, ChatMessageType, ParticipantType, ChatType, ReportChatUser, RelatedPostType, OwnerType, SocialMediaType, ResourceImageType, Category, UserLicenceType, AssociateType, ResourceContactDetailsType, TermsAgreement, RelationDate, DateTimeType, LocationGeoType, LocationType, SocialShareResourceType, PosterUsageType, GoogleImportedMarket, PushTokenType, RelationType, ResourceActivityType, UserActivityEvent, UserType, VendorType, VendorInfoType, UnregisteredVendorInvitationType, UnregisteredVendorType, EventType, StallType, RefundPolicy, EventInfoType, PartnerType, PostType, PostContentType, PostResource, AppSettingsType, GameType, GameDocType, SchoolType, AffiliateRewardType, AffiliateResourceType, AffiliateType, EnumAffiliateRewardType, PromoCodeType, EnumUserLicence, EventListItemType, DateTimeWithPriceType } from '@timardex/cluemart-shared';
|
|
3
3
|
import * as mongoose from 'mongoose';
|
|
4
4
|
import mongoose__default from 'mongoose';
|
|
5
5
|
export { default as mongoose } from 'mongoose';
|
|
@@ -257,6 +257,15 @@ declare const relatedPostSchema: mongoose__default.Schema<SchemaRelatedPostType,
|
|
|
257
257
|
} & {
|
|
258
258
|
__v: number;
|
|
259
259
|
}>;
|
|
260
|
+
declare const socialShareResourceSchema: mongoose__default.Schema<SocialShareResourceType, mongoose__default.Model<SocialShareResourceType, any, any, any, mongoose__default.Document<unknown, any, SocialShareResourceType, any, {}> & SocialShareResourceType & {
|
|
261
|
+
_id: mongoose__default.Types.ObjectId;
|
|
262
|
+
} & {
|
|
263
|
+
__v: number;
|
|
264
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, SocialShareResourceType, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<SocialShareResourceType>, {}, mongoose__default.ResolveSchemaOptions<mongoose__default.DefaultSchemaOptions>> & mongoose__default.FlatRecord<SocialShareResourceType> & {
|
|
265
|
+
_id: mongoose__default.Types.ObjectId;
|
|
266
|
+
} & {
|
|
267
|
+
__v: number;
|
|
268
|
+
}>;
|
|
260
269
|
declare const baseResourceFields: {
|
|
261
270
|
active: {
|
|
262
271
|
default: boolean;
|
|
@@ -397,6 +406,18 @@ declare const baseResourceFields: {
|
|
|
397
406
|
required: boolean;
|
|
398
407
|
type: NumberConstructor;
|
|
399
408
|
};
|
|
409
|
+
sharePublic: {
|
|
410
|
+
required: boolean;
|
|
411
|
+
type: mongoose__default.Schema<SocialShareResourceType, mongoose__default.Model<SocialShareResourceType, any, any, any, mongoose__default.Document<unknown, any, SocialShareResourceType, any, {}> & SocialShareResourceType & {
|
|
412
|
+
_id: mongoose__default.Types.ObjectId;
|
|
413
|
+
} & {
|
|
414
|
+
__v: number;
|
|
415
|
+
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, SocialShareResourceType, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<SocialShareResourceType>, {}, mongoose__default.ResolveSchemaOptions<mongoose__default.DefaultSchemaOptions>> & mongoose__default.FlatRecord<SocialShareResourceType> & {
|
|
416
|
+
_id: mongoose__default.Types.ObjectId;
|
|
417
|
+
} & {
|
|
418
|
+
__v: number;
|
|
419
|
+
}>;
|
|
420
|
+
};
|
|
400
421
|
slug: {
|
|
401
422
|
required: boolean;
|
|
402
423
|
type: StringConstructor;
|
|
@@ -428,15 +449,6 @@ declare const baseResourceFields: {
|
|
|
428
449
|
}>;
|
|
429
450
|
};
|
|
430
451
|
};
|
|
431
|
-
declare const socialShareResourceSchema: mongoose__default.Schema<SocialShareResourceType, mongoose__default.Model<SocialShareResourceType, any, any, any, mongoose__default.Document<unknown, any, SocialShareResourceType, any, {}> & SocialShareResourceType & {
|
|
432
|
-
_id: mongoose__default.Types.ObjectId;
|
|
433
|
-
} & {
|
|
434
|
-
__v: number;
|
|
435
|
-
}, any>, {}, {}, {}, {}, mongoose__default.DefaultSchemaOptions, SocialShareResourceType, mongoose__default.Document<unknown, {}, mongoose__default.FlatRecord<SocialShareResourceType>, {}, mongoose__default.ResolveSchemaOptions<mongoose__default.DefaultSchemaOptions>> & mongoose__default.FlatRecord<SocialShareResourceType> & {
|
|
436
|
-
_id: mongoose__default.Types.ObjectId;
|
|
437
|
-
} & {
|
|
438
|
-
__v: number;
|
|
439
|
-
}>;
|
|
440
452
|
|
|
441
453
|
type SchemaGoogleImportedMarket = Omit<GoogleImportedMarket, "eventId" | "claimedByUserId"> & {
|
|
442
454
|
eventId?: mongoose__default.Types.ObjectId;
|
|
@@ -878,6 +890,24 @@ declare const ACTIVE_NOT_DELETED_FILTER: {
|
|
|
878
890
|
|
|
879
891
|
declare function normalizePromoCode(decoratedPromoCode: string | null | undefined): string | null;
|
|
880
892
|
|
|
893
|
+
/**
|
|
894
|
+
* Publish-only pubsub used to emit GraphQL subscription events. Optional in
|
|
895
|
+
* {@link notifyUsers} because non-GraphQL processes (e.g. the cron worker) have
|
|
896
|
+
* no subscribers to publish to.
|
|
897
|
+
*/
|
|
898
|
+
type NotificationPubSub = Pick<GraphQLContext["pubsub"], "publish">;
|
|
899
|
+
/** Publishes notification list/count subscription events for a user. */
|
|
900
|
+
declare function publishNotificationEvents(userId: ObjectId, pubsub: NotificationPubSub): Promise<void>;
|
|
901
|
+
/**
|
|
902
|
+
* Sends push notifications, saves them in the database, and (when a `pubsub`
|
|
903
|
+
* is provided) publishes GraphQL subscription events for each affected user.
|
|
904
|
+
* Errors are logged and swallowed; this function never throws.
|
|
905
|
+
*/
|
|
906
|
+
declare function notifyUsers({ payload, pubsub, }: {
|
|
907
|
+
payload: SchemaCreateBulkNotificationInput;
|
|
908
|
+
pubsub?: NotificationPubSub;
|
|
909
|
+
}): Promise<void>;
|
|
910
|
+
|
|
881
911
|
/**
|
|
882
912
|
* Create notifications in the database for multiple users
|
|
883
913
|
* This is typically called when sending push notifications
|
|
@@ -933,4 +963,4 @@ declare function didRemoveAnyEventDates(previousDateTime: EventDateSlot[] | unde
|
|
|
933
963
|
*/
|
|
934
964
|
declare function updateRelationDatesToUnavailable(relationDates: SchemaRelationType["relationDates"], eventDateTime: DateTimeWithPriceType[] | undefined): SchemaRelationType["relationDates"];
|
|
935
965
|
|
|
936
|
-
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, awardAffiliateVendorSubscriptionRewards, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
|
966
|
+
export { ACTIVE_NOT_DELETED_FILTER, AFFILIATE_REWARDS, APP_SETTINGS_ID, AdModel, AffiliateModel, AppSettingModel, type AuthUser, type AwardAffiliateVendorSubscriptionRewardsResult, CategorySchema, ChatModel, ChatReportModel, ContactDetailsSchema, EnumPubSubEvents, EventInfoModel, EventModel, GameModel, GoogleImportedMarketModel, type GraphQLContext, NotificationModel, type NotificationPubSub, type ObjectId, OwnerTypeSchema, PartnerModel, PostModel, PushTokenModel, RelationModel, RelationTypeSchema, ResourceActivityModel, ResourceImageTypeSchema, type SchemaAffiliateResourceType, type SchemaAffiliateReward, type SchemaChatMessageReactionType, type SchemaChatMessageReplyPreviewType, type SchemaChatMessageSeenType, type SchemaChatMessageType, type SchemaChatReportType, type SchemaChatType, type SchemaCreateBulkNotificationInput, type SchemaEventInfoType, type SchemaEventType, type SchemaGameType, type SchemaGoogleImportedMarket, type SchemaNotificationType, type SchemaOwnerType, type SchemaParticipantType, type SchemaPartnerType, type SchemaPostType, type SchemaPushTokenType, type SchemaRelatedPostType, type SchemaRelationType, type SchemaUnregisteredVendorInvitationType, type SchemaUnregisteredVendorType, type SchemaUserActivityEvent, type SchemaUserType, type SchemaVendorInfoType, type SchemaVendorType, SchoolModel, SocialMediaTypeSchema, StallTypeSchema, type SubscriptionPayload, UnregisteredVendorModel, UserModel, VendorInfoModel, VendorModel, VerificationTokenModel, type VerificationTokenType, activeAffiliateCodeExists, associatesSchema, awardAffiliateVendorSubscriptionRewards, baseResourceFields, connectToDatabase, convertObjectIdsToStrings, createAffiliateReward, dateTimeSchema, didRemoveAnyEventDates, findAffiliateByPromoCode, findEventOrImportedMarketById, getSubscriptionRewardPeriodBounds, locationGeoSchema, locationsSchema, mapVendorLicenceToSubscriptionRewardType, normalizeAffiliatePromoCodes, normalizePromoCode, notifyUsers, publishNotificationEvents, refundPolicySchema, relatedPostSchema, relationDatesSchema, resourceRelationsSchema, saveNotificationsInDb, sendPushNotifications, socialShareResourceSchema, termsAgreementSchema, updateAdStatuses, updateAllEventDateTimeStatuses, updateRelationDatesToUnavailable, updateSingleDateTimeStatus, updateVendorBasedOnUserLicense, userLicenseSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -4654,29 +4654,6 @@ var tagOptions = availableTagTypes.map((tag) => ({
|
|
|
4654
4654
|
label: tag.label,
|
|
4655
4655
|
value: tag.label
|
|
4656
4656
|
}));
|
|
4657
|
-
var stallTypes = [
|
|
4658
|
-
"1.8m table only",
|
|
4659
|
-
"2x2m mini stall",
|
|
4660
|
-
"3x3m tent site",
|
|
4661
|
-
"Corner stall",
|
|
4662
|
-
"Craft stall with power",
|
|
4663
|
-
"Craft stall without power",
|
|
4664
|
-
"Double stall (6x3m)",
|
|
4665
|
-
"Food truck site",
|
|
4666
|
-
"Food vendor with power",
|
|
4667
|
-
"Food vendor without power",
|
|
4668
|
-
"Inside hall stall",
|
|
4669
|
-
"Non-profit/community stall",
|
|
4670
|
-
"Outdoor open area",
|
|
4671
|
-
"Shared table space",
|
|
4672
|
-
"Wall-based vendor",
|
|
4673
|
-
"Workshop/seating area"
|
|
4674
|
-
];
|
|
4675
|
-
var stallTypeOptions = stallTypes.map((type) => ({
|
|
4676
|
-
label: type,
|
|
4677
|
-
price: 0,
|
|
4678
|
-
stallCapacity: 0
|
|
4679
|
-
}));
|
|
4680
4657
|
var emailField = {
|
|
4681
4658
|
helperText: "Enter email address",
|
|
4682
4659
|
keyboardType: "email-address",
|
|
@@ -4701,6 +4678,51 @@ var companyContactFields = [
|
|
|
4701
4678
|
placeholder: "Landline Phone Number"
|
|
4702
4679
|
}
|
|
4703
4680
|
];
|
|
4681
|
+
var bankAccountDetailsFields = [
|
|
4682
|
+
{
|
|
4683
|
+
helperText: "Account holder name *",
|
|
4684
|
+
name: "accountHolderName",
|
|
4685
|
+
placeholder: "Account holder name"
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
helperText: "Account number *",
|
|
4689
|
+
keyboardType: "number-pad",
|
|
4690
|
+
name: "accountNumber",
|
|
4691
|
+
placeholder: "Account number"
|
|
4692
|
+
}
|
|
4693
|
+
];
|
|
4694
|
+
var eventInfoPaymentInfo = [
|
|
4695
|
+
...bankAccountDetailsFields,
|
|
4696
|
+
{
|
|
4697
|
+
helperText: "Payment link, where applicants can pay *",
|
|
4698
|
+
keyboardType: "url",
|
|
4699
|
+
name: "link",
|
|
4700
|
+
placeholder: "Payment link"
|
|
4701
|
+
}
|
|
4702
|
+
];
|
|
4703
|
+
var stallTypes = [
|
|
4704
|
+
"1.8m table only",
|
|
4705
|
+
"2x2m mini stall",
|
|
4706
|
+
"3x3m tent site",
|
|
4707
|
+
"Corner stall",
|
|
4708
|
+
"Craft stall with power",
|
|
4709
|
+
"Craft stall without power",
|
|
4710
|
+
"Double stall (6x3m)",
|
|
4711
|
+
"Food truck site",
|
|
4712
|
+
"Food vendor with power",
|
|
4713
|
+
"Food vendor without power",
|
|
4714
|
+
"Inside hall stall",
|
|
4715
|
+
"Non-profit/community stall",
|
|
4716
|
+
"Outdoor open area",
|
|
4717
|
+
"Shared table space",
|
|
4718
|
+
"Wall-based vendor",
|
|
4719
|
+
"Workshop/seating area"
|
|
4720
|
+
];
|
|
4721
|
+
var stallTypeOptions = stallTypes.map((type) => ({
|
|
4722
|
+
label: type,
|
|
4723
|
+
price: 0,
|
|
4724
|
+
stallCapacity: 0
|
|
4725
|
+
}));
|
|
4704
4726
|
var loginFields = [
|
|
4705
4727
|
{
|
|
4706
4728
|
...emailField,
|
|
@@ -7472,8 +7494,10 @@ var AFFILIATE_FIELDS_FRAGMENT = gql`
|
|
|
7472
7494
|
}
|
|
7473
7495
|
createdAt
|
|
7474
7496
|
deletedAt
|
|
7475
|
-
|
|
7476
|
-
|
|
7497
|
+
redeemHistory {
|
|
7498
|
+
redeemedAt
|
|
7499
|
+
rewardValue
|
|
7500
|
+
}
|
|
7477
7501
|
overallPoints
|
|
7478
7502
|
owner {
|
|
7479
7503
|
...OwnerFields
|
|
@@ -8179,6 +8203,14 @@ var relatedPostSchema = new MongooseSchema6(
|
|
|
8179
8203
|
{ _id: false }
|
|
8180
8204
|
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8181
8205
|
);
|
|
8206
|
+
var socialShareResourceSchema = new MongooseSchema6(
|
|
8207
|
+
{
|
|
8208
|
+
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
8209
|
+
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
8210
|
+
},
|
|
8211
|
+
{ _id: false }
|
|
8212
|
+
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8213
|
+
);
|
|
8182
8214
|
var baseResourceFields = {
|
|
8183
8215
|
active: { default: false, required: true, type: Boolean },
|
|
8184
8216
|
adIds: {
|
|
@@ -8210,18 +8242,11 @@ var baseResourceFields = {
|
|
|
8210
8242
|
region: { required: true, type: String },
|
|
8211
8243
|
relatedPost: { required: false, type: relatedPostSchema },
|
|
8212
8244
|
reviewCount: { required: false, type: Number },
|
|
8245
|
+
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
8213
8246
|
slug: { required: true, type: String },
|
|
8214
8247
|
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
8215
8248
|
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
8216
8249
|
};
|
|
8217
|
-
var socialShareResourceSchema = new MongooseSchema6(
|
|
8218
|
-
{
|
|
8219
|
-
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
8220
|
-
socialImage: { required: true, type: ResourceImageTypeSchema }
|
|
8221
|
-
},
|
|
8222
|
-
{ _id: false }
|
|
8223
|
-
// Prevents Mongoose from creating an additional _id field for subdocuments
|
|
8224
|
-
);
|
|
8225
8250
|
|
|
8226
8251
|
// src/mongoose/GoogleImportedMarket.ts
|
|
8227
8252
|
import mongoose7 from "mongoose";
|
|
@@ -8698,7 +8723,6 @@ var schema9 = new MongooseSchema13(
|
|
|
8698
8723
|
required: false,
|
|
8699
8724
|
type: [resourceRelationsSchema]
|
|
8700
8725
|
},
|
|
8701
|
-
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
8702
8726
|
shareRelation: { required: false, type: socialShareResourceSchema },
|
|
8703
8727
|
unregisteredVendorId: {
|
|
8704
8728
|
ref: "UnregisteredVendor",
|
|
@@ -8851,7 +8875,6 @@ var schema12 = new MongooseSchema16(
|
|
|
8851
8875
|
required: false,
|
|
8852
8876
|
type: [resourceRelationsSchema]
|
|
8853
8877
|
},
|
|
8854
|
-
sharePublic: { required: false, type: socialShareResourceSchema },
|
|
8855
8878
|
shareRelation: { required: false, type: socialShareResourceSchema },
|
|
8856
8879
|
tags: { required: true, type: [String] }
|
|
8857
8880
|
},
|
|
@@ -8883,8 +8906,7 @@ var schema13 = new MongooseSchema17(
|
|
|
8883
8906
|
enum: Object.values(EnumPartnerType),
|
|
8884
8907
|
required: true,
|
|
8885
8908
|
type: String
|
|
8886
|
-
}
|
|
8887
|
-
sharePublic: { required: false, type: socialShareResourceSchema }
|
|
8909
|
+
}
|
|
8888
8910
|
},
|
|
8889
8911
|
{ timestamps: true }
|
|
8890
8912
|
);
|
|
@@ -9259,6 +9281,13 @@ var affiliateDetailsSchema = new MongooseSchema25(
|
|
|
9259
9281
|
},
|
|
9260
9282
|
{ _id: false }
|
|
9261
9283
|
);
|
|
9284
|
+
var redeemHistorySchema = new MongooseSchema25(
|
|
9285
|
+
{
|
|
9286
|
+
redeemedAt: { required: true, type: Date },
|
|
9287
|
+
rewardValue: { required: true, type: Number }
|
|
9288
|
+
},
|
|
9289
|
+
{ _id: false }
|
|
9290
|
+
);
|
|
9262
9291
|
var schema17 = new MongooseSchema25(
|
|
9263
9292
|
{
|
|
9264
9293
|
active: { default: false, required: true, type: Boolean },
|
|
@@ -9275,16 +9304,15 @@ var schema17 = new MongooseSchema25(
|
|
|
9275
9304
|
type: [affiliateResourceSchema]
|
|
9276
9305
|
},
|
|
9277
9306
|
deletedAt: { default: null, required: false, type: Date },
|
|
9278
|
-
lastRewardRedemptionAt: { default: null, required: false, type: Date },
|
|
9279
|
-
lastRewardRedemptionPoints: {
|
|
9280
|
-
default: null,
|
|
9281
|
-
required: false,
|
|
9282
|
-
type: Number
|
|
9283
|
-
},
|
|
9284
9307
|
overallPoints: { default: 0, required: true, type: Number },
|
|
9285
9308
|
owner: {
|
|
9286
9309
|
required: true,
|
|
9287
9310
|
type: OwnerTypeSchema
|
|
9311
|
+
},
|
|
9312
|
+
redeemHistory: {
|
|
9313
|
+
default: [],
|
|
9314
|
+
required: false,
|
|
9315
|
+
type: [redeemHistorySchema]
|
|
9288
9316
|
}
|
|
9289
9317
|
},
|
|
9290
9318
|
{ timestamps: true }
|
|
@@ -9731,6 +9759,60 @@ var connectToDatabase = async ({
|
|
|
9731
9759
|
}
|
|
9732
9760
|
};
|
|
9733
9761
|
|
|
9762
|
+
// src/types/index.ts
|
|
9763
|
+
import express from "express";
|
|
9764
|
+
import mongoose27 from "mongoose";
|
|
9765
|
+
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
9766
|
+
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
9767
|
+
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
9768
|
+
EnumPubSubEvents2["GET_NOTIFICATIONS_COUNT"] = "GET_NOTIFICATIONS_COUNT";
|
|
9769
|
+
EnumPubSubEvents2["USER_TYPING"] = "USER_TYPING";
|
|
9770
|
+
return EnumPubSubEvents2;
|
|
9771
|
+
})(EnumPubSubEvents || {});
|
|
9772
|
+
|
|
9773
|
+
// src/service/notifyUsers.ts
|
|
9774
|
+
async function publishNotificationEvents(userId, pubsub) {
|
|
9775
|
+
try {
|
|
9776
|
+
const userNotifications = await NotificationModel.find({
|
|
9777
|
+
userId
|
|
9778
|
+
}).sort({ createdAt: -1 });
|
|
9779
|
+
const [total, unread] = await Promise.all([
|
|
9780
|
+
NotificationModel.countDocuments({ userId }),
|
|
9781
|
+
NotificationModel.countDocuments({ isRead: false, userId })
|
|
9782
|
+
]);
|
|
9783
|
+
pubsub.publish("GET_NOTIFICATIONS" /* GET_NOTIFICATIONS */, {
|
|
9784
|
+
getNotifications: userNotifications,
|
|
9785
|
+
getNotificationsUserId: userId
|
|
9786
|
+
});
|
|
9787
|
+
pubsub.publish("GET_NOTIFICATIONS_COUNT" /* GET_NOTIFICATIONS_COUNT */, {
|
|
9788
|
+
getNotificationsCount: { total, unread, userId }
|
|
9789
|
+
});
|
|
9790
|
+
console.log(`Published notification events for user: ${String(userId)}`);
|
|
9791
|
+
} catch (error) {
|
|
9792
|
+
console.error(
|
|
9793
|
+
`Failed to publish notification events for user ${String(userId)}:`,
|
|
9794
|
+
error
|
|
9795
|
+
);
|
|
9796
|
+
}
|
|
9797
|
+
}
|
|
9798
|
+
async function notifyUsers({
|
|
9799
|
+
payload,
|
|
9800
|
+
pubsub
|
|
9801
|
+
}) {
|
|
9802
|
+
try {
|
|
9803
|
+
await sendPushNotifications(payload);
|
|
9804
|
+
const uniqueUserIds = await saveNotificationsInDb(payload);
|
|
9805
|
+
if (!pubsub) {
|
|
9806
|
+
return;
|
|
9807
|
+
}
|
|
9808
|
+
for (const userId of uniqueUserIds) {
|
|
9809
|
+
await publishNotificationEvents(userId, pubsub);
|
|
9810
|
+
}
|
|
9811
|
+
} catch (error) {
|
|
9812
|
+
console.error("Error in notifyUsers:", error);
|
|
9813
|
+
}
|
|
9814
|
+
}
|
|
9815
|
+
|
|
9734
9816
|
// src/service/updateAdStatus.ts
|
|
9735
9817
|
async function updateAdStatuses() {
|
|
9736
9818
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -9767,9 +9849,9 @@ async function updateAdStatuses() {
|
|
|
9767
9849
|
}
|
|
9768
9850
|
|
|
9769
9851
|
// src/service/associate.ts
|
|
9770
|
-
import
|
|
9852
|
+
import mongoose28 from "mongoose";
|
|
9771
9853
|
function normalizeObjectId(id) {
|
|
9772
|
-
return typeof id === "string" ? new
|
|
9854
|
+
return typeof id === "string" ? new mongoose28.Types.ObjectId(id) : id;
|
|
9773
9855
|
}
|
|
9774
9856
|
async function getAssociateEmailsForResource({
|
|
9775
9857
|
normalizedResourceId,
|
|
@@ -9921,12 +10003,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
9921
10003
|
}
|
|
9922
10004
|
|
|
9923
10005
|
// src/service/objectIdToString.ts
|
|
9924
|
-
import
|
|
10006
|
+
import mongoose29 from "mongoose";
|
|
9925
10007
|
function convertObjectIdsToStrings(obj) {
|
|
9926
10008
|
if (obj === null || obj === void 0) {
|
|
9927
10009
|
return obj;
|
|
9928
10010
|
}
|
|
9929
|
-
if (obj instanceof
|
|
10011
|
+
if (obj instanceof mongoose29.Types.ObjectId) {
|
|
9930
10012
|
return obj.toString();
|
|
9931
10013
|
}
|
|
9932
10014
|
if (obj instanceof Date) {
|
|
@@ -10107,17 +10189,6 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
|
|
|
10107
10189
|
};
|
|
10108
10190
|
});
|
|
10109
10191
|
}
|
|
10110
|
-
|
|
10111
|
-
// src/types/index.ts
|
|
10112
|
-
import express from "express";
|
|
10113
|
-
import mongoose29 from "mongoose";
|
|
10114
|
-
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
10115
|
-
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
10116
|
-
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
10117
|
-
EnumPubSubEvents2["GET_NOTIFICATIONS_COUNT"] = "GET_NOTIFICATIONS_COUNT";
|
|
10118
|
-
EnumPubSubEvents2["USER_TYPING"] = "USER_TYPING";
|
|
10119
|
-
return EnumPubSubEvents2;
|
|
10120
|
-
})(EnumPubSubEvents || {});
|
|
10121
10192
|
export {
|
|
10122
10193
|
ACTIVE_NOT_DELETED_FILTER,
|
|
10123
10194
|
AFFILIATE_REWARDS,
|
|
@@ -10167,9 +10238,11 @@ export {
|
|
|
10167
10238
|
locationGeoSchema,
|
|
10168
10239
|
locationsSchema,
|
|
10169
10240
|
mapVendorLicenceToSubscriptionRewardType,
|
|
10170
|
-
|
|
10241
|
+
mongoose27 as mongoose,
|
|
10171
10242
|
normalizeAffiliatePromoCodes,
|
|
10172
10243
|
normalizePromoCode,
|
|
10244
|
+
notifyUsers,
|
|
10245
|
+
publishNotificationEvents,
|
|
10173
10246
|
refundPolicySchema,
|
|
10174
10247
|
relatedPostSchema,
|
|
10175
10248
|
relationDatesSchema,
|