@rootintf/protocol-2phw 0.7.1 → 0.7.5-api-0.7
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/README.md +1 -1
- package/dist/twoPhW.cjs.js +756 -758
- package/dist/twoPhW.es.mjs +756 -756
- package/jasmine.json +6 -6
- package/package.json +42 -42
- package/rollup.config.mjs +23 -23
- package/schema/schema_Msg2PhW.json +11 -11
- package/schema/schema_MsgEngage.json +11 -11
- package/schema/schema_MsgOptions.json +10 -10
- package/schema/schema_MsgWarp.json +19 -19
- package/schema/schema_Options_delay.json +16 -16
- package/src/ajv-gen-validate.cjs +23 -23
- package/src/twoPhW.mjs +582 -582
- package/tests/twoPhW-new.spec.mjs +173 -173
- package/tests/twoPhW.test.mjs +175 -175
|
@@ -1,173 +1,173 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
validate_Msg2PhW as validate_Msg2PhW_,
|
|
4
|
-
validate_MsgOptions as validate_MsgOptions_,
|
|
5
|
-
validate_Options_delay as validate_Options_delay_,
|
|
6
|
-
validate_MsgWarp as validate_MsgWarp_,
|
|
7
|
-
validate_MsgEngage as validate_MsgEngage_
|
|
8
|
-
} from '../src/validate-esm.mjs';
|
|
9
|
-
|
|
10
|
-
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
-
import { TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage, l as l_2PhW } from '../src/twoPhW.mjs';
|
|
12
|
-
import { JSON_Msg, JSON_Msg_msg, JSON_MsgAck } from '@rootintf/json-msg'
|
|
13
|
-
|
|
14
|
-
const k_VERSION= "0.
|
|
15
|
-
|
|
16
|
-
var twoPhW= new TwoPhW();
|
|
17
|
-
twoPhW.config.logr= {
|
|
18
|
-
VALIDATION : 1
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const str_uuid_ID_ = uuidv4();
|
|
22
|
-
console.log('str_uuid_ID_= ' + str_uuid_ID_);
|
|
23
|
-
|
|
24
|
-
const json_msgWarp_ = {
|
|
25
|
-
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
26
|
-
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
27
|
-
dt: "2022-10-28T06:26:19.692Z",
|
|
28
|
-
warp: {
|
|
29
|
-
user: {},
|
|
30
|
-
hyperport: {},
|
|
31
|
-
ttl_msec : 30
|
|
32
|
-
},
|
|
33
|
-
"2PhW": k_VERSION
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const json_msgEngage_ = {
|
|
37
|
-
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
38
|
-
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
39
|
-
dt: "2022-10-28T06:26:19.692Z",
|
|
40
|
-
engage: {
|
|
41
|
-
user: {},
|
|
42
|
-
hyperport: {}
|
|
43
|
-
},
|
|
44
|
-
"2PhW": k_VERSION
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const json_msgAckWarp_str_ = {
|
|
48
|
-
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
49
|
-
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
50
|
-
dt: "2022-10-28T06:26:19.692Z",
|
|
51
|
-
ack: {
|
|
52
|
-
"ok" : true,
|
|
53
|
-
},
|
|
54
|
-
"_msg" : JSON.stringify( json_msgWarp_ ),
|
|
55
|
-
"2PhW": k_VERSION
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const json_msgAckWarp_obj_ = {
|
|
59
|
-
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
60
|
-
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
61
|
-
dt: "2022-10-28T06:26:19.692Z",
|
|
62
|
-
ack: {
|
|
63
|
-
"ok" : true,
|
|
64
|
-
},
|
|
65
|
-
"_msg" : json_msgWarp_,
|
|
66
|
-
"2PhW": k_VERSION
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const json_msgAckEngage_ = {
|
|
70
|
-
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
71
|
-
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
72
|
-
dt: "2022-10-28T06:26:19.692Z",
|
|
73
|
-
ack: {
|
|
74
|
-
"ok" : false,
|
|
75
|
-
},
|
|
76
|
-
"_msg" : json_msgEngage_,
|
|
77
|
-
"2PhW": k_VERSION
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
//TODO: "required" : ["reason"],
|
|
81
|
-
const json_msgOptions_ = {
|
|
82
|
-
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
83
|
-
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
84
|
-
dt: "2022-10-28T06:26:19.692Z",
|
|
85
|
-
options: {
|
|
86
|
-
ttl_msec_incr : [ 20000, 4000 ],
|
|
87
|
-
reason : "it is taking too long"
|
|
88
|
-
},
|
|
89
|
-
"_msg" : json_msgWarp_,
|
|
90
|
-
"2PhW": k_VERSION
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
describe("Validation", function () {
|
|
95
|
-
it("JSON_Msg.validate(json_msgWarp_)", function () {
|
|
96
|
-
expect( JSON_Msg.validate(json_msgWarp_) ).toBe(true);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe("Validation", function () {
|
|
101
|
-
it("twoPhW.JSON_MsgOptions.validate(json_msgOptions_)", function () {
|
|
102
|
-
expect( JSON_MsgOptions.validate(json_msgOptions_) ).toBe(true);
|
|
103
|
-
});
|
|
104
|
-
it("validate_Options_delay_(json_msgOptions_.options)", function () {
|
|
105
|
-
expect( validate_Options_delay_(json_msgOptions_.options) ).toBe(true);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
describe("Validation", function () {
|
|
110
|
-
it("twoPhW.JSON_MsgWarp.validate(json_msgWarp_)", function () {
|
|
111
|
-
expect( JSON_MsgWarp.validate(json_msgWarp_) ).toBe(true);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
describe("Validation", function () {
|
|
116
|
-
it("twoPhW.JSON_MsgEngage.validate(json_msgEngage_)", function () {
|
|
117
|
-
expect( JSON_MsgEngage.validate(json_msgEngage_) ).toBe(true);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
describe("Validation", function () {
|
|
122
|
-
it("JSON_MsgAckWarp.validate(json_msgAckWarp_str_)", function () {
|
|
123
|
-
expect( JSON_MsgAckWarp.validate(json_msgAckWarp_str_) ).toBe(false);
|
|
124
|
-
});
|
|
125
|
-
it("JSON_MsgAckWarp.validate(json_msgAckWarp_obj_)", function () {
|
|
126
|
-
expect( JSON_MsgAckWarp.validate(json_msgAckWarp_obj_) ).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe("Validation", function () {
|
|
131
|
-
it("JSON_MsgAckEngage.validate(json_msgAckEngage_)", function () {
|
|
132
|
-
expect( JSON_MsgAckEngage.validate(json_msgAckEngage_) ).toBe(true);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// beforeEach(function (done) {
|
|
137
|
-
// setTimeout(function () {
|
|
138
|
-
|
|
139
|
-
// function callback_Ack_Warp_(msg, json_Ack, json_Warp, json_Engage) {
|
|
140
|
-
// // console.log('callback_Ack_Warp: Ack: ', json_Ack);
|
|
141
|
-
|
|
142
|
-
// // console.log('callback_Ack_Warp: publish: Engage: ', json_Engage);
|
|
143
|
-
// // IPSME_MsgEnv.publish( JSON.stringify(json_Engage) );
|
|
144
|
-
|
|
145
|
-
// done();
|
|
146
|
-
|
|
147
|
-
// return true;
|
|
148
|
-
// }
|
|
149
|
-
|
|
150
|
-
// twoPhW.config.options= {
|
|
151
|
-
// str_referer_id : str_uuid_ID_,
|
|
152
|
-
// callback_Warp : callback_Ack_Warp_,
|
|
153
|
-
// logr : {
|
|
154
|
-
// // HANDLERS : 1,
|
|
155
|
-
// VALIDATION : 1
|
|
156
|
-
// }
|
|
157
|
-
// }
|
|
158
|
-
|
|
159
|
-
// twoPhW.handler_msg(json_Warp_);
|
|
160
|
-
|
|
161
|
-
// // done();
|
|
162
|
-
|
|
163
|
-
// }, 100);
|
|
164
|
-
// });
|
|
165
|
-
|
|
166
|
-
// it('does a thing', function (done) {
|
|
167
|
-
// someAsyncFunction(function (result) {
|
|
168
|
-
// expect(result).toEqual(someExpectedValue);
|
|
169
|
-
// done();
|
|
170
|
-
// });
|
|
171
|
-
// });
|
|
172
|
-
|
|
173
|
-
//-------------------------------------------------------------------------------------------------
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
validate_Msg2PhW as validate_Msg2PhW_,
|
|
4
|
+
validate_MsgOptions as validate_MsgOptions_,
|
|
5
|
+
validate_Options_delay as validate_Options_delay_,
|
|
6
|
+
validate_MsgWarp as validate_MsgWarp_,
|
|
7
|
+
validate_MsgEngage as validate_MsgEngage_
|
|
8
|
+
} from '../src/validate-esm.mjs';
|
|
9
|
+
|
|
10
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
11
|
+
import { TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage, l as l_2PhW } from '../src/twoPhW.mjs';
|
|
12
|
+
import { JSON_Msg, JSON_Msg_msg, JSON_MsgAck } from '@rootintf/json-msg'
|
|
13
|
+
|
|
14
|
+
const k_VERSION= "0.7";
|
|
15
|
+
|
|
16
|
+
var twoPhW= new TwoPhW();
|
|
17
|
+
twoPhW.config.logr= {
|
|
18
|
+
VALIDATION : 1
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const str_uuid_ID_ = uuidv4();
|
|
22
|
+
console.log('str_uuid_ID_= ' + str_uuid_ID_);
|
|
23
|
+
|
|
24
|
+
const json_msgWarp_ = {
|
|
25
|
+
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
26
|
+
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
27
|
+
dt: "2022-10-28T06:26:19.692Z",
|
|
28
|
+
warp: {
|
|
29
|
+
user: {},
|
|
30
|
+
hyperport: {},
|
|
31
|
+
ttl_msec : 30
|
|
32
|
+
},
|
|
33
|
+
"2PhW": k_VERSION
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const json_msgEngage_ = {
|
|
37
|
+
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
38
|
+
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
39
|
+
dt: "2022-10-28T06:26:19.692Z",
|
|
40
|
+
engage: {
|
|
41
|
+
user: {},
|
|
42
|
+
hyperport: {}
|
|
43
|
+
},
|
|
44
|
+
"2PhW": k_VERSION
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const json_msgAckWarp_str_ = {
|
|
48
|
+
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
49
|
+
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
50
|
+
dt: "2022-10-28T06:26:19.692Z",
|
|
51
|
+
ack: {
|
|
52
|
+
"ok" : true,
|
|
53
|
+
},
|
|
54
|
+
"_msg" : JSON.stringify( json_msgWarp_ ),
|
|
55
|
+
"2PhW": k_VERSION
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const json_msgAckWarp_obj_ = {
|
|
59
|
+
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
60
|
+
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
61
|
+
dt: "2022-10-28T06:26:19.692Z",
|
|
62
|
+
ack: {
|
|
63
|
+
"ok" : true,
|
|
64
|
+
},
|
|
65
|
+
"_msg" : json_msgWarp_,
|
|
66
|
+
"2PhW": k_VERSION
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const json_msgAckEngage_ = {
|
|
70
|
+
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
71
|
+
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
72
|
+
dt: "2022-10-28T06:26:19.692Z",
|
|
73
|
+
ack: {
|
|
74
|
+
"ok" : false,
|
|
75
|
+
},
|
|
76
|
+
"_msg" : json_msgEngage_,
|
|
77
|
+
"2PhW": k_VERSION
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
//TODO: "required" : ["reason"],
|
|
81
|
+
const json_msgOptions_ = {
|
|
82
|
+
id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
83
|
+
referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
|
|
84
|
+
dt: "2022-10-28T06:26:19.692Z",
|
|
85
|
+
options: {
|
|
86
|
+
ttl_msec_incr : [ 20000, 4000 ],
|
|
87
|
+
reason : "it is taking too long"
|
|
88
|
+
},
|
|
89
|
+
"_msg" : json_msgWarp_,
|
|
90
|
+
"2PhW": k_VERSION
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
describe("Validation", function () {
|
|
95
|
+
it("JSON_Msg.validate(json_msgWarp_)", function () {
|
|
96
|
+
expect( JSON_Msg.validate(json_msgWarp_) ).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("Validation", function () {
|
|
101
|
+
it("twoPhW.JSON_MsgOptions.validate(json_msgOptions_)", function () {
|
|
102
|
+
expect( JSON_MsgOptions.validate(json_msgOptions_) ).toBe(true);
|
|
103
|
+
});
|
|
104
|
+
it("validate_Options_delay_(json_msgOptions_.options)", function () {
|
|
105
|
+
expect( validate_Options_delay_(json_msgOptions_.options) ).toBe(true);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe("Validation", function () {
|
|
110
|
+
it("twoPhW.JSON_MsgWarp.validate(json_msgWarp_)", function () {
|
|
111
|
+
expect( JSON_MsgWarp.validate(json_msgWarp_) ).toBe(true);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe("Validation", function () {
|
|
116
|
+
it("twoPhW.JSON_MsgEngage.validate(json_msgEngage_)", function () {
|
|
117
|
+
expect( JSON_MsgEngage.validate(json_msgEngage_) ).toBe(true);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("Validation", function () {
|
|
122
|
+
it("JSON_MsgAckWarp.validate(json_msgAckWarp_str_)", function () {
|
|
123
|
+
expect( JSON_MsgAckWarp.validate(json_msgAckWarp_str_) ).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
it("JSON_MsgAckWarp.validate(json_msgAckWarp_obj_)", function () {
|
|
126
|
+
expect( JSON_MsgAckWarp.validate(json_msgAckWarp_obj_) ).toBe(true);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
describe("Validation", function () {
|
|
131
|
+
it("JSON_MsgAckEngage.validate(json_msgAckEngage_)", function () {
|
|
132
|
+
expect( JSON_MsgAckEngage.validate(json_msgAckEngage_) ).toBe(true);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// beforeEach(function (done) {
|
|
137
|
+
// setTimeout(function () {
|
|
138
|
+
|
|
139
|
+
// function callback_Ack_Warp_(msg, json_Ack, json_Warp, json_Engage) {
|
|
140
|
+
// // console.log('callback_Ack_Warp: Ack: ', json_Ack);
|
|
141
|
+
|
|
142
|
+
// // console.log('callback_Ack_Warp: publish: Engage: ', json_Engage);
|
|
143
|
+
// // IPSME_MsgEnv.publish( JSON.stringify(json_Engage) );
|
|
144
|
+
|
|
145
|
+
// done();
|
|
146
|
+
|
|
147
|
+
// return true;
|
|
148
|
+
// }
|
|
149
|
+
|
|
150
|
+
// twoPhW.config.options= {
|
|
151
|
+
// str_referer_id : str_uuid_ID_,
|
|
152
|
+
// callback_Warp : callback_Ack_Warp_,
|
|
153
|
+
// logr : {
|
|
154
|
+
// // HANDLERS : 1,
|
|
155
|
+
// VALIDATION : 1
|
|
156
|
+
// }
|
|
157
|
+
// }
|
|
158
|
+
|
|
159
|
+
// twoPhW.handler_msg(json_Warp_);
|
|
160
|
+
|
|
161
|
+
// // done();
|
|
162
|
+
|
|
163
|
+
// }, 100);
|
|
164
|
+
// });
|
|
165
|
+
|
|
166
|
+
// it('does a thing', function (done) {
|
|
167
|
+
// someAsyncFunction(function (result) {
|
|
168
|
+
// expect(result).toEqual(someExpectedValue);
|
|
169
|
+
// done();
|
|
170
|
+
// });
|
|
171
|
+
// });
|
|
172
|
+
|
|
173
|
+
//-------------------------------------------------------------------------------------------------
|