@drayman/framework 1.6.0 → 1.9.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/*! For license information please see index.js.LICENSE.txt */
|
package/dist/commands/start.js
CHANGED
|
@@ -31,7 +31,7 @@ const ws_1 = __importDefault(require("ws"));
|
|
|
31
31
|
const build_1 = require("./build");
|
|
32
32
|
const config_1 = require("../config");
|
|
33
33
|
(async () => {
|
|
34
|
-
const { publicDir, port, componentsOutputDir } = (0, config_1.getDraymanConfig)();
|
|
34
|
+
const { publicDir, port, componentsOutputDir, outDir } = (0, config_1.getDraymanConfig)();
|
|
35
35
|
const elementsPaths = await draymanCore.getElementsScriptPaths({});
|
|
36
36
|
await (0, build_1.build)();
|
|
37
37
|
const storage = multer_1.default.memoryStorage();
|
|
@@ -42,6 +42,14 @@ const config_1 = require("../config");
|
|
|
42
42
|
app.get('/drayman-framework-client.js', function (req, res) {
|
|
43
43
|
res.sendFile(path_1.default.join(__dirname, '../../client/dist/index.js'));
|
|
44
44
|
});
|
|
45
|
+
let Server;
|
|
46
|
+
try {
|
|
47
|
+
Server = await (await Promise.resolve().then(() => __importStar(require(path_1.default.join(process.cwd(), outDir, 'index.js'))))).Server({
|
|
48
|
+
app,
|
|
49
|
+
emit: (callbackId, data) => draymanCore.onHandleBrowserCallback({ callbackId, data })
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (err) { }
|
|
45
53
|
app.post('/api/componentEvent', upload.any(), async (req, res, next) => {
|
|
46
54
|
try {
|
|
47
55
|
const { componentInstanceId, eventName } = req.body;
|
|
@@ -111,9 +119,19 @@ const config_1 = require("../config");
|
|
|
111
119
|
componentInstanceId,
|
|
112
120
|
componentOptions,
|
|
113
121
|
connectionId,
|
|
114
|
-
emit: (message) =>
|
|
122
|
+
emit: async (message) => {
|
|
123
|
+
if (message.type === 'serverCommand') {
|
|
124
|
+
const { data, callbackId, command } = message.payload;
|
|
125
|
+
const result = await Server[command](data);
|
|
126
|
+
draymanCore.onHandleBrowserCallback({ callbackId, data: result });
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
ws.send(JSON.stringify({ data: message, type: 'event' }));
|
|
130
|
+
}
|
|
131
|
+
},
|
|
115
132
|
onComponentInstanceConsole: ({ text }) => { console.log(text); },
|
|
116
133
|
browserCommands,
|
|
134
|
+
serverCommands: Object.keys(Server || {}),
|
|
117
135
|
});
|
|
118
136
|
}
|
|
119
137
|
else if (type === 'eventHubEvent') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drayman/framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "ISC",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@drayman/core": "^1.
|
|
23
|
+
"@drayman/core": "^1.9.0",
|
|
24
24
|
"cup-readdir": "^1.0.3",
|
|
25
25
|
"express": "^4.17.1",
|
|
26
26
|
"fs-extra": "^9.1.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@drayman/elements": "latest",
|
|
37
|
-
"@drayman/types": "^1.
|
|
37
|
+
"@drayman/types": "^1.8.0",
|
|
38
38
|
"@types/express": "^4.17.11",
|
|
39
39
|
"@types/fs-extra": "^9.0.11",
|
|
40
40
|
"@types/multer": "^1.4.5",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"npm": "^7.10.0",
|
|
48
48
|
"start-server-and-test": "^1.12.1"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "828de3167180b8e7920b86c9d44da55a7577961c"
|
|
51
51
|
}
|