@friggframework/core 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/module-plugin/module-factory.js +18 -17
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
# v1.2.1 (Thu Aug 08 2024)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Fix bug during local running [#326](https://github.com/friggframework/frigg/pull/326) ([@seanspeaks](https://github.com/seanspeaks))
|
|
6
|
+
- Adding toJSON so that the descriminator decorator will be evaluated/added to the mongoose model (currently undefined on initialization and first invocation) ([@seanspeaks](https://github.com/seanspeaks))
|
|
7
|
+
|
|
8
|
+
#### Authors: 1
|
|
9
|
+
|
|
10
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
1
14
|
# v1.2.0 (Tue Aug 06 2024)
|
|
2
15
|
|
|
3
16
|
:tada: This release contains work from a new contributor! :tada:
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
const { Entity } = require(
|
|
1
|
+
const { Entity } = require('./entity');
|
|
2
2
|
const { Auther } = require('./auther');
|
|
3
3
|
|
|
4
4
|
class ModuleFactory {
|
|
5
5
|
constructor(...params) {
|
|
6
6
|
this.moduleDefinitions = params;
|
|
7
|
-
this.moduleTypes = this.moduleDefinitions.map(
|
|
8
|
-
(def) => def.moduleName
|
|
9
|
-
);
|
|
7
|
+
this.moduleTypes = this.moduleDefinitions.map((def) => def.moduleName);
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
async getEntitiesForUser(userId) {
|
|
@@ -14,7 +12,7 @@ class ModuleFactory {
|
|
|
14
12
|
for (const moduleDefinition of this.moduleDefinitions) {
|
|
15
13
|
const moduleInstance = await Auther.getInstance({
|
|
16
14
|
userId,
|
|
17
|
-
definition: moduleDefinition
|
|
15
|
+
definition: moduleDefinition,
|
|
18
16
|
});
|
|
19
17
|
const list = await moduleInstance.getEntitiesForUserId(userId);
|
|
20
18
|
results.push(...list);
|
|
@@ -27,33 +25,36 @@ class ModuleFactory {
|
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
getModuleDefinitionFromTypeName(typeName) {
|
|
30
|
-
return
|
|
28
|
+
return;
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
|
|
34
31
|
async getModuleInstanceFromEntityId(entityId, userId) {
|
|
35
32
|
const entity = await Entity.findById(entityId);
|
|
36
33
|
const moduleDefinition = this.moduleDefinitions.find(
|
|
37
|
-
(def) =>
|
|
38
|
-
|
|
34
|
+
(def) =>
|
|
35
|
+
entity.toJSON()['__t'] ===
|
|
36
|
+
Auther.getEntityModelFromDefinition(def).modelName
|
|
37
|
+
);
|
|
39
38
|
if (!moduleDefinition) {
|
|
40
|
-
throw new Error(
|
|
39
|
+
throw new Error(
|
|
40
|
+
'Module definition not found for entity type: ' + entity['__t']
|
|
41
|
+
);
|
|
41
42
|
}
|
|
42
43
|
return await Auther.getInstance({
|
|
43
44
|
userId,
|
|
44
45
|
entityId,
|
|
45
|
-
definition: moduleDefinition
|
|
46
|
+
definition: moduleDefinition,
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
const moduleDefinition =this.moduleDefinitions.find(
|
|
50
|
+
async getInstanceFromTypeName(typeName, userId) {
|
|
51
|
+
const moduleDefinition = this.moduleDefinitions.find(
|
|
51
52
|
(def) => def.getName() === typeName
|
|
52
53
|
);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
return await Auther.getInstance({
|
|
55
|
+
userId,
|
|
56
|
+
definition: moduleDefinition,
|
|
57
|
+
});
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@hapi/boom": "^10.0.1",
|
|
7
7
|
"aws-sdk": "^2.1200.0",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"node-fetch": "^2.6.7"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@friggframework/eslint-config": "^1.2.
|
|
19
|
-
"@friggframework/prettier-config": "^1.2.
|
|
20
|
-
"@friggframework/test": "^1.2.
|
|
18
|
+
"@friggframework/eslint-config": "^1.2.1",
|
|
19
|
+
"@friggframework/prettier-config": "^1.2.1",
|
|
20
|
+
"@friggframework/test": "^1.2.1",
|
|
21
21
|
"@types/lodash": "^4.14.191",
|
|
22
22
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
23
23
|
"chai": "^4.3.6",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/friggframework/frigg#readme",
|
|
50
50
|
"description": "",
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "3c2bb949c71be314cf44e326e618b3e16b787e8c"
|
|
52
52
|
}
|