@resolveio/server-lib 5.2.11 → 5.2.12-newrole

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.
@@ -22,13 +22,6 @@ var schema = {
22
22
  type: Date,
23
23
  optional: true
24
24
  },
25
- readonly: {
26
- type: Boolean,
27
- optional: true
28
- },
29
- active: {
30
- type: Boolean
31
- },
32
25
  attempts: {
33
26
  type: Number,
34
27
  optional: true
@@ -65,53 +58,67 @@ var schema = {
65
58
  type: String
66
59
  },
67
60
  roles: {
61
+ type: Object
62
+ },
63
+ 'roles.super_admin': {
64
+ type: Boolean
65
+ },
66
+ 'roles.approvals': {
68
67
  type: Array
69
68
  },
70
- 'roles.$': {
69
+ 'roles.approvals.$': {
70
+ type: Object
71
+ },
72
+ 'roles.approvals.$.name': {
71
73
  type: String
72
74
  },
73
- phonenumber: {
74
- type: String,
75
- optional: true
75
+ 'roles.approvals.$.type': {
76
+ type: String
76
77
  },
77
- other: {
78
- type: Object,
79
- blackbox: true,
80
- optional: true
78
+ 'roles.approvals.$.accounting_code': {
79
+ type: String
81
80
  },
82
- assets: {
83
- type: Array,
84
- optional: true
81
+ 'roles.groups': {
82
+ type: Array
85
83
  },
86
- 'assets.$': {
84
+ 'roles.groups.$': {
87
85
  type: Object
88
86
  },
89
- 'assets.$.type': {
87
+ 'roles.groups.$.name': {
90
88
  type: String
91
89
  },
92
- 'assets.$.id_asset': {
93
- type: String
90
+ 'roles.groups.$.views': {
91
+ type: Array
94
92
  },
95
- 'assets.$.asset_number': {
93
+ 'roles.groups.$.views.$': {
96
94
  type: String
97
95
  },
98
- 'assets.$.ownership': {
99
- type: String
96
+ 'roles.groups.$.yard': {
97
+ type: String,
98
+ optional: true
99
+ },
100
+ 'roles.notifications': {
101
+ type: Array
100
102
  },
101
- 'assets.$.ownership_driver': {
103
+ 'roles.notifications.$': {
102
104
  type: String
103
105
  },
104
- 'assets.$.date_start': {
105
- type: Date
106
+ 'roles.miscs': {
107
+ type: Array
106
108
  },
107
- 'assets.$.date_end': {
108
- type: Date,
109
- optional: true
109
+ 'roles.miscs.$': {
110
+ type: String
110
111
  },
111
- id_function: {
112
+ active: Boolean,
113
+ phonenumber: {
112
114
  type: String,
113
115
  optional: true
114
116
  },
117
+ other: {
118
+ type: Object,
119
+ optional: true,
120
+ blackbox: true
121
+ },
115
122
  customers: {
116
123
  type: Array,
117
124
  optional: true,
package/fixtures/init.js CHANGED
@@ -37,8 +37,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
38
  var app_version_collection_1 = require("../collections/app-version.collection");
39
39
  var logged_in_users_collection_1 = require("../collections/logged-in-users.collection");
40
- var active_subscription_collection_1 = require("../collections/active-subscription.collection");
41
40
  var mongoose_1 = require("mongoose");
41
+ var active_subscription_collection_1 = require("../collections/active-subscription.collection");
42
42
  function loadServerInit() {
43
43
  return __awaiter(this, void 0, void 0, function () {
44
44
  var appVersion;
package/methods/aws.js CHANGED
@@ -86,7 +86,7 @@ function loadAWSMethods(methodManager) {
86
86
  file_collection_1.Files.create(file).then(function (resFile) {
87
87
  resolve(resFile);
88
88
  }, function (errFile) { return reject(errFile); });
89
- this.callMethodInternal.call(this, 'compressAndUploadPDF', file._id, fileName, key_1, fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''));
89
+ this.callMethodInternal.call(this, 'compressBase64AndUploadPDF', file._id, fileName, key_1, fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''));
90
90
  }
91
91
  else {
92
92
  newParams = { Bucket: that.serverConfig.AWSBUCKET, Key: key_1, Body: Buffer.from(fileData.replace('data:' + fileData.split(',')[0].split(':')[1].split(';')[0] + ';base64,', ''), 'base64'), ACL: 'private', ContentType: fileData.split(',')[0].split(':')[1].split(';')[0], ContentDisposition: 'inline' };
package/methods/pdf.js CHANGED
@@ -120,7 +120,7 @@ function loadPDFMethods(methodManager) {
120
120
  });
121
121
  }
122
122
  },
123
- compressAndUploadPDF: {
123
+ compressBase64AndUploadPDF: {
124
124
  skipQueue: true,
125
125
  check: new simpl_schema_1.default({
126
126
  id_file: {
@@ -162,7 +162,73 @@ function loadPDFMethods(methodManager) {
162
162
  'bucket': _this.serverConfig['AWSBUCKET'],
163
163
  'path': filePath
164
164
  }
165
+ }
166
+ }
167
+ }, function (error, response, body) {
168
+ if (!error) {
169
+ if (body.output.size) {
170
+ file_collection_1.Files.updateOne({ _id: id_file }, { $set: { size: body.output.size } }).exec();
171
+ resolve();
172
+ }
173
+ else {
174
+ reject('Compressed file has no size, compress failed');
175
+ }
176
+ }
177
+ else {
178
+ reject(error);
179
+ }
180
+ });
181
+ }, function (errCC) { return reject(errCC); });
182
+ });
183
+ }
184
+ },
185
+ compressPDFOnS3: {
186
+ skipQueue: true,
187
+ check: new simpl_schema_1.default({
188
+ id_file: {
189
+ type: String
190
+ },
191
+ fileName: {
192
+ type: String
193
+ },
194
+ filePath: {
195
+ type: String
196
+ }
197
+ }),
198
+ function: function (id_file, fileName, filePath) {
199
+ var _this = this;
200
+ return new Promise(function (resolve, reject) {
201
+ _this.callMethodInternal.call(_this, 'getCCProcessURL').then(function (resCC) {
202
+ //send request
203
+ request({
204
+ method: 'POST',
205
+ url: 'https:' + resCC.url,
206
+ headers: {
207
+ 'Content-Type': 'application/json'
208
+ },
209
+ json: {
210
+ mode: 'compress',
211
+ input: {
212
+ 's3': {
213
+ 'accesskeyid': _this.serverConfig['AWSACCESSKEYID'],
214
+ 'secretaccesskey': _this.serverConfig['AWSSECRETACCESSKEY'],
215
+ 'region': _this.serverConfig['AWSREGION'],
216
+ 'bucket': _this.serverConfig['AWSBUCKET']
217
+ }
165
218
  },
219
+ file: filePath,
220
+ filename: fileName,
221
+ outputformat: 'pdf',
222
+ wait: true,
223
+ output: {
224
+ 's3': {
225
+ 'accesskeyid': _this.serverConfig['AWSACCESSKEYID'],
226
+ 'secretaccesskey': _this.serverConfig['AWSSECRETACCESSKEY'],
227
+ 'region': _this.serverConfig['AWSREGION'],
228
+ 'bucket': _this.serverConfig['AWSBUCKET'],
229
+ 'path': filePath
230
+ }
231
+ }
166
232
  }
167
233
  }, function (error, response, body) {
168
234
  if (!error) {
@@ -260,6 +326,7 @@ function loadPDFMethods(methodManager) {
260
326
  _this.callMethodInternal.call(_this, 'insertDocument', 'files', resFile_1, function (errUpFile, resUpFile) {
261
327
  if (resUpFile) {
262
328
  resFile_1.status = 'Uploaded';
329
+ _this.callMethodInternal.call(_this, 'compressPDFOnS3', resFile_1._id, fileName, mergeFileName);
263
330
  resolve(resFile_1);
264
331
  }
265
332
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "5.2.11",
3
+ "version": "5.2.12-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {