@resolveio/server-lib 22.2.5 → 22.2.8
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/managers/customer-notification-content.manager.d.ts +55 -0
- package/managers/customer-notification-content.manager.js +158 -0
- package/managers/customer-notification-content.manager.js.map +1 -0
- package/managers/diagnostic-manager-bootstrap.d.ts +9 -0
- package/managers/diagnostic-manager-bootstrap.js +260 -0
- package/managers/diagnostic-manager-bootstrap.js.map +1 -0
- package/managers/error-auto-fix.manager.d.ts +143 -0
- package/managers/error-auto-fix.manager.js +2934 -0
- package/managers/error-auto-fix.manager.js.map +1 -0
- package/managers/slow-query-verifier.manager.d.ts +114 -0
- package/managers/slow-query-verifier.manager.js +3358 -0
- package/managers/slow-query-verifier.manager.js.map +1 -0
- package/managers/slow-query.manager.d.ts +28 -0
- package/managers/slow-query.manager.js +468 -0
- package/managers/slow-query.manager.js.map +1 -0
- package/methods/customer-notifications.js +77 -9
- package/methods/customer-notifications.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +7 -0
- package/public_api.js +7 -0
- package/public_api.js.map +1 -1
- package/types/error-report.d.ts +25 -0
- package/types/error-report.js +4 -0
- package/types/error-report.js.map +1 -0
- package/types/slow-query-report.d.ts +27 -0
- package/types/slow-query-report.js +6 -0
- package/types/slow-query-report.js.map +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/customer-notifications.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6KA,0EAyNC;AAtYD,6CAAwC;AACxC,oGAAwF;AACxF,kEAAuD;AAEvD,yCAAmD;AAEnD,IAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,IAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,IAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACxC,IAAM,gBAAgB,GAAG,IAAI,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CAAC;gCACxB,CAAC;gCACD,IAAI,QAAQ,EAAE,CAAC;oCACd,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC;gCAC5B,CAAC;gCACD,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;oCAC9C,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;gCACvB,CAAC;gCAEK,KAAK,GAAG,kBAAkB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;gCAC1C,qBAAM,wDAAqB,CAAC,IAAI,CAAC,KAAK,EAAE;wCAC9C,IAAI,EAAE;4CACL,SAAS,EAAE,CAAC,CAAC;yCACb;wCACD,KAAK,OAAA;qCACL,CAAC,EAAA;oCALF,sBAAO,SAKL,EAAC;;;;aACH;SACD;KACD,CAAC,CAAC;AACJ,CAAC","file":"customer-notifications.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { CustomerNotifications } from '../collections/customer-notification.collection';\nimport { Users } from '../collections/user.collection';\nimport { MethodManager } from '../managers/method.manager';\nimport { objectIdHexString } from '../util/common';\n\nconst DEFAULT_LIST_LIMIT = 100;\nconst MAX_LIST_LIMIT = 500;\nconst DEDUPE_WINDOW_MS = 30 * 60 * 1000;\nconst MAX_TARGET_USERS = 5000;\n\ntype CreateCustomerNotificationPayload = {\n\ttitle: string;\n\tmessage: string;\n\tdetails?: string;\n\tcategory?: string;\n\tseverity?: string;\n\ttarget_type?: 'client' | 'users' | 'all_active';\n\tid_client?: string;\n\tclient_name?: string;\n\tid_users?: string[];\n\tsource?: string;\n\tsource_id?: string;\n\taction_label?: string;\n\taction_route?: string;\n\tdedupe_key?: string;\n\texpires_at?: Date;\n\tmetadata?: Record<string, any>;\n};\n\ntype ListCustomerNotificationsPayload = {\n\tid_user?: string;\n\tid_client?: string;\n\tstatus?: 'unread' | 'read';\n\tlimit?: number;\n};\n\nfunction normalizeString(value: any, maxLength = 500): string {\n\tconst normalized = String(value || '').trim();\n\tif (!normalized) {\n\t\treturn '';\n\t}\n\tif (normalized.length <= maxLength) {\n\t\treturn normalized;\n\t}\n\treturn normalized.slice(0, maxLength);\n}\n\nfunction normalizeNotificationCategory(value?: string): string {\n\tconst normalized = normalizeString(value, 40).toLowerCase();\n\tif (!normalized) {\n\t\treturn 'system';\n\t}\n\tif (['autofix', 'slow-query', 'system', 'manual'].includes(normalized)) {\n\t\treturn normalized;\n\t}\n\treturn 'system';\n}\n\nfunction normalizeNotificationSeverity(value?: string): string {\n\tconst normalized = normalizeString(value, 20).toLowerCase();\n\tif (!normalized) {\n\t\treturn 'info';\n\t}\n\tif (['info', 'success', 'warning', 'error'].includes(normalized)) {\n\t\treturn normalized;\n\t}\n\treturn 'info';\n}\n\nfunction normalizeListLimit(value?: number): number {\n\tconst parsed = Number(value);\n\tif (!Number.isFinite(parsed) || parsed <= 0) {\n\t\treturn DEFAULT_LIST_LIMIT;\n\t}\n\treturn Math.min(Math.floor(parsed), MAX_LIST_LIMIT);\n}\n\nfunction isSystemMethodUser(methodUser: any): boolean {\n\treturn !methodUser || methodUser === 'Internal System';\n}\n\nasync function resolveMethodUser(methodUser: any, methodUserId?: any): Promise<any | null> {\n\tif (isSystemMethodUser(methodUser)) {\n\t\treturn null;\n\t}\n\n\tif (typeof methodUser === 'object' && methodUser?._id && methodUser?.roles) {\n\t\treturn methodUser;\n\t}\n\n\tconst idUser = normalizeString(\n\t\ttypeof methodUserId === 'string'\n\t\t\t? methodUserId\n\t\t\t: (\n\t\t\t\tmethodUserId?._id ||\n\t\t\t\tmethodUserId?.id_user ||\n\t\t\t\t(typeof methodUser === 'string'\n\t\t\t\t\t? methodUser\n\t\t\t\t\t: (methodUser?._id || methodUser?.id_user || ''))\n\t\t\t),\n\t\t80\n\t);\n\tif (!idUser) {\n\t\treturn null;\n\t}\n\treturn await Users.findById(idUser);\n}\n\nfunction isSuperAdmin(user: any): boolean {\n\treturn !!user?.roles?.super_admin;\n}\n\nfunction uniqueUserIds(input: string[]): string[] {\n\tconst unique = new Set<string>();\n\tfor (const entry of (Array.isArray(input) ? input : [])) {\n\t\tconst id = normalizeString(entry, 80);\n\t\tif (id) {\n\t\t\tunique.add(id);\n\t\t}\n\t\tif (unique.size >= MAX_TARGET_USERS) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn Array.from(unique);\n}\n\nasync function resolveTargetUsers(payload: CreateCustomerNotificationPayload): Promise<string[]> {\n\tconst targetType = normalizeString(payload?.target_type || 'client', 20).toLowerCase() || 'client';\n\tif (targetType === 'users') {\n\t\treturn uniqueUserIds(payload?.id_users || []);\n\t}\n\n\tif (targetType === 'all_active') {\n\t\tconst users = await Users.find({\n\t\t\tactive: true,\n\t\t\tusername: {\n\t\t\t\t$exists: true\n\t\t\t}\n\t\t}, {\n\t\t\tprojection: {\n\t\t\t\t_id: 1\n\t\t\t},\n\t\t\tlimit: MAX_TARGET_USERS\n\t\t});\n\t\treturn uniqueUserIds(users.map((user: any) => user?._id));\n\t}\n\n\tconst idClient = normalizeString(payload?.id_client, 80);\n\tif (!idClient) {\n\t\treturn [];\n\t}\n\n\tconst users = await Users.find({\n\t\tactive: true,\n\t\tusername: {\n\t\t\t$exists: true\n\t\t},\n\t\t$or: [\n\t\t\t{'other.id_client': idClient},\n\t\t\t{'other.idClient': idClient},\n\t\t\t{id_client: idClient}\n\t\t]\n\t}, {\n\t\tprojection: {\n\t\t\t_id: 1\n\t\t},\n\t\tlimit: MAX_TARGET_USERS\n\t});\n\n\treturn uniqueUserIds(users.map((user: any) => user?._id));\n}\n\nexport function loadCustomerNotificationMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tcreateCustomerNotification: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tpayload: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(payload: CreateCustomerNotificationPayload) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst systemUser = isSystemMethodUser(this.user);\n\t\t\t\tif (!systemUser && !isSuperAdmin(methodUser)) {\n\t\t\t\t\tthrow new Error('Only super admins can create notifications.');\n\t\t\t\t}\n\n\t\t\t\tconst title = normalizeString(payload?.title, 160);\n\t\t\t\tconst message = normalizeString(payload?.message, 1500);\n\t\t\t\tif (!title || !message) {\n\t\t\t\t\tthrow new Error('Notification title and message are required.');\n\t\t\t\t}\n\n\t\t\t\tconst idClient = normalizeString(payload?.id_client, 80);\n\t\t\t\tconst clientName = normalizeString(payload?.client_name, 200);\n\t\t\t\tconst category = normalizeNotificationCategory(payload?.category);\n\t\t\t\tconst severity = normalizeNotificationSeverity(payload?.severity);\n\t\t\t\tconst details = normalizeString(payload?.details, 6000);\n\t\t\t\tconst source = normalizeString(payload?.source, 120);\n\t\t\t\tconst sourceId = normalizeString(payload?.source_id, 120);\n\t\t\t\tconst actionLabel = normalizeString(payload?.action_label, 80);\n\t\t\t\tconst actionRoute = normalizeString(payload?.action_route, 500);\n\t\t\t\tconst dedupeKey = normalizeString(payload?.dedupe_key, 160);\n\t\t\t\tconst expiresAt = payload?.expires_at instanceof Date && !Number.isNaN(payload.expires_at.getTime())\n\t\t\t\t\t? payload.expires_at\n\t\t\t\t\t: undefined;\n\t\t\t\tconst metadata = payload?.metadata && typeof payload.metadata === 'object'\n\t\t\t\t\t? payload.metadata\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst targetUsers = await resolveTargetUsers(payload);\n\t\t\t\tif (!targetUsers.length) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcreated: 0,\n\t\t\t\t\t\treason: 'no_target_users'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst now = new Date();\n\t\t\t\tconst createById = systemUser ? 'Internal System' : normalizeString(methodUser?._id, 80);\n\t\t\t\tconst createByName = systemUser\n\t\t\t\t\t? 'Internal System'\n\t\t\t\t\t: normalizeString(methodUser?.fullname || methodUser?.username, 200);\n\n\t\t\t\tlet skippedByDedupe = new Set<string>();\n\t\t\t\tif (dedupeKey) {\n\t\t\t\t\tconst cutoff = new Date(now.getTime() - DEDUPE_WINDOW_MS);\n\t\t\t\t\tconst existing = await CustomerNotifications.find({\n\t\t\t\t\t\tid_user: {\n\t\t\t\t\t\t\t$in: targetUsers\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdedupe_key: dedupeKey,\n\t\t\t\t\t\tcreatedAt: {\n\t\t\t\t\t\t\t$gte: cutoff\n\t\t\t\t\t\t}\n\t\t\t\t\t}, {\n\t\t\t\t\t\tprojection: {\n\t\t\t\t\t\t\tid_user: 1\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlimit: MAX_TARGET_USERS\n\t\t\t\t\t});\n\t\t\t\t\tskippedByDedupe = new Set(existing.map(entry => normalizeString(entry?.id_user, 80)).filter(Boolean));\n\t\t\t\t}\n\n\t\t\t\tconst docs = targetUsers\n\t\t\t\t\t.filter(idUser => !skippedByDedupe.has(idUser))\n\t\t\t\t\t.map((idUser) => ({\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tid_user: idUser,\n\t\t\t\t\t\tid_client: idClient || undefined,\n\t\t\t\t\t\tclient_name: clientName || undefined,\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tdetails: details || undefined,\n\t\t\t\t\t\tcategory,\n\t\t\t\t\t\tseverity,\n\t\t\t\t\t\tstatus: 'unread',\n\t\t\t\t\t\tread_at: undefined,\n\t\t\t\t\t\tread_by: '',\n\t\t\t\t\t\tsource: source || undefined,\n\t\t\t\t\t\tsource_id: sourceId || undefined,\n\t\t\t\t\t\taction_label: actionLabel || undefined,\n\t\t\t\t\t\taction_route: actionRoute || undefined,\n\t\t\t\t\t\tdedupe_key: dedupeKey || undefined,\n\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\texpires_at: expiresAt,\n\t\t\t\t\t\tcreated_by: createById || undefined,\n\t\t\t\t\t\tcreated_by_name: createByName || undefined,\n\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\tupdatedAt: now\n\t\t\t\t\t}));\n\n\t\t\t\tif (!docs.length) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcreated: 0,\n\t\t\t\t\t\treason: 'dedupe_suppressed'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tawait CustomerNotifications.insertMany(docs as any[]);\n\n\t\t\t\treturn {\n\t\t\t\t\tcreated: docs.length,\n\t\t\t\t\ttargeted: targetUsers.length\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\tmarkUserNotificationRead: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_notification: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(id_notification: string) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst idUser = normalizeString(methodUser?._id, 80);\n\t\t\t\tif (!idUser) {\n\t\t\t\t\tthrow new Error('You must be logged in to mark notifications as read.');\n\t\t\t\t}\n\n\t\t\t\tawait CustomerNotifications.updateOne({\n\t\t\t\t\t_id: id_notification,\n\t\t\t\t\tid_user: idUser\n\t\t\t\t}, {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tstatus: 'read',\n\t\t\t\t\t\tread_at: new Date(),\n\t\t\t\t\t\tread_by: idUser\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\t\tmarkAllUserNotificationsRead: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_client: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\toptional: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(id_client?: string) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst idUser = normalizeString(methodUser?._id, 80);\n\t\t\t\tif (!idUser) {\n\t\t\t\t\tthrow new Error('You must be logged in to mark notifications as read.');\n\t\t\t\t}\n\n\t\t\t\tconst idClient = normalizeString(id_client, 80);\n\t\t\t\tconst query: Record<string, any> = {\n\t\t\t\t\tid_user: idUser,\n\t\t\t\t\tstatus: 'unread'\n\t\t\t\t};\n\t\t\t\tif (idClient) {\n\t\t\t\t\tquery.id_client = idClient;\n\t\t\t\t}\n\n\t\t\t\tawait CustomerNotifications.updateMany(query, {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tstatus: 'read',\n\t\t\t\t\t\tread_at: new Date(),\n\t\t\t\t\t\tread_by: idUser\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\t\tlistCustomerNotifications: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tpayload: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\toptional: true,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(payload?: ListCustomerNotificationsPayload) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst systemUser = isSystemMethodUser(this.user);\n\t\t\t\tif (!systemUser && !isSuperAdmin(methodUser)) {\n\t\t\t\t\tthrow new Error('Only super admins can list all notifications.');\n\t\t\t\t}\n\n\t\t\t\tconst query: Record<string, any> = {};\n\t\t\t\tconst idUser = normalizeString(payload?.id_user, 80);\n\t\t\t\tconst idClient = normalizeString(payload?.id_client, 80);\n\t\t\t\tconst status = normalizeString(payload?.status, 20).toLowerCase();\n\t\t\t\tif (idUser) {\n\t\t\t\t\tquery.id_user = idUser;\n\t\t\t\t}\n\t\t\t\tif (idClient) {\n\t\t\t\t\tquery.id_client = idClient;\n\t\t\t\t}\n\t\t\t\tif (status === 'unread' || status === 'read') {\n\t\t\t\t\tquery.status = status;\n\t\t\t\t}\n\n\t\t\t\tconst limit = normalizeListLimit(payload?.limit);\n\t\t\t\treturn await CustomerNotifications.find(query, {\n\t\t\t\t\tsort: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M,GAAG,eAAe,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,EAAE,EAAE,CAAC,CAAC;gCAC/C,QAAQ,GAAG,eAAe,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gCACnD,MAAM,GAAG,eAAe,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;gCAClE,IAAI,MAAM,EAAE,CAAC;oCACZ,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;gCACxB,CAAC;gCACD,IAAI,QAAQ,EAAE,CAAC;oCACd,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC;gCAC5B,CAAC;gCACD,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;oCAC9C,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;gCACvB,CAAC;gCAEK,KAAK,GAAG,kBAAkB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC,CAAC;gCAC1C,qBAAM,wDAAqB,CAAC,IAAI,CAAC,KAAK,EAAE;wCAC9C,IAAI,EAAE;4CACL,SAAS,EAAE,CAAC,CAAC;yCACb;wCACD,KAAK,OAAA;qCACL,CAAC,EAAA;oCALF,sBAAO,SAKL,EAAC;;;;aACH;SACD;KACD,CAAC,CAAC;AACJ,CAAC","file":"customer-notifications.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { CustomerNotifications } from '../collections/customer-notification.collection';\nimport { Users } from '../collections/user.collection';\nimport { MethodManager } from '../managers/method.manager';\nimport { objectIdHexString } from '../util/common';\n\nconst DEFAULT_LIST_LIMIT = 100;\nconst MAX_LIST_LIMIT = 500;\nconst DEDUPE_WINDOW_MS = 30 * 60 * 1000;\nconst MAX_TARGET_USERS = 5000;\n\ntype CreateCustomerNotificationPayload = {\n\ttitle: string;\n\tmessage: string;\n\tdetails?: string;\n\tcategory?: string;\n\tseverity?: string;\n\ttarget_type?: 'client' | 'users' | 'all_active' | 'client_admins' | 'client_internal';\n\tid_client?: string;\n\tclient_name?: string;\n\tid_users?: string[];\n\tsource?: string;\n\tsource_id?: string;\n\taction_label?: string;\n\taction_route?: string;\n\tdedupe_key?: string;\n\texpires_at?: Date;\n\tmetadata?: Record<string, any>;\n};\n\ntype ListCustomerNotificationsPayload = {\n\tid_user?: string;\n\tid_client?: string;\n\tstatus?: 'unread' | 'read';\n\tlimit?: number;\n};\n\nfunction normalizeString(value: any, maxLength = 500): string {\n\tconst normalized = String(value || '').trim();\n\tif (!normalized) {\n\t\treturn '';\n\t}\n\tif (normalized.length <= maxLength) {\n\t\treturn normalized;\n\t}\n\treturn normalized.slice(0, maxLength);\n}\n\nfunction normalizeNotificationCategory(value?: string): string {\n\tconst normalized = normalizeString(value, 40).toLowerCase();\n\tif (!normalized) {\n\t\treturn 'system';\n\t}\n\tif (['autofix', 'slow-query', 'system', 'manual'].includes(normalized)) {\n\t\treturn normalized;\n\t}\n\treturn 'system';\n}\n\nfunction normalizeNotificationSeverity(value?: string): string {\n\tconst normalized = normalizeString(value, 20).toLowerCase();\n\tif (!normalized) {\n\t\treturn 'info';\n\t}\n\tif (['info', 'success', 'warning', 'error'].includes(normalized)) {\n\t\treturn normalized;\n\t}\n\treturn 'info';\n}\n\nfunction normalizeListLimit(value?: number): number {\n\tconst parsed = Number(value);\n\tif (!Number.isFinite(parsed) || parsed <= 0) {\n\t\treturn DEFAULT_LIST_LIMIT;\n\t}\n\treturn Math.min(Math.floor(parsed), MAX_LIST_LIMIT);\n}\n\nfunction isSystemMethodUser(methodUser: any): boolean {\n\treturn !methodUser || methodUser === 'Internal System';\n}\n\nasync function resolveMethodUser(methodUser: any, methodUserId?: any): Promise<any | null> {\n\tif (isSystemMethodUser(methodUser)) {\n\t\treturn null;\n\t}\n\n\tif (typeof methodUser === 'object' && methodUser?._id && methodUser?.roles) {\n\t\treturn methodUser;\n\t}\n\n\tconst idUser = normalizeString(\n\t\ttypeof methodUserId === 'string'\n\t\t\t? methodUserId\n\t\t\t: (\n\t\t\t\tmethodUserId?._id ||\n\t\t\t\tmethodUserId?.id_user ||\n\t\t\t\t(typeof methodUser === 'string'\n\t\t\t\t\t? methodUser\n\t\t\t\t\t: (methodUser?._id || methodUser?.id_user || ''))\n\t\t\t),\n\t\t80\n\t);\n\tif (!idUser) {\n\t\treturn null;\n\t}\n\treturn await Users.findById(idUser);\n}\n\nfunction isSuperAdmin(user: any): boolean {\n\treturn !!user?.roles?.super_admin;\n}\n\nfunction uniqueUserIds(input: string[]): string[] {\n\tconst unique = new Set<string>();\n\tfor (const entry of (Array.isArray(input) ? input : [])) {\n\t\tconst id = normalizeString(entry, 80);\n\t\tif (id) {\n\t\t\tunique.add(id);\n\t\t}\n\t\tif (unique.size >= MAX_TARGET_USERS) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn Array.from(unique);\n}\n\nfunction buildClientMembershipCriteria(idClient: string): Record<string, any> {\n\treturn {\n\t\t$or: [\n\t\t\t{'other.id_client': idClient},\n\t\t\t{'other.idClient': idClient},\n\t\t\t{id_client: idClient}\n\t\t]\n\t};\n}\n\nfunction buildInternalUserCriteria(): Record<string, any> {\n\treturn {\n\t\t$and: [\n\t\t\t{\n\t\t\t\tis_customer: {\n\t\t\t\t\t$ne: true\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t$nor: [\n\t\t\t\t\t{\n\t\t\t\t\t\t'other.id_customer': {\n\t\t\t\t\t\t\t$exists: true,\n\t\t\t\t\t\t\t$nin: ['', null]\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid_customer: {\n\t\t\t\t\t\t\t$exists: true,\n\t\t\t\t\t\t\t$nin: ['', null]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t};\n}\n\nfunction buildAdminUserCriteria(): Record<string, any> {\n\treturn {\n\t\t$or: [\n\t\t\t{\n\t\t\t\t'roles.super_admin': true\n\t\t\t},\n\t\t\t{\n\t\t\t\t'roles.groups.name': {\n\t\t\t\t\t$regex: 'admin',\n\t\t\t\t\t$options: 'i'\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t'roles.groups.views': {\n\t\t\t\t\t$regex: '^/manage'\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\t'roles.groups.views': '/manage'\n\t\t\t}\n\t\t]\n\t};\n}\n\nasync function resolveTargetUsers(payload: CreateCustomerNotificationPayload): Promise<string[]> {\n\tconst targetType = normalizeString(payload?.target_type || 'client', 20).toLowerCase() || 'client';\n\tif (targetType === 'users') {\n\t\treturn uniqueUserIds(payload?.id_users || []);\n\t}\n\n\tif (targetType === 'all_active') {\n\t\tconst users = await Users.find({\n\t\t\tactive: true,\n\t\t\tusername: {\n\t\t\t\t$exists: true\n\t\t\t}\n\t\t}, {\n\t\t\tprojection: {\n\t\t\t\t_id: 1\n\t\t\t},\n\t\t\tlimit: MAX_TARGET_USERS\n\t\t});\n\t\treturn uniqueUserIds(users.map((user: any) => user?._id));\n\t}\n\n\tconst idClient = normalizeString(payload?.id_client, 80);\n\tif (!idClient) {\n\t\treturn [];\n\t}\n\n\tconst andClauses: Record<string, any>[] = [\n\t\t{\n\t\t\tactive: true\n\t\t},\n\t\t{\n\t\t\tusername: {\n\t\t\t\t$exists: true\n\t\t\t}\n\t\t},\n\t\tbuildClientMembershipCriteria(idClient)\n\t];\n\n\tif (targetType === 'client_internal' || targetType === 'client_admins') {\n\t\tandClauses.push(buildInternalUserCriteria());\n\t}\n\n\tif (targetType === 'client_admins') {\n\t\tandClauses.push(buildAdminUserCriteria());\n\t}\n\n\tconst users = await Users.find({\n\t\t$and: andClauses\n\t}, {\n\t\tprojection: {\n\t\t\t_id: 1\n\t\t},\n\t\tlimit: MAX_TARGET_USERS\n\t});\n\n\treturn uniqueUserIds(users.map((user: any) => user?._id));\n}\n\nexport function loadCustomerNotificationMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tcreateCustomerNotification: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tpayload: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(payload: CreateCustomerNotificationPayload) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst systemUser = isSystemMethodUser(this.user);\n\t\t\t\tif (!systemUser && !isSuperAdmin(methodUser)) {\n\t\t\t\t\tthrow new Error('Only super admins can create notifications.');\n\t\t\t\t}\n\n\t\t\t\tconst title = normalizeString(payload?.title, 160);\n\t\t\t\tconst message = normalizeString(payload?.message, 1500);\n\t\t\t\tif (!title || !message) {\n\t\t\t\t\tthrow new Error('Notification title and message are required.');\n\t\t\t\t}\n\n\t\t\t\tconst idClient = normalizeString(payload?.id_client, 80);\n\t\t\t\tconst clientName = normalizeString(payload?.client_name, 200);\n\t\t\t\tconst category = normalizeNotificationCategory(payload?.category);\n\t\t\t\tconst severity = normalizeNotificationSeverity(payload?.severity);\n\t\t\t\tconst details = normalizeString(payload?.details, 6000);\n\t\t\t\tconst source = normalizeString(payload?.source, 120);\n\t\t\t\tconst sourceId = normalizeString(payload?.source_id, 120);\n\t\t\t\tconst actionLabel = normalizeString(payload?.action_label, 80);\n\t\t\t\tconst actionRoute = normalizeString(payload?.action_route, 500);\n\t\t\t\tconst dedupeKey = normalizeString(payload?.dedupe_key, 160);\n\t\t\t\tconst expiresAt = payload?.expires_at instanceof Date && !Number.isNaN(payload.expires_at.getTime())\n\t\t\t\t\t? payload.expires_at\n\t\t\t\t\t: undefined;\n\t\t\t\tconst metadata = payload?.metadata && typeof payload.metadata === 'object'\n\t\t\t\t\t? payload.metadata\n\t\t\t\t\t: undefined;\n\n\t\t\t\tconst targetUsers = await resolveTargetUsers(payload);\n\t\t\t\tif (!targetUsers.length) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcreated: 0,\n\t\t\t\t\t\treason: 'no_target_users'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tconst now = new Date();\n\t\t\t\tconst createById = systemUser ? 'Internal System' : normalizeString(methodUser?._id, 80);\n\t\t\t\tconst createByName = systemUser\n\t\t\t\t\t? 'Internal System'\n\t\t\t\t\t: normalizeString(methodUser?.fullname || methodUser?.username, 200);\n\n\t\t\t\tlet skippedByDedupe = new Set<string>();\n\t\t\t\tif (dedupeKey) {\n\t\t\t\t\tconst cutoff = new Date(now.getTime() - DEDUPE_WINDOW_MS);\n\t\t\t\t\tconst existing = await CustomerNotifications.find({\n\t\t\t\t\t\tid_user: {\n\t\t\t\t\t\t\t$in: targetUsers\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdedupe_key: dedupeKey,\n\t\t\t\t\t\tcreatedAt: {\n\t\t\t\t\t\t\t$gte: cutoff\n\t\t\t\t\t\t}\n\t\t\t\t\t}, {\n\t\t\t\t\t\tprojection: {\n\t\t\t\t\t\t\tid_user: 1\n\t\t\t\t\t\t},\n\t\t\t\t\t\tlimit: MAX_TARGET_USERS\n\t\t\t\t\t});\n\t\t\t\t\tskippedByDedupe = new Set(existing.map(entry => normalizeString(entry?.id_user, 80)).filter(Boolean));\n\t\t\t\t}\n\n\t\t\t\tconst docs = targetUsers\n\t\t\t\t\t.filter(idUser => !skippedByDedupe.has(idUser))\n\t\t\t\t\t.map((idUser) => ({\n\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tid_user: idUser,\n\t\t\t\t\t\tid_client: idClient || undefined,\n\t\t\t\t\t\tclient_name: clientName || undefined,\n\t\t\t\t\t\ttitle,\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tdetails: details || undefined,\n\t\t\t\t\t\tcategory,\n\t\t\t\t\t\tseverity,\n\t\t\t\t\t\tstatus: 'unread',\n\t\t\t\t\t\tread_at: undefined,\n\t\t\t\t\t\tread_by: '',\n\t\t\t\t\t\tsource: source || undefined,\n\t\t\t\t\t\tsource_id: sourceId || undefined,\n\t\t\t\t\t\taction_label: actionLabel || undefined,\n\t\t\t\t\t\taction_route: actionRoute || undefined,\n\t\t\t\t\t\tdedupe_key: dedupeKey || undefined,\n\t\t\t\t\t\tmetadata,\n\t\t\t\t\t\texpires_at: expiresAt,\n\t\t\t\t\t\tcreated_by: createById || undefined,\n\t\t\t\t\t\tcreated_by_name: createByName || undefined,\n\t\t\t\t\t\tcreatedAt: now,\n\t\t\t\t\t\tupdatedAt: now\n\t\t\t\t\t}));\n\n\t\t\t\tif (!docs.length) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcreated: 0,\n\t\t\t\t\t\treason: 'dedupe_suppressed'\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tawait CustomerNotifications.insertMany(docs as any[]);\n\n\t\t\t\treturn {\n\t\t\t\t\tcreated: docs.length,\n\t\t\t\t\ttargeted: targetUsers.length\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\tmarkUserNotificationRead: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_notification: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(id_notification: string) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst idUser = normalizeString(methodUser?._id, 80);\n\t\t\t\tif (!idUser) {\n\t\t\t\t\tthrow new Error('You must be logged in to mark notifications as read.');\n\t\t\t\t}\n\n\t\t\t\tawait CustomerNotifications.updateOne({\n\t\t\t\t\t_id: id_notification,\n\t\t\t\t\tid_user: idUser\n\t\t\t\t}, {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tstatus: 'read',\n\t\t\t\t\t\tread_at: new Date(),\n\t\t\t\t\t\tread_by: idUser\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\t\tmarkAllUserNotificationsRead: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_client: {\n\t\t\t\t\ttype: String,\n\t\t\t\t\toptional: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(id_client?: string) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst idUser = normalizeString(methodUser?._id, 80);\n\t\t\t\tif (!idUser) {\n\t\t\t\t\tthrow new Error('You must be logged in to mark notifications as read.');\n\t\t\t\t}\n\n\t\t\t\tconst idClient = normalizeString(id_client, 80);\n\t\t\t\tconst query: Record<string, any> = {\n\t\t\t\t\tid_user: idUser,\n\t\t\t\t\tstatus: 'unread'\n\t\t\t\t};\n\t\t\t\tif (idClient) {\n\t\t\t\t\tquery.id_client = idClient;\n\t\t\t\t}\n\n\t\t\t\tawait CustomerNotifications.updateMany(query, {\n\t\t\t\t\t$set: {\n\t\t\t\t\t\tstatus: 'read',\n\t\t\t\t\t\tread_at: new Date(),\n\t\t\t\t\t\tread_by: idUser\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t},\n\t\tlistCustomerNotifications: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tpayload: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\toptional: true,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async function(payload?: ListCustomerNotificationsPayload) {\n\t\t\t\tconst methodUser = await resolveMethodUser(this.user, this.id_user);\n\t\t\t\tconst systemUser = isSystemMethodUser(this.user);\n\t\t\t\tif (!systemUser && !isSuperAdmin(methodUser)) {\n\t\t\t\t\tthrow new Error('Only super admins can list all notifications.');\n\t\t\t\t}\n\n\t\t\t\tconst query: Record<string, any> = {};\n\t\t\t\tconst idUser = normalizeString(payload?.id_user, 80);\n\t\t\t\tconst idClient = normalizeString(payload?.id_client, 80);\n\t\t\t\tconst status = normalizeString(payload?.status, 20).toLowerCase();\n\t\t\t\tif (idUser) {\n\t\t\t\t\tquery.id_user = idUser;\n\t\t\t\t}\n\t\t\t\tif (idClient) {\n\t\t\t\t\tquery.id_client = idClient;\n\t\t\t\t}\n\t\t\t\tif (status === 'unread' || status === 'read') {\n\t\t\t\t\tquery.status = status;\n\t\t\t\t}\n\n\t\t\t\tconst limit = normalizeListLimit(payload?.limit);\n\t\t\t\treturn await CustomerNotifications.find(query, {\n\t\t\t\t\tsort: {\n\t\t\t\t\t\tcreatedAt: -1\n\t\t\t\t\t},\n\t\t\t\t\tlimit\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n"]}
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export * from './collections/user-group.collection';
|
|
|
29
29
|
export * from './collections/user-guide.collection';
|
|
30
30
|
export * from './collections/user.collection';
|
|
31
31
|
export * from './managers/mongo.manager';
|
|
32
|
+
export * from './managers/error-auto-fix.manager';
|
|
33
|
+
export * from './managers/slow-query-verifier.manager';
|
|
34
|
+
export * from './managers/slow-query.manager';
|
|
35
|
+
export * from './managers/customer-notification-content.manager';
|
|
36
|
+
export * from './managers/diagnostic-manager-bootstrap';
|
|
32
37
|
export * from './models/app-status.model';
|
|
33
38
|
export * from './models/app-setting.model';
|
|
34
39
|
export * from './models/ai-terminal-issue-report.model';
|
|
@@ -70,6 +75,8 @@ export * from './models/support-ticket.model';
|
|
|
70
75
|
export * from './models/user-group.model';
|
|
71
76
|
export * from './models/user-guide.model';
|
|
72
77
|
export * from './models/user.model';
|
|
78
|
+
export * from './types/error-report';
|
|
79
|
+
export * from './types/slow-query-report';
|
|
73
80
|
export * from './managers/openai-usage-ledger.manager';
|
|
74
81
|
export * from './managers/communication-metric.manager';
|
|
75
82
|
export * from './resolveio-server-app';
|
package/public_api.js
CHANGED
|
@@ -45,6 +45,11 @@ __exportStar(require("./collections/user-group.collection"), exports);
|
|
|
45
45
|
__exportStar(require("./collections/user-guide.collection"), exports);
|
|
46
46
|
__exportStar(require("./collections/user.collection"), exports);
|
|
47
47
|
__exportStar(require("./managers/mongo.manager"), exports);
|
|
48
|
+
__exportStar(require("./managers/error-auto-fix.manager"), exports);
|
|
49
|
+
__exportStar(require("./managers/slow-query-verifier.manager"), exports);
|
|
50
|
+
__exportStar(require("./managers/slow-query.manager"), exports);
|
|
51
|
+
__exportStar(require("./managers/customer-notification-content.manager"), exports);
|
|
52
|
+
__exportStar(require("./managers/diagnostic-manager-bootstrap"), exports);
|
|
48
53
|
__exportStar(require("./models/app-status.model"), exports);
|
|
49
54
|
__exportStar(require("./models/app-setting.model"), exports);
|
|
50
55
|
__exportStar(require("./models/ai-terminal-issue-report.model"), exports);
|
|
@@ -86,6 +91,8 @@ __exportStar(require("./models/support-ticket.model"), exports);
|
|
|
86
91
|
__exportStar(require("./models/user-group.model"), exports);
|
|
87
92
|
__exportStar(require("./models/user-guide.model"), exports);
|
|
88
93
|
__exportStar(require("./models/user.model"), exports);
|
|
94
|
+
__exportStar(require("./types/error-report"), exports);
|
|
95
|
+
__exportStar(require("./types/slow-query-report"), exports);
|
|
89
96
|
__exportStar(require("./managers/openai-usage-ledger.manager"), exports);
|
|
90
97
|
__exportStar(require("./managers/communication-metric.manager"), exports);
|
|
91
98
|
__exportStar(require("./resolveio-server-app"), exports);
|
package/public_api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,uEAAqD;AACrD,oFAAkE;AAClE,oFAAkE;AAClE,+EAA6D;AAC7D,mEAAiD;AACjD,iFAA+D;AAC/D,gFAA8D;AAC9D,4EAA0D;AAC1D,oEAAkD;AAClD,yEAAuD;AACvD,0EAAwD;AACxD,gEAA8C;AAC9C,uEAAqD;AACrD,gEAA8C;AAC9C,8EAA4D;AAC5D,4EAA0D;AAC1D,+DAA6C;AAC7C,2EAAyD;AACzD,uEAAqD;AACrD,4EAA0D;AAC1D,0EAAwD;AACxD,yEAAuD;AACvD,wEAAsD;AACtD,+EAA6D;AAC7D,kFAAgE;AAChE,iFAA+D;AAC/D,sEAAoD;AACpD,sEAAoD;AACpD,gEAA8C;AAC9C,2DAAyC;AACzC,4DAA0C;AAC1C,6DAA2C;AAC3C,0EAAwD;AACxD,0EAAwD;AACxD,qEAAmD;AACnD,yEAAuD;AACvD,qEAAmD;AACnD,sEAAoD;AACpD,yDAAuC;AACvC,uEAAqD;AACrD,kEAAgD;AAChD,0DAAwC;AACxC,wDAAsC;AACtC,+DAA6C;AAC7C,gEAA8C;AAC9C,sDAAoC;AACpC,6DAA2C;AAC3C,sDAAoC;AACpC,oEAAkD;AAClD,kEAAgD;AAChD,qDAAmC;AACnC,iEAA+C;AAC/C,iEAA+C;AAC/C,wDAAsC;AACtC,6DAA2C;AAC3C,gEAA8C;AAC9C,+DAA6C;AAC7C,8DAA4C;AAC5C,qEAAmD;AACnD,4DAA0C;AAC1C,4DAA0C;AAC1C,wEAAsD;AACtD,uEAAqD;AACrD,gEAA8C;AAC9C,mEAAiD;AACjD,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,4DAA0C;AAC1C,4DAA0C;AAC1C,sDAAoC;AACpC,yEAAuD;AACvD,0EAAwD;AACxD,yDAAuC;AACvC,2DAAyC;AACzC,0DAAwC;AACxC,gDAA8B;AAC9B,mDAAiC","file":"public_api.js","sourcesContent":["export * from './collections/app-status.collection';\nexport * from './collections/app-setting.collection';\nexport * from './collections/ai-terminal-issue-report.collection';\nexport * from './collections/ai-terminal-conversation.collection';\nexport * from './collections/ai-terminal-message.collection';\nexport * from './collections/counter.collection';\nexport * from './collections/customer-notification.collection';\nexport * from './collections/communication-metric.collection';\nexport * from './collections/cron-job-history.collection';\nexport * from './collections/cron-job.collection';\nexport * from './collections/email-history.collection';\nexport * from './collections/email-verified.collection';\nexport * from './collections/file.collection';\nexport * from './collections/flag-update.collection';\nexport * from './collections/flag.collection';\nexport * from './collections/log-method-latency.collection';\nexport * from './collections/log-subscription.collection';\nexport * from './collections/log.collection';\nexport * from './collections/logged-in-users.collection';\nexport * from './collections/monitor-cpu.collection';\nexport * from './collections/monitor-function.collection';\nexport * from './collections/monitor-memory.collection';\nexport * from './collections/monitor-mongo.collection';\nexport * from './collections/notification.collection';\nexport * from './collections/openai-usage-ledger.collection';\nexport * from './collections/report-builder-library.collection';\nexport * from './collections/report-builder-report.collection';\nexport * from './collections/user-group.collection';\nexport * from './collections/user-guide.collection';\nexport * from './collections/user.collection';\nexport * from './managers/mongo.manager';\nexport * from './models/app-status.model';\nexport * from './models/app-setting.model';\nexport * from './models/ai-terminal-issue-report.model';\nexport * from './models/ai-terminal-conversation.model';\nexport * from './models/ai-terminal-message.model';\nexport * from './models/billing-logged-in-users.model';\nexport * from './models/collection-document.model';\nexport * from './models/communication-metric.model';\nexport * from './models/counter.model';\nexport * from './models/customer-notification.model';\nexport * from './models/cron-job-history.model';\nexport * from './models/cron-job.model';\nexport * from './models/dialog.model';\nexport * from './models/email-history.model';\nexport * from './models/email-verified.model';\nexport * from './models/file.model';\nexport * from './models/flag-update.model';\nexport * from './models/flag.model';\nexport * from './models/log-method-latency.model';\nexport * from './models/log-subscription.model';\nexport * from './models/log.model';\nexport * from './models/logged-in-users.model';\nexport * from './models/method-response.model';\nexport * from './models/method.model';\nexport * from './models/monitor-cpu.model';\nexport * from './models/monitor-memory.model';\nexport * from './models/monitor-mongo.model';\nexport * from './models/notification.model';\nexport * from './models/openai-usage-ledger.model';\nexport * from './models/pagination.model';\nexport * from './models/permission.model';\nexport * from './models/report-builder-library.model';\nexport * from './models/report-builder-report.model';\nexport * from './models/report-builder.model';\nexport * from './models/select-data-label.model';\nexport * from './models/server-message.model';\nexport * from './models/subscription.model';\nexport * from './models/support-ticket.model';\nexport * from './models/user-group.model';\nexport * from './models/user-guide.model';\nexport * from './models/user.model';\nexport * from './managers/openai-usage-ledger.manager';\nexport * from './managers/communication-metric.manager';\nexport * from './resolveio-server-app';\nexport * from './services/openai-client';\nexport * from './services/codex-client';\nexport * from './util/common';\nexport * from './util/tokenizer';\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,uEAAqD;AACrD,oFAAkE;AAClE,oFAAkE;AAClE,+EAA6D;AAC7D,mEAAiD;AACjD,iFAA+D;AAC/D,gFAA8D;AAC9D,4EAA0D;AAC1D,oEAAkD;AAClD,yEAAuD;AACvD,0EAAwD;AACxD,gEAA8C;AAC9C,uEAAqD;AACrD,gEAA8C;AAC9C,8EAA4D;AAC5D,4EAA0D;AAC1D,+DAA6C;AAC7C,2EAAyD;AACzD,uEAAqD;AACrD,4EAA0D;AAC1D,0EAAwD;AACxD,yEAAuD;AACvD,wEAAsD;AACtD,+EAA6D;AAC7D,kFAAgE;AAChE,iFAA+D;AAC/D,sEAAoD;AACpD,sEAAoD;AACpD,gEAA8C;AAC9C,2DAAyC;AACzC,oEAAkD;AAClD,yEAAuD;AACvD,gEAA8C;AAC9C,mFAAiE;AACjE,0EAAwD;AACxD,4DAA0C;AAC1C,6DAA2C;AAC3C,0EAAwD;AACxD,0EAAwD;AACxD,qEAAmD;AACnD,yEAAuD;AACvD,qEAAmD;AACnD,sEAAoD;AACpD,yDAAuC;AACvC,uEAAqD;AACrD,kEAAgD;AAChD,0DAAwC;AACxC,wDAAsC;AACtC,+DAA6C;AAC7C,gEAA8C;AAC9C,sDAAoC;AACpC,6DAA2C;AAC3C,sDAAoC;AACpC,oEAAkD;AAClD,kEAAgD;AAChD,qDAAmC;AACnC,iEAA+C;AAC/C,iEAA+C;AAC/C,wDAAsC;AACtC,6DAA2C;AAC3C,gEAA8C;AAC9C,+DAA6C;AAC7C,8DAA4C;AAC5C,qEAAmD;AACnD,4DAA0C;AAC1C,4DAA0C;AAC1C,wEAAsD;AACtD,uEAAqD;AACrD,gEAA8C;AAC9C,mEAAiD;AACjD,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,4DAA0C;AAC1C,4DAA0C;AAC1C,sDAAoC;AACpC,uDAAqC;AACrC,4DAA0C;AAC1C,yEAAuD;AACvD,0EAAwD;AACxD,yDAAuC;AACvC,2DAAyC;AACzC,0DAAwC;AACxC,gDAA8B;AAC9B,mDAAiC","file":"public_api.js","sourcesContent":["export * from './collections/app-status.collection';\nexport * from './collections/app-setting.collection';\nexport * from './collections/ai-terminal-issue-report.collection';\nexport * from './collections/ai-terminal-conversation.collection';\nexport * from './collections/ai-terminal-message.collection';\nexport * from './collections/counter.collection';\nexport * from './collections/customer-notification.collection';\nexport * from './collections/communication-metric.collection';\nexport * from './collections/cron-job-history.collection';\nexport * from './collections/cron-job.collection';\nexport * from './collections/email-history.collection';\nexport * from './collections/email-verified.collection';\nexport * from './collections/file.collection';\nexport * from './collections/flag-update.collection';\nexport * from './collections/flag.collection';\nexport * from './collections/log-method-latency.collection';\nexport * from './collections/log-subscription.collection';\nexport * from './collections/log.collection';\nexport * from './collections/logged-in-users.collection';\nexport * from './collections/monitor-cpu.collection';\nexport * from './collections/monitor-function.collection';\nexport * from './collections/monitor-memory.collection';\nexport * from './collections/monitor-mongo.collection';\nexport * from './collections/notification.collection';\nexport * from './collections/openai-usage-ledger.collection';\nexport * from './collections/report-builder-library.collection';\nexport * from './collections/report-builder-report.collection';\nexport * from './collections/user-group.collection';\nexport * from './collections/user-guide.collection';\nexport * from './collections/user.collection';\nexport * from './managers/mongo.manager';\nexport * from './managers/error-auto-fix.manager';\nexport * from './managers/slow-query-verifier.manager';\nexport * from './managers/slow-query.manager';\nexport * from './managers/customer-notification-content.manager';\nexport * from './managers/diagnostic-manager-bootstrap';\nexport * from './models/app-status.model';\nexport * from './models/app-setting.model';\nexport * from './models/ai-terminal-issue-report.model';\nexport * from './models/ai-terminal-conversation.model';\nexport * from './models/ai-terminal-message.model';\nexport * from './models/billing-logged-in-users.model';\nexport * from './models/collection-document.model';\nexport * from './models/communication-metric.model';\nexport * from './models/counter.model';\nexport * from './models/customer-notification.model';\nexport * from './models/cron-job-history.model';\nexport * from './models/cron-job.model';\nexport * from './models/dialog.model';\nexport * from './models/email-history.model';\nexport * from './models/email-verified.model';\nexport * from './models/file.model';\nexport * from './models/flag-update.model';\nexport * from './models/flag.model';\nexport * from './models/log-method-latency.model';\nexport * from './models/log-subscription.model';\nexport * from './models/log.model';\nexport * from './models/logged-in-users.model';\nexport * from './models/method-response.model';\nexport * from './models/method.model';\nexport * from './models/monitor-cpu.model';\nexport * from './models/monitor-memory.model';\nexport * from './models/monitor-mongo.model';\nexport * from './models/notification.model';\nexport * from './models/openai-usage-ledger.model';\nexport * from './models/pagination.model';\nexport * from './models/permission.model';\nexport * from './models/report-builder-library.model';\nexport * from './models/report-builder-report.model';\nexport * from './models/report-builder.model';\nexport * from './models/select-data-label.model';\nexport * from './models/server-message.model';\nexport * from './models/subscription.model';\nexport * from './models/support-ticket.model';\nexport * from './models/user-group.model';\nexport * from './models/user-guide.model';\nexport * from './models/user.model';\nexport * from './types/error-report';\nexport * from './types/slow-query-report';\nexport * from './managers/openai-usage-ledger.manager';\nexport * from './managers/communication-metric.manager';\nexport * from './resolveio-server-app';\nexport * from './services/openai-client';\nexport * from './services/codex-client';\nexport * from './util/common';\nexport * from './util/tokenizer';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ErrorReportAttachment {
|
|
2
|
+
name?: string;
|
|
3
|
+
url?: string;
|
|
4
|
+
contentType?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ErrorReportPayload {
|
|
8
|
+
clientId?: string;
|
|
9
|
+
clientName?: string;
|
|
10
|
+
clientRepo?: string;
|
|
11
|
+
clientEmail?: string;
|
|
12
|
+
clientSlug?: string;
|
|
13
|
+
sourceApp: string;
|
|
14
|
+
environment?: string;
|
|
15
|
+
severity?: string;
|
|
16
|
+
message: string;
|
|
17
|
+
stack?: string;
|
|
18
|
+
context?: Record<string, any>;
|
|
19
|
+
metadata?: Record<string, any>;
|
|
20
|
+
attachments?: ErrorReportAttachment[];
|
|
21
|
+
fingerprint?: string;
|
|
22
|
+
idempotencyKey?: string;
|
|
23
|
+
reportedBy?: string;
|
|
24
|
+
reportedAt?: Date;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/error-report.ts"],"names":[],"mappings":"","file":"error-report.js","sourcesContent":["export interface ErrorReportAttachment {\n\tname?: string;\n\turl?: string;\n\tcontentType?: string;\n\tsize?: number;\n}\n\nexport interface ErrorReportPayload {\n\tclientId?: string;\n\tclientName?: string;\n\tclientRepo?: string;\n\tclientEmail?: string;\n\tclientSlug?: string;\n\tsourceApp: string;\n\tenvironment?: string;\n\tseverity?: string;\n\tmessage: string;\n\tstack?: string;\n\tcontext?: Record<string, any>;\n\tmetadata?: Record<string, any>;\n\tattachments?: ErrorReportAttachment[];\n\tfingerprint?: string;\n\tidempotencyKey?: string;\n\treportedBy?: string;\n\treportedAt?: Date;\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type SlowQueryLogStatus = 'new' | 'investigating' | 'queued' | 'optimized' | 'ignored';
|
|
2
|
+
export declare const slowQueryLogStatuses: SlowQueryLogStatus[];
|
|
3
|
+
export interface SlowQueryReportPayload {
|
|
4
|
+
queryHash: string;
|
|
5
|
+
collection: string;
|
|
6
|
+
filter?: Record<string, any>;
|
|
7
|
+
options?: Record<string, any>;
|
|
8
|
+
durationMs: number;
|
|
9
|
+
maxDurationMs?: number;
|
|
10
|
+
thresholdMs?: number;
|
|
11
|
+
explainPlan?: Record<string, any>;
|
|
12
|
+
explainExecutionStats?: Record<string, any>;
|
|
13
|
+
explainGeneratedAt?: Date | string;
|
|
14
|
+
clientSlug?: string;
|
|
15
|
+
clientName?: string;
|
|
16
|
+
environment?: string;
|
|
17
|
+
sourceApp?: string;
|
|
18
|
+
nodeHostname?: string;
|
|
19
|
+
status?: SlowQueryLogStatus;
|
|
20
|
+
ignored?: boolean;
|
|
21
|
+
notes?: string;
|
|
22
|
+
pipeline?: Record<string, any>[];
|
|
23
|
+
server_url?: string;
|
|
24
|
+
publication?: string;
|
|
25
|
+
subscription_data?: any[];
|
|
26
|
+
userId?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/slow-query-report.ts"],"names":[],"mappings":";;;AACa,QAAA,oBAAoB,GAAyB,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC","file":"slow-query-report.js","sourcesContent":["export type SlowQueryLogStatus = 'new' | 'investigating' | 'queued' | 'optimized' | 'ignored';\nexport const slowQueryLogStatuses: SlowQueryLogStatus[] = ['new', 'investigating', 'queued', 'optimized', 'ignored'];\n\nexport interface SlowQueryReportPayload {\n\tqueryHash: string;\n\tcollection: string;\n\tfilter?: Record<string, any>;\n\toptions?: Record<string, any>;\n\tdurationMs: number;\n\tmaxDurationMs?: number;\n\tthresholdMs?: number;\n\texplainPlan?: Record<string, any>;\n\texplainExecutionStats?: Record<string, any>;\n\texplainGeneratedAt?: Date | string;\n\tclientSlug?: string;\n\tclientName?: string;\n\tenvironment?: string;\n\tsourceApp?: string;\n\tnodeHostname?: string;\n\tstatus?: SlowQueryLogStatus;\n\tignored?: boolean;\n\tnotes?: string;\n\tpipeline?: Record<string, any>[];\n\tserver_url?: string;\n\tpublication?: string;\n\tsubscription_data?: any[];\n\tuserId?: string;\n}\n"]}
|