@resolveio/server-lib 1.0.0-rc28 → 1.0.0-rc3
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.js +1 -68
- package/collections/app-status.collection.js +1 -43
- package/collections/app-version.collection.js +1 -56
- package/collections/counter.collection.js +1 -73
- package/collections/cron-job-history.collection.js +1 -86
- package/collections/cron-job.collection.js +1 -89
- package/collections/file.collection.js +1 -73
- package/collections/flag.collection.js +1 -47
- package/collections/log.collection.js +1 -64
- package/collections/logged-in-users.collection.js +1 -70
- package/collections/method-call.collection.js +1 -44
- package/collections/method-response.collection.js +1 -48
- package/collections/queue-flag.collection.js +1 -41
- package/collections/queue-method.collection.js +1 -116
- package/collections/queue-response.collection.js +1 -78
- package/collections/support-ticket.collection.js +1 -146
- package/collections/user.collection.js +1 -108
- package/cron/cron.js +1 -160
- package/fixtures/cron-jobs.js +1 -72
- package/fixtures/init.js +1 -73
- package/http/auth.js +1 -472
- package/http/health.js +1 -8
- package/index.js +1 -125
- package/managers/cron.manager.js +1 -193
- package/managers/method.manager.js +1 -544
- package/managers/queue-method.manager.js +1 -239
- package/managers/subscription.manager.js +1 -700
- package/managers/support.manager.js +1 -208
- package/methods/accounts.js +1 -253
- package/methods/aws.js +1 -345
- package/methods/cloudconvert.js +1 -37
- package/methods/collections.js +1 -738
- package/methods/counters.js +1 -404
- package/methods/cron-jobs.js +1 -63
- package/methods/flags.js +1 -6
- package/methods/logs.js +1 -29
- package/methods/pdf.js +1 -303
- package/models/active-subscription.model.js +1 -2
- package/models/app-status.model.js +1 -2
- package/models/app-version.model.js +1 -2
- package/models/collection-document.model.js +1 -2
- package/models/counter.model.js +1 -2
- package/models/cron-job-history.model.js +1 -2
- package/models/cron-job.model.js +1 -2
- package/models/dialog.model.js +1 -2
- package/models/file.model.js +1 -2
- package/models/flag.model.js +1 -2
- package/models/log.model.js +1 -2
- package/models/logged-in-users.model.js +1 -2
- package/models/method-call.model.js +1 -2
- package/models/method-response.model.js +1 -2
- package/models/method.model.js +1 -2
- package/models/pagination.model.js +1 -20
- package/models/permission.model.js +1 -2
- package/models/queue-method.model.js +1 -2
- package/models/queue-response.model.js +1 -2
- package/models/select-data-label.model.js +1 -2
- package/models/server-response.model.js +1 -2
- package/models/subscription.model.js +1 -2
- package/models/support-method.model.js +1 -2
- package/models/support-ticket.model.js +1 -2
- package/models/user.model.js +1 -2
- package/package.json +2 -5
- package/publications/app-status.js +1 -14
- package/publications/app-version.js +1 -14
- package/publications/cron-jobs.js +1 -14
- package/publications/files.js +1 -71
- package/publications/flags.js +1 -23
- package/publications/logs.js +1 -26
- package/publications/method-calls.js +1 -14
- package/publications/method-responses.js +1 -14
- package/publications/super-admin.js +1 -21
- package/publications/support-tickets.js +1 -118
- package/server-app.js +1 -641
- package/support-methods/aws.js +1 -276
- package/support-methods/collections.js +1 -471
- package/support-methods/counters.js +1 -189
- package/support-methods/support.js +1 -19
- package/util/common.js +1 -334
- package/collections/active-subscription.collection.d.ts +0 -8
- package/collections/app-status.collection.d.ts +0 -8
- package/collections/app-version.collection.d.ts +0 -8
- package/collections/counter.collection.d.ts +0 -10
- package/collections/cron-job-history.collection.d.ts +0 -8
- package/collections/cron-job.collection.d.ts +0 -8
- package/collections/file.collection.d.ts +0 -10
- package/collections/flag.collection.d.ts +0 -8
- package/collections/log.collection.d.ts +0 -8
- package/collections/logged-in-users.collection.d.ts +0 -8
- package/collections/method-call.collection.d.ts +0 -7
- package/collections/method-response.collection.d.ts +0 -7
- package/collections/queue-flag.collection.d.ts +0 -8
- package/collections/queue-method.collection.d.ts +0 -8
- package/collections/queue-response.collection.d.ts +0 -8
- package/collections/support-ticket.collection.d.ts +0 -8
- package/collections/user.collection.d.ts +0 -9
- package/cron/cron.d.ts +0 -6
- package/fixtures/cron-jobs.d.ts +0 -2
- package/fixtures/init.d.ts +0 -2
- package/http/auth.d.ts +0 -3
- package/http/health.d.ts +0 -2
- package/index.d.ts +0 -17
- package/managers/cron.manager.d.ts +0 -17
- package/managers/method.manager.d.ts +0 -28
- package/managers/queue-method.manager.d.ts +0 -14
- package/managers/subscription.manager.d.ts +0 -27
- package/managers/support.manager.d.ts +0 -18
- package/methods/accounts.d.ts +0 -3
- package/methods/aws.d.ts +0 -3
- package/methods/cloudconvert.d.ts +0 -3
- package/methods/collections.d.ts +0 -3
- package/methods/counters.d.ts +0 -3
- package/methods/cron-jobs.d.ts +0 -3
- package/methods/flags.d.ts +0 -3
- package/methods/logs.d.ts +0 -3
- package/methods/pdf.d.ts +0 -3
- package/models/active-subscription.model.d.ts +0 -14
- package/models/app-status.model.d.ts +0 -5
- package/models/app-version.model.d.ts +0 -5
- package/models/collection-document.model.d.ts +0 -7
- package/models/counter.model.d.ts +0 -6
- package/models/cron-job-history.model.d.ts +0 -13
- package/models/cron-job.model.d.ts +0 -14
- package/models/dialog.model.d.ts +0 -24
- package/models/file.model.d.ts +0 -10
- package/models/flag.model.d.ts +0 -6
- package/models/log.model.d.ts +0 -12
- package/models/logged-in-users.model.d.ts +0 -10
- package/models/method-call.model.d.ts +0 -8
- package/models/method-response.model.d.ts +0 -9
- package/models/method.model.d.ts +0 -11
- package/models/notification.model.d.ts +0 -5
- package/models/notification.model.js +0 -2
- package/models/pagination.model.d.ts +0 -12
- package/models/permission.model.d.ts +0 -13
- package/models/queue-method.model.d.ts +0 -10
- package/models/queue-response.model.d.ts +0 -11
- package/models/select-data-label.model.d.ts +0 -10
- package/models/server-response.model.d.ts +0 -6
- package/models/subscription.model.d.ts +0 -31
- package/models/support-method.model.d.ts +0 -10
- package/models/support-ticket.model.d.ts +0 -40
- package/models/user.model.d.ts +0 -15
- package/publications/app-status.d.ts +0 -3
- package/publications/app-version.d.ts +0 -3
- package/publications/cron-jobs.d.ts +0 -3
- package/publications/files.d.ts +0 -3
- package/publications/flags.d.ts +0 -3
- package/publications/logs.d.ts +0 -3
- package/publications/method-calls.d.ts +0 -3
- package/publications/method-responses.d.ts +0 -3
- package/publications/super-admin.d.ts +0 -3
- package/publications/support-tickets.d.ts +0 -2
- package/server-app.d.ts +0 -34
- package/support-methods/aws.d.ts +0 -3
- package/support-methods/collections.d.ts +0 -3
- package/support-methods/counters.d.ts +0 -3
- package/support-methods/support.d.ts +0 -3
- package/util/common.d.ts +0 -15
package/methods/pdf.js
CHANGED
|
@@ -1,303 +1 @@
|
|
|
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;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var fs=require("fs"),request=require("request"),mongoose_1=require("mongoose"),simpl_schema_1=require("simpl-schema"),pdfCnt=0;function loadPDFMethods(t){t.methods({generatePDF:{skipQueue:!0,check:new simpl_schema_1.default({html:{type:String},fileName:{type:String},orientation:{type:String,optional:!0},fontSize:{type:String,optional:!0},upload:{type:Boolean,optional:!0},uploadFileOrder:{type:Number,optional:!0},uploadFileType:{type:String,optional:!0}}),function:function(e,s,n,l,f,p,c){void 0===n&&(n="portrait"),void 0===l&&(l="8px"),void 0===f&&(f=!1),void 0===p&&(p=-1),void 0===c&&(c="");var u=this;return new Promise(function(i,o){var t=require("phantom"),a=null;t.create().then(function(t){return(a=t).createPage()}).then(function(t){t.property("paperSize",{format:"letter",margin:"1cm",orientation:n,footer:{height:"1cm",contents:a.callback(function(t,e){return"<span style='float:right; font-size: 12px;'>Page "+t+" of "+e+"</span>"})}}),t.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: "+(l||"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"+e.replace(new RegExp("flex-basis:","g"),"-webkit-flex-basis:").replace(new RegExp("flex:","g"),"-webkit-flex:")+"</body>");var r=pdfCnt+++"-"+s;t.render(r,{format:"pdf",quality:"100"}).then(function(){fs.existsSync(r)?fs.readFile(r,function(t,e){if(t)console.log(t);else if(fs.unlinkSync(r),f){var n="data:application/pdf;base64,"+Buffer.from(e).toString("base64");u.callMethodInternal.call(u,"uploadFileAndSave",s,n,4*Math.ceil(n.length/3),p,c,function(t,e){t?o(t):i(e)})}else i("data:application/pdf;base64,"+Buffer.from(e).toString("base64"));a.exit()}):(o("No tmp file"),console.log("No tmp file ",r))})}).catch(function(t){o(t),a.exit()})})}},mergePDF:{skipQueue:!0,check:new simpl_schema_1.default({fileKeys:{type:Array},"fileKeys.$":{type:String},fileName:{type:String},fileType:{type:String,optional:!0}}),function:function(e,s,l){var f=this;return new Promise(function(o,a){f.callMethodInternal.call(f,"getCCProcessURL").then(function(t){var i="uploads/"+Date.now()+"-"+pdfCnt+++"-"+s;request({method:"POST",url:"https:"+t.url,headers:{"Content-Type":"application/json"},json:{mode:"combine",input:{s3:{accesskeyid:f.serverConfig.AWSACCESSKEYID,secretaccesskey:f.serverConfig.AWSSECRETACCESSKEY,region:f.serverConfig.AWSREGION,bucket:f.serverConfig.AWSBUCKET}},files:e,outputformat:"pdf",wait:!0,output:{s3:{accesskeyid:f.serverConfig.AWSACCESSKEYID,secretaccesskey:f.serverConfig.AWSSECRETACCESSKEY,region:f.serverConfig.AWSREGION,bucket:f.serverConfig.AWSBUCKET,path:i}},converteroptions:{resize:"612x792",resizemode:"scale",resizeenlarge:null,grayscale:null,auto_orient:null,strip_metatags:!1,density:72,rotate:null,command:null}}},function(t,e,n){if(t)a(t);else{var r={_id:mongoose_1.Types.ObjectId().toHexString(),__v:0,name:s,size:n.output.size,key:i,type:l||"",order:-1};n.output.size?f.callMethodInternal.call(f,"insertDocument","files",r,function(t,e){e?(r.status="Uploaded",o(r)):a(t)}):a("Merged file has no size, merge failed")}})},function(t){return a(t)})})}},mergePDFNoUpload:{skipQueue:!0,check:new simpl_schema_1.default({fileKeys:{type:Array},"fileKeys.$":{type:String},fileName:{type:String},fileType:{type:String,optional:!0}}),function:function(e,s,l){var f=this;return new Promise(function(o,a){f.callMethodInternal.call(f,"getCCProcessURL").then(function(t){var i="uploads/"+Date.now()+"-"+pdfCnt+++"-"+s;request({method:"POST",url:"https:"+t.url,headers:{"Content-Type":"application/json"},json:{mode:"combine",input:{s3:{accesskeyid:f.serverConfig.AWSACCESSKEYID,secretaccesskey:f.serverConfig.AWSSECRETACCESSKEY,region:f.serverConfig.AWSREGION,bucket:f.serverConfig.AWSBUCKET}},files:e,outputformat:"pdf",wait:!0,output:{s3:{accesskeyid:f.serverConfig.AWSACCESSKEYID,secretaccesskey:f.serverConfig.AWSSECRETACCESSKEY,region:f.serverConfig.AWSREGION,bucket:f.serverConfig.AWSBUCKET,path:i}},converteroptions:{resize:"612x792",resizemode:"scale",resizeenlarge:null,grayscale:null,auto_orient:null,strip_metatags:!1,density:72,rotate:null,command:null}}},function(t,e,n){if(t)a(t);else{var r={_id:mongoose_1.Types.ObjectId().toHexString(),name:s,size:n.output.size,key:i,type:l||"",order:-1};f.callMethodInternal.call(f,"insertDocument","files",r,function(t,e){if(e){r.status="Uploaded",o(r);var n=f;setTimeout(function(){n.callMethodInternal.call(n,"deleteFile",i)},6e4)}else a(t)})}})},function(t){return a(t)})})}}})}exports.loadPDFMethods=loadPDFMethods;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/counter.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/cron-job.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/dialog.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/file.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/flag.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/log.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/method.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,20 +1 @@
|
|
|
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
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var simpl_schema_1=require("simpl-schema");exports.PaginationOptionsSchema=new simpl_schema_1.default({limit:{type:Number},skip:{type:Number},sort:{type:Object,blackbox:!0},fields:{type:Object,optional:!0,blackbox:!0}});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/models/user.model.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@resolveio/server-lib",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"package": "npm
|
|
7
|
+
"package": "npm pack ./dist",
|
|
8
8
|
"start": "node_modules/.bin/forever -c node --max-old-space-size=800 index.js",
|
|
9
9
|
"server": "node_modules/gulp/bin/gulp.js mongo-start && node_modules/gulp/bin/gulp.js",
|
|
10
10
|
"postserver": "node_modules/gulp/bin/gulp.js mongo-stop",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/aws-sdk": "2.7.0",
|
|
46
|
-
"@types/core-js": "^2.5.0",
|
|
47
46
|
"@types/express": "4.16.0",
|
|
48
47
|
"@types/handlebars": "4.0.39",
|
|
49
48
|
"@types/imap": "0.8.29",
|
|
@@ -61,11 +60,9 @@
|
|
|
61
60
|
"gulp-nodemon": "2.4.1",
|
|
62
61
|
"gulp-rename": "1.4.0",
|
|
63
62
|
"gulp-shell": "0.6.5",
|
|
64
|
-
"gulp-sourcemaps": "^2.6.4",
|
|
65
63
|
"gulp-typescript": "5.0.0-alpha.3",
|
|
66
64
|
"gulp-uglify": "3.0.1",
|
|
67
65
|
"gulp-zip": "4.2.0",
|
|
68
|
-
"merge2": "^1.2.3",
|
|
69
66
|
"mkdirs": "0.0.2",
|
|
70
67
|
"typescript": "3.1.6"
|
|
71
68
|
}
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var app_status_collection_1 = require("../collections/app-status.collection");
|
|
4
|
-
function loadAppStatusPublications(subscriptionManager) {
|
|
5
|
-
subscriptionManager.publications({
|
|
6
|
-
appstatus: {
|
|
7
|
-
function: function () {
|
|
8
|
-
return app_status_collection_1.AppStatus.findOne().exec();
|
|
9
|
-
},
|
|
10
|
-
collections: ['app-statuses']
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
exports.loadAppStatusPublications = loadAppStatusPublications;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var app_status_collection_1=require("../collections/app-status.collection");function loadAppStatusPublications(t){t.publications({appstatus:{function:function(){return app_status_collection_1.AppStatus.findOne().exec()},collections:["app-statuses"]}})}exports.loadAppStatusPublications=loadAppStatusPublications;
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var app_version_collection_1 = require("../collections/app-version.collection");
|
|
4
|
-
function loadAppVersionPublications(subscriptionManager) {
|
|
5
|
-
subscriptionManager.publications({
|
|
6
|
-
appversion: {
|
|
7
|
-
function: function () {
|
|
8
|
-
return app_version_collection_1.AppVersions.findOne({}).exec();
|
|
9
|
-
},
|
|
10
|
-
collections: ['app-versions']
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
exports.loadAppVersionPublications = loadAppVersionPublications;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var app_version_collection_1=require("../collections/app-version.collection");function loadAppVersionPublications(o){o.publications({appversion:{function:function(){return app_version_collection_1.AppVersions.findOne({}).exec()},collections:["app-versions"]}})}exports.loadAppVersionPublications=loadAppVersionPublications;
|
|
@@ -1,14 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var cron_job_collection_1 = require("../collections/cron-job.collection");
|
|
4
|
-
function loadCronJobPublications(subscriptionManager) {
|
|
5
|
-
subscriptionManager.publications({
|
|
6
|
-
cronjobs: {
|
|
7
|
-
function: function () {
|
|
8
|
-
return cron_job_collection_1.CronJobs.find().sort({ name: 1 }).exec();
|
|
9
|
-
},
|
|
10
|
-
collections: ['cron-jobs']
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
exports.loadCronJobPublications = loadCronJobPublications;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var cron_job_collection_1=require("../collections/cron-job.collection");function loadCronJobPublications(o){o.publications({cronjobs:{function:function(){return cron_job_collection_1.CronJobs.find().sort({name:1}).exec()},collections:["cron-jobs"]}})}exports.loadCronJobPublications=loadCronJobPublications;
|
package/publications/files.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var simpl_schema_1 = require("simpl-schema");
|
|
4
|
-
var file_collection_1 = require("./../collections/file.collection");
|
|
5
|
-
function loadFilePublications(subscriptionManager) {
|
|
6
|
-
subscriptionManager.publications({
|
|
7
|
-
fileWithId: {
|
|
8
|
-
function: function (id_file) {
|
|
9
|
-
return file_collection_1.Files.findById(id_file).sort({ name: 1 }).exec();
|
|
10
|
-
},
|
|
11
|
-
check: new simpl_schema_1.default({
|
|
12
|
-
id_file: {
|
|
13
|
-
type: String
|
|
14
|
-
}
|
|
15
|
-
}),
|
|
16
|
-
collections: ['files'],
|
|
17
|
-
fetchFunction: function (document, id_file) {
|
|
18
|
-
return document._id === id_file;
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
filesIn: {
|
|
22
|
-
function: function (id_files) {
|
|
23
|
-
return file_collection_1.Files.find({ _id: { $in: id_files } }).sort({ name: 1 }).exec();
|
|
24
|
-
},
|
|
25
|
-
check: new simpl_schema_1.default({
|
|
26
|
-
id_files: {
|
|
27
|
-
type: Array
|
|
28
|
-
},
|
|
29
|
-
'id_files.$': {
|
|
30
|
-
type: String
|
|
31
|
-
}
|
|
32
|
-
}),
|
|
33
|
-
collections: ['files'],
|
|
34
|
-
fetchFunction: function (document, id_files) {
|
|
35
|
-
return id_files.includes(document._id);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
supportFileWithId: {
|
|
39
|
-
function: function (id_file) {
|
|
40
|
-
return file_collection_1.SupportFiles.findById(id_file).sort({ name: 1 }).exec();
|
|
41
|
-
},
|
|
42
|
-
check: new simpl_schema_1.default({
|
|
43
|
-
id_file: {
|
|
44
|
-
type: String
|
|
45
|
-
}
|
|
46
|
-
}),
|
|
47
|
-
collections: ['files'],
|
|
48
|
-
fetchFunction: function (document, id_file) {
|
|
49
|
-
return document._id === id_file;
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
supportFilesIn: {
|
|
53
|
-
function: function (id_files) {
|
|
54
|
-
return file_collection_1.SupportFiles.find({ _id: { $in: id_files } }).sort({ name: 1 }).exec();
|
|
55
|
-
},
|
|
56
|
-
check: new simpl_schema_1.default({
|
|
57
|
-
id_files: {
|
|
58
|
-
type: Array
|
|
59
|
-
},
|
|
60
|
-
'id_files.$': {
|
|
61
|
-
type: String
|
|
62
|
-
}
|
|
63
|
-
}),
|
|
64
|
-
collections: ['files'],
|
|
65
|
-
fetchFunction: function (document, id_files) {
|
|
66
|
-
return id_files.includes(document._id);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
exports.loadFilePublications = loadFilePublications;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var simpl_schema_1=require("simpl-schema"),file_collection_1=require("./../collections/file.collection");function loadFilePublications(e){e.publications({fileWithId:{function:function(e){return file_collection_1.Files.findById(e).sort({name:1}).exec()},check:new simpl_schema_1.default({id_file:{type:String}}),collections:["files"],fetchFunction:function(e,i){return e._id===i}},filesIn:{function:function(e){return file_collection_1.Files.find({_id:{$in:e}}).sort({name:1}).exec()},check:new simpl_schema_1.default({id_files:{type:Array},"id_files.$":{type:String}}),collections:["files"],fetchFunction:function(e,i){return i.includes(e._id)}},supportFileWithId:{function:function(e){return file_collection_1.SupportFiles.findById(e).sort({name:1}).exec()},check:new simpl_schema_1.default({id_file:{type:String}}),collections:["files"],fetchFunction:function(e,i){return e._id===i}},supportFilesIn:{function:function(e){return file_collection_1.SupportFiles.find({_id:{$in:e}}).sort({name:1}).exec()},check:new simpl_schema_1.default({id_files:{type:Array},"id_files.$":{type:String}}),collections:["files"],fetchFunction:function(e,i){return i.includes(e._id)}}})}exports.loadFilePublications=loadFilePublications;
|