hop-message 0.0.5 → 0.0.6
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/package.json +1 -1
- package/src/dml/index.js +36 -0
- package/src/index.js +12 -1
package/package.json
CHANGED
package/src/dml/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/**
|
|
3
|
+
* dml - message validation & routing
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @class DmlValidateroute
|
|
7
|
+
* @package SafeflowRoute
|
|
8
|
+
* @copyright Copyright (c) 2022 James Littlejohn
|
|
9
|
+
* @license http://www.gnu.org/licenses/old-licenses/gpl-3.0.html
|
|
10
|
+
* @version $Id$
|
|
11
|
+
*/
|
|
12
|
+
import util from 'util'
|
|
13
|
+
import EventEmitter from 'events'
|
|
14
|
+
|
|
15
|
+
class DmlValidateroute extends EventEmitter {
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
super()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* type of dml message?
|
|
23
|
+
* @method assessMessage
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
assessMessage = function (options) {
|
|
27
|
+
let messageRoute = {}
|
|
28
|
+
messageRoute.type = options.type
|
|
29
|
+
messageRoute.action = options.action
|
|
30
|
+
messageRoute.data = options.data
|
|
31
|
+
return messageRoute
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default DmlValidateroute
|
package/src/index.js
CHANGED
|
@@ -13,6 +13,7 @@ import util from 'util'
|
|
|
13
13
|
import EventEmitter from 'events'
|
|
14
14
|
import SfRoute from './safeflow/index.js'
|
|
15
15
|
import LibraryRoute from './library/index.js'
|
|
16
|
+
import DmlValidateroute from './library/index.js'
|
|
16
17
|
// import HyperRoute from './hyperspace/index.js'
|
|
17
18
|
|
|
18
19
|
class HopMessages extends EventEmitter {
|
|
@@ -21,6 +22,7 @@ class HopMessages extends EventEmitter {
|
|
|
21
22
|
super()
|
|
22
23
|
this.routeSafeflow = new SfRoute()
|
|
23
24
|
this.routeLibrary = new LibraryRoute()
|
|
25
|
+
this.routeDML = new DmlValidateroute ()
|
|
24
26
|
// this.routeHyper = new HyperRoute()
|
|
25
27
|
}
|
|
26
28
|
|
|
@@ -33,7 +35,7 @@ class HopMessages extends EventEmitter {
|
|
|
33
35
|
let routeMessage = {}
|
|
34
36
|
// verifty -> route ECS or back to network (or both)
|
|
35
37
|
let verifyState = this.verifyMessage()
|
|
36
|
-
// library sf-ECS data-API AI
|
|
38
|
+
// library sf-ECS data-API AI DML
|
|
37
39
|
if (verifyState === true) {
|
|
38
40
|
if (message.type === 'launch') {
|
|
39
41
|
routeMessage.type = 'launch'
|
|
@@ -53,6 +55,15 @@ class HopMessages extends EventEmitter {
|
|
|
53
55
|
} else if (message.type.trim() === 'bbai') {
|
|
54
56
|
// routeMessage = this.routeBBAi(options)
|
|
55
57
|
routeMessage.type = 'bbai-reply'
|
|
58
|
+
routeMessage.bbid = message.bbid
|
|
59
|
+
routeMessage.reftype = 'ignore'
|
|
60
|
+
routeMessage.action = message.action
|
|
61
|
+
routeMessage.data = message.data
|
|
62
|
+
} else if (message.type.trim() === 'dml') {
|
|
63
|
+
console.log('dml message')
|
|
64
|
+
routeMessage = this.routeDML(options)
|
|
65
|
+
routeMessage.type = 'dml-reply'
|
|
66
|
+
routeMessage.bbid = message.bbid
|
|
56
67
|
routeMessage.reftype = 'ignore'
|
|
57
68
|
routeMessage.action = message.action
|
|
58
69
|
routeMessage.data = message.data
|