@resolveio/server-lib 1.0.0-rc2 → 1.0.0-rc21
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/active-subscription.collection.d.ts +8 -0
- package/collections/active-subscription.collection.js +68 -1
- package/collections/app-status.collection.d.ts +8 -0
- package/collections/app-status.collection.js +43 -1
- package/collections/app-version.collection.d.ts +8 -0
- package/collections/app-version.collection.js +56 -1
- package/collections/counter.collection.d.ts +10 -0
- package/collections/counter.collection.js +73 -1
- package/collections/cron-job-history.collection.d.ts +8 -0
- package/collections/cron-job-history.collection.js +86 -1
- package/collections/cron-job.collection.d.ts +8 -0
- package/collections/cron-job.collection.js +89 -1
- package/collections/file.collection.d.ts +10 -0
- package/collections/file.collection.js +73 -1
- package/collections/flag.collection.d.ts +8 -0
- package/collections/flag.collection.js +47 -1
- package/collections/log.collection.d.ts +8 -0
- package/collections/log.collection.js +64 -1
- package/collections/logged-in-users.collection.d.ts +8 -0
- package/collections/logged-in-users.collection.js +70 -1
- package/collections/method-call.collection.d.ts +7 -0
- package/collections/method-call.collection.js +44 -1
- package/collections/method-response.collection.d.ts +7 -0
- package/collections/method-response.collection.js +48 -1
- package/collections/queue-flag.collection.d.ts +8 -0
- package/collections/queue-flag.collection.js +41 -1
- package/collections/queue-method.collection.d.ts +8 -0
- package/collections/queue-method.collection.js +116 -1
- package/collections/queue-response.collection.d.ts +8 -0
- package/collections/queue-response.collection.js +78 -1
- package/collections/support-ticket.collection.d.ts +8 -0
- package/collections/support-ticket.collection.js +146 -1
- package/collections/user.collection.d.ts +9 -0
- package/collections/user.collection.js +108 -1
- package/cron/cron.d.ts +6 -0
- package/cron/cron.js +160 -1
- package/fixtures/cron-jobs.d.ts +2 -0
- package/fixtures/cron-jobs.js +72 -1
- package/fixtures/init.d.ts +2 -0
- package/fixtures/init.js +73 -1
- package/http/auth.d.ts +3 -0
- package/http/auth.js +472 -1
- package/http/health.d.ts +2 -0
- package/http/health.js +8 -1
- package/index.d.ts +15 -0
- package/index.js +123 -1
- package/managers/cron.manager.d.ts +17 -0
- package/managers/cron.manager.js +193 -1
- package/managers/method.manager.d.ts +27 -0
- package/managers/method.manager.js +513 -1
- package/managers/queue-method.manager.d.ts +14 -0
- package/managers/queue-method.manager.js +239 -1
- package/managers/subscription.manager.d.ts +27 -0
- package/managers/subscription.manager.js +700 -1
- package/managers/support.manager.d.ts +18 -0
- package/managers/support.manager.js +208 -1
- package/methods/accounts.d.ts +3 -0
- package/methods/accounts.js +253 -1
- package/methods/aws.d.ts +3 -0
- package/methods/aws.js +323 -1
- package/methods/cloudconvert.d.ts +3 -0
- package/methods/cloudconvert.js +37 -1
- package/methods/collections.d.ts +3 -0
- package/methods/collections.js +738 -1
- package/methods/counters.d.ts +3 -0
- package/methods/counters.js +404 -1
- package/methods/cron-jobs.d.ts +3 -0
- package/methods/cron-jobs.js +63 -1
- package/methods/flags.d.ts +3 -0
- package/methods/flags.js +6 -1
- package/methods/logs.d.ts +3 -0
- package/methods/logs.js +29 -1
- package/methods/pdf.d.ts +3 -0
- package/methods/pdf.js +303 -1
- package/models/active-subscription.model.d.ts +14 -0
- package/models/active-subscription.model.js +2 -1
- package/models/app-status.model.d.ts +5 -0
- package/models/app-status.model.js +2 -1
- package/models/app-version.model.d.ts +5 -0
- package/models/app-version.model.js +2 -1
- package/models/collection-document.model.d.ts +7 -0
- package/models/collection-document.model.js +2 -1
- package/models/counter.model.d.ts +6 -0
- package/models/counter.model.js +2 -1
- package/models/cron-job-history.model.d.ts +13 -0
- package/models/cron-job-history.model.js +2 -1
- package/models/cron-job.model.d.ts +14 -0
- package/models/cron-job.model.js +2 -1
- package/models/dialog.model.d.ts +24 -0
- package/models/dialog.model.js +2 -1
- package/models/file.model.d.ts +10 -0
- package/models/file.model.js +2 -1
- package/models/flag.model.d.ts +6 -0
- package/models/flag.model.js +2 -1
- package/models/log.model.d.ts +12 -0
- package/models/log.model.js +2 -1
- package/models/logged-in-users.model.d.ts +10 -0
- package/models/logged-in-users.model.js +2 -1
- package/models/method-call.model.d.ts +8 -0
- package/models/method-call.model.js +2 -1
- package/models/method-response.model.d.ts +9 -0
- package/models/method-response.model.js +2 -1
- package/models/method.model.d.ts +11 -0
- package/models/method.model.js +2 -1
- package/models/notification.model.d.ts +5 -0
- package/models/notification.model.js +2 -0
- package/models/pagination.model.d.ts +12 -0
- package/models/pagination.model.js +20 -1
- package/models/permission.model.d.ts +13 -0
- package/models/permission.model.js +2 -1
- package/models/queue-method.model.d.ts +10 -0
- package/models/queue-method.model.js +2 -1
- package/models/queue-response.model.d.ts +11 -0
- package/models/queue-response.model.js +2 -1
- package/models/select-data-label.model.d.ts +10 -0
- package/models/select-data-label.model.js +2 -1
- package/models/server-response.model.d.ts +6 -0
- package/models/server-response.model.js +2 -1
- package/models/subscription.model.d.ts +31 -0
- package/models/subscription.model.js +2 -1
- package/models/support-method.model.d.ts +10 -0
- package/models/support-method.model.js +2 -1
- package/models/support-ticket.model.d.ts +40 -0
- package/models/support-ticket.model.js +2 -1
- package/models/user.model.d.ts +15 -0
- package/models/user.model.js +2 -1
- package/package.json +5 -2
- package/publications/app-status.d.ts +3 -0
- package/publications/app-status.js +14 -1
- package/publications/app-version.d.ts +3 -0
- package/publications/app-version.js +14 -1
- package/publications/cron-jobs.d.ts +3 -0
- package/publications/cron-jobs.js +14 -1
- package/publications/files.d.ts +3 -0
- package/publications/files.js +71 -1
- package/publications/flags.d.ts +3 -0
- package/publications/flags.js +23 -1
- package/publications/logs.d.ts +3 -0
- package/publications/logs.js +26 -1
- package/publications/method-calls.d.ts +3 -0
- package/publications/method-calls.js +14 -1
- package/publications/method-responses.d.ts +3 -0
- package/publications/method-responses.js +14 -1
- package/publications/super-admin.d.ts +3 -0
- package/publications/super-admin.js +21 -1
- package/publications/support-tickets.d.ts +2 -0
- package/publications/support-tickets.js +118 -1
- package/server-app.d.ts +33 -0
- package/server-app.js +640 -1
- package/support-methods/aws.d.ts +3 -0
- package/support-methods/aws.js +276 -1
- package/support-methods/collections.d.ts +3 -0
- package/support-methods/collections.js +471 -1
- package/support-methods/counters.d.ts +3 -0
- package/support-methods/counters.js +189 -1
- package/support-methods/support.d.ts +3 -0
- package/support-methods/support.js +19 -1
- package/util/common.d.ts +15 -0
- package/util/common.js +334 -1
package/methods/pdf.js
CHANGED
|
@@ -1 +1,303 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var request = require("request");
|
|
5
|
+
var mongoose_1 = require("mongoose");
|
|
6
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
7
|
+
var pdfCnt = 0;
|
|
8
|
+
function loadPDFMethods(methodManager) {
|
|
9
|
+
methodManager.methods({
|
|
10
|
+
generatePDF: {
|
|
11
|
+
skipQueue: true,
|
|
12
|
+
check: new simpl_schema_1.default({
|
|
13
|
+
html: {
|
|
14
|
+
type: String
|
|
15
|
+
},
|
|
16
|
+
fileName: {
|
|
17
|
+
type: String
|
|
18
|
+
},
|
|
19
|
+
orientation: {
|
|
20
|
+
type: String,
|
|
21
|
+
optional: true
|
|
22
|
+
},
|
|
23
|
+
fontSize: {
|
|
24
|
+
type: String,
|
|
25
|
+
optional: true
|
|
26
|
+
},
|
|
27
|
+
upload: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
optional: true
|
|
30
|
+
},
|
|
31
|
+
uploadFileOrder: {
|
|
32
|
+
type: Number,
|
|
33
|
+
optional: true
|
|
34
|
+
},
|
|
35
|
+
uploadFileType: {
|
|
36
|
+
type: String,
|
|
37
|
+
optional: true
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
function: function (html, fileName, orientation, fontSize, upload, uploadFileOrder, uploadFileType) {
|
|
41
|
+
if (orientation === void 0) { orientation = 'portrait'; }
|
|
42
|
+
if (fontSize === void 0) { fontSize = '8px'; }
|
|
43
|
+
if (upload === void 0) { upload = false; }
|
|
44
|
+
if (uploadFileOrder === void 0) { uploadFileOrder = -1; }
|
|
45
|
+
if (uploadFileType === void 0) { uploadFileType = ''; }
|
|
46
|
+
var that = this;
|
|
47
|
+
return new Promise(function (resolve, reject) {
|
|
48
|
+
var phantom = require('phantom');
|
|
49
|
+
var phInstance = null;
|
|
50
|
+
phantom.create().then(function (instance) {
|
|
51
|
+
phInstance = instance;
|
|
52
|
+
return instance.createPage();
|
|
53
|
+
}).then(function (page) {
|
|
54
|
+
page.property('paperSize', {
|
|
55
|
+
format: 'letter',
|
|
56
|
+
margin: '1cm',
|
|
57
|
+
orientation: orientation,
|
|
58
|
+
footer: {
|
|
59
|
+
height: '1cm',
|
|
60
|
+
contents: phInstance.callback(function (pageNum, numPages) {
|
|
61
|
+
return '<span style=\'float:right; font-size: 12px;\'>Page ' + pageNum + ' of ' + numPages + '</span>';
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
page.property('content', "\n\t\t\t\t\t\t<head>\n\t\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t\t@font-face {\n\t\t\t\t\t\t\t\t\tfont-family: 'Dejavu Serif', serif;\n\t\t\t\t\t\t\t\t\tfont-style: normal;\n\t\t\t\t\t\t\t\t\tfont-weight: normal;\n\t\t\t\t\t\t\t\t\tsrc: url(\"/usr/share/fonts/dejavu/DejaVuSerif.ttf\");\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t@font-face {\n\t\t\t\t\t\t\t\t\tfont-family: 'Dejavu Serif', serif;\n\t\t\t\t\t\t\t\t\tfont-style: normal;\n\t\t\t\t\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\t\t\t\tsrc: url(\"/usr/share/fonts/dejavu/DejaVuSerif-Bold.ttf\");\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t@font-face {\n\t\t\t\t\t\t\t\t\tfont-family: 'Dejavu Serif', serif;\n\t\t\t\t\t\t\t\t\tfont-style: italic;\n\t\t\t\t\t\t\t\t\tfont-weight: normal;\n\t\t\t\t\t\t\t\t\tsrc: url(\"/usr/share/fonts/dejavu/DejaVuSerif-Italic.ttf\");\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t@font-face {\n\t\t\t\t\t\t\t\t\tfont-family: 'Dejavu Serif', serif;\n\t\t\t\t\t\t\t\t\tfont-style: italic;\n\t\t\t\t\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\t\t\t\tsrc: url(\"/usr/share/fonts/dejavu/DejaVuSerif-BoldItalic.ttf\");\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbody {\n\t\t\t\t\t\t\t\t\tfont-family: 'Dejavu Serif', serif;\n\t\t\t\t\t\t\t\t\tfont-size: " + (fontSize ? fontSize : '8px') + ";\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.row {\n\t\t\t\t\t\t\t\t\tdisplay: -webkit-flex;\n\t\t\t\t\t\t\t\t\tdisplay: flex;\n\t\t\t\t\t\t\t\t\tflex-wrap: wrap;\n\t\t\t\t\t\t\t\t\t-webkit-flex-wrap: wrap;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t.page-break {\n\t\t\t\t\t\t\t\t\tpage-break-before: always !important;\n\t\t\t\t\t\t\t\t\tmargin-bottom: 1px;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.cell {\n\t\t\t\t\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\t\t\t\t\tpadding : 2px;\n\t\t\t\t\t\t\t\t\t-webkit-flex: 1;\n\t\t\t\t\t\t\t\t\tword-wrap: break-word;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.cell-no-padding {\n\t\t\t\t\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\t\t\t\t\t-webkit-flex: 1;\n\t\t\t\t\t\t\t\t\tword-wrap: break-word;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.centered {\n\t\t\t\t\t\t\t\t\t-webkit-justify-content: center;\n\t\t\t\t\t\t\t\t\t-webkit-align-items: center;\n\t\t\t\t\t\t\t\t\tdisplay: -webkit-flex;\n\t\t\t\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.centered-left {\n\t\t\t\t\t\t\t\t\t-webkit-align-items: center;\n\t\t\t\t\t\t\t\t\tdisplay: -webkit-flex;\n\t\t\t\t\t\t\t\t\t-webkit-justify-content: flex-start;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.centered-right {\n\t\t\t\t\t\t\t\t\t-webkit-justify-content: flex-end;\n\t\t\t\t\t\t\t\t\t-webkit-align-items: center;\n\t\t\t\t\t\t\t\t\tdisplay: -webkit-flex;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t.box {\n\t\t\t\t\t\t\t\t\tborder: 1px solid black;\n\t\t\t\t\t\t\t\t\tmargin: -1px 0px 0px -1px;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t.boxNoBorder {\n\t\t\t\t\t\t\t\t\tmargin: -1px 0px 0px -1px;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tpre {\n\t\t\t\t\t\t\t\t\twhite-space: pre-wrap; /* css-3 */\n\t\t\t\t\t\t\t\t\twhite-space: -moz-pre-wrap; /* Mozilla, since 1999 */\n\t\t\t\t\t\t\t\t\twhite-space: -pre-wrap; /* Opera 4-6 */\n\t\t\t\t\t\t\t\t\twhite-space: -o-pre-wrap; /* Opera 7 */\n\t\t\t\t\t\t\t\t\tword-wrap: break-word; /* Internet Explorer 5.5+ */\n\t\t\t\t\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\t\t\t\t\tfont-family: Open Sans; \n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</style>\n\t\t\t\t\t\t</head>\n\t\t\t\t\t\t<body>\n\t\t\t\t\t" + html.replace(new RegExp('flex-basis:', 'g'), '-webkit-flex-basis:').replace(new RegExp('flex:', 'g'), '-webkit-flex:') + '</body>');
|
|
66
|
+
var tmpFileName = (pdfCnt++) + '-' + fileName;
|
|
67
|
+
page.render(tmpFileName, {
|
|
68
|
+
format: 'pdf',
|
|
69
|
+
quality: '100'
|
|
70
|
+
}).then(function () {
|
|
71
|
+
if (fs.existsSync(tmpFileName)) {
|
|
72
|
+
fs.readFile(tmpFileName, function (errRead, data) {
|
|
73
|
+
if (!errRead) {
|
|
74
|
+
fs.unlinkSync(tmpFileName);
|
|
75
|
+
if (!upload) {
|
|
76
|
+
resolve('data:application/pdf;base64,' + Buffer.from(data).toString('base64'));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
var fileData = 'data:application/pdf;base64,' + Buffer.from(data).toString('base64');
|
|
80
|
+
that.callMethodInternal.call(that, 'uploadFileAndSave', fileName, fileData, (4 * Math.ceil(fileData.length / 3)), uploadFileOrder, uploadFileType, function (err, res) {
|
|
81
|
+
if (err) {
|
|
82
|
+
reject(err);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
resolve(res);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.log(errRead);
|
|
92
|
+
}
|
|
93
|
+
phInstance.exit();
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
reject('No tmp file');
|
|
98
|
+
console.log('No tmp file ', tmpFileName);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
})
|
|
102
|
+
.catch(function (error) {
|
|
103
|
+
reject(error);
|
|
104
|
+
phInstance.exit();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
mergePDF: {
|
|
110
|
+
skipQueue: true,
|
|
111
|
+
check: new simpl_schema_1.default({
|
|
112
|
+
fileKeys: {
|
|
113
|
+
type: Array
|
|
114
|
+
},
|
|
115
|
+
'fileKeys.$': {
|
|
116
|
+
type: String
|
|
117
|
+
},
|
|
118
|
+
fileName: {
|
|
119
|
+
type: String
|
|
120
|
+
},
|
|
121
|
+
fileType: {
|
|
122
|
+
type: String,
|
|
123
|
+
optional: true
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
function: function (fileKeys, fileName, fileType) {
|
|
127
|
+
var _this = this;
|
|
128
|
+
return new Promise(function (resolve, reject) {
|
|
129
|
+
_this.callMethodInternal.call(_this, 'getCCProcessURL').then(function (resCC) {
|
|
130
|
+
var mergeFileName = 'uploads/' + Date.now() + '-' + (pdfCnt++) + '-' + fileName;
|
|
131
|
+
//send request
|
|
132
|
+
request({
|
|
133
|
+
method: 'POST',
|
|
134
|
+
url: 'https:' + resCC.url,
|
|
135
|
+
headers: {
|
|
136
|
+
'Content-Type': 'application/json'
|
|
137
|
+
},
|
|
138
|
+
json: {
|
|
139
|
+
mode: 'combine',
|
|
140
|
+
input: {
|
|
141
|
+
s3: {
|
|
142
|
+
'accesskeyid': _this.serverConfig['AWSACCESSKEYID'],
|
|
143
|
+
'secretaccesskey': _this.serverConfig['AWSSECRETACCESSKEY'],
|
|
144
|
+
'region': _this.serverConfig['AWSREGION'],
|
|
145
|
+
'bucket': _this.serverConfig['AWSBUCKET']
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
files: fileKeys,
|
|
149
|
+
outputformat: 'pdf',
|
|
150
|
+
wait: true,
|
|
151
|
+
output: {
|
|
152
|
+
's3': {
|
|
153
|
+
'accesskeyid': _this.serverConfig['AWSACCESSKEYID'],
|
|
154
|
+
'secretaccesskey': _this.serverConfig['AWSSECRETACCESSKEY'],
|
|
155
|
+
'region': _this.serverConfig['AWSREGION'],
|
|
156
|
+
'bucket': _this.serverConfig['AWSBUCKET'],
|
|
157
|
+
'path': mergeFileName
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
converteroptions: {
|
|
161
|
+
'resize': '612x792',
|
|
162
|
+
'resizemode': 'scale',
|
|
163
|
+
'resizeenlarge': null,
|
|
164
|
+
'grayscale': null,
|
|
165
|
+
'auto_orient': null,
|
|
166
|
+
'strip_metatags': false,
|
|
167
|
+
'density': 72,
|
|
168
|
+
'rotate': null,
|
|
169
|
+
'command': null
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
}, function (error, response, body) {
|
|
173
|
+
if (!error) {
|
|
174
|
+
var resFile_1 = {
|
|
175
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
176
|
+
__v: 0,
|
|
177
|
+
name: fileName,
|
|
178
|
+
size: body.output.size,
|
|
179
|
+
key: mergeFileName,
|
|
180
|
+
type: fileType ? fileType : '',
|
|
181
|
+
order: -1
|
|
182
|
+
};
|
|
183
|
+
if (body.output.size) {
|
|
184
|
+
_this.callMethodInternal.call(_this, 'insertDocument', 'files', resFile_1, function (errUpFile, resUpFile) {
|
|
185
|
+
if (resUpFile) {
|
|
186
|
+
resFile_1.status = 'Uploaded';
|
|
187
|
+
resolve(resFile_1);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
reject(errUpFile);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
reject('Merged file has no size, merge failed');
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
reject(error);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}, function (errCC) { return reject(errCC); });
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
mergePDFNoUpload: {
|
|
207
|
+
skipQueue: true,
|
|
208
|
+
check: new simpl_schema_1.default({
|
|
209
|
+
fileKeys: {
|
|
210
|
+
type: Array
|
|
211
|
+
},
|
|
212
|
+
'fileKeys.$': {
|
|
213
|
+
type: String
|
|
214
|
+
},
|
|
215
|
+
fileName: {
|
|
216
|
+
type: String
|
|
217
|
+
},
|
|
218
|
+
fileType: {
|
|
219
|
+
type: String,
|
|
220
|
+
optional: true
|
|
221
|
+
}
|
|
222
|
+
}),
|
|
223
|
+
function: function (fileKeys, fileName, fileType) {
|
|
224
|
+
var _this = this;
|
|
225
|
+
return new Promise(function (resolve, reject) {
|
|
226
|
+
_this.callMethodInternal.call(_this, 'getCCProcessURL').then(function (resCC) {
|
|
227
|
+
var mergeFileName = 'uploads/' + Date.now() + '-' + (pdfCnt++) + '-' + fileName;
|
|
228
|
+
//send request
|
|
229
|
+
request({
|
|
230
|
+
method: 'POST',
|
|
231
|
+
url: 'https:' + resCC.url,
|
|
232
|
+
headers: {
|
|
233
|
+
'Content-Type': 'application/json'
|
|
234
|
+
},
|
|
235
|
+
json: {
|
|
236
|
+
mode: 'combine',
|
|
237
|
+
input: {
|
|
238
|
+
s3: {
|
|
239
|
+
'accesskeyid': _this.serverConfig['AWSACCESSKEYID'],
|
|
240
|
+
'secretaccesskey': _this.serverConfig['AWSSECRETACCESSKEY'],
|
|
241
|
+
'region': _this.serverConfig['AWSREGION'],
|
|
242
|
+
'bucket': _this.serverConfig['AWSBUCKET']
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
files: fileKeys,
|
|
246
|
+
outputformat: 'pdf',
|
|
247
|
+
wait: true,
|
|
248
|
+
output: {
|
|
249
|
+
's3': {
|
|
250
|
+
'accesskeyid': _this.serverConfig['AWSACCESSKEYID'],
|
|
251
|
+
'secretaccesskey': _this.serverConfig['AWSSECRETACCESSKEY'],
|
|
252
|
+
'region': _this.serverConfig['AWSREGION'],
|
|
253
|
+
'bucket': _this.serverConfig['AWSBUCKET'],
|
|
254
|
+
'path': mergeFileName
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
converteroptions: {
|
|
258
|
+
'resize': '612x792',
|
|
259
|
+
'resizemode': 'scale',
|
|
260
|
+
'resizeenlarge': null,
|
|
261
|
+
'grayscale': null,
|
|
262
|
+
'auto_orient': null,
|
|
263
|
+
'strip_metatags': false,
|
|
264
|
+
'density': 72,
|
|
265
|
+
'rotate': null,
|
|
266
|
+
'command': null
|
|
267
|
+
},
|
|
268
|
+
}
|
|
269
|
+
}, function (error, response, body) {
|
|
270
|
+
if (!error) {
|
|
271
|
+
var resFile_2 = {
|
|
272
|
+
_id: mongoose_1.Types.ObjectId().toHexString(),
|
|
273
|
+
name: fileName,
|
|
274
|
+
size: body.output.size,
|
|
275
|
+
key: mergeFileName,
|
|
276
|
+
type: fileType ? fileType : '',
|
|
277
|
+
order: -1
|
|
278
|
+
};
|
|
279
|
+
_this.callMethodInternal.call(_this, 'insertDocument', 'files', resFile_2, function (errUpFile, resUpFile) {
|
|
280
|
+
if (resUpFile) {
|
|
281
|
+
resFile_2.status = 'Uploaded';
|
|
282
|
+
resolve(resFile_2);
|
|
283
|
+
var that_1 = _this;
|
|
284
|
+
setTimeout(function () {
|
|
285
|
+
that_1.callMethodInternal.call(that_1, 'deleteFile', mergeFileName);
|
|
286
|
+
}, 60000);
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
reject(errUpFile);
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
reject(error);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}, function (errCC) { return reject(errCC); });
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
exports.loadPDFMethods = loadPDFMethods;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface ActiveSubscriptionModel extends CollectionDocument {
|
|
3
|
+
date: Date;
|
|
4
|
+
publication: string;
|
|
5
|
+
subData: string | Object;
|
|
6
|
+
collections: string[];
|
|
7
|
+
clients: ActiveSubscriptionClientModel[];
|
|
8
|
+
}
|
|
9
|
+
export interface ActiveSubscriptionClientModel {
|
|
10
|
+
id_user: string;
|
|
11
|
+
messageId: number;
|
|
12
|
+
id_socket: string;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=active-subscription.model.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/models/counter.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface CronJobHistoryModel extends CollectionDocument {
|
|
3
|
+
name: string;
|
|
4
|
+
reoccuring: boolean;
|
|
5
|
+
time_to_run: string;
|
|
6
|
+
method_name: string;
|
|
7
|
+
server_restart: boolean;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
error: Object;
|
|
10
|
+
start_time: Date;
|
|
11
|
+
end_time: Date;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=cron-job-history.model.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface CronJobModel extends CollectionDocument {
|
|
3
|
+
name: string;
|
|
4
|
+
repeat: boolean;
|
|
5
|
+
time_to_run: string;
|
|
6
|
+
method_run: string;
|
|
7
|
+
method_run_data?: Object;
|
|
8
|
+
method_complete?: string;
|
|
9
|
+
method_complete_data?: Object;
|
|
10
|
+
running: boolean;
|
|
11
|
+
timezone?: string;
|
|
12
|
+
next_run?: Date;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=cron-job.model.d.ts.map
|
package/models/cron-job.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface DialogInputFieldModel {
|
|
2
|
+
label: string;
|
|
3
|
+
form: string;
|
|
4
|
+
data: string | number | boolean;
|
|
5
|
+
validators: any[];
|
|
6
|
+
validatorErrors: string[];
|
|
7
|
+
validatorMsg: string[];
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
type?: DialogInputFieldTypes;
|
|
12
|
+
options?: DialogInputFieldSelectOptions[];
|
|
13
|
+
}
|
|
14
|
+
export interface DialogInputFieldSelectOptions {
|
|
15
|
+
value: string | number;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
declare type DialogInputFieldTypes = 'text' | 'number' | 'select' | 'state' | 'textarea' | 'email' | 'password' | 'boolean';
|
|
19
|
+
export interface DialogSelectWithButtonsOptionModel {
|
|
20
|
+
value: string | number;
|
|
21
|
+
text: string;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=dialog.model.d.ts.map
|
package/models/dialog.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface FileModel extends CollectionDocument {
|
|
3
|
+
name: string;
|
|
4
|
+
size: number;
|
|
5
|
+
key: string;
|
|
6
|
+
type: string;
|
|
7
|
+
order: number;
|
|
8
|
+
status?: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=file.model.d.ts.map
|
package/models/file.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/models/flag.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface LogModel extends CollectionDocument {
|
|
3
|
+
date: Date;
|
|
4
|
+
type: string;
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
payload: any;
|
|
8
|
+
method: string;
|
|
9
|
+
user: string;
|
|
10
|
+
messageId: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=log.model.d.ts.map
|
package/models/log.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface LoggedInUserModel extends CollectionDocument {
|
|
3
|
+
date: Date;
|
|
4
|
+
id_user: string;
|
|
5
|
+
user: string;
|
|
6
|
+
id_ws: string;
|
|
7
|
+
app_version?: number;
|
|
8
|
+
latency?: number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=logged-in-users.model.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CollectionDocument } from './collection-document.model';
|
|
2
|
+
export interface MethodResponseModel extends CollectionDocument {
|
|
3
|
+
id_user: string;
|
|
4
|
+
message_id: string;
|
|
5
|
+
method: string;
|
|
6
|
+
data: string;
|
|
7
|
+
response: any;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=method-response.model.d.ts.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import SimpleSchema from 'simpl-schema';
|
|
2
|
+
export interface MethodModel {
|
|
3
|
+
[key: string]: MethodAllModel;
|
|
4
|
+
}
|
|
5
|
+
export interface MethodAllModel {
|
|
6
|
+
check?: SimpleSchema;
|
|
7
|
+
function: (...parameters: any[]) => Promise<any | any[]>;
|
|
8
|
+
skipValidation?: boolean;
|
|
9
|
+
skipQueue?: boolean;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=method.model.d.ts.map
|
package/models/method.model.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface PaginationOptions {
|
|
2
|
+
limit: number;
|
|
3
|
+
skip: number;
|
|
4
|
+
sort: {
|
|
5
|
+
[key: string]: number;
|
|
6
|
+
};
|
|
7
|
+
fields: {
|
|
8
|
+
[key: string]: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare const PaginationOptionsSchema: any;
|
|
12
|
+
//# sourceMappingURL=pagination.model.d.ts.map
|
|
@@ -1 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
4
|
+
exports.PaginationOptionsSchema = new simpl_schema_1.default({
|
|
5
|
+
limit: {
|
|
6
|
+
type: Number
|
|
7
|
+
},
|
|
8
|
+
skip: {
|
|
9
|
+
type: Number
|
|
10
|
+
},
|
|
11
|
+
sort: {
|
|
12
|
+
type: Object,
|
|
13
|
+
blackbox: true
|
|
14
|
+
},
|
|
15
|
+
fields: {
|
|
16
|
+
type: Object,
|
|
17
|
+
optional: true,
|
|
18
|
+
blackbox: true
|
|
19
|
+
}
|
|
20
|
+
});
|