@resolveio/server-lib 6.4.23 → 7.0.1

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 (68) hide show
  1. package/collections/counter.collection.d.ts +0 -2
  2. package/collections/counter.collection.js +0 -14
  3. package/collections/counter.collection.js.map +1 -1
  4. package/collections/file.collection.d.ts +0 -2
  5. package/collections/file.collection.js +0 -14
  6. package/collections/file.collection.js.map +1 -1
  7. package/collections/user.collection.d.ts +0 -1
  8. package/collections/user.collection.js +0 -4
  9. package/collections/user.collection.js.map +1 -1
  10. package/fixtures/cron-jobs.js +0 -17
  11. package/fixtures/cron-jobs.js.map +1 -1
  12. package/http/auth.js +176 -20
  13. package/http/auth.js.map +1 -1
  14. package/http/home.js +37 -0
  15. package/http/home.js.map +1 -1
  16. package/index.d.ts +1 -4
  17. package/index.js +22 -71
  18. package/index.js.map +1 -1
  19. package/managers/method.manager.d.ts +0 -1
  20. package/managers/method.manager.js +2 -28
  21. package/managers/method.manager.js.map +1 -1
  22. package/managers/subscription.manager.d.ts +0 -3
  23. package/managers/subscription.manager.js +19 -142
  24. package/managers/subscription.manager.js.map +1 -1
  25. package/methods/cron-jobs.js +0 -68
  26. package/methods/cron-jobs.js.map +1 -1
  27. package/methods/support.d.ts +2 -0
  28. package/methods/support.js +439 -0
  29. package/methods/support.js.map +1 -0
  30. package/package.json +1 -1
  31. package/publications/files.js +0 -31
  32. package/publications/files.js.map +1 -1
  33. package/server-app.d.ts +0 -4
  34. package/server-app.js +11 -71
  35. package/server-app.js.map +1 -1
  36. package/client-server-app.d.ts +0 -1
  37. package/client-server-app.js +0 -48
  38. package/client-server-app.js.map +0 -1
  39. package/collections/billing-logged-in-users.collection.d.ts +0 -7
  40. package/collections/billing-logged-in-users.collection.js +0 -75
  41. package/collections/billing-logged-in-users.collection.js.map +0 -1
  42. package/collections/support-ticket.collection.d.ts +0 -7
  43. package/collections/support-ticket.collection.js +0 -226
  44. package/collections/support-ticket.collection.js.map +0 -1
  45. package/managers/support.manager.d.ts +0 -22
  46. package/managers/support.manager.js +0 -329
  47. package/managers/support.manager.js.map +0 -1
  48. package/models/support-method.model.d.ts +0 -9
  49. package/models/support-method.model.js +0 -4
  50. package/models/support-method.model.js.map +0 -1
  51. package/publications/billing-logged-in-users.d.ts +0 -1
  52. package/publications/billing-logged-in-users.js +0 -65
  53. package/publications/billing-logged-in-users.js.map +0 -1
  54. package/publications/support-tickets.d.ts +0 -1
  55. package/publications/support-tickets.js +0 -203
  56. package/publications/support-tickets.js.map +0 -1
  57. package/support-methods/aws.d.ts +0 -2
  58. package/support-methods/aws.js +0 -279
  59. package/support-methods/aws.js.map +0 -1
  60. package/support-methods/collections.d.ts +0 -2
  61. package/support-methods/collections.js +0 -475
  62. package/support-methods/collections.js.map +0 -1
  63. package/support-methods/counters.d.ts +0 -2
  64. package/support-methods/counters.js +0 -192
  65. package/support-methods/counters.js.map +0 -1
  66. package/support-methods/support.d.ts +0 -2
  67. package/support-methods/support.js +0 -282
  68. package/support-methods/support.js.map +0 -1
@@ -3,7 +3,5 @@ import { CounterModel } from '../models/counter.model';
3
3
  interface ResolveIOModel extends CounterModel, Document {
4
4
  }
5
5
  export declare const Counters: Model<ResolveIOModel>;
6
- export declare let SupportCounters: Model<ResolveIOModel>;
7
6
  export declare const CounterVersions: Model<ResolveIOModel>;
8
- export declare let SupportCounterVersions: Model<ResolveIOModel>;
9
7
  export {};
@@ -44,10 +44,6 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
44
44
  timestamps: true
45
45
  });
46
46
  exports.Counters = index_1.ResolveIOServer.getMainDB().model('counters', DefaultSchema);
47
- exports.SupportCounters = null;
48
- if (index_1.ResolveIOServer.getSupportDB()) {
49
- exports.SupportCounters = index_1.ResolveIOServer.getSupportDB().model('counters', DefaultSchema);
50
- }
51
47
  var checkSchema = __assign({}, schema);
52
48
  checkSchema._id = {
53
49
  type: mongoose_1.Schema.Types.Mixed
@@ -58,18 +54,8 @@ var VersionSchema = new mongoose_1.Schema(checkSchema, {
58
54
  timestamps: true
59
55
  });
60
56
  exports.Counters['versionCollection'] = 'counters.versions';
61
- if (index_1.ResolveIOServer.getSupportDB()) {
62
- exports.SupportCounters['versionCollection'] = 'counters.versions';
63
- }
64
57
  exports.CounterVersions = index_1.ResolveIOServer.getMainDB().model(exports.Counters['versionCollection'], VersionSchema);
65
- exports.SupportCounterVersions = null;
66
- if (index_1.ResolveIOServer.getSupportDB()) {
67
- exports.SupportCounterVersions = index_1.ResolveIOServer.getSupportDB().model(exports.SupportCounters['versionCollection'], VersionSchema);
68
- }
69
58
  schema.count.type = simpl_schema_1.default.Integer;
70
59
  exports.Counters['simplschema'] = new simpl_schema_1.default(schema);
71
- if (index_1.ResolveIOServer.getSupportDB()) {
72
- exports.SupportCounters['simplschema'] = new simpl_schema_1.default(schema);
73
- }
74
60
 
75
61
  //# sourceMappingURL=counter.collection.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/counter.collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAmD;AACnD,6CAAwC;AACxC,kCAA2C;AAG3C,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,IAAI,EAAE;QACL,IAAI,EAAE,MAAM;KACZ;IACD,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;KACZ;CACD,CAAC;AAEF,IAAM,aAAa,GAAG,IAAI,iBAAM,CAAC,MAAM,EAAE;IACxC,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CA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AAC,YAAY,EAAE,EAAE;IACnC,uBAAe,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;CAC1D","file":"counter.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { CounterModel } from '../models/counter.model';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true \n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\ttype: {\n\t\ttype: String\n\t},\n\tcount: {\n\t\ttype: Number\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\ninterface ResolveIOModel extends CounterModel, Document {}\nexport const Counters: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('counters', DefaultSchema);\nexport let SupportCounters: Model<ResolveIOModel> = null;\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportCounters = ResolveIOServer.getSupportDB().model('counters', DefaultSchema);\n}\n\nlet checkSchema = { ...schema };\n\ncheckSchema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(checkSchema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nCounters['versionCollection'] = 'counters.versions';\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportCounters['versionCollection'] = 'counters.versions';\n}\n\nexport const CounterVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Counters['versionCollection'], VersionSchema);\nexport let SupportCounterVersions: Model<ResolveIOModel> = null;\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportCounterVersions = ResolveIOServer.getSupportDB().model(SupportCounters['versionCollection'], VersionSchema);\n}\n\nschema.count.type = SimpleSchema.Integer;\nCounters['simplschema'] = new SimpleSchema(schema);\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportCounters['simplschema'] = new SimpleSchema(schema);\n}"]}
1
+ {"version":3,"sources":["../../src/collections/counter.collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qCAAmD;AACnD,6CAAwC;AACxC,kCAA2C;AAG3C,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,IAAI,EAAE;QACL,IAAI,EAAE,MAAM;KACZ;IACD,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;KACZ;CACD,CAAC;AAEF,IAAM,aAAa,GAAG,IAAI,iBAAM,CAAC,MAAM,EAAE;IACxC,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAGU,QAAA,QAAQ,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE5G,IAAI,WAAW,gBAAQ,MAAM,CAAE,CAAC;AAEhC,WAAW,CAAC,GAAG,GAAG;IACjB,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK;CACxB,CAAC;AAEF,IAAI,aAAa,GAAG,IAAI,iBAAM,CAAC,WAAW,EAAE;IAC3C,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,gBAAQ,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;AAEvC,QAAA,eAAe,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,gBAAQ,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;AAEtI,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,sBAAY,CAAC,OAAO,CAAC;AACzC,gBAAQ,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC","file":"counter.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { CounterModel } from '../models/counter.model';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true \n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\ttype: {\n\t\ttype: String\n\t},\n\tcount: {\n\t\ttype: Number\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\ninterface ResolveIOModel extends CounterModel, Document {}\nexport const Counters: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('counters', DefaultSchema);\n\nlet checkSchema = { ...schema };\n\ncheckSchema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(checkSchema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nCounters['versionCollection'] = 'counters.versions';\n\nexport const CounterVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Counters['versionCollection'], VersionSchema);\n\nschema.count.type = SimpleSchema.Integer;\nCounters['simplschema'] = new SimpleSchema(schema);"]}
@@ -3,7 +3,5 @@ import { FileModel } from '../models/file.model';
3
3
  interface ResolveIOModel extends FileModel, Document {
4
4
  }
5
5
  export declare const Files: Model<ResolveIOModel>;
6
- export declare let SupportFiles: Model<ResolveIOModel>;
7
6
  export declare const FileVersions: Model<ResolveIOModel>;
8
- export declare let SupportFileVersions: Model<ResolveIOModel>;
9
7
  export {};
@@ -51,14 +51,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
51
51
  timestamps: true
52
52
  });
53
53
  exports.Files = index_1.ResolveIOServer.getMainDB().model('files', DefaultSchema);
54
- exports.SupportFiles = null;
55
- if (index_1.ResolveIOServer.getSupportDB()) {
56
- exports.SupportFiles = index_1.ResolveIOServer.getSupportDB().model('files', DefaultSchema);
57
- }
58
54
  exports.Files['simplschema'] = new simpl_schema_1.default(schema);
59
- if (index_1.ResolveIOServer.getSupportDB()) {
60
- exports.SupportFiles['simplschema'] = new simpl_schema_1.default(schema);
61
- }
62
55
  schema._id = {
63
56
  type: mongoose_1.Schema.Types.Mixed
64
57
  };
@@ -68,14 +61,7 @@ var VersionSchema = new mongoose_1.Schema(schema, {
68
61
  timestamps: true
69
62
  });
70
63
  exports.Files['versionCollection'] = 'files.versions';
71
- if (index_1.ResolveIOServer.getSupportDB()) {
72
- exports.SupportFiles['versionCollection'] = 'files.versions';
73
- }
74
64
  exports.FileVersions = index_1.ResolveIOServer.getMainDB().model(exports.Files['versionCollection'], VersionSchema);
75
- exports.SupportFileVersions = null;
76
- if (index_1.ResolveIOServer.getSupportDB()) {
77
- exports.SupportFileVersions = index_1.ResolveIOServer.getSupportDB().model(exports.Files['versionCollection'], VersionSchema);
78
- }
79
65
  //------------- Report Builder Schema
80
66
  var rbLookups = [];
81
67
  var rbSchema = Object.assign(schema, schema_report_builder_1.buildRbLookups(rbLookups, DefaultSchema, []));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/file.collection.ts"],"names":[],"mappings":";;AAAA,qCAAmD;AACnD,6CAAwC;AACxC,kCAA2C;AAG3C,uEAA8E;AAE9E,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,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AAC,KAAK,CAAC,KAAK;CACxB,CAAC;AAEF,IAAI,aAAa,GAAG,IAAI,iBAAM,CAAC,MAAM,EAAE;IACtC,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,aAAK,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;AAE9C,IAAI,uBAAe,CAAC,YAAY,EAAE,EAAE;IACnC,oBAAY,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;CACrD;AAEY,QAAA,YAAY,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,aAAK,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;AACrH,QAAA,mBAAmB,GAA0B,IAAI,CAAC;AAE7D,IAAI,uBAAe,CAAC,YAAY,EAAE,EAAE;IACnC,2BAAmB,GAAG,uBAAe,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,aAAK,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;CACtG;AAED,qCAAqC;AACrC,IAAI,SAAS,GAAmB,EAAE,CAAC;AAEnC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sCAAc,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;AACnF,aAAK,CAAC,UAAU,CAAC,GAAG,qCAAa,CAAC,QAAQ,CAAC,CAAC","file":"file.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { FileModel } from '../models/file.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { buildRbSchema, buildRbLookups } from '../util/schema-report-builder';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tname: {\n\t\ttype: String\n\t},\n\tsize: {\n\t\ttype: Number\n\t},\n\tkey: {\n\t\ttype: String\n\t},\n\ttype: {\n\t\ttype: String\n\t},\n\torder: {\n\t\ttype: Number\n\t},\n\tstatus: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tdefault: {\n\t\ttype: Boolean,\n\t\toptional: true\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\ninterface ResolveIOModel extends FileModel, Document {}\nexport const Files: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('files', DefaultSchema);\nexport let SupportFiles: Model<ResolveIOModel> = null;\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportFiles = ResolveIOServer.getSupportDB().model('files', DefaultSchema);\n}\n\nFiles['simplschema'] = new SimpleSchema(schema);\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportFiles['simplschema'] = new SimpleSchema(schema);\n}\n\nschema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nFiles['versionCollection'] = 'files.versions';\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportFiles['versionCollection'] = 'files.versions';\n}\n\nexport const FileVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Files['versionCollection'], VersionSchema);\nexport let SupportFileVersions: Model<ResolveIOModel> = null;\n\nif (ResolveIOServer.getSupportDB()) {\n\tSupportFileVersions = ResolveIOServer.getSupportDB().model(Files['versionCollection'], VersionSchema);\n}\n\n//------------- Report Builder Schema\nlet rbLookups: LookupTables[] = [];\n\nlet rbSchema = Object.assign(schema, buildRbLookups(rbLookups, DefaultSchema, []));\nFiles['rbSchema'] = buildRbSchema(rbSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/file.collection.ts"],"names":[],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EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,aAAK,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;AAEjC,QAAA,YAAY,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,aAAK,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;AAEhI,qCAAqC;AACrC,IAAI,SAAS,GAAmB,EAAE,CAAC;AAEnC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sCAAc,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;AACnF,aAAK,CAAC,UAAU,CAAC,GAAG,qCAAa,CAAC,QAAQ,CAAC,CAAC","file":"file.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { FileModel } from '../models/file.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { buildRbSchema, buildRbLookups } from '../util/schema-report-builder';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tname: {\n\t\ttype: String\n\t},\n\tsize: {\n\t\ttype: Number\n\t},\n\tkey: {\n\t\ttype: String\n\t},\n\ttype: {\n\t\ttype: String\n\t},\n\torder: {\n\t\ttype: Number\n\t},\n\tstatus: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tdefault: {\n\t\ttype: Boolean,\n\t\toptional: true\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\ninterface ResolveIOModel extends FileModel, Document {}\nexport const Files: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('files', DefaultSchema);\n\nFiles['simplschema'] = new SimpleSchema(schema);\n\nschema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nFiles['versionCollection'] = 'files.versions';\n\nexport const FileVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Files['versionCollection'], VersionSchema);\n\n//------------- Report Builder Schema\nlet rbLookups: LookupTables[] = [];\n\nlet rbSchema = Object.assign(schema, buildRbLookups(rbLookups, DefaultSchema, []));\nFiles['rbSchema'] = buildRbSchema(rbSchema);"]}
@@ -4,6 +4,5 @@ import { UserModel } from '../models/user.model';
4
4
  interface ResolveIOModel extends UserModel, PassportLocalDocument {
5
5
  }
6
6
  export declare const Users: PassportLocalModel<ResolveIOModel>;
7
- export declare let ClientUsers: PassportLocalModel<ResolveIOModel>;
8
7
  export declare const UserVersions: Model<ResolveIOModel>;
9
8
  export {};
@@ -167,10 +167,6 @@ DefaultSchema.plugin(passportLocalMongoose, {
167
167
  }
168
168
  });
169
169
  exports.Users = index_1.ResolveIOServer.getMainDB().model('users', DefaultSchema);
170
- exports.ClientUsers = null;
171
- if (index_1.ResolveIOServer.getSupportDB()) {
172
- exports.ClientUsers = index_1.ResolveIOServer.getSupportDB().model('client-users', DefaultSchema);
173
- }
174
170
  exports.Users['simplschema'] = new simpl_schema_1.default(schema);
175
171
  schema._id = {
176
172
  type: mongoose_1.Schema.Types.Mixed
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/user.collection.ts"],"names":[],"mappings":";;AAAA,qCAAwG;AACxG,+DAAiE;AACjE,6CAAwC;AACxC,kCAA2C;AAG3C,uEAA8E;AAE9E,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAA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GAAmB,EAAE,CAAC;AAEnC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sCAAc,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;AACnF,aAAK,CAAC,UAAU,CAAC,GAAG,qCAAa,CAAC,QAAQ,CAAC,CAAC","file":"user.collection.js","sourcesContent":["import { Schema, Model, PassportLocalDocument, PassportLocalModel, PassportLocalSchema} from 'mongoose';\nimport * as passportLocalMongoose from 'passport-local-mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { buildRbSchema, buildRbLookups } from '../util/schema-report-builder';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\treadonly: {\n\t\ttype: Boolean,\n\t\toptional: true\n\t},\n\tactive: {\n\t\ttype: Boolean\n\t},\n\tattempts: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tlast: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tservices: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'services.enrollment': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.forgot_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.reset_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tusername: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\temail: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tfullname: {\n\t\ttype: String\n\t},\n\troles: {\n\t\ttype: Array\n\t},\n\t'roles.$': {\n\t\ttype: String\n\t},\n\tphonenumber: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tother: {\n\t\ttype: Object,\n\t\tblackbox: true,\n\t\toptional: true\n\t},\n\tassets: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'assets.$': {\n\t\ttype: Object\n\t},\n\t'assets.$.type': {\n\t\ttype: String\n\t},\n\t'assets.$.id_asset': {\n\t\ttype: String\n\t},\n\t'assets.$.asset_number': {\n\t\ttype: String\n\t},\n\t'assets.$.ownership': {\n\t\ttype: String\n\t},\n\t'assets.$.ownership_driver': {\n\t\ttype: String\n\t},\n\t'assets.$.date_start': {\n\t\ttype: Date\n\t},\n\t'assets.$.date_end': {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tid_function: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomers: {\n\t\ttype: Array,\n\t\toptional: true,\n\t},\n\t'customers.$': {\n\t\ttype: Object\n\t},\n\t'customers.$.id_customer': {\n\t\ttype: String\n\t},\n\t'customers.$.customer': {\n\t\ttype: String\n\t},\n\tid_customer: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomer: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomer_type: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tdepartments: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'departments.$': {\n\t\ttype: Object\n\t},\n\t'departments.$.id_department': {\n\t\ttype: String\n\t},\n\t'departments.$.department': {\n\t\ttype: String\n\t}\n};\n\nconst DefaultSchema = <PassportLocalSchema>new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.plugin(passportLocalMongoose, {\n\tusernameUnique: true,\n\tlimitAttempts: true,\n\tmaxAttempts: 5,\n\tfindByUsername: (mongooseModel, queryParameters) => {\n\t\t// Add additional query parameter - AND condition - active: true\n\t\tqueryParameters.active = true;\n\t\treturn mongooseModel.findOne(queryParameters);\n\t}\n});\n\ninterface ResolveIOModel extends UserModel, PassportLocalDocument {}\nexport const Users: PassportLocalModel<ResolveIOModel> = (<any>ResolveIOServer.getMainDB()).model('users', DefaultSchema);\n\nexport let ClientUsers: PassportLocalModel<ResolveIOModel> = null;\n\nif (ResolveIOServer.getSupportDB()) {\n\tClientUsers = (<any>ResolveIOServer.getSupportDB()).model('client-users', DefaultSchema);\n}\n\nUsers['simplschema'] = new SimpleSchema(schema);\n\nschema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nVersionSchema.index({'_id.__v': 1, '_id._id': 1});\n\nUsers['versionCollection'] = 'users.versions';\n\nexport const UserVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Users['versionCollection'], VersionSchema);\n\n//------------- Report Builder Schema\nlet rbLookups: LookupTables[] = [];\n\nlet rbSchema = Object.assign(schema, buildRbLookups(rbLookups, DefaultSchema, []));\nUsers['rbSchema'] = buildRbSchema(rbSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/user.collection.ts"],"names":[],"mappings":";;AAAA,qCAAwG;AACxG,+DAAiE;AACjE,6CAAwC;AACxC,kCAA2C;AAG3C,uEAA8E;AAE9E,IAAI,MAAM,GAAQ;IACjB,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,IAAI;KACd;IACD,MAAM,EAAE;QACP,IAAI,EAAE,OAAO;KACb;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;Q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EAAG,CAAC,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;AAE1H,aAAK,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAEhD,MAAM,CAAC,GAAG,GAAG;IACZ,IAAI,EAAE,iBAAM,CAAC,KAAK,CAAC,KAAK;CACxB,CAAC;AAEF,IAAI,aAAa,GAAG,IAAI,iBAAM,CAAC,MAAM,EAAE;IACtC,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,aAAa,CAAC,KAAK,CAAC,EAAC,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAC,CAAC,CAAC;AAElD,aAAK,CAAC,mBAAmB,CAAC,GAAG,gBAAgB,CAAC;AAEjC,QAAA,YAAY,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,aAAK,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC;AAEhI,qCAAqC;AACrC,IAAI,SAAS,GAAmB,EAAE,CAAC;AAEnC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sCAAc,CAAC,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC,CAAC;AACnF,aAAK,CAAC,UAAU,CAAC,GAAG,qCAAa,CAAC,QAAQ,CAAC,CAAC","file":"user.collection.js","sourcesContent":["import { Schema, Model, PassportLocalDocument, PassportLocalModel, PassportLocalSchema} from 'mongoose';\nimport * as passportLocalMongoose from 'passport-local-mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\nimport { LookupTables } from '../models/report-builder.model';\nimport { buildRbSchema, buildRbLookups } from '../util/schema-report-builder';\n\nlet schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\treadonly: {\n\t\ttype: Boolean,\n\t\toptional: true\n\t},\n\tactive: {\n\t\ttype: Boolean\n\t},\n\tattempts: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tlast: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tservices: {\n\t\ttype: Object,\n\t\toptional: true\n\t},\n\t'services.enrollment': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.forgot_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'services.reset_password': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tusername: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\temail: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tfullname: {\n\t\ttype: String\n\t},\n\troles: {\n\t\ttype: Array\n\t},\n\t'roles.$': {\n\t\ttype: String\n\t},\n\tphonenumber: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tother: {\n\t\ttype: Object,\n\t\tblackbox: true,\n\t\toptional: true\n\t},\n\tassets: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'assets.$': {\n\t\ttype: Object\n\t},\n\t'assets.$.type': {\n\t\ttype: String\n\t},\n\t'assets.$.id_asset': {\n\t\ttype: String\n\t},\n\t'assets.$.asset_number': {\n\t\ttype: String\n\t},\n\t'assets.$.ownership': {\n\t\ttype: String\n\t},\n\t'assets.$.ownership_driver': {\n\t\ttype: String\n\t},\n\t'assets.$.date_start': {\n\t\ttype: Date\n\t},\n\t'assets.$.date_end': {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tid_function: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomers: {\n\t\ttype: Array,\n\t\toptional: true,\n\t},\n\t'customers.$': {\n\t\ttype: Object\n\t},\n\t'customers.$.id_customer': {\n\t\ttype: String\n\t},\n\t'customers.$.customer': {\n\t\ttype: String\n\t},\n\tid_customer: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomer: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tcustomer_type: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tdepartments: {\n\t\ttype: Array,\n\t\toptional: true\n\t},\n\t'departments.$': {\n\t\ttype: Object\n\t},\n\t'departments.$.id_department': {\n\t\ttype: String\n\t},\n\t'departments.$.department': {\n\t\ttype: String\n\t}\n};\n\nconst DefaultSchema = <PassportLocalSchema>new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.plugin(passportLocalMongoose, {\n\tusernameUnique: true,\n\tlimitAttempts: true,\n\tmaxAttempts: 5,\n\tfindByUsername: (mongooseModel, queryParameters) => {\n\t\t// Add additional query parameter - AND condition - active: true\n\t\tqueryParameters.active = true;\n\t\treturn mongooseModel.findOne(queryParameters);\n\t}\n});\n\ninterface ResolveIOModel extends UserModel, PassportLocalDocument {}\nexport const Users: PassportLocalModel<ResolveIOModel> = (<any>ResolveIOServer.getMainDB()).model('users', DefaultSchema);\n\nUsers['simplschema'] = new SimpleSchema(schema);\n\nschema._id = {\n\ttype: Schema.Types.Mixed\n};\n\nlet VersionSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nVersionSchema.index({'_id.__v': 1, '_id._id': 1});\n\nUsers['versionCollection'] = 'users.versions';\n\nexport const UserVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(Users['versionCollection'], VersionSchema);\n\n//------------- Report Builder Schema\nlet rbLookups: LookupTables[] = [];\n\nlet rbSchema = Object.assign(schema, buildRbLookups(rbLookups, DefaultSchema, []));\nUsers['rbSchema'] = buildRbSchema(rbSchema);"]}
@@ -63,23 +63,6 @@ function loadServerCronJobs() {
63
63
  _a.sent();
64
64
  _a.label = 3;
65
65
  case 3:
66
- if (!!cronJobs.filter(function (a) { return a.name === 'Update Client Users'; }).length) return [3 /*break*/, 5];
67
- return [4 /*yield*/, cron_job_collection_1.CronJobs.create({
68
- _id: mongoose_1.Types.ObjectId().toHexString(),
69
- __v: 0,
70
- name: 'Update Client Users',
71
- "repeat": true,
72
- reoccuring: true,
73
- "time_to_run": "0 */1 * * *",
74
- "method_run": "updateClientUsers",
75
- "method_run_data": null,
76
- "next_run": new Date(),
77
- "running": false
78
- })];
79
- case 4:
80
- _a.sent();
81
- _a.label = 5;
82
- case 5:
83
66
  cronJobs.filter(function (a) { return a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime(); }).forEach(function (cronJob) {
84
67
  cron_job_collection_1.CronJobs.updateOne({ _id: cronJob._id }, { $set: { running: false } }).exec();
85
68
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/fixtures/cron-jobs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAA8D;AAC9D,qCAAiC;AAEjC,SAAsB,kBAAkB;;;;;wBAExB,qBAAM,8BAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,EAAA;;oBAAzC,QAAQ,GAAG,SAA8B;yBAEzC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,cAAc,EAAzB,CAAyB,CAAC,CAAC,MAAM,EAAvD,wBAAuD;oBAC1D,qBAAM,8BAAQ,CAAC,MAAM,CACpB;4BACC,GAAG,EAAE,gBAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE;4BACnC,GAAG,EAAE,CAAC;4BACN,IAAI,EAAE,cAAc;4BACpB,QAAQ,EAAG,IAAI;4BACf,UAAU,EAAE,IAAI;4BAChB,aAAa,EAAG,eAAe;4BAC/B,YAAY,EAAG,aAAa;4BAC5B,iBAAiB,EAAG,IAAI;4BACxB,UAAU,EAAG,IAAI,IAAI,EAAE;4BACvB,SAAS,EAAG,KAAK;yBACjB,CACD,EAAA;;oBAbD,SAaC,CAAC;;;yBAGC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,qBAAqB,EAAhC,CAAgC,CAAC,CAAC,MAAM,EAA9D,wBAA8D;oBACjE,qBAAM,8BAAQ,CAAC,MAAM,CACpB;4BACC,GAAG,EAAE,gBAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE;4BACnC,GAAG,EAAE,CAAC;4BACN,IAAI,EAAE,qBAAqB;4BAC3B,QAAQ,EAAG,IAAI;4BACf,UAAU,EAAE,IAAI;4BAChB,aAAa,EAAG,aAAa;4BAC7B,YAAY,EAAG,mBAAmB;4BAClC,iBAAiB,EAAG,IAAI;4BACxB,UAAU,EAAG,IAAI,IAAI,EAAE;4BACvB,SAAS,EAAG,KAAK;yBACjB,CACD,EAAA;;oBAbD,SAaC,CAAC;;;oBAGH,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAxE,CAAwE,CAAC,CAAC,OAAO,CAAC,UAAA,OAAO;wBAC7G,8BAAQ,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBACzE,CAAC,CAAC,CAAC;;;;;CACH;AAzCD,gDAyCC","file":"cron-jobs.js","sourcesContent":["import { CronJobs } from '../collections/cron-job.collection';\nimport { Types } from 'mongoose';\n\nexport async function loadServerCronJobs() {\n\n\tlet cronJobs = await CronJobs.find({}).exec();\n\n\tif (!cronJobs.filter(a => a.name === 'Method Queue').length) {\n\t\tawait CronJobs.create(\n\t\t\t{\n\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t__v: 0,\n\t\t\t\tname: 'Method Queue',\n\t\t\t\t\"repeat\" : true, \n\t\t\t\treoccuring: true,\n\t\t\t\t\"time_to_run\" : \"*/5 * * * * *\", \n\t\t\t\t\"method_run\" : \"methodQueue\", \n\t\t\t\t\"method_run_data\" : null, \n\t\t\t\t\"next_run\" : new Date(), \n\t\t\t\t\"running\" : false\n\t\t\t}\n\t\t);\n\t}\n\n\tif (!cronJobs.filter(a => a.name === 'Update Client Users').length) {\n\t\tawait CronJobs.create(\n\t\t\t{\n\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t__v: 0,\n\t\t\t\tname: 'Update Client Users',\n\t\t\t\t\"repeat\" : true, \n\t\t\t\treoccuring: true,\n\t\t\t\t\"time_to_run\" : \"0 */1 * * *\", \n\t\t\t\t\"method_run\" : \"updateClientUsers\", \n\t\t\t\t\"method_run_data\" : null, \n\t\t\t\t\"next_run\" : new Date(), \n\t\t\t\t\"running\" : false\n\t\t\t}\n\t\t);\n\t}\n\n\tcronJobs.filter(a => a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime()).forEach(cronJob => {\n\t\tCronJobs.updateOne({_id: cronJob._id}, {$set: {running: false}}).exec();\n\t});\n} "]}
1
+ {"version":3,"sources":["../../src/fixtures/cron-jobs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAA8D;AAC9D,qCAAiC;AAEjC,SAAsB,kBAAkB;;;;;wBAExB,qBAAM,8BAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,EAAA;;oBAAzC,QAAQ,GAAG,SAA8B;yBAEzC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,cAAc,EAAzB,CAAyB,CAAC,CAAC,MAAM,EAAvD,wBAAuD;oBAC1D,qBAAM,8BAAQ,CAAC,MAAM,CACpB;4BACC,GAAG,EAAE,gBAAK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE;4BACnC,GAAG,EAAE,CAAC;4BACN,IAAI,EAAE,cAAc;4BACpB,QAAQ,EAAG,IAAI;4BACf,UAAU,EAAE,IAAI;4BAChB,aAAa,EAAG,eAAe;4BAC/B,YAAY,EAAG,aAAa;4BAC5B,iBAAiB,EAAG,IAAI;4BACxB,UAAU,EAAG,IAAI,IAAI,EAAE;4BACvB,SAAS,EAAG,KAAK;yBACjB,CACD,EAAA;;oBAbD,SAaC,CAAC;;;oBAGH,QAAQ,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,EAAxE,CAAwE,CAAC,CAAC,OAAO,CAAC,UAAA,OAAO;wBAC7G,8BAAQ,CAAC,SAAS,CAAC,EAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAC,EAAE,EAAC,IAAI,EAAE,EAAC,OAAO,EAAE,KAAK,EAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;oBACzE,CAAC,CAAC,CAAC;;;;;CACH;AAxBD,gDAwBC","file":"cron-jobs.js","sourcesContent":["import { CronJobs } from '../collections/cron-job.collection';\nimport { Types } from 'mongoose';\n\nexport async function loadServerCronJobs() {\n\n\tlet cronJobs = await CronJobs.find({}).exec();\n\n\tif (!cronJobs.filter(a => a.name === 'Method Queue').length) {\n\t\tawait CronJobs.create(\n\t\t\t{\n\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t__v: 0,\n\t\t\t\tname: 'Method Queue',\n\t\t\t\t\"repeat\" : true, \n\t\t\t\treoccuring: true,\n\t\t\t\t\"time_to_run\" : \"*/5 * * * * *\", \n\t\t\t\t\"method_run\" : \"methodQueue\", \n\t\t\t\t\"method_run_data\" : null, \n\t\t\t\t\"next_run\" : new Date(), \n\t\t\t\t\"running\" : false\n\t\t\t}\n\t\t);\n\t}\n\n\tcronJobs.filter(a => a.running && a.next_run && a.next_run.getTime() < (new Date()).getTime()).forEach(cronJob => {\n\t\tCronJobs.updateOne({_id: cronJob._id}, {$set: {running: false}}).exec();\n\t});\n} "]}
package/http/auth.js CHANGED
@@ -40,11 +40,12 @@ var user_collection_1 = require("../collections/user.collection");
40
40
  var jwt = require("jsonwebtoken");
41
41
  var handlebars = require("handlebars");
42
42
  var __1 = require("..");
43
+ var simpl_schema_1 = require("simpl-schema");
43
44
  function setupAuthRoutes(mainServer, app, serverConfig) {
44
45
  var _this = this;
45
46
  // Login via HTTP, return refresh token if authenticated
46
47
  app.post('/login', function (request, response) { return __awaiter(_this, void 0, void 0, function () {
47
- var user_1, username, resAuth_1, emailData_1, emailData_2;
48
+ var body, schema, user_1, username, resAuth_1, emailData_1, emailData_2;
48
49
  return __generator(this, function (_a) {
49
50
  switch (_a.label) {
50
51
  case 0:
@@ -54,17 +55,41 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
54
55
  result: 'Invalid header'
55
56
  }));
56
57
  return [3 /*break*/, 6];
57
- case 1: return [4 /*yield*/, user_collection_1.Users.findOne({ username: request.body.username }).exec()];
58
+ case 1:
59
+ body = request.body;
60
+ schema = new simpl_schema_1.default({
61
+ username: {
62
+ type: String
63
+ },
64
+ password: {
65
+ type: String
66
+ }
67
+ });
68
+ try {
69
+ schema.validate(body);
70
+ }
71
+ catch (errors) {
72
+ if (errors) {
73
+ console.error('Error in HTTP Check (/login)', errors);
74
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/login' + '\n\nData Being Checked\n' + JSON.stringify(body, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
75
+ response.send(JSON.stringify({
76
+ error: true,
77
+ result: 'Invalid Parameters'
78
+ }));
79
+ return [2 /*return*/];
80
+ }
81
+ }
82
+ return [4 /*yield*/, user_collection_1.Users.findOne({ username: body.username }).exec()];
58
83
  case 2:
59
84
  user_1 = _a.sent();
60
85
  if (!!user_1) return [3 /*break*/, 4];
61
- return [4 /*yield*/, user_collection_1.Users.findOne({ email: request.body.username }).exec()];
86
+ return [4 /*yield*/, user_collection_1.Users.findOne({ email: body.username }).exec()];
62
87
  case 3:
63
88
  user_1 = _a.sent();
64
89
  _a.label = 4;
65
90
  case 4:
66
- username = user_1 ? user_1.username : request.body.username;
67
- return [4 /*yield*/, user_collection_1.Users.authenticate()(username, request.body.password)];
91
+ username = user_1 ? user_1.username : body.username;
92
+ return [4 /*yield*/, user_collection_1.Users.authenticate()(username, body.password)];
68
93
  case 5:
69
94
  resAuth_1 = _a.sent();
70
95
  if (resAuth_1.error) {
@@ -138,6 +163,7 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
138
163
  }); });
139
164
  app.post('/accessToken', function (request, response) {
140
165
  return __awaiter(this, void 0, void 0, function () {
166
+ var body, schema;
141
167
  return __generator(this, function (_a) {
142
168
  if (request.headers.origin !== serverConfig['ROOT_URL'] && request.headers.origin !== serverConfig['SEC_ROOT_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_URL'] && request.headers.origin !== serverConfig['RESOLVEIO_SECONDARY_URL']) {
143
169
  response.send(JSON.stringify({
@@ -146,8 +172,31 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
146
172
  }));
147
173
  }
148
174
  else {
175
+ body = request.body;
176
+ schema = new simpl_schema_1.default({
177
+ refreshToken: {
178
+ type: String
179
+ },
180
+ appVersion: {
181
+ type: Number
182
+ }
183
+ });
184
+ try {
185
+ schema.validate(body);
186
+ }
187
+ catch (errors) {
188
+ if (errors) {
189
+ console.error('Error in HTTP Check (/accessToken)', errors);
190
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/accessToken' + '\n\nData Being Checked\n' + JSON.stringify(body, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
191
+ response.send(JSON.stringify({
192
+ error: true,
193
+ result: 'Invalid Parameters'
194
+ }));
195
+ return [2 /*return*/];
196
+ }
197
+ }
149
198
  if (serverConfig['ROOT_URL'] !== 'http://localhost:4200') {
150
- jwt.verify(request.body.refreshToken, serverConfig['JWT_SECRET'], function (err, decoded) {
199
+ jwt.verify(body.refreshToken, serverConfig['JWT_SECRET'], function (err, decoded) {
151
200
  if (err) {
152
201
  response.send(JSON.stringify({
153
202
  error: true,
@@ -193,7 +242,7 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
193
242
  });
194
243
  }
195
244
  else {
196
- jwt.verify(request.body.refreshToken, serverConfig['JWT_SECRET'], function (err, decoded) {
245
+ jwt.verify(body.refreshToken, serverConfig['JWT_SECRET'], function (err, decoded) {
197
246
  if (err) {
198
247
  response.send(JSON.stringify({
199
248
  error: true,
@@ -251,7 +300,27 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
251
300
  }));
252
301
  }
253
302
  else {
254
- jwt.verify(request.body.enrollmentToken, serverConfig['JWT_SECRET'], function (err, decoded) {
303
+ var body_1 = request.body;
304
+ var schema = new simpl_schema_1.default({
305
+ enrollmentToken: {
306
+ type: String
307
+ }
308
+ });
309
+ try {
310
+ schema.validate(body_1);
311
+ }
312
+ catch (errors) {
313
+ if (errors) {
314
+ console.error('Error in HTTP Check (/userWithEnrollmentToken)', errors);
315
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/userWithEnrollmentToken' + '\n\nData Being Checked\n' + JSON.stringify(body_1, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
316
+ response.send(JSON.stringify({
317
+ error: true,
318
+ result: 'Invalid Parameters'
319
+ }));
320
+ return;
321
+ }
322
+ }
323
+ jwt.verify(body_1.enrollmentToken, serverConfig['JWT_SECRET'], function (err, decoded) {
255
324
  if (err) {
256
325
  response.send(JSON.stringify({
257
326
  error: true,
@@ -262,7 +331,7 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
262
331
  user_collection_1.Users.findOne({
263
332
  $and: [
264
333
  { _id: decoded['id_user'] },
265
- { 'services.enrollment': request.body.enrollmentToken }
334
+ { 'services.enrollment': body_1.enrollmentToken }
266
335
  ]
267
336
  }).select('_id __v username active').exec().then(function (user) {
268
337
  if (user) {
@@ -306,7 +375,30 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
306
375
  }));
307
376
  }
308
377
  else {
309
- jwt.verify(request.body.enrollmentToken, serverConfig['JWT_SECRET'], function (err, decoded) { return __awaiter(_this, void 0, void 0, function () {
378
+ var body_2 = request.body;
379
+ var schema = new simpl_schema_1.default({
380
+ enrollmentToken: {
381
+ type: String
382
+ },
383
+ password: {
384
+ type: String
385
+ }
386
+ });
387
+ try {
388
+ schema.validate(body_2);
389
+ }
390
+ catch (errors) {
391
+ if (errors) {
392
+ console.error('Error in HTTP Check (/setUserWithEnrollmentToken)', errors);
393
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/setUserWithEnrollmentToken' + '\n\nData Being Checked\n' + JSON.stringify(body_2, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
394
+ response.send(JSON.stringify({
395
+ error: true,
396
+ result: 'Invalid Parameters'
397
+ }));
398
+ return;
399
+ }
400
+ }
401
+ jwt.verify(body_2.enrollmentToken, serverConfig['JWT_SECRET'], function (err, decoded) { return __awaiter(_this, void 0, void 0, function () {
310
402
  return __generator(this, function (_a) {
311
403
  if (err) {
312
404
  response.send(JSON.stringify({
@@ -318,12 +410,12 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
318
410
  user_collection_1.Users.findOne({
319
411
  $and: [
320
412
  { _id: decoded['id_user'] },
321
- { 'services.enrollment': request.body.enrollmentToken }
413
+ { 'services.enrollment': body_2.enrollmentToken }
322
414
  ]
323
415
  }).exec().then(function (user) {
324
416
  if (user) {
325
417
  if (user.active) {
326
- user.setPassword(request.body.password, function (errSet, resSet) {
418
+ user.setPassword(body_2.password, function (errSet, resSet) {
327
419
  if (resSet) {
328
420
  user.services.enrollment = '';
329
421
  user.resetAttempts();
@@ -373,7 +465,27 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
373
465
  }));
374
466
  }
375
467
  else {
376
- jwt.verify(request.body.forgotPasswordToken, serverConfig['JWT_SECRET'], function (err, decoded) {
468
+ var body_3 = request.body;
469
+ var schema = new simpl_schema_1.default({
470
+ forgotPasswordToken: {
471
+ type: String
472
+ }
473
+ });
474
+ try {
475
+ schema.validate(body_3);
476
+ }
477
+ catch (errors) {
478
+ if (errors) {
479
+ console.error('Error in HTTP Check (/userWithForgotPasswordToken)', errors);
480
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/userWithForgotPasswordToken' + '\n\nData Being Checked\n' + JSON.stringify(body_3, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
481
+ response.send(JSON.stringify({
482
+ error: true,
483
+ result: 'Invalid Parameters'
484
+ }));
485
+ return;
486
+ }
487
+ }
488
+ jwt.verify(body_3.forgotPasswordToken, serverConfig['JWT_SECRET'], function (err, decoded) {
377
489
  if (err) {
378
490
  response.send(JSON.stringify({
379
491
  error: true,
@@ -384,7 +496,7 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
384
496
  user_collection_1.Users.findOne({
385
497
  $and: [
386
498
  { _id: decoded['id_user'] },
387
- { 'services.forgot_password': request.body.forgotPasswordToken }
499
+ { 'services.forgot_password': body_3.forgotPasswordToken }
388
500
  ]
389
501
  }).select('_id __v username active').exec().then(function (user) {
390
502
  if (user) {
@@ -428,7 +540,30 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
428
540
  }));
429
541
  }
430
542
  else {
431
- jwt.verify(request.body.forgotPasswordToken, serverConfig['JWT_SECRET'], function (err, decoded) { return __awaiter(_this, void 0, void 0, function () {
543
+ var body_4 = request.body;
544
+ var schema = new simpl_schema_1.default({
545
+ forgotPasswordToken: {
546
+ type: String
547
+ },
548
+ password: {
549
+ type: String
550
+ }
551
+ });
552
+ try {
553
+ schema.validate(body_4);
554
+ }
555
+ catch (errors) {
556
+ if (errors) {
557
+ console.error('Error in HTTP Check (/setUserWithForgotPasswordToken)', errors);
558
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/setUserWithForgotPasswordToken' + '\n\nData Being Checked\n' + JSON.stringify(body_4, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
559
+ response.send(JSON.stringify({
560
+ error: true,
561
+ result: 'Invalid Parameters'
562
+ }));
563
+ return;
564
+ }
565
+ }
566
+ jwt.verify(body_4.forgotPasswordToken, serverConfig['JWT_SECRET'], function (err, decoded) { return __awaiter(_this, void 0, void 0, function () {
432
567
  return __generator(this, function (_a) {
433
568
  if (err) {
434
569
  response.send(JSON.stringify({
@@ -440,12 +575,12 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
440
575
  user_collection_1.Users.findOne({
441
576
  $and: [
442
577
  { _id: decoded['id_user'] },
443
- { 'services.forgot_password': request.body.forgotPasswordToken }
578
+ { 'services.forgot_password': body_4.forgotPasswordToken }
444
579
  ]
445
580
  }).exec().then(function (user) {
446
581
  if (user) {
447
582
  if (user.active) {
448
- user.setPassword(request.body.password, function (errSet, resSet) {
583
+ user.setPassword(body_4.password, function (errSet, resSet) {
449
584
  if (resSet) {
450
585
  user.services.forgot_password = '';
451
586
  user.resetAttempts();
@@ -488,7 +623,7 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
488
623
  }
489
624
  });
490
625
  app.post('/resetPassword', function (request, response) { return __awaiter(_this, void 0, void 0, function () {
491
- var user;
626
+ var body, schema, user;
492
627
  return __generator(this, function (_a) {
493
628
  switch (_a.label) {
494
629
  case 0:
@@ -498,11 +633,32 @@ function setupAuthRoutes(mainServer, app, serverConfig) {
498
633
  result: 'Invalid header'
499
634
  }));
500
635
  return [3 /*break*/, 5];
501
- case 1: return [4 /*yield*/, user_collection_1.Users.findOne({ username: request.body.username }).exec()];
636
+ case 1:
637
+ body = request.body;
638
+ schema = new simpl_schema_1.default({
639
+ username: {
640
+ type: String
641
+ }
642
+ });
643
+ try {
644
+ schema.validate(body);
645
+ }
646
+ catch (errors) {
647
+ if (errors) {
648
+ console.error('Error in HTTP Check (/resetPassword)', errors);
649
+ __1.ResolveIOServer.getMainServer().getMethodManager().sendEmail('dev@resolveio.com', __1.ResolveIOServer.getClientName() + 'HTTP - Error Detected', 'Match Error On HTTP ' + '/resetPassword' + '\n\nData Being Checked\n' + JSON.stringify(body, null, 2) + '\n\nErrors\n' + JSON.stringify(errors, null, 2));
650
+ response.send(JSON.stringify({
651
+ error: true,
652
+ result: 'Invalid Parameters'
653
+ }));
654
+ return [2 /*return*/];
655
+ }
656
+ }
657
+ return [4 /*yield*/, user_collection_1.Users.findOne({ username: body.username }).exec()];
502
658
  case 2:
503
659
  user = _a.sent();
504
660
  if (!!user) return [3 /*break*/, 4];
505
- return [4 /*yield*/, user_collection_1.Users.findOne({ email: request.body.username }).exec()];
661
+ return [4 /*yield*/, user_collection_1.Users.findOne({ email: body.username }).exec()];
506
662
  case 3:
507
663
  user = _a.sent();
508
664
  _a.label = 4;