@resolveio/server-lib 7.1.4 → 7.1.5-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.
@@ -20,6 +20,9 @@ var schema = {
20
20
  type: Date,
21
21
  optional: true
22
22
  },
23
+ instance: {
24
+ type: String
25
+ },
23
26
  client: {
24
27
  type: String
25
28
  },
@@ -38,6 +41,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
38
41
  versionKey: false,
39
42
  timestamps: true
40
43
  });
44
+ DefaultSchema.index({ client: 1, instance: 1, date: 1 });
41
45
  DefaultSchema.index({ client: 1, date: 1 });
42
46
  DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
43
47
  exports.MonitorCPUs = index_1.ResolveIOServer.getMainDB().model('monitor-cpus', DefaultSchema);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/monitor-cpu.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,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;KACV;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;KACZ;IACD,MAAM,EAAE;QACP,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;AAEH,aAAa,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;AAC1C,aAAa,CAAC,KAAK,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,EAAE,EAAC,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAC,CAAC,CAAC;AAG3D,QAAA,WAAW,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;AAEnH,mBAAW,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAEtD,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,mBAAW,CAAC,mBAAmB,CAAC,GAAG,uBAAuB,CAAC;AAE9C,QAAA,kBAAkB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,mBAAW,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-cpu.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorCPUModel } from '../models/monitor-cpu.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\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tapp: {\n\t\ttype: Number\n\t},\n\tsystem: {\n\t\ttype: Number\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, date: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorCPUModel, Document {}\nexport const MonitorCPUs: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-cpus', DefaultSchema);\n\nMonitorCPUs['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\nMonitorCPUs['versionCollection'] = 'monitor-cpus.versions';\n\nexport const MonitorCPUVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorCPUs['versionCollection'], VersionSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/monitor-cpu.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,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;KACZ;IACD,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;KACV;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,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pleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorCPUModel } from '../models/monitor-cpu.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\tinstance: {\n\t\ttype: String\n\t},\n\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tapp: {\n\t\ttype: Number\n\t},\n\tsystem: {\n\t\ttype: Number\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, instance: 1, date: 1});\nDefaultSchema.index({client: 1, date: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorCPUModel, Document {}\nexport const MonitorCPUs: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-cpus', DefaultSchema);\n\nMonitorCPUs['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\nMonitorCPUs['versionCollection'] = 'monitor-cpus.versions';\n\nexport const MonitorCPUVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorCPUs['versionCollection'], VersionSchema);"]}
@@ -20,6 +20,9 @@ var schema = {
20
20
  type: Date,
21
21
  optional: true
22
22
  },
23
+ instance: {
24
+ type: String
25
+ },
23
26
  client: {
24
27
  type: String
25
28
  },
@@ -47,6 +50,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
47
50
  versionKey: false,
48
51
  timestamps: true
49
52
  });
53
+ DefaultSchema.index({ client: 1, instance: 1, date: 1, method: 1, url: 1 });
50
54
  DefaultSchema.index({ client: 1, date: 1, duration: 1 });
51
55
  DefaultSchema.index({ client: 1, date: 1, method: 1, url: 1 });
52
56
  DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/monitor-https-inbound.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,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;KACV;IACD,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,GAAG,EAAE;QACJ,IAAI,EAAE,MAAM;KACZ;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;KACZ;IACD,WAAW,EAAE;QACZ,IAAI,EAAE,MAAM;KACZ;IACD,aAAa,EAAE;QACd,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;AAEH,aAAa,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAC,CAAC,CAAC;AACvD,aAAa,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC,CAAC;AAC7D,aAAa,CAAC,KAAK,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,EAAE,EAAC,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAC,CAAC,CAAC;AAG3D,QAAA,oBAAoB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;AAEtI,4BAAoB,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAE/D,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,4BAAoB,CAAC,mBAAmB,CAAC,GAAG,iCAAiC,CAAC;AAEjE,QAAA,0BAA0B,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,4BAAoB,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-https-inbound.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorHTTPSInboundModel } from '../models/monitor-https-inbound.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\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\turl: {\n\t\ttype: String\n\t},\n\tduration: {\n\t\ttype: Number\n\t},\n\tcontentType: {\n\t\ttype: String\n\t},\n\trequestHeader: {\n\t\ttype: String\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, date: 1, duration: 1});\nDefaultSchema.index({client: 1, date: 1, method: 1, url: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorHTTPSInboundModel, Document {}\nexport const MonitorHTTPSInbounds: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-https-inbounds', DefaultSchema);\n\nMonitorHTTPSInbounds['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\nMonitorHTTPSInbounds['versionCollection'] = 'monitor-https-inbounds.versions';\n\nexport const MonitorHTTPInboundVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorHTTPSInbounds['versionCollection'], VersionSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/monitor-https-inbound.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,QAAQ,EAAE;QACT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,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAE/D,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,4BAAoB,CAAC,mBAAmB,CAAC,GAAG,iCAAiC,CAAC;AAEjE,QAAA,0BAA0B,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,4BAAoB,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-https-inbound.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorHTTPSInboundModel } from '../models/monitor-https-inbound.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\tinstance: {\n\t\ttype: String\n\t},\n\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\turl: {\n\t\ttype: String\n\t},\n\tduration: {\n\t\ttype: Number\n\t},\n\tcontentType: {\n\t\ttype: String\n\t},\n\trequestHeader: {\n\t\ttype: String\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, instance: 1, date: 1, method: 1, url: 1});\nDefaultSchema.index({client: 1, date: 1, duration: 1});\nDefaultSchema.index({client: 1, date: 1, method: 1, url: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorHTTPSInboundModel, Document {}\nexport const MonitorHTTPSInbounds: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-https-inbounds', DefaultSchema);\n\nMonitorHTTPSInbounds['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\nMonitorHTTPSInbounds['versionCollection'] = 'monitor-https-inbounds.versions';\n\nexport const MonitorHTTPInboundVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorHTTPSInbounds['versionCollection'], VersionSchema);"]}
@@ -20,6 +20,9 @@ var schema = {
20
20
  type: Date,
21
21
  optional: true
22
22
  },
23
+ instance: {
24
+ type: String
25
+ },
23
26
  client: {
24
27
  type: String
25
28
  },
@@ -51,6 +54,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
51
54
  versionKey: false,
52
55
  timestamps: true
53
56
  });
57
+ DefaultSchema.index({ client: 1, instance: 1, date: 1, method: 1, url: 1, status: 1 });
54
58
  DefaultSchema.index({ client: 1, date: 1, duration: 1 });
55
59
  DefaultSchema.index({ client: 1, date: 1, method: 1, url: 1, status: 1 });
56
60
  DefaultSchema.index({ client: 1, date: 1, status: 1 });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/monitor-https-outbound.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;IAC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,EAAE,GAAG,EAAE,EAAC,CAAC,CAAC;AAG3D,QAAA,qBAAqB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAExI,6BAAqB,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAEhE,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,6BAAqB,CAAC,mBAAmB,CAAC,GAAG,kCAAkC,CAAC;AAEnE,QAAA,4BAA4B,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,6BAAqB,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-https-outbound.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorHTTPSOutboundModel } from '../models/monitor-https-outbound.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\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\turl: {\n\t\ttype: String\n\t},\n\tduration: {\n\t\ttype: Number\n\t},\n\tstatus: {\n\t\ttype: String\n\t},\n\tcontentType: {\n\t\ttype: String\n\t},\n\trequestHeaders: {\n\t\ttype: Object,\n\t\tblackbox: true\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, date: 1, duration: 1});\nDefaultSchema.index({client: 1, date: 1, method: 1, url: 1, status: 1});\nDefaultSchema.index({client: 1, date: 1, status: 1});\nDefaultSchema.index({client: 1, status: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorHTTPSOutboundModel, Document {}\nexport const MonitorHTTPSOutbounds: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-https-outbounds', DefaultSchema);\n\nMonitorHTTPSOutbounds['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\nMonitorHTTPSOutbounds['versionCollection'] = 'monitor-https-outbounds.versions';\n\nexport const MonitorHTTPSOutboundVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorHTTPSOutbounds['versionCollection'], VersionSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/monitor-https-outbound.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,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;KACZ;IACD,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,IAAI,EAAE;QACL,IAA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,EAAC,EAAE,EAAC,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAC,CAAC,CAAC;AAG3D,QAAA,qBAAqB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,yBAAyB,EAAE,aAAa,CAAC,CAAC;AAExI,6BAAqB,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAEhE,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,6BAAqB,CAAC,mBAAmB,CAAC,GAAG,kCAAkC,CAAC;AAEnE,QAAA,4BAA4B,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,6BAAqB,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-https-outbound.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorHTTPSOutboundModel } from '../models/monitor-https-outbound.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\tinstance: {\n\t\ttype: String\n\t},\n\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\turl: {\n\t\ttype: String\n\t},\n\tduration: {\n\t\ttype: Number\n\t},\n\tstatus: {\n\t\ttype: String\n\t},\n\tcontentType: {\n\t\ttype: String\n\t},\n\trequestHeaders: {\n\t\ttype: Object,\n\t\tblackbox: true\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, instance: 1, date: 1, method: 1, url: 1, status: 1});\nDefaultSchema.index({client: 1, date: 1, duration: 1});\nDefaultSchema.index({client: 1, date: 1, method: 1, url: 1, status: 1});\nDefaultSchema.index({client: 1, date: 1, status: 1});\nDefaultSchema.index({client: 1, status: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorHTTPSOutboundModel, Document {}\nexport const MonitorHTTPSOutbounds: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-https-outbounds', DefaultSchema);\n\nMonitorHTTPSOutbounds['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\nMonitorHTTPSOutbounds['versionCollection'] = 'monitor-https-outbounds.versions';\n\nexport const MonitorHTTPSOutboundVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorHTTPSOutbounds['versionCollection'], VersionSchema);"]}
@@ -20,6 +20,9 @@ var schema = {
20
20
  type: Date,
21
21
  optional: true
22
22
  },
23
+ instance: {
24
+ type: String
25
+ },
23
26
  client: {
24
27
  type: String
25
28
  },
@@ -50,10 +53,8 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
50
53
  versionKey: false,
51
54
  timestamps: true
52
55
  });
53
- DefaultSchema.index({ client: 1, date: 1, duration: 1 });
54
- DefaultSchema.index({ client: 1, date: 1, method: 1, url: 1 });
55
- DefaultSchema.index({ client: 1, date: 1, status: 1 });
56
- DefaultSchema.index({ client: 1, status: 1 });
56
+ DefaultSchema.index({ client: 1, instance: 1, date: 1 });
57
+ DefaultSchema.index({ client: 1, date: 1 });
57
58
  DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
58
59
  exports.MonitorMemorys = index_1.ResolveIOServer.getMainDB().model('monitor-memorys', DefaultSchema);
59
60
  exports.MonitorMemorys['simplschema'] = new simpl_schema_1.default(schema);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/monitor-memory.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,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;KACV;IACD,cAAc,EAAE;QACf,IAAI,EAAE,MAAM;KACZ;IACD,aAAa,EAAE;QACd,IAAI,EAAE,MAAM;KACZ;IACD,aAAa,EAAE;QACd,IAAI,EAAE,MAAM;KACZ;IACD,OAAO,EAAE;QACR,IAAI,EAAE,MAAM;KACZ;IACD,OAAO,EAAE;QACR,IAAI,EAAE,MAAM;KACZ;IACD,QAAQ,EAAE;QACT,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;AAEH,aAAa,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAA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{ ResolveIOServer } from '../index';\nimport { MonitorMemoryModel } from '../models/monitor-memory.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\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tphysical_total: {\n\t\ttype: Number\n\t},\n\tphysical_used: {\n\t\ttype: Number\n\t},\n\tphysical_free: {\n\t\ttype: Number\n\t},\n\tvirtual: {\n\t\ttype: Number\n\t},\n\tprivate: {\n\t\ttype: Number\n\t},\n\tphysical: {\n\t\ttype: Number\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, date: 1, duration: 1});\nDefaultSchema.index({client: 1, date: 1, method: 1, url: 1});\nDefaultSchema.index({client: 1, date: 1, status: 1});\nDefaultSchema.index({client: 1, status: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorMemoryModel, Document {}\nexport const MonitorMemorys: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-memorys', DefaultSchema);\n\nMonitorMemorys['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\nMonitorMemorys['versionCollection'] = 'monitor-memorys.versions';\n\nexport const MonitorMemoryVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorMemorys['versionCollection'], VersionSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/monitor-memory.collection.ts"],"names":[],"mappings":";;AAAA,qCAAmD;AACnD,6CAAwC;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EAAE,EAAC,CAAC,CAAC;AAG3D,QAAA,cAAc,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;AAEzH,sBAAc,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAEzD,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,sBAAc,CAAC,mBAAmB,CAAC,GAAG,0BAA0B,CAAC;AAEpD,QAAA,qBAAqB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,sBAAc,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-memory.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorMemoryModel } from '../models/monitor-memory.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\tinstance: {\n\t\ttype: String\n\t},\n\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tphysical_total: {\n\t\ttype: Number\n\t},\n\tphysical_used: {\n\t\ttype: Number\n\t},\n\tphysical_free: {\n\t\ttype: Number\n\t},\n\tvirtual: {\n\t\ttype: Number\n\t},\n\tprivate: {\n\t\ttype: Number\n\t},\n\tphysical: {\n\t\ttype: Number\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({client: 1, instance: 1, date: 1});\nDefaultSchema.index({client: 1, date: 1});\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\n\ninterface ResolveIOModel extends MonitorMemoryModel, Document {}\nexport const MonitorMemorys: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-memorys', DefaultSchema);\n\nMonitorMemorys['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\nMonitorMemorys['versionCollection'] = 'monitor-memorys.versions';\n\nexport const MonitorMemoryVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorMemorys['versionCollection'], VersionSchema);"]}
@@ -20,6 +20,9 @@ var schema = {
20
20
  type: Date,
21
21
  optional: true
22
22
  },
23
+ instance: {
24
+ type: String
25
+ },
23
26
  client: {
24
27
  type: String
25
28
  },
@@ -47,6 +50,7 @@ var DefaultSchema = new mongoose_1.Schema(schema, {
47
50
  });
48
51
  DefaultSchema.index({ date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 30 });
49
52
  DefaultSchema.index({ client: 1, date: 1, method: 1 });
53
+ DefaultSchema.index({ client: 1, instance: 1, date: 1, method: 1 });
50
54
  exports.MonitorMongos = index_1.ResolveIOServer.getMainDB().model('monitor-mongos', DefaultSchema);
51
55
  exports.MonitorMongos['simplschema'] = new simpl_schema_1.default(schema);
52
56
  schema._id = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collections/monitor-mongo.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;K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,iBAAM,CAAC,MAAM,EAAE;IACtC,cAAc,EAAE,IAAI;IACpB,UAAU,EAAE,KAAK;IACjB,UAAU,EAAE,IAAI;CAChB,CAAC,CAAC;AAEH,qBAAa,CAAC,mBAAmB,CAAC,GAAG,yBAAyB,CAAC;AAElD,QAAA,oBAAoB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,qBAAa,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-mongo.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorMongoModel } from '../models/monitor-mongo.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\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\tdoc_collection: {\n\t\ttype: String\n\t},\n\tduration: {\n\t\ttype: Number\n\t},\n\tquery: {\n\t\ttype: Object,\n\t\tblackbox: true\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\nDefaultSchema.index({client: 1, date: 1, method: 1});\n\ninterface ResolveIOModel extends MonitorMongoModel, Document {}\nexport const MonitorMongos: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-mongos', DefaultSchema);\n\nMonitorMongos['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\nMonitorMongos['versionCollection'] = 'monitor-mongos.versions';\n\nexport const MonitorMongoVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorMongos['versionCollection'], VersionSchema);"]}
1
+ {"version":3,"sources":["../../src/collections/monitor-mongo.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,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;KACZ;IACD,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;KACV;IACD,MAAM,EAAE;QACP,IAAI,EAAE,MAAM;KACZ;IACD,cAAc,EAAE;QACf,IAAI,EAAE,MAAM;KACZ;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;KACZ;IACD,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;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;AAEH,aAAa,CAAC,KAAK,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,EAAE,EAAC,kBAAkB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAC,CAAC,CAAC;AACxE,aAAa,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC,CAAC;AACrD,aAAa,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC,CAAC;AAGrD,QAAA,aAAa,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAEvH,qBAAa,CAAC,aAAa,CAAC,GAAG,IAAI,sBAAY,CAAC,MAAM,CAAC,CAAC;AAExD,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,qBAAa,CAAC,mBAAmB,CAAC,GAAG,yBAAyB,CAAC;AAElD,QAAA,oBAAoB,GAA0B,uBAAe,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,qBAAa,CAAC,mBAAmB,CAAC,EAAE,aAAa,CAAC,CAAC","file":"monitor-mongo.collection.js","sourcesContent":["import { Schema, Model, Document } from 'mongoose';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '../index';\nimport { MonitorMongoModel } from '../models/monitor-mongo.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\tinstance: {\n\t\ttype: String\n\t},\n\tclient: {\n\t\ttype: String\n\t},\n\tdate: {\n\t\ttype: Date\n\t},\n\tmethod: {\n\t\ttype: String\n\t},\n\tdoc_collection: {\n\t\ttype: String\n\t},\n\tduration: {\n\t\ttype: Number\n\t},\n\tquery: {\n\t\ttype: Object,\n\t\tblackbox: true\n\t}\n};\n\nconst DefaultSchema = new Schema(schema, {\n\tskipVersioning: true,\n\tversionKey: false,\n\ttimestamps: true\n});\n\nDefaultSchema.index({date: 1}, {expireAfterSeconds: 60 * 60 * 24 * 30});\nDefaultSchema.index({client: 1, date: 1, method: 1});\nDefaultSchema.index({client: 1, instance: 1, date: 1, method: 1});\n\ninterface ResolveIOModel extends MonitorMongoModel, Document {}\nexport const MonitorMongos: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model('monitor-mongos', DefaultSchema);\n\nMonitorMongos['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\nMonitorMongos['versionCollection'] = 'monitor-mongos.versions';\n\nexport const MonitorMongoVersions: Model<ResolveIOModel> = ResolveIOServer.getMainDB().model(MonitorMongos['versionCollection'], VersionSchema);"]}
@@ -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,
@@ -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,QAAQ,EAAE,IAAI;KACd;IACD,SAAS,EAAE;QACV,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI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ocalModel, 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);"]}
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,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,IAAI,EAAE;QACL,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,qBAAqB,EAAE;QACtB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,0BAA0B,EAAE;QAC3B,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,yBAAyB,EAAE;QAC1B,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,KAAK,EAAE;QACN,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;K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C,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\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: Object\n\t},\n\t'roles.super_admin': {\n\t\ttype: Boolean\n\t},\n\t'roles.approvals': {\n\t\ttype: Array\n\t},\n\t'roles.approvals.$': {\n\t\ttype: Object\n\t},\n\t'roles.approvals.$.name': {\n\t\ttype: String\n\t},\n\t'roles.approvals.$.type': {\n\t\ttype: String\n\t},\n\t'roles.approvals.$.accounting_code': {\n\t\ttype: String\n\t},\n\t'roles.groups': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$': {\n\t\ttype: Object\n\t},\n\t'roles.groups.$.name': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.views': {\n\t\ttype: Array\n\t},\n\t'roles.groups.$.views.$': {\n\t\ttype: String\n\t},\n\t'roles.groups.$.yard': {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t'roles.notifications': {\n\t\ttype: Array\n\t},\n\t'roles.notifications.$': {\n\t\ttype: String\n\t},\n\t'roles.miscs': {\n\t\ttype: Array\n\t},\n\t'roles.miscs.$': {\n\t\ttype: String\n\t},\n\tactive: Boolean,\n\tphonenumber: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tother: {\n\t\ttype: Object,\n\t\toptional: true,\n\t\tblackbox: 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);"]}
@@ -2,6 +2,7 @@ export declare class MonitorManager {
2
2
  private _mainServer;
3
3
  private _monitorAgent;
4
4
  private _serverConfig;
5
+ private _instanceHostname;
5
6
  constructor(mainServer: any, monitorAgent: any, serverConfig: any);
6
7
  setupEvents(): void;
7
8
  }
@@ -57,6 +57,9 @@ var MonitorManager = /** @class */ (function () {
57
57
  env = _this._monitorAgent.getEnvironment();
58
58
  for (var entry in env) {
59
59
  console.log(entry + ':' + env[entry]);
60
+ if (entry === 'environment.HOSTNAME') {
61
+ _this._instanceHostname = env[entry].replace('ip-', '').replace(/-/g, '.');
62
+ }
60
63
  }
61
64
  ;
62
65
  });
@@ -69,6 +72,7 @@ var MonitorManager = /** @class */ (function () {
69
72
  monitor_cpu_collection_1.MonitorCPUs.create({
70
73
  _id: mongoose_1.Types.ObjectId().toHexString(),
71
74
  __v: 0,
75
+ instance: this._instanceHostname,
72
76
  client: this._serverConfig['CLIENT_NAME'],
73
77
  date: new Date(data.time),
74
78
  app: data.process,
@@ -76,6 +80,7 @@ var MonitorManager = /** @class */ (function () {
76
80
  });
77
81
  return [3 /*break*/, 3];
78
82
  case 1: return [4 /*yield*/, post('/api/monitor/cpu', {
83
+ instance: this._instanceHostname,
79
84
  client: this._serverConfig['CLIENT_NAME'],
80
85
  date: new Date(data.time),
81
86
  app: data.process,
@@ -97,6 +102,7 @@ var MonitorManager = /** @class */ (function () {
97
102
  monitor_memory_collection_1.MonitorMemorys.create({
98
103
  _id: mongoose_1.Types.ObjectId().toHexString(),
99
104
  __v: 0,
105
+ instance: this._instanceHostname,
100
106
  client: this._serverConfig['CLIENT_NAME'],
101
107
  date: new Date(data.time),
102
108
  physical_total: data.physical_total,
@@ -108,6 +114,7 @@ var MonitorManager = /** @class */ (function () {
108
114
  });
109
115
  return [3 /*break*/, 3];
110
116
  case 1: return [4 /*yield*/, post('/api/monitor/memory', {
117
+ instance: this._instanceHostname,
111
118
  client: this._serverConfig['CLIENT_NAME'],
112
119
  date: new Date(data.time),
113
120
  physical_total: data.physical_total,
@@ -133,6 +140,7 @@ var MonitorManager = /** @class */ (function () {
133
140
  monitor_https_inbound_collection_1.MonitorHTTPSInbounds.create({
134
141
  _id: mongoose_1.Types.ObjectId().toHexString(),
135
142
  __v: 0,
143
+ instance: this._instanceHostname,
136
144
  client: this._serverConfig['CLIENT_NAME'],
137
145
  date: new Date(data.time),
138
146
  method: data.method,
@@ -143,6 +151,7 @@ var MonitorManager = /** @class */ (function () {
143
151
  });
144
152
  return [3 /*break*/, 3];
145
153
  case 1: return [4 /*yield*/, post('/api/monitor/https-inbound', {
154
+ instance: this._instanceHostname,
146
155
  client: this._serverConfig['CLIENT_NAME'],
147
156
  date: new Date(data.time),
148
157
  method: data.method,
@@ -167,6 +176,7 @@ var MonitorManager = /** @class */ (function () {
167
176
  monitor_https_outbound_collection_1.MonitorHTTPSOutbounds.create({
168
177
  _id: mongoose_1.Types.ObjectId().toHexString(),
169
178
  __v: 0,
179
+ instance: this._instanceHostname,
170
180
  client: this._serverConfig['CLIENT_NAME'],
171
181
  date: new Date(data.time),
172
182
  method: data.method,
@@ -178,6 +188,7 @@ var MonitorManager = /** @class */ (function () {
178
188
  });
179
189
  return [3 /*break*/, 3];
180
190
  case 1: return [4 /*yield*/, post('/api/monitor/https-outbound', {
191
+ instance: this._instanceHostname,
181
192
  client: this._serverConfig['CLIENT_NAME'],
182
193
  date: new Date(data.time),
183
194
  method: data.method,
@@ -204,6 +215,7 @@ var MonitorManager = /** @class */ (function () {
204
215
  monitor_mongo_collection_1.MonitorMongos.create({
205
216
  _id: mongoose_1.Types.ObjectId().toHexString(),
206
217
  __v: 0,
218
+ instance: this._instanceHostname,
207
219
  client: this._serverConfig['CLIENT_NAME'],
208
220
  date: new Date(data.time),
209
221
  method: data.method,
@@ -214,6 +226,7 @@ var MonitorManager = /** @class */ (function () {
214
226
  }
215
227
  return [3 /*break*/, 3];
216
228
  case 1: return [4 /*yield*/, post('/api/monitor/mongo', {
229
+ instance: this._instanceHostname,
217
230
  client: this._serverConfig['CLIENT_NAME'],
218
231
  date: new Date(data.time),
219
232
  method: data.method,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/managers/monitor.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6B;AAC7B,qCAAiC;AACjC,gFAAoE;AACpE,sFAA0E;AAC1E,oGAAuF;AACvF,sGAAyF;AACzF,oFAA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AK,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE;gCACnC,GAAG,EAAE,CAAC;gCACN,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;gCACzC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gCACzB,MAAM,EAAE,IAAI,CAAC,MAAM;gCACnB,cAAc,EAAE,IAAI,CAAC,UAAU;gCAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gCACvB,KAAK,EAAE,IAAI,CAAC,KAAK;6BACjB,CAAC,CAAC;yBACH;;4BAGgB,qBAAM,IAAI,CAAC,oBAAoB,EAAE;4BACjD,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;4BACzC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;4BACzB,MAAM,EAAE,IAAI,CAAC,MAAM;4BACnB,cAAc,EAAE,IAAI,CAAC,UAAU;4BAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,KAAK,EAAE,IAAI,CAAC,KAAK;yBACjB,CAAC,EAAA;;wBAPI,QAAQ,GAAG,SAOf;;;;;aAEH,CAAC,CAAC;QAEH,oDAAoD;QACpD,qEAAqE;QAErE,KAAK;QACL,UAAU;QACV,yDAAyD;QACzD,gDAAgD;QAChD,gCAAgC;QAEhC,QAAQ;QACR,KAAK;QACL,MAAM;IACP,CAAC;IACF,qBAAC;AAAD,CAzKA,AAyKC,IAAA;AAzKY,wCAAc","file":"monitor.manager.js","sourcesContent":["import ResolveIOMainServer from '../server-app';\nimport * as bent from 'bent';\nimport { Types } from 'mongoose';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { MonitorHTTPSInbounds } from '../collections/monitor-https-inbound.collection';\nimport { MonitorHTTPSOutbounds } from '../collections/monitor-https-outbound.collection';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\n\nexport class MonitorManager {\n\tprivate _mainServer: ResolveIOMainServer;\n\tprivate _monitorAgent;\n\tprivate _serverConfig;\n\n\tconstructor(mainServer, monitorAgent, serverConfig) {\n\t\tthis._mainServer = mainServer;\n\t\tthis._monitorAgent = monitorAgent;\n\t\tthis._serverConfig = serverConfig;\n\n\t\tthis.setupEvents();\n\t}\n\n\tsetupEvents() {\n\t\tconst post = bent('https://backend.resolveio.com', 'POST', 'json', 200);\n\t\t\n\t\tthis._monitorAgent.on('initialized', (env) => {\n\t\t\tenv = this._monitorAgent.getEnvironment();\n\t\t\tfor (let entry in env) {\n\t\t\t\tconsole.log(entry + ':' + env[entry]);\n\t\t\t};\n\t\t});\n\t\t\n\t\tthis._monitorAgent.on('cpu', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorCPUs.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tapp: data.process,\n\t\t\t\t\tsystem: data.system\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/cpu', {\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tapp: data.process,\n\t\t\t\t\tsystem: data.system\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('memory', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorMemorys.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\tprivate: data.private,\n\t\t\t\t\tphysical: data.physical\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/memory', {\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\tprivate: data.private,\n\t\t\t\t\tphysical: data.physical\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('https', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorHTTPSInbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeader: data.requestHeader\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/https-inbound', {\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeader: data.requestHeader\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('https-outbound', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorHTTPSOutbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tstatus: data.status,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeaders: data.requestHeaders\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/https-outbound', {\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tstatus: data.status,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeaders: data.requestHeaders\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('mongo', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tif (data.collection !== 'monitor-mongos') {\n\t\t\t\t\tMonitorMongos.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tquery: data.query\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/mongo', {\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tquery: data.query\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// this._monitorAgent.on('socket', async (data) => {\n\t\t// \tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\n\t\t// \t}\n\t\t// \telse {\n\t\t// \t\tconst response = await post('/api/monitor/socket', {\n\t\t// \t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t// \t\t\tdate: new Date(data.time),\n\t\t\t\t\t\n\t\t// \t\t});\n\t\t// \t}\n\t\t// });\n\t}\n}"]}
1
+ {"version":3,"sources":["../../src/managers/monitor.manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2BAA6B;AAC7B,qCAAiC;AACjC,gFAAoE;AACpE,sFAA0E;AAC1E,oGAAuF;AACvF,sGAAyF;AACzF,oFAAwE;AAExE;IAMC,wBAAY,UAAU,EAAE,YAAY,EAAE,YAAY;QACjD,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAElC,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC;IAED,oCAAW,GAAX;QAAA,iBAwKC;QAvKA,IAAM,IAAI,GAAG,IAAI,CAAC,+BAA+B,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;QAExE,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,aAAa,EAAE,UAAC,GAAG;YACxC,GAAG,GAAG,KAAI,CAAC,aAAa,CAAC,cAAc,EAAE,CAAC;YAC1C,KAAK,IAAI,KAAK,IAAI,GAAG,EAAE;gBACtB,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;gBACtC,IAAI,KAAK,KAAK,sBAAsB,EAAE;oBACrC,KAAI,CAAC,iBAAiB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC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CAAC,IAAI,CAAC,IAAI,CAAC;gCACzB,MAAM,EAAE,IAAI,CAAC,MAAM;gCACnB,cAAc,EAAE,IAAI,CAAC,UAAU;gCAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gCACvB,KAAK,EAAE,IAAI,CAAC,KAAK;6BACjB,CAAC,CAAC;yBACH;;4BAGgB,qBAAM,IAAI,CAAC,oBAAoB,EAAE;4BACjD,QAAQ,EAAE,IAAI,CAAC,iBAAiB;4BAChC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;4BACzC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;4BACzB,MAAM,EAAE,IAAI,CAAC,MAAM;4BACnB,cAAc,EAAE,IAAI,CAAC,UAAU;4BAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;4BACvB,KAAK,EAAE,IAAI,CAAC,KAAK;yBACjB,CAAC,EAAA;;wBARI,QAAQ,GAAG,SAQf;;;;;aAEH,CAAC,CAAC;QAEH,oDAAoD;QACpD,qEAAqE;QAErE,KAAK;QACL,UAAU;QACV,yDAAyD;QACzD,gDAAgD;QAChD,gCAAgC;QAEhC,QAAQ;QACR,KAAK;QACL,MAAM;IACP,CAAC;IACF,qBAAC;AAAD,CAvLA,AAuLC,IAAA;AAvLY,wCAAc","file":"monitor.manager.js","sourcesContent":["import ResolveIOMainServer from '../server-app';\nimport * as bent from 'bent';\nimport { Types } from 'mongoose';\nimport { MonitorCPUs } from '../collections/monitor-cpu.collection';\nimport { MonitorMemorys } from '../collections/monitor-memory.collection';\nimport { MonitorHTTPSInbounds } from '../collections/monitor-https-inbound.collection';\nimport { MonitorHTTPSOutbounds } from '../collections/monitor-https-outbound.collection';\nimport { MonitorMongos } from '../collections/monitor-mongo.collection';\n\nexport class MonitorManager {\n\tprivate _mainServer: ResolveIOMainServer;\n\tprivate _monitorAgent;\n\tprivate _serverConfig;\n\tprivate _instanceHostname;\n\n\tconstructor(mainServer, monitorAgent, serverConfig) {\n\t\tthis._mainServer = mainServer;\n\t\tthis._monitorAgent = monitorAgent;\n\t\tthis._serverConfig = serverConfig;\n\n\t\tthis.setupEvents();\n\t}\n\n\tsetupEvents() {\n\t\tconst post = bent('https://backend.resolveio.com', 'POST', 'json', 200);\n\t\t\n\t\tthis._monitorAgent.on('initialized', (env) => {\n\t\t\tenv = this._monitorAgent.getEnvironment();\n\t\t\tfor (let entry in env) {\n\t\t\t\tconsole.log(entry + ':' + env[entry]);\n\t\t\t\tif (entry === 'environment.HOSTNAME') {\n\t\t\t\t\tthis._instanceHostname = env[entry].replace('ip-', '').replace(/-/g, '.');\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t\t\n\t\tthis._monitorAgent.on('cpu', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorCPUs.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tapp: data.process,\n\t\t\t\t\tsystem: data.system\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/cpu', {\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tapp: data.process,\n\t\t\t\t\tsystem: data.system\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('memory', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorMemorys.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\tprivate: data.private,\n\t\t\t\t\tphysical: data.physical\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/memory', {\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tphysical_total: data.physical_total,\n\t\t\t\t\tphysical_used: data.physical_used,\n\t\t\t\t\tphysical_free: data.physical_free,\n\t\t\t\t\tvirtual: data.virtual,\n\t\t\t\t\tprivate: data.private,\n\t\t\t\t\tphysical: data.physical\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('https', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorHTTPSInbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeader: data.requestHeader\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/https-inbound', {\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeader: data.requestHeader\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('https-outbound', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tMonitorHTTPSOutbounds.create({\n\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t__v: 0,\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tstatus: data.status,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeaders: data.requestHeaders\n\t\t\t\t});\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/https-outbound', {\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\turl: data.url,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tstatus: data.status,\n\t\t\t\t\tcontentType: data.contentType,\n\t\t\t\t\trequestHeaders: data.requestHeaders\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tthis._monitorAgent.on('mongo', async (data) => {\n\t\t\tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\t\t\t\tif (data.collection !== 'monitor-mongos') {\n\t\t\t\t\tMonitorMongos.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\t\tmethod: data.method,\n\t\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\t\tduration: data.duration,\n\t\t\t\t\t\tquery: data.query\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tconst response = await post('/api/monitor/mongo', {\n\t\t\t\t\tinstance: this._instanceHostname,\n\t\t\t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t\t\t\tdate: new Date(data.time),\n\t\t\t\t\tmethod: data.method,\n\t\t\t\t\tdoc_collection: data.collection,\n\t\t\t\t\tduration: data.duration,\n\t\t\t\t\tquery: data.query\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t// this._monitorAgent.on('socket', async (data) => {\n\t\t// \tif (this._serverConfig['ROOT_URL'] === 'https://resolveio.com') {\n\n\t\t// \t}\n\t\t// \telse {\n\t\t// \t\tconst response = await post('/api/monitor/socket', {\n\t\t// \t\t\tclient: this._serverConfig['CLIENT_NAME'],\n\t\t// \t\t\tdate: new Date(data.time),\n\t\t\t\t\t\n\t\t// \t\t});\n\t\t// \t}\n\t\t// });\n\t}\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/methods/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,qCAAiC;AACjC,kEAAuD;AACvD,uCAAyC;AACzC,kCAAoC;AACpC,wFAA0E;AAC1E,sFAA0E;AAE1E,kCAA2C;AAG3C,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACrB,eAAe,EAAE;YAChB,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,OAAO,EAAE,MAAM;aACf,CAAC;YACF,QAAQ,EAAE,UAAS,OAAO;gBACzB,OAAO,0CAAa,CAAC,SAAS,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAC,EAAE,EAAC,IAAI,EAAE,EAAC,WAAW,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC,IAAI,EAAE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CAClC,CAAC,CAAC,CAAC;iCACH;;;;qBACD,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAlMD,gDAkMC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"accounts.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Types } from 'mongoose';\nimport { Users } from '../collections/user.collection';\nimport * as handlebars from 'handlebars';\nimport * as jwt from 'jsonwebtoken';\nimport { LoggedInUsers } from '../collections/logged-in-users.collection';\nimport { QueueResponses } from '../collections/queue-response.collection';\nimport { MethodManager } from '../managers/method.manager';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\n\nexport function loadAccountMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tsetWSAppVersion: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tversion: Number\n\t\t\t}),\n\t\t\tfunction: function(version) {\n\t\t\t\treturn LoggedInUsers.updateOne({id_ws: this.id_ws}, {$set: {app_version: version}}).exec();\n\t\t\t}\n\t\t},\n\t\treloadWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reloadWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reloadWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t}).then(val => {\n\t\t\t\t\t\t// console.log(val);\n\t\t\t\t\t}, err => {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\treconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdisconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'disconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'disconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcreateUserAndEmailEnrollment: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tdata: {\n\t\t\t\t\ttype: Users['simplschema']\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(data) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet userId = Types.ObjectId().toHexString();\n\n\t\t\t\t\tlet newUser = {\n\t\t\t\t\t\t_id: userId,\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tusername: data.username, \n\t\t\t\t\t\temail: data.email,\n\t\t\t\t\t\tfullname: data.fullname,\n\t\t\t\t\t\troles: data.roles,\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\treadonly: false,\n\t\t\t\t\t\tservices: {\n\t\t\t\t\t\t\tenrollment: jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\texpiresIn : 3 * 24 * 60 * 60 * 1000 // 3 days\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t\tphonenumber: data.phonenumber,\n\t\t\t\t\t\tother: {}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data['departments']) {\n\t\t\t\t\t\tnewUser['departments'] = data['departments'];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data['other']) {\n\t\t\t\t\t\tnewUser['other'] = data['other'];\n\t\t\t\t\t}\n\n\t\t\t\t\tlet user = await Users.create(newUser);\n\n\t\t\t\t\tuser.setPassword(randomString(20, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), ((err, res) => {\n\t\t\t\t\t\tuser.resetAttempts();\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tfullname: user.fullname,\n\t\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/enroll-account?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.enrollment\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tthis.readFile('email-templates/enrollment.html').then(html => {\n\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t});\n\t\t\n\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Enrollment Email', '', template(emailData));\n\t\t\n\t\t\t\t\t\t\tresolve(user);\n\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tresetUserPassword: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tuserId: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(userId: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\n\t\t\t\t\tlet user = await Users.findOne({_id: userId});\n\t\t\n\t\t\t\t\tif (user) {\n\n\t\t\t\t\t\tuser.services.forgot_password = jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET']);\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\t\tuserWhoResetPassword: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.forgot_password\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tUsers.updateOne({_id: user._id}, {$set: {services: user.services}}).exec((err, res) => {\n\t\t\t\t\t\t\tthis.readFile('email-templates/forgot-password.html').then(html => {\n\t\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t\t});\n\t\t\t\n\t\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData));\n\t\t\t\n\t\t\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }\n\treturn result;\n}"]}
1
+ {"version":3,"sources":["../../src/methods/accounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AACxC,qCAAiC;AACjC,kEAAuD;AACvD,uCAAyC;AACzC,kCAAoC;AACpC,wFAA0E;AAC1E,sFAA0E;AAE1E,kCAA2C;AAG3C,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACrB,eAAe,EAAE;YAChB,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,OAAO,EAAE,MAAM;aACf,CAAC;YACF,QAAQ,EAAE,UAAS,OAAO;gBACzB,OAAO,0CAAa,CAAC,SAAS,CAAC,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAC,EAAE,EA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AA,QAAQ,IAAI,OAAA,MAAM,CAAC,QAAQ,CAAC,EAAhB,CAAgB,CAAC,CAAC;oCAClC,CAAC,CAAC,CAAC;iCACH;;;;qBACD,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAlMD,gDAkMC;AAED,SAAS,YAAY,CAAC,MAAM,EAAE,KAAK;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KAAE;IAC/F,OAAO,MAAM,CAAC;AACf,CAAC","file":"accounts.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Types } from 'mongoose';\nimport { Users } from '../collections/user.collection';\nimport * as handlebars from 'handlebars';\nimport * as jwt from 'jsonwebtoken';\nimport { LoggedInUsers } from '../collections/logged-in-users.collection';\nimport { QueueResponses } from '../collections/queue-response.collection';\nimport { MethodManager } from '../managers/method.manager';\nimport { ResolveIOServer } from '../index';\nimport { UserModel } from '../models/user.model';\n\nexport function loadAccountMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tsetWSAppVersion: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tversion: Number\n\t\t\t}),\n\t\t\tfunction: function(version) {\n\t\t\t\treturn LoggedInUsers.updateOne({id_ws: this.id_ws}, {$set: {app_version: version}}).exec();\n\t\t\t}\n\t\t},\n\t\treloadWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reloadWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reloadWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t}).then(val => {\n\t\t\t\t\t\t// console.log(val);\n\t\t\t\t\t}, err => {\n\t\t\t\t\t\tconsole.log(err);\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\treconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'reconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'reconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tdisconnectWS: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_ws: String\n\t\t\t}),\n\t\t\tfunction: function(id_ws) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tQueueResponses.create({\n\t\t\t\t\t\t_id: Types.ObjectId().toHexString(),\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tmethod: 'disconnectWSCommand',\n\t\t\t\t\t\tmethod_data: [],\n\t\t\t\t\t\tid_ws: id_ws,\n\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\tid_user: this.id_user,\n\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\tresponse: {\n\t\t\t\t\t\t\tmessageId: 0,\n\t\t\t\t\t\t\thasError: false,\n\t\t\t\t\t\t\tdata: 'disconnectWSCommand'\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tresolve();\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcreateUserAndEmailEnrollment: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tdata: {\n\t\t\t\t\ttype: Users['simplschema']\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(data) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet userId = Types.ObjectId().toHexString();\n\n\t\t\t\t\tlet newUser = {\n\t\t\t\t\t\t_id: userId,\n\t\t\t\t\t\t__v: 0,\n\t\t\t\t\t\tusername: data.username, \n\t\t\t\t\t\temail: data.email,\n\t\t\t\t\t\tfullname: data.fullname,\n\t\t\t\t\t\troles: data.roles,\n\t\t\t\t\t\tactive: true,\n\t\t\t\t\t\treadonly: false,\n\t\t\t\t\t\tservices: {\n\t\t\t\t\t\t\tenrollment: jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET'], {\n\t\t\t\t\t\t\t\texpiresIn : 3 * 24 * 60 * 60 * 1000 // 3 days\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t},\n\t\t\t\t\t\tphonenumber: data.phonenumber,\n\t\t\t\t\t\tother: {}\n\t\t\t\t\t};\n\n\t\t\t\t\tif (data['departments']) {\n\t\t\t\t\t\tnewUser['departments'] = data['departments'];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (data['other']) {\n\t\t\t\t\t\tnewUser['other'] = data['other'];\n\t\t\t\t\t}\n\n\t\t\t\t\tlet user = await Users.create(newUser);\n\n\t\t\t\t\tuser.setPassword(randomString(20, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'), ((err, res) => {\n\t\t\t\t\t\tuser.resetAttempts();\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tfullname: user.fullname,\n\t\t\t\t\t\t\tuser: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/enroll-account?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.enrollment\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tthis.readFile('email-templates/enrollment.html').then(html => {\n\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t});\n\t\t\n\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Enrollment Email', '', template(emailData));\n\t\t\n\t\t\t\t\t\t\tresolve(user);\n\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t}));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tresetUserPassword: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tuserId: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(userId: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\t\t\t\t\n\t\t\t\t\tlet user = await Users.findOne({_id: userId});\n\t\t\n\t\t\t\t\tif (user) {\n\n\t\t\t\t\t\tuser.services.forgot_password = jwt.sign({id_user: userId}, this.serverConfig['JWT_SECRET']);\n\n\t\t\t\t\t\tlet emailData = {\n\t\t\t\t\t\t\tuserToChangePassword: user.fullname,\n\t\t\t\t\t\t\tuserWhoResetPassword: this.user,\n\t\t\t\t\t\t\turl: this.serverConfig['ROOT_URL'] + '/forgot-password?' + encodeURIComponent(this.serverConfig['SERVER_URL']) + '&' + user.services.forgot_password\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tUsers.updateOne({_id: user._id}, {$set: {services: user.services}}).exec((err, res) => {\n\t\t\t\t\t\t\tthis.readFile('email-templates/forgot-password.html').then(html => {\n\t\t\t\t\t\t\t\tlet template = handlebars.compile(html);\n\t\t\t\t\t\t\t\thandlebars.registerHelper('equals', (a, b) => {\n\t\t\t\t\t\t\t\t\treturn a === b;\n\t\t\t\t\t\t\t\t});\n\t\t\t\n\t\t\t\t\t\t\t\tthis.sendEmail(user.email, 'ResolveIO (' + ResolveIOServer.getClientName() + ') - Forgot Password', '', template(emailData));\n\t\t\t\n\t\t\t\t\t\t\t\tresolve(true);\n\t\t\t\t\t\t\t}, errEmail => reject(errEmail));\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction randomString(length, chars) {\n\tlet result = '';\n\tfor (let i = length; i > 0; --i) { result += chars[Math.floor(Math.random() * chars.length)]; }\n\treturn result;\n}"]}
@@ -1,29 +1,27 @@
1
1
  import { CollectionDocument } from './collection-document.model';
2
2
  export interface UserModel extends CollectionDocument {
3
- attempts: number;
4
- last: Date;
3
+ roles: UserRoleModel;
4
+ attempts?: number;
5
+ last?: Date;
6
+ services?: any;
5
7
  fullname: string;
6
- roles: string[];
7
- readonly?: boolean;
8
8
  username?: string;
9
9
  email?: string;
10
10
  active?: boolean;
11
- services?: any;
12
- phonenumber?: string;
13
- other?: UserObject;
14
11
  id_customer?: string;
15
12
  customer?: string;
16
13
  customer_type?: string;
17
- customers?: UserCustomersModel[];
14
+ customers?: UserCustomerModel[];
15
+ phonenumber?: string;
16
+ other?: UserObject;
17
+ assets?: UserAssetModel[];
18
+ id_function?: string;
19
+ readonly?: boolean;
18
20
  departments?: UserDepartmentModel[];
19
21
  }
20
22
  export interface UserObject {
21
23
  [key: string]: any;
22
24
  }
23
- export interface UserDepartmentModel {
24
- id_department: string;
25
- department: string;
26
- }
27
25
  export interface UserRoleModel {
28
26
  super_admin: boolean;
29
27
  approvals: UserRoleApprovalModel[];
@@ -41,7 +39,20 @@ export interface UserRoleGroupModel {
41
39
  views: string[];
42
40
  yard?: string;
43
41
  }
44
- export interface UserCustomersModel {
45
- id_customer: string;
42
+ export interface UserAssetModel {
43
+ type: any;
44
+ id_asset: string;
45
+ asset_number: string;
46
+ ownership: string;
47
+ ownership_driver: string;
48
+ date_start: Date;
49
+ date_end?: Date;
50
+ }
51
+ export interface UserCustomerModel {
46
52
  customer: string;
53
+ id_customer: string;
54
+ }
55
+ export interface UserDepartmentModel {
56
+ id_department: string;
57
+ department: string;
47
58
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/models/user.model.ts"],"names":[],"mappings":"","file":"user.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface UserModel extends CollectionDocument {\n\tattempts: number;\n\tlast: Date;\n\tfullname: string;\n\troles: string[];\n\treadonly?: boolean;\n\tusername?: string;\n\temail?: string;\n\tactive?: boolean;\n\tservices?: any;\n\tphonenumber?: string;\n\tother?: UserObject;\n\tid_customer?: string;\n\tcustomer?: string;\n\tcustomer_type?: string;\n\tcustomers?: UserCustomersModel[];\n\tdepartments?: UserDepartmentModel[];\n}\n\nexport interface UserObject {\n [key: string]: any;\n}\n\nexport interface UserDepartmentModel {\n\tid_department: string;\n\tdepartment: string;\n}\n\nexport interface UserRoleModel {\n\tsuper_admin: boolean;\n\tapprovals: UserRoleApprovalModel[];\n\tgroups: UserRoleGroupModel[];\n\tnotifications: string[];\n\tmiscs: string[];\n}\n\nexport interface UserRoleApprovalModel {\n\taccounting_code: string;\n\ttype: string;\n\tname: string;\n}\n\nexport interface UserRoleGroupModel {\n\tname: string;\n\tviews: string[];\n\tyard?: string;\n}\n\nexport interface UserCustomersModel {\n\tid_customer: string;\n\tcustomer: string;\n}"]}
1
+ {"version":3,"sources":["../../src/models/user.model.ts"],"names":[],"mappings":"","file":"user.model.js","sourcesContent":["import { CollectionDocument } from './collection-document.model';\n\nexport interface UserModel extends CollectionDocument {\n\troles: UserRoleModel;\n\tattempts?: number;\n\tlast?: Date;\n\tservices?: any;\n\tfullname: string;\n\tusername?: string;\n\temail?: string;\n\tactive?: boolean;\n\tid_customer?: string;\n\tcustomer?: string;\n\tcustomer_type?: string;\n\tcustomers?: UserCustomerModel[];\n\tphonenumber?: string;\n\tother?: UserObject;\n\tassets?: UserAssetModel[];\n\tid_function?: string;\n\treadonly?: boolean;\n\tdepartments?: UserDepartmentModel[];\n}\n\nexport interface UserObject {\n [key: string]: any;\n}\n\nexport interface UserRoleModel {\n\tsuper_admin: boolean;\n\tapprovals: UserRoleApprovalModel[];\n\tgroups: UserRoleGroupModel[];\n\tnotifications: string[];\n\tmiscs: string[];\n}\n\nexport interface UserRoleApprovalModel {\n\taccounting_code: string;\n\ttype: string;\n\tname: string;\n}\n\nexport interface UserRoleGroupModel {\n\tname: string;\n\tviews: string[];\n\tyard?: string;\n}\n\nexport interface UserAssetModel {\n\ttype: any;\n\tid_asset: string;\n\tasset_number: string;\n\townership: string;\n\townership_driver: string;\n\tdate_start: Date;\n\tdate_end?: Date;\n}\n\nexport interface UserCustomerModel {\n\tcustomer: string;\n\tid_customer: string;\n}\n\nexport interface UserDepartmentModel {\n\tid_department: string;\n\tdepartment: string;\n}"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "7.1.4",
3
+ "version": "7.1.5-newrole",
4
4
  "description": "",
5
5
  "main": "index.ts",
6
6
  "scripts": {
@@ -67,14 +67,13 @@ function loadReportBuilderLibraryPublications(subscriptionManager) {
67
67
  }
68
68
  }),
69
69
  function: function (id_user) { return __awaiter(_this, void 0, void 0, function () {
70
- var user, userGroupNames, userGroups;
70
+ var user, userGroups;
71
71
  return __generator(this, function (_a) {
72
72
  switch (_a.label) {
73
73
  case 0: return [4 /*yield*/, user_collection_1.Users.findById(id_user)];
74
74
  case 1:
75
75
  user = _a.sent();
76
- userGroupNames = user.roles.filter(function (a) { return a.startsWith('group-'); }).map(function (a) { return a.replace('group-', ''); });
77
- return [4 /*yield*/, user_group_collection_1.UserGroups.find({ name: { $in: userGroupNames } })];
76
+ return [4 /*yield*/, user_group_collection_1.UserGroups.find({ name: { $in: user.roles.groups.map(function (a) { return a.name; }) } })];
78
77
  case 2:
79
78
  userGroups = _a.sent();
80
79
  return [2 /*return*/, report_builder_library_collection_1.ReportBuilderLibraries.find({ 'user_groups.id_user_group': { $in: userGroups.map(function (a) { return a._id; }) } }).sort({ name: 1 }).exec()];
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/publications/report-builder-libraries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAGxC,sGAA0F;AAC1F,kEAAuD;AACvD,8EAAkE;AAElE,SAAgB,oCAAoC,CAAC,mBAAwC;IAA7F,iBAoCC;IAnCA,mBAAmB,CAAC,YAAY,CAAC;QAChC,sBAAsB,EAAE;YACvB,QAAQ,EAAE;gBACT,OAAO,0DAAsB,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC7D,CAAC;YACD,WAAW,EAAE,CAAC,0BAA0B,CAAC;SACzC;QACD,gCAAgC,EAAE;YACjC,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,OAAO,EAAE;oBACR,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,QAAQ,EAAE,UAAC,OAAe;gBACzB,OAAO,0DAAsB,CAAC,IAAI,CAAC,EAAC,cAAc,EAAE,OAAO,EAAC,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACtF,CAAC;YACD,WAAW,EAAE,CAAC,OAAO,EAAE,0BAA0B,CAAC;SAClD;QACD,6BAA6B,EAAE;YAC9B,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,OAAO,EAAE;oBACR,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,QAAQ,EAAE,UAAO,OAAe;;;;gCACpB,qBAAM,uBAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAA;;4BAApC,IAAI,GAAG,SAA6B;4BAEpC,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAtB,CAAsB,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,CAAC;4BACrF,qBAAM,kCAAU,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,EAAC,GAAG,EAAE,cAAc,EAAC,EAAC,CAAC,EAAA;;4BAAjE,UAAU,GAAG,SAAoD;4BAErE,sBAAO,0DAAsB,CAAC,IAAI,CAAC,EAAC,2BAA2B,EAAE,EAAC,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,GAAG,EAAL,CAAK,CAAC,EAAC,EAAC,CAAC,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,EAAC;;;iBAC5H;YACD,WAAW,EAAE,CAAC,OAAO,EAAE,0BAA0B,CAAC;SAClD;KACD,CAAC,CAAC;AACJ,CAAC;AApCD,oFAoCC","file":"report-builder-libraries.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Document } from 'mongoose';\nimport { SubscriptionManager } from '../managers/subscription.manager';\nimport { ReportBuilderLibraries } from '../collections/report-builder-library.collection';\nimport { Users } from '../collections/user.collection';\nimport { UserGroups } from '../collections/user-group.collection';\n\nexport function loadReportBuilderLibraryPublications(subscriptionManager: SubscriptionManager) {\n\tsubscriptionManager.publications({\n\t\treportbuilderlibraries: {\n\t\t\tfunction: () => {\n\t\t\t\treturn ReportBuilderLibraries.find().sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['report-builder-libraries']\n\t\t},\n\t\treportbuilderlibrariesWithIdUser: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_user: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: (id_user: string) => {\n\t\t\t\treturn ReportBuilderLibraries.find({id_user_create: id_user}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['users', 'report-builder-libraries']\n\t\t},\n\t\treportbuilderlibrariesForUser: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_user: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async (id_user: string) => {\n\t\t\t\tlet user = await Users.findById(id_user);\n\n\t\t\t\tlet userGroupNames = user.roles.filter(a => a.startsWith('group-')).map(a => a.replace('group-', ''));\n\t\t\t\tlet userGroups = await UserGroups.find({name: {$in: userGroupNames}})\n\n\t\t\t\treturn ReportBuilderLibraries.find({'user_groups.id_user_group': {$in: userGroups.map(a => a._id)}}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['users', 'report-builder-libraries']\n\t\t},\n\t});\n}"]}
1
+ {"version":3,"sources":["../../src/publications/report-builder-libraries.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwC;AAGxC,sGAA0F;AAC1F,kEAAuD;AACvD,8EAAkE;AAElE,SAAgB,oCAAoC,CAAC,mBAAwC;IAA7F,iBAkCC;IAjCA,mBAAmB,CAAC,YAAY,CAAC;QAChC,sBAA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AC,IAAI,CAAC,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC,IAAI,EAAE,EAAC;;;iBAC5H;YACD,WAAW,EAAE,CAAC,OAAO,EAAE,0BAA0B,CAAC;SAClD;KACD,CAAC,CAAC;AACJ,CAAC;AAlCD,oFAkCC","file":"report-builder-libraries.js","sourcesContent":["import SimpleSchema from 'simpl-schema';\nimport { Document } from 'mongoose';\nimport { SubscriptionManager } from '../managers/subscription.manager';\nimport { ReportBuilderLibraries } from '../collections/report-builder-library.collection';\nimport { Users } from '../collections/user.collection';\nimport { UserGroups } from '../collections/user-group.collection';\n\nexport function loadReportBuilderLibraryPublications(subscriptionManager: SubscriptionManager) {\n\tsubscriptionManager.publications({\n\t\treportbuilderlibraries: {\n\t\t\tfunction: () => {\n\t\t\t\treturn ReportBuilderLibraries.find().sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['report-builder-libraries']\n\t\t},\n\t\treportbuilderlibrariesWithIdUser: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_user: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: (id_user: string) => {\n\t\t\t\treturn ReportBuilderLibraries.find({id_user_create: id_user}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['users', 'report-builder-libraries']\n\t\t},\n\t\treportbuilderlibrariesForUser: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tid_user: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: async (id_user: string) => {\n\t\t\t\tlet user = await Users.findById(id_user);\n\t\t\t\tlet userGroups = await UserGroups.find({name: {$in: user.roles.groups.map(a => a.name)}});\n\n\t\t\t\treturn ReportBuilderLibraries.find({'user_groups.id_user_group': {$in: userGroups.map(a => a._id)}}).sort({name: 1}).exec();\n\t\t\t},\n\t\t\tcollections: ['users', 'report-builder-libraries']\n\t\t},\n\t});\n}"]}