@friggframework/core 1.2.1 → 1.2.3--canary.325.a6ba792.0
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 +0 -13
- package/integrations/integration-base.js +10 -19
- package/module-plugin/module-factory.js +17 -18
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
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
|
-
|
|
14
1
|
# v1.2.0 (Tue Aug 06 2024)
|
|
15
2
|
|
|
16
3
|
:tada: This release contains work from a new contributor! :tada:
|
|
@@ -27,9 +27,7 @@ class IntegrationBase {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
//psuedo delegate for backwards compatability
|
|
30
|
-
async receiveNotification(notifier, delegateString, object = null) {
|
|
31
|
-
|
|
32
|
-
}
|
|
30
|
+
async receiveNotification(notifier, delegateString, object = null) {}
|
|
33
31
|
|
|
34
32
|
async notify(delegateString, object = null) {
|
|
35
33
|
if (!this.delegateTypes.includes(delegateString)) {
|
|
@@ -37,11 +35,7 @@ class IntegrationBase {
|
|
|
37
35
|
`delegateString:${delegateString} is not defined in delegateTypes`
|
|
38
36
|
);
|
|
39
37
|
}
|
|
40
|
-
return this.receiveNotification(
|
|
41
|
-
this,
|
|
42
|
-
delegateString,
|
|
43
|
-
object
|
|
44
|
-
);
|
|
38
|
+
return this.receiveNotification(this, delegateString, object);
|
|
45
39
|
}
|
|
46
40
|
|
|
47
41
|
async validateConfig() {
|
|
@@ -130,8 +124,6 @@ class IntegrationBase {
|
|
|
130
124
|
return this.userActions;
|
|
131
125
|
}
|
|
132
126
|
|
|
133
|
-
|
|
134
|
-
|
|
135
127
|
/**
|
|
136
128
|
* CHILDREN CAN OVERRIDE THESE CONFIGURATION METHODS
|
|
137
129
|
*/
|
|
@@ -141,10 +133,9 @@ class IntegrationBase {
|
|
|
141
133
|
return this.record;
|
|
142
134
|
}
|
|
143
135
|
|
|
144
|
-
async onUpdate(params) {
|
|
145
|
-
}
|
|
136
|
+
async onUpdate(params) {}
|
|
146
137
|
|
|
147
|
-
async onDelete(params) {
|
|
138
|
+
async onDelete(params) {}
|
|
148
139
|
|
|
149
140
|
async getConfigOptions() {
|
|
150
141
|
const options = {
|
|
@@ -158,8 +149,8 @@ class IntegrationBase {
|
|
|
158
149
|
const options = {
|
|
159
150
|
jsonSchema: {},
|
|
160
151
|
uiSchema: {},
|
|
161
|
-
}
|
|
162
|
-
return options
|
|
152
|
+
};
|
|
153
|
+
return options;
|
|
163
154
|
}
|
|
164
155
|
|
|
165
156
|
async getUserActions() {
|
|
@@ -170,16 +161,16 @@ class IntegrationBase {
|
|
|
170
161
|
const options = {
|
|
171
162
|
jsonSchema: {},
|
|
172
163
|
uiSchema: {},
|
|
173
|
-
}
|
|
174
|
-
return options
|
|
164
|
+
};
|
|
165
|
+
return options;
|
|
175
166
|
}
|
|
176
167
|
|
|
177
168
|
async refreshActionOptions(params) {
|
|
178
169
|
const options = {
|
|
179
170
|
jsonSchema: {},
|
|
180
171
|
uiSchema: {},
|
|
181
|
-
}
|
|
182
|
-
return options
|
|
172
|
+
};
|
|
173
|
+
return options;
|
|
183
174
|
}
|
|
184
175
|
}
|
|
185
176
|
|
|
@@ -1,10 +1,12 @@
|
|
|
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(
|
|
7
|
+
this.moduleTypes = this.moduleDefinitions.map(
|
|
8
|
+
(def) => def.moduleName
|
|
9
|
+
);
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
async getEntitiesForUser(userId) {
|
|
@@ -12,7 +14,7 @@ class ModuleFactory {
|
|
|
12
14
|
for (const moduleDefinition of this.moduleDefinitions) {
|
|
13
15
|
const moduleInstance = await Auther.getInstance({
|
|
14
16
|
userId,
|
|
15
|
-
definition: moduleDefinition
|
|
17
|
+
definition: moduleDefinition
|
|
16
18
|
});
|
|
17
19
|
const list = await moduleInstance.getEntitiesForUserId(userId);
|
|
18
20
|
results.push(...list);
|
|
@@ -25,36 +27,33 @@ class ModuleFactory {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
getModuleDefinitionFromTypeName(typeName) {
|
|
28
|
-
return
|
|
30
|
+
return
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
|
|
31
34
|
async getModuleInstanceFromEntityId(entityId, userId) {
|
|
32
35
|
const entity = await Entity.findById(entityId);
|
|
33
36
|
const moduleDefinition = this.moduleDefinitions.find(
|
|
34
|
-
(def) =>
|
|
35
|
-
|
|
36
|
-
Auther.getEntityModelFromDefinition(def).modelName
|
|
37
|
-
);
|
|
37
|
+
(def) => entity['__t'] === Auther.getEntityModelFromDefinition(def).modelName
|
|
38
|
+
)
|
|
38
39
|
if (!moduleDefinition) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
'Module definition not found for entity type: ' + entity['__t']
|
|
41
|
-
);
|
|
40
|
+
throw new Error('Module definition not found for entity type: ' + entity['__t']);
|
|
42
41
|
}
|
|
43
42
|
return await Auther.getInstance({
|
|
44
43
|
userId,
|
|
45
44
|
entityId,
|
|
46
|
-
definition: moduleDefinition
|
|
45
|
+
definition: moduleDefinition
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
const moduleDefinition =
|
|
49
|
+
async getInstanceFromTypeName(typeName, userId) {
|
|
50
|
+
const moduleDefinition =this.moduleDefinitions.find(
|
|
52
51
|
(def) => def.getName() === typeName
|
|
53
52
|
);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
return await Auther.getInstance({
|
|
54
|
+
userId,
|
|
55
|
+
definition: moduleDefinition
|
|
56
|
+
});
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
|
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.3--canary.325.a6ba792.0",
|
|
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": "
|
|
19
|
-
"@friggframework/prettier-config": "
|
|
20
|
-
"@friggframework/test": "
|
|
18
|
+
"@friggframework/eslint-config": "1.2.3--canary.325.a6ba792.0",
|
|
19
|
+
"@friggframework/prettier-config": "1.2.3--canary.325.a6ba792.0",
|
|
20
|
+
"@friggframework/test": "1.2.3--canary.325.a6ba792.0",
|
|
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": "a6ba792fd5a3d66c761647feb3c7e622a9eacddb"
|
|
52
52
|
}
|