connectfy-shared 0.0.125 → 0.0.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -9450,7 +9450,6 @@ __export(index_exports, {
9450
9450
  CLS_KEYS: () => CLS_KEYS,
9451
9451
  COLLECTIONS: () => COLLECTIONS,
9452
9452
  COUNTRIES: () => COUNTRIES,
9453
- ChatMessageType: () => ChatMessageType,
9454
9453
  ChatParticiantRole: () => ChatParticiantRole,
9455
9454
  ChatType: () => ChatType,
9456
9455
  DATE_FORMAT: () => DATE_FORMAT,
@@ -9476,8 +9475,11 @@ __export(index_exports, {
9476
9475
  LOCAL_STORAGE_KEYS: () => LOCAL_STORAGE_KEYS,
9477
9476
  MICROSERVICE_NAMES: () => MICROSERVICE_NAMES,
9478
9477
  MODULE_TO_TOPIC_MAP: () => MODULE_TO_TOPIC_MAP,
9478
+ MessageType: () => MessageType,
9479
+ NEO4J_DRIVER: () => NEO4J_DRIVER,
9479
9480
  NOTIFICATION_CONTENT_MODE: () => NOTIFICATION_CONTENT_MODE,
9480
9481
  NOTIFICATION_SOUND_MODE: () => NOTIFICATION_SOUND_MODE,
9482
+ Neo4jBaseRepository: () => Neo4jBaseRepository,
9481
9483
  NotificationChannel: () => NotificationChannel,
9482
9484
  NotificationResource: () => NotificationResource,
9483
9485
  NotificationStatus: () => NotificationStatus,
@@ -9928,6 +9930,7 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus4) => {
9928
9930
  var REDIS_KEYS = /* @__PURE__ */ ((REDIS_KEYS2) => {
9929
9931
  REDIS_KEYS2["REDIS_CLIENT"] = "REDIS_CLIENT";
9930
9932
  REDIS_KEYS2["KEYV_CLIENT"] = "KEYV_CLIENT";
9933
+ REDIS_KEYS2["REDIS_SUBSCRIBER_CLIENT"] = "REDIS_SUBSCRIBER_CLIENT";
9931
9934
  return REDIS_KEYS2;
9932
9935
  })(REDIS_KEYS || {});
9933
9936
  var FileOwnerModule = /* @__PURE__ */ ((FileOwnerModule2) => {
@@ -10007,16 +10010,16 @@ var ChatParticiantRole = /* @__PURE__ */ ((ChatParticiantRole2) => {
10007
10010
  ChatParticiantRole2["Member"] = "member";
10008
10011
  return ChatParticiantRole2;
10009
10012
  })(ChatParticiantRole || {});
10010
- var ChatMessageType = /* @__PURE__ */ ((ChatMessageType2) => {
10011
- ChatMessageType2["Text"] = "text";
10012
- ChatMessageType2["Image"] = "image";
10013
- ChatMessageType2["Audio"] = "audio";
10014
- ChatMessageType2["Video"] = "video";
10015
- ChatMessageType2["File"] = "file";
10016
- ChatMessageType2["Call"] = "call";
10017
- ChatMessageType2["System"] = "system";
10018
- return ChatMessageType2;
10019
- })(ChatMessageType || {});
10013
+ var MessageType = /* @__PURE__ */ ((MessageType2) => {
10014
+ MessageType2["Text"] = "text";
10015
+ MessageType2["Image"] = "image";
10016
+ MessageType2["Audio"] = "audio";
10017
+ MessageType2["Video"] = "video";
10018
+ MessageType2["File"] = "file";
10019
+ MessageType2["Call"] = "call";
10020
+ MessageType2["System"] = "system";
10021
+ return MessageType2;
10022
+ })(MessageType || {});
10020
10023
 
10021
10024
  // src/constants/server/constants.ts
10022
10025
  var MICROSERVICE_NAMES = {
@@ -10058,6 +10061,16 @@ var COLLECTIONS = {
10058
10061
  NOTIFICATION: {
10059
10062
  NOTIFICATIONS: "notifications",
10060
10063
  DEVICE_TOKENS: "device_tokens"
10064
+ },
10065
+ MESSENGER: {
10066
+ CHAT: {
10067
+ CHATS: "chats",
10068
+ CHAT_PARTICIPANTS: "chat_participants"
10069
+ },
10070
+ MESSAGE: {
10071
+ MESSAGES: "messages",
10072
+ MESSAGE_REACTIONS: "message_reactions"
10073
+ }
10061
10074
  }
10062
10075
  };
10063
10076
  var EXPIRE_DATES = {
@@ -10167,6 +10180,7 @@ var COUNTRIES = [
10167
10180
  var MODULE_TO_TOPIC_MAP = {
10168
10181
  ["PROFILE_PHOTO" /* PROFILE_PHOTO */]: "profile.photo.uploaded" /* PROFILE_PHOTO_UPLOADED */
10169
10182
  };
10183
+ var NEO4J_DRIVER = "NEO4J_DRIVER";
10170
10184
 
10171
10185
  // src/i18n.ts
10172
10186
  var import_i18next = __toESM(require("i18next"), 1);
@@ -11762,6 +11776,113 @@ var BaseRepository = class {
11762
11776
  return await this.model.aggregate(pipeline).exec();
11763
11777
  }
11764
11778
  };
11779
+
11780
+ // src/repo/server/neo4j.base.repository.ts
11781
+ var import_common5 = require("@nestjs/common");
11782
+ var Neo4jBaseRepository = class {
11783
+ constructor(driver) {
11784
+ this.driver = driver;
11785
+ }
11786
+ /**
11787
+ * Helper method to run a Cypher query
11788
+ * @param query The Cypher query string
11789
+ * @param params Parameters for the query
11790
+ * @returns Result of the query
11791
+ */
11792
+ async runQuery(query, params) {
11793
+ const session = this.driver.session();
11794
+ try {
11795
+ const result = await session.run(query, params);
11796
+ return result;
11797
+ } finally {
11798
+ await session.close();
11799
+ }
11800
+ }
11801
+ /**
11802
+ * Helper to write data using a transaction
11803
+ * @param query The Cypher query string
11804
+ * @param params Parameters for the query
11805
+ */
11806
+ async writeQuery(query, params) {
11807
+ const session = this.driver.session();
11808
+ try {
11809
+ return await session.executeWrite((tx) => tx.run(query, params));
11810
+ } finally {
11811
+ await session.close();
11812
+ }
11813
+ }
11814
+ /**
11815
+ * Helper to read data using a transaction
11816
+ * @param query The Cypher query string
11817
+ * @param params Parameters for the query
11818
+ */
11819
+ async readQuery(query, params) {
11820
+ const session = this.driver.session();
11821
+ try {
11822
+ return await session.executeRead((tx) => tx.run(query, params));
11823
+ } finally {
11824
+ await session.close();
11825
+ }
11826
+ }
11827
+ // ================================================
11828
+ // GENERIC CRUD HELPERS
11829
+ // ================================================
11830
+ /**
11831
+ * Insert a single node
11832
+ */
11833
+ async createNode(label, data) {
11834
+ const query = `CREATE (n:${label}) SET n = $data RETURN n`;
11835
+ return this.writeQuery(query, { data });
11836
+ }
11837
+ /**
11838
+ * Update a node by its ID (or another unique identifier)
11839
+ */
11840
+ async updateNode(label, idField, idValue, data) {
11841
+ const query = `
11842
+ MATCH (n:${label} {${idField}: $idValue})
11843
+ SET n += $data
11844
+ RETURN n
11845
+ `;
11846
+ return this.writeQuery(query, { idValue, data });
11847
+ }
11848
+ /**
11849
+ * Delete a node by its ID (DETACH DELETE removes all connected relationships too)
11850
+ */
11851
+ async deleteNode(label, idField, idValue) {
11852
+ const query = `
11853
+ MATCH (n:${label} {${idField}: $idValue})
11854
+ DETACH DELETE n
11855
+ `;
11856
+ return this.writeQuery(query, { idValue });
11857
+ }
11858
+ /**
11859
+ * Insert multiple nodes at once using UNWIND (highly optimized)
11860
+ */
11861
+ async insertManyNodes(label, dataList) {
11862
+ const query = `
11863
+ UNWIND $batch AS row
11864
+ CREATE (n:${label})
11865
+ SET n = row
11866
+ RETURN n
11867
+ `;
11868
+ return this.writeQuery(query, { batch: dataList });
11869
+ }
11870
+ /**
11871
+ * Extract properties from a single Neo4j Record node
11872
+ * @param record Neo4j Record
11873
+ * @param nodeName The variable name used in the Cypher query (e.g. 'u' in 'RETURN u')
11874
+ */
11875
+ extractNode(record, nodeName) {
11876
+ if (!record || !record.has(nodeName)) {
11877
+ return null;
11878
+ }
11879
+ const node = record.get(nodeName);
11880
+ return node.properties;
11881
+ }
11882
+ };
11883
+ Neo4jBaseRepository = __decorateClass([
11884
+ (0, import_common5.Injectable)()
11885
+ ], Neo4jBaseRepository);
11765
11886
  // Annotate the CommonJS export names for ESM import in node:
11766
11887
  0 && (module.exports = {
11767
11888
  AllExceptionsFilter,
@@ -11777,7 +11898,6 @@ var BaseRepository = class {
11777
11898
  CLS_KEYS,
11778
11899
  COLLECTIONS,
11779
11900
  COUNTRIES,
11780
- ChatMessageType,
11781
11901
  ChatParticiantRole,
11782
11902
  ChatType,
11783
11903
  DATE_FORMAT,
@@ -11803,8 +11923,11 @@ var BaseRepository = class {
11803
11923
  LOCAL_STORAGE_KEYS,
11804
11924
  MICROSERVICE_NAMES,
11805
11925
  MODULE_TO_TOPIC_MAP,
11926
+ MessageType,
11927
+ NEO4J_DRIVER,
11806
11928
  NOTIFICATION_CONTENT_MODE,
11807
11929
  NOTIFICATION_SOUND_MODE,
11930
+ Neo4jBaseRepository,
11808
11931
  NotificationChannel,
11809
11932
  NotificationResource,
11810
11933
  NotificationStatus,
package/dist/index.d.cts CHANGED
@@ -6,6 +6,7 @@ import { ClassConstructor } from 'class-transformer';
6
6
  import { ExceptionFilter } from '@nestjs/common';
7
7
  import * as rxjs from 'rxjs';
8
8
  import { Observable } from 'rxjs';
9
+ import { Driver, Result, Record as Record$1 } from 'neo4j-driver';
9
10
 
10
11
  declare class BaseException extends RpcException {
11
12
  constructor(messageOrFunc?: string | string[] | ((...args: any[]) => string | string[]), statusCode?: HttpStatus, additional?: Record<string, any>);
@@ -360,7 +361,8 @@ declare enum HttpStatus {
360
361
  }
361
362
  declare enum REDIS_KEYS {
362
363
  REDIS_CLIENT = "REDIS_CLIENT",
363
- KEYV_CLIENT = "KEYV_CLIENT"
364
+ KEYV_CLIENT = "KEYV_CLIENT",
365
+ REDIS_SUBSCRIBER_CLIENT = "REDIS_SUBSCRIBER_CLIENT"
364
366
  }
365
367
  declare enum FileOwnerModule {
366
368
  PROFILE_PHOTO = "PROFILE_PHOTO"
@@ -427,7 +429,7 @@ declare enum ChatParticiantRole {
427
429
  Owner = "owner",
428
430
  Member = "member"
429
431
  }
430
- declare enum ChatMessageType {
432
+ declare enum MessageType {
431
433
  Text = "text",
432
434
  Image = "image",
433
435
  Audio = "audio",
@@ -514,6 +516,16 @@ declare const COLLECTIONS: {
514
516
  NOTIFICATIONS: string;
515
517
  DEVICE_TOKENS: string;
516
518
  };
519
+ MESSENGER: {
520
+ CHAT: {
521
+ CHATS: string;
522
+ CHAT_PARTICIPANTS: string;
523
+ };
524
+ MESSAGE: {
525
+ MESSAGES: string;
526
+ MESSAGE_REACTIONS: string;
527
+ };
528
+ };
517
529
  };
518
530
  declare const EXPIRE_DATES: {
519
531
  JWT: {
@@ -551,6 +563,7 @@ declare const CACHE_KEYS: {
551
563
  };
552
564
  declare const COUNTRIES: ICountry[];
553
565
  declare const MODULE_TO_TOPIC_MAP: Record<FileOwnerModule, FileUploadTopic>;
566
+ declare const NEO4J_DRIVER = "NEO4J_DRIVER";
554
567
 
555
568
  declare const getLang: (args: ValidationArguments) => LANGUAGE;
556
569
  declare const validationMessage: ({ args, type, params, }: IValidateMessageOptions) => string;
@@ -876,4 +889,17 @@ declare abstract class BaseRepository<TDocument extends Document<any, any, any>,
876
889
  aggregate<R = any>(pipeline: PipelineStage[]): Promise<R[]>;
877
890
  }
878
891
 
879
- export { AllExceptionsFilter, AvatarFormats, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, ChatMessageType, ChatParticiantRole, ChatType, DATE_FORMAT, DELETE_REASON, DELETE_REASON_CODE, DEVICE_TYPE, EXPIRE_DATES, ExceptionMessages, FIELD_TRANSFORMER_REGISTRY, FIELD_TYPE, FIELD_VALIDATOR_REGISTRY, FORGOT_PASSWORD_IDENTIFIER_TYPE, FieldValidator, type FieldValidatorOptions, FileOwnerModule, FileUploadTopic, FriendshipRequestType, FriendshipStatus, GENDER, GOOGLE_AUTH_LOGIN_TYPE, HttpStatus, type IAccount, type IArrayFieldOptions, type IAvatar, type IBaseFieldOptions, type IBaseRepositoryInterface, type IBaseRepositoryOptions, type IBaseRepositoryRemoveOptions, type IBaseRepositoryUpdateOptions, type IBooleanFieldOptions, type ICountry, IDENTIFIER_TYPE, type IDateFieldOptions, type IDefaultAvatar, type IEmitTcpWithContextClientParams, type IEmitWithContextClientParams, type IEnumFieldOptions, type IFindAllResponse, type IGeneralSettings, type ILoggedUser, type INotificationSettings, type INumberFieldOptions, type IObjectFieldOptions, type IPhoneNumber, type IPrivacySettings, type IRemoveAllResponse, type IResponse, type IReturnedUser, type ISendWithContextClientParams, type IStringFieldOptions, type ITimeZone, type IValidateMessageOptions, LANGUAGE, LOCAL_STORAGE_KEYS, MICROSERVICE_NAMES, MODULE_TO_TOPIC_MAP, NOTIFICATION_CONTENT_MODE, NOTIFICATION_SOUND_MODE, NotificationChannel, NotificationResource, NotificationStatus, NotificationType, OS_TYPE, PHONE_NUMBER_ACTION, PRIVACY_SETTINGS_CHOICE, PROVIDER, PopulateOption, ProfilePhotoUpdateAction, Push_DELIVERY_STATUS, REDIS_KEYS, REDUCER_PATH, RESOURCE, ROLE, SOCIAL_LINK_PLATFORM, STARTUP_PAGE, TAG_TYPES, THEME, TIME_DIFFERENCE_TYPE, TIME_FORMAT, TOKEN_TYPE, TWO_FACTOR_ACTION, USER_STATUS, VALIDATION_TYPE, accountDeletedMessage, arrayTransform, booleanTransform, changeEmailMessage, commitKafkaOffset, dateTransform, decryptPayload, deleteAccountMessage, emailNotFoundMessage, emitWithContext, emitWithContextTcp, encryptPayload, enumTransform, forgotPasswordMessage, getLang, googleSignInMessage, lowerCaseTranform, numberTransform, objectTransform, sendWithContext, shouldShowField, signupVerifyMessage, stringTransform, twoFactorVerifyMessage, upperCaseTranform, validationMessage, verifyYourselfMessage };
892
+ declare abstract class Neo4jBaseRepository {
893
+ protected readonly driver: Driver;
894
+ protected constructor(driver: Driver);
895
+ protected runQuery(query: string, params?: any): Promise<Result>;
896
+ protected writeQuery(query: string, params?: any): Promise<Result>;
897
+ protected readQuery(query: string, params?: any): Promise<Result>;
898
+ protected createNode(label: string, data: Record<string, any>): Promise<Result>;
899
+ protected updateNode(label: string, idField: string, idValue: any, data: Record<string, any>): Promise<Result>;
900
+ protected deleteNode(label: string, idField: string, idValue: any): Promise<Result>;
901
+ protected insertManyNodes(label: string, dataList: Record<string, any>[]): Promise<Result>;
902
+ protected extractNode<T>(record: Record$1, nodeName: string): T | null;
903
+ }
904
+
905
+ export { AllExceptionsFilter, AvatarFormats, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, ChatParticiantRole, ChatType, DATE_FORMAT, DELETE_REASON, DELETE_REASON_CODE, DEVICE_TYPE, EXPIRE_DATES, ExceptionMessages, FIELD_TRANSFORMER_REGISTRY, FIELD_TYPE, FIELD_VALIDATOR_REGISTRY, FORGOT_PASSWORD_IDENTIFIER_TYPE, FieldValidator, type FieldValidatorOptions, FileOwnerModule, FileUploadTopic, FriendshipRequestType, FriendshipStatus, GENDER, GOOGLE_AUTH_LOGIN_TYPE, HttpStatus, type IAccount, type IArrayFieldOptions, type IAvatar, type IBaseFieldOptions, type IBaseRepositoryInterface, type IBaseRepositoryOptions, type IBaseRepositoryRemoveOptions, type IBaseRepositoryUpdateOptions, type IBooleanFieldOptions, type ICountry, IDENTIFIER_TYPE, type IDateFieldOptions, type IDefaultAvatar, type IEmitTcpWithContextClientParams, type IEmitWithContextClientParams, type IEnumFieldOptions, type IFindAllResponse, type IGeneralSettings, type ILoggedUser, type INotificationSettings, type INumberFieldOptions, type IObjectFieldOptions, type IPhoneNumber, type IPrivacySettings, type IRemoveAllResponse, type IResponse, type IReturnedUser, type ISendWithContextClientParams, type IStringFieldOptions, type ITimeZone, type IValidateMessageOptions, LANGUAGE, LOCAL_STORAGE_KEYS, MICROSERVICE_NAMES, MODULE_TO_TOPIC_MAP, MessageType, NEO4J_DRIVER, NOTIFICATION_CONTENT_MODE, NOTIFICATION_SOUND_MODE, Neo4jBaseRepository, NotificationChannel, NotificationResource, NotificationStatus, NotificationType, OS_TYPE, PHONE_NUMBER_ACTION, PRIVACY_SETTINGS_CHOICE, PROVIDER, PopulateOption, ProfilePhotoUpdateAction, Push_DELIVERY_STATUS, REDIS_KEYS, REDUCER_PATH, RESOURCE, ROLE, SOCIAL_LINK_PLATFORM, STARTUP_PAGE, TAG_TYPES, THEME, TIME_DIFFERENCE_TYPE, TIME_FORMAT, TOKEN_TYPE, TWO_FACTOR_ACTION, USER_STATUS, VALIDATION_TYPE, accountDeletedMessage, arrayTransform, booleanTransform, changeEmailMessage, commitKafkaOffset, dateTransform, decryptPayload, deleteAccountMessage, emailNotFoundMessage, emitWithContext, emitWithContextTcp, encryptPayload, enumTransform, forgotPasswordMessage, getLang, googleSignInMessage, lowerCaseTranform, numberTransform, objectTransform, sendWithContext, shouldShowField, signupVerifyMessage, stringTransform, twoFactorVerifyMessage, upperCaseTranform, validationMessage, verifyYourselfMessage };
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { ClassConstructor } from 'class-transformer';
6
6
  import { ExceptionFilter } from '@nestjs/common';
7
7
  import * as rxjs from 'rxjs';
8
8
  import { Observable } from 'rxjs';
9
+ import { Driver, Result, Record as Record$1 } from 'neo4j-driver';
9
10
 
10
11
  declare class BaseException extends RpcException {
11
12
  constructor(messageOrFunc?: string | string[] | ((...args: any[]) => string | string[]), statusCode?: HttpStatus, additional?: Record<string, any>);
@@ -360,7 +361,8 @@ declare enum HttpStatus {
360
361
  }
361
362
  declare enum REDIS_KEYS {
362
363
  REDIS_CLIENT = "REDIS_CLIENT",
363
- KEYV_CLIENT = "KEYV_CLIENT"
364
+ KEYV_CLIENT = "KEYV_CLIENT",
365
+ REDIS_SUBSCRIBER_CLIENT = "REDIS_SUBSCRIBER_CLIENT"
364
366
  }
365
367
  declare enum FileOwnerModule {
366
368
  PROFILE_PHOTO = "PROFILE_PHOTO"
@@ -427,7 +429,7 @@ declare enum ChatParticiantRole {
427
429
  Owner = "owner",
428
430
  Member = "member"
429
431
  }
430
- declare enum ChatMessageType {
432
+ declare enum MessageType {
431
433
  Text = "text",
432
434
  Image = "image",
433
435
  Audio = "audio",
@@ -514,6 +516,16 @@ declare const COLLECTIONS: {
514
516
  NOTIFICATIONS: string;
515
517
  DEVICE_TOKENS: string;
516
518
  };
519
+ MESSENGER: {
520
+ CHAT: {
521
+ CHATS: string;
522
+ CHAT_PARTICIPANTS: string;
523
+ };
524
+ MESSAGE: {
525
+ MESSAGES: string;
526
+ MESSAGE_REACTIONS: string;
527
+ };
528
+ };
517
529
  };
518
530
  declare const EXPIRE_DATES: {
519
531
  JWT: {
@@ -551,6 +563,7 @@ declare const CACHE_KEYS: {
551
563
  };
552
564
  declare const COUNTRIES: ICountry[];
553
565
  declare const MODULE_TO_TOPIC_MAP: Record<FileOwnerModule, FileUploadTopic>;
566
+ declare const NEO4J_DRIVER = "NEO4J_DRIVER";
554
567
 
555
568
  declare const getLang: (args: ValidationArguments) => LANGUAGE;
556
569
  declare const validationMessage: ({ args, type, params, }: IValidateMessageOptions) => string;
@@ -876,4 +889,17 @@ declare abstract class BaseRepository<TDocument extends Document<any, any, any>,
876
889
  aggregate<R = any>(pipeline: PipelineStage[]): Promise<R[]>;
877
890
  }
878
891
 
879
- export { AllExceptionsFilter, AvatarFormats, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, ChatMessageType, ChatParticiantRole, ChatType, DATE_FORMAT, DELETE_REASON, DELETE_REASON_CODE, DEVICE_TYPE, EXPIRE_DATES, ExceptionMessages, FIELD_TRANSFORMER_REGISTRY, FIELD_TYPE, FIELD_VALIDATOR_REGISTRY, FORGOT_PASSWORD_IDENTIFIER_TYPE, FieldValidator, type FieldValidatorOptions, FileOwnerModule, FileUploadTopic, FriendshipRequestType, FriendshipStatus, GENDER, GOOGLE_AUTH_LOGIN_TYPE, HttpStatus, type IAccount, type IArrayFieldOptions, type IAvatar, type IBaseFieldOptions, type IBaseRepositoryInterface, type IBaseRepositoryOptions, type IBaseRepositoryRemoveOptions, type IBaseRepositoryUpdateOptions, type IBooleanFieldOptions, type ICountry, IDENTIFIER_TYPE, type IDateFieldOptions, type IDefaultAvatar, type IEmitTcpWithContextClientParams, type IEmitWithContextClientParams, type IEnumFieldOptions, type IFindAllResponse, type IGeneralSettings, type ILoggedUser, type INotificationSettings, type INumberFieldOptions, type IObjectFieldOptions, type IPhoneNumber, type IPrivacySettings, type IRemoveAllResponse, type IResponse, type IReturnedUser, type ISendWithContextClientParams, type IStringFieldOptions, type ITimeZone, type IValidateMessageOptions, LANGUAGE, LOCAL_STORAGE_KEYS, MICROSERVICE_NAMES, MODULE_TO_TOPIC_MAP, NOTIFICATION_CONTENT_MODE, NOTIFICATION_SOUND_MODE, NotificationChannel, NotificationResource, NotificationStatus, NotificationType, OS_TYPE, PHONE_NUMBER_ACTION, PRIVACY_SETTINGS_CHOICE, PROVIDER, PopulateOption, ProfilePhotoUpdateAction, Push_DELIVERY_STATUS, REDIS_KEYS, REDUCER_PATH, RESOURCE, ROLE, SOCIAL_LINK_PLATFORM, STARTUP_PAGE, TAG_TYPES, THEME, TIME_DIFFERENCE_TYPE, TIME_FORMAT, TOKEN_TYPE, TWO_FACTOR_ACTION, USER_STATUS, VALIDATION_TYPE, accountDeletedMessage, arrayTransform, booleanTransform, changeEmailMessage, commitKafkaOffset, dateTransform, decryptPayload, deleteAccountMessage, emailNotFoundMessage, emitWithContext, emitWithContextTcp, encryptPayload, enumTransform, forgotPasswordMessage, getLang, googleSignInMessage, lowerCaseTranform, numberTransform, objectTransform, sendWithContext, shouldShowField, signupVerifyMessage, stringTransform, twoFactorVerifyMessage, upperCaseTranform, validationMessage, verifyYourselfMessage };
892
+ declare abstract class Neo4jBaseRepository {
893
+ protected readonly driver: Driver;
894
+ protected constructor(driver: Driver);
895
+ protected runQuery(query: string, params?: any): Promise<Result>;
896
+ protected writeQuery(query: string, params?: any): Promise<Result>;
897
+ protected readQuery(query: string, params?: any): Promise<Result>;
898
+ protected createNode(label: string, data: Record<string, any>): Promise<Result>;
899
+ protected updateNode(label: string, idField: string, idValue: any, data: Record<string, any>): Promise<Result>;
900
+ protected deleteNode(label: string, idField: string, idValue: any): Promise<Result>;
901
+ protected insertManyNodes(label: string, dataList: Record<string, any>[]): Promise<Result>;
902
+ protected extractNode<T>(record: Record$1, nodeName: string): T | null;
903
+ }
904
+
905
+ export { AllExceptionsFilter, AvatarFormats, BROWSER_TYPE, BaseException, BaseFindDto, BaseRemoveAllDto, BaseRemoveDto, BaseRepository, CACHE_KEYS, CHECK_UNIQUE_FIELD, CLS_KEYS, COLLECTIONS, COUNTRIES, ChatParticiantRole, ChatType, DATE_FORMAT, DELETE_REASON, DELETE_REASON_CODE, DEVICE_TYPE, EXPIRE_DATES, ExceptionMessages, FIELD_TRANSFORMER_REGISTRY, FIELD_TYPE, FIELD_VALIDATOR_REGISTRY, FORGOT_PASSWORD_IDENTIFIER_TYPE, FieldValidator, type FieldValidatorOptions, FileOwnerModule, FileUploadTopic, FriendshipRequestType, FriendshipStatus, GENDER, GOOGLE_AUTH_LOGIN_TYPE, HttpStatus, type IAccount, type IArrayFieldOptions, type IAvatar, type IBaseFieldOptions, type IBaseRepositoryInterface, type IBaseRepositoryOptions, type IBaseRepositoryRemoveOptions, type IBaseRepositoryUpdateOptions, type IBooleanFieldOptions, type ICountry, IDENTIFIER_TYPE, type IDateFieldOptions, type IDefaultAvatar, type IEmitTcpWithContextClientParams, type IEmitWithContextClientParams, type IEnumFieldOptions, type IFindAllResponse, type IGeneralSettings, type ILoggedUser, type INotificationSettings, type INumberFieldOptions, type IObjectFieldOptions, type IPhoneNumber, type IPrivacySettings, type IRemoveAllResponse, type IResponse, type IReturnedUser, type ISendWithContextClientParams, type IStringFieldOptions, type ITimeZone, type IValidateMessageOptions, LANGUAGE, LOCAL_STORAGE_KEYS, MICROSERVICE_NAMES, MODULE_TO_TOPIC_MAP, MessageType, NEO4J_DRIVER, NOTIFICATION_CONTENT_MODE, NOTIFICATION_SOUND_MODE, Neo4jBaseRepository, NotificationChannel, NotificationResource, NotificationStatus, NotificationType, OS_TYPE, PHONE_NUMBER_ACTION, PRIVACY_SETTINGS_CHOICE, PROVIDER, PopulateOption, ProfilePhotoUpdateAction, Push_DELIVERY_STATUS, REDIS_KEYS, REDUCER_PATH, RESOURCE, ROLE, SOCIAL_LINK_PLATFORM, STARTUP_PAGE, TAG_TYPES, THEME, TIME_DIFFERENCE_TYPE, TIME_FORMAT, TOKEN_TYPE, TWO_FACTOR_ACTION, USER_STATUS, VALIDATION_TYPE, accountDeletedMessage, arrayTransform, booleanTransform, changeEmailMessage, commitKafkaOffset, dateTransform, decryptPayload, deleteAccountMessage, emailNotFoundMessage, emitWithContext, emitWithContextTcp, encryptPayload, enumTransform, forgotPasswordMessage, getLang, googleSignInMessage, lowerCaseTranform, numberTransform, objectTransform, sendWithContext, shouldShowField, signupVerifyMessage, stringTransform, twoFactorVerifyMessage, upperCaseTranform, validationMessage, verifyYourselfMessage };
package/dist/index.mjs CHANGED
@@ -9824,6 +9824,7 @@ var HttpStatus = /* @__PURE__ */ ((HttpStatus4) => {
9824
9824
  var REDIS_KEYS = /* @__PURE__ */ ((REDIS_KEYS2) => {
9825
9825
  REDIS_KEYS2["REDIS_CLIENT"] = "REDIS_CLIENT";
9826
9826
  REDIS_KEYS2["KEYV_CLIENT"] = "KEYV_CLIENT";
9827
+ REDIS_KEYS2["REDIS_SUBSCRIBER_CLIENT"] = "REDIS_SUBSCRIBER_CLIENT";
9827
9828
  return REDIS_KEYS2;
9828
9829
  })(REDIS_KEYS || {});
9829
9830
  var FileOwnerModule = /* @__PURE__ */ ((FileOwnerModule2) => {
@@ -9903,16 +9904,16 @@ var ChatParticiantRole = /* @__PURE__ */ ((ChatParticiantRole2) => {
9903
9904
  ChatParticiantRole2["Member"] = "member";
9904
9905
  return ChatParticiantRole2;
9905
9906
  })(ChatParticiantRole || {});
9906
- var ChatMessageType = /* @__PURE__ */ ((ChatMessageType2) => {
9907
- ChatMessageType2["Text"] = "text";
9908
- ChatMessageType2["Image"] = "image";
9909
- ChatMessageType2["Audio"] = "audio";
9910
- ChatMessageType2["Video"] = "video";
9911
- ChatMessageType2["File"] = "file";
9912
- ChatMessageType2["Call"] = "call";
9913
- ChatMessageType2["System"] = "system";
9914
- return ChatMessageType2;
9915
- })(ChatMessageType || {});
9907
+ var MessageType = /* @__PURE__ */ ((MessageType2) => {
9908
+ MessageType2["Text"] = "text";
9909
+ MessageType2["Image"] = "image";
9910
+ MessageType2["Audio"] = "audio";
9911
+ MessageType2["Video"] = "video";
9912
+ MessageType2["File"] = "file";
9913
+ MessageType2["Call"] = "call";
9914
+ MessageType2["System"] = "system";
9915
+ return MessageType2;
9916
+ })(MessageType || {});
9916
9917
 
9917
9918
  // src/constants/server/constants.ts
9918
9919
  var MICROSERVICE_NAMES = {
@@ -9954,6 +9955,16 @@ var COLLECTIONS = {
9954
9955
  NOTIFICATION: {
9955
9956
  NOTIFICATIONS: "notifications",
9956
9957
  DEVICE_TOKENS: "device_tokens"
9958
+ },
9959
+ MESSENGER: {
9960
+ CHAT: {
9961
+ CHATS: "chats",
9962
+ CHAT_PARTICIPANTS: "chat_participants"
9963
+ },
9964
+ MESSAGE: {
9965
+ MESSAGES: "messages",
9966
+ MESSAGE_REACTIONS: "message_reactions"
9967
+ }
9957
9968
  }
9958
9969
  };
9959
9970
  var EXPIRE_DATES = {
@@ -10063,6 +10074,7 @@ var COUNTRIES = [
10063
10074
  var MODULE_TO_TOPIC_MAP = {
10064
10075
  ["PROFILE_PHOTO" /* PROFILE_PHOTO */]: "profile.photo.uploaded" /* PROFILE_PHOTO_UPLOADED */
10065
10076
  };
10077
+ var NEO4J_DRIVER = "NEO4J_DRIVER";
10066
10078
 
10067
10079
  // src/i18n.ts
10068
10080
  import i18next from "i18next";
@@ -11700,6 +11712,113 @@ var BaseRepository = class {
11700
11712
  return await this.model.aggregate(pipeline).exec();
11701
11713
  }
11702
11714
  };
11715
+
11716
+ // src/repo/server/neo4j.base.repository.ts
11717
+ import { Injectable } from "@nestjs/common";
11718
+ var Neo4jBaseRepository = class {
11719
+ constructor(driver) {
11720
+ this.driver = driver;
11721
+ }
11722
+ /**
11723
+ * Helper method to run a Cypher query
11724
+ * @param query The Cypher query string
11725
+ * @param params Parameters for the query
11726
+ * @returns Result of the query
11727
+ */
11728
+ async runQuery(query, params) {
11729
+ const session = this.driver.session();
11730
+ try {
11731
+ const result = await session.run(query, params);
11732
+ return result;
11733
+ } finally {
11734
+ await session.close();
11735
+ }
11736
+ }
11737
+ /**
11738
+ * Helper to write data using a transaction
11739
+ * @param query The Cypher query string
11740
+ * @param params Parameters for the query
11741
+ */
11742
+ async writeQuery(query, params) {
11743
+ const session = this.driver.session();
11744
+ try {
11745
+ return await session.executeWrite((tx) => tx.run(query, params));
11746
+ } finally {
11747
+ await session.close();
11748
+ }
11749
+ }
11750
+ /**
11751
+ * Helper to read data using a transaction
11752
+ * @param query The Cypher query string
11753
+ * @param params Parameters for the query
11754
+ */
11755
+ async readQuery(query, params) {
11756
+ const session = this.driver.session();
11757
+ try {
11758
+ return await session.executeRead((tx) => tx.run(query, params));
11759
+ } finally {
11760
+ await session.close();
11761
+ }
11762
+ }
11763
+ // ================================================
11764
+ // GENERIC CRUD HELPERS
11765
+ // ================================================
11766
+ /**
11767
+ * Insert a single node
11768
+ */
11769
+ async createNode(label, data) {
11770
+ const query = `CREATE (n:${label}) SET n = $data RETURN n`;
11771
+ return this.writeQuery(query, { data });
11772
+ }
11773
+ /**
11774
+ * Update a node by its ID (or another unique identifier)
11775
+ */
11776
+ async updateNode(label, idField, idValue, data) {
11777
+ const query = `
11778
+ MATCH (n:${label} {${idField}: $idValue})
11779
+ SET n += $data
11780
+ RETURN n
11781
+ `;
11782
+ return this.writeQuery(query, { idValue, data });
11783
+ }
11784
+ /**
11785
+ * Delete a node by its ID (DETACH DELETE removes all connected relationships too)
11786
+ */
11787
+ async deleteNode(label, idField, idValue) {
11788
+ const query = `
11789
+ MATCH (n:${label} {${idField}: $idValue})
11790
+ DETACH DELETE n
11791
+ `;
11792
+ return this.writeQuery(query, { idValue });
11793
+ }
11794
+ /**
11795
+ * Insert multiple nodes at once using UNWIND (highly optimized)
11796
+ */
11797
+ async insertManyNodes(label, dataList) {
11798
+ const query = `
11799
+ UNWIND $batch AS row
11800
+ CREATE (n:${label})
11801
+ SET n = row
11802
+ RETURN n
11803
+ `;
11804
+ return this.writeQuery(query, { batch: dataList });
11805
+ }
11806
+ /**
11807
+ * Extract properties from a single Neo4j Record node
11808
+ * @param record Neo4j Record
11809
+ * @param nodeName The variable name used in the Cypher query (e.g. 'u' in 'RETURN u')
11810
+ */
11811
+ extractNode(record, nodeName) {
11812
+ if (!record || !record.has(nodeName)) {
11813
+ return null;
11814
+ }
11815
+ const node = record.get(nodeName);
11816
+ return node.properties;
11817
+ }
11818
+ };
11819
+ Neo4jBaseRepository = __decorateClass([
11820
+ Injectable()
11821
+ ], Neo4jBaseRepository);
11703
11822
  export {
11704
11823
  AllExceptionsFilter,
11705
11824
  AvatarFormats,
@@ -11714,7 +11833,6 @@ export {
11714
11833
  CLS_KEYS,
11715
11834
  COLLECTIONS,
11716
11835
  COUNTRIES,
11717
- ChatMessageType,
11718
11836
  ChatParticiantRole,
11719
11837
  ChatType,
11720
11838
  DATE_FORMAT,
@@ -11740,8 +11858,11 @@ export {
11740
11858
  LOCAL_STORAGE_KEYS,
11741
11859
  MICROSERVICE_NAMES,
11742
11860
  MODULE_TO_TOPIC_MAP,
11861
+ MessageType,
11862
+ NEO4J_DRIVER,
11743
11863
  NOTIFICATION_CONTENT_MODE,
11744
11864
  NOTIFICATION_SOUND_MODE,
11865
+ Neo4jBaseRepository,
11745
11866
  NotificationChannel,
11746
11867
  NotificationResource,
11747
11868
  NotificationStatus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "connectfy-shared",
3
- "version": "0.0.125",
3
+ "version": "0.0.127",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {
@@ -36,6 +36,7 @@
36
36
  "class-validator": "^0.14.3",
37
37
  "connectfy-i18n": "^0.0.45",
38
38
  "mongoose": "^8.18.1",
39
+ "neo4j-driver": "^6.2.0",
39
40
  "nestjs-cls": "^6.2.0"
40
41
  },
41
42
  "peerDependencies": {