@rootintf/protocol-2phw 2.3.4-api.2 → 2.3.7-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/package.json CHANGED
@@ -1,10 +1,15 @@
1
1
  {
2
2
  "name": "@rootintf/protocol-2phw",
3
- "version": "2.3.4-api.2",
3
+ "version": "2.3.7-api.2",
4
4
  "description": "",
5
5
  "main": "dist/twoPhW.cjs.js",
6
- "types": "dist/index.d.ts",
6
+ "types": "dist/twoPhW.d.ts",
7
7
  "browser": "dist/twoPhW.es.mjs",
8
+ "files": [
9
+ "dist",
10
+ "src",
11
+ "schema"
12
+ ],
8
13
  "scripts": {
9
14
  "gv:all" : "gv --js --antora --tag api && git add package.json ./antora-docs/antora.yml",
10
15
  "build": "node src/ajv-gen-validate.cjs && rollup --config",
@@ -1 +0,0 @@
1
- {"sessionId":"665ff5cb-5985-468b-b076-b14bb79155c0","pid":29412,"acquiredAt":1782215798789}
@@ -1,2 +0,0 @@
1
- name: protocol-2PhW
2
- version: '2.3.4-api.2'
@@ -1,7 +0,0 @@
1
- = npm-protocol-2PhW
2
-
3
- Protocols: xref:protocols::2PhW.adoc[]
4
-
5
- npm implementation of the xref:ROOT:index.adoc[Two-Phase Warp protocol].
6
-
7
- TODO: documentation.
package/dev.txt DELETED
@@ -1,23 +0,0 @@
1
-
2
- npm outdated
3
- npm audit
4
-
5
- npm i
6
- npm run build
7
- npm run test
8
-
9
- gv --js --tag api
10
- npm i
11
- npm run build
12
- (npm run test)
13
- git commit
14
- npm publish --tag api
15
-
16
-
17
-
18
- TODO
19
- - what to do if:
20
- - AckWarp is lost? resend Warp?
21
- - Engage is lost? resend AckWarp? drop it?
22
- - AckEngage is lost? resend Engage?
23
-
package/jasmine.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "spec_dir": "tests",
3
- "spec_files": [
4
- "**/*[sS]pec.?(m)js",
5
- "!**/*nospec.js"
6
- ]
7
- }
package/rollup.config.mjs DELETED
@@ -1,40 +0,0 @@
1
-
2
- import resolve from '@rollup/plugin-node-resolve';
3
- import commonjs from '@rollup/plugin-commonjs';
4
- import json from '@rollup/plugin-json';
5
- import typescript from '@rollup/plugin-typescript';
6
-
7
- // EventLog now lives in its own package; keep it external instead of re-bundling it.
8
- const external = ['@rootintf/eventlog'];
9
-
10
- export default [
11
- {
12
- input: 'src/twoPhW.ts',
13
- external,
14
- output: {
15
- file: 'dist/twoPhW.es.mjs',
16
- format: 'es'
17
- },
18
- plugins: [
19
- resolve(),
20
- commonjs(),
21
- json(),
22
- typescript({ tsconfig: './tsconfig.json' })
23
- ]
24
- },
25
- {
26
- input: 'src/twoPhW.ts',
27
- external,
28
- output: {
29
- file: 'dist/twoPhW.cjs.js',
30
- format: 'cjs'
31
- },
32
- plugins: [
33
- resolve(),
34
- commonjs(),
35
- json(),
36
- typescript({ tsconfig: './tsconfig.json' })
37
- ]
38
- }
39
-
40
- ];
@@ -1,850 +0,0 @@
1
-
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { LOGR, l_concat } from '@knev/bitlogr';
4
- import { EventLog } from '@rootintf/eventlog';
5
- import {
6
- StateAckEngage, StateEngage, StateAckWarp, StateWarp, StateInitialState, StateINVALID,
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'
15
-
16
- const k_VERSION= "2";
17
-
18
- const kstr_REFERER_ = 'twoPhW-new.spec';
19
- const karr_referer_src = [kstr_REFERER_, uuidv4()];
20
- const karr_referer_dst = [kstr_REFERER_, uuidv4()];
21
-
22
- const T0= 1000000; // Fixed base time: 1,000,000 ms
23
- const TTL_MSEC_1500= 1500;
24
- const STT_MSEC_1000= 1000; // SINGLE trip time = half the RTT
25
- const RTT_MSEC_2000= 2000;
26
-
27
- //-------------------------------------------------------------------------------------------------
28
-
29
- const LOGR_= LOGR.get_instance();
30
- const l_= logr_.l;
31
-
32
- LOGR_.toggle(l_, {
33
- VALIDATION : true
34
- });
35
- logr_.raw('twoPhW-new.spec: const l_ ', l_.get())
36
-
37
- //-------------------------------------------------------------------------------------------------
38
-
39
- describe("Initialization", function () {
40
- it("json_msgWarp", function () {
41
- const json_msgWarp= JSON_MsgWarp.create_with_id_user_hyperport(uuidv4(), '', '', TTL_MSEC_1500);
42
-
43
- const json_msgAckWarp_obj= JSON_MsgAckWarp.create_with_Warp_Ok(json_msgWarp, true);
44
- const json_msgAckWarp_str= JSON_MsgAckWarp.create_with_Warp_Ok( JSON.stringify(json_msgWarp), true);
45
-
46
- expect(typeof json_msgAckWarp_obj._cause.warp.id === 'string').toBe(true);
47
- expect(() => {
48
- json_msgAckWarp_str._cause.warp.id;
49
- }).toThrowError(TypeError, "Cannot read properties of undefined (reading 'id')");
50
-
51
- expect(() => {
52
- const isInstance = json_msgWarp instanceof JSON_Msg; // This will throw
53
- }).toThrowError(TypeError, /Right-hand side of 'instanceof' is not callable/);
54
-
55
- expect(json_msgWarp.warp !== undefined).toBe(true);
56
- });
57
- });
58
-
59
- //-------------------------------------------------------------------------------------------------
60
-
61
- describe("Validation", function () {
62
-
63
- const json_msgWarp_ = {
64
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
65
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
66
- dt: "2022-10-28T06:26:19.692Z",
67
- warp: {
68
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
69
- user: {},
70
- hyperport: {},
71
- ttl_msec : 3000
72
- },
73
- "2PhW": k_VERSION
74
- }
75
-
76
- const json_msgEngage_ = {
77
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
78
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
79
- dt: "2022-10-28T06:26:19.692Z",
80
- engage: {
81
- "ok" : true,
82
- "rtt_msec" : 6000
83
- },
84
- "_cause" : json_msgWarp_,
85
- "2PhW": k_VERSION
86
- }
87
-
88
- const json_msgAckWarp_str_ = {
89
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
90
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
91
- dt: "2022-10-28T06:26:19.692Z",
92
- ack: {
93
- "ok" : true,
94
- },
95
- "_cause" : JSON.stringify( json_msgWarp_ ),
96
- "2PhW": k_VERSION
97
- }
98
-
99
- const json_msgAckWarp_obj_ = {
100
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
101
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
102
- dt: "2022-10-28T06:26:19.692Z",
103
- ack: {
104
- "ok" : true,
105
- },
106
- "_cause" : json_msgWarp_,
107
- "2PhW": k_VERSION
108
- }
109
-
110
- const json_msgAckEngage_ = {
111
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
112
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
113
- dt: "2022-10-28T06:26:19.692Z",
114
- ack: {
115
- "ok" : false,
116
- },
117
- "_cause" : json_msgEngage_,
118
- "2PhW": k_VERSION
119
- }
120
-
121
- //TODO: "required" : ["reason"],
122
- const json_msgOptions_ = {
123
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
124
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
125
- dt: "2022-10-28T06:26:19.692Z",
126
- options: {
127
- ttl_msec_incr : [ 20000, 4000 ],
128
- reason : "it is taking too long"
129
- },
130
- "_cause" : json_msgWarp_,
131
- "2PhW": k_VERSION
132
- }
133
-
134
- it("JSON_Msg.validate(json_msgWarp_)", function () {
135
- expect( JSON_Msg.validate(json_msgWarp_) ).toBe(true);
136
- });
137
-
138
- it("twoPhW.JSON_MsgOptions.validate(json_msgOptions_)", function () {
139
- expect( JSON_MsgOptions.validate(json_msgOptions_) ).toBe(true);
140
- });
141
-
142
- it("twoPhW.JSON_MsgWarp.validate(json_msgWarp_)", function () {
143
- expect( JSON_MsgWarp.validate(json_msgWarp_) ).toBe(true);
144
- });
145
-
146
- it("twoPhW.JSON_MsgEngage.validate(json_msgEngage_)", function () {
147
- expect( JSON_MsgEngage.validate(json_msgEngage_) ).toBe(true);
148
- });
149
-
150
- it("JSON_MsgAckWarp.validate(json_msgAckWarp_str_)", function () {
151
- expect( JSON_MsgAckWarp.validate(json_msgAckWarp_str_) ).toBe(false);
152
- });
153
-
154
- it("JSON_MsgAckWarp.validate(json_msgAckWarp_obj_)", function () {
155
- expect( JSON_MsgAckWarp.validate(json_msgAckWarp_obj_) ).toBe(true);
156
- });
157
-
158
- it("JSON_MsgAckEngage.validate(json_msgAckEngage_)", function () {
159
- expect( JSON_MsgAckEngage.validate(json_msgAckEngage_) ).toBe(true);
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
-
177
- });
178
-
179
- //-------------------------------------------------------------------------------------------------
180
-
181
- describe('2PhW protocol', () => {
182
- let eventLog;
183
- let twoPhW;
184
-
185
- beforeEach(() => {
186
- eventLog = new EventLog();
187
- twoPhW= new TwoPhW(eventLog);
188
-
189
- // spyOn(eventLog.logr, 'log'); // Mock logging
190
- jasmine.clock().install();
191
- jasmine.clock().mockDate(new Date(T0));
192
- });
193
-
194
- afterEach(() => {
195
- jasmine.clock().uninstall();
196
- });
197
-
198
- describe('basics', () => {
199
- it('_addEvent', () => {
200
- const json_msgWarp= JSON_MsgWarp.create_with_id_user_hyperport(uuidv4(), '', '', TTL_MSEC_1500);
201
- json_msgWarp.referer= karr_referer_src;
202
-
203
- const json_msgEngage= JSON_MsgEngage.create_with_Warp(json_msgWarp);
204
- json_msgEngage.referer= karr_referer_src;
205
-
206
- const json_msgNackWarp= JSON_MsgAckWarp.create_with_Warp_Ok(json_msgWarp, false);
207
- json_msgNackWarp.referer= karr_referer_dst;
208
- const str_msgNackWarp = JSON.stringify(json_msgNackWarp);
209
- twoPhW.eventLog._addEvent(str_msgNackWarp, json_msgNackWarp)
210
- expect(eventLog.arr_events.length).toBe(1);
211
- expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgAckWarp]');
212
- expect(eventLog.arr_events[0].data).toEqual({ msg: str_msgNackWarp, json_msg : json_msgNackWarp });
213
- });
214
-
215
- it('t_ttl_rtt', () => {
216
- jasmine.clock().tick(0); // 0
217
- expect(Date.now()-T0).toBe(0)
218
-
219
- expect( t_ttl_rtt(undefined, undefined) === undefined ).toBe(true);
220
- expect( t_ttl_rtt(TTL_MSEC_1500) ).toBe(TTL_MSEC_1500 *2);
221
- expect( t_ttl_rtt(TTL_MSEC_1500, 750*4) ).toBe(6000);
222
-
223
- spyOn(console, "assert");
224
- t_ttl_rtt(TTL_MSEC_1500, TTL_MSEC_1500 *2 +1); // 3001 > 2000 *2
225
- expect(console.assert).toHaveBeenCalledWith(
226
- false,
227
- "t_ttl_rtt_: INVALID rtt_msec ttl_msec[1500] rtt_msec[3001]"
228
- );
229
- });
230
-
231
- });
232
-
233
- // ,---, ___
234
- // .' .' `\ ,--.'|_
235
- // ,---.' \ | | :,'
236
- // .--.--. | | .`\ | .--.--. : : ' :
237
- // ,--.--. / / ' : : | ' | / / '.;__,' /
238
- // / \ | : /`./ | ' ' ; :| : /`./| | |
239
- // .--. .-. | | : ;_ ' | ; . || : ;_ :__,'| :
240
- // \__\/: . . \ \ `. | | : | ' \ \ `. ' : |__
241
- // ," .--.; | `----. \ ' : | / ; `----. \| | '.'|
242
- // / / ,. | / /`--' / | | '` ,/ / /`--' /; : ;
243
- // ; : .' \'--'. / ; : .' '--'. / | , /
244
- // | , .-./ `--'---' | ,.' `--'---' ---`-'
245
- // `--`---' '---'
246
- //
247
-
248
- describe('warp sequence as Destination receiver;', () => {
249
- let callback_msgWarp;
250
- let callback_msgEngage;
251
- let callback_msg_sent_expired;
252
-
253
- let json_msgWarp_src;
254
- let str_msgWarp_src;
255
-
256
- beforeEach(() => {
257
- callback_msgWarp = jasmine.createSpy('callback_msgWarp').and.returnValue(true);
258
- callback_msgEngage = jasmine.createSpy('callback_msgEngage').and.returnValue(true);
259
- callback_msg_sent_expired = jasmine.createSpy('callback_msg_sent_expired');
260
-
261
- twoPhW.config.receiver( callback_msgWarp, callback_msgEngage, callback_msg_sent_expired )
262
- LOGR_.toggle(l_, {
263
- // RECVER : 1,
264
- // PROTOCOL_STATE : 1,
265
- // DROPS : 1
266
- });
267
-
268
- expect(Date.now()-T0).toBe(0);
269
-
270
- json_msgWarp_src= JSON_MsgWarp.create_with_id_user_hyperport(uuidv4(), '', '', TTL_MSEC_1500);
271
- json_msgWarp_src.referer= karr_referer_src;
272
- str_msgWarp_src = JSON.stringify(json_msgWarp_src);
273
-
274
- jasmine.clock().tick(STT_MSEC_1000);
275
- expect(eventLog.arr_events.length).toBe(0);
276
- expect(callback_msgWarp).not.toHaveBeenCalled();
277
-
278
- expect(Date.now()-T0).toBe(1000);
279
- });
280
-
281
- afterEach(() => {
282
- logr_.log(l_.LOG_TEST, () => ['afterEach: eventLog.arr_events', eventLog.arr_events])
283
- });
284
-
285
- it('receive JSON_MsgWarp', () => {
286
- jasmine.clock().tick(TTL_MSEC_1500 -STT_MSEC_1000 -1); // 1499
287
- twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
288
- expect(callback_msgWarp).toHaveBeenCalled();
289
- expect(eventLog.arr_events.length).toBe(1);
290
- expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgWarp]');
291
- expect(eventLog.arr_events[0].data).toEqual({ msg : str_msgWarp_src, json_msg: json_msgWarp_src });
292
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
293
-
294
- // dup
295
- twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
296
- expect(eventLog.arr_events.length).toBe(1);
297
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
298
- });
299
-
300
- it('receive JSON_MsgWarp expired', () => {
301
- jasmine.clock().tick(TTL_MSEC_1500 -STT_MSEC_1000); // 1500
302
- twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
303
- expect(callback_msgWarp).not.toHaveBeenCalled();
304
- expect(eventLog.arr_events.length).toBe(0);
305
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateInitialState).toBe(true);
306
- });
307
-
308
- it('receive premature JSON_MsgEngage', () => {
309
- const json_msgEngage_recvd= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
310
- json_msgEngage_recvd.referer= karr_referer_src;
311
-
312
- twoPhW.handler_json_msgEffect(json_msgEngage_recvd, json_msgEngage_recvd);
313
- expect(eventLog.arr_events.length).toBe(0);
314
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateInitialState).toBe(true);
315
- });
316
-
317
- it('traverse_State JSON_MsgWarp.compare(json_msgWarp, this._warp(json_msg).json_msgWarp )', () => {
318
- twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
319
- expect(eventLog.arr_events.length).toBe(1);
320
- expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgWarp]');
321
- expect(eventLog.arr_events[0].data).toEqual({ msg : str_msgWarp_src, json_msg: json_msgWarp_src });
322
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
323
-
324
- const json_msgWarp_wrong_dt= {
325
- ...json_msgWarp_src
326
- };
327
- jasmine.clock().tick(1); // 1001, make sure it is th wrong date
328
- json_msgWarp_wrong_dt.dt= new Date().toISOString();
329
- twoPhW.handler_json_msg(json_msgWarp_wrong_dt, json_msgWarp_wrong_dt);
330
- expect(eventLog.arr_events.length).toBe(1);
331
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
332
- });
333
-
334
- describe('warp sequence as Destination receiver;', () => {
335
- let json_msgAckWarp_dst;
336
- let str_msgAckWarp_dst;
337
- let json_msgNackWarp_dst;
338
- let str_msgNackWarp_dst;
339
-
340
- beforeEach(() => {
341
- json_msgAckWarp_dst= JSON_MsgAckWarp.create_with_Warp_Ok(json_msgWarp_src, true);
342
- json_msgAckWarp_dst.referer= karr_referer_dst;
343
- str_msgAckWarp_dst = JSON.stringify(json_msgAckWarp_dst);
344
-
345
- json_msgNackWarp_dst= JSON_MsgAckWarp.create_with_Warp_Ok(json_msgWarp_src, false);
346
- json_msgNackWarp_dst.referer= karr_referer_dst;
347
- str_msgNackWarp_dst = JSON.stringify(str_msgNackWarp_dst);
348
-
349
- expect(eventLog.arr_events.length).toBe(0);
350
-
351
- expect(Date.now()-T0).toBe(STT_MSEC_1000);
352
-
353
- twoPhW.handler_json_msg(str_msgWarp_src, json_msgWarp_src);
354
- expect(callback_msgWarp).toHaveBeenCalled();
355
- expect(eventLog.arr_events.length).toBe(1);
356
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
357
- });
358
-
359
- it('Ack expires', () => {
360
- jasmine.clock().tick(300); // register of Ack 300ms after creation
361
- expect(Date.now()-T0).toBe(STT_MSEC_1000 +300);
362
- twoPhW.register_msgAckWarp(str_msgAckWarp_dst, json_msgAckWarp_dst);
363
-
364
- // The Ack gets to live for THE ACK'S creation time + TTL*2 + STT
365
- // - Ack creation time @1000ms
366
- // - TTL= 1500; TTL*2= 3000; STT=1000; timeout= 4000
367
- // - expires at 5000
368
-
369
- jasmine.clock().tick(TTL_MSEC_1500*2 + STT_MSEC_1000 -300 -1);
370
- expect(Date.now()-T0).toBe( t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) -1);
371
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
372
-
373
- jasmine.clock().tick(1); // t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000)
374
- expect(Date.now()-T0).toBe(5000);
375
- expect(callback_msg_sent_expired).toHaveBeenCalled();
376
- expect(eventLog.arr_events.length).toBe(2);
377
- expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
378
- expect(eventLog.arr_events[1].data).toEqual({ msg: str_msgAckWarp_dst, json_msg : json_msgAckWarp_dst });
379
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
380
-
381
- const json_msgEngage_src= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
382
- json_msgEngage_src.referer= karr_referer_src;
383
-
384
- twoPhW.handler_json_msgEffect(json_msgEngage_src, json_msgEngage_src);
385
- expect(eventLog.arr_events.length).toBe(2);
386
- });
387
-
388
- it('NACK', () => {
389
- twoPhW.register_msgAckWarp(str_msgNackWarp_dst, json_msgNackWarp_dst);
390
- expect(eventLog.arr_events.length).toBe(2);
391
- expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
392
- expect(eventLog.arr_events[1].data).toEqual({ msg : str_msgNackWarp_dst, json_msg : json_msgNackWarp_dst });
393
-
394
- jasmine.clock().tick(STT_MSEC_1000); // 2000, STT_MSEC_1000 *2= RTT
395
- const json_msgEngage_src= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
396
- json_msgEngage_src.referer= karr_referer_src;
397
-
398
- jasmine.clock().tick(STT_MSEC_1000); // 3000, STT_MSEC_1000 *3
399
- twoPhW.handler_json_msgEffect(json_msgEngage_src, json_msgEngage_src);
400
- expect(eventLog.arr_events.length).toBe(2);
401
- });
402
-
403
- describe('JSON_MsgAckWarp;', () => {
404
- let json_msgEngage_src;
405
- let str_msgEngage_src;
406
-
407
- beforeEach(() => {
408
- LOGR_.toggle(l_, {
409
- // RECVER : 1,
410
- // PROTOCOL_STATE : 1,
411
- // DROPS : 1,
412
- // LOG_TEST : true
413
- });
414
-
415
- jasmine.clock().tick(0);
416
- expect(Date.now()-T0).toBe(STT_MSEC_1000);
417
-
418
- // Ack
419
- twoPhW.register_msgAckWarp(str_msgAckWarp_dst, json_msgAckWarp_dst);
420
- expect(eventLog.arr_events.length).toBe(2);
421
- expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
422
- expect(eventLog.arr_events[1].data).toEqual({ msg: str_msgAckWarp_dst, json_msg : json_msgAckWarp_dst });
423
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
424
-
425
- jasmine.clock().tick(STT_MSEC_1000); // STT_MSEC_1000 *2= RTT
426
- json_msgEngage_src= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
427
- json_msgEngage_src.referer= karr_referer_src;
428
- str_msgEngage_src = JSON.stringify(json_msgEngage_src);
429
-
430
- expect(Date.now()-T0).toBe(RTT_MSEC_2000);
431
- });
432
-
433
- // The Ack gets to live for THE ACK'S creation time + TTL*2
434
- // - Ack creation time @1000ms
435
- // - TTL= 1500; TTL*2= 3000; timeout= 3000
436
- // - expires at 4000
437
-
438
- it('AckWarp and JSON_MsgEngage timeouts', () => {
439
- jasmine.clock().tick(t_ttl_rtt(TTL_MSEC_1500) -1);
440
- expect(Date.now()-T0).toBe( t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) -1);
441
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
442
- expect(callback_msgEngage).not.toHaveBeenCalled();
443
-
444
- jasmine.clock().tick(1);
445
- expect(Date.now()-T0).toBe( t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000));
446
- expect(callback_msg_sent_expired).toHaveBeenCalled();
447
-
448
- expect( t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000 ).toBe(true);
449
- // The Engaget gets to live for THE WARP'S creation time + TTL*2 + RTT
450
- // - the Warp was created time at 0ms
451
- // - TTL= 1500, RTT= 2000; TTL*2 + RTT= 5000; timeout= 5000
452
- // - expires at 5000
453
-
454
- twoPhW.handler_json_msgEffect(str_msgEngage_src, json_msgEngage_src);
455
- expect(callback_msgEngage).not.toHaveBeenCalled();
456
- expect(eventLog.arr_events.length).toBe(2);
457
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
458
-
459
- jasmine.clock().tick(STT_MSEC_1000); // 4000, STT_MSEC_1000 *4
460
- const json_msgNackEngage_dst= JSON_MsgAckEngage.create_with_Engage_Ok(json_msgEngage_src, false);
461
- json_msgNackEngage_dst.referer= karr_referer_dst;
462
- twoPhW.register_msgAckEngage(JSON.stringify(json_msgNackEngage_dst), json_msgNackEngage_dst)
463
- expect(eventLog.arr_events.length).toBe(2);
464
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
465
- });
466
-
467
- describe('JSON_MsgAckWarp;', () => {
468
- let json_msgNackEngage_dst;
469
- let str_msgNackEngage_dst;
470
-
471
- beforeEach(() => {
472
- LOGR_.toggle(l_, {
473
- // RECVER : 1,
474
- // PROTOCOL_STATE : 1,
475
- // DROPS : 1
476
- });
477
-
478
- jasmine.clock().tick(STT_MSEC_1000); // 3000, STT_MSEC_1000 *3
479
-
480
- twoPhW.handler_json_msgEffect(str_msgEngage_src, json_msgEngage_src);
481
- expect(callback_msgEngage).toHaveBeenCalled();
482
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
483
- expect(eventLog.arr_events.length).toBe(3);
484
- expect(eventLog.arr_events[2].type).toBe('2PhW[JSON_MsgEngage]');
485
- expect(eventLog.arr_events[2].data).toEqual({ msg: str_msgEngage_src, json_msg : json_msgEngage_src });
486
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
487
-
488
- json_msgNackEngage_dst= JSON_MsgAckEngage.create_with_Engage_Ok(json_msgEngage_src, false);
489
- json_msgNackEngage_dst.referer= karr_referer_dst;
490
- str_msgNackEngage_dst = JSON.stringify(json_msgNackEngage_dst);
491
-
492
- // jasmine.clock().tick(STT_MSEC_1000); // 4000, STT_MSEC_1000 *4
493
- // expect(Date.now()-T0).toBe(RTT_MSEC_2000 *2);
494
- expect(Date.now()-T0).toBe(STT_MSEC_1000 *3);
495
- });
496
-
497
- it('JSON_MsgAckEngage', () => {
498
- expect( t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000 ).toBe(true);
499
- // The Engaget gets to live for THE WARP'S creation time + TTL*2 + RTT
500
- // - the Warp was created time at 0ms
501
- // - TTL= 1500, RTT= 2000; TTL*2 + RTT= 5000; timeout= 5000
502
- // - expires at 5000
503
- jasmine.clock().tick(2000 -1);
504
- expect(Date.now()-T0).toBe( t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) -1);
505
-
506
- twoPhW.register_msgAckEngage(str_msgNackEngage_dst, json_msgNackEngage_dst)
507
- expect(eventLog.arr_events.length).toBe(4);
508
- expect(eventLog.arr_events[3].type).toBe('2PhW[JSON_MsgAckEngage]');
509
- expect(eventLog.arr_events[3].data).toEqual({ msg : str_msgNackEngage_dst, json_msg : json_msgNackEngage_dst });
510
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckEngage).toBe(true);
511
- });
512
-
513
- it('JSON_MsgAckEngage, expired', () => {
514
- jasmine.clock().tick(2000);
515
- expect(Date.now()-T0).toBe(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000));
516
-
517
- twoPhW.register_msgAckEngage(str_msgNackEngage_dst, json_msgNackEngage_dst)
518
- expect(eventLog.arr_events.length).toBe(3);
519
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
520
- });
521
-
522
- });
523
- });
524
- });
525
-
526
-
527
- it('JSON_MsgWarp instantaneous', () => {
528
- // const callback_msgWarp= (_msg, json_msgWarp) => {
529
- // // console.log('callback_msgWarp', json_msgWarp);
530
-
531
- // const json_msgAckWarp= JSON_MsgAckWarp.create_with_msgOk(json_msgWarp, true);
532
- // json_msgAckWarp.referer= karr_referer_dst;
533
- // expect((twoPhW.eventLog.traverse_State(json_msgWarp_recvd)).state instanceof StateWarp).toBe(true);
534
-
535
- // twoPhW.eventLog.addEvent(json_msgAckWarp);
536
- // expect(eventLog.arr_events.length).toBe(2);
537
- // expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
538
- // expect(eventLog.arr_events[1].data).toBe(json_msgAckWarp);
539
-
540
- // return true;
541
- // }
542
-
543
- // twoPhW.config.receiver( callback_msgWarp, () => {} )
544
- // twoPhW.config.toggled= {
545
- // // RECVER : 1,
546
- // // PROTOCOL_STATE : 1,
547
- // // DROPS : 1
548
- // }
549
-
550
- // const json_msgWarp_recvd= JSON_MsgWarp.create_with_id_user_hyperport(uuidv4(), '', '', TIMEOUT_2000_MSEC);
551
- // json_msgWarp_recvd.warp.instantaneous= true;
552
- // json_msgWarp_recvd.referer= karr_referer_src;
553
-
554
- // const json_msgEngage_recvd= JSON_MsgEngage.create_with_MsgWarp(json_msgWarp_recvd);
555
- // json_msgEngage_recvd.referer= karr_referer_src;
556
-
557
-
558
- // jasmine.clock().tick(1000); // 1000
559
- // twoPhW.handler_json(json_msgWarp_recvd, json_msgWarp_recvd);
560
- // expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgWarp]');
561
- // expect(eventLog.arr_events[0].data).toBe(json_msgWarp_recvd);
562
- // expect((twoPhW.eventLog.traverse_State(json_msgWarp_recvd)).state instanceof StateAckWarp).toBe(true);
563
-
564
- // jasmine.clock().tick(1000); // 2000
565
- // twoPhW.handler_json(json_msgEngage_recvd, json_msgEngage_recvd);
566
-
567
- // expect(eventLog.arr_events.length).toBe(3);
568
- // expect(eventLog.arr_events[2].type).toBe('2PhW[DROPPED!]');
569
- });
570
-
571
- });
572
-
573
- // .--.--.
574
- // / / '.
575
- // | : /`. / __ ,-.
576
- // .--.--. ; | |--` ,' ,'/ /|
577
- // ,--.--. / / ' | : ;_ ' | |' | ,---.
578
- // / \ | : /`./ \ \ `. | | ,'/ \
579
- // .--. .-. | | : ;_ `----. \' : / / / '
580
- // \__\/: . . \ \ `. __ \ \ || | ' . ' /
581
- // ," .--.; | `----. \ / /`--' /; : | ' ; :__
582
- // / / ,. | / /`--' / '--'. / | , ; ' | '.'|
583
- // ; : .' \'--'. / `--'---' ---' | : :
584
- // | , .-./ `--'---' \ \ /
585
- // `--`---' `----'
586
- //
587
-
588
- describe('warp sequence as Source sender;', () => {
589
- let callback_msgAckWarp;
590
- let callback_msgAckEngage;
591
- let callback_msg_sent_expired;
592
-
593
- let json_msgWarp_src;
594
- let str_msgWarp_src;
595
-
596
- beforeEach(() => {
597
- callback_msgAckWarp = jasmine.createSpy('callback_msgAckWarp').and.returnValue(true);
598
- callback_msgAckEngage = jasmine.createSpy('callback_msgAckEngage').and.returnValue(true);
599
- callback_msg_sent_expired = jasmine.createSpy('callback_msg_sent_expired');
600
- twoPhW.config.sender( callback_msgAckWarp, callback_msgAckEngage, callback_msg_sent_expired )
601
- LOGR_.toggle(l_, {
602
- // SENDER : 1,
603
- // PROTOCOL_STATE : 1,
604
- // DROPS : 1
605
- });
606
-
607
- jasmine.clock().tick(0);
608
- expect(Date.now()-T0).toBe(0);
609
-
610
- json_msgWarp_src= JSON_MsgWarp.create_with_id_user_hyperport(uuidv4(), '', '', TTL_MSEC_1500);
611
- json_msgWarp_src.referer= karr_referer_src;
612
- str_msgWarp_src = JSON.stringify(json_msgWarp_src);
613
-
614
- expect(eventLog.arr_events.length).toBe(0);
615
- });
616
-
617
- afterEach(() => {
618
- logr_.log(l_.LOG_TEST, () => ['afterEach: eventLog.arr_events', eventLog.arr_events])
619
- });
620
-
621
- it('send JSON_MsgWarp == can register a Warp', () => {
622
- jasmine.clock().tick(TTL_MSEC_1500 -1);
623
- expect(Date.now()-T0).toBe(1499);
624
-
625
- twoPhW.register_msgWarp(str_msgWarp_src, json_msgWarp_src);
626
- expect(eventLog.arr_events.length).toBe(1);
627
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
628
-
629
- jasmine.clock().tick(TTL_MSEC_1500 +1);
630
- expect(Date.now()-T0).toBe(t_ttl_rtt(TTL_MSEC_1500));
631
- expect(callback_msg_sent_expired).toHaveBeenCalled();
632
- });
633
-
634
- it('send JSON_MsgWarp == cant register an expired Warp', () => {
635
- jasmine.clock().tick(TTL_MSEC_1500);
636
- expect(Date.now()-T0).toBe(1500);
637
-
638
- twoPhW.register_msgWarp(str_msgWarp_src, json_msgWarp_src);
639
- expect(eventLog.arr_events.length).toBe(0);
640
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateInitialState).toBe(true);
641
- });
642
-
643
- describe('JSON_MsgAckWarp;', () => {
644
- let json_msgAckWarp_dst;
645
- let str_msgAckWarp_dst;
646
- let json_msgNackWarp_dst;
647
- let str_msgNackWarp_dst;
648
- let json_msgEngage_src;
649
- let str_msgEngage_src;
650
-
651
- beforeEach(() => {
652
- LOGR_.toggle(l_, {
653
- // SENDER : 1,
654
- // PROTOCOL_STATE : 1,
655
- // DROPS : 1
656
- });
657
-
658
- twoPhW.register_msgWarp(str_msgWarp_src, json_msgWarp_src);
659
- expect(eventLog.arr_events.length).toBe(1);
660
- expect(eventLog.arr_events[0].type).toBe('2PhW[JSON_MsgWarp]');
661
- expect(eventLog.arr_events[0].data).toEqual({ msg : str_msgWarp_src, json_msg: json_msgWarp_src });
662
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
663
-
664
- expect(Date.now()-T0).toBe(0);
665
-
666
- jasmine.clock().tick(STT_MSEC_1000); // 1000
667
- json_msgAckWarp_dst= JSON_MsgAckWarp.create_with_Warp_Ok(json_msgWarp_src, true);
668
- json_msgAckWarp_dst.referer= karr_referer_dst;
669
- str_msgAckWarp_dst = JSON.stringify(json_msgAckWarp_dst);
670
-
671
- json_msgNackWarp_dst= JSON_MsgAckWarp.create_with_Warp_Ok(json_msgWarp_src, false);
672
- json_msgNackWarp_dst.referer= karr_referer_dst;
673
- str_msgNackWarp_dst = JSON.stringify(json_msgNackWarp_dst);
674
-
675
- jasmine.clock().tick(STT_MSEC_1000); // 2000
676
-
677
- json_msgEngage_src= JSON_MsgEngage.create_with_Warp(json_msgWarp_src);
678
- json_msgEngage_src.referer= karr_referer_src;
679
- str_msgEngage_src = JSON.stringify(json_msgEngage_src);
680
-
681
- expect(Date.now()-T0).toBe(STT_MSEC_1000 *2);
682
- expect(Date.now()-T0).toBe(RTT_MSEC_2000);
683
- });
684
-
685
- it('Late Ack', () => {
686
- expect(t_ttl_rtt(TTL_MSEC_1500) === 3000).toBe(true)
687
-
688
- jasmine.clock().tick(1000 -1); // 2999
689
- expect(Date.now()-T0).toBe(t_ttl_rtt(TTL_MSEC_1500) -1);
690
-
691
- expect(callback_msgAckWarp).not.toHaveBeenCalled();
692
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
693
-
694
- jasmine.clock().tick(1); // 3000
695
- expect(callback_msgAckWarp).not.toHaveBeenCalled();
696
- expect(callback_msg_sent_expired).toHaveBeenCalled();
697
-
698
- twoPhW.handler_json_msgAck(json_msgAckWarp_dst, json_msgAckWarp_dst);
699
- expect(callback_msgAckWarp).not.toHaveBeenCalled();
700
- expect(eventLog.arr_events.length).toBe(1);
701
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateWarp).toBe(true);
702
- });
703
-
704
- it('send JSON_MsgWarp == NACK', () => {
705
- twoPhW.handler_json_msgAck(str_msgNackWarp_dst, json_msgNackWarp_dst);
706
- expect(eventLog.arr_events.length).toBe(2);
707
- expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
708
- expect(eventLog.arr_events[1].data).toEqual({msg : str_msgNackWarp_dst, json_msg : json_msgNackWarp_dst });
709
- expect(callback_msgAckWarp).toHaveBeenCalled();
710
-
711
- twoPhW.register_msgEngage(str_msgEngage_src, json_msgEngage_src);
712
- expect(eventLog.arr_events.length).toBe(2);
713
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
714
-
715
- jasmine.clock().tick(STT_MSEC_1000); // 3000
716
- const json_msgAckEngage_recv= JSON_MsgAckEngage.create_with_Engage_Ok(json_msgEngage_src, true);
717
- json_msgAckEngage_recv.referer= karr_referer_dst;
718
-
719
- jasmine.clock().tick(STT_MSEC_1000); // 4000
720
- twoPhW.handler_json_msgAck(json_msgAckEngage_recv, json_msgAckEngage_recv);
721
- expect(eventLog.arr_events.length).toBe(2);
722
- });
723
-
724
- describe('register Engage!', () => {
725
- beforeEach(() => {
726
- LOGR_.toggle(l_, {
727
- // SENDER : 1,
728
- // PROTOCOL_STATE : 1,
729
- // DROPS : 1
730
- });
731
-
732
- expect(Date.now()-T0).toBe(RTT_MSEC_2000);
733
-
734
- twoPhW.handler_json_msgAck(str_msgAckWarp_dst, json_msgAckWarp_dst);
735
- expect(callback_msgAckWarp).toHaveBeenCalled();
736
- expect(eventLog.arr_events.length).toBe(2);
737
- expect(eventLog.arr_events[1].type).toBe('2PhW[JSON_MsgAckWarp]');
738
- expect(eventLog.arr_events[1].data).toEqual({ msg: str_msgAckWarp_dst, json_msg : json_msgAckWarp_dst });
739
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
740
- });
741
-
742
- it('CAN register a Engage', () => {
743
- expect(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000).toBe(true)
744
- jasmine.clock().tick(TTL_MSEC_1500*2 -1); // 4999
745
- expect(Date.now()-T0).toBe(4999);
746
-
747
- twoPhW.register_msgEngage(str_msgEngage_src, json_msgEngage_src);
748
- expect(eventLog.arr_events.length).toBe(3);
749
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
750
- });
751
-
752
- it('delayed register of Engage', () => {
753
- expect(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000).toBe(true)
754
- jasmine.clock().tick(300);
755
- expect(Date.now()-T0).toBe(RTT_MSEC_2000 +300);
756
- twoPhW.register_msgEngage(str_msgEngage_src, json_msgEngage_src);
757
- expect(eventLog.arr_events.length).toBe(3);
758
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
759
-
760
- jasmine.clock().tick( t_ttl_rtt(TTL_MSEC_1500) -300 -1); // 4999
761
- expect(Date.now()-T0).toBe(4999);
762
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
763
-
764
- jasmine.clock().tick(1);
765
- expect(callback_msg_sent_expired).toHaveBeenCalled();
766
- });
767
-
768
- it('can NOT register an expired Engage', () => {
769
- expect(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000).toBe(true)
770
- jasmine.clock().tick(TTL_MSEC_1500*2); // 5000
771
- twoPhW.register_msgEngage(str_msgEngage_src, json_msgEngage_src);
772
- expect(eventLog.arr_events.length).toBe(2);
773
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckWarp).toBe(true);
774
- });
775
-
776
- describe('Engage!', () => {
777
- let json_msgAckEngage_dst;
778
- let str_msgAckEngage_dst;
779
-
780
- beforeEach(() => {
781
- LOGR_.toggle(l_, {
782
- // SENDER : 1,
783
- // PROTOCOL_STATE : 1,
784
- // DROPS : 1
785
- });
786
-
787
- expect(Date.now()-T0).toBe(RTT_MSEC_2000);
788
-
789
- twoPhW.register_msgEngage(str_msgEngage_src, json_msgEngage_src);
790
- expect(eventLog.arr_events.length).toBe(3);
791
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
792
-
793
- jasmine.clock().tick(STT_MSEC_1000); // 3000
794
- json_msgAckEngage_dst= JSON_MsgAckEngage.create_with_Engage_Ok(json_msgEngage_src, true);
795
- json_msgAckEngage_dst.referer= karr_referer_dst;
796
- str_msgAckEngage_dst = JSON.stringify(json_msgAckEngage_dst);
797
-
798
- jasmine.clock().tick(STT_MSEC_1000); // 4000
799
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
800
-
801
- expect(Date.now()-T0).toBe(RTT_MSEC_2000 +(STT_MSEC_1000*2));
802
- expect(Date.now()-T0).toBe(4000);
803
- });
804
-
805
- it('Ack', () => {
806
- expect(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000).toBe(true)
807
-
808
- jasmine.clock().tick(1000 -1); // 4999
809
- expect(Date.now()-T0).toBe(4999);
810
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
811
-
812
- twoPhW.handler_json_msgAck(str_msgAckEngage_dst, json_msgAckEngage_dst);
813
- expect(eventLog.arr_events.length).toBe(4);
814
- expect(eventLog.arr_events[3].type).toBe('2PhW[JSON_MsgAckEngage]');
815
- expect(eventLog.arr_events[3].data).toEqual({ msg: str_msgAckEngage_dst, json_msg : json_msgAckEngage_dst });
816
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateAckEngage).toBe(true);
817
-
818
- jasmine.clock().tick(1); // 5000
819
- expect(callback_msg_sent_expired).not.toHaveBeenCalled();
820
- });
821
-
822
- it('Ack (timed out)', () => {
823
- expect(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000) === 5000).toBe(true)
824
-
825
- jasmine.clock().tick(1000); // 5000
826
- expect(Date.now()-T0).toBe(t_ttl_rtt(TTL_MSEC_1500, RTT_MSEC_2000));
827
- expect(callback_msg_sent_expired).toHaveBeenCalled();
828
-
829
- // test to make sure a late ack isn't a valid AckEngage state
830
- twoPhW.handler_json_msgAck(str_msgAckEngage_dst, json_msgAckEngage_dst);
831
- expect(eventLog.arr_events.length).toBe(3);
832
- expect((twoPhW.eventLog.traverse_State(json_msgWarp_src)).state instanceof StateEngage).toBe(true);
833
- });
834
-
835
-
836
- });
837
-
838
- });
839
-
840
- });
841
-
842
- });
843
-
844
- //TODO: check if multiple warps have been sent out with the same destination
845
-
846
-
847
-
848
- });
849
-
850
- //-------------------------------------------------------------------------------------------------
package/tsconfig.json DELETED
@@ -1,115 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- // "jsx": "preserve", /* Specify what JSX code is generated. */
17
- // "libReplacement": true, /* Enable lib replacement. */
18
- // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
19
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
20
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
21
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
22
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
23
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
24
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
25
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
26
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
27
-
28
- /* Modules */
29
- "module": "ESNext", /* Specify what module code is generated. */
30
- "rootDir": "./src", /* Specify the root folder within your source files. */
31
- "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
32
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
33
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
34
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
35
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
36
- "types": [ "node" ], /* Specify type package names to be included without being referenced in a source file. */
37
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
38
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
39
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
40
- // "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
41
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
42
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
43
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
44
- // "noUncheckedSideEffectImports": true, /* Check side effect imports. */
45
- // "resolveJsonModule": true, /* Enable importing .json files. */
46
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
47
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
48
-
49
- /* JavaScript Support */
50
- "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
51
- "checkJs": false, /* Enable error reporting in type-checked JavaScript files. */
52
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
53
-
54
- /* Emit */
55
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
56
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
57
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
58
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
59
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
60
- // "noEmit": true, /* Disable emitting files from a compilation. */
61
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
62
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
63
- // "removeComments": true, /* Disable emitting comments. */
64
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
65
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
66
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
67
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
68
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
69
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
70
- // "newLine": "crlf", /* Set the newline character for emitting files. */
71
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
72
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
73
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
74
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
75
- "declarationDir": "./dist", /* Specify the output directory for generated declaration files. */
76
-
77
- /* Interop Constraints */
78
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
79
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
80
- // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
81
- // "erasableSyntaxOnly": true, /* Do not allow runtime constructs that are not part of ECMAScript. */
82
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
83
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
84
- // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
85
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
86
-
87
- /* Type Checking */
88
- "strict": false, /* Enable all strict type-checking options. */
89
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
90
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
91
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
92
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
93
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
94
- // "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
95
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
96
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
97
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
98
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
99
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
100
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
101
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
102
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
103
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
104
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
105
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
106
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
107
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
108
-
109
- /* Completeness */
110
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
111
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
112
- },
113
- "include": ["src/**/*"],
114
- "exclude": ["node_modules", "dist"]
115
- }