@resolveio/server-lib 12.0.79 → 12.1.0
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/log-ts.collection.d.ts +3 -0
- package/collections/log-ts.collection.js +78 -0
- package/collections/log-ts.collection.js.map +1 -0
- package/managers/mongo.manager.d.ts +1 -0
- package/managers/mongo.manager.js +14 -15
- package/managers/mongo.manager.js.map +1 -1
- package/methods/pdf.js +70 -72
- package/methods/pdf.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Logs = void 0;
|
|
4
|
+
var index_1 = require("../index");
|
|
5
|
+
var mongo_manager_1 = require("../managers/mongo.manager");
|
|
6
|
+
var schema = {
|
|
7
|
+
_id: {
|
|
8
|
+
type: String,
|
|
9
|
+
optional: true
|
|
10
|
+
},
|
|
11
|
+
createdAt: {
|
|
12
|
+
type: Date,
|
|
13
|
+
optional: true
|
|
14
|
+
},
|
|
15
|
+
metadata: {
|
|
16
|
+
type: Object
|
|
17
|
+
},
|
|
18
|
+
'metadata.type': {
|
|
19
|
+
type: String
|
|
20
|
+
},
|
|
21
|
+
'metadata.collection': {
|
|
22
|
+
type: String
|
|
23
|
+
},
|
|
24
|
+
id_document: {
|
|
25
|
+
type: String
|
|
26
|
+
},
|
|
27
|
+
payload: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
method: {
|
|
31
|
+
type: String
|
|
32
|
+
},
|
|
33
|
+
id_user: {
|
|
34
|
+
type: String
|
|
35
|
+
},
|
|
36
|
+
user: {
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
messageId: {
|
|
40
|
+
type: Number
|
|
41
|
+
},
|
|
42
|
+
route: {
|
|
43
|
+
type: String
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.Logs = null;
|
|
47
|
+
initializeCollection();
|
|
48
|
+
function initializeCollection() {
|
|
49
|
+
if (index_1.ResolveIOServer && index_1.ResolveIOServer.getMainDB()) {
|
|
50
|
+
var model = new mongo_manager_1.MongoManagerModel({
|
|
51
|
+
collectionName: 'logs',
|
|
52
|
+
schema: schema,
|
|
53
|
+
useVersionCollection: false,
|
|
54
|
+
useReportBuilder: false,
|
|
55
|
+
reportBuilderLookupTables: [],
|
|
56
|
+
timestamps: true,
|
|
57
|
+
createLogs: false,
|
|
58
|
+
checkSchema: true,
|
|
59
|
+
collectionOptions: null
|
|
60
|
+
});
|
|
61
|
+
exports.Logs = model.collection_main;
|
|
62
|
+
exports.Logs.createIndex({ createdAt: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 90 });
|
|
63
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, id_document: 1 });
|
|
64
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, user: 1 });
|
|
65
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, method: 1 });
|
|
66
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, route: 1 });
|
|
67
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, collection: 1, id_document: 1 });
|
|
68
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, collection: 1, method: 1, route: 1 });
|
|
69
|
+
exports.Logs.createIndex({ createdAt: -1, type: 1, collection: 1, route: 1 });
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setTimeout(function () {
|
|
73
|
+
initializeCollection();
|
|
74
|
+
}, 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=log-ts.collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/collections/log-ts.collection.ts"],"names":[],"mappings":";;;AAAA,kCAA2C;AAC3C,2DAAsF;AAGtF,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EA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AAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAC,CAAC,CAAC;QAC3D,YAAI,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;QACpD,YAAI,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC,CAAC;QACtD,YAAI,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAC;QACrD,YAAI,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAC,CAAC,CAAC;QAC1E,YAAI,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAC;QAC/E,YAAI,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC,CAAC;KACpE;SACI;QACJ,UAAU,CAAC;YACV,oBAAoB,EAAE,CAAC;QACxB,CAAC,EAAE,CAAC,CAAC,CAAC;KACN;AACF,CAAC","file":"log-ts.collection.js","sourcesContent":["import { ResolveIOServer } from '../index';\nimport { MongoManagerCollection, MongoManagerModel } from '../managers/mongo.manager';\nimport { LogModel } from '../models/log.model';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tmetadata: {\n\t\ttype: Object\n\t},\n\t'metadata.type': {\n\t\ttype: String\n\t},\n\t'metadata.collection': {\n\t\ttype: String\n\t},\n\tid_document: {\n\t\ttype: String\n\t},\n\tpayload: {\n\t\ttype: String\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\tid_user: {\n\t\ttype: String\n\t},\n\tuser: {\n\t\ttype: String\n\t},\n\tmessageId: {\n\t\ttype: Number\n\t},\n\troute: {\n\t\ttype: String\n\t}\n};\n\nexport let Logs: MongoManagerCollection<LogModel> = null;\n\ninitializeCollection();\n\nfunction initializeCollection() {\n\tif (ResolveIOServer && ResolveIOServer.getMainDB()) {\n\t\tconst model = new MongoManagerModel<LogModel>({\n\t\t\tcollectionName: 'logs',\n\t\t\tschema: schema,\n\t\t\tuseVersionCollection: false,\n\t\t\tuseReportBuilder: false,\n\t\t\treportBuilderLookupTables: [],\n\t\t\ttimestamps: true,\n\t\t\tcreateLogs: false,\n\t\t\tcheckSchema: true,\n\t\t\tcollectionOptions: null\n\t\t});\n\t\tLogs = model.collection_main;\n\t\tLogs.createIndex({createdAt: 1}, {expireAfterSeconds: 60 * 60 * 24 * 90});\n\t\tLogs.createIndex({createdAt: -1, type: 1, id_document: 1});\n\t\tLogs.createIndex({createdAt: -1, type: 1, user: 1});\n\t\tLogs.createIndex({createdAt: -1, type: 1, method: 1});\n\t\tLogs.createIndex({createdAt: -1, type: 1, route: 1});\n\t\tLogs.createIndex({createdAt: -1, type: 1, collection: 1, id_document: 1});\n\t\tLogs.createIndex({createdAt: -1, type: 1, collection: 1, method: 1, route: 1});\n\t\tLogs.createIndex({createdAt: -1, type: 1, collection: 1, route: 1});\n\t}\n\telse {\n\t\tsetTimeout(() => {\n\t\t\tinitializeCollection();\n\t\t}, 1);\n\t}\n}"]}
|
|
@@ -86,6 +86,7 @@ export declare class MongoManager {
|
|
|
86
86
|
constructor();
|
|
87
87
|
getServerCollections(): string[];
|
|
88
88
|
registerCollection(collection: MongoManagerCollection<CollectionDocument>): void;
|
|
89
|
+
createCollection(collection: MongoManagerCollection<CollectionDocument>): void;
|
|
89
90
|
collections(): MongoManagerCollection<CollectionDocument>[];
|
|
90
91
|
collection(collectionName: string): MongoManagerCollection<CollectionDocument> | MongoManagerUserCollection<CollectionDocument>;
|
|
91
92
|
addToQueue(mongoQueue: MongoQueueModel): void;
|
|
@@ -108,24 +108,23 @@ var MongoManager = /** @class */ (function () {
|
|
|
108
108
|
};
|
|
109
109
|
MongoManager.prototype.registerCollection = function (collection) {
|
|
110
110
|
if (!this._serverCollections.includes(collection.collectionName)) {
|
|
111
|
-
|
|
112
|
-
console.log('Created collection', collection.collectionName, JSON.stringify(res, null, 2));
|
|
113
|
-
}, function (err) {
|
|
114
|
-
console.log('Error creating collection', collection.collectionName, JSON.stringify(err, null, 2));
|
|
115
|
-
index_1.ResolveIOServer.getMainDB().dropCollection(collection.collectionName).then(function (resDrop) {
|
|
116
|
-
console.log('Dropped collection', collection.collectionName, JSON.stringify(resDrop, null, 2));
|
|
117
|
-
index_1.ResolveIOServer.getMainDB().createCollection(collection.collectionName, collection.collectionOptions).then(function (res2) {
|
|
118
|
-
console.log('Created collection 2', collection.collectionName, JSON.stringify(res2, null, 2));
|
|
119
|
-
}, function (err2) {
|
|
120
|
-
console.log('Error creating collection 2', collection.collectionName, JSON.stringify(err2, null, 2));
|
|
121
|
-
});
|
|
122
|
-
}, function (errDrop) {
|
|
123
|
-
console.log('Error dropping collection', collection.collectionName, JSON.stringify(errDrop, null, 2));
|
|
124
|
-
});
|
|
125
|
-
});
|
|
111
|
+
this.createCollection(collection);
|
|
126
112
|
}
|
|
127
113
|
this._collections.push(collection);
|
|
128
114
|
};
|
|
115
|
+
MongoManager.prototype.createCollection = function (collection) {
|
|
116
|
+
var _this = this;
|
|
117
|
+
index_1.ResolveIOServer.getMainDB().createCollection(collection.collectionName, collection.collectionOptions).then(function (res) {
|
|
118
|
+
console.log('Created collection', collection.collectionName, JSON.stringify(collection.collectionOptions, null, 2), JSON.stringify(res, null, 2));
|
|
119
|
+
}, function (err) {
|
|
120
|
+
console.log('Error creating collection', collection.collectionName, JSON.stringify(collection.collectionOptions, null, 2), JSON.stringify(err, null, 2));
|
|
121
|
+
index_1.ResolveIOServer.getMainDB().dropCollection(collection.collectionName).then(function () {
|
|
122
|
+
_this.createCollection(collection);
|
|
123
|
+
}, function () {
|
|
124
|
+
_this.createCollection(collection);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
};
|
|
129
128
|
MongoManager.prototype.collections = function () {
|
|
130
129
|
return this._collections;
|
|
131
130
|
};
|