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