@resolveio/server-lib 1.0.0-rc3 → 1.0.0-rc5

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.
Files changed (157) hide show
  1. package/collections/active-subscription.collection.d.ts +8 -0
  2. package/collections/active-subscription.collection.js +68 -1
  3. package/collections/app-status.collection.d.ts +8 -0
  4. package/collections/app-status.collection.js +43 -1
  5. package/collections/app-version.collection.d.ts +8 -0
  6. package/collections/app-version.collection.js +56 -1
  7. package/collections/counter.collection.d.ts +10 -0
  8. package/collections/counter.collection.js +73 -1
  9. package/collections/cron-job-history.collection.d.ts +8 -0
  10. package/collections/cron-job-history.collection.js +86 -1
  11. package/collections/cron-job.collection.d.ts +8 -0
  12. package/collections/cron-job.collection.js +89 -1
  13. package/collections/file.collection.d.ts +10 -0
  14. package/collections/file.collection.js +73 -1
  15. package/collections/flag.collection.d.ts +8 -0
  16. package/collections/flag.collection.js +47 -1
  17. package/collections/log.collection.d.ts +8 -0
  18. package/collections/log.collection.js +64 -1
  19. package/collections/logged-in-users.collection.d.ts +8 -0
  20. package/collections/logged-in-users.collection.js +70 -1
  21. package/collections/method-call.collection.d.ts +7 -0
  22. package/collections/method-call.collection.js +44 -1
  23. package/collections/method-response.collection.d.ts +7 -0
  24. package/collections/method-response.collection.js +48 -1
  25. package/collections/queue-flag.collection.d.ts +8 -0
  26. package/collections/queue-flag.collection.js +41 -1
  27. package/collections/queue-method.collection.d.ts +8 -0
  28. package/collections/queue-method.collection.js +116 -1
  29. package/collections/queue-response.collection.d.ts +8 -0
  30. package/collections/queue-response.collection.js +78 -1
  31. package/collections/support-ticket.collection.d.ts +8 -0
  32. package/collections/support-ticket.collection.js +146 -1
  33. package/collections/user.collection.d.ts +9 -0
  34. package/collections/user.collection.js +108 -1
  35. package/cron/cron.d.ts +6 -0
  36. package/cron/cron.js +160 -1
  37. package/fixtures/cron-jobs.d.ts +2 -0
  38. package/fixtures/cron-jobs.js +72 -1
  39. package/fixtures/init.d.ts +2 -0
  40. package/fixtures/init.js +73 -1
  41. package/http/auth.d.ts +3 -0
  42. package/http/auth.js +472 -1
  43. package/http/health.d.ts +2 -0
  44. package/http/health.js +8 -1
  45. package/index.d.ts +53 -0
  46. package/index.js +123 -1
  47. package/managers/cron.manager.d.ts +17 -0
  48. package/managers/cron.manager.js +193 -1
  49. package/managers/method.manager.d.ts +27 -0
  50. package/managers/method.manager.js +513 -1
  51. package/managers/queue-method.manager.d.ts +14 -0
  52. package/managers/queue-method.manager.js +239 -1
  53. package/managers/subscription.manager.d.ts +27 -0
  54. package/managers/subscription.manager.js +700 -1
  55. package/managers/support.manager.d.ts +18 -0
  56. package/managers/support.manager.js +208 -1
  57. package/methods/accounts.d.ts +3 -0
  58. package/methods/accounts.js +253 -1
  59. package/methods/aws.d.ts +3 -0
  60. package/methods/aws.js +323 -1
  61. package/methods/cloudconvert.d.ts +3 -0
  62. package/methods/cloudconvert.js +37 -1
  63. package/methods/collections.d.ts +3 -0
  64. package/methods/collections.js +738 -1
  65. package/methods/counters.d.ts +3 -0
  66. package/methods/counters.js +404 -1
  67. package/methods/cron-jobs.d.ts +3 -0
  68. package/methods/cron-jobs.js +63 -1
  69. package/methods/flags.d.ts +3 -0
  70. package/methods/flags.js +6 -1
  71. package/methods/logs.d.ts +3 -0
  72. package/methods/logs.js +29 -1
  73. package/methods/pdf.d.ts +3 -0
  74. package/methods/pdf.js +303 -1
  75. package/models/active-subscription.model.d.ts +14 -0
  76. package/models/active-subscription.model.js +2 -1
  77. package/models/app-status.model.d.ts +5 -0
  78. package/models/app-status.model.js +2 -1
  79. package/models/app-version.model.d.ts +5 -0
  80. package/models/app-version.model.js +2 -1
  81. package/models/collection-document.model.d.ts +7 -0
  82. package/models/collection-document.model.js +2 -1
  83. package/models/counter.model.d.ts +6 -0
  84. package/models/counter.model.js +2 -1
  85. package/models/cron-job-history.model.d.ts +13 -0
  86. package/models/cron-job-history.model.js +2 -1
  87. package/models/cron-job.model.d.ts +14 -0
  88. package/models/cron-job.model.js +2 -1
  89. package/models/dialog.model.d.ts +24 -0
  90. package/models/dialog.model.js +2 -1
  91. package/models/file.model.d.ts +10 -0
  92. package/models/file.model.js +2 -1
  93. package/models/flag.model.d.ts +6 -0
  94. package/models/flag.model.js +2 -1
  95. package/models/log.model.d.ts +12 -0
  96. package/models/log.model.js +2 -1
  97. package/models/logged-in-users.model.d.ts +10 -0
  98. package/models/logged-in-users.model.js +2 -1
  99. package/models/method-call.model.d.ts +8 -0
  100. package/models/method-call.model.js +2 -1
  101. package/models/method-response.model.d.ts +9 -0
  102. package/models/method-response.model.js +2 -1
  103. package/models/method.model.d.ts +11 -0
  104. package/models/method.model.js +2 -1
  105. package/models/pagination.model.d.ts +12 -0
  106. package/models/pagination.model.js +20 -1
  107. package/models/permission.model.d.ts +13 -0
  108. package/models/permission.model.js +2 -1
  109. package/models/queue-method.model.d.ts +10 -0
  110. package/models/queue-method.model.js +2 -1
  111. package/models/queue-response.model.d.ts +11 -0
  112. package/models/queue-response.model.js +2 -1
  113. package/models/select-data-label.model.d.ts +10 -0
  114. package/models/select-data-label.model.js +2 -1
  115. package/models/server-response.model.d.ts +6 -0
  116. package/models/server-response.model.js +2 -1
  117. package/models/subscription.model.d.ts +31 -0
  118. package/models/subscription.model.js +2 -1
  119. package/models/support-method.model.d.ts +10 -0
  120. package/models/support-method.model.js +2 -1
  121. package/models/support-ticket.model.d.ts +40 -0
  122. package/models/support-ticket.model.js +2 -1
  123. package/models/user.model.d.ts +15 -0
  124. package/models/user.model.js +2 -1
  125. package/package.json +4 -1
  126. package/publications/app-status.d.ts +3 -0
  127. package/publications/app-status.js +14 -1
  128. package/publications/app-version.d.ts +3 -0
  129. package/publications/app-version.js +14 -1
  130. package/publications/cron-jobs.d.ts +3 -0
  131. package/publications/cron-jobs.js +14 -1
  132. package/publications/files.d.ts +3 -0
  133. package/publications/files.js +71 -1
  134. package/publications/flags.d.ts +3 -0
  135. package/publications/flags.js +23 -1
  136. package/publications/logs.d.ts +3 -0
  137. package/publications/logs.js +26 -1
  138. package/publications/method-calls.d.ts +3 -0
  139. package/publications/method-calls.js +14 -1
  140. package/publications/method-responses.d.ts +3 -0
  141. package/publications/method-responses.js +14 -1
  142. package/publications/super-admin.d.ts +3 -0
  143. package/publications/super-admin.js +21 -1
  144. package/publications/support-tickets.d.ts +2 -0
  145. package/publications/support-tickets.js +118 -1
  146. package/server-app.d.ts +33 -0
  147. package/server-app.js +598 -1
  148. package/support-methods/aws.d.ts +3 -0
  149. package/support-methods/aws.js +276 -1
  150. package/support-methods/collections.d.ts +3 -0
  151. package/support-methods/collections.js +471 -1
  152. package/support-methods/counters.d.ts +3 -0
  153. package/support-methods/counters.js +189 -1
  154. package/support-methods/support.d.ts +3 -0
  155. package/support-methods/support.js +19 -1
  156. package/util/common.d.ts +15 -0
  157. package/util/common.js +334 -1
package/methods/pdf.js CHANGED
@@ -1 +1,303 @@
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
+ "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";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { CollectionDocument } from './collection-document.model';
2
+ export interface AppStatusModel extends CollectionDocument {
3
+ message: string;
4
+ }
5
+ //# sourceMappingURL=app-status.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { CollectionDocument } from './collection-document.model';
2
+ export interface AppVersionModel extends CollectionDocument {
3
+ version: number;
4
+ }
5
+ //# sourceMappingURL=app-version.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ export interface CollectionDocument {
2
+ _id?: any;
3
+ __v?: number;
4
+ createdAt?: Date;
5
+ updatedAt?: Date;
6
+ }
7
+ //# sourceMappingURL=collection-document.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { CollectionDocument } from './collection-document.model';
2
+ export interface CounterModel extends CollectionDocument {
3
+ count: number;
4
+ type: string;
5
+ }
6
+ //# sourceMappingURL=counter.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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";Object.defineProperty(exports,"__esModule",{value:!0});
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
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { CollectionDocument } from './collection-document.model';
2
+ export interface FlagModel extends CollectionDocument {
3
+ type: string;
4
+ value?: boolean;
5
+ }
6
+ //# sourceMappingURL=flag.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { CollectionDocument } from './collection-document.model';
2
+ export interface MethodCallModel extends CollectionDocument {
3
+ id_user: string;
4
+ message_id: string;
5
+ method: string;
6
+ data: string;
7
+ }
8
+ //# sourceMappingURL=method-call.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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";Object.defineProperty(exports,"__esModule",{value:!0});
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
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
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";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
+ "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
+ });
@@ -0,0 +1,13 @@
1
+ export interface ModulePermissionModel {
2
+ name: string;
3
+ views: ModulePermissionViewModel[];
4
+ approval?: ModulePermissionApprovalModel;
5
+ }
6
+ export interface ModulePermissionViewModel {
7
+ link: string;
8
+ label: string;
9
+ }
10
+ export interface ModulePermissionApprovalModel {
11
+ type: string;
12
+ }
13
+ //# sourceMappingURL=permission.model.d.ts.map
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });