@resolveio/server-lib 22.2.1 → 22.2.2
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/collections/customer-notification.collection.d.ts +3 -0
- package/collections/customer-notification.collection.js +130 -0
- package/collections/customer-notification.collection.js.map +1 -0
- package/managers/local-log.manager.js +1 -2
- package/managers/local-log.manager.js.map +1 -1
- package/managers/method.manager.js +3 -2
- package/managers/method.manager.js.map +1 -1
- package/managers/mongo.manager.js +18 -36
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +4 -8
- package/managers/monitor.manager.js.map +1 -1
- package/managers/subscription.manager.js +2 -0
- package/managers/subscription.manager.js.map +1 -1
- package/methods/customer-notifications.d.ts +2 -0
- package/methods/customer-notifications.js +456 -0
- package/methods/customer-notifications.js.map +1 -0
- package/methods/logs.js +2 -4
- package/methods/logs.js.map +1 -1
- package/methods.ts +12 -0
- package/models/customer-notification.model.d.ts +26 -0
- package/models/customer-notification.model.js +4 -0
- package/models/customer-notification.model.js.map +1 -0
- package/package.json +1 -1
- package/public_api.d.ts +2 -0
- package/public_api.js +2 -0
- package/public_api.js.map +1 -1
- package/publications/customer-notifications.d.ts +2 -0
- package/publications/customer-notifications.js +161 -0
- package/publications/customer-notifications.js.map +1 -0
- package/publications.ts +6 -0
- package/resolveio-server-app.d.ts +4 -0
- package/resolveio-server-app.js +38 -0
- package/resolveio-server-app.js.map +1 -1
- package/server-app.js +2 -4
- package/server-app.js.map +1 -1
package/methods.ts
CHANGED
|
@@ -60,6 +60,9 @@ export function SERVER_METHODS(resolveioServer) {
|
|
|
60
60
|
countCollectionWithQuery: (collectionType: string, query: Object, cb?: Function): Promise<any> => {
|
|
61
61
|
return resolveioServer.call('countCollectionWithQuery', collectionType, query, cb);
|
|
62
62
|
},
|
|
63
|
+
createCustomerNotification: (payload: CreateCustomerNotificationPayload, cb?: Function): Promise<any> => {
|
|
64
|
+
return resolveioServer.call('createCustomerNotification', payload, cb);
|
|
65
|
+
},
|
|
63
66
|
createUserAndEmailEnrollment: (newUser: UserModel, sendEnrollmentEmail = true, cb?: Function): Promise<any> => {
|
|
64
67
|
return resolveioServer.call('createUserAndEmailEnrollment', newUser, sendEnrollmentEmail, cb);
|
|
65
68
|
},
|
|
@@ -138,6 +141,15 @@ export function SERVER_METHODS(resolveioServer) {
|
|
|
138
141
|
insertSubscriptionLog: (type, subscription, collection_name, subData, cb?: Function): Promise<any> => {
|
|
139
142
|
return resolveioServer.call('insertSubscriptionLog', type, subscription, collection_name, subData, cb);
|
|
140
143
|
},
|
|
144
|
+
listCustomerNotifications: (payload?: ListCustomerNotificationsPayload, cb?: Function): Promise<any> => {
|
|
145
|
+
return resolveioServer.call('listCustomerNotifications', payload, cb);
|
|
146
|
+
},
|
|
147
|
+
markAllUserNotificationsRead: (id_client?: string, cb?: Function): Promise<any> => {
|
|
148
|
+
return resolveioServer.call('markAllUserNotificationsRead', id_client, cb);
|
|
149
|
+
},
|
|
150
|
+
markUserNotificationRead: (id_notification: string, cb?: Function): Promise<any> => {
|
|
151
|
+
return resolveioServer.call('markUserNotificationRead', id_notification, cb);
|
|
152
|
+
},
|
|
141
153
|
mergePDFResolve: (fileKeys: string[], fileName: string, fileType?: string, cb?: Function): Promise<any> => {
|
|
142
154
|
return resolveioServer.call('mergePDFResolve', fileKeys, fileName, fileType, cb);
|
|
143
155
|
},
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export type CustomerNotificationStatus = 'unread' | 'read';
|
|
3
|
+
export type CustomerNotificationSeverity = 'info' | 'success' | 'warning' | 'error';
|
|
4
|
+
export type CustomerNotificationCategory = 'autofix' | 'slow-query' | 'system' | 'manual';
|
|
5
|
+
export interface CustomerNotificationModel extends CollectionDocument {
|
|
6
|
+
id_user: string;
|
|
7
|
+
id_client?: string;
|
|
8
|
+
client_name?: string;
|
|
9
|
+
title: string;
|
|
10
|
+
message: string;
|
|
11
|
+
details?: string;
|
|
12
|
+
category?: CustomerNotificationCategory | string;
|
|
13
|
+
severity?: CustomerNotificationSeverity | string;
|
|
14
|
+
status: CustomerNotificationStatus;
|
|
15
|
+
read_at?: Date;
|
|
16
|
+
read_by?: string;
|
|
17
|
+
source?: string;
|
|
18
|
+
source_id?: string;
|
|
19
|
+
action_label?: string;
|
|
20
|
+
action_route?: string;
|
|
21
|
+
dedupe_key?: string;
|
|
22
|
+
metadata?: Record<string, any>;
|
|
23
|
+
expires_at?: Date;
|
|
24
|
+
created_by?: string;
|
|
25
|
+
created_by_name?: string;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/models/customer-notification.model.ts"],"names":[],"mappings":"","file":"customer-notification.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport type CustomerNotificationStatus = 'unread' | 'read';\nexport type CustomerNotificationSeverity = 'info' | 'success' | 'warning' | 'error';\nexport type CustomerNotificationCategory = 'autofix' | 'slow-query' | 'system' | 'manual';\n\nexport interface CustomerNotificationModel extends CollectionDocument {\n\tid_user: string;\n\tid_client?: string;\n\tclient_name?: string;\n\ttitle: string;\n\tmessage: string;\n\tdetails?: string;\n\tcategory?: CustomerNotificationCategory | string;\n\tseverity?: CustomerNotificationSeverity | string;\n\tstatus: CustomerNotificationStatus;\n\tread_at?: Date;\n\tread_by?: string;\n\tsource?: string;\n\tsource_id?: string;\n\taction_label?: string;\n\taction_route?: string;\n\tdedupe_key?: string;\n\tmetadata?: Record<string, any>;\n\texpires_at?: Date;\n\tcreated_by?: string;\n\tcreated_by_name?: string;\n}\n"]}
|
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './collections/ai-terminal-issue-report.collection';
|
|
|
3
3
|
export * from './collections/ai-terminal-conversation.collection';
|
|
4
4
|
export * from './collections/ai-terminal-message.collection';
|
|
5
5
|
export * from './collections/counter.collection';
|
|
6
|
+
export * from './collections/customer-notification.collection';
|
|
6
7
|
export * from './collections/communication-metric.collection';
|
|
7
8
|
export * from './collections/cron-job-history.collection';
|
|
8
9
|
export * from './collections/cron-job.collection';
|
|
@@ -35,6 +36,7 @@ export * from './models/billing-logged-in-users.model';
|
|
|
35
36
|
export * from './models/collection-document.model';
|
|
36
37
|
export * from './models/communication-metric.model';
|
|
37
38
|
export * from './models/counter.model';
|
|
39
|
+
export * from './models/customer-notification.model';
|
|
38
40
|
export * from './models/cron-job-history.model';
|
|
39
41
|
export * from './models/cron-job.model';
|
|
40
42
|
export * from './models/dialog.model';
|
package/public_api.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./collections/ai-terminal-issue-report.collection"), expor
|
|
|
19
19
|
__exportStar(require("./collections/ai-terminal-conversation.collection"), exports);
|
|
20
20
|
__exportStar(require("./collections/ai-terminal-message.collection"), exports);
|
|
21
21
|
__exportStar(require("./collections/counter.collection"), exports);
|
|
22
|
+
__exportStar(require("./collections/customer-notification.collection"), exports);
|
|
22
23
|
__exportStar(require("./collections/communication-metric.collection"), exports);
|
|
23
24
|
__exportStar(require("./collections/cron-job-history.collection"), exports);
|
|
24
25
|
__exportStar(require("./collections/cron-job.collection"), exports);
|
|
@@ -51,6 +52,7 @@ __exportStar(require("./models/billing-logged-in-users.model"), exports);
|
|
|
51
52
|
__exportStar(require("./models/collection-document.model"), exports);
|
|
52
53
|
__exportStar(require("./models/communication-metric.model"), exports);
|
|
53
54
|
__exportStar(require("./models/counter.model"), exports);
|
|
55
|
+
__exportStar(require("./models/customer-notification.model"), exports);
|
|
54
56
|
__exportStar(require("./models/cron-job-history.model"), exports);
|
|
55
57
|
__exportStar(require("./models/cron-job.model"), exports);
|
|
56
58
|
__exportStar(require("./models/dialog.model"), exports);
|
package/public_api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,oFAAkE;AAClE,oFAAkE;AAClE,+EAA6D;AAC7D,mEAAiD;AACjD,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,0EAAwD;AACxD,0EAAwD;AACxD,qEAAmD;AACnD,yEAAuD;AACvD,qEAAmD;AACnD,sEAAoD;AACpD,yDAAuC;AACvC,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/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/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/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/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,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,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/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/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"]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.loadCustomerNotificationPublications = loadCustomerNotificationPublications;
|
|
51
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
52
|
+
var customer_notification_collection_1 = require("../collections/customer-notification.collection");
|
|
53
|
+
var user_collection_1 = require("../collections/user.collection");
|
|
54
|
+
var DEFAULT_USER_LIMIT = 100;
|
|
55
|
+
var DEFAULT_ADMIN_LIMIT = 250;
|
|
56
|
+
var MAX_LIMIT = 500;
|
|
57
|
+
function normalizeLimit(value, fallback) {
|
|
58
|
+
var parsed = Number(value);
|
|
59
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
60
|
+
return fallback;
|
|
61
|
+
}
|
|
62
|
+
return Math.min(Math.floor(parsed), MAX_LIMIT);
|
|
63
|
+
}
|
|
64
|
+
function normalizeId(value) {
|
|
65
|
+
return String(value || '').trim();
|
|
66
|
+
}
|
|
67
|
+
function buildNotExpiredQuery() {
|
|
68
|
+
return {
|
|
69
|
+
$or: [
|
|
70
|
+
{
|
|
71
|
+
expires_at: {
|
|
72
|
+
$exists: false
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
expires_at: null
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
expires_at: {
|
|
80
|
+
$gt: new Date()
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function loadCustomerNotificationPublications(subscriptionManager) {
|
|
87
|
+
subscriptionManager.publications({
|
|
88
|
+
userNotificationCenter: {
|
|
89
|
+
function: function (id_user, limit) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
+
var idUser, query;
|
|
92
|
+
return __generator(this, function (_a) {
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
idUser = normalizeId(id_user);
|
|
96
|
+
if (!idUser) {
|
|
97
|
+
return [2 /*return*/, []];
|
|
98
|
+
}
|
|
99
|
+
query = __assign({ id_user: idUser }, buildNotExpiredQuery());
|
|
100
|
+
return [4 /*yield*/, customer_notification_collection_1.CustomerNotifications.find(query, {
|
|
101
|
+
sort: {
|
|
102
|
+
createdAt: -1
|
|
103
|
+
},
|
|
104
|
+
limit: normalizeLimit(limit, DEFAULT_USER_LIMIT)
|
|
105
|
+
})];
|
|
106
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
check: new simpl_schema_1.default({
|
|
112
|
+
limit: {
|
|
113
|
+
type: simpl_schema_1.default.Integer,
|
|
114
|
+
optional: true
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
collections: ['customer-notifications'],
|
|
118
|
+
user_specific: true
|
|
119
|
+
},
|
|
120
|
+
customerNotificationsAdmin: {
|
|
121
|
+
function: function (id_user, limit) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
123
|
+
var idUser, user;
|
|
124
|
+
var _a;
|
|
125
|
+
return __generator(this, function (_b) {
|
|
126
|
+
switch (_b.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
idUser = normalizeId(id_user);
|
|
129
|
+
if (!idUser) {
|
|
130
|
+
return [2 /*return*/, []];
|
|
131
|
+
}
|
|
132
|
+
return [4 /*yield*/, user_collection_1.Users.findById(idUser)];
|
|
133
|
+
case 1:
|
|
134
|
+
user = _b.sent();
|
|
135
|
+
if (!((_a = user === null || user === void 0 ? void 0 : user.roles) === null || _a === void 0 ? void 0 : _a.super_admin)) {
|
|
136
|
+
return [2 /*return*/, []];
|
|
137
|
+
}
|
|
138
|
+
return [4 /*yield*/, customer_notification_collection_1.CustomerNotifications.find(buildNotExpiredQuery(), {
|
|
139
|
+
sort: {
|
|
140
|
+
createdAt: -1
|
|
141
|
+
},
|
|
142
|
+
limit: normalizeLimit(limit, DEFAULT_ADMIN_LIMIT)
|
|
143
|
+
})];
|
|
144
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
},
|
|
149
|
+
check: new simpl_schema_1.default({
|
|
150
|
+
limit: {
|
|
151
|
+
type: simpl_schema_1.default.Integer,
|
|
152
|
+
optional: true
|
|
153
|
+
}
|
|
154
|
+
}),
|
|
155
|
+
collections: ['customer-notifications'],
|
|
156
|
+
user_specific: true
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
//# sourceMappingURL=customer-notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/publications/customer-notifications.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,oFA2DC;AApGD,6CAAwC;AACxC,oGAAwF;AACxF,kEAAuD;AAGvD,IAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,IAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,IAAM,SAAS,GAAG,GAAG,CAAC;AAEtB,SAAS,cAAc,CAAC,KAAU,EAAE,QAAgB;IACnD,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC7C,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,WAAW,CAAC,KAA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,CAAC;oCACb,sBAAO,EAAE,EAAC;gCACX,CAAC;gCAEY,qBAAM,uBAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAA;;gCAAnC,IAAI,GAAG,SAA4B;gCACzC,IAAI,CAAC,CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,0CAAE,WAAW,CAAA,EAAE,CAAC;oCAC/B,sBAAO,EAAE,EAAC;gCACX,CAAC;gCAEM,qBAAM,wDAAqB,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE;wCAC/D,IAAI,EAAE;4CACL,SAAS,EAAE,CAAC,CAAC;yCACb;wCACD,KAAK,EAAE,cAAc,CAAC,KAAK,EAAE,mBAAmB,CAAC;qCACjD,CAAC,EAAA;oCALF,sBAAO,SAKL,EAAC;;;;aACH;YACD,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,KAAK,EAAE;oBACN,IAAI,EAAE,sBAAY,CAAC,OAAO;oBAC1B,QAAQ,EAAE,IAAI;iBACd;aACD,CAAC;YACF,WAAW,EAAE,CAAC,wBAAwB,CAAC;YACvC,aAAa,EAAE,IAAI;SACnB;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 { SubscriptionManager } from '../managers/subscription.manager';\n\nconst DEFAULT_USER_LIMIT = 100;\nconst DEFAULT_ADMIN_LIMIT = 250;\nconst MAX_LIMIT = 500;\n\nfunction normalizeLimit(value: any, fallback: number): number {\n\tconst parsed = Number(value);\n\tif (!Number.isFinite(parsed) || parsed <= 0) {\n\t\treturn fallback;\n\t}\n\treturn Math.min(Math.floor(parsed), MAX_LIMIT);\n}\n\nfunction normalizeId(value: any): string {\n\treturn String(value || '').trim();\n}\n\nfunction buildNotExpiredQuery(): Record<string, any> {\n\treturn {\n\t\t$or: [\n\t\t\t{\n\t\t\t\texpires_at: {\n\t\t\t\t\t$exists: false\n\t\t\t\t}\n\t\t\t},\n\t\t\t{\n\t\t\t\texpires_at: null\n\t\t\t},\n\t\t\t{\n\t\t\t\texpires_at: {\n\t\t\t\t\t$gt: new Date()\n\t\t\t\t}\n\t\t\t}\n\t\t]\n\t};\n}\n\nexport function loadCustomerNotificationPublications(subscriptionManager: SubscriptionManager) {\n\tsubscriptionManager.publications({\n\t\tuserNotificationCenter: {\n\t\t\tfunction: async function(id_user: string, limit?: number) {\n\t\t\t\tconst idUser = normalizeId(id_user);\n\t\t\t\tif (!idUser) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst query: Record<string, any> = {\n\t\t\t\t\tid_user: idUser,\n\t\t\t\t\t...buildNotExpiredQuery()\n\t\t\t\t};\n\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: normalizeLimit(limit, DEFAULT_USER_LIMIT)\n\t\t\t\t});\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tlimit: {\n\t\t\t\t\ttype: SimpleSchema.Integer,\n\t\t\t\t\toptional: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['customer-notifications'],\n\t\t\tuser_specific: true\n\t\t},\n\t\tcustomerNotificationsAdmin: {\n\t\t\tfunction: async function(id_user: string, limit?: number) {\n\t\t\t\tconst idUser = normalizeId(id_user);\n\t\t\t\tif (!idUser) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\tconst user = await Users.findById(idUser);\n\t\t\t\tif (!user?.roles?.super_admin) {\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\n\t\t\t\treturn await CustomerNotifications.find(buildNotExpiredQuery(), {\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: normalizeLimit(limit, DEFAULT_ADMIN_LIMIT)\n\t\t\t\t});\n\t\t\t},\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tlimit: {\n\t\t\t\t\ttype: SimpleSchema.Integer,\n\t\t\t\t\toptional: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tcollections: ['customer-notifications'],\n\t\t\tuser_specific: true\n\t\t}\n\t});\n}\n"]}
|
package/publications.ts
CHANGED
|
@@ -17,6 +17,9 @@ export function SERVER_PUBLICATIONS(resolveioServer) {
|
|
|
17
17
|
cronjobsReportBuilderWithIdUser: (id_user: string) => {
|
|
18
18
|
return <Observable<any>> resolveioServer.subscribe('cronjobsReportBuilderWithIdUser', id_user);
|
|
19
19
|
},
|
|
20
|
+
customerNotificationsAdmin: (id_user: string, limit?: number) => {
|
|
21
|
+
return <Observable<any>> resolveioServer.subscribe('customerNotificationsAdmin', id_user, limit);
|
|
22
|
+
},
|
|
20
23
|
fileWithId: (id_file: string) => {
|
|
21
24
|
return <Observable<any>> resolveioServer.subscribe('fileWithId', id_file);
|
|
22
25
|
},
|
|
@@ -86,6 +89,9 @@ export function SERVER_PUBLICATIONS(resolveioServer) {
|
|
|
86
89
|
userGuides: () => {
|
|
87
90
|
return <Observable<any>> resolveioServer.subscribe('userGuides');
|
|
88
91
|
},
|
|
92
|
+
userNotificationCenter: (id_user: string, limit?: number) => {
|
|
93
|
+
return <Observable<any>> resolveioServer.subscribe('userNotificationCenter', id_user, limit);
|
|
94
|
+
},
|
|
89
95
|
usergroups: () => {
|
|
90
96
|
return <Observable<any>> resolveioServer.subscribe('usergroups');
|
|
91
97
|
},
|
|
@@ -37,6 +37,10 @@ export declare class ResolveIOServer {
|
|
|
37
37
|
static getLocalLogManager(): LocalLogManager;
|
|
38
38
|
static setLocalLogManager(localLogManager: LocalLogManager): void;
|
|
39
39
|
static getServerConfig(): any;
|
|
40
|
+
static getLogStorageMode(): 'offline' | 'direct';
|
|
41
|
+
static shouldWriteLogsOffline(): boolean;
|
|
42
|
+
private static resolveConfiguredLogStorageMode;
|
|
43
|
+
private static resolveLegacyLogStorageMode;
|
|
40
44
|
static getClientRoutes(): any[];
|
|
41
45
|
static getClientDir(): string;
|
|
42
46
|
static getSESMail(): boolean;
|
package/resolveio-server-app.js
CHANGED
|
@@ -338,6 +338,44 @@ var ResolveIOServer = /** @class */ (function () {
|
|
|
338
338
|
ResolveIOServer.getServerConfig = function () {
|
|
339
339
|
return ResolveIOServer._serverConfig;
|
|
340
340
|
};
|
|
341
|
+
ResolveIOServer.getLogStorageMode = function () {
|
|
342
|
+
var configuredMode = this.resolveConfiguredLogStorageMode();
|
|
343
|
+
if (configuredMode === 'offline' || configuredMode === 'direct') {
|
|
344
|
+
return configuredMode;
|
|
345
|
+
}
|
|
346
|
+
return this.resolveLegacyLogStorageMode();
|
|
347
|
+
};
|
|
348
|
+
ResolveIOServer.shouldWriteLogsOffline = function () {
|
|
349
|
+
return this.getLogStorageMode() === 'offline';
|
|
350
|
+
};
|
|
351
|
+
ResolveIOServer.resolveConfiguredLogStorageMode = function () {
|
|
352
|
+
var config = ResolveIOServer.getServerConfig() || {};
|
|
353
|
+
var configuredValue = process.env.RESOLVEIO_LOG_STORAGE_MODE
|
|
354
|
+
|| process.env.LOG_STORAGE_MODE
|
|
355
|
+
|| config['RESOLVEIO_LOG_STORAGE_MODE']
|
|
356
|
+
|| config['LOG_STORAGE_MODE']
|
|
357
|
+
|| config['LOCAL_LOG_STORAGE_MODE']
|
|
358
|
+
|| '';
|
|
359
|
+
var normalized = String(configuredValue || '').trim().toLowerCase();
|
|
360
|
+
if (!normalized || normalized === 'auto') {
|
|
361
|
+
return 'auto';
|
|
362
|
+
}
|
|
363
|
+
if (normalized === 'direct' || normalized === 'database' || normalized === 'db') {
|
|
364
|
+
return 'direct';
|
|
365
|
+
}
|
|
366
|
+
if (normalized === 'offline' || normalized === 'offload' || normalized === 'file' || normalized === 'local') {
|
|
367
|
+
return 'offline';
|
|
368
|
+
}
|
|
369
|
+
return 'auto';
|
|
370
|
+
};
|
|
371
|
+
ResolveIOServer.resolveLegacyLogStorageMode = function () {
|
|
372
|
+
var _a;
|
|
373
|
+
var rootUrl = (_a = ResolveIOServer.getServerConfig()) === null || _a === void 0 ? void 0 : _a['ROOT_URL'];
|
|
374
|
+
if (rootUrl !== 'https://resolveio.com' && rootUrl !== 'http://localhost:4200') {
|
|
375
|
+
return 'offline';
|
|
376
|
+
}
|
|
377
|
+
return 'direct';
|
|
378
|
+
};
|
|
341
379
|
ResolveIOServer.getClientRoutes = function () {
|
|
342
380
|
return ResolveIOServer._clientRoutes;
|
|
343
381
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resolveio-server-app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8D;AAK9D;IAwJC;IAAe,CAAC;IAzIK,4BAAY,GAAjC;;;;;;wBACO,QAAQ,GAAG,eAAe,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,CAAC;wBAC1D,aAAa,GAAG,eAAe,CAAC,yBAAyB,EAAE,CAAC;wBACnD,qBAAM,qBAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,aAAa,CAAC,EAAA;;wBAA3D,MAAM,GAAG,SAAkD;wBACjE,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;wBAC1D,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;wBAC1D,MAAM,CAAC,EAAE,CAAC,uBAAuB,EAAE,eAAe,CAAC,qBAAqB,CAAC,CAAC;wBAC1E,sBAAO,MAAM,EAAC;;;;KACd;IAEoB,qCAAqB,GAA1C,UAA2C,GAAG;;;;;wBAC7C,OAAO,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,EAAE,uBAAuB,EAAE,GAAG,CAAC,CAAC;wBACxD,IAAI,eAAe,CAAC,aAAa,EAAE,CAAC;4BACnC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IAAA;AA9QY,0CAAe","file":"resolveio-server-app.js","sourcesContent":["import { Db, MongoClient, MongoClientOptions } from 'mongodb';\nimport { LocalLogManager } from './managers/local-log.manager';\nimport { MongoManager } from './managers/mongo.manager';\nimport { ResolveIOMainServer } from './server-app';\n\nexport class ResolveIOServer {\n\tprivate static _serverConfig = null;\n\tprivate static _clientRoutes = [];\n\tprivate static _mongoConnection: MongoClient = null;\n\tprivate static _mainDB: Db = null;\n\tprivate static _mainServer = null;\n\tprivate static _localLogManager = null;\n\tprivate static _mongoManager = null;\n\tprivate static _client = '';\n\tprivate static _clientDir = '';\n\tprivate static _sesMail = true;\n\tprivate static _publicProgram = false;\n\n\tprivate static _reconnecting = false;\n\n\tprivate static async connectMongo(): Promise<MongoClient> {\n\t\tconst mongoUrl = ResolveIOServer.getServerConfig()['MONGO_URL'];\n\t\tconst clientOptions = ResolveIOServer.resolveMongoClientOptions();\n\t\tconst client = await MongoClient.connect(mongoUrl, clientOptions);\n\t\tclient.on('close', ResolveIOServer.handleMongoDisconnect);\n\t\tclient.on('error', ResolveIOServer.handleMongoDisconnect);\n\t\tclient.on('connectionPoolCleared', ResolveIOServer.handleMongoDisconnect);\n\t\treturn client;\n\t}\n\n\tprivate static async handleMongoDisconnect(err): Promise<void> {\n\t\tconsole.error(new Date(), 'Mongo connection lost', err);\n\t\tif (ResolveIOServer._reconnecting) {\n\t\t\treturn;\n\t\t}\n\n\t\tResolveIOServer._reconnecting = true;\n\n\t\ttry {\n\t\t\tawait ResolveIOServer.reconnectMongo();\n\t\t}\n\t\tfinally {\n\t\t\tResolveIOServer._reconnecting = false;\n\t\t}\n\t}\n\n\tprivate static async reconnectMongo(): Promise<void> {\n\t\tlet attempt = 0;\n\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tconst client = await ResolveIOServer.connectMongo();\n\t\t\t\tResolveIOServer.setMongoConnection(client);\n\t\t\t\tResolveIOServer.setMainDB(client.db(ResolveIOServer.getServerConfig()['DATABASE']));\n\t\t\t\tconsole.log(new Date(), 'Mongo reconnected');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tattempt++;\n\t\t\t\tconsole.error(new Date(), 'Mongo reconnect failed', err);\n\t\t\t\tawait ResolveIOServer.delay(Math.min(attempt * 1000, 10000));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static async delay(ms: number) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\tprivate static resolveMongoClientOptions(): MongoClientOptions | undefined {\n\t\tconst config = ResolveIOServer.getServerConfig();\n\t\tconst options: MongoClientOptions = {};\n\n\t\tconst numericOptionKeys: Array<{ key: keyof MongoClientOptions; env: string; configKey: string }> = [\n\t\t\t{ key: 'maxPoolSize', env: 'MONGO_MAX_POOL_SIZE', configKey: 'MONGO_MAX_POOL_SIZE' },\n\t\t\t{ key: 'minPoolSize', env: 'MONGO_MIN_POOL_SIZE', configKey: 'MONGO_MIN_POOL_SIZE' },\n\t\t\t{ key: 'waitQueueTimeoutMS', env: 'MONGO_WAIT_QUEUE_TIMEOUT_MS', configKey: 'MONGO_WAIT_QUEUE_TIMEOUT_MS' },\n\t\t\t{ key: 'maxIdleTimeMS', env: 'MONGO_MAX_IDLE_TIME_MS', configKey: 'MONGO_MAX_IDLE_TIME_MS' }\n\t\t];\n\n\t\tfor (const option of numericOptionKeys) {\n\t\t\tconst value = ResolveIOServer.pickMongoOptionValue(option.env, option.configKey);\n\t\t\tif (typeof value === 'number') {\n\t\t\t\tObject.assign(options, { [option.key]: value });\n\t\t\t}\n\t\t}\n\n\t\tconst booleanOptionKeys: Array<{ key: keyof MongoClientOptions; env: string; configKey: string }> = [\n\t\t\t{ key: 'retryWrites', env: 'MONGO_RETRY_WRITES', configKey: 'MONGO_RETRY_WRITES' }\n\t\t];\n\n\t\tfor (const option of booleanOptionKeys) {\n\t\t\tconst value = ResolveIOServer.pickMongoBooleanOptionValue(option.env, option.configKey);\n\t\t\tif (typeof value === 'boolean') {\n\t\t\t\tObject.assign(options, { [option.key]: value });\n\t\t\t}\n\t\t}\n\n\t\tconst structuredOptions = config?.['MONGO_CLIENT_OPTIONS'];\n\t\tif (structuredOptions && typeof structuredOptions === 'object' && !Array.isArray(structuredOptions)) {\n\t\t\tObject.assign(options, structuredOptions);\n\t\t}\n\n\t\treturn Object.keys(options).length ? options : undefined;\n\t}\n\n\tprivate static pickMongoOptionValue(envKey: string, configKey: string): number | undefined {\n\t\tconst rawEnv = process.env[envKey];\n\t\tif (rawEnv && !Number.isNaN(Number(rawEnv))) {\n\t\t\tconst parsed = parseInt(rawEnv, 10);\n\t\t\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;\n\t\t}\n\n\t\tconst config = ResolveIOServer.getServerConfig();\n\t\tconst configValue = config?.[configKey];\n\t\tif (typeof configValue === 'number' && Number.isFinite(configValue) && configValue > 0) {\n\t\t\treturn configValue;\n\t\t}\n\n\t\tif (typeof configValue === 'string' && configValue.trim().length && !Number.isNaN(Number(configValue))) {\n\t\t\tconst parsed = parseInt(configValue, 10);\n\t\t\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tprivate static pickMongoBooleanOptionValue(envKey: string, configKey: string): boolean | undefined {\n\t\tconst rawEnv = process.env[envKey];\n\t\tif (typeof rawEnv === 'string' && rawEnv.length) {\n\t\t\tif (['true', '1', 'yes'].includes(rawEnv.toLowerCase())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if (['false', '0', 'no'].includes(rawEnv.toLowerCase())) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tconst config = ResolveIOServer.getServerConfig();\n\t\tconst configValue = config?.[configKey];\n\t\tif (typeof configValue === 'boolean') {\n\t\t\treturn configValue;\n\t\t}\n\n\t\tif (typeof configValue === 'string' && configValue.length) {\n\t\t\tif (['true', '1', 'yes'].includes(configValue.toLowerCase())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if (['false', '0', 'no'].includes(configValue.toLowerCase())) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tconstructor() {}\n\t\n\tpublic static async create(serverConfig, clientRoutes: string[], client: string, clientDir, sesMail = true, publicProgram = false) {\n\t\tconst resolveioServer = new ResolveIOServer();\n\t\tawait resolveioServer.initialize(serverConfig, clientRoutes, client, clientDir, sesMail, publicProgram);\n\t\treturn resolveioServer;\n\t}\n\n\tprivate async initialize(serverConfig, clientRoutes: string[], client: string, clientDir, sesMail = true, publicProgram = false) {\n\t\tResolveIOServer._serverConfig = serverConfig;\n\t\tResolveIOServer._clientRoutes = clientRoutes;\n\t\tResolveIOServer._client = client;\n\t\tResolveIOServer._clientDir = clientDir;\n\t\tResolveIOServer._sesMail = sesMail;\n\t\tResolveIOServer._publicProgram = publicProgram;\n\t\t\n\t\ttry {\n\t\t\tlet dbConnection = await ResolveIOServer.connectMongo();\n\t\t\tprocess.removeAllListeners('unhandledRejection');\n\n\t\t\tResolveIOServer.setMongoConnection(dbConnection);\n\t\t\tResolveIOServer.setMainDB(dbConnection.db(ResolveIOServer.getServerConfig()['DATABASE']));\n\n\t\t\t// dbConnection\n\t\t\t// .on('error', error => {\n\t\t\t// \tif (typeof error.message === 'string' && error.message.includes('ns does not exist')) {\n\t\t\t// \t\treturn;\n\t\t\t// \t}\n\t\t\t\t\t\n\t\t\t// \t// Otherwise log normally\n\t\t\t// \tthrow error;\n\t\t\t// })\n\t\t\t// .on('close', () => process.exit(1));\n\t\n\t\t\tlet LocalLogManager = (await import('./managers/local-log.manager')).LocalLogManager;\n\t\t\tlet localLogManager = LocalLogManager.create();\n\t\t\tResolveIOServer.setLocalLogManager(localLogManager);\n\n\t\t\tlet MongoManager = (await import('./managers/mongo.manager')).MongoManager;\n\t\t\tlet mongoManager = await MongoManager.create();\n\t\t\tResolveIOServer.setMongoManager(mongoManager);\n\t\t\t\n\t\t\tlet serverApp = (await import('./server-app')).ResolveIOMainServer;\n\t\t\tlet app = await serverApp.create();\n\t\t\tResolveIOServer.setMainServer(app);\n\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = 'Error in ResolveIOServer (initialize): Mongo Client Connect And Run ResolveIO Server App Library - ' + err.message;\n\t\t\tconsole.error(err.message);\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tpublic static getClientName() {\n\t\treturn this._client;\n\t}\n\n\tpublic static getMainServer(): ResolveIOMainServer {\n\t\treturn ResolveIOServer._mainServer;\n\t}\n\n\tpublic static setMainServer(mainServer: ResolveIOMainServer) {\n\t\tResolveIOServer._mainServer = mainServer;\n\t}\n\n\tpublic static setMongoConnection(mongoConnection: MongoClient) {\n\t\tResolveIOServer._mongoConnection = mongoConnection;\n\t}\n\n\tpublic static getMongoConnection(): MongoClient {\n\t\treturn ResolveIOServer._mongoConnection;\n\t}\n\n\tpublic static getMainDB(): Db {\n\t\treturn ResolveIOServer._mainDB;\n\t}\n\n\tpublic static setMainDB(mainDB: Db) {\n\t\tResolveIOServer._mainDB = mainDB\n\t}\n\n\tpublic static getMongoManager(): MongoManager {\n\t\treturn ResolveIOServer._mongoManager;\n\t}\n\n\tpublic static setMongoManager(mongoManager: MongoManager) {\n\t\tResolveIOServer._mongoManager = mongoManager;\n\t}\n\n\tpublic static getLocalLogManager(): LocalLogManager {\n\t\treturn ResolveIOServer._localLogManager;\n\t}\n\n\tpublic static setLocalLogManager(localLogManager: LocalLogManager) {\n\t\tResolveIOServer._localLogManager = localLogManager;\n\t}\n\n\tpublic static getServerConfig() {\n\t\treturn ResolveIOServer._serverConfig;\n\t}\n\n\tpublic static getClientRoutes() {\n\t\treturn ResolveIOServer._clientRoutes;\n\t}\n\n\tpublic static getClientDir(): string {\n\t\treturn ResolveIOServer._clientDir;\n\t}\n\n\tpublic static getSESMail(): boolean {\n\t\treturn ResolveIOServer._sesMail;\n\t}\n\n\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AAK,SAAS,IAAI,UAAU,KAAK,MAAM,IAAI,UAAU,KAAK,OAAO,EAAE,CAAC;YAC7G,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEc,2CAA2B,GAA1C;;QACC,IAAM,OAAO,GAAG,MAAA,eAAe,CAAC,eAAe,EAAE,0CAAG,UAAU,CAAC,CAAC;QAChE,IAAI,OAAO,KAAK,uBAAuB,IAAI,OAAO,KAAK,uBAAuB,EAAE,CAAC;YAChF,OAAO,SAAS,CAAC;QAClB,CAAC;QACD,OAAO,QAAQ,CAAC;IACjB,CAAC;IAEa,+BAAe,GAA7B;QACC,OAAO,eAAe,CAAC,aAAa,CAAC;IACtC,CAAC;IAEa,4BAAY,GAA1B;QACC,OAAO,eAAe,CAAC,UAAU,CAAC;IACnC,CAAC;IAEa,0BAAU,GAAxB;QACC,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEa,gCAAgB,GAA9B;QACC,OAAO,eAAe,CAAC,cAAc,CAAC;IACvC,CAAC;IA1Tc,6BAAa,GAAG,IAAI,CAAC;IACrB,6BAAa,GAAG,EAAE,CAAC;IACnB,gCAAgB,GAAgB,IAAI,CAAC;IACrC,uBAAO,GAAO,IAAI,CAAC;IACnB,2BAAW,GAAG,IAAI,CAAC;IACnB,gCAAgB,GAAG,IAAI,CAAC;IACxB,6BAAa,GAAG,IAAI,CAAC;IACrB,uBAAO,GAAG,EAAE,CAAC;IACb,0BAAU,GAAG,EAAE,CAAC;IAChB,wBAAQ,GAAG,IAAI,CAAC;IAChB,8BAAc,GAAG,KAAK,CAAC;IAEvB,6BAAa,GAAG,KAAK,CAAC;IA+StC,sBAAC;CA5TD,AA4TC,IAAA;AA5TY,0CAAe","file":"resolveio-server-app.js","sourcesContent":["import { Db, MongoClient, MongoClientOptions } from 'mongodb';\nimport { LocalLogManager } from './managers/local-log.manager';\nimport { MongoManager } from './managers/mongo.manager';\nimport { ResolveIOMainServer } from './server-app';\n\nexport class ResolveIOServer {\n\tprivate static _serverConfig = null;\n\tprivate static _clientRoutes = [];\n\tprivate static _mongoConnection: MongoClient = null;\n\tprivate static _mainDB: Db = null;\n\tprivate static _mainServer = null;\n\tprivate static _localLogManager = null;\n\tprivate static _mongoManager = null;\n\tprivate static _client = '';\n\tprivate static _clientDir = '';\n\tprivate static _sesMail = true;\n\tprivate static _publicProgram = false;\n\n\tprivate static _reconnecting = false;\n\n\tprivate static async connectMongo(): Promise<MongoClient> {\n\t\tconst mongoUrl = ResolveIOServer.getServerConfig()['MONGO_URL'];\n\t\tconst clientOptions = ResolveIOServer.resolveMongoClientOptions();\n\t\tconst client = await MongoClient.connect(mongoUrl, clientOptions);\n\t\tclient.on('close', ResolveIOServer.handleMongoDisconnect);\n\t\tclient.on('error', ResolveIOServer.handleMongoDisconnect);\n\t\tclient.on('connectionPoolCleared', ResolveIOServer.handleMongoDisconnect);\n\t\treturn client;\n\t}\n\n\tprivate static async handleMongoDisconnect(err): Promise<void> {\n\t\tconsole.error(new Date(), 'Mongo connection lost', err);\n\t\tif (ResolveIOServer._reconnecting) {\n\t\t\treturn;\n\t\t}\n\n\t\tResolveIOServer._reconnecting = true;\n\n\t\ttry {\n\t\t\tawait ResolveIOServer.reconnectMongo();\n\t\t}\n\t\tfinally {\n\t\t\tResolveIOServer._reconnecting = false;\n\t\t}\n\t}\n\n\tprivate static async reconnectMongo(): Promise<void> {\n\t\tlet attempt = 0;\n\n\t\twhile (true) {\n\t\t\ttry {\n\t\t\t\tconst client = await ResolveIOServer.connectMongo();\n\t\t\t\tResolveIOServer.setMongoConnection(client);\n\t\t\t\tResolveIOServer.setMainDB(client.db(ResolveIOServer.getServerConfig()['DATABASE']));\n\t\t\t\tconsole.log(new Date(), 'Mongo reconnected');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\tattempt++;\n\t\t\t\tconsole.error(new Date(), 'Mongo reconnect failed', err);\n\t\t\t\tawait ResolveIOServer.delay(Math.min(attempt * 1000, 10000));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static async delay(ms: number) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\treturn new Promise(resolve => setTimeout(resolve, ms));\n\t}\n\n\tprivate static resolveMongoClientOptions(): MongoClientOptions | undefined {\n\t\tconst config = ResolveIOServer.getServerConfig();\n\t\tconst options: MongoClientOptions = {};\n\n\t\tconst numericOptionKeys: Array<{ key: keyof MongoClientOptions; env: string; configKey: string }> = [\n\t\t\t{ key: 'maxPoolSize', env: 'MONGO_MAX_POOL_SIZE', configKey: 'MONGO_MAX_POOL_SIZE' },\n\t\t\t{ key: 'minPoolSize', env: 'MONGO_MIN_POOL_SIZE', configKey: 'MONGO_MIN_POOL_SIZE' },\n\t\t\t{ key: 'waitQueueTimeoutMS', env: 'MONGO_WAIT_QUEUE_TIMEOUT_MS', configKey: 'MONGO_WAIT_QUEUE_TIMEOUT_MS' },\n\t\t\t{ key: 'maxIdleTimeMS', env: 'MONGO_MAX_IDLE_TIME_MS', configKey: 'MONGO_MAX_IDLE_TIME_MS' }\n\t\t];\n\n\t\tfor (const option of numericOptionKeys) {\n\t\t\tconst value = ResolveIOServer.pickMongoOptionValue(option.env, option.configKey);\n\t\t\tif (typeof value === 'number') {\n\t\t\t\tObject.assign(options, { [option.key]: value });\n\t\t\t}\n\t\t}\n\n\t\tconst booleanOptionKeys: Array<{ key: keyof MongoClientOptions; env: string; configKey: string }> = [\n\t\t\t{ key: 'retryWrites', env: 'MONGO_RETRY_WRITES', configKey: 'MONGO_RETRY_WRITES' }\n\t\t];\n\n\t\tfor (const option of booleanOptionKeys) {\n\t\t\tconst value = ResolveIOServer.pickMongoBooleanOptionValue(option.env, option.configKey);\n\t\t\tif (typeof value === 'boolean') {\n\t\t\t\tObject.assign(options, { [option.key]: value });\n\t\t\t}\n\t\t}\n\n\t\tconst structuredOptions = config?.['MONGO_CLIENT_OPTIONS'];\n\t\tif (structuredOptions && typeof structuredOptions === 'object' && !Array.isArray(structuredOptions)) {\n\t\t\tObject.assign(options, structuredOptions);\n\t\t}\n\n\t\treturn Object.keys(options).length ? options : undefined;\n\t}\n\n\tprivate static pickMongoOptionValue(envKey: string, configKey: string): number | undefined {\n\t\tconst rawEnv = process.env[envKey];\n\t\tif (rawEnv && !Number.isNaN(Number(rawEnv))) {\n\t\t\tconst parsed = parseInt(rawEnv, 10);\n\t\t\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;\n\t\t}\n\n\t\tconst config = ResolveIOServer.getServerConfig();\n\t\tconst configValue = config?.[configKey];\n\t\tif (typeof configValue === 'number' && Number.isFinite(configValue) && configValue > 0) {\n\t\t\treturn configValue;\n\t\t}\n\n\t\tif (typeof configValue === 'string' && configValue.trim().length && !Number.isNaN(Number(configValue))) {\n\t\t\tconst parsed = parseInt(configValue, 10);\n\t\t\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tprivate static pickMongoBooleanOptionValue(envKey: string, configKey: string): boolean | undefined {\n\t\tconst rawEnv = process.env[envKey];\n\t\tif (typeof rawEnv === 'string' && rawEnv.length) {\n\t\t\tif (['true', '1', 'yes'].includes(rawEnv.toLowerCase())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if (['false', '0', 'no'].includes(rawEnv.toLowerCase())) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tconst config = ResolveIOServer.getServerConfig();\n\t\tconst configValue = config?.[configKey];\n\t\tif (typeof configValue === 'boolean') {\n\t\t\treturn configValue;\n\t\t}\n\n\t\tif (typeof configValue === 'string' && configValue.length) {\n\t\t\tif (['true', '1', 'yes'].includes(configValue.toLowerCase())) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\telse if (['false', '0', 'no'].includes(configValue.toLowerCase())) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n\n\tconstructor() {}\n\t\n\tpublic static async create(serverConfig, clientRoutes: string[], client: string, clientDir, sesMail = true, publicProgram = false) {\n\t\tconst resolveioServer = new ResolveIOServer();\n\t\tawait resolveioServer.initialize(serverConfig, clientRoutes, client, clientDir, sesMail, publicProgram);\n\t\treturn resolveioServer;\n\t}\n\n\tprivate async initialize(serverConfig, clientRoutes: string[], client: string, clientDir, sesMail = true, publicProgram = false) {\n\t\tResolveIOServer._serverConfig = serverConfig;\n\t\tResolveIOServer._clientRoutes = clientRoutes;\n\t\tResolveIOServer._client = client;\n\t\tResolveIOServer._clientDir = clientDir;\n\t\tResolveIOServer._sesMail = sesMail;\n\t\tResolveIOServer._publicProgram = publicProgram;\n\t\t\n\t\ttry {\n\t\t\tlet dbConnection = await ResolveIOServer.connectMongo();\n\t\t\tprocess.removeAllListeners('unhandledRejection');\n\n\t\t\tResolveIOServer.setMongoConnection(dbConnection);\n\t\t\tResolveIOServer.setMainDB(dbConnection.db(ResolveIOServer.getServerConfig()['DATABASE']));\n\n\t\t\t// dbConnection\n\t\t\t// .on('error', error => {\n\t\t\t// \tif (typeof error.message === 'string' && error.message.includes('ns does not exist')) {\n\t\t\t// \t\treturn;\n\t\t\t// \t}\n\t\t\t\t\t\n\t\t\t// \t// Otherwise log normally\n\t\t\t// \tthrow error;\n\t\t\t// })\n\t\t\t// .on('close', () => process.exit(1));\n\t\n\t\t\tlet LocalLogManager = (await import('./managers/local-log.manager')).LocalLogManager;\n\t\t\tlet localLogManager = LocalLogManager.create();\n\t\t\tResolveIOServer.setLocalLogManager(localLogManager);\n\n\t\t\tlet MongoManager = (await import('./managers/mongo.manager')).MongoManager;\n\t\t\tlet mongoManager = await MongoManager.create();\n\t\t\tResolveIOServer.setMongoManager(mongoManager);\n\t\t\t\n\t\t\tlet serverApp = (await import('./server-app')).ResolveIOMainServer;\n\t\t\tlet app = await serverApp.create();\n\t\t\tResolveIOServer.setMainServer(app);\n\t\t\t\n\t\t\treturn true;\n\t\t}\n\t\tcatch (err) {\n\t\t\terr.message = 'Error in ResolveIOServer (initialize): Mongo Client Connect And Run ResolveIO Server App Library - ' + err.message;\n\t\t\tconsole.error(err.message);\n\t\t\tprocess.exit(1);\n\t\t}\n\t}\n\n\tpublic static getClientName() {\n\t\treturn this._client;\n\t}\n\n\tpublic static getMainServer(): ResolveIOMainServer {\n\t\treturn ResolveIOServer._mainServer;\n\t}\n\n\tpublic static setMainServer(mainServer: ResolveIOMainServer) {\n\t\tResolveIOServer._mainServer = mainServer;\n\t}\n\n\tpublic static setMongoConnection(mongoConnection: MongoClient) {\n\t\tResolveIOServer._mongoConnection = mongoConnection;\n\t}\n\n\tpublic static getMongoConnection(): MongoClient {\n\t\treturn ResolveIOServer._mongoConnection;\n\t}\n\n\tpublic static getMainDB(): Db {\n\t\treturn ResolveIOServer._mainDB;\n\t}\n\n\tpublic static setMainDB(mainDB: Db) {\n\t\tResolveIOServer._mainDB = mainDB\n\t}\n\n\tpublic static getMongoManager(): MongoManager {\n\t\treturn ResolveIOServer._mongoManager;\n\t}\n\n\tpublic static setMongoManager(mongoManager: MongoManager) {\n\t\tResolveIOServer._mongoManager = mongoManager;\n\t}\n\n\tpublic static getLocalLogManager(): LocalLogManager {\n\t\treturn ResolveIOServer._localLogManager;\n\t}\n\n\tpublic static setLocalLogManager(localLogManager: LocalLogManager) {\n\t\tResolveIOServer._localLogManager = localLogManager;\n\t}\n\n\tpublic static getServerConfig() {\n\t\treturn ResolveIOServer._serverConfig;\n\t}\n\n\tpublic static getLogStorageMode(): 'offline' | 'direct' {\n\t\tconst configuredMode = this.resolveConfiguredLogStorageMode();\n\t\tif (configuredMode === 'offline' || configuredMode === 'direct') {\n\t\t\treturn configuredMode;\n\t\t}\n\n\t\treturn this.resolveLegacyLogStorageMode();\n\t}\n\n\tpublic static shouldWriteLogsOffline(): boolean {\n\t\treturn this.getLogStorageMode() === 'offline';\n\t}\n\n\tprivate static resolveConfiguredLogStorageMode(): 'offline' | 'direct' | 'auto' {\n\t\tconst config = ResolveIOServer.getServerConfig() || {};\n\t\tconst configuredValue = process.env.RESOLVEIO_LOG_STORAGE_MODE\n\t\t\t|| process.env.LOG_STORAGE_MODE\n\t\t\t|| config['RESOLVEIO_LOG_STORAGE_MODE']\n\t\t\t|| config['LOG_STORAGE_MODE']\n\t\t\t|| config['LOCAL_LOG_STORAGE_MODE']\n\t\t\t|| '';\n\t\tconst normalized = String(configuredValue || '').trim().toLowerCase();\n\n\t\tif (!normalized || normalized === 'auto') {\n\t\t\treturn 'auto';\n\t\t}\n\n\t\tif (normalized === 'direct' || normalized === 'database' || normalized === 'db') {\n\t\t\treturn 'direct';\n\t\t}\n\n\t\tif (normalized === 'offline' || normalized === 'offload' || normalized === 'file' || normalized === 'local') {\n\t\t\treturn 'offline';\n\t\t}\n\n\t\treturn 'auto';\n\t}\n\n\tprivate static resolveLegacyLogStorageMode(): 'offline' | 'direct' {\n\t\tconst rootUrl = ResolveIOServer.getServerConfig()?.['ROOT_URL'];\n\t\tif (rootUrl !== 'https://resolveio.com' && rootUrl !== 'http://localhost:4200') {\n\t\t\treturn 'offline';\n\t\t}\n\t\treturn 'direct';\n\t}\n\n\tpublic static getClientRoutes() {\n\t\treturn ResolveIOServer._clientRoutes;\n\t}\n\n\tpublic static getClientDir(): string {\n\t\treturn ResolveIOServer._clientDir;\n\t}\n\n\tpublic static getSESMail(): boolean {\n\t\treturn ResolveIOServer._sesMail;\n\t}\n\n\tpublic static getpublicProgram(): boolean {\n\t\treturn ResolveIOServer._publicProgram;\n\t}\n}\n"]}
|
package/server-app.js
CHANGED
|
@@ -2453,8 +2453,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
2453
2453
|
return [3 /*break*/, 14];
|
|
2454
2454
|
}
|
|
2455
2455
|
if (!(method !== 'reportBuilderGetResults' && method !== 'reportBuilderGetDistinctValue' && method !== 'reportBuilderBuildTree' && method !== 'generatePDF' && method !== 'getWOOfflineData' && method !== 'countQuery' && method !== 'countWithQuery' && method !== 'countCollectionWithQuery' && method !== 'find' && method !== 'findOne' && method !== 'findWithOptions' && method !== 'getDrivers' && method !== 'processAirdropDistribution' && method !== 'qbHandleResponse')) return [3 /*break*/, 8];
|
|
2456
|
-
if (!
|
|
2457
|
-
&& resolveio_server_app_1.ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200')) return [3 /*break*/, 6];
|
|
2456
|
+
if (!resolveio_server_app_1.ResolveIOServer.shouldWriteLogsOffline()) return [3 /*break*/, 6];
|
|
2458
2457
|
resolveio_server_app_1.ResolveIOServer.getLocalLogManager().writeLog({
|
|
2459
2458
|
type: 'log',
|
|
2460
2459
|
data: {
|
|
@@ -2530,8 +2529,7 @@ var ResolveIOMainServer = /** @class */ (function () {
|
|
|
2530
2529
|
return [2 /*return*/];
|
|
2531
2530
|
}
|
|
2532
2531
|
if (!(methodName_1 !== 'reportBuilderGetResults' && methodName_1 !== 'reportBuilderGetDistinctValue' && methodName_1 !== 'reportBuilderBuildTree' && methodName_1 !== 'generatePDF' && methodName_1 !== 'getWOOfflineData' && methodName_1 !== 'countQuery' && methodName_1 !== 'countWithQuery' && methodName_1 !== 'countCollectionWithQuery' && methodName_1 !== 'find' && methodName_1 !== 'findOne' && methodName_1 !== 'findWithOptions' && methodName_1 !== 'getDrivers' && methodName_1 !== 'processAirdropDistribution')) return [3 /*break*/, 19];
|
|
2533
|
-
if (!
|
|
2534
|
-
&& resolveio_server_app_1.ResolveIOServer.getServerConfig()['ROOT_URL'] !== 'http://localhost:4200')) return [3 /*break*/, 17];
|
|
2532
|
+
if (!resolveio_server_app_1.ResolveIOServer.shouldWriteLogsOffline()) return [3 /*break*/, 17];
|
|
2535
2533
|
resolveio_server_app_1.ResolveIOServer.getLocalLogManager().writeLog({
|
|
2536
2534
|
type: 'log',
|
|
2537
2535
|
data: {
|