@rootintf/protocol-2phw 1.2.4-api.1 → 2.0.3-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.
@@ -1,4 +1,180 @@
1
- const schema_MsgWarp = validate19;function validate19(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate19.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.warp === undefined) && (missing0 = "warp")){validate19.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.warp !== undefined){let data0 = data.warp;const _errs1 = errors;{if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((((data0.id === undefined) && (missing1 = "id")) || ((data0.user === undefined) && (missing1 = "user"))) || ((data0.hyperport === undefined) && (missing1 = "hyperport"))) || ((data0.ttl_msec === undefined) && (missing1 = "ttl_msec"))){validate19.errors = [{instancePath:instancePath+"/warp",schemaPath:"#/properties/warp/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.id !== undefined){const _errs3 = errors;if(typeof data0.id !== "string"){validate19.errors = [{instancePath:instancePath+"/warp/id",schemaPath:"definitions#/definitions/warp_id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs3 === errors;}else {var valid1 = true;}if(valid1){if(data0.ttl_msec !== undefined){let data2 = data0.ttl_msec;const _errs6 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate19.errors = [{instancePath:instancePath+"/warp/ttl_msec",schemaPath:"#/properties/warp/properties/ttl_msec/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid1 = _errs6 === errors;}else {var valid1 = true;}if(valid1){if(data0.instantaneous !== undefined){const _errs8 = errors;if(typeof data0.instantaneous !== "boolean"){validate19.errors = [{instancePath:instancePath+"/warp/instantaneous",schemaPath:"#/properties/warp/properties/instantaneous/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs8 === errors;}else {var valid1 = true;}}}}}else {validate19.errors = [{instancePath:instancePath+"/warp",schemaPath:"#/properties/warp/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs1 === errors;}else {var valid0 = true;}if(valid0){if(data["2PhW"] !== undefined){const _errs10 = errors;if("1" !== data["2PhW"]){validate19.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"definitions#/definitions/2PhW/const",keyword:"const",params:{allowedValue: "1"},message:"must be equal to constant"}];return false;}var valid0 = _errs10 === errors;}else {var valid0 = true;}}}}else {validate19.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate19.errors = vErrors;return errors === 0;}validate19.evaluated = {"props":{"warp":true,"2PhW":true},"dynamicProps":false,"dynamicItems":false};const schema_MsgEngage = validate20;function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.engage === undefined) && (missing0 = "engage")){validate20.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.engage !== undefined){let data0 = data.engage;const _errs1 = errors;{if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((data0.ok === undefined) && (missing1 = "ok")) || ((data0.rtt_msec === undefined) && (missing1 = "rtt_msec"))){validate20.errors = [{instancePath:instancePath+"/engage",schemaPath:"#/properties/engage/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.ok !== undefined){const _errs3 = errors;if(typeof data0.ok !== "boolean"){validate20.errors = [{instancePath:instancePath+"/engage/ok",schemaPath:"#/properties/engage/properties/ok/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs3 === errors;}else {var valid1 = true;}if(valid1){if(data0.rtt_msec !== undefined){let data2 = data0.rtt_msec;const _errs5 = errors;if(!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))){validate20.errors = [{instancePath:instancePath+"/engage/rtt_msec",schemaPath:"#/properties/engage/properties/rtt_msec/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid1 = _errs5 === errors;}else {var valid1 = true;}}}}else {validate20.errors = [{instancePath:instancePath+"/engage",schemaPath:"#/properties/engage/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid0 = _errs1 === errors;}else {var valid0 = true;}if(valid0){if(data["2PhW"] !== undefined){const _errs7 = errors;if("1" !== data["2PhW"]){validate20.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"definitions#/definitions/2PhW/const",keyword:"const",params:{allowedValue: "1"},message:"must be equal to constant"}];return false;}var valid0 = _errs7 === errors;}else {var valid0 = true;}}}}else {validate20.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":{"engage":true,"2PhW":true},"dynamicProps":false,"dynamicItems":false};
1
+ const schema_MsgWarp = validate19;
2
+ function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate19.evaluated; if (evaluated0.dynamicProps) {
3
+ evaluated0.props = undefined;
4
+ } if (evaluated0.dynamicItems) {
5
+ evaluated0.items = undefined;
6
+ } {
7
+ if (data && typeof data == "object" && !Array.isArray(data)) {
8
+ let missing0;
9
+ if ((data.warp === undefined) && (missing0 = "warp")) {
10
+ validate19.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
11
+ return false;
12
+ }
13
+ else {
14
+ if (data.warp !== undefined) {
15
+ let data0 = data.warp;
16
+ const _errs1 = errors;
17
+ {
18
+ if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
19
+ let missing1;
20
+ if (((((data0.id === undefined) && (missing1 = "id")) || ((data0.user === undefined) && (missing1 = "user"))) || ((data0.hyperport === undefined) && (missing1 = "hyperport"))) || ((data0.ttl_msec === undefined) && (missing1 = "ttl_msec"))) {
21
+ validate19.errors = [{ instancePath: instancePath + "/warp", schemaPath: "#/properties/warp/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
22
+ return false;
23
+ }
24
+ else {
25
+ if (data0.id !== undefined) {
26
+ const _errs3 = errors;
27
+ if (typeof data0.id !== "string") {
28
+ validate19.errors = [{ instancePath: instancePath + "/warp/id", schemaPath: "definitions#/definitions/warp_id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
29
+ return false;
30
+ }
31
+ var valid1 = _errs3 === errors;
32
+ }
33
+ else {
34
+ var valid1 = true;
35
+ }
36
+ if (valid1) {
37
+ if (data0.ttl_msec !== undefined) {
38
+ let data2 = data0.ttl_msec;
39
+ const _errs6 = errors;
40
+ if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) {
41
+ validate19.errors = [{ instancePath: instancePath + "/warp/ttl_msec", schemaPath: "#/properties/warp/properties/ttl_msec/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
42
+ return false;
43
+ }
44
+ var valid1 = _errs6 === errors;
45
+ }
46
+ else {
47
+ var valid1 = true;
48
+ }
49
+ if (valid1) {
50
+ if (data0.instantaneous !== undefined) {
51
+ const _errs8 = errors;
52
+ if (typeof data0.instantaneous !== "boolean") {
53
+ validate19.errors = [{ instancePath: instancePath + "/warp/instantaneous", schemaPath: "#/properties/warp/properties/instantaneous/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
54
+ return false;
55
+ }
56
+ var valid1 = _errs8 === errors;
57
+ }
58
+ else {
59
+ var valid1 = true;
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ else {
66
+ validate19.errors = [{ instancePath: instancePath + "/warp", schemaPath: "#/properties/warp/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
67
+ return false;
68
+ }
69
+ }
70
+ var valid0 = _errs1 === errors;
71
+ }
72
+ else {
73
+ var valid0 = true;
74
+ }
75
+ if (valid0) {
76
+ if (data["2PhW"] !== undefined) {
77
+ const _errs10 = errors;
78
+ if ("2" !== data["2PhW"]) {
79
+ validate19.errors = [{ instancePath: instancePath + "/2PhW", schemaPath: "definitions#/definitions/2PhW/const", keyword: "const", params: { allowedValue: "2" }, message: "must be equal to constant" }];
80
+ return false;
81
+ }
82
+ var valid0 = _errs10 === errors;
83
+ }
84
+ else {
85
+ var valid0 = true;
86
+ }
87
+ }
88
+ }
89
+ }
90
+ else {
91
+ validate19.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
92
+ return false;
93
+ }
94
+ } validate19.errors = vErrors; return errors === 0; }
95
+ validate19.evaluated = { "props": { "warp": true, "2PhW": true }, "dynamicProps": false, "dynamicItems": false };
96
+ const schema_MsgEngage = validate20;
97
+ function validate20(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate20.evaluated; if (evaluated0.dynamicProps) {
98
+ evaluated0.props = undefined;
99
+ } if (evaluated0.dynamicItems) {
100
+ evaluated0.items = undefined;
101
+ } {
102
+ if (data && typeof data == "object" && !Array.isArray(data)) {
103
+ let missing0;
104
+ if ((data.engage === undefined) && (missing0 = "engage")) {
105
+ validate20.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
106
+ return false;
107
+ }
108
+ else {
109
+ if (data.engage !== undefined) {
110
+ let data0 = data.engage;
111
+ const _errs1 = errors;
112
+ {
113
+ if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
114
+ let missing1;
115
+ if (((data0.ok === undefined) && (missing1 = "ok")) || ((data0.rtt_msec === undefined) && (missing1 = "rtt_msec"))) {
116
+ validate20.errors = [{ instancePath: instancePath + "/engage", schemaPath: "#/properties/engage/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
117
+ return false;
118
+ }
119
+ else {
120
+ if (data0.ok !== undefined) {
121
+ const _errs3 = errors;
122
+ if (typeof data0.ok !== "boolean") {
123
+ validate20.errors = [{ instancePath: instancePath + "/engage/ok", schemaPath: "#/properties/engage/properties/ok/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
124
+ return false;
125
+ }
126
+ var valid1 = _errs3 === errors;
127
+ }
128
+ else {
129
+ var valid1 = true;
130
+ }
131
+ if (valid1) {
132
+ if (data0.rtt_msec !== undefined) {
133
+ let data2 = data0.rtt_msec;
134
+ const _errs5 = errors;
135
+ if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) {
136
+ validate20.errors = [{ instancePath: instancePath + "/engage/rtt_msec", schemaPath: "#/properties/engage/properties/rtt_msec/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
137
+ return false;
138
+ }
139
+ var valid1 = _errs5 === errors;
140
+ }
141
+ else {
142
+ var valid1 = true;
143
+ }
144
+ }
145
+ }
146
+ }
147
+ else {
148
+ validate20.errors = [{ instancePath: instancePath + "/engage", schemaPath: "#/properties/engage/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
149
+ return false;
150
+ }
151
+ }
152
+ var valid0 = _errs1 === errors;
153
+ }
154
+ else {
155
+ var valid0 = true;
156
+ }
157
+ if (valid0) {
158
+ if (data["2PhW"] !== undefined) {
159
+ const _errs7 = errors;
160
+ if ("2" !== data["2PhW"]) {
161
+ validate20.errors = [{ instancePath: instancePath + "/2PhW", schemaPath: "definitions#/definitions/2PhW/const", keyword: "const", params: { allowedValue: "2" }, message: "must be equal to constant" }];
162
+ return false;
163
+ }
164
+ var valid0 = _errs7 === errors;
165
+ }
166
+ else {
167
+ var valid0 = true;
168
+ }
169
+ }
170
+ }
171
+ }
172
+ else {
173
+ validate20.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
174
+ return false;
175
+ }
176
+ } validate20.errors = vErrors; return errors === 0; }
177
+ validate20.evaluated = { "props": { "engage": true, "2PhW": true }, "dynamicProps": false, "dynamicItems": false };
2
178
 
3
179
  // console.log('OUT', __name({variableName}) );
4
180
 
@@ -192,7 +368,115 @@ function requireJsonMsg_cjs () {
192
368
  if (hasRequiredJsonMsg_cjs) return jsonMsg_cjs;
193
369
  hasRequiredJsonMsg_cjs = 1;
194
370
 
195
- const schema_Msg = validate18;function validate18(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate18.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((((data.id === undefined) && (missing0 = "id")) || ((data.referer === undefined) && (missing0 = "referer"))) || ((data.dt === undefined) && (missing0 = "dt"))){validate18.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.id !== undefined){const _errs1 = errors;if(typeof data.id !== "string"){validate18.errors = [{instancePath:instancePath+"/id",schemaPath:"#/properties/id/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs1 === errors;}else {var valid0 = true;}if(valid0){if(data.dt !== undefined){const _errs3 = errors;if(typeof data.dt !== "string"){validate18.errors = [{instancePath:instancePath+"/dt",schemaPath:"#/properties/dt/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs3 === errors;}else {var valid0 = true;}}}}else {validate18.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate18.errors = vErrors;return errors === 0;}validate18.evaluated = {"props":{"id":true,"dt":true},"dynamicProps":false,"dynamicItems":false};const schema_Msg_msg = validate19;function validate19(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate19.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data._msg === undefined) && (missing0 = "_msg")){validate19.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}}else {validate19.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate19.errors = vErrors;return errors === 0;}validate19.evaluated = {"dynamicProps":false,"dynamicItems":false};const schema_MsgAck_msg = validate20;function validate20(data, {instancePath="", parentData, parentDataProperty, rootData=data, dynamicAnchors={}}={}){let vErrors = null;let errors = 0;const evaluated0 = validate20.evaluated;if(evaluated0.dynamicProps){evaluated0.props = undefined;}if(evaluated0.dynamicItems){evaluated0.items = undefined;}{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ack === undefined) && (missing0 = "ack")){validate20.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.ack !== undefined){let data0 = data.ack;{if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if((data0.ok === undefined) && (missing1 = "ok")){validate20.errors = [{instancePath:instancePath+"/ack",schemaPath:"#/properties/ack/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.ok !== undefined){if(typeof data0.ok !== "boolean"){validate20.errors = [{instancePath:instancePath+"/ack/ok",schemaPath:"#/properties/ack/properties/ok/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}}}}else {validate20.errors = [{instancePath:instancePath+"/ack",schemaPath:"#/properties/ack/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}}else {validate20.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate20.errors = vErrors;return errors === 0;}validate20.evaluated = {"props":{"ack":true},"dynamicProps":false,"dynamicItems":false};
371
+ const schema_Msg = validate18;
372
+ function validate18(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate18.evaluated; if (evaluated0.dynamicProps) {
373
+ evaluated0.props = undefined;
374
+ } if (evaluated0.dynamicItems) {
375
+ evaluated0.items = undefined;
376
+ } {
377
+ if (data && typeof data == "object" && !Array.isArray(data)) {
378
+ let missing0;
379
+ if ((((data.id === undefined) && (missing0 = "id")) || ((data.referer === undefined) && (missing0 = "referer"))) || ((data.dt === undefined) && (missing0 = "dt"))) {
380
+ validate18.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
381
+ return false;
382
+ }
383
+ else {
384
+ if (data.id !== undefined) {
385
+ const _errs1 = errors;
386
+ if (typeof data.id !== "string") {
387
+ validate18.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
388
+ return false;
389
+ }
390
+ var valid0 = _errs1 === errors;
391
+ }
392
+ else {
393
+ var valid0 = true;
394
+ }
395
+ if (valid0) {
396
+ if (data.dt !== undefined) {
397
+ const _errs3 = errors;
398
+ if (typeof data.dt !== "string") {
399
+ validate18.errors = [{ instancePath: instancePath + "/dt", schemaPath: "#/properties/dt/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
400
+ return false;
401
+ }
402
+ var valid0 = _errs3 === errors;
403
+ }
404
+ else {
405
+ var valid0 = true;
406
+ }
407
+ }
408
+ }
409
+ }
410
+ else {
411
+ validate18.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
412
+ return false;
413
+ }
414
+ } validate18.errors = vErrors; return errors === 0; }
415
+ validate18.evaluated = { "props": { "id": true, "dt": true }, "dynamicProps": false, "dynamicItems": false };
416
+ const schema_MsgEffect = validate19;
417
+ function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate19.evaluated; if (evaluated0.dynamicProps) {
418
+ evaluated0.props = undefined;
419
+ } if (evaluated0.dynamicItems) {
420
+ evaluated0.items = undefined;
421
+ } {
422
+ if (data && typeof data == "object" && !Array.isArray(data)) {
423
+ let missing0;
424
+ if ((data._cause === undefined) && (missing0 = "_cause")) {
425
+ validate19.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
426
+ return false;
427
+ }
428
+ }
429
+ else {
430
+ validate19.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
431
+ return false;
432
+ }
433
+ } validate19.errors = vErrors; return errors === 0; }
434
+ validate19.evaluated = { "dynamicProps": false, "dynamicItems": false };
435
+ const schema_MsgAckEffect = validate20;
436
+ function validate20(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) { let vErrors = null; let errors = 0; const evaluated0 = validate20.evaluated; if (evaluated0.dynamicProps) {
437
+ evaluated0.props = undefined;
438
+ } if (evaluated0.dynamicItems) {
439
+ evaluated0.items = undefined;
440
+ } {
441
+ if (data && typeof data == "object" && !Array.isArray(data)) {
442
+ let missing0;
443
+ if ((data.ack === undefined) && (missing0 = "ack")) {
444
+ validate20.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
445
+ return false;
446
+ }
447
+ else {
448
+ if (data.ack !== undefined) {
449
+ let data0 = data.ack;
450
+ {
451
+ if (data0 && typeof data0 == "object" && !Array.isArray(data0)) {
452
+ let missing1;
453
+ if ((data0.ok === undefined) && (missing1 = "ok")) {
454
+ validate20.errors = [{ instancePath: instancePath + "/ack", schemaPath: "#/properties/ack/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
455
+ return false;
456
+ }
457
+ else {
458
+ if (data0.ok !== undefined) {
459
+ if (typeof data0.ok !== "boolean") {
460
+ validate20.errors = [{ instancePath: instancePath + "/ack/ok", schemaPath: "#/properties/ack/properties/ok/type", keyword: "type", params: { type: "boolean" }, message: "must be boolean" }];
461
+ return false;
462
+ }
463
+ }
464
+ }
465
+ }
466
+ else {
467
+ validate20.errors = [{ instancePath: instancePath + "/ack", schemaPath: "#/properties/ack/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
468
+ return false;
469
+ }
470
+ }
471
+ }
472
+ }
473
+ }
474
+ else {
475
+ validate20.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
476
+ return false;
477
+ }
478
+ } validate20.errors = vErrors; return errors === 0; }
479
+ validate20.evaluated = { "props": { "ack": true }, "dynamicProps": false, "dynamicItems": false };
196
480
 
197
481
  const byteToHex = [];
198
482
  for (let i = 0; i < 256; ++i) {
@@ -236,10 +520,7 @@ function requireJsonMsg_cjs () {
236
520
  const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
237
521
  var native = { randomUUID };
238
522
 
239
- function v4(options, buf, offset) {
240
- if (native.randomUUID && true && !options) {
241
- return native.randomUUID();
242
- }
523
+ function _v4(options, buf, offset) {
243
524
  options = options || {};
244
525
  const rnds = options.random ?? options.rng?.() ?? rng();
245
526
  if (rnds.length < 16) {
@@ -249,6 +530,12 @@ function requireJsonMsg_cjs () {
249
530
  rnds[8] = (rnds[8] & 0x3f) | 0x80;
250
531
  return unsafeStringify(rnds);
251
532
  }
533
+ function v4(options, buf, offset) {
534
+ if (native.randomUUID && true && !options) {
535
+ return native.randomUUID();
536
+ }
537
+ return _v4(options);
538
+ }
252
539
 
253
540
  // console.log('OUT', __name({variableName}) );
254
541
 
@@ -343,227 +630,202 @@ function requireJsonMsg_cjs () {
343
630
 
344
631
  })();
345
632
 
346
- let LOGR_= LOGR.get_instance();
347
- const log_= LOGR_.log;
348
-
349
- const l_= {
350
- VALIDATION : 0b1 << 0,
633
+ let LOGR_ = LOGR.get_instance();
634
+ const log_ = LOGR_.log;
635
+ const l_ = {
636
+ VALIDATION: 0b1 << 0,
351
637
  };
352
- LOGR_.labels= l_;
353
-
638
+ LOGR_.labels = l_;
354
639
  // TODO: use RFC3339 "timestamp"? https://ajv.js.org/json-type-definition.html
355
-
356
640
  // "module" pattern to avoid "static" and "#" private : https://stackoverflow.com/a/1479341/298545
357
- var JSON_Msg = (function() {
358
- return {
359
- merge: function(json) {
360
- return Object.assign({
361
- id: v4(),
362
- referer: null,
363
- dt: new Date().toISOString()
364
- }, json || {});
365
- },
366
- validate : function (json) {
367
- const b_valid = schema_Msg(json);
368
- if (!b_valid)
369
- log_(l_.VALIDATION, () => ['JSON_Msg: validate: ', schema_Msg.errors]);
370
- return b_valid;
371
- },
372
- // TODO: requires a separate ajv module require, and JTD specific schema
373
- // https://ajv.js.org/guide/getting-started.html#parsing-and-serializing-json
374
- // static #ajv_parse_= ajv.compileParser(this.#schema_json_Msg);
375
- // static parse(json) {
376
- // return this.#ajv_parse_(json);
377
- // }
378
- }
641
+ var JSON_Msg = (function () {
642
+ return {
643
+ merge: function (json) {
644
+ return Object.assign({
645
+ id: v4(),
646
+ referer: null,
647
+ dt: new Date().toISOString()
648
+ }, json || {});
649
+ },
650
+ validate: function (json) {
651
+ const b_valid = schema_Msg(json);
652
+ if (!b_valid)
653
+ log_(l_.VALIDATION, () => ['JSON_Msg: validate: ', schema_Msg.errors]);
654
+ return b_valid;
655
+ },
656
+ // TODO: requires a separate ajv module require, and JTD specific schema
657
+ // https://ajv.js.org/guide/getting-started.html#parsing-and-serializing-json
658
+ // static #ajv_parse_= ajv.compileParser(this.#schema_json_Msg);
659
+ // static parse(json) {
660
+ // return this.#ajv_parse_(json);
661
+ // }
662
+ };
379
663
  })();
380
-
381
- var JSON_Msg_msg = (function() {
382
- return {
383
- create_with_msg_merge: function(_msg, json) {
384
- return Object.assign(JSON_Msg.merge(json), { _msg });
385
- },
386
- validate : function(json) {
387
- if (! JSON_Msg.validate(json))
388
- return false;
389
- const b_valid= schema_Msg_msg(json);
390
- if (!b_valid)
391
- log_(l_.VALIDATION, () => ['JSON_Msg_msg: validate: ', schema_Msg_msg.errors]);
392
- return b_valid;
393
- }
394
- }
664
+ var JSON_MsgEffect = (function () {
665
+ return {
666
+ create_with_cause_merge: function (msg_cause, json) {
667
+ const _cause = msg_cause;
668
+ return Object.assign(JSON_Msg.merge(json), { _cause });
669
+ },
670
+ validate: function (json) {
671
+ if (!JSON_Msg.validate(json))
672
+ return false;
673
+ const b_valid = schema_MsgEffect(json);
674
+ if (!b_valid)
675
+ log_(l_.VALIDATION, () => ['JSON_MsgEffect: validate: ', schema_MsgEffect.errors]);
676
+ return b_valid;
677
+ }
678
+ };
395
679
  })();
396
-
397
- var JSON_MsgAck_msg = (function() {
398
- return {
399
- create_with_msgOk : function(_msg, b_ok= true) {
400
- return JSON_Msg_msg.create_with_msg_merge(_msg, {
401
- ack : {
402
- "ok" : b_ok,
403
- },
404
- });
405
- },
406
- create_with_msgExpired : function(_msg) {
407
- return JSON_Msg_msg.create_with_msg_merge(_msg, {
408
- ack : {
409
- "ok" : false,
410
- "expired" : true
411
- },
412
- });
413
- },
414
- validate : function(json) {
415
- if (! JSON_Msg_msg.validate(json))
416
- return false;
417
- const b_valid= schema_MsgAck_msg(json);
418
- if (!b_valid)
419
- log_(l_.VALIDATION, () => ['JSON_MsgAck: validate: ', schema_MsgAck_msg.errors]);
420
- return b_valid;
421
- }
422
- }
680
+ var JSON_MsgAck = (function () {
681
+ return {
682
+ create_with_cause_Ok: function (msg_cause, b_ok = true) {
683
+ return JSON_MsgEffect.create_with_cause_merge(msg_cause, {
684
+ ack: {
685
+ "ok": b_ok,
686
+ },
687
+ });
688
+ },
689
+ create_with_cause_Expired: function (msg_cause) {
690
+ return JSON_MsgEffect.create_with_cause_merge(msg_cause, {
691
+ ack: {
692
+ "ok": false,
693
+ "expired": true
694
+ },
695
+ });
696
+ },
697
+ validate: function (json) {
698
+ if (!JSON_MsgEffect.validate(json))
699
+ return false;
700
+ const b_valid = schema_MsgAckEffect(json);
701
+ if (!b_valid)
702
+ log_(l_.VALIDATION, () => ['JSON_MsgAckEffect: validate: ', schema_MsgAckEffect.errors]);
703
+ return b_valid;
704
+ }
705
+ };
423
706
  })();
424
707
 
425
708
  jsonMsg_cjs.JSON_Msg = JSON_Msg;
426
- jsonMsg_cjs.JSON_MsgAck_msg = JSON_MsgAck_msg;
427
- jsonMsg_cjs.JSON_Msg_msg = JSON_Msg_msg;
709
+ jsonMsg_cjs.JSON_MsgAck = JSON_MsgAck;
710
+ jsonMsg_cjs.JSON_MsgEffect = JSON_MsgEffect;
428
711
  jsonMsg_cjs.l = l_;
429
712
  return jsonMsg_cjs;
430
713
  }
431
714
 
432
715
  var jsonMsg_cjsExports = requireJsonMsg_cjs();
433
716
 
434
- //-------------------------------------------------------------------------------------------------
435
-
436
- let LOGR_$1= LOGR.get_instance();
437
- const log_$1= LOGR_$1.log;
438
-
439
- const l_$1= {
440
- EVENTS : 0b1 << 0,
441
- TIMEOUTS : 0b1 << 1,
442
- };
443
- LOGR_$1.labels= l_$1;
444
- // LOGR_.toggled= {
445
- // EVENTS : 1
446
- // }
447
-
448
-
449
- //-------------------------------------------------------------------------------------------------
450
-
451
- class EventLog {
452
- constructor() {
453
- this.arr_events = []; // In-memory event store
454
- this.map_index_id = new Map(); // Map of id -> array of indices into arr_events; arr_events[idx]
455
- this.map_timeouts = new Map(); // Store timeout references: idx -> timeout_id
456
- }
457
-
458
- addEvent(type, id, data, timeout_ms = null, timeout_callback = null) {
459
- const evt = {
460
- type,
461
- dt: Date.now(),
462
- id,
463
- data,
464
- timeout_id: null // Will store timeout reference if set
465
- };
466
- const idx = this.arr_events.push(evt) - 1; // More efficient than .length before push
467
-
468
- let arr_indices = this.map_index_id.get(id);
469
- if (! arr_indices) {
470
- arr_indices = [];
471
- this.map_index_id.set(id, arr_indices);
472
- }
473
- arr_indices.push(idx);
474
-
475
- // Set timeout if specified
476
- if (timeout_ms && timeout_callback) {
477
- evt.timeout_id = setTimeout(() => {
478
- if (this.map_timeouts.delete(idx)) {
479
- evt.timeout_id = null;
480
- timeout_callback({idx, evt});
481
- log_$1(l_$1.EVENTS, () => [`Event DELETED[${idx}]: ${type}`, evt]);
482
- }
483
- }, timeout_ms);
484
-
485
- this.map_timeouts.set(idx, evt.timeout_id);
486
- }
487
-
488
- // the error "toISOString is not a function" occurs because Date(evt.dt) is not doing what you expect.
489
- // When you pass a number to the Date constructor without using new, it doesn’t return a Date object—it returns a string. Specifically, it’s equivalent to new Date(evt.dt).toString().
490
- // Date(evt.dt).toISOString() -> new Date(evt.dt).toISOString()
491
- log_$1(l_$1.EVENTS, () => [`Event added[${idx}] @${new Date(evt.dt).toISOString()}: ${type}`, evt]);
492
- return { idx, evt };
493
- }
494
-
495
- cancelTimeout(idx) {
496
- const timeout_id = this.map_timeouts.get(idx);
497
- if (timeout_id) {
498
- clearTimeout(timeout_id);
499
- this.map_timeouts.delete(idx);
500
- if (this.arr_events[idx])
501
- this.arr_events[idx].timeout_id = null;
502
- return true;
503
- }
504
- return false;
505
- }
506
-
507
- cancelAllTimeouts() {
508
- for (const [idx, timeout_id] of this.map_timeouts) {
509
- clearTimeout(timeout_id);
510
- if (this.arr_events[idx])
511
- this.arr_events[idx].timeout_id = null;
512
- }
513
- this.map_timeouts.clear();
514
- }
515
-
516
- getEventsById(id, lookback_ms = null) {
517
- const arr_indices = this.map_index_id.get(id);
518
- if (!arr_indices?.length) return [];
519
-
520
- const result = [];
521
- const cutoff = lookback_ms !== null ? Date.now() - lookback_ms : -Infinity;
522
-
523
- // Single loop with early cutoff
524
- for (let i = arr_indices.length - 1; i >= 0; i--) {
525
- const idx = arr_indices[i];
526
- const evt = this.arr_events[idx];
527
- if (evt.dt < cutoff)
528
- break;
529
- result.push({ idx, evt });
530
- }
531
-
532
- return result; // Newest to oldest order
533
- }
534
-
535
- // getRecentEvents(id, lookbackMs) {
536
- // const cutoff = Date.now() - lookbackMs;
537
- // return this.events.filter(e => e.id === id && e.dt >= cutoff);
538
- // }
539
-
540
- getEvents(lookback_ms, predicate) {
541
- const cutoff = Date.now() - lookback_ms;
542
- const result = [];
543
-
544
- // Iterate backwards from the end
545
- for (let idx = this.arr_events.length - 1; idx >= 0; idx--) {
546
- const evt = this.arr_events[idx];
547
- if (evt.dt < cutoff) {
548
- break; // Stop once we pass the cutoff
549
- }
550
- if (predicate(evt)) {
551
- result.push({ idx, evt });
552
- }
553
- }
554
-
555
- return result; // Newest to oldest order
556
- }
557
-
558
- // setLogr(obj_logr) {
559
- // this.logr.toggled = obj_logr;
560
- // }
561
-
562
- clear() {
563
- this.cancelAllTimeouts(); // Clear all timeouts before clearing events
564
- this.arr_events.length = 0;
565
- this.map_index_id.clear();
566
- }
717
+ //-------------------------------------------------------------------------------------------------
718
+ let LOGR_$1 = LOGR.get_instance();
719
+ const log_$1 = LOGR_$1.log;
720
+ const l_$1 = {
721
+ EVENTS: 0b1 << 0,
722
+ TIMEOUTS: 0b1 << 1,
723
+ };
724
+ LOGR_$1.labels = l_$1;
725
+ // LOGR_.toggled= {
726
+ // EVENTS : 1
727
+ // }
728
+ //-------------------------------------------------------------------------------------------------
729
+ class EventLog {
730
+ constructor() {
731
+ this.arr_events = []; // In-memory event store
732
+ this.map_index_id = new Map(); // Map of id -> array of indices into arr_events; arr_events[idx]
733
+ this.map_timeouts = new Map(); // Store timeout references: idx -> timeout_id
734
+ }
735
+ addEvent(type, id, data, timeout_ms = null, timeout_callback = null) {
736
+ const evt = {
737
+ type,
738
+ dt: Date.now(),
739
+ id,
740
+ data,
741
+ timeout_id: null // Will store timeout reference if set
742
+ };
743
+ const idx = this.arr_events.push(evt) - 1; // More efficient than .length before push
744
+ let arr_indices = this.map_index_id.get(id);
745
+ if (!arr_indices) {
746
+ arr_indices = [];
747
+ this.map_index_id.set(id, arr_indices);
748
+ }
749
+ arr_indices.push(idx);
750
+ // Set timeout if specified
751
+ if (timeout_ms && timeout_callback) {
752
+ evt.timeout_id = setTimeout(() => {
753
+ if (this.map_timeouts.delete(idx)) {
754
+ evt.timeout_id = null;
755
+ timeout_callback({ idx, evt });
756
+ log_$1(l_$1.EVENTS, () => [`Event DELETED[${idx}]: ${type}`, evt]);
757
+ }
758
+ }, timeout_ms);
759
+ this.map_timeouts.set(idx, evt.timeout_id);
760
+ }
761
+ // the error "toISOString is not a function" occurs because Date(evt.dt) is not doing what you expect.
762
+ // When you pass a number to the Date constructor without using new, it doesn’t return a Date object—it returns a string. Specifically, it’s equivalent to new Date(evt.dt).toString().
763
+ // Date(evt.dt).toISOString() -> new Date(evt.dt).toISOString()
764
+ log_$1(l_$1.EVENTS, () => [`Event added[${idx}] @${new Date(evt.dt).toISOString()}: ${type}`, evt]);
765
+ return { idx, evt };
766
+ }
767
+ cancelTimeout(idx) {
768
+ const timeout_id = this.map_timeouts.get(idx);
769
+ if (timeout_id) {
770
+ clearTimeout(timeout_id);
771
+ this.map_timeouts.delete(idx);
772
+ if (this.arr_events[idx])
773
+ this.arr_events[idx].timeout_id = null;
774
+ return true;
775
+ }
776
+ return false;
777
+ }
778
+ cancelAllTimeouts() {
779
+ for (const [idx, timeout_id] of this.map_timeouts) {
780
+ clearTimeout(timeout_id);
781
+ if (this.arr_events[idx])
782
+ this.arr_events[idx].timeout_id = null;
783
+ }
784
+ this.map_timeouts.clear();
785
+ }
786
+ getEventsById(id, lookback_ms = null) {
787
+ const arr_indices = this.map_index_id.get(id);
788
+ if (!arr_indices?.length)
789
+ return [];
790
+ const result = [];
791
+ const cutoff = lookback_ms !== null ? Date.now() - lookback_ms : -Infinity;
792
+ // Single loop with early cutoff
793
+ for (let i = arr_indices.length - 1; i >= 0; i--) {
794
+ const idx = arr_indices[i];
795
+ const evt = this.arr_events[idx];
796
+ if (evt.dt < cutoff)
797
+ break;
798
+ result.push({ idx, evt });
799
+ }
800
+ return result; // Newest to oldest order
801
+ }
802
+ // getRecentEvents(id, lookbackMs) {
803
+ // const cutoff = Date.now() - lookbackMs;
804
+ // return this.events.filter(e => e.id === id && e.dt >= cutoff);
805
+ // }
806
+ getEvents(lookback_ms, predicate) {
807
+ const cutoff = Date.now() - lookback_ms;
808
+ const result = [];
809
+ // Iterate backwards from the end
810
+ for (let idx = this.arr_events.length - 1; idx >= 0; idx--) {
811
+ const evt = this.arr_events[idx];
812
+ if (evt.dt < cutoff) {
813
+ break; // Stop once we pass the cutoff
814
+ }
815
+ if (predicate(evt)) {
816
+ result.push({ idx, evt });
817
+ }
818
+ }
819
+ return result; // Newest to oldest order
820
+ }
821
+ // setLogr(obj_logr) {
822
+ // this.logr.toggled = obj_logr;
823
+ // }
824
+ clear() {
825
+ this.cancelAllTimeouts(); // Clear all timeouts before clearing events
826
+ this.arr_events.length = 0;
827
+ this.map_index_id.clear();
828
+ }
567
829
  }
568
830
 
569
831
  // interface Event extends Required<EventMinimal> {
@@ -571,9 +833,6 @@ class EventLog {
571
833
  // id : string | number;
572
834
  // timeout_id : NodeJS.Timeout | null;
573
835
  // };
574
- const k_ERROR = -1;
575
- const k_NOP = 0;
576
- // const k_HANDLED = 1;
577
836
  const k_TTL = 20000;
578
837
  //-------------------------------------------------------------------------------------------------
579
838
  const LOGR_ = LOGR.get_instance();
@@ -593,19 +852,19 @@ class Config {
593
852
  // Initialize callbacks as no-op functions
594
853
  this._callback_msgWarp = (_msg, _json_msg) => {
595
854
  console.assert(false, 'callback_msgWarp uninitialized');
596
- return k_ERROR;
855
+ return false;
597
856
  };
598
857
  this._callback_msgEngage = (_msg, _json_msg) => {
599
858
  console.assert(false, 'callback_msgEngage uninitialized');
600
- return k_ERROR;
859
+ return false;
601
860
  };
602
861
  this._callback_msgAckWarp = (_msg, _json_msg) => {
603
862
  console.assert(false, 'callback_msgAckWarp uninitialized');
604
- return k_ERROR;
863
+ return false;
605
864
  };
606
865
  this._callback_msgAckEngage = (_msg, _json_msg) => {
607
866
  console.assert(false, 'callback_msgAckEngage uninitialized');
608
- return k_ERROR;
867
+ return false;
609
868
  };
610
869
  this._callback_msg_sent_expired = (_msg, _json_msg) => {
611
870
  console.assert(false, '_callback_msg_sent_expired uninitialized');
@@ -640,7 +899,7 @@ class Config {
640
899
  // }
641
900
  // })();
642
901
  //-------------------------------------------------------------------------------------------------
643
- let k_VERSION = "1";
902
+ let k_VERSION = "2";
644
903
  // rtt_msec <= ttl_msec *2 => rtt_msec = ttl_msec *2
645
904
  // t_ttl_rtt_(TTL, RTT) = t_ttl_rtt_(TTL, TTL *2) = TTL *2 + TTL *2 = TTL *4 MAX
646
905
  function time_ttl_rtt_(ttl_msec, rtt_msec) {
@@ -653,8 +912,8 @@ function time_ttl_rtt_(ttl_msec, rtt_msec) {
653
912
  }
654
913
  var JSON_MsgOptions = (function () {
655
914
  return {
656
- create_with_msg_options: function (_msg, options) {
657
- return jsonMsg_cjsExports.JSON_Msg_msg.create_with_msg_merge(_msg, {
915
+ create_with_cause_options: function (msg_cause, options) {
916
+ return jsonMsg_cjsExports.JSON_MsgEffect.create_with_msg_merge(msg_cause, {
658
917
  options: options,
659
918
  "2PhW": k_VERSION
660
919
  });
@@ -707,9 +966,9 @@ var JSON_MsgWarp = (function () {
707
966
  })();
708
967
  var JSON_MsgEngage = (function () {
709
968
  return {
710
- create_with_MsgWarp: function (json_msgWarp) {
969
+ create_with_Warp: function (json_msgWarp) {
711
970
  console.assert(json_msgWarp.ack === undefined, "Engage with a Warp, not an Ack");
712
- return jsonMsg_cjsExports.JSON_Msg_msg.create_with_msg_merge(json_msgWarp, {
971
+ return jsonMsg_cjsExports.JSON_MsgEffect.create_with_cause_merge(json_msgWarp, {
713
972
  engage: {
714
973
  "ok": true,
715
974
  "rtt_msec": Date.now() - Date.parse(json_msgWarp.dt)
@@ -717,12 +976,12 @@ var JSON_MsgEngage = (function () {
717
976
  "2PhW": k_VERSION
718
977
  });
719
978
  },
720
- validate: function (json_msg_msg) {
979
+ validate: function (json_msgEffect) {
721
980
  // if (! JSON_Msg_msg.validate(json))
722
981
  // return false;
723
- if (!JSON_MsgWarp.validate(json_msg_msg._msg))
982
+ if (!JSON_MsgWarp.validate(json_msgEffect._cause))
724
983
  return false;
725
- if (!schema_MsgEngage(json_msg_msg)) {
984
+ if (!schema_MsgEngage(json_msgEffect)) {
726
985
  log_(l_.VALIDATION, () => ['JSON_MsgEngage: schema_MsgEngage_: ', schema_MsgEngage.errors]);
727
986
  return false;
728
987
  }
@@ -734,23 +993,23 @@ var JSON_MsgAckWarp = (function () {
734
993
  return {
735
994
  // createWith_msgAck_msg : function(json_msgAck, _msg) {
736
995
  // const json_msgAckWarp= structuredClone(json_msgAck);
737
- // json_msgAckWarp._msg= _msg;
996
+ // json_msgAckWarp._cause= _cause;
738
997
  // return json_msgAckWarp;
739
998
  // }
740
- create_with_msgOk: function (json_msgWarp, b_ok = true) {
741
- const json_msgAck_msg = jsonMsg_cjsExports.JSON_MsgAck_msg.create_with_msgOk(json_msgWarp, b_ok);
742
- json_msgAck_msg["2PhW"] = k_VERSION;
743
- return json_msgAck_msg;
999
+ create_with_Warp_Ok: function (json_msgWarp, b_ok = true) {
1000
+ const json_msgAck = jsonMsg_cjsExports.JSON_MsgAck.create_with_cause_Ok(json_msgWarp, b_ok);
1001
+ json_msgAck["2PhW"] = k_VERSION;
1002
+ return json_msgAck;
744
1003
  },
745
1004
  // create_with_msgExpired : function( json_msgWarp ) {
746
1005
  // const json_msgAck_msg= JSON_MsgAck_msg.create_with_msgExpired( json_msgWarp )
747
1006
  // json_msgAck_msg["2PhW"]= k_VERSION;
748
1007
  // return json_msgAck_msg;
749
1008
  // },
750
- validate: function (json_msgAck_msg) {
1009
+ validate: function (json_msgAck) {
751
1010
  // if (! JSON_MsgAck_msg.validate(json))
752
1011
  // return false;
753
- if (!JSON_MsgWarp.validate(json_msgAck_msg._msg))
1012
+ if (!JSON_MsgWarp.validate(json_msgAck._cause))
754
1013
  return false;
755
1014
  return true;
756
1015
  }
@@ -760,23 +1019,23 @@ var JSON_MsgAckEngage = (function () {
760
1019
  return {
761
1020
  // createWith_msgAck_msg : function(json_msgAck, _msg) {
762
1021
  // const json_msgAckEngage= structuredClone(json_msgAck);
763
- // json_msgAckEngage._msg= _msg;
1022
+ // json_msgAckEngage._cause= _cause;
764
1023
  // return json_msgAckEngage;
765
1024
  // }
766
- create_with_msgOk: function (json_msgEngage, b_ok = true) {
767
- const json_msgAck_msg = jsonMsg_cjsExports.JSON_MsgAck_msg.create_with_msgOk(json_msgEngage, b_ok);
768
- json_msgAck_msg["2PhW"] = k_VERSION;
769
- return json_msgAck_msg;
1025
+ create_with_Engage_Ok: function (json_msgEngage, b_ok = true) {
1026
+ const json_msgAck = jsonMsg_cjsExports.JSON_MsgAck.create_with_cause_Ok(json_msgEngage, b_ok);
1027
+ json_msgAck["2PhW"] = k_VERSION;
1028
+ return json_msgAck;
770
1029
  },
771
1030
  // create_with_msgExpired : function( json_msgEngage ) {
772
1031
  // const json_msgAck_msg= JSON_MsgAck_msg.create_with_msgExpired( json_msgEngage )
773
1032
  // json_msgAck_msg["2PhW"]= k_VERSION;
774
1033
  // return json_msgAck_msg;
775
1034
  // },
776
- validate: function (json_msgAck_msg) {
1035
+ validate: function (json_msgAck) {
777
1036
  // if (! JSON_MsgAck_msg.validate(json_msgAck_msg))
778
1037
  // return false;
779
- if (!JSON_MsgEngage.validate(json_msgAck_msg._msg))
1038
+ if (!JSON_MsgEngage.validate(json_msgAck._cause))
780
1039
  return false;
781
1040
  return true;
782
1041
  }
@@ -834,7 +1093,7 @@ class StateEngage extends StateState {
834
1093
  if (false === state_new instanceof StateAckEngage)
835
1094
  return false;
836
1095
  // The Engage gets to live for THE WARP'S creation time + TTL*2 + RTT
837
- const json_msgWarp = this.json_msgEngage._msg;
1096
+ const json_msgWarp = this.json_msgEngage._cause;
838
1097
  const timeout_ms = time_ttl_rtt_(json_msgWarp.warp.ttl_msec, this.json_msgEngage.engage.rtt_msec);
839
1098
  log_(l_.PROTOCOL_STATE, () => [`StateEngage: evt_AckEngage.dt@${state_new.evt_AckEngage.dt}, msgWarp.dt@${Date.parse(json_msgWarp.dt)} + ${timeout_ms}`]);
840
1099
  if (state_new.evt_AckEngage.dt >= Date.parse(json_msgWarp.dt) + timeout_ms)
@@ -851,14 +1110,14 @@ class StateAckWarp extends StateState {
851
1110
  return false;
852
1111
  if (!this.json_msgAckWarp.ack.ok)
853
1112
  return false;
854
- if (this.json_msgAckWarp._msg.warp.instantaneous)
1113
+ if (this.json_msgAckWarp._cause.warp.instantaneous)
855
1114
  return false;
856
1115
  // The Ack gets to live for THE ACK'S creation time + TTL*2 + STT
857
1116
  // +STT, so lines up with the Engage timeout
858
1117
  // - Engage: T0 +2TTL +RTT; RTT= STT+STT
859
1118
  // - AckWarp: TAckWarp +2TLL +STT; TAckWarp= T0 +STT;
860
1119
  // - STT: Date of the Ack minus date of the Warp.
861
- const timeout_ms = time_ttl_rtt_(this.json_msgAckWarp._msg.warp.ttl_msec) + Date.parse(this.json_msgAckWarp.dt) - Date.parse(this.json_msgAckWarp._msg.dt);
1120
+ const timeout_ms = time_ttl_rtt_(this.json_msgAckWarp._cause.warp.ttl_msec) + Date.parse(this.json_msgAckWarp.dt) - Date.parse(this.json_msgAckWarp._cause.dt);
862
1121
  log_(l_.PROTOCOL_STATE, () => [`StateAckWarp: evt_Engage.dt@${state_new.evt_Engage.dt}, msgAckWarp.dt@${Date.parse(this.json_msgAckWarp.dt)} + ${timeout_ms}`]);
863
1122
  if (state_new.evt_Engage.dt >= Date.parse(this.json_msgAckWarp.dt) + timeout_ms)
864
1123
  return false;
@@ -930,7 +1189,7 @@ class TwoPhW_EventLog {
930
1189
  }
931
1190
  _warp(json_msg) {
932
1191
  const b_Ack = json_msg.ack !== undefined;
933
- const json = b_Ack ? json_msg["_msg"] : json_msg;
1192
+ const json = b_Ack ? json_msg["_cause"] : json_msg;
934
1193
  if (json.warp) {
935
1194
  return {
936
1195
  str_type: `2PhW[JSON_Msg${b_Ack ? 'Ack' : ''}Warp]`,
@@ -940,7 +1199,7 @@ class TwoPhW_EventLog {
940
1199
  if (json.engage) {
941
1200
  return {
942
1201
  str_type: `2PhW[JSON_Msg${b_Ack ? 'Ack' : ''}Engage]`,
943
- json_msgWarp: json["_msg"]
1202
+ json_msgWarp: json["_cause"]
944
1203
  };
945
1204
  }
946
1205
  return { str_type: null, json_msgWarp: null }; // Explicit default for invalid cases
@@ -1014,8 +1273,8 @@ class TwoPhW {
1014
1273
  if (! validate_Options_delay_(json_msgOptions.options))
1015
1274
  return false;
1016
1275
 
1017
- if (JSON_MsgWarp.validate(json_msgOptions._msg)) {
1018
- const json_msgWarp= json_msgOptions._msg;
1276
+ if (JSON_MsgWarp.validate(json_msgOptions._cause)) {
1277
+ const json_msgWarp= json_msgOptions._cause;
1019
1278
 
1020
1279
  const ctx= get_ctx(json_msgWarp.id);
1021
1280
  if (!ctx )
@@ -1036,7 +1295,7 @@ class TwoPhW {
1036
1295
  return true;
1037
1296
  }
1038
1297
  */
1039
- return k_NOP;
1298
+ return false;
1040
1299
  }
1041
1300
  //-------------------------------------------------------------------------------------------------
1042
1301
  // sender Source (src)
@@ -1049,7 +1308,7 @@ class TwoPhW {
1049
1308
  }));
1050
1309
  log_(l_.HANDLERS | l_.SENDER, () => ['register_msgWarp: protocolState.canChangeState ', b_changeState]);
1051
1310
  if (!b_changeState)
1052
- return k_NOP;
1311
+ return false;
1053
1312
  const timeout_ms = time_ttl_rtt_(json_msgWarp.warp.ttl_msec);
1054
1313
  const elapsed_ms = Date.now() - Date.parse(json_msgWarp.dt);
1055
1314
  this.eventLog._addEvent(msg, json_msgWarp, timeout_ms - elapsed_ms, () => {
@@ -1058,7 +1317,7 @@ class TwoPhW {
1058
1317
  }
1059
1318
  _handler_msgAckWarp(msg, json_msgAckWarp) {
1060
1319
  log_(l_.HANDLERS | l_.SENDER, () => ['handler_msgAckWarp: ', json_msgAckWarp]);
1061
- const json_msgWarp = json_msgAckWarp._msg;
1320
+ const json_msgWarp = json_msgAckWarp._cause;
1062
1321
  const protocolState = this.eventLog.traverse_State(json_msgWarp);
1063
1322
  const b_changeState = protocolState.canChangeState(new StateAckWarp(null, {
1064
1323
  dt: Date.now(),
@@ -1066,14 +1325,14 @@ class TwoPhW {
1066
1325
  }));
1067
1326
  log_(l_.HANDLERS | l_.SENDER, () => ['handler_msgAckWarp: protocolState.canChangeState ', b_changeState]);
1068
1327
  if (!b_changeState)
1069
- return k_NOP;
1328
+ return false;
1070
1329
  this.eventLog._cancelTimeout(protocolState.state.idx_event);
1071
1330
  this.eventLog._addEvent(msg, json_msgAckWarp);
1072
1331
  return this.config._callback_msgAckWarp(msg, json_msgAckWarp);
1073
1332
  }
1074
1333
  register_msgEngage(msg, json_msgEngage) {
1075
1334
  log_(l_.SENDER, () => ['register_msgEngage: ', json_msgEngage]);
1076
- const json_msgWarp = json_msgEngage._msg;
1335
+ const json_msgWarp = json_msgEngage._cause;
1077
1336
  const protocolState = this.eventLog.traverse_State(json_msgWarp);
1078
1337
  const b_changeState = protocolState.canChangeState(new StateEngage(null, {
1079
1338
  dt: Date.now(),
@@ -1081,7 +1340,7 @@ class TwoPhW {
1081
1340
  }));
1082
1341
  log_(l_.HANDLERS | l_.SENDER, () => ['register_msgEngage: protocolState.canChangeState ', b_changeState]);
1083
1342
  if (!b_changeState)
1084
- return k_NOP;
1343
+ return false;
1085
1344
  const timeout_ms = time_ttl_rtt_(json_msgWarp.warp.ttl_msec, json_msgEngage.engage.rtt_msec);
1086
1345
  const elapsed_ms = Date.now() - Date.parse(json_msgWarp.dt);
1087
1346
  this.eventLog._addEvent(msg, json_msgEngage, timeout_ms - elapsed_ms, () => {
@@ -1090,7 +1349,7 @@ class TwoPhW {
1090
1349
  }
1091
1350
  _handler_msgAckEngage(msg, json_msgAckEngage) {
1092
1351
  log_(l_.HANDLERS | l_.SENDER, () => ['handler_msgAckEngage: ', json_msgAckEngage]);
1093
- const json_msgWarp = json_msgAckEngage._msg._msg;
1352
+ const json_msgWarp = json_msgAckEngage._cause._cause;
1094
1353
  const protocolState = this.eventLog.traverse_State(json_msgWarp);
1095
1354
  const b_changeState = protocolState.canChangeState(new StateAckEngage(null, {
1096
1355
  dt: Date.now(),
@@ -1098,7 +1357,7 @@ class TwoPhW {
1098
1357
  }));
1099
1358
  log_(l_.HANDLERS | l_.SENDER, () => ['handler_msgAckEngage_: protocolState.canChangeState ', b_changeState]);
1100
1359
  if (!b_changeState)
1101
- return k_NOP;
1360
+ return false;
1102
1361
  this.eventLog._cancelTimeout(protocolState.state.idx_event);
1103
1362
  this.eventLog._addEvent(msg, json_msgAckEngage);
1104
1363
  return this.config._callback_msgAckEngage(msg, json_msgAckEngage);
@@ -1114,13 +1373,13 @@ class TwoPhW {
1114
1373
  }));
1115
1374
  log_(l_.HANDLERS | l_.RECVER, () => ['handler_msgWarp: protocolState.canChangeState: ', b_changeState]);
1116
1375
  if (!b_changeState)
1117
- return k_NOP;
1376
+ return false;
1118
1377
  this.eventLog._addEvent(msg, json_msgWarp);
1119
1378
  return this.config._callback_msgWarp(msg, json_msgWarp);
1120
1379
  }
1121
1380
  register_msgAckWarp(msg, json_msgAckWarp) {
1122
1381
  log_(l_.RECVER, () => ['register_msgAckWarp: ', json_msgAckWarp]);
1123
- const json_msgWarp = json_msgAckWarp._msg;
1382
+ const json_msgWarp = json_msgAckWarp._cause;
1124
1383
  const protocolState = this.eventLog.traverse_State(json_msgWarp);
1125
1384
  const b_changeState = protocolState.canChangeState(new StateAckWarp(null, {
1126
1385
  dt: Date.now(),
@@ -1128,7 +1387,7 @@ class TwoPhW {
1128
1387
  }));
1129
1388
  log_(l_.HANDLERS | l_.RECVER, () => ['register_msgAckWarp: protocolState.canChangeState: ', b_changeState]);
1130
1389
  if (!b_changeState)
1131
- return k_NOP;
1390
+ return false;
1132
1391
  const elapsed_ms = Date.now() - Date.parse(json_msgAckWarp.dt);
1133
1392
  const timeout_ms = time_ttl_rtt_(json_msgWarp.warp.ttl_msec) + Date.parse(json_msgAckWarp.dt) - Date.parse(json_msgWarp.dt);
1134
1393
  this.eventLog._addEvent(msg, json_msgAckWarp, timeout_ms - elapsed_ms, () => {
@@ -1137,7 +1396,7 @@ class TwoPhW {
1137
1396
  }
1138
1397
  _handler_msgEngage(msg, json_msgEngage) {
1139
1398
  log_(l_.HANDLERS | l_.RECVER, () => ['handler_msgEngage: ', json_msgEngage]);
1140
- const json_msgWarp = json_msgEngage["_msg"];
1399
+ const json_msgWarp = json_msgEngage._cause;
1141
1400
  const protocolState = this.eventLog.traverse_State(json_msgWarp);
1142
1401
  const b_changeState = protocolState.canChangeState(new StateEngage(null, {
1143
1402
  dt: Date.now(),
@@ -1145,14 +1404,14 @@ class TwoPhW {
1145
1404
  }));
1146
1405
  log_(l_.HANDLERS | l_.RECVER, () => ['handler_msgEngage: protocolState.canChangeState: ', b_changeState]);
1147
1406
  if (!b_changeState)
1148
- return k_NOP;
1407
+ return false;
1149
1408
  this.eventLog._cancelTimeout(protocolState.state.idx_event);
1150
1409
  this.eventLog._addEvent(msg, json_msgEngage);
1151
1410
  return this.config._callback_msgEngage(msg, json_msgEngage);
1152
1411
  }
1153
1412
  register_msgAckEngage(msg, json_msgAckEngage) {
1154
1413
  log_(l_.RECVER, () => ['register_msgAckEngage: ', json_msgAckEngage]);
1155
- const json_msgWarp = json_msgAckEngage._msg._msg;
1414
+ const json_msgWarp = json_msgAckEngage._cause._cause;
1156
1415
  const protocolState = this.eventLog.traverse_State(json_msgWarp);
1157
1416
  const b_changeState = protocolState.canChangeState(new StateAckEngage(null, {
1158
1417
  dt: Date.now(),
@@ -1160,33 +1419,32 @@ class TwoPhW {
1160
1419
  }));
1161
1420
  log_(l_.HANDLERS | l_.RECVER, () => ['register_msgAckEngage: protocolState.canChangeState: ', b_changeState]);
1162
1421
  if (!b_changeState)
1163
- return k_NOP;
1422
+ return false;
1164
1423
  this.eventLog._addEvent(msg, json_msgAckEngage);
1165
1424
  }
1166
1425
  //-------------------------------------------------------------------------------------------------
1167
- handler_json_msgAck_msg(msg, json_msgAck_msg) {
1168
- log_(l_.HANDLERS, () => ['handler_json_msgAck_msg: ', json_msgAck_msg]);
1169
- let ret;
1170
- if (JSON_MsgAckWarp.validate(json_msgAck_msg) && (ret = this._handler_msgAckWarp(msg, json_msgAck_msg)))
1171
- return ret;
1172
- if (JSON_MsgAckEngage.validate(json_msgAck_msg) && (ret = this._handler_msgAckEngage(msg, json_msgAck_msg)))
1173
- return ret;
1174
- return k_NOP;
1426
+ handler_json_msgAck(msg, json_msgAck) {
1427
+ log_(l_.HANDLERS, () => ['handler_json_msgAck: ', json_msgAck]);
1428
+ if (JSON_MsgAckWarp.validate(json_msgAck) && this._handler_msgAckWarp(msg, json_msgAck))
1429
+ return true;
1430
+ if (JSON_MsgAckEngage.validate(json_msgAck) && this._handler_msgAckEngage(msg, json_msgAck))
1431
+ return true;
1432
+ return false;
1175
1433
  }
1176
- handler_json_msg_msg(msg, json_msg_msg) {
1177
- log_(l_.HANDLERS, () => ['handler_json_msg_msg: ', json_msg_msg]);
1178
- let ret;
1179
- if (JSON_MsgEngage.validate(json_msg_msg) && (ret = this._handler_msgEngage(msg, json_msg_msg)))
1180
- return ret;
1434
+ handler_json_msgEffect(msg, json_msgEffect) {
1435
+ log_(l_.HANDLERS, () => ['handler_json_msgEffect: ', json_msgEffect]);
1436
+ if (jsonMsg_cjsExports.JSON_MsgAck.validate(json_msgEffect) && this.handler_json_msgAck(msg, json_msgEffect))
1437
+ return true;
1438
+ if (JSON_MsgEngage.validate(json_msgEffect) && this._handler_msgEngage(msg, json_msgEffect))
1439
+ return true;
1181
1440
  // if (JSON_MsgOptions.validate(json_msg) && this.handler_msgOptions_(this._config, msg, json_msg))
1182
1441
  // return true;
1183
- return k_NOP;
1442
+ return false;
1184
1443
  }
1185
1444
  handler_json_msg(msg, json_msg) {
1186
1445
  log_(l_.HANDLERS, () => ['handler_json_msg: ', json_msg]);
1187
- let ret;
1188
- if (JSON_MsgWarp.validate(json_msg) && (ret = this._handler_msgWarp(msg, json_msg)))
1189
- return ret;
1446
+ if (JSON_MsgWarp.validate(json_msg) && this._handler_msgWarp(msg, json_msg))
1447
+ return true;
1190
1448
  // https://attacomsian.com/blog/javascript-iterate-objects
1191
1449
  // Object.keys(json_msg).forEach((key, index) => {
1192
1450
  // if (key == 'dt')
@@ -1195,30 +1453,15 @@ class TwoPhW {
1195
1453
  // return;
1196
1454
  // console.log(`${key}: ${json_msg[key]}`);
1197
1455
  // });
1198
- return k_NOP;
1456
+ return false;
1199
1457
  }
1200
1458
  handler_json(msg, json) {
1201
- if (jsonMsg_cjsExports.JSON_Msg.validate(json)) {
1202
- if (jsonMsg_cjsExports.JSON_Msg_msg.validate(json)) {
1203
- if (jsonMsg_cjsExports.JSON_MsgAck_msg.validate(json)) {
1204
- let ret;
1205
- if (JSON_MsgAckWarp.validate(json) && (ret = this._handler_msgAckWarp(msg, json)))
1206
- return ret;
1207
- if (JSON_MsgAckEngage.validate(json) && (ret = this._handler_msgAckEngage(msg, json)))
1208
- return ret;
1209
- return k_NOP;
1210
- }
1211
- let ret;
1212
- if (JSON_MsgEngage.validate(json) && (ret = this._handler_msgEngage(msg, json)))
1213
- return ret;
1214
- return k_NOP;
1215
- }
1216
- let ret;
1217
- if (JSON_MsgWarp.validate(json) && (ret = this._handler_msgWarp(msg, json)))
1218
- return ret;
1219
- return k_NOP;
1220
- }
1221
- return k_NOP;
1459
+ log_(l_.HANDLERS, () => ['handler_json: ', json]);
1460
+ if (jsonMsg_cjsExports.JSON_MsgEffect.validate(json) && this.handler_json_msgEffect(msg, json))
1461
+ return true;
1462
+ if (jsonMsg_cjsExports.JSON_Msg.validate(json) && this.handler_json_msg(msg, json))
1463
+ return true;
1464
+ return false;
1222
1465
  }
1223
1466
  }
1224
1467