@resolveio/server-lib 9.0.34 → 9.0.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-server-app.js +48 -7
- package/client-server-app.js.map +1 -1
- package/collections/app-status.collection.js +11 -8
- package/collections/app-status.collection.js.map +1 -1
- package/collections/app-version.collection.js +11 -8
- package/collections/app-version.collection.js.map +1 -1
- package/collections/counter.collection.js +11 -8
- package/collections/counter.collection.js.map +1 -1
- package/collections/cron-job-history.collection.js +12 -9
- package/collections/cron-job-history.collection.js.map +1 -1
- package/collections/cron-job.collection.js +11 -8
- package/collections/cron-job.collection.js.map +1 -1
- package/collections/email-history.collection.js +11 -8
- package/collections/email-history.collection.js.map +1 -1
- package/collections/email-verified.collection.js +12 -9
- package/collections/email-verified.collection.js.map +1 -1
- package/collections/file.collection.js +11 -8
- package/collections/file.collection.js.map +1 -1
- package/collections/flag.collection.js +11 -8
- package/collections/flag.collection.js.map +1 -1
- package/collections/log-method-latency.collection.js +14 -11
- package/collections/log-method-latency.collection.js.map +1 -1
- package/collections/log-subscription.collection.js +16 -13
- package/collections/log-subscription.collection.js.map +1 -1
- package/collections/log.collection.js +19 -16
- package/collections/log.collection.js.map +1 -1
- package/collections/logged-in-users.collection.js +12 -9
- package/collections/logged-in-users.collection.js.map +1 -1
- package/collections/method-call.collection.js +13 -10
- package/collections/method-call.collection.js.map +1 -1
- package/collections/method-response.collection.js +13 -10
- package/collections/method-response.collection.js.map +1 -1
- package/collections/monitor-cpu.collection.js +16 -13
- package/collections/monitor-cpu.collection.js.map +1 -1
- package/collections/monitor-https-inbound.collection.js +16 -13
- package/collections/monitor-https-inbound.collection.js.map +1 -1
- package/collections/monitor-https-outbound.collection.js +18 -15
- package/collections/monitor-https-outbound.collection.js.map +1 -1
- package/collections/monitor-memory.collection.js +15 -12
- package/collections/monitor-memory.collection.js.map +1 -1
- package/collections/monitor-mongo.collection.js +15 -12
- package/collections/monitor-mongo.collection.js.map +1 -1
- package/collections/notification.collection.js +11 -8
- package/collections/notification.collection.js.map +1 -1
- package/collections/queue-flag.collection.js +12 -9
- package/collections/queue-flag.collection.js.map +1 -1
- package/collections/queue-method.collection.js +12 -9
- package/collections/queue-method.collection.js.map +1 -1
- package/collections/queue-response.collection.js +12 -9
- package/collections/queue-response.collection.js.map +1 -1
- package/collections/report-builder-dashboard-builder.collection.js +13 -10
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -1
- package/collections/report-builder-library.collection.js +14 -11
- package/collections/report-builder-library.collection.js.map +1 -1
- package/collections/report-builder-report.collection.js +14 -11
- package/collections/report-builder-report.collection.js.map +1 -1
- package/collections/user-group.collection.js +14 -11
- package/collections/user-group.collection.js.map +1 -1
- package/collections/user-guide.collection.js +11 -8
- package/collections/user-guide.collection.js.map +1 -1
- package/collections/user.collection.js +15 -12
- package/collections/user.collection.js.map +1 -1
- package/cron/cron.js +25 -25
- package/cron/cron.js.map +1 -1
- package/fixtures/cron-jobs.js +80 -30
- package/fixtures/cron-jobs.js.map +1 -1
- package/fixtures/init.js +59 -9
- package/fixtures/init.js.map +1 -1
- package/http/auth.js +460 -344
- package/http/auth.js.map +1 -1
- package/http/health.js +5 -1
- package/http/health.js.map +1 -1
- package/http/home.js +11 -7
- package/http/home.js.map +1 -1
- package/index.js +98 -36
- package/index.js.map +1 -1
- package/managers/cron.manager.js +157 -78
- package/managers/cron.manager.js.map +1 -1
- package/managers/method.manager.js +302 -314
- package/managers/method.manager.js.map +1 -1
- package/managers/mongo.manager.js +1001 -739
- package/managers/mongo.manager.js.map +1 -1
- package/managers/monitor.manager.js +254 -171
- package/managers/monitor.manager.js.map +1 -1
- package/managers/queue-method.manager.js +166 -69
- package/managers/queue-method.manager.js.map +1 -1
- package/managers/subscription.manager.js +714 -515
- package/managers/subscription.manager.js.map +1 -1
- package/methods/accounts.js +183 -111
- package/methods/accounts.js.map +1 -1
- package/methods/aws.js +262 -156
- package/methods/aws.js.map +1 -1
- package/methods/cloudconvert.js +180 -100
- package/methods/cloudconvert.js.map +1 -1
- package/methods/collections.js +110 -103
- package/methods/collections.js.map +1 -1
- package/methods/counters.js +79 -29
- package/methods/counters.js.map +1 -1
- package/methods/cron-jobs.js +884 -819
- package/methods/cron-jobs.js.map +1 -1
- package/methods/flags.js +5 -1
- package/methods/flags.js.map +1 -1
- package/methods/logs.js +313 -258
- package/methods/logs.js.map +1 -1
- package/methods/monitor.js +348 -289
- package/methods/monitor.js.map +1 -1
- package/methods/pdf.js +340 -341
- package/methods/pdf.js.map +1 -1
- package/methods/report-builder.js +657 -565
- package/methods/report-builder.js.map +1 -1
- package/methods/support.js +185 -67
- package/methods/support.js.map +1 -1
- package/models/app-status.model.js +2 -1
- package/models/app-version.model.js +2 -1
- package/models/billing-logged-in-users.model.js +2 -1
- package/models/collection-document.model.js +2 -1
- package/models/counter.model.js +2 -1
- package/models/cron-job-history.model.js +2 -1
- package/models/cron-job.model.js +2 -1
- package/models/dialog.model.js +2 -1
- package/models/email-history.model.js +2 -1
- package/models/email-verified.model.js +2 -1
- package/models/file.model.js +2 -1
- package/models/flag.model.js +2 -1
- package/models/log-method-latency.model.js +2 -1
- package/models/log-subscription.model.js +2 -1
- package/models/log.model.js +2 -1
- package/models/logged-in-users.model.js +2 -1
- package/models/method-call.model.js +2 -1
- package/models/method-response.model.js +2 -1
- package/models/method.model.js +2 -1
- package/models/monitor-cpu.model.js +2 -1
- package/models/monitor-https-inbound.model.js +2 -1
- package/models/monitor-https-outbound.model.js +2 -1
- package/models/monitor-memory.model.js +2 -1
- package/models/monitor-mongo.model.js +2 -1
- package/models/notification.model.js +2 -1
- package/models/pagination.model.js +5 -2
- package/models/pagination.model.js.map +1 -1
- package/models/permission.model.js +2 -1
- package/models/queue-method.model.js +2 -1
- package/models/queue-response.model.js +2 -1
- package/models/report-builder-dashboard-builder.model.js +2 -1
- package/models/report-builder-library.model.js +2 -1
- package/models/report-builder-report.model.js +2 -1
- package/models/report-builder.model.js +2 -1
- package/models/select-data-label.model.js +2 -1
- package/models/server-response.model.js +2 -1
- package/models/subscription.model.js +2 -1
- package/models/support-ticket.model.js +2 -1
- package/models/user-group.model.js +2 -1
- package/models/user-guide.model.js +2 -1
- package/models/user.model.js +2 -1
- package/package.json +1 -1
- package/public_api.js +82 -70
- package/public_api.js.map +1 -1
- package/publications/app-status.js +8 -4
- package/publications/app-status.js.map +1 -1
- package/publications/app-version.js +8 -4
- package/publications/app-version.js.map +1 -1
- package/publications/cron-jobs.js +13 -9
- package/publications/cron-jobs.js.map +1 -1
- package/publications/files.js +15 -11
- package/publications/files.js.map +1 -1
- package/publications/flags.js +11 -7
- package/publications/flags.js.map +1 -1
- package/publications/logs.js +35 -31
- package/publications/logs.js.map +1 -1
- package/publications/method-calls.js +8 -4
- package/publications/method-calls.js.map +1 -1
- package/publications/method-responses.js +8 -4
- package/publications/method-responses.js.map +1 -1
- package/publications/notifications.js +8 -4
- package/publications/notifications.js.map +1 -1
- package/publications/report-builder-dashboard-builders.js +12 -8
- package/publications/report-builder-dashboard-builders.js.map +1 -1
- package/publications/report-builder-libraries.js +66 -16
- package/publications/report-builder-libraries.js.map +1 -1
- package/publications/report-builder-reports.js +21 -17
- package/publications/report-builder-reports.js.map +1 -1
- package/publications/super-admin.js +7 -3
- package/publications/super-admin.js.map +1 -1
- package/publications/user-groups.js +8 -4
- package/publications/user-groups.js.map +1 -1
- package/publications/user-guides.js +8 -4
- package/publications/user-guides.js.map +1 -1
- package/server-app.js +534 -393
- package/server-app.js.map +1 -1
- package/util/common.js +92 -55
- package/util/common.js.map +1 -1
- package/util/schema-report-builder.js +134 -76
- package/util/schema-report-builder.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/collections.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,QAAQ,EAAE,uBAAuB,EAAiB,MAAM,gBAAgB,CAAC;AACnG,OAAO,YAAY,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAqB,M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,OAAO,EAAE,MAAM,EAAE,EAAE;oBACtC,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;wBAC9D,MAAM,CAAC,oBAAoB,CAAC,CAAC;qBAC7B;yBACI;wBACJ,eAAe,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;4BACrF,OAAO,CAAC,GAAG,CAAC,CAAC;wBACd,CAAC,EAAE,GAAG,CAAC,EAAE;4BACR,MAAM,CAAC,GAAG,CAAC,CAAC;wBACb,CAAC,CAAC,CAAC;qBACH;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC","file":"collections.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { getMongoUpdates, deepCopy, getMongoMergeUpdatedDoc, getBinarySize } from '../util/common';\nimport SimpleSchema from 'simpl-schema';\nimport { PaginationOptionsSchema, PaginationOptions } from '../models/pagination.model';\nimport { ResolveIOServer } from '../index';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport function loadCollectionMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tcollectionListAll: {\n\t\t\tskipQueue: true,\n\t\t\tfunction: function() {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tresolve(ResolveIOServer.getMongoManager().collections().map(a => a.collectionName).sort((a, b) => a.localeCompare(b)));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcollectionListRB: {\n\t\t\tskipQueue: true,\n\t\t\tfunction: function() {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tresolve(ResolveIOServer.getMongoManager().collections().filter(a => a.useRB).map(a => a.collectionName).sort((a, b) => a.localeCompare(b)));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Query database for any collection and query\n\t\tfindOne: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query = {}) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne(query).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tfind: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tsort: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true,\n\t\t\t\t\toptional: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query = {}, sortQuery = {}) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).find(query, {sort: sortQuery}).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tfindWithOptions: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\toptions: {\n\t\t\t\t\ttype: PaginationOptionsSchema\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query: Object, options: PaginationOptions) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tlet optionsQuery = {};\n\n\t\t\t\t\t\tif (options.fields && Object.keys(options.fields).length) {\n\t\t\t\t\t\t\toptionsQuery['projection'] = options.fields;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.sort && Object.keys(options.sort).length) {\n\t\t\t\t\t\t\toptionsQuery['sort'] = options.sort;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.limit) {\n\t\t\t\t\t\t\toptionsQuery['limit'] = options.limit;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.skip) {\n\t\t\t\t\t\t\toptionsQuery['skip'] = options.skip;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).find(query, optionsQuery).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Insert 1 document\n\t\t// @Inputs: collection, document\n\t\t// @Outputs: res = _id of new document, err = not inserted\n\t\tinsertDocument: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdocument: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, document: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tlet id = objectIdHexString();\n\t\t\t\t\t\tdocument['_id'] = id;\n\t\t\t\t\t\tdocument['__v'] = 0;\n\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).insertOne(document).then(() => resolve(id), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Insert 1 document\n\t\t// @Inputs: collection, document\n\t\t// @Outputs: res = _id of new document, err = not inserted\n\t\tinsertManyDocuments: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdocuments: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'documents.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, documents: Object[]) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdocuments.forEach(document => {\n\t\t\t\t\t\t\tdocument['_id'] = objectIdHexString();\n\t\t\t\t\t\t\tdocument['__v'] = 0;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).insertMany(documents).then(() => resolve(documents.map(a => a['_id'])), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Replaces 1 document with new document (from _id)\n\t\t// @Inputs: collection, document id\n\t\t// @Outputs: res = 1 (updated 1), err = not updated/wrong version\n\t\t// Search for doc, check version, if found then try and update\n\t\tupdateDocument: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tf_document: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, f_document: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: f_document['_id']}, f_document).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Updates 1 document's props (from _id)\n\t\t// @Inputs: collection, document id, document version, update paramters ({prop: 'xxx', data: 'yyy})\n\t\t// @Outputs: res = 1 (updated 1), res = 0 (not updated), err = not updated/wrong version\n\t\t// Search for doc, check version, if found then try and update props\n\t\tupdateDocumentProps: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdoc_id: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tupdateParams: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'updateParams.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tdoc__v: {\n\t\t\t\t\ttype: Number\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, doc_id: string, updateParams: any[], doc__v: number) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne({_id: doc_id}).then(currDoc => {\n\t\t\t\t\t\t\tif (currDoc) {\n\t\t\t\t\t\t\t\tlet modifiedDoc = deepCopy(currDoc);\n\n\t\t\t\t\t\t\t\tupdateParams.forEach(data => {\n\t\t\t\t\t\t\t\t\tmodifiedDoc[data.prop] = data.data;\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (modifiedDoc.__v === doc__v) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: modifiedDoc._id}, modifiedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tconsole.log(new Date(), 'invalid version - ' + collection, currDoc.__v, doc__v);\n\n\t\t\t\t\t\t\t\t\tif (ResolveIOServer.getMongoManager().collection(collection + '.versions')) {\n\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection + '.versions').findOne({\n\t\t\t\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t\t\t\t{'_id._id': currDoc._id},\n\t\t\t\t\t\t\t\t\t\t\t\t{'_id.__v': doc__v}\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t}).then(oldDoc => {\n\t\t\t\t\t\t\t\t\t\t\tlet newCurrDocId = currDoc._id;\n\n\t\t\t\t\t\t\t\t\t\t\tif (oldDoc) {\n\t\t\t\t\t\t\t\t\t\t\t\tlet updatedDoc = getMongoMergeUpdatedDoc(modifiedDoc, currDoc, oldDoc);\n\t\t\t\t\t\t\t\t\t\t\t\tupdatedDoc._id = newCurrDocId;\n\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: newCurrDocId}, updatedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t\treject('Invalid Version And Could Not Find History Props - DB: ' + currDoc.__v + ', Trying to update with :' + doc__v);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}, () => {});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\treject('Invalid Version And We Are NOT Using Versions On This Collection!');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject('No Document');\n\t\t\t\t\t\t\t}\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\tupdateDocumentOffline: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tf_document: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tf_oldDocument: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, f_document: Object, f_oldDocument: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne({_id: f_document['_id']}).then(currDoc => {\n\t\t\t\t\t\t\tif (currDoc) {\n\t\t\t\t\t\t\t\tif (currDoc.__v === f_document['__v']) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: f_document['_id']}, f_document, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tconsole.log('OFFLINE - invalid version - ' + collection, currDoc.__v, f_document['__v']);\n\n\t\t\t\t\t\t\t\t\tlet newCurrDocId = currDoc._id;\n\n\t\t\t\t\t\t\t\t\tif (f_oldDocument) {\n\t\t\t\t\t\t\t\t\t\tlet updatedDoc = getMongoMergeUpdatedDoc(f_document, currDoc, f_oldDocument);\n\t\t\t\t\t\t\t\t\t\tupdatedDoc._id = newCurrDocId;\n\n\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: newCurrDocId}, updatedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\treject('OFFLINE - Invalid Version And Could Not Find History - DB: ' + currDoc.__v + ', Trying to update with :' + f_document['__v']);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject('No Document');\n\t\t\t\t\t\t\t}\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\t// Updates 1 document's props (from _id)\n\t\t// @Inputs: collection, document id, document version, update paramters ({prop: 'xxx', data: 'yyy})\n\t\t// @Outputs: res = 1 (updated 1), res = 0 (not updated), err = not updated/wrong version\n\t\t// Search for doc, check version, if found then try and update props\n\t\tupdateDocumentPropsOffline: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdoc_id: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tupdateParams: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'updateParams.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tdoc__v: {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\tf_oldDocument: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, doc_id: string, updateParams: any[], doc__v: number, f_oldDocument: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne({_id: doc_id}).then(currDoc => {\n\t\t\t\t\t\t\tif (currDoc) {\n\t\t\t\t\t\t\t\tlet modifiedDoc = deepCopy(currDoc);\n\n\t\t\t\t\t\t\t\tupdateParams.forEach(data => {\n\t\t\t\t\t\t\t\t\tmodifiedDoc[data.prop] = data.data;\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (modifiedDoc.__v === doc__v) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: modifiedDoc._id}, modifiedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tconsole.log('OFFLINE - invalid version - ' + collection, currDoc.__v, doc__v);\n\n\t\t\t\t\t\t\t\t\tlet newCurrDocId = currDoc._id;\n\n\t\t\t\t\t\t\t\t\tif (f_oldDocument) {\n\t\t\t\t\t\t\t\t\t\tlet updatedDoc = getMongoMergeUpdatedDoc(modifiedDoc, currDoc, f_oldDocument);\n\t\t\t\t\t\t\t\t\t\tupdatedDoc._id = newCurrDocId;\n\n\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: newCurrDocId}, updatedDoc).then(res => {\n\t\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\treject('OFFLINE - Invalid Version And Could Not Find History Props - DB: ' + currDoc.__v + ', Trying to update with :' + modifiedDoc.__v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject('No Document');\n\t\t\t\t\t\t\t}\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\t// Removes 1 document (from _id)\n\t\t// @Inputs: collection, document id\n\t\t// @Outputs: res = 1 (deleted), res = 0 (not deleted), err = not deleted\n\t\t// Search for doc, if found then try and remove\n\t\tremoveDocument: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdoc_id: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, doc_id: string) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).deleteOne({_id: doc_id}).then(res => {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\treject(err);\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\tremoveDocumentWithQuery: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).deleteOne(query).then(res => {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\treject(err);\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\tremoveDocumentsWithQuery: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).deleteMany(query).then(res => {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\treject(err);\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}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/methods/collections.ts"],"names":[],"mappings":";;;AACA,yCAAmG;AACnG,6CAAwC;AACxC,+DAAwF;AACxF,kCAA2C;AAC3C,2DAA8D;AAE9D,SAAgB,qBAAqB,CAAC,aAA4B;IACjE,aAAa,CAAC,OAAO,CAAC;QACrB,iBAAiB,EAAE;YAClB,SAAS,EAAE,IAAI;YACf,QAAQ,EA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,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAA,GAAG;4BAClF,OAAO,CAAC,GAAG,CAAC,CAAC;wBACd,CAAC,EAAE,UAAA,GAAG;4BACL,MAAM,CAAC,GAAG,CAAC,CAAC;wBACb,CAAC,CAAC,CAAC;qBACH;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAheD,sDAgeC","file":"collections.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { getMongoUpdates, deepCopy, getMongoMergeUpdatedDoc, getBinarySize } from '../util/common';\nimport SimpleSchema from 'simpl-schema';\nimport { PaginationOptionsSchema, PaginationOptions } from '../models/pagination.model';\nimport { ResolveIOServer } from '../index';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport function loadCollectionMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tcollectionListAll: {\n\t\t\tskipQueue: true,\n\t\t\tfunction: function() {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tresolve(ResolveIOServer.getMongoManager().collections().map(a => a.collectionName).sort((a, b) => a.localeCompare(b)));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcollectionListRB: {\n\t\t\tskipQueue: true,\n\t\t\tfunction: function() {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tresolve(ResolveIOServer.getMongoManager().collections().filter(a => a.useRB).map(a => a.collectionName).sort((a, b) => a.localeCompare(b)));\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Query database for any collection and query\n\t\tfindOne: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query = {}) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne(query).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tfind: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tsort: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true,\n\t\t\t\t\toptional: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query = {}, sortQuery = {}) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).find(query, {sort: sortQuery}).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tfindWithOptions: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\toptions: {\n\t\t\t\t\ttype: PaginationOptionsSchema\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query: Object, options: PaginationOptions) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tlet optionsQuery = {};\n\n\t\t\t\t\t\tif (options.fields && Object.keys(options.fields).length) {\n\t\t\t\t\t\t\toptionsQuery['projection'] = options.fields;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.sort && Object.keys(options.sort).length) {\n\t\t\t\t\t\t\toptionsQuery['sort'] = options.sort;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.limit) {\n\t\t\t\t\t\t\toptionsQuery['limit'] = options.limit;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (options.skip) {\n\t\t\t\t\t\t\toptionsQuery['skip'] = options.skip;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).find(query, optionsQuery).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Insert 1 document\n\t\t// @Inputs: collection, document\n\t\t// @Outputs: res = _id of new document, err = not inserted\n\t\tinsertDocument: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdocument: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, document: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tlet id = objectIdHexString();\n\t\t\t\t\t\tdocument['_id'] = id;\n\t\t\t\t\t\tdocument['__v'] = 0;\n\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).insertOne(document).then(() => resolve(id), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Insert 1 document\n\t\t// @Inputs: collection, document\n\t\t// @Outputs: res = _id of new document, err = not inserted\n\t\tinsertManyDocuments: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdocuments: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'documents.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, documents: Object[]) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tdocuments.forEach(document => {\n\t\t\t\t\t\t\tdocument['_id'] = objectIdHexString();\n\t\t\t\t\t\t\tdocument['__v'] = 0;\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).insertMany(documents).then(() => resolve(documents.map(a => a['_id'])), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Replaces 1 document with new document (from _id)\n\t\t// @Inputs: collection, document id\n\t\t// @Outputs: res = 1 (updated 1), err = not updated/wrong version\n\t\t// Search for doc, check version, if found then try and update\n\t\tupdateDocument: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tf_document: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, f_document: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: f_document['_id']}, f_document).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\t// Updates 1 document's props (from _id)\n\t\t// @Inputs: collection, document id, document version, update paramters ({prop: 'xxx', data: 'yyy})\n\t\t// @Outputs: res = 1 (updated 1), res = 0 (not updated), err = not updated/wrong version\n\t\t// Search for doc, check version, if found then try and update props\n\t\tupdateDocumentProps: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdoc_id: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tupdateParams: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'updateParams.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tdoc__v: {\n\t\t\t\t\ttype: Number\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, doc_id: string, updateParams: any[], doc__v: number) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne({_id: doc_id}).then(currDoc => {\n\t\t\t\t\t\t\tif (currDoc) {\n\t\t\t\t\t\t\t\tlet modifiedDoc = deepCopy(currDoc);\n\n\t\t\t\t\t\t\t\tupdateParams.forEach(data => {\n\t\t\t\t\t\t\t\t\tmodifiedDoc[data.prop] = data.data;\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (modifiedDoc.__v === doc__v) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: modifiedDoc._id}, modifiedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tconsole.log(new Date(), 'invalid version - ' + collection, currDoc.__v, doc__v);\n\n\t\t\t\t\t\t\t\t\tif (ResolveIOServer.getMongoManager().collection(collection + '.versions')) {\n\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection + '.versions').findOne({\n\t\t\t\t\t\t\t\t\t\t\t$and: [\n\t\t\t\t\t\t\t\t\t\t\t\t{'_id._id': currDoc._id},\n\t\t\t\t\t\t\t\t\t\t\t\t{'_id.__v': doc__v}\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t}).then(oldDoc => {\n\t\t\t\t\t\t\t\t\t\t\tlet newCurrDocId = currDoc._id;\n\n\t\t\t\t\t\t\t\t\t\t\tif (oldDoc) {\n\t\t\t\t\t\t\t\t\t\t\t\tlet updatedDoc = getMongoMergeUpdatedDoc(modifiedDoc, currDoc, oldDoc);\n\t\t\t\t\t\t\t\t\t\t\t\tupdatedDoc._id = newCurrDocId;\n\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: newCurrDocId}, updatedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\t\t\treject('Invalid Version And Could Not Find History Props - DB: ' + currDoc.__v + ', Trying to update with :' + doc__v);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}, () => {});\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\treject('Invalid Version And We Are NOT Using Versions On This Collection!');\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject('No Document');\n\t\t\t\t\t\t\t}\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\tupdateDocumentOffline: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tf_document: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tf_oldDocument: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, f_document: Object, f_oldDocument: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne({_id: f_document['_id']}).then(currDoc => {\n\t\t\t\t\t\t\tif (currDoc) {\n\t\t\t\t\t\t\t\tif (currDoc.__v === f_document['__v']) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: f_document['_id']}, f_document, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tconsole.log('OFFLINE - invalid version - ' + collection, currDoc.__v, f_document['__v']);\n\n\t\t\t\t\t\t\t\t\tlet newCurrDocId = currDoc._id;\n\n\t\t\t\t\t\t\t\t\tif (f_oldDocument) {\n\t\t\t\t\t\t\t\t\t\tlet updatedDoc = getMongoMergeUpdatedDoc(f_document, currDoc, f_oldDocument);\n\t\t\t\t\t\t\t\t\t\tupdatedDoc._id = newCurrDocId;\n\n\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: newCurrDocId}, updatedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\treject('OFFLINE - Invalid Version And Could Not Find History - DB: ' + currDoc.__v + ', Trying to update with :' + f_document['__v']);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject('No Document');\n\t\t\t\t\t\t\t}\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\t// Updates 1 document's props (from _id)\n\t\t// @Inputs: collection, document id, document version, update paramters ({prop: 'xxx', data: 'yyy})\n\t\t// @Outputs: res = 1 (updated 1), res = 0 (not updated), err = not updated/wrong version\n\t\t// Search for doc, check version, if found then try and update props\n\t\tupdateDocumentPropsOffline: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdoc_id: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tupdateParams: {\n\t\t\t\t\ttype: Array\n\t\t\t\t},\n\t\t\t\t'updateParams.$': {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t},\n\t\t\t\tdoc__v: {\n\t\t\t\t\ttype: Number\n\t\t\t\t},\n\t\t\t\tf_oldDocument: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, doc_id: string, updateParams: any[], doc__v: number, f_oldDocument: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).findOne({_id: doc_id}).then(currDoc => {\n\t\t\t\t\t\t\tif (currDoc) {\n\t\t\t\t\t\t\t\tlet modifiedDoc = deepCopy(currDoc);\n\n\t\t\t\t\t\t\t\tupdateParams.forEach(data => {\n\t\t\t\t\t\t\t\t\tmodifiedDoc[data.prop] = data.data;\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\tif (modifiedDoc.__v === doc__v) {\n\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: modifiedDoc._id}, modifiedDoc, {}, false, true).then(res => {\n\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tconsole.log('OFFLINE - invalid version - ' + collection, currDoc.__v, doc__v);\n\n\t\t\t\t\t\t\t\t\tlet newCurrDocId = currDoc._id;\n\n\t\t\t\t\t\t\t\t\tif (f_oldDocument) {\n\t\t\t\t\t\t\t\t\t\tlet updatedDoc = getMongoMergeUpdatedDoc(modifiedDoc, currDoc, f_oldDocument);\n\t\t\t\t\t\t\t\t\t\tupdatedDoc._id = newCurrDocId;\n\n\t\t\t\t\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).replaceOne({_id: newCurrDocId}, updatedDoc).then(res => {\n\t\t\t\t\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t\t\t\t\t}, err => reject(err));\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\t\treject('OFFLINE - Invalid Version And Could Not Find History Props - DB: ' + currDoc.__v + ', Trying to update with :' + modifiedDoc.__v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\treject('No Document');\n\t\t\t\t\t\t\t}\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\t// Removes 1 document (from _id)\n\t\t// @Inputs: collection, document id\n\t\t// @Outputs: res = 1 (deleted), res = 0 (not deleted), err = not deleted\n\t\t// Search for doc, if found then try and remove\n\t\tremoveDocument: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tdoc_id: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, doc_id: string) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).deleteOne({_id: doc_id}).then(res => {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\treject(err);\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\tremoveDocumentWithQuery: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).deleteOne(query).then(res => {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\treject(err);\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\tremoveDocumentsWithQuery: {\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollection: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collection: string, query: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collection)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collection).deleteMany(query).then(res => {\n\t\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t\t}, err => {\n\t\t\t\t\t\t\treject(err);\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}"]}
|
package/methods/counters.js
CHANGED
|
@@ -1,37 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.loadCounterMethods = void 0;
|
|
40
|
+
var counter_collection_1 = require("../collections/counter.collection");
|
|
41
|
+
var simpl_schema_1 = require("simpl-schema");
|
|
42
|
+
var __1 = require("..");
|
|
43
|
+
var mongo_manager_1 = require("../managers/mongo.manager");
|
|
44
|
+
function loadCounterMethods(methodManager) {
|
|
6
45
|
methodManager.methods({
|
|
7
46
|
incCounter: {
|
|
8
47
|
skipQueue: true,
|
|
9
|
-
check: new
|
|
48
|
+
check: new simpl_schema_1.default({
|
|
10
49
|
counterType: {
|
|
11
50
|
type: String
|
|
12
51
|
}
|
|
13
52
|
}),
|
|
14
53
|
function: function (counterType) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
54
|
+
var _this = this;
|
|
55
|
+
return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
|
|
56
|
+
var counter, newCount;
|
|
57
|
+
return __generator(this, function (_a) {
|
|
58
|
+
switch (_a.label) {
|
|
59
|
+
case 0: return [4 /*yield*/, counter_collection_1.Counters.findOne({ type: counterType })];
|
|
60
|
+
case 1:
|
|
61
|
+
counter = _a.sent();
|
|
62
|
+
if (!!counter) return [3 /*break*/, 2];
|
|
63
|
+
counter_collection_1.Counters.create({
|
|
64
|
+
_id: mongo_manager_1.objectIdHexString(),
|
|
65
|
+
count: 2,
|
|
66
|
+
type: counterType
|
|
67
|
+
});
|
|
68
|
+
resolve(1);
|
|
69
|
+
return [3 /*break*/, 4];
|
|
70
|
+
case 2: return [4 /*yield*/, counter_collection_1.Counters.findOneAndUpdate({ type: counterType }, { $inc: { count: 1 } })];
|
|
71
|
+
case 3:
|
|
72
|
+
newCount = _a.sent();
|
|
73
|
+
resolve(newCount.count);
|
|
74
|
+
_a.label = 4;
|
|
75
|
+
case 4: return [2 /*return*/];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}); });
|
|
30
79
|
}
|
|
31
80
|
},
|
|
32
81
|
countCollectionWithQuery: {
|
|
33
82
|
skipQueue: true,
|
|
34
|
-
check: new
|
|
83
|
+
check: new simpl_schema_1.default({
|
|
35
84
|
collectionType: {
|
|
36
85
|
type: String
|
|
37
86
|
},
|
|
@@ -41,35 +90,36 @@ export function loadCounterMethods(methodManager) {
|
|
|
41
90
|
}
|
|
42
91
|
}),
|
|
43
92
|
function: function (collectionType, query) {
|
|
44
|
-
return new Promise((resolve, reject)
|
|
45
|
-
if (!ResolveIOServer.getMongoManager().collection(collectionType)) {
|
|
93
|
+
return new Promise(function (resolve, reject) {
|
|
94
|
+
if (!__1.ResolveIOServer.getMongoManager().collection(collectionType)) {
|
|
46
95
|
reject('Invalid collection');
|
|
47
96
|
}
|
|
48
97
|
else {
|
|
49
|
-
ResolveIOServer.getMongoManager().collection(collectionType).countDocuments(query).then(res
|
|
98
|
+
__1.ResolveIOServer.getMongoManager().collection(collectionType).countDocuments(query).then(function (res) { return resolve(res); }, function (err) { return reject(err); });
|
|
50
99
|
}
|
|
51
100
|
});
|
|
52
101
|
}
|
|
53
102
|
},
|
|
54
103
|
countCollection: {
|
|
55
104
|
skipQueue: true,
|
|
56
|
-
check: new
|
|
105
|
+
check: new simpl_schema_1.default({
|
|
57
106
|
collectionType: {
|
|
58
107
|
type: String
|
|
59
108
|
}
|
|
60
109
|
}),
|
|
61
110
|
function: function (collectionType) {
|
|
62
|
-
return new Promise((resolve, reject)
|
|
63
|
-
if (!ResolveIOServer.getMongoManager().collection(collectionType)) {
|
|
111
|
+
return new Promise(function (resolve, reject) {
|
|
112
|
+
if (!__1.ResolveIOServer.getMongoManager().collection(collectionType)) {
|
|
64
113
|
reject('Invalid collection');
|
|
65
114
|
}
|
|
66
115
|
else {
|
|
67
|
-
ResolveIOServer.getMongoManager().collection(collectionType).countDocuments().then(res
|
|
116
|
+
__1.ResolveIOServer.getMongoManager().collection(collectionType).countDocuments().then(function (res) { return resolve(res); }, function (err) { return reject(err); });
|
|
68
117
|
}
|
|
69
118
|
});
|
|
70
119
|
}
|
|
71
120
|
}
|
|
72
121
|
});
|
|
73
122
|
}
|
|
123
|
+
exports.loadCounterMethods = loadCounterMethods;
|
|
74
124
|
|
|
75
125
|
//# sourceMappingURL=counters.js.map
|
package/methods/counters.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/methods/counters.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"sources":["../../src/methods/counters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,wEAA6D;AAC7D,6CAAwC;AACxC,wBAAqC;AACrC,2DAA8D;AAE9D,SAAgB,kBAAkB,CAAC,aAA4B;IAC9D,aAAa,CAAC,OAAO,CAAC;QACrB,UAAU,EAAE;YACX,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAI,sBAAY,CAAC;gBACvB,WAAW,EAAE;oBACZ,IAAI,EAAE,MAAM;iBACZ;aACD,CAAC;YACF,QAAQ,EAAE,UAAS,WAAmB;gBAA5B,iBAmBT;gBAlBA,OAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;;oCAC1B,qBAAM,6BAAQ,CAAC,OAAO,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,EAAA;;gCAArD,OAAO,GAAG,SAA2C;qCAErD,CAAC,OAAO,EAAR,wBAAQ;gCACX,6BAAQ,CAAC,MAAM,CAAC;oCACf,GAAG,EAAE,iCAAiB,EAAE;oCACxB,KAAK,EAAE,CAAC;oCACR,IAAI,EAAE,WAAW;iCACjB,CAAC,CAAC;g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AAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBAClC,IAAI,CAAC,mBAAe,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE;wBAClE,MAAM,CAAC,oBAAoB,CAAC,CAAC;qBAC7B;yBACI;wBACJ,mBAAe,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,UAAA,GAAG,IAAI,OAAA,OAAO,CAAC,GAAG,CAAC,EAAZ,CAAY,EAAE,UAAA,GAAG,IAAI,OAAA,MAAM,CAAC,GAAG,CAAC,EAAX,CAAW,CAAC,CAAC;qBAC5H;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC;SACD;KACD,CAAC,CAAC;AACJ,CAAC;AAvED,gDAuEC","file":"counters.js","sourcesContent":["import { MethodManager } from '../managers/method.manager';\nimport { Counters } from '../collections/counter.collection';\nimport SimpleSchema from 'simpl-schema';\nimport { ResolveIOServer } from '..';\nimport { objectIdHexString } from '../managers/mongo.manager';\n\nexport function loadCounterMethods(methodManager: MethodManager) {\n\tmethodManager.methods({\n\t\tincCounter: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcounterType: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(counterType: string) {\n\t\t\t\treturn new Promise(async (resolve, reject) => {\n\t\t\t\t\tlet counter = await Counters.findOne({type: counterType});\n\n\t\t\t\t\tif (!counter) {\n\t\t\t\t\t\tCounters.create({\n\t\t\t\t\t\t\t_id: objectIdHexString(),\n\t\t\t\t\t\t\tcount: 2,\n\t\t\t\t\t\t\ttype: counterType\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tresolve(1);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tlet newCount = await Counters.findOneAndUpdate({type: counterType}, {$inc: {count: 1}});\n\n\t\t\t\t\t\tresolve(newCount.count);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcountCollectionWithQuery: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollectionType: {\n\t\t\t\t\ttype: String\n\t\t\t\t},\n\t\t\t\tquery: {\n\t\t\t\t\ttype: Object,\n\t\t\t\t\tblackbox: true\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collectionType: string, query: Object) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collectionType)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collectionType).countDocuments(query).then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tcountCollection: {\n\t\t\tskipQueue: true,\n\t\t\tcheck: new SimpleSchema({\n\t\t\t\tcollectionType: {\n\t\t\t\t\ttype: String\n\t\t\t\t}\n\t\t\t}),\n\t\t\tfunction: function(collectionType: string) {\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\tif (!ResolveIOServer.getMongoManager().collection(collectionType)) {\n\t\t\t\t\t\treject('Invalid collection');\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tResolveIOServer.getMongoManager().collection(collectionType).countDocuments().then(res => resolve(res), err => reject(err));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t});\n}"]}
|