compass-user-model 1.26.1 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +1 -1
- package/lib/model.js +13 -13
- package/package.json +6 -6
package/index.js
CHANGED
package/lib/model.js
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
const Model = require('ampersand-model');
|
2
|
+
const storageMixin = require('storage-mixin');
|
3
|
+
const uuid = require('uuid');
|
4
|
+
const compassUtils = require('@mongodb-js/compass-utils');
|
5
|
+
const basepath = (compassUtils.getStoragePaths() || {}).basepath;
|
6
6
|
|
7
|
-
//
|
7
|
+
// const debug = require('debug')('scout:user');
|
8
8
|
|
9
|
-
|
9
|
+
const User = Model.extend(storageMixin, {
|
10
10
|
idAttribute: 'id',
|
11
11
|
namespace: 'Users',
|
12
12
|
storage: {
|
13
13
|
backend: 'disk',
|
14
|
-
basepath:
|
14
|
+
basepath: basepath
|
15
15
|
},
|
16
16
|
props: {
|
17
17
|
id: {
|
@@ -37,8 +37,8 @@ var User = Model.extend(storageMixin, {
|
|
37
37
|
}
|
38
38
|
});
|
39
39
|
|
40
|
-
User.getOrCreate =
|
41
|
-
|
40
|
+
User.getOrCreate = (id) => new Promise((resolve, reject) => {
|
41
|
+
const user = new User({
|
42
42
|
id: id || uuid.v4(),
|
43
43
|
createdAt: new Date()
|
44
44
|
});
|
@@ -47,12 +47,12 @@ User.getOrCreate = function(id, done) {
|
|
47
47
|
user.save({
|
48
48
|
lastUsed: new Date()
|
49
49
|
});
|
50
|
-
|
50
|
+
resolve(user);
|
51
51
|
},
|
52
52
|
error: function(model, err) {
|
53
|
-
|
53
|
+
reject(err);
|
54
54
|
}
|
55
55
|
});
|
56
|
-
};
|
56
|
+
});
|
57
57
|
|
58
58
|
module.exports = User;
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "compass-user-model",
|
3
3
|
"description": "MongoDB user model.",
|
4
4
|
"author": "Lucas Hrabovsky <lucas@mongodb.com>",
|
5
|
-
"version": "1.
|
5
|
+
"version": "2.1.1",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://jira.mongodb.org/projects/COMPASS/issues",
|
8
8
|
"email": "compass@mongodb.com"
|
@@ -40,20 +40,20 @@
|
|
40
40
|
"ampersand-state": "5.0.3",
|
41
41
|
"debug": "^2.2.0",
|
42
42
|
"lodash.get": "^4.4.2",
|
43
|
-
"mongodb-collection-model": "^
|
44
|
-
"mongodb-database-model": "^1.
|
43
|
+
"mongodb-collection-model": "^5.1.1",
|
44
|
+
"mongodb-database-model": "^2.1.1",
|
45
45
|
"mongodb-ns": "^2.4.0",
|
46
46
|
"raf": "^3.4.1",
|
47
|
-
"storage-mixin": "^
|
47
|
+
"storage-mixin": "^5.1.0",
|
48
48
|
"uuid": "^3.3.2"
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
|
+
"@mongodb-js/compass-utils": "^0.1.1",
|
51
52
|
"depcheck": "^1.4.1",
|
52
|
-
"electron": "^13.5.1",
|
53
53
|
"eslint": "^7.25.0",
|
54
54
|
"eslint-config-mongodb-js": "^3.0.1",
|
55
55
|
"lodash.result": "^4.5.2",
|
56
56
|
"mocha": "^6.0.2"
|
57
57
|
},
|
58
|
-
"gitHead": "
|
58
|
+
"gitHead": "51f04a0ac45c3b51a3ffb98af390c811d1404380"
|
59
59
|
}
|