@rootintf/protocol-2phw 2.0.3-api.2 → 2.1.5-api.2
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/dist/EventLog-mem.d.mts +2 -5
- package/dist/twoPhW.cjs.js +416 -297
- package/dist/twoPhW.d.ts +23 -23
- package/dist/twoPhW.es.mjs +416 -297
- package/package.json +3 -3
- package/src/EventLog-mem.mjs +9 -15
- package/src/index.ts +1 -1
- package/src/twoPhW.ts +70 -70
- package/tests/event-log-mem.spec.mjs +9 -4
- package/tests/twoPhW-new.spec.mjs +49 -30
- package/dist/index.d.ts +0 -1
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
import { LOGR, l_concat } from '@knev/bitlogr';
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
StateAckEngage, StateEngage, StateAckWarp, StateWarp, StateInitialState, StateINVALID,
|
|
6
|
+
EventLog,
|
|
7
|
+
t_ttl_rtt,
|
|
8
|
+
TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage,
|
|
9
|
+
logr as logr_,
|
|
10
|
+
JSON_Msg, JSON_MsgEffect, JSON_MsgAck
|
|
11
|
+
} from '../dist/twoPhW.es.mjs';
|
|
12
|
+
|
|
13
|
+
// this leads to two copies of l_ from '@rootintf/json-msg'; one copy from twoPhW
|
|
14
|
+
// import { JSON_Msg, JSON_MsgEffect, JSON_MsgAck, l as l_json_msg } from '@rootintf/json-msg'
|
|
11
15
|
|
|
12
16
|
const k_VERSION= "2";
|
|
13
17
|
|
|
@@ -22,14 +26,13 @@ const RTT_MSEC_2000= 2000;
|
|
|
22
26
|
|
|
23
27
|
//-------------------------------------------------------------------------------------------------
|
|
24
28
|
|
|
25
|
-
const LOGR_= LOGR.get_instance()
|
|
29
|
+
const LOGR_= LOGR.get_instance();
|
|
30
|
+
const l_= logr_.l;
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
LOGR_.log(l_.LOG_TEST, () => ['const l_ ', l_])
|
|
32
|
+
LOGR_.toggle(l_, {
|
|
33
|
+
VALIDATION : true
|
|
34
|
+
});
|
|
35
|
+
logr_.raw(() => ['twoPhW-new.spec: const l_ ', l_.get()])
|
|
33
36
|
|
|
34
37
|
//-------------------------------------------------------------------------------------------------
|
|
35
38
|
|
|
@@ -155,6 +158,22 @@ describe("Validation", function () {
|
|
|
155
158
|
it("JSON_MsgAckEngage.validate(json_msgAckEngage_)", function () {
|
|
156
159
|
expect( JSON_MsgAckEngage.validate(json_msgAckEngage_) ).toBe(true);
|
|
157
160
|
});
|
|
161
|
+
|
|
162
|
+
it("LOGR test", function () {
|
|
163
|
+
const json_msgWarp= JSON_MsgWarp.create_with_id_user_hyperport(
|
|
164
|
+
"f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
|
|
165
|
+
'',
|
|
166
|
+
'',
|
|
167
|
+
3000
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
LOGR_.toggle(l_, {
|
|
171
|
+
VALIDATION : true
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
expect( JSON_MsgEffect.validate(json_msgWarp) ).toBe(false);
|
|
175
|
+
});
|
|
176
|
+
|
|
158
177
|
});
|
|
159
178
|
|
|
160
179
|
//-------------------------------------------------------------------------------------------------
|
|
@@ -208,7 +227,7 @@ describe('2PhW protocol', () => {
|
|
|
208
227
|
"t_ttl_rtt_: INVALID rtt_msec ttl_msec[1500] rtt_msec[3001]"
|
|
209
228
|
);
|
|
210
229
|
});
|
|
211
|
-
|
|
230
|
+
|
|
212
231
|
});
|
|
213
232
|
|
|
214
233
|
// ,---, ___
|
|
@@ -240,11 +259,11 @@ describe('2PhW protocol', () => {
|
|
|
240
259
|
callback_msg_sent_expired = jasmine.createSpy('callback_msg_sent_expired');
|
|
241
260
|
|
|
242
261
|
twoPhW.config.receiver( callback_msgWarp, callback_msgEngage, callback_msg_sent_expired )
|
|
243
|
-
LOGR_.
|
|
262
|
+
LOGR_.toggle(l_, {
|
|
244
263
|
// RECVER : 1,
|
|
245
264
|
// PROTOCOL_STATE : 1,
|
|
246
265
|
// DROPS : 1
|
|
247
|
-
}
|
|
266
|
+
});
|
|
248
267
|
|
|
249
268
|
expect(Date.now()-T0).toBe(0);
|
|
250
269
|
|
|
@@ -260,7 +279,7 @@ describe('2PhW protocol', () => {
|
|
|
260
279
|
});
|
|
261
280
|
|
|
262
281
|
afterEach(() => {
|
|
263
|
-
|
|
282
|
+
logr_.log(l_.LOG_TEST, () => ['afterEach: eventLog.arr_events', eventLog.arr_events])
|
|
264
283
|
});
|
|
265
284
|
|
|
266
285
|
it('receive JSON_MsgWarp', () => {
|
|
@@ -386,12 +405,12 @@ describe('2PhW protocol', () => {
|
|
|
386
405
|
let str_msgEngage_src;
|
|
387
406
|
|
|
388
407
|
beforeEach(() => {
|
|
389
|
-
LOGR_.
|
|
408
|
+
LOGR_.toggle(l_, {
|
|
390
409
|
// RECVER : 1,
|
|
391
410
|
// PROTOCOL_STATE : 1,
|
|
392
411
|
// DROPS : 1,
|
|
393
412
|
// LOG_TEST : true
|
|
394
|
-
}
|
|
413
|
+
});
|
|
395
414
|
|
|
396
415
|
jasmine.clock().tick(0);
|
|
397
416
|
expect(Date.now()-T0).toBe(STT_MSEC_1000);
|
|
@@ -450,11 +469,11 @@ describe('2PhW protocol', () => {
|
|
|
450
469
|
let str_msgNackEngage_dst;
|
|
451
470
|
|
|
452
471
|
beforeEach(() => {
|
|
453
|
-
LOGR_.
|
|
472
|
+
LOGR_.toggle(l_, {
|
|
454
473
|
// RECVER : 1,
|
|
455
474
|
// PROTOCOL_STATE : 1,
|
|
456
475
|
// DROPS : 1
|
|
457
|
-
}
|
|
476
|
+
});
|
|
458
477
|
|
|
459
478
|
jasmine.clock().tick(STT_MSEC_1000); // 3000, STT_MSEC_1000 *3
|
|
460
479
|
|
|
@@ -579,11 +598,11 @@ describe('2PhW protocol', () => {
|
|
|
579
598
|
callback_msgAckEngage = jasmine.createSpy('callback_msgAckEngage').and.returnValue(true);
|
|
580
599
|
callback_msg_sent_expired = jasmine.createSpy('callback_msg_sent_expired');
|
|
581
600
|
twoPhW.config.sender( callback_msgAckWarp, callback_msgAckEngage, callback_msg_sent_expired )
|
|
582
|
-
LOGR_.
|
|
601
|
+
LOGR_.toggle(l_, {
|
|
583
602
|
// SENDER : 1,
|
|
584
603
|
// PROTOCOL_STATE : 1,
|
|
585
604
|
// DROPS : 1
|
|
586
|
-
}
|
|
605
|
+
});
|
|
587
606
|
|
|
588
607
|
jasmine.clock().tick(0);
|
|
589
608
|
expect(Date.now()-T0).toBe(0);
|
|
@@ -596,7 +615,7 @@ describe('2PhW protocol', () => {
|
|
|
596
615
|
});
|
|
597
616
|
|
|
598
617
|
afterEach(() => {
|
|
599
|
-
|
|
618
|
+
logr_.log(l_.LOG_TEST, () => ['afterEach: eventLog.arr_events', eventLog.arr_events])
|
|
600
619
|
});
|
|
601
620
|
|
|
602
621
|
it('send JSON_MsgWarp == can register a Warp', () => {
|
|
@@ -630,11 +649,11 @@ describe('2PhW protocol', () => {
|
|
|
630
649
|
let str_msgEngage_src;
|
|
631
650
|
|
|
632
651
|
beforeEach(() => {
|
|
633
|
-
LOGR_.
|
|
652
|
+
LOGR_.toggle(l_, {
|
|
634
653
|
// SENDER : 1,
|
|
635
654
|
// PROTOCOL_STATE : 1,
|
|
636
655
|
// DROPS : 1
|
|
637
|
-
}
|
|
656
|
+
});
|
|
638
657
|
|
|
639
658
|
twoPhW.register_msgWarp(str_msgWarp_src, json_msgWarp_src);
|
|
640
659
|
expect(eventLog.arr_events.length).toBe(1);
|
|
@@ -704,11 +723,11 @@ describe('2PhW protocol', () => {
|
|
|
704
723
|
|
|
705
724
|
describe('register Engage!', () => {
|
|
706
725
|
beforeEach(() => {
|
|
707
|
-
LOGR_.
|
|
726
|
+
LOGR_.toggle(l_, {
|
|
708
727
|
// SENDER : 1,
|
|
709
728
|
// PROTOCOL_STATE : 1,
|
|
710
729
|
// DROPS : 1
|
|
711
|
-
}
|
|
730
|
+
});
|
|
712
731
|
|
|
713
732
|
expect(Date.now()-T0).toBe(RTT_MSEC_2000);
|
|
714
733
|
|
|
@@ -759,11 +778,11 @@ describe('2PhW protocol', () => {
|
|
|
759
778
|
let str_msgAckEngage_dst;
|
|
760
779
|
|
|
761
780
|
beforeEach(() => {
|
|
762
|
-
LOGR_.
|
|
781
|
+
LOGR_.toggle(l_, {
|
|
763
782
|
// SENDER : 1,
|
|
764
783
|
// PROTOCOL_STATE : 1,
|
|
765
784
|
// DROPS : 1
|
|
766
|
-
}
|
|
785
|
+
});
|
|
767
786
|
|
|
768
787
|
expect(Date.now()-T0).toBe(RTT_MSEC_2000);
|
|
769
788
|
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './twoPhW';
|