@optimiser/common 1.0.365 → 1.0.367

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.
Files changed (69) hide show
  1. package/dist/aws/awsservices.d.ts +39 -39
  2. package/dist/aws/awsservices.js +398 -398
  3. package/dist/constants.d.ts +35 -35
  4. package/dist/constants.js +36 -36
  5. package/dist/enums/databasetype.enum.d.ts +7 -7
  6. package/dist/enums/databasetype.enum.js +11 -11
  7. package/dist/enums/log.enum.d.ts +22 -22
  8. package/dist/enums/log.enum.js +26 -26
  9. package/dist/index.d.ts +25 -25
  10. package/dist/index.js +69 -61
  11. package/dist/lib/activity.d.ts +1 -1
  12. package/dist/lib/activity.js +44 -44
  13. package/dist/lib/calculatedbsize.d.ts +15 -15
  14. package/dist/lib/calculatedbsize.js +75 -75
  15. package/dist/lib/connection.d.ts +116 -116
  16. package/dist/lib/connection.js +595 -595
  17. package/dist/lib/convertfilesize.d.ts +2 -2
  18. package/dist/lib/convertfilesize.js +15 -15
  19. package/dist/lib/countrycode.d.ts +2 -2
  20. package/dist/lib/countrycode.js +255 -255
  21. package/dist/lib/event.d.ts +26 -26
  22. package/dist/lib/event.js +252 -248
  23. package/dist/lib/helper.d.ts +94 -93
  24. package/dist/lib/helper.js +1016 -1009
  25. package/dist/lib/memoryserverclient.d.ts +40 -40
  26. package/dist/lib/memoryserverclient.js +256 -252
  27. package/dist/lib/operautilitycommon.d.ts +65 -65
  28. package/dist/lib/operautilitycommon.js +620 -620
  29. package/dist/lib/redis.d.ts +21 -21
  30. package/dist/lib/redis.js +46 -46
  31. package/dist/lib/socketidfromredis.d.ts +3 -3
  32. package/dist/lib/socketidfromredis.js +5 -5
  33. package/dist/lib/taskutils.d.ts +40 -40
  34. package/dist/lib/taskutils.js +656 -656
  35. package/dist/lib/utility.d.ts +300 -298
  36. package/dist/lib/utility.js +5626 -5621
  37. package/dist/lib/validateRequest.d.ts +3 -3
  38. package/dist/lib/validateRequest.js +13 -13
  39. package/dist/logs/auditlog.d.ts +25 -25
  40. package/dist/logs/auditlog.js +1033 -1029
  41. package/dist/logs/checklogtable.d.ts +3 -3
  42. package/dist/logs/checklogtable.js +67 -67
  43. package/dist/logs/log.table.d.ts +7 -7
  44. package/dist/logs/log.table.js +127 -127
  45. package/dist/modals/connection.modal.d.ts +32 -32
  46. package/dist/modals/connection.modal.js +2 -2
  47. package/dist/modals/globalNotification.modal.d.ts +8 -8
  48. package/dist/modals/globalNotification.modal.js +2 -2
  49. package/dist/modals/log.modal.d.ts +64 -64
  50. package/dist/modals/log.modal.js +2 -2
  51. package/dist/modals/mail.modal.d.ts +6 -6
  52. package/dist/modals/mail.modal.js +2 -2
  53. package/dist/modals/notificationData.modal.d.ts +29 -29
  54. package/dist/modals/notificationData.modal.js +2 -2
  55. package/dist/modals/redisconfig.modal.d.ts +6 -6
  56. package/dist/modals/redisconfig.modal.js +2 -2
  57. package/dist/modals/sqsconfig.modal.d.ts +8 -8
  58. package/dist/modals/sqsconfig.modal.js +2 -2
  59. package/dist/modals/utility.modal.d.ts +17 -17
  60. package/dist/modals/utility.modal.js +2 -2
  61. package/dist/utility/crypto.d.ts +4 -4
  62. package/dist/utility/crypto.js +43 -43
  63. package/dist/utility/errorHandler.d.ts +30 -30
  64. package/dist/utility/errorHandler.js +24 -24
  65. package/dist/utility/errorHandlerForServices.d.ts +22 -22
  66. package/dist/utility/errorHandlerForServices.js +19 -19
  67. package/dist/utility/mail.d.ts +21 -21
  68. package/dist/utility/mail.js +91 -87
  69. package/package.json +3 -3
@@ -1,298 +1,300 @@
1
- import { Moment } from "moment";
2
- import { NextFunction, Response } from "express";
3
- import { ObjectId, Db } from "mongodb";
4
- import { ResponseStructure, OPT_ERROR } from "../modals/connection.modal";
5
- import { Express } from '../modals/log.modal';
6
- import { AnyObjectInterface, callBackInterface, GetEncryptedURLOptions } from "../modals/utility.modal";
7
- import { OPT_Request } from "../modals/connection.modal";
8
- import { Redis } from "ioredis";
9
- import 'moment-timezone';
10
- import { integer } from "aws-sdk/clients/cloudfront";
11
- declare function GetObjectByKeyValueFromList(list: AnyObjectInterface, key: string, val: any): any;
12
- declare function IsEqualArrays(a: [any] | [], b: [any] | []): boolean;
13
- declare function IsEqualValue(a: any, b: any): boolean;
14
- declare function AddDaysToDate(date: any, days: integer): Date;
15
- declare function CheckUserProfileField(pageData: AnyObjectInterface, profileData: AnyObjectInterface): void;
16
- declare function GetPageFieldData(pageName: string, db: any, mdb: any, msp_d: any, next: NextFunction, callback: callBackInterface): void;
17
- declare function GetPageObjectSchema(pageName: string, db: Db, next: NextFunction, callback: callBackInterface): void;
18
- declare function GetFieldDetail(objectName: string, fieldName: string, db: any, callback: callBackInterface, next: NextFunction): void;
19
- declare function UpdateRecentViewObject(objectName: string, objectID: ObjectId, userID: ObjectId, db: Db): void;
20
- declare function UpdateRecentViewFields(objectName: string, fieldID: string, userID: ObjectId, db: Db): void;
21
- declare function SyncChildObjectData(pageData: AnyObjectInterface, objectID: ObjectId, db: Db): Promise<void>;
22
- declare function SyncParentObjectData(pageData: AnyObjectInterface, objectID: ObjectId, db: Db): Promise<void>;
23
- /**
24
- * Delete field in other collection after delete records
25
- * @param objectName : ObjectName of record to which we want to delete
26
- * @param objectIDs : ObjectId of the created records of above object name collection
27
- * @param db : database connection || Db
28
- * @param params : It includes the object of remaining arguments passing here as an argument
29
- * @param params.isBuiltOnPromise : optional param need to send with params obj for to confirm function is used with promise or not!!
30
- * @param params.mongoQueryOpts :optional param sending with params obj for some specific mongodb query operation, to maintain session for transactions
31
- * @param comMasterDb : optional param sending to get it update and sync with master db.
32
- */
33
- declare function DeleteFieldInOtherCollection(objectName: string, objectIDs: ObjectId, db: Db, params?: AnyObjectInterface, comMasterDb?: Db): Promise<void>;
34
- declare function ReactivateFieldInOtherCollection(objectName: string, objectIDs: ObjectId, db: Db): void;
35
- declare function SyncFieldInSameCollection(objectName: string, objectIDs: ObjectId[], db: Db, comMasterDb?: Db): Promise<any>;
36
- declare function SyncFieldInSameCollectionByObjectID(objectName: string, objectID: ObjectId, db: Db): void;
37
- declare function SyncFieldInSameCollectionByObjectIDWithPromise(objectName: string, objectID: ObjectId, db: Db): Promise<any>;
38
- declare function SyncFieldInOtherCollection(syncFields: AnyObjectInterface[], db: Db): Promise<any>;
39
- /** Special Note: Need to create seachValue for it in QPC-6169.
40
- I've not done yet, cause it was not calling from anywhere.
41
- */
42
- declare function SyncUserInOtherCollection(options: AnyObjectInterface, db: Db, callback: callBackInterface, next: NextFunction): void;
43
- declare function GetObjectByString(o: any, s: any): any;
44
- declare function BuildLookupDataField(fieldSchema: AnyObjectInterface, updateObj: AnyObjectInterface, db: Db): Promise<void>;
45
- declare function CheckDataBeforeAdd(updateObj: AnyObjectInterface, objectSchema: AnyObjectInterface, db: Db): Promise<void>;
46
- declare function CheckDataBeforeUpdate(updateObj: AnyObjectInterface, objectData: AnyObjectInterface, objectSchema: AnyObjectInterface, db: Db): Promise<void>;
47
- declare function BuildGridFieldProjection(project: AnyObjectInterface, field: AnyObjectInterface, group?: AnyObjectInterface): void;
48
- declare function BuildFieldProjection(project: AnyObjectInterface, field: AnyObjectInterface, group: AnyObjectInterface): void;
49
- declare function BuildLookupFieldProjection(field: AnyObjectInterface, group: AnyObjectInterface, project: AnyObjectInterface, aggregateArry: AnyObjectInterface[]): void;
50
- declare function FilterConditions(condition: AnyObjectInterface, match: AnyObjectInterface, fields: AnyObjectInterface): void;
51
- declare function GirdHeaderFilters(filters: AnyObjectInterface, fields: AnyObjectInterface): {
52
- $and: AnyObjectInterface[];
53
- } | undefined;
54
- declare function FieldsGridHeaderFilters(filters: AnyObjectInterface, fields: AnyObjectInterface): {
55
- $and: AnyObjectInterface[];
56
- lookupConditions: {
57
- [x: number]: RegExp;
58
- }[];
59
- };
60
- /** @desc:{
61
- objectName: It's a name of Collection.
62
- logAction: Add | Modify | Delete
63
- objLogProp :{ // Its details of the object
64
- ObjectID: Object Id
65
- Data : Full Collection Object
66
- }
67
- }*/
68
- declare function AddLog(req: OPT_Request, objectName: string, logAction: string, objLogProp: AnyObjectInterface, db: Db, next: NextFunction): void;
69
- declare function CheckFilterFieldsProjection(condition: AnyObjectInterface, fields: AnyObjectInterface, pageData: AnyObjectInterface, project: AnyObjectInterface): void;
70
- declare function VerifyEmailPassword(options: AnyObjectInterface, callback: callBackInterface): void;
71
- declare function GetMyTeamUsers(options: AnyObjectInterface, next: NextFunction): void;
72
- declare function ExtractChildUsersTree(userId: string, childUsersArray: AnyObjectInterface[], usersTraversed: string[], counter: number, db: Db, onFetch: callBackInterface): void;
73
- declare function GetMaxKeyValueListSchema(ListName: string, db: Db): Promise<any>;
74
- declare function VerifyAWSEmailConfig(mailData: AnyObjectInterface, callback: callBackInterface): void;
75
- declare function GenerateId(obj: AnyObjectInterface): void;
76
- declare function SyncUserDetailsWithMasterDB(userData: AnyObjectInterface, callback: CallableFunction, dbMaster: Db): void;
77
- declare function SignoutUserFromAllDevices(options: AnyObjectInterface, dbMaster: Db, redisClient: Redis): void;
78
- declare function SignoutUsersWithPromise(options: AnyObjectInterface, dbMaster: Db, redisClient: Redis): Promise<unknown>;
79
- declare function SignoutMultipleUsersFromAllDevices(options: AnyObjectInterface, dbMaster: Db, redisClient: Redis): void;
80
- declare function UserLicenseConsumeCalculate(options: AnyObjectInterface): void;
81
- declare function sendMailWithUserAccount(mailObj: AnyObjectInterface, files: AnyObjectInterface, userSettings: AnyObjectInterface): Promise<any>;
82
- declare function GetEmailClientConfigs(options: AnyObjectInterface): void;
83
- declare function GetCompanyEncryptionKey(options: AnyObjectInterface): void;
84
- declare function ExecuteDynamicDMLQuery(options: AnyObjectInterface): Promise<string>;
85
- declare function ExecuteDynamicDQLQuery(options: AnyObjectInterface): Promise<AnyObjectInterface>;
86
- declare function GetUserProfilePermissions(options: AnyObjectInterface): void;
87
- declare function MakeUserPasswordInvalid(options: AnyObjectInterface): void;
88
- declare function ConvertJsonToXLXS(data: AnyObjectInterface, params: AnyObjectInterface | undefined, filePath: string): Promise<void>;
89
- declare function SendResetPasswordMail(db: Db, userDetails: AnyObjectInterface, type?: string): Promise<unknown>;
90
- declare function SendMailToSupport(mailData: AnyObjectInterface, callback: callBackInterface): void;
91
- declare function MailTemplateStructure(content: string, HasDontReplyContent?: boolean): string;
92
- declare function SendMailToCustomer(mailData: AnyObjectInterface, callback: callBackInterface): void;
93
- declare function parseMSPCookie(cookie: AnyObjectInterface): any;
94
- declare function isEmptyObj(object: AnyObjectInterface): boolean;
95
- declare function ConvertFileByteSize(bytes: number): string;
96
- declare function GetIPDetailsFromReq(req: Express.Request): Promise<{
97
- countryName: string;
98
- region: string;
99
- city: string;
100
- ip: string;
101
- }>;
102
- /**
103
- * @param res
104
- * @param params
105
- * @description Helper function to send response
106
- */
107
- declare function ReturnJsonResponse(res: Response, params: ResponseStructure): void;
108
- declare function CheckForWhiteListedDomain(req: Express.Request, whiteListedDomain: Array<string>): boolean;
109
- declare function SyncListSchemaFieldInOtherCollection(syncFields: AnyObjectInterface, db: Db, msp_d: AnyObjectInterface): Promise<void>;
110
- declare function UpdateTagCountAfterDelete(objectids: ObjectId[], objectName: string, db: Db, params?: AnyObjectInterface): Promise<void>;
111
- declare function SyncTagCountAfterUpdate(objectName: string, db: Db): void;
112
- declare function SyncUserLicenceConsumedCount(msp_d: AnyObjectInterface, db: Db, dbMaster: Db): Promise<void>;
113
- /**
114
- * @param db: database object
115
- * @param event : event module object
116
- * @param EventsList : array of events like socket event..
117
- * * @param EventName : name of event like refresh-notification
118
- * * @param EventData : event data, if needed
119
- * * @param IsSocketEvent : Type of event, currently handled for socket event only
120
- * @param UserID : creater of the event, event is not sending to sender
121
- * @param req : request object
122
- * @param req : response object
123
- * @param next : next object
124
- * @description To Broad Case any event to all company Users like refresh-notification
125
- */
126
- declare function BroadCastEventToAllCompanyUsers(params: AnyObjectInterface): void;
127
- /**
128
- * @param actionType : add, edit, delete
129
- * @description check before add update or delete operation
130
- */
131
- declare function CheckDataPermission(fieldsObj: AnyObjectInterface, pageData: AnyObjectInterface, profileData: AnyObjectInterface, actionType: string): void;
132
- /**
133
- * @param fieldsObj : company ID
134
- * @description Sync Company Licence In Master Company
135
- */
136
- declare function SyncCompanyLicenceInMasterCompanyAfterAdd(fieldsObj: AnyObjectInterface, dbMaster: Db): Promise<void>;
137
- /**
138
- * Returns date string - Date for next service with the given options
139
- *
140
- * @param object options date string
141
- * @return string - date
142
- */
143
- declare function NextServiceDateForDashboard(options: any): string;
144
- /**
145
- * Returns - Check Date Exist in Past
146
- * _common.GetWeekDayInfoInMonth("sunday");
147
- *
148
- * @param {object} currentDt moment date object
149
- * @param {object} dateToCheck moment date object
150
- * @return boolean
151
- */
152
- declare function CheckDateNotInPast(currentDt: Moment, dateToCheck: Moment): boolean;
153
- /**
154
- * Returns - date by given date, weekday and occurance like first, second -
155
- * _common.GetWeekDayByDayAndOccurance(moment().format(), 5, "fourth");
156
- *
157
- * @param {string} dt date moment date string
158
- * @param {string} weekday weekday like sunday, monday
159
- * @param {string} occuranceSeq occurence like first, second till fourth & last
160
- * @return string
161
- */
162
- declare function GetWeekDayByDayAndOccurance(dt: string, weekday: number, occuranceSeq: string): string;
163
- /**
164
- * Returns - get occurence index from list
165
- * _common.GetInterValFromOccurance("first");
166
- *
167
- * @param {string} occurVal first, second till fourth & last
168
- * @return number
169
- */
170
- declare function GetInterValFromOccurance(occurVal: string): number;
171
- /**
172
- * Returns object - Get Date information related to occurance, day index etc.
173
- *
174
- * @param {string} dt date string
175
- * @return occurance, day, month, date, dayIndex
176
- */
177
- declare function GetWeekDayInfoInMonth(dt: string): {
178
- occurance: string;
179
- day: string;
180
- month: string;
181
- date: number;
182
- dayIndex: number;
183
- };
184
- /**
185
- * Returns - weekindex
186
- * _common.GetWeekDayInfoInMonth("sunday");
187
- *
188
- * @param {string} day sunday to saturday
189
- * @return number
190
- */
191
- declare function GetDayIndex(day: string): number;
192
- declare function GetUserProfile(msp_d: AnyObjectInterface, db: Db, mdb: Db, next: NextFunction): Promise<{
193
- statusCode: number;
194
- message: string;
195
- data: any;
196
- } | undefined>;
197
- declare function CheckPageAuthentication(pageData: AnyObjectInterface, msp_d: AnyObjectInterface, db: Db, mdb: Db, next: NextFunction): Promise<boolean>;
198
- declare function RemoveFieldsFromFilters(condition: AnyObjectInterface, fields: AnyObjectInterface[], identifier: string): void;
199
- /**
200
- * @param Error Error object
201
- * @param ServiceOrigin - Error Occur in Service (Service Name)
202
- * @param EmailConfig Email configuration object
203
- * @param Module Module
204
- * @param db db connection
205
- * @description Error handler function: Send Error Email & Save Error in database
206
- */
207
- declare function ErrorHandlerForServices(Error: OPT_ERROR, ServiceOrigin: string, EmailConfig: any, Module?: string, db?: Db): Promise<any>;
208
- declare function CheckCaptcha(token: string, captcha: string, redisClient: Redis): Promise<unknown>;
209
- declare function IsStringValue(val: any): boolean;
210
- declare function ValidateSanitizeUserInput(inputFields: AnyObjectInterface, pageData: AnyObjectInterface): Promise<AnyObjectInterface[] | undefined>;
211
- declare function ValidateUserInput(options: AnyObjectInterface): Promise<string | undefined>;
212
- /**
213
- * TODO: Check conditional field criteria with user inputs
214
- *
215
- * @param {object} field Contains shcema
216
- * @param {object} record contains user inputs
217
- * @param {string} action shows add or update
218
- * @return message in string
219
- */
220
- declare function CheckConditionalField(field: any, record: any, action: string): string;
221
- /**
222
- * TODO: Check expression on date field
223
- *
224
- * @param {object} record Contains user inputs
225
- * @param {string} fieldName name
226
- * @param {string} range like 'Custom', 'today', yesterday etc.
227
- * @param {string} startDate in case of custom range
228
- * @param {string} endDate in case of custom range
229
- * @return true or false
230
- */
231
- declare function CheckExpressionOnDateField(record: any, fieldName: string, range: string, startDate: string, endDate: string): boolean;
232
- /**
233
- * TODO: Create lookup of fields of list schema for Vat Setting data
234
- *
235
- * @param {object} msp_d Contains user information
236
- * @param {object} db Database connection object
237
- * @param {object} sdata contains vat setting data including list schema
238
- * @param next middleware for error handling
239
- * @return N/A
240
- */
241
- declare function CreateBanquetingVATSettingsData(msp_d: AnyObjectInterface, db: Db, sdata: AnyObjectInterface, next: NextFunction): Promise<void>;
242
- /**
243
- * TODO: To Check if given user has access to Report Folder - THIS FUNCTION IS COPIED FROM report_controller.js
244
- *
245
- * @param {object} report Contains Report information
246
- * @param {object} db Database connection object
247
- * @param {object} msp_d Contains User id information
248
- * @param folderActiveStatus boolean default value true
249
- * @return N/A
250
- */
251
- declare function CheckReportFolderAccess(report: AnyObjectInterface, db: Db, msp_d: AnyObjectInterface, folderActiveStatus?: boolean): Promise<boolean>;
252
- /**
253
- * TODO: Return On behalf String in Calendar Invitation mails
254
- * @param fromUser From User Name
255
- * @returns string
256
- */
257
- declare function GetMailFromString(fromUser: string): string;
258
- /**
259
- * TODO: Return On behalf String in Calendar Invitation mails
260
- * @param fromUser From User Name
261
- * @param fromEmail From User Email
262
- * @returns string
263
- */
264
- declare function InvitationMailReplyContent(fromUser: string, fromEmail: string): string;
265
- /**
266
- * TODO: Check if filter has fiscal in Operator value - Recursion Function
267
- *
268
- * @param filter - object || array
269
- * @return boolean
270
- */
271
- declare function HasFiscalOperator(filter: any): boolean;
272
- /**
273
- * TODO: Return Encrypted URL
274
- *
275
- * @param recordIds - ObjectId[]
276
- * @param companyId - string
277
- * @param secretKey - string
278
- * @return object
279
- */
280
- declare function GetEncryptedURL(options: GetEncryptedURLOptions): any[];
281
- declare function GenerateBase64QRCodeData(data: string, options?: any): Promise<any>;
282
- /**
283
- * QPC-7137: getting Drive sharing
284
- *
285
- * @param parentFolderID - folder id
286
- * @param db - object db connecttion
287
- * @return array of all sharing of child file folders
288
- */
289
- declare function GetFileFolderDetailsInFolderForDriveSharing(parentFolderID: any, db: Db): Promise<any>;
290
- /**
291
- * TODO: Sync total slots remainig in Event Registration
292
- *
293
- * @param1 registration id || ObjectId
294
- * @param2 database connection || Db
295
- * @return NA
296
- */
297
- declare function SyncTotalSlotRemaining(registrationID: any, db: Db): Promise<void>;
298
- export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, UpdateRecentViewFields, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, GetObjectByString, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, FieldsGridHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, RemoveFieldsFromFilters, GetUserProfile, CheckPageAuthentication, ErrorHandlerForServices, CheckCaptcha, IsStringValue, ValidateSanitizeUserInput, ValidateUserInput, CheckConditionalField, CheckExpressionOnDateField, AddDaysToDate, CreateBanquetingVATSettingsData, CheckReportFolderAccess, GetMailFromString, InvitationMailReplyContent, HasFiscalOperator, GetEncryptedURL, GenerateBase64QRCodeData, GetFileFolderDetailsInFolderForDriveSharing, SyncTotalSlotRemaining };
1
+ import { Moment } from "moment";
2
+ import { NextFunction, Response } from "express";
3
+ import { ObjectId, Db } from "mongodb";
4
+ import { ResponseStructure, OPT_ERROR } from "../modals/connection.modal";
5
+ import { Express } from '../modals/log.modal';
6
+ import { AnyObjectInterface, callBackInterface, GetEncryptedURLOptions } from "../modals/utility.modal";
7
+ import { OPT_Request } from "../modals/connection.modal";
8
+ import { Redis } from "ioredis";
9
+ import 'moment-timezone';
10
+ import { integer } from "aws-sdk/clients/cloudfront";
11
+ declare function GetObjectByKeyValueFromList(list: AnyObjectInterface, key: string, val: any): any;
12
+ declare function IsEqualArrays(a: [any] | [], b: [any] | []): boolean;
13
+ declare function IsEqualValue(a: any, b: any): boolean;
14
+ declare function AddDaysToDate(date: any, days: integer): Date;
15
+ declare function CheckUserProfileField(pageData: AnyObjectInterface, profileData: AnyObjectInterface): void;
16
+ declare function GetPageFieldData(pageName: string, db: any, mdb: any, msp_d: any, next: NextFunction, callback: callBackInterface): void;
17
+ declare function GetPageObjectSchema(pageName: string, db: Db, next: NextFunction, callback: callBackInterface): void;
18
+ declare function GetFieldDetail(objectName: string, fieldName: string, db: any, callback: callBackInterface, next: NextFunction): void;
19
+ declare function UpdateRecentViewObject(objectName: string, objectID: ObjectId, userID: ObjectId, db: Db): void;
20
+ declare function UpdateRecentViewFields(objectName: string, fieldID: string, userID: ObjectId, db: Db): void;
21
+ declare function SyncChildObjectData(pageData: AnyObjectInterface, objectID: ObjectId, db: Db): Promise<void>;
22
+ declare function SyncParentObjectData(pageData: AnyObjectInterface, objectID: ObjectId, db: Db): Promise<void>;
23
+ /**
24
+ * Delete field in other collection after delete records
25
+ * @param objectName : ObjectName of record to which we want to delete
26
+ * @param objectIDs : ObjectId of the created records of above object name collection
27
+ * @param db : database connection || Db
28
+ * @param params : It includes the object of remaining arguments passing here as an argument
29
+ * @param params.isBuiltOnPromise : optional param need to send with params obj for to confirm function is used with promise or not!!
30
+ * @param params.mongoQueryOpts :optional param sending with params obj for some specific mongodb query operation, to maintain session for transactions
31
+ * @param comMasterDb : optional param sending to get it update and sync with master db.
32
+ */
33
+ declare function DeleteFieldInOtherCollection(objectName: string, objectIDs: ObjectId, db: Db, params?: AnyObjectInterface, comMasterDb?: Db): Promise<void>;
34
+ declare function ReactivateFieldInOtherCollection(objectName: string, objectIDs: ObjectId, db: Db): void;
35
+ declare function SyncFieldInSameCollection(objectName: string, objectIDs: ObjectId[], db: Db, comMasterDb?: Db): Promise<any>;
36
+ declare function SyncFieldInSameCollectionByObjectID(objectName: string, objectID: ObjectId, db: Db): void;
37
+ declare function SyncFieldInSameCollectionByObjectIDWithPromise(objectName: string, objectID: ObjectId, db: Db): Promise<any>;
38
+ declare function SyncFieldInOtherCollection(syncFields: AnyObjectInterface[], db: Db): Promise<any>;
39
+ /** Special Note: Need to create seachValue for it in QPC-6169.
40
+ I've not done yet, cause it was not calling from anywhere.
41
+ */
42
+ declare function SyncUserInOtherCollection(options: AnyObjectInterface, db: Db, callback: callBackInterface, next: NextFunction): void;
43
+ declare function GetObjectByString(o: any, s: any): any;
44
+ declare function BuildLookupDataField(fieldSchema: AnyObjectInterface, updateObj: AnyObjectInterface, db: Db): Promise<void>;
45
+ declare function CheckDataBeforeAdd(updateObj: AnyObjectInterface, objectSchema: AnyObjectInterface, db: Db): Promise<void>;
46
+ declare function CheckDataBeforeUpdate(updateObj: AnyObjectInterface, objectData: AnyObjectInterface, objectSchema: AnyObjectInterface, db: Db): Promise<void>;
47
+ declare function BuildGridFieldProjection(project: AnyObjectInterface, field: AnyObjectInterface, group?: AnyObjectInterface): void;
48
+ declare function BuildFieldProjection(project: AnyObjectInterface, field: AnyObjectInterface, group: AnyObjectInterface): void;
49
+ declare function BuildLookupFieldProjection(field: AnyObjectInterface, group: AnyObjectInterface, project: AnyObjectInterface, aggregateArry: AnyObjectInterface[]): void;
50
+ declare function FilterConditions(condition: AnyObjectInterface, match: AnyObjectInterface, fields: AnyObjectInterface): void;
51
+ declare function GirdHeaderFilters(filters: AnyObjectInterface, fields: AnyObjectInterface): {
52
+ $and: AnyObjectInterface[];
53
+ } | undefined;
54
+ declare function FieldsGridHeaderFilters(filters: AnyObjectInterface, fields: AnyObjectInterface): {
55
+ $and: AnyObjectInterface[];
56
+ lookupConditions: {
57
+ [x: number]: RegExp;
58
+ }[];
59
+ };
60
+ /** @desc:{
61
+ objectName: It's a name of Collection.
62
+ logAction: Add | Modify | Delete
63
+ objLogProp :{ // Its details of the object
64
+ ObjectID: Object Id
65
+ Data : Full Collection Object
66
+ }
67
+ }*/
68
+ declare function AddLog(req: OPT_Request, objectName: string, logAction: string, objLogProp: AnyObjectInterface, db: Db, next: NextFunction): void;
69
+ declare function CheckFilterFieldsProjection(condition: AnyObjectInterface, fields: AnyObjectInterface, pageData: AnyObjectInterface, project: AnyObjectInterface): void;
70
+ declare function VerifyEmailPassword(options: AnyObjectInterface, callback: callBackInterface): void;
71
+ declare function GetMyTeamUsers(options: AnyObjectInterface, next: NextFunction): void;
72
+ declare function ExtractChildUsersTree(userId: string, childUsersArray: AnyObjectInterface[], usersTraversed: string[], counter: number, db: Db, onFetch: callBackInterface): void;
73
+ declare function GetMaxKeyValueListSchema(ListName: string, db: Db): Promise<any>;
74
+ declare function VerifyAWSEmailConfig(mailData: AnyObjectInterface, callback: callBackInterface): void;
75
+ declare function GenerateId(obj: AnyObjectInterface): void;
76
+ declare function SyncUserDetailsWithMasterDB(userData: AnyObjectInterface, callback: CallableFunction, dbMaster: Db): void;
77
+ declare function SignoutUserFromAllDevices(options: AnyObjectInterface, dbMaster: Db, redisClient: Redis): void;
78
+ declare function SignoutUsersWithPromise(options: AnyObjectInterface, dbMaster: Db, redisClient: Redis): Promise<unknown>;
79
+ declare function SignoutMultipleUsersFromAllDevices(options: AnyObjectInterface, dbMaster: Db, redisClient: Redis): void;
80
+ declare function UserLicenseConsumeCalculate(options: AnyObjectInterface): void;
81
+ declare function sendMailWithUserAccount(mailObj: AnyObjectInterface, files: AnyObjectInterface, userSettings: AnyObjectInterface): Promise<any>;
82
+ declare function GetEmailClientConfigs(options: AnyObjectInterface): void;
83
+ declare function GetCompanyEncryptionKey(options: AnyObjectInterface): void;
84
+ declare function ExecuteDynamicDMLQuery(options: AnyObjectInterface): Promise<string>;
85
+ declare function ExecuteDynamicDQLQuery(options: AnyObjectInterface): Promise<AnyObjectInterface>;
86
+ declare function GetUserProfilePermissions(options: AnyObjectInterface): void;
87
+ declare function MakeUserPasswordInvalid(options: AnyObjectInterface): void;
88
+ declare function ConvertJsonToXLXS(data: AnyObjectInterface, params: AnyObjectInterface | undefined, filePath: string): Promise<void>;
89
+ declare function SendResetPasswordMail(db: Db, userDetails: AnyObjectInterface, type?: string): Promise<unknown>;
90
+ declare function SendMailToSupport(mailData: AnyObjectInterface, callback: callBackInterface): void;
91
+ declare function MailTemplateStructure(content: string, HasDontReplyContent?: boolean): string;
92
+ declare function SendMailToCustomer(mailData: AnyObjectInterface, callback: callBackInterface): void;
93
+ declare function parseMSPCookie(cookie: AnyObjectInterface): any;
94
+ declare function isEmptyObj(object: AnyObjectInterface): boolean;
95
+ declare function ConvertFileByteSize(bytes: number): string;
96
+ declare function GetIPDetailsFromReq(req: Express.Request): Promise<{
97
+ countryName: string;
98
+ region: string;
99
+ city: string;
100
+ ip: string;
101
+ }>;
102
+ /**
103
+ * @param res
104
+ * @param params
105
+ * @description Helper function to send response
106
+ */
107
+ declare function ReturnJsonResponse(res: Response, params: ResponseStructure): void;
108
+ declare function CheckForWhiteListedDomain(req: Express.Request, whiteListedDomain: Array<string>): boolean;
109
+ declare function SyncListSchemaFieldInOtherCollection(syncFields: AnyObjectInterface, db: Db, msp_d: AnyObjectInterface): Promise<void>;
110
+ declare function UpdateTagCountAfterDelete(objectids: ObjectId[], objectName: string, db: Db, params?: AnyObjectInterface): Promise<void>;
111
+ declare function SyncTagCountAfterUpdate(objectName: string, db: Db): void;
112
+ declare function SyncUserLicenceConsumedCount(msp_d: AnyObjectInterface, db: Db, dbMaster: Db): Promise<void>;
113
+ /**
114
+ * @param db: database object
115
+ * @param event : event module object
116
+ * @param EventsList : array of events like socket event..
117
+ * * @param EventName : name of event like refresh-notification
118
+ * * @param EventData : event data, if needed
119
+ * * @param IsSocketEvent : Type of event, currently handled for socket event only
120
+ * @param UserID : creater of the event, event is not sending to sender
121
+ * @param req : request object
122
+ * @param req : response object
123
+ * @param next : next object
124
+ * @description To Broad Case any event to all company Users like refresh-notification
125
+ */
126
+ declare function BroadCastEventToAllCompanyUsers(params: AnyObjectInterface): void;
127
+ /**
128
+ * @param actionType : add, edit, delete
129
+ * @description check before add update or delete operation
130
+ */
131
+ declare function CheckDataPermission(fieldsObj: AnyObjectInterface, pageData: AnyObjectInterface, profileData: AnyObjectInterface, actionType: string): void;
132
+ /**
133
+ * @param fieldsObj : company ID
134
+ * @description Sync Company Licence In Master Company
135
+ */
136
+ declare function SyncCompanyLicenceInMasterCompanyAfterAdd(fieldsObj: AnyObjectInterface, dbMaster: Db): Promise<void>;
137
+ /**
138
+ * Returns date string - Date for next service with the given options
139
+ *
140
+ * @param object options date string
141
+ * @return string - date
142
+ */
143
+ declare function NextServiceDateForDashboard(options: any): string;
144
+ /**
145
+ * Returns - Check Date Exist in Past
146
+ * _common.GetWeekDayInfoInMonth("sunday");
147
+ *
148
+ * @param {object} currentDt moment date object
149
+ * @param {object} dateToCheck moment date object
150
+ * @return boolean
151
+ */
152
+ declare function CheckDateNotInPast(currentDt: Moment, dateToCheck: Moment): boolean;
153
+ /**
154
+ * Returns - date by given date, weekday and occurance like first, second -
155
+ * _common.GetWeekDayByDayAndOccurance(moment().format(), 5, "fourth");
156
+ *
157
+ * @param {string} dt date moment date string
158
+ * @param {string} weekday weekday like sunday, monday
159
+ * @param {string} occuranceSeq occurence like first, second till fourth & last
160
+ * @return string
161
+ */
162
+ declare function GetWeekDayByDayAndOccurance(dt: string, weekday: number, occuranceSeq: string): string;
163
+ /**
164
+ * Returns - get occurence index from list
165
+ * _common.GetInterValFromOccurance("first");
166
+ *
167
+ * @param {string} occurVal first, second till fourth & last
168
+ * @return number
169
+ */
170
+ declare function GetInterValFromOccurance(occurVal: string): number;
171
+ /**
172
+ * Returns object - Get Date information related to occurance, day index etc.
173
+ *
174
+ * @param {string} dt date string
175
+ * @return occurance, day, month, date, dayIndex
176
+ */
177
+ declare function GetWeekDayInfoInMonth(dt: string): {
178
+ occurance: string;
179
+ day: string;
180
+ month: string;
181
+ date: number;
182
+ dayIndex: number;
183
+ };
184
+ /**
185
+ * Returns - weekindex
186
+ * _common.GetWeekDayInfoInMonth("sunday");
187
+ *
188
+ * @param {string} day sunday to saturday
189
+ * @return number
190
+ */
191
+ declare function GetDayIndex(day: string): number;
192
+ declare function GetUserProfile(msp_d: AnyObjectInterface, db: Db, mdb: Db, next: NextFunction): Promise<{
193
+ statusCode: number;
194
+ message: string;
195
+ data: any;
196
+ } | undefined>;
197
+ declare function CheckPageAuthentication(pageData: AnyObjectInterface, msp_d: AnyObjectInterface, db: Db, mdb: Db, next: NextFunction): Promise<boolean>;
198
+ declare function RemoveFieldsFromFilters(condition: AnyObjectInterface, fields: AnyObjectInterface[], identifier: string): void;
199
+ /**
200
+ * @param Error Error object
201
+ * @param ServiceOrigin - Error Occur in Service (Service Name)
202
+ * @param EmailConfig Email configuration object
203
+ * @param Module Module
204
+ * @param db db connection
205
+ * @description Error handler function: Send Error Email & Save Error in database
206
+ */
207
+ declare function ErrorHandlerForServices(Error: OPT_ERROR, ServiceOrigin: string, EmailConfig: any, Module?: string, db?: Db): Promise<any>;
208
+ declare function CheckCaptcha(token: string, captcha: string, redisClient: Redis): Promise<unknown>;
209
+ declare function IsStringValue(val: any): boolean;
210
+ declare function ValidateSanitizeUserInput(inputFields: AnyObjectInterface, pageData: AnyObjectInterface): Promise<(AnyObjectInterface | {
211
+ msg: string;
212
+ })[] | undefined>;
213
+ declare function ValidateUserInput(options: AnyObjectInterface): Promise<string | undefined>;
214
+ /**
215
+ * TODO: Check conditional field criteria with user inputs
216
+ *
217
+ * @param {object} field Contains shcema
218
+ * @param {object} record contains user inputs
219
+ * @param {string} action shows add or update
220
+ * @return message in string
221
+ */
222
+ declare function CheckConditionalField(field: any, record: any, action: string): string;
223
+ /**
224
+ * TODO: Check expression on date field
225
+ *
226
+ * @param {object} record Contains user inputs
227
+ * @param {string} fieldName name
228
+ * @param {string} range like 'Custom', 'today', yesterday etc.
229
+ * @param {string} startDate in case of custom range
230
+ * @param {string} endDate in case of custom range
231
+ * @return true or false
232
+ */
233
+ declare function CheckExpressionOnDateField(record: any, fieldName: string, range: string, startDate: string, endDate: string): boolean;
234
+ /**
235
+ * TODO: Create lookup of fields of list schema for Vat Setting data
236
+ *
237
+ * @param {object} msp_d Contains user information
238
+ * @param {object} db Database connection object
239
+ * @param {object} sdata contains vat setting data including list schema
240
+ * @param next middleware for error handling
241
+ * @return N/A
242
+ */
243
+ declare function CreateBanquetingVATSettingsData(msp_d: AnyObjectInterface, db: Db, sdata: AnyObjectInterface, next: NextFunction): Promise<void>;
244
+ /**
245
+ * TODO: To Check if given user has access to Report Folder - THIS FUNCTION IS COPIED FROM report_controller.js
246
+ *
247
+ * @param {object} report Contains Report information
248
+ * @param {object} db Database connection object
249
+ * @param {object} msp_d Contains User id information
250
+ * @param folderActiveStatus boolean default value true
251
+ * @return N/A
252
+ */
253
+ declare function CheckReportFolderAccess(report: AnyObjectInterface, db: Db, msp_d: AnyObjectInterface, folderActiveStatus?: boolean): Promise<boolean>;
254
+ /**
255
+ * TODO: Return On behalf String in Calendar Invitation mails
256
+ * @param fromUser From User Name
257
+ * @returns string
258
+ */
259
+ declare function GetMailFromString(fromUser: string): string;
260
+ /**
261
+ * TODO: Return On behalf String in Calendar Invitation mails
262
+ * @param fromUser From User Name
263
+ * @param fromEmail From User Email
264
+ * @returns string
265
+ */
266
+ declare function InvitationMailReplyContent(fromUser: string, fromEmail: string): string;
267
+ /**
268
+ * TODO: Check if filter has fiscal in Operator value - Recursion Function
269
+ *
270
+ * @param filter - object || array
271
+ * @return boolean
272
+ */
273
+ declare function HasFiscalOperator(filter: any): boolean;
274
+ /**
275
+ * TODO: Return Encrypted URL
276
+ *
277
+ * @param recordIds - ObjectId[]
278
+ * @param companyId - string
279
+ * @param secretKey - string
280
+ * @return object
281
+ */
282
+ declare function GetEncryptedURL(options: GetEncryptedURLOptions): any[];
283
+ declare function GenerateBase64QRCodeData(data: string, options?: any): Promise<any>;
284
+ /**
285
+ * QPC-7137: getting Drive sharing
286
+ *
287
+ * @param parentFolderID - folder id
288
+ * @param db - object db connecttion
289
+ * @return array of all sharing of child file folders
290
+ */
291
+ declare function GetFileFolderDetailsInFolderForDriveSharing(parentFolderID: any, db: Db): Promise<any>;
292
+ /**
293
+ * TODO: Sync total slots remainig in Event Registration
294
+ *
295
+ * @param1 registration id || ObjectId
296
+ * @param2 database connection || Db
297
+ * @return NA
298
+ */
299
+ declare function SyncTotalSlotRemaining(registrationID: any, db: Db): Promise<void>;
300
+ export { CheckForWhiteListedDomain, ReturnJsonResponse, ConvertFileByteSize, GetObjectByKeyValueFromList, IsEqualArrays, IsEqualValue, CheckUserProfileField, GetPageFieldData, GetPageObjectSchema, GetFieldDetail, UpdateRecentViewObject, UpdateRecentViewFields, SyncChildObjectData, SyncParentObjectData, DeleteFieldInOtherCollection, SyncFieldInSameCollection, SyncFieldInSameCollectionByObjectID, SyncFieldInSameCollectionByObjectIDWithPromise, SyncFieldInOtherCollection, SyncUserInOtherCollection, GetObjectByString, BuildLookupDataField, CheckDataBeforeAdd, CheckDataBeforeUpdate, BuildGridFieldProjection, BuildFieldProjection, BuildLookupFieldProjection, FilterConditions, GirdHeaderFilters, FieldsGridHeaderFilters, AddLog, CheckFilterFieldsProjection, VerifyEmailPassword, GetMyTeamUsers, ExtractChildUsersTree, GetMaxKeyValueListSchema, VerifyAWSEmailConfig, GenerateId, SyncUserDetailsWithMasterDB, SignoutUserFromAllDevices, SignoutUsersWithPromise, SignoutMultipleUsersFromAllDevices, UserLicenseConsumeCalculate, sendMailWithUserAccount, GetEmailClientConfigs, GetCompanyEncryptionKey, ExecuteDynamicDMLQuery, ExecuteDynamicDQLQuery, GetUserProfilePermissions, MakeUserPasswordInvalid, ConvertJsonToXLXS, SendResetPasswordMail, SendMailToSupport, MailTemplateStructure, SendMailToCustomer, parseMSPCookie, GetIPDetailsFromReq, isEmptyObj, SyncListSchemaFieldInOtherCollection, UpdateTagCountAfterDelete, SyncTagCountAfterUpdate, ReactivateFieldInOtherCollection, SyncUserLicenceConsumedCount, BroadCastEventToAllCompanyUsers, CheckDataPermission, SyncCompanyLicenceInMasterCompanyAfterAdd, NextServiceDateForDashboard, CheckDateNotInPast, GetWeekDayByDayAndOccurance, GetInterValFromOccurance, GetWeekDayInfoInMonth, GetDayIndex, RemoveFieldsFromFilters, GetUserProfile, CheckPageAuthentication, ErrorHandlerForServices, CheckCaptcha, IsStringValue, ValidateSanitizeUserInput, ValidateUserInput, CheckConditionalField, CheckExpressionOnDateField, AddDaysToDate, CreateBanquetingVATSettingsData, CheckReportFolderAccess, GetMailFromString, InvitationMailReplyContent, HasFiscalOperator, GetEncryptedURL, GenerateBase64QRCodeData, GetFileFolderDetailsInFolderForDriveSharing, SyncTotalSlotRemaining };