@rootintf/protocol-2phw 0.6.11 → 0.7.1

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const validate_Msg2PhW = validate10$1;const pattern0 = new RegExp("0\\.6", "u");function validate10$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data["2PhW"] === undefined) && (missing0 = "2PhW")){validate10$1.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"];{if(typeof data0 === "string"){if(!pattern0.test(data0)){validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/pattern",keyword:"pattern",params:{pattern: "0\\.6"},message:"must match pattern \""+"0\\.6"+"\""}];return false;}}else {validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}}else {validate10$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10$1.errors = vErrors;return errors === 0;}const validate_MsgOptions = validate11$1;function validate11$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.options === undefined) && (missing0 = "options")){validate11$1.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$1.errors = [{instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate11$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11$1.errors = vErrors;return errors === 0;}const validate_Options_delay = validate12$1;function validate12$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ttl_msec_incr === undefined) && (missing0 = "ttl_msec_incr")){validate12$1.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$1.errors = [{instancePath:instancePath+"/ttl_msec",schemaPath:"#/properties/ttl_msec/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate12$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12$1.errors = vErrors;return errors === 0;}const validate_MsgWarp = validate13;function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}const validate_MsgEngage = validate14;function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}
5
+ const validate_Msg2PhW = validate10$1;const pattern0 = new RegExp("0\\.7", "u");function validate10$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data["2PhW"] === undefined) && (missing0 = "2PhW")){validate10$1.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"];{if(typeof data0 === "string"){if(!pattern0.test(data0)){validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/pattern",keyword:"pattern",params:{pattern: "0\\.7"},message:"must match pattern \""+"0\\.7"+"\""}];return false;}}else {validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}}else {validate10$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10$1.errors = vErrors;return errors === 0;}const validate_MsgOptions = validate11$1;function validate11$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.options === undefined) && (missing0 = "options")){validate11$1.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$1.errors = [{instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate11$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11$1.errors = vErrors;return errors === 0;}const validate_Options_delay = validate12$1;function validate12$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ttl_msec_incr === undefined) && (missing0 = "ttl_msec_incr")){validate12$1.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(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$1.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$1.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$1.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$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12$1.errors = vErrors;return errors === 0;}const validate_MsgWarp = validate13;function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}const validate_MsgEngage = validate14;function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}
6
6
 
7
7
  // console.log('OUT', __name({variableName}) );
8
8
 
@@ -389,7 +389,7 @@ class Config {
389
389
 
390
390
  //-------------------------------------------------------------------------------------------------
391
391
 
392
- let k_VERSION= "0.6";
392
+ let k_VERSION= "0.7";
393
393
 
394
394
  var JSON_MsgOptions = (function() {
395
395
  return {
@@ -605,6 +605,8 @@ class StateWarp {
605
605
  changeState(newState) {
606
606
  if (newState instanceof StateAckWarp)
607
607
  return true;
608
+ if (newState instanceof StateComplete)
609
+ return true;
608
610
  return false;
609
611
  }
610
612
  }
@@ -613,19 +615,21 @@ class StateAckWarp {
613
615
  changeState(newState) {
614
616
  if (newState instanceof StateEngage)
615
617
  return true;
618
+ if (newState instanceof StateComplete)
619
+ return true;
616
620
  return false;
617
621
  }
618
622
  }
619
623
 
620
624
  class StateEngage {
621
625
  changeState(newState) {
622
- if (newState instanceof StateAckEngage)
626
+ if (newState instanceof StateComplete)
623
627
  return true;
624
628
  return false;
625
629
  }
626
630
  }
627
631
 
628
- class StateAckEngage {
632
+ class StateComplete {
629
633
  changeState(newState) {
630
634
  return false;
631
635
  }
@@ -689,6 +693,13 @@ function handler_msgAckWarp_(cfg, msg, json_msgAckWarp)
689
693
  if (! cfg._callback_msgAckWarp(msg, json_msgAckWarp))
690
694
  return false;
691
695
 
696
+ if (json_msgWarp.warp.instantaneous) {
697
+ const b_res= ctx.protocol.changeState( new StateComplete() );
698
+ console.assert(b_res);
699
+
700
+ return true;
701
+ }
702
+
692
703
  const b_res= ctx.protocol.changeState( new StateEngage() );
693
704
  console.assert(b_res);
694
705
 
@@ -736,6 +747,13 @@ function handler_msgWarp_(cfg, msg, json_msgWarp)
736
747
  if (! cfg._callback_msgWarp(msg, json_msgWarp))
737
748
  return false;
738
749
 
750
+ if (json_msgWarp.warp.instantaneous) {
751
+ const b_res= ctx.protocol.changeState( new StateComplete() );
752
+ console.assert(b_res);
753
+
754
+ return true;
755
+ }
756
+
739
757
  const b_res= ctx.protocol.changeState( new StateAckWarp() );
740
758
  console.assert(b_res);
741
759
 
@@ -755,7 +773,7 @@ function handler_msgEngage_(cfg, msg, json_msgEngage)
755
773
  if (! cfg._callback_msgEngage(msg, json_msgEngage))
756
774
  return false;
757
775
 
758
- const b_res= ctx.protocol.changeState( new StateAckEngage() );
776
+ const b_res= ctx.protocol.changeState( new StateComplete() );
759
777
  console.assert(b_res);
760
778
 
761
779
  return true;
@@ -773,7 +791,7 @@ class TwoPhW {
773
791
  }
774
792
 
775
793
  // this function need to be removed when a microservice db is used instead of a state machine
776
- create_MsgWarp_out(str_id, json_user, json_hyperport, nr_ttl_msec)
794
+ create_MsgWarp_out(str_id, json_user, json_hyperport, nr_ttl_msec, b_instantaneous)
777
795
  {
778
796
  if (nr_ttl_msec === undefined)
779
797
  nr_ttl_msec= k_TTL;
@@ -781,9 +799,13 @@ class TwoPhW {
781
799
  const json_msgWarp= JSON_MsgWarp.create_with_user_hyperport(json_user, json_hyperport, nr_ttl_msec);
782
800
  json_msgWarp.id= str_id;
783
801
 
802
+ if (b_instantaneous !== undefined)
803
+ json_msgWarp.warp.instantaneous= b_instantaneous;
804
+
784
805
  const ctx= set_ctx(json_msgWarp.id, { protocol: new ProtocolStateState() });
785
806
  const b_res= ctx.protocol.changeState( new StateWarp(), nr_ttl_msec, function() {
786
807
  const json_Nack= JSON_MsgAckWarp.create_with_msgExpired( json_msgWarp );
808
+ //TODO: the referer is NULL here !
787
809
  this._config._callback_msgAckWarp(json_Nack, json_Nack);
788
810
  }.bind(this) );
789
811
 
@@ -1,4 +1,4 @@
1
- const validate_Msg2PhW = validate10$1;const pattern0 = new RegExp("0\\.6", "u");function validate10$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data["2PhW"] === undefined) && (missing0 = "2PhW")){validate10$1.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"];{if(typeof data0 === "string"){if(!pattern0.test(data0)){validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/pattern",keyword:"pattern",params:{pattern: "0\\.6"},message:"must match pattern \""+"0\\.6"+"\""}];return false;}}else {validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}}else {validate10$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10$1.errors = vErrors;return errors === 0;}const validate_MsgOptions = validate11$1;function validate11$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.options === undefined) && (missing0 = "options")){validate11$1.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$1.errors = [{instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate11$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11$1.errors = vErrors;return errors === 0;}const validate_Options_delay = validate12$1;function validate12$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ttl_msec_incr === undefined) && (missing0 = "ttl_msec_incr")){validate12$1.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$1.errors = [{instancePath:instancePath+"/ttl_msec",schemaPath:"#/properties/ttl_msec/type",keyword:"type",params:{type: "array"},message:"must be array"}];return false;}}}}else {validate12$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12$1.errors = vErrors;return errors === 0;}const validate_MsgWarp = validate13;function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}const validate_MsgEngage = validate14;function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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
+ const validate_Msg2PhW = validate10$1;const pattern0 = new RegExp("0\\.7", "u");function validate10$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data["2PhW"] === undefined) && (missing0 = "2PhW")){validate10$1.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"];{if(typeof data0 === "string"){if(!pattern0.test(data0)){validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/pattern",keyword:"pattern",params:{pattern: "0\\.7"},message:"must match pattern \""+"0\\.7"+"\""}];return false;}}else {validate10$1.errors = [{instancePath:instancePath+"/2PhW",schemaPath:"#/properties/2PhW/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}}}}}else {validate10$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate10$1.errors = vErrors;return errors === 0;}const validate_MsgOptions = validate11$1;function validate11$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.options === undefined) && (missing0 = "options")){validate11$1.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$1.errors = [{instancePath:instancePath+"/options",schemaPath:"#/properties/options/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}}}else {validate11$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11$1.errors = vErrors;return errors === 0;}const validate_Options_delay = validate12$1;function validate12$1(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;{if(data && typeof data == "object" && !Array.isArray(data)){let missing0;if((data.ttl_msec_incr === undefined) && (missing0 = "ttl_msec_incr")){validate12$1.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(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$1.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$1.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$1.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$1.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate12$1.errors = vErrors;return errors === 0;}const validate_MsgWarp = validate13;function validate13(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}const validate_MsgEngage = validate14;function validate14(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let 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;{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;}
2
2
 
3
3
  // console.log('OUT', __name({variableName}) );
4
4
 
@@ -385,7 +385,7 @@ class Config {
385
385
 
386
386
  //-------------------------------------------------------------------------------------------------
387
387
 
388
- let k_VERSION= "0.6";
388
+ let k_VERSION= "0.7";
389
389
 
390
390
  var JSON_MsgOptions = (function() {
391
391
  return {
@@ -601,6 +601,8 @@ class StateWarp {
601
601
  changeState(newState) {
602
602
  if (newState instanceof StateAckWarp)
603
603
  return true;
604
+ if (newState instanceof StateComplete)
605
+ return true;
604
606
  return false;
605
607
  }
606
608
  }
@@ -609,19 +611,21 @@ class StateAckWarp {
609
611
  changeState(newState) {
610
612
  if (newState instanceof StateEngage)
611
613
  return true;
614
+ if (newState instanceof StateComplete)
615
+ return true;
612
616
  return false;
613
617
  }
614
618
  }
615
619
 
616
620
  class StateEngage {
617
621
  changeState(newState) {
618
- if (newState instanceof StateAckEngage)
622
+ if (newState instanceof StateComplete)
619
623
  return true;
620
624
  return false;
621
625
  }
622
626
  }
623
627
 
624
- class StateAckEngage {
628
+ class StateComplete {
625
629
  changeState(newState) {
626
630
  return false;
627
631
  }
@@ -685,6 +689,13 @@ function handler_msgAckWarp_(cfg, msg, json_msgAckWarp)
685
689
  if (! cfg._callback_msgAckWarp(msg, json_msgAckWarp))
686
690
  return false;
687
691
 
692
+ if (json_msgWarp.warp.instantaneous) {
693
+ const b_res= ctx.protocol.changeState( new StateComplete() );
694
+ console.assert(b_res);
695
+
696
+ return true;
697
+ }
698
+
688
699
  const b_res= ctx.protocol.changeState( new StateEngage() );
689
700
  console.assert(b_res);
690
701
 
@@ -732,6 +743,13 @@ function handler_msgWarp_(cfg, msg, json_msgWarp)
732
743
  if (! cfg._callback_msgWarp(msg, json_msgWarp))
733
744
  return false;
734
745
 
746
+ if (json_msgWarp.warp.instantaneous) {
747
+ const b_res= ctx.protocol.changeState( new StateComplete() );
748
+ console.assert(b_res);
749
+
750
+ return true;
751
+ }
752
+
735
753
  const b_res= ctx.protocol.changeState( new StateAckWarp() );
736
754
  console.assert(b_res);
737
755
 
@@ -751,7 +769,7 @@ function handler_msgEngage_(cfg, msg, json_msgEngage)
751
769
  if (! cfg._callback_msgEngage(msg, json_msgEngage))
752
770
  return false;
753
771
 
754
- const b_res= ctx.protocol.changeState( new StateAckEngage() );
772
+ const b_res= ctx.protocol.changeState( new StateComplete() );
755
773
  console.assert(b_res);
756
774
 
757
775
  return true;
@@ -769,7 +787,7 @@ class TwoPhW {
769
787
  }
770
788
 
771
789
  // this function need to be removed when a microservice db is used instead of a state machine
772
- create_MsgWarp_out(str_id, json_user, json_hyperport, nr_ttl_msec)
790
+ create_MsgWarp_out(str_id, json_user, json_hyperport, nr_ttl_msec, b_instantaneous)
773
791
  {
774
792
  if (nr_ttl_msec === undefined)
775
793
  nr_ttl_msec= k_TTL;
@@ -777,9 +795,13 @@ class TwoPhW {
777
795
  const json_msgWarp= JSON_MsgWarp.create_with_user_hyperport(json_user, json_hyperport, nr_ttl_msec);
778
796
  json_msgWarp.id= str_id;
779
797
 
798
+ if (b_instantaneous !== undefined)
799
+ json_msgWarp.warp.instantaneous= b_instantaneous;
800
+
780
801
  const ctx= set_ctx(json_msgWarp.id, { protocol: new ProtocolStateState() });
781
802
  const b_res= ctx.protocol.changeState( new StateWarp(), nr_ttl_msec, function() {
782
803
  const json_Nack= JSON_MsgAckWarp.create_with_msgExpired( json_msgWarp );
804
+ //TODO: the referer is NULL here !
783
805
  this._config._callback_msgAckWarp(json_Nack, json_Nack);
784
806
  }.bind(this) );
785
807
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootintf/protocol-2phw",
3
- "version": "0.6.11",
3
+ "version": "0.7.1",
4
4
  "description": "",
5
5
  "main": "dist/twoPhW.cjs.js",
6
6
  "browser": "dist/twoPhW.es.mjs",
@@ -6,7 +6,7 @@
6
6
  "properties" : {
7
7
  "2PhW" : {
8
8
  "type" : "string",
9
- "pattern": "0\\.6"
9
+ "pattern": "0\\.7"
10
10
  }
11
11
  }
12
12
  }
@@ -9,7 +9,11 @@
9
9
  "required" : ["user", "hyperport"],
10
10
  "properties": {
11
11
  "ttl_msec" : {
12
- "type" : "integer"}
12
+ "type" : "integer"
13
+ },
14
+ "instantaneous" : {
15
+ "type" : "boolean"
16
+ }
13
17
  }
14
18
  }
15
19
  }
@@ -4,8 +4,14 @@
4
4
  "type" : "object",
5
5
  "required" : ["ttl_msec_incr"],
6
6
  "properties" : {
7
- "ttl_msec" : {
8
- "type" : "array"
7
+ "ttl_msec_incr" : {
8
+ "type" : "array",
9
+ "items": {
10
+ "type" : "integer"
11
+ }
12
+ },
13
+ "reason" : {
14
+ "type" : "string"
9
15
  }
10
16
  }
11
17
  }
package/src/twoPhW.mjs CHANGED
@@ -80,7 +80,7 @@ class Config {
80
80
 
81
81
  //-------------------------------------------------------------------------------------------------
82
82
 
83
- let k_VERSION= "0.6";
83
+ let k_VERSION= "0.7";
84
84
 
85
85
  var JSON_MsgOptions = (function() {
86
86
  return {
@@ -296,6 +296,8 @@ class StateWarp {
296
296
  changeState(newState) {
297
297
  if (newState instanceof StateAckWarp)
298
298
  return true;
299
+ if (newState instanceof StateComplete)
300
+ return true;
299
301
  return false;
300
302
  }
301
303
  }
@@ -304,24 +306,20 @@ class StateAckWarp {
304
306
  changeState(newState) {
305
307
  if (newState instanceof StateEngage)
306
308
  return true;
309
+ if (newState instanceof StateComplete)
310
+ return true;
307
311
  return false;
308
312
  }
309
313
  }
310
314
 
311
315
  class StateEngage {
312
316
  changeState(newState) {
313
- if (newState instanceof StateAckEngage)
317
+ if (newState instanceof StateComplete)
314
318
  return true;
315
319
  return false;
316
320
  }
317
321
  }
318
322
 
319
- class StateAckEngage {
320
- changeState(newState) {
321
- return false;
322
- }
323
- }
324
-
325
323
  class StateComplete {
326
324
  changeState(newState) {
327
325
  return false;
@@ -386,6 +384,13 @@ function handler_msgAckWarp_(cfg, msg, json_msgAckWarp)
386
384
  if (! cfg._callback_msgAckWarp(msg, json_msgAckWarp))
387
385
  return false;
388
386
 
387
+ if (json_msgWarp.warp.instantaneous) {
388
+ const b_res= ctx.protocol.changeState( new StateComplete() );
389
+ console.assert(b_res);
390
+
391
+ return true;
392
+ }
393
+
389
394
  const b_res= ctx.protocol.changeState( new StateEngage() );
390
395
  console.assert(b_res);
391
396
 
@@ -433,6 +438,13 @@ function handler_msgWarp_(cfg, msg, json_msgWarp)
433
438
  if (! cfg._callback_msgWarp(msg, json_msgWarp))
434
439
  return false;
435
440
 
441
+ if (json_msgWarp.warp.instantaneous) {
442
+ const b_res= ctx.protocol.changeState( new StateComplete() );
443
+ console.assert(b_res);
444
+
445
+ return true;
446
+ }
447
+
436
448
  const b_res= ctx.protocol.changeState( new StateAckWarp() );
437
449
  console.assert(b_res);
438
450
 
@@ -452,7 +464,7 @@ function handler_msgEngage_(cfg, msg, json_msgEngage)
452
464
  if (! cfg._callback_msgEngage(msg, json_msgEngage))
453
465
  return false;
454
466
 
455
- const b_res= ctx.protocol.changeState( new StateAckEngage() );
467
+ const b_res= ctx.protocol.changeState( new StateComplete() );
456
468
  console.assert(b_res);
457
469
 
458
470
  return true;
@@ -470,7 +482,7 @@ class TwoPhW {
470
482
  }
471
483
 
472
484
  // this function need to be removed when a microservice db is used instead of a state machine
473
- create_MsgWarp_out(str_id, json_user, json_hyperport, nr_ttl_msec)
485
+ create_MsgWarp_out(str_id, json_user, json_hyperport, nr_ttl_msec, b_instantaneous)
474
486
  {
475
487
  if (nr_ttl_msec === undefined)
476
488
  nr_ttl_msec= k_TTL;
@@ -478,9 +490,13 @@ class TwoPhW {
478
490
  const json_msgWarp= JSON_MsgWarp.create_with_user_hyperport(json_user, json_hyperport, nr_ttl_msec);
479
491
  json_msgWarp.id= str_id;
480
492
 
493
+ if (b_instantaneous !== undefined)
494
+ json_msgWarp.warp.instantaneous= b_instantaneous;
495
+
481
496
  const ctx= set_ctx(json_msgWarp.id, { protocol: new ProtocolStateState() });
482
497
  const b_res= ctx.protocol.changeState( new StateWarp(), nr_ttl_msec, function() {
483
498
  const json_Nack= JSON_MsgAckWarp.create_with_msgExpired( json_msgWarp );
499
+ //TODO: the referer is NULL here !
484
500
  this._config._callback_msgAckWarp(json_Nack, json_Nack);
485
501
  }.bind(this) );
486
502
 
@@ -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,4 +1,12 @@
1
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
+
2
10
  import { v4 as uuidv4 } from 'uuid';
3
11
  import { TwoPhW, JSON_MsgOptions, JSON_MsgWarp, JSON_MsgEngage, JSON_MsgAckWarp, JSON_MsgAckEngage, l as l_2PhW } from '../src/twoPhW.mjs';
4
12
  import { JSON_Msg, JSON_Msg_msg, JSON_MsgAck } from '@rootintf/json-msg'
@@ -69,11 +77,14 @@ const json_msgAckEngage_ = {
69
77
  "2PhW": k_VERSION
70
78
  }
71
79
 
80
+ //TODO: "required" : ["reason"],
72
81
  const json_msgOptions_ = {
73
82
  id: "f5d6c2b8-1481-49b2-882c-262bb1c9ef8c",
74
83
  referer: ["twoPhW", "af9447e3-4b36-424f-8d07-976a9216a298"],
75
84
  dt: "2022-10-28T06:26:19.692Z",
76
85
  options: {
86
+ ttl_msec_incr : [ 20000, 4000 ],
87
+ reason : "it is taking too long"
77
88
  },
78
89
  "_msg" : json_msgWarp_,
79
90
  "2PhW": k_VERSION
@@ -90,6 +101,9 @@ describe("Validation", function () {
90
101
  it("twoPhW.JSON_MsgOptions.validate(json_msgOptions_)", function () {
91
102
  expect( JSON_MsgOptions.validate(json_msgOptions_) ).toBe(true);
92
103
  });
104
+ it("validate_Options_delay_(json_msgOptions_.options)", function () {
105
+ expect( validate_Options_delay_(json_msgOptions_.options) ).toBe(true);
106
+ });
93
107
  });
94
108
 
95
109
  describe("Validation", function () {