@rootintf/protocol-2phw 0.6.11 → 0.7.5-api-0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";export const validate_Msg2PhW = validate10;const schema11 = {"$id":"validate_Msg2PhW","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["2PhW"],"properties":{"2PhW":{"type":"string","pattern":"0\\.6"}}};const pattern0 = new RegExp("0\\.6", "u");function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_Msg2PhW" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data["2PhW"] === undefined) && (missing0 = "2PhW")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data["2PhW"] !== undefined){let data0 = data["2PhW"];const _errs1 = errors;if(errors === _errs1){if(typeof data0 === "string"){if(!pattern0.test(data0)){validate10.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/pattern",keyword:"pattern",params:{pattern: "0\\.6"},message:"must match pattern \""+"0\\.6"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;}export const validate_MsgOptions = validate11;const schema12 = {"$id":"validate_MsgOptions","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["options"],"properties":{"options":{"type":"object"}}};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_MsgOptions" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.options === undefined) && (missing0 = "options")){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.options !== undefined){let data0 = data.options;if(!(data0 && typeof data0 == "object" && !Array.isArray(data0))){validate11.errors = [{instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}export const validate_Options_delay = validate12;const schema13 = {"$id":"validate_Options_delay","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["ttl_msec_incr"],"properties":{"ttl_msec":{"type":"array"}}};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_Options_delay" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ttl_msec_incr === undefined) && (missing0 = "ttl_msec_incr")){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.ttl_msec !== undefined){if(!(Array.isArray(data.ttl_msec))){validate12.errors = [{instancePath:instancePath+"/ttl_msec",schemaPath:"#/properties/ttl_msec/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}export const validate_MsgWarp = validate13;const schema14 = {"$id":"validate_MsgWarp","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["warp"],"properties":{"warp":{"type":"object","required":["user","hyperport"],"properties":{"ttl_msec":{"type":"integer"}}}}};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_MsgWarp" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.warp === undefined) && (missing0 = "warp")){validate13.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(errors === _errs1){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((data0.user === undefined) && (missing1 = "user")) || ((data0.hyperport === undefined) && (missing1 = "hyperport"))){validate13.errors = [{instancePath:instancePath+"/warp",schemaPath:"#/properties/warp/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.ttl_msec !== undefined){let data1 = data0.ttl_msec;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate13.errors = [{instancePath:instancePath+"/warp/ttl_msec",schemaPath:"#/properties/warp/properties/ttl_msec/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}}}}else {validate13.errors = [{instancePath:instancePath+"/warp",schemaPath:"#/properties/warp/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}}else {validate13.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate13.errors = vErrors;return errors === 0;}export const validate_MsgEngage = validate14;const schema15 = {"$id":"validate_MsgEngage","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["engage"],"properties":{"engage":{"type":"object","required":["user","hyperport"]}}};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_MsgEngage" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.engage === undefined) && (missing0 = "engage")){validate14.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(errors === _errs1){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((data0.user === undefined) && (missing1 = "user")) || ((data0.hyperport === undefined) && (missing1 = "hyperport"))){validate14.errors = [{instancePath:instancePath+"/engage",schemaPath:"#/properties/engage/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}}else {validate14.errors = [{instancePath:instancePath+"/engage",schemaPath:"#/properties/engage/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}
1
+ "use strict";export const validate_Msg2PhW = validate10;const schema11 = {"$id":"validate_Msg2PhW","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["2PhW"],"properties":{"2PhW":{"type":"string","pattern":"0\\.7"}}};const pattern0 = new RegExp("0\\.7", "u");function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_Msg2PhW" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data["2PhW"] === undefined) && (missing0 = "2PhW")){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data["2PhW"] !== undefined){let data0 = data["2PhW"];const _errs1 = errors;if(errors === _errs1){if(typeof data0 === "string"){if(!pattern0.test(data0)){validate10.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/pattern",keyword:"pattern",params:{pattern: "0\\.7"},message:"must match pattern \""+"0\\.7"+"\""}];return false;}}else {validate10.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}}else {validate10.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10.errors = vErrors;return errors === 0;}export const validate_MsgOptions = validate11;const schema12 = {"$id":"validate_MsgOptions","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["options"],"properties":{"options":{"type":"object"}}};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_MsgOptions" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.options === undefined) && (missing0 = "options")){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.options !== undefined){let data0 = data.options;if(!(data0 && typeof data0 == "object" && !Array.isArray(data0))){validate11.errors = [{instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}export const validate_Options_delay = validate12;const schema13 = {"$id":"validate_Options_delay","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["ttl_msec_incr"],"properties":{"ttl_msec_incr":{"type":"array","items":{"type":"integer"}},"reason":{"type":"string"}}};function validate12(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_Options_delay" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ttl_msec_incr === undefined) && (missing0 = "ttl_msec_incr")){validate12.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;}else {if(data.ttl_msec_incr !== undefined){let data0 = data.ttl_msec_incr;const _errs1 = errors;if(errors === _errs1){if(Array.isArray(data0)){var valid1 = true;const len0 = data0.length;for(let i0=0; i0<len0; i0++){let data1 = data0[i0];const _errs3 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate12.errors = [{instancePath:instancePath+"/ttl_msec_incr/" + i0,schemaPath:"#/properties/ttl_msec_incr/items/type",keyword:"type",params:{type: "integer"},message:"must be integer"}];return false;}var valid1 = _errs3 === errors;if(!valid1){break;}}}else {validate12.errors = [{instancePath:instancePath+"/ttl_msec_incr",schemaPath:"#/properties/ttl_msec_incr/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}var valid0 = _errs1 === errors;}else {var valid0 = true;}if(valid0){if(data.reason !== undefined){const _errs5 = errors;if(typeof data.reason !== "string"){validate12.errors = [{instancePath:instancePath+"/reason",schemaPath:"#/properties/reason/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid0 = _errs5 === errors;}else {var valid0 = true;}}}}else {validate12.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12.errors = vErrors;return errors === 0;}export const validate_MsgWarp = validate13;const schema14 = {"$id":"validate_MsgWarp","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["warp"],"properties":{"warp":{"type":"object","required":["user","hyperport"],"properties":{"ttl_msec":{"type":"integer"},"instantaneous":{"type":"boolean"}}}}};function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_MsgWarp" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.warp === undefined) && (missing0 = "warp")){validate13.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(errors === _errs1){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((data0.user === undefined) && (missing1 = "user")) || ((data0.hyperport === undefined) && (missing1 = "hyperport"))){validate13.errors = [{instancePath:instancePath+"/warp",schemaPath:"#/properties/warp/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}else {if(data0.ttl_msec !== undefined){let data1 = data0.ttl_msec;const _errs3 = errors;if(!(((typeof data1 == "number") && (!(data1 % 1) && !isNaN(data1))) && (isFinite(data1)))){validate13.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 = _errs3 === errors;}else {var valid1 = true;}if(valid1){if(data0.instantaneous !== undefined){const _errs5 = errors;if(typeof data0.instantaneous !== "boolean"){validate13.errors = [{instancePath:instancePath+"/warp/instantaneous",schemaPath:"#/properties/warp/properties/instantaneous/type",keyword:"type",params:{type: "boolean"},message:"must be boolean"}];return false;}var valid1 = _errs5 === errors;}else {var valid1 = true;}}}}else {validate13.errors = [{instancePath:instancePath+"/warp",schemaPath:"#/properties/warp/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}}else {validate13.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate13.errors = vErrors;return errors === 0;}export const validate_MsgEngage = validate14;const schema15 = {"$id":"validate_MsgEngage","$schema":"http://json-schema.org/draft-07/schema#","type":"object","required":["engage"],"properties":{"engage":{"type":"object","required":["user","hyperport"]}}};function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){/*# sourceURL="validate_MsgEngage" */;let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.engage === undefined) && (missing0 = "engage")){validate14.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(errors === _errs1){if(data0 && typeof data0 == "object" && !Array.isArray(data0)){let missing1;if(((data0.user === undefined) && (missing1 = "user")) || ((data0.hyperport === undefined) && (missing1 = "hyperport"))){validate14.errors = [{instancePath:instancePath+"/engage",schemaPath:"#/properties/engage/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"}];return false;}}else {validate14.errors = [{instancePath:instancePath+"/engage",schemaPath:"#/properties/engage/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}}else {validate14.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate14.errors = vErrors;return errors === 0;}
@@ -1,159 +1,173 @@
1
-
2
- import { v4 as uuidv4 } from 'uuid';
3
- import { TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage, l as l_2PhW } from '../src/twoPhW.mjs';
4
- import { JSON_Msg, JSON_Msg_msg, JSON_MsgAck } from '@rootintf/json-msg'
5
-
6
- const k_VERSION= "0.6";
7
-
8
- var twoPhW= new TwoPhW();
9
- twoPhW.config.logr= {
10
- VALIDATION : 1
11
- }
12
-
13
- const str_uuid_ID_ = uuidv4();
14
- console.log('str_uuid_ID_= ' + str_uuid_ID_);
15
-
16
- const json_msgWarp_ = {
17
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
18
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
19
- dt: "2022-10-28T06:26:19.692Z",
20
- warp: {
21
- user: {},
22
- hyperport: {},
23
- ttl_msec : 30
24
- },
25
- "2PhW": k_VERSION
26
- }
27
-
28
- const json_msgEngage_ = {
29
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
30
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
31
- dt: "2022-10-28T06:26:19.692Z",
32
- engage: {
33
- user: {},
34
- hyperport: {}
35
- },
36
- "2PhW": k_VERSION
37
- }
38
-
39
- const json_msgAckWarp_str_ = {
40
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
41
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
42
- dt: "2022-10-28T06:26:19.692Z",
43
- ack: {
44
- "ok" : true,
45
- },
46
- "_msg" : JSON.stringify( json_msgWarp_ ),
47
- "2PhW": k_VERSION
48
- }
49
-
50
- const json_msgAckWarp_obj_ = {
51
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
52
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
53
- dt: "2022-10-28T06:26:19.692Z",
54
- ack: {
55
- "ok" : true,
56
- },
57
- "_msg" : json_msgWarp_,
58
- "2PhW": k_VERSION
59
- }
60
-
61
- const json_msgAckEngage_ = {
62
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
63
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
64
- dt: "2022-10-28T06:26:19.692Z",
65
- ack: {
66
- "ok" : false,
67
- },
68
- "_msg" : json_msgEngage_,
69
- "2PhW": k_VERSION
70
- }
71
-
72
- const json_msgOptions_ = {
73
- id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
74
- referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
75
- dt: "2022-10-28T06:26:19.692Z",
76
- options: {
77
- },
78
- "_msg" : json_msgWarp_,
79
- "2PhW": k_VERSION
80
- }
81
-
82
-
83
- describe("Validation", function () {
84
- it("JSON_Msg.validate(json_msgWarp_)", function () {
85
- expect( JSON_Msg.validate(json_msgWarp_) ).toBe(true);
86
- });
87
- });
88
-
89
- describe("Validation", function () {
90
- it("twoPhW.JSON_MsgOptions.validate(json_msgOptions_)", function () {
91
- expect( JSON_MsgOptions.validate(json_msgOptions_) ).toBe(true);
92
- });
93
- });
94
-
95
- describe("Validation", function () {
96
- it("twoPhW.JSON_MsgWarp.validate(json_msgWarp_)", function () {
97
- expect( JSON_MsgWarp.validate(json_msgWarp_) ).toBe(true);
98
- });
99
- });
100
-
101
- describe("Validation", function () {
102
- it("twoPhW.JSON_MsgEngage.validate(json_msgEngage_)", function () {
103
- expect( JSON_MsgEngage.validate(json_msgEngage_) ).toBe(true);
104
- });
105
- });
106
-
107
- describe("Validation", function () {
108
- it("JSON_MsgAckWarp.validate(json_msgAckWarp_str_)", function () {
109
- expect( JSON_MsgAckWarp.validate(json_msgAckWarp_str_) ).toBe(false);
110
- });
111
- it("JSON_MsgAckWarp.validate(json_msgAckWarp_obj_)", function () {
112
- expect( JSON_MsgAckWarp.validate(json_msgAckWarp_obj_) ).toBe(true);
113
- });
114
- });
115
-
116
- describe("Validation", function () {
117
- it("JSON_MsgAckEngage.validate(json_msgAckEngage_)", function () {
118
- expect( JSON_MsgAckEngage.validate(json_msgAckEngage_) ).toBe(true);
119
- });
120
- });
121
-
122
- // beforeEach(function (done) {
123
- // setTimeout(function () {
124
-
125
- // function callback_Ack_Warp_(msg, json_Ack, json_Warp, json_Engage) {
126
- // // console.log('callback_Ack_Warp: Ack: ', json_Ack);
127
-
128
- // // console.log('callback_Ack_Warp: publish: Engage: ', json_Engage);
129
- // // IPSME_MsgEnv.publish( JSON.stringify(json_Engage) );
130
-
131
- // done();
132
-
133
- // return true;
134
- // }
135
-
136
- // twoPhW.config.options= {
137
- // str_referer_id : str_uuid_ID_,
138
- // callback_Warp : callback_Ack_Warp_,
139
- // logr : {
140
- // // HANDLERS : 1,
141
- // VALIDATION : 1
142
- // }
143
- // }
144
-
145
- // twoPhW.handler_msg(json_Warp_);
146
-
147
- // // done();
148
-
149
- // }, 100);
150
- // });
151
-
152
- // it('does a thing', function (done) {
153
- // someAsyncFunction(function (result) {
154
- // expect(result).toEqual(someExpectedValue);
155
- // done();
156
- // });
157
- // });
158
-
159
- //-------------------------------------------------------------------------------------------------
1
+
2
+ import {
3
+ validate_Msg2PhW as validate_Msg2PhW_,
4
+ validate_MsgOptions as validate_MsgOptions_,
5
+ validate_Options_delay as validate_Options_delay_,
6
+ validate_MsgWarp as validate_MsgWarp_,
7
+ validate_MsgEngage as validate_MsgEngage_
8
+ } from '../src/validate-esm.mjs';
9
+
10
+ import { v4 as uuidv4 } from 'uuid';
11
+ import { TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage, l as l_2PhW } from '../src/twoPhW.mjs';
12
+ import { JSON_Msg, JSON_Msg_msg, JSON_MsgAck } from '@rootintf/json-msg'
13
+
14
+ const k_VERSION= "0.7";
15
+
16
+ var twoPhW= new TwoPhW();
17
+ twoPhW.config.logr= {
18
+ VALIDATION : 1
19
+ }
20
+
21
+ const str_uuid_ID_ = uuidv4();
22
+ console.log('str_uuid_ID_= ' + str_uuid_ID_);
23
+
24
+ const json_msgWarp_ = {
25
+ id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
26
+ referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
27
+ dt: "2022-10-28T06:26:19.692Z",
28
+ warp: {
29
+ user: {},
30
+ hyperport: {},
31
+ ttl_msec : 30
32
+ },
33
+ "2PhW": k_VERSION
34
+ }
35
+
36
+ const json_msgEngage_ = {
37
+ id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
38
+ referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
39
+ dt: "2022-10-28T06:26:19.692Z",
40
+ engage: {
41
+ user: {},
42
+ hyperport: {}
43
+ },
44
+ "2PhW": k_VERSION
45
+ }
46
+
47
+ const json_msgAckWarp_str_ = {
48
+ id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
49
+ referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
50
+ dt: "2022-10-28T06:26:19.692Z",
51
+ ack: {
52
+ "ok" : true,
53
+ },
54
+ "_msg" : JSON.stringify( json_msgWarp_ ),
55
+ "2PhW": k_VERSION
56
+ }
57
+
58
+ const json_msgAckWarp_obj_ = {
59
+ id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
60
+ referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
61
+ dt: "2022-10-28T06:26:19.692Z",
62
+ ack: {
63
+ "ok" : true,
64
+ },
65
+ "_msg" : json_msgWarp_,
66
+ "2PhW": k_VERSION
67
+ }
68
+
69
+ const json_msgAckEngage_ = {
70
+ id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
71
+ referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
72
+ dt: "2022-10-28T06:26:19.692Z",
73
+ ack: {
74
+ "ok" : false,
75
+ },
76
+ "_msg" : json_msgEngage_,
77
+ "2PhW": k_VERSION
78
+ }
79
+
80
+ //TODO: "required" : ["reason"],
81
+ const json_msgOptions_ = {
82
+ id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
83
+ referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
84
+ dt: "2022-10-28T06:26:19.692Z",
85
+ options: {
86
+ ttl_msec_incr : [ 20000, 4000 ],
87
+ reason : "it is taking too long"
88
+ },
89
+ "_msg" : json_msgWarp_,
90
+ "2PhW": k_VERSION
91
+ }
92
+
93
+
94
+ describe("Validation", function () {
95
+ it("JSON_Msg.validate(json_msgWarp_)", function () {
96
+ expect( JSON_Msg.validate(json_msgWarp_) ).toBe(true);
97
+ });
98
+ });
99
+
100
+ describe("Validation", function () {
101
+ it("twoPhW.JSON_MsgOptions.validate(json_msgOptions_)", function () {
102
+ expect( JSON_MsgOptions.validate(json_msgOptions_) ).toBe(true);
103
+ });
104
+ it("validate_Options_delay_(json_msgOptions_.options)", function () {
105
+ expect( validate_Options_delay_(json_msgOptions_.options) ).toBe(true);
106
+ });
107
+ });
108
+
109
+ describe("Validation", function () {
110
+ it("twoPhW.JSON_MsgWarp.validate(json_msgWarp_)", function () {
111
+ expect( JSON_MsgWarp.validate(json_msgWarp_) ).toBe(true);
112
+ });
113
+ });
114
+
115
+ describe("Validation", function () {
116
+ it("twoPhW.JSON_MsgEngage.validate(json_msgEngage_)", function () {
117
+ expect( JSON_MsgEngage.validate(json_msgEngage_) ).toBe(true);
118
+ });
119
+ });
120
+
121
+ describe("Validation", function () {
122
+ it("JSON_MsgAckWarp.validate(json_msgAckWarp_str_)", function () {
123
+ expect( JSON_MsgAckWarp.validate(json_msgAckWarp_str_) ).toBe(false);
124
+ });
125
+ it("JSON_MsgAckWarp.validate(json_msgAckWarp_obj_)", function () {
126
+ expect( JSON_MsgAckWarp.validate(json_msgAckWarp_obj_) ).toBe(true);
127
+ });
128
+ });
129
+
130
+ describe("Validation", function () {
131
+ it("JSON_MsgAckEngage.validate(json_msgAckEngage_)", function () {
132
+ expect( JSON_MsgAckEngage.validate(json_msgAckEngage_) ).toBe(true);
133
+ });
134
+ });
135
+
136
+ // beforeEach(function (done) {
137
+ // setTimeout(function () {
138
+
139
+ // function callback_Ack_Warp_(msg, json_Ack, json_Warp, json_Engage) {
140
+ // // console.log('callback_Ack_Warp: Ack: ', json_Ack);
141
+
142
+ // // console.log('callback_Ack_Warp: publish: Engage: ', json_Engage);
143
+ // // IPSME_MsgEnv.publish( JSON.stringify(json_Engage) );
144
+
145
+ // done();
146
+
147
+ // return true;
148
+ // }
149
+
150
+ // twoPhW.config.options= {
151
+ // str_referer_id : str_uuid_ID_,
152
+ // callback_Warp : callback_Ack_Warp_,
153
+ // logr : {
154
+ // // HANDLERS : 1,
155
+ // VALIDATION : 1
156
+ // }
157
+ // }
158
+
159
+ // twoPhW.handler_msg(json_Warp_);
160
+
161
+ // // done();
162
+
163
+ // }, 100);
164
+ // });
165
+
166
+ // it('does a thing', function (done) {
167
+ // someAsyncFunction(function (result) {
168
+ // expect(result).toEqual(someExpectedValue);
169
+ // done();
170
+ // });
171
+ // });
172
+
173
+ //-------------------------------------------------------------------------------------------------