@cocreate/lazy-loader 1.11.1 → 1.11.3
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 +14 -0
- package/package.json +1 -1
- package/src/server.js +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.11.3](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.11.2...v1.11.3) (2023-12-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* organization_id ([6b907e8](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/6b907e86bd64eb6c45abd592f698a615a032b7e7))
|
|
7
|
+
|
|
8
|
+
## [1.11.2](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.11.1...v1.11.2) (2023-12-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* this.modules ([7839c7f](https://github.com/CoCreate-app/CoCreate-lazy-loader/commit/7839c7f73e68f967a20613ffe53b1b3deb4f7f62))
|
|
14
|
+
|
|
1
15
|
## [1.11.1](https://github.com/CoCreate-app/CoCreate-lazy-loader/compare/v1.11.0...v1.11.1) (2023-12-09)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -34,15 +34,13 @@ class CoCreateLazyLoader {
|
|
|
34
34
|
// Call this function at the start of your application
|
|
35
35
|
createScriptsDirectory();
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const config = await Config('modules', false, false)
|
|
41
|
-
if (!config)
|
|
37
|
+
this.modules = await Config('modules', false, false)
|
|
38
|
+
if (!this.modules)
|
|
42
39
|
return
|
|
40
|
+
else
|
|
41
|
+
this.modules = this.modules.modules
|
|
43
42
|
|
|
44
|
-
for (let name of Object.keys(
|
|
45
|
-
this.modules[name] = config.modules[name];
|
|
43
|
+
for (let name of Object.keys(this.modules)) {
|
|
46
44
|
this.wsManager.on(this.modules[name].event, async (data) => {
|
|
47
45
|
this.executeScriptWithTimeout(name, data)
|
|
48
46
|
});
|
|
@@ -73,14 +71,15 @@ class CoCreateLazyLoader {
|
|
|
73
71
|
} else {
|
|
74
72
|
organization = org.object[0]
|
|
75
73
|
organizations[organization._id] = organization
|
|
76
|
-
hosts[hostname] = organization
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
|
|
77
|
+
hosts[hostname] = organization
|
|
78
|
+
|
|
80
79
|
if (valideUrl.pathname.startsWith('/webhooks/')) {
|
|
81
80
|
let name = req.url.split('/')[2]; // Assuming URL structure is /webhook/name/...
|
|
82
81
|
if (this.modules[name]) {
|
|
83
|
-
this.executeScriptWithTimeout(name, { req, res, crud: this.crud, organization, valideUrl })
|
|
82
|
+
this.executeScriptWithTimeout(name, { req, res, crud: this.crud, organization, valideUrl, organization_id: organization._id })
|
|
84
83
|
} else {
|
|
85
84
|
// Handle unknown module or missing webhook method
|
|
86
85
|
res.writeHead(404, { 'Content-Type': 'application/json' });
|