orator 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "optOut": false,
3
- "lastUpdateCheck": 1677519671750
3
+ "lastUpdateCheck": 1678606070157
4
4
  }
package/dist/orator.js CHANGED
@@ -3073,7 +3073,7 @@
3073
3073
  "assert": 1,
3074
3074
  "fast-deep-equal": 22,
3075
3075
  "fast-querystring": 23,
3076
- "safe-regex2": 43
3076
+ "safe-regex2": 38
3077
3077
  }],
3078
3078
  30: [function (require, module, exports) {
3079
3079
  'use strict';
@@ -3997,6 +3997,54 @@
3997
3997
  };
3998
3998
  }, {}],
3999
3999
  38: [function (require, module, exports) {
4000
+ 'use strict';
4001
+
4002
+ var parse = require('ret');
4003
+ var types = parse.types;
4004
+ module.exports = function (re, opts) {
4005
+ if (!opts) opts = {};
4006
+ var replimit = opts.limit === undefined ? 25 : opts.limit;
4007
+ if (isRegExp(re)) re = re.source;else if (typeof re !== 'string') re = String(re);
4008
+ try {
4009
+ re = parse(re);
4010
+ } catch (err) {
4011
+ return false;
4012
+ }
4013
+ var reps = 0;
4014
+ return function walk(node, starHeight) {
4015
+ var i;
4016
+ var ok;
4017
+ var len;
4018
+ if (node.type === types.REPETITION) {
4019
+ starHeight++;
4020
+ reps++;
4021
+ if (starHeight > 1) return false;
4022
+ if (reps > replimit) return false;
4023
+ }
4024
+ if (node.options) {
4025
+ for (i = 0, len = node.options.length; i < len; i++) {
4026
+ ok = walk({
4027
+ stack: node.options[i]
4028
+ }, starHeight);
4029
+ if (!ok) return false;
4030
+ }
4031
+ }
4032
+ var stack = node.stack || node.value && node.value.stack;
4033
+ if (!stack) return true;
4034
+ for (i = 0; i < stack.length; i++) {
4035
+ ok = walk(stack[i], starHeight);
4036
+ if (!ok) return false;
4037
+ }
4038
+ return true;
4039
+ }(re, 0);
4040
+ };
4041
+ function isRegExp(x) {
4042
+ return {}.toString.call(x) === '[object RegExp]';
4043
+ }
4044
+ }, {
4045
+ "ret": 39
4046
+ }],
4047
+ 39: [function (require, module, exports) {
4000
4048
  const util = require('./util');
4001
4049
  const types = require('./types');
4002
4050
  const sets = require('./sets');
@@ -4254,12 +4302,12 @@
4254
4302
  };
4255
4303
  module.exports.types = types;
4256
4304
  }, {
4257
- "./positions": 39,
4258
- "./sets": 40,
4259
- "./types": 41,
4260
- "./util": 42
4305
+ "./positions": 40,
4306
+ "./sets": 41,
4307
+ "./types": 42,
4308
+ "./util": 43
4261
4309
  }],
4262
- 39: [function (require, module, exports) {
4310
+ 40: [function (require, module, exports) {
4263
4311
  const types = require('./types');
4264
4312
  exports.wordBoundary = () => ({
4265
4313
  type: types.POSITION,
@@ -4278,9 +4326,9 @@
4278
4326
  value: '$'
4279
4327
  });
4280
4328
  }, {
4281
- "./types": 41
4329
+ "./types": 42
4282
4330
  }],
4283
- 40: [function (require, module, exports) {
4331
+ 41: [function (require, module, exports) {
4284
4332
  const types = require('./types');
4285
4333
  const INTS = () => [{
4286
4334
  type: types.RANGE,
@@ -4403,9 +4451,9 @@
4403
4451
  not: true
4404
4452
  });
4405
4453
  }, {
4406
- "./types": 41
4454
+ "./types": 42
4407
4455
  }],
4408
- 41: [function (require, module, exports) {
4456
+ 42: [function (require, module, exports) {
4409
4457
  module.exports = {
4410
4458
  ROOT: 0,
4411
4459
  GROUP: 1,
@@ -4417,7 +4465,7 @@
4417
4465
  CHAR: 7
4418
4466
  };
4419
4467
  }, {}],
4420
- 42: [function (require, module, exports) {
4468
+ 43: [function (require, module, exports) {
4421
4469
  const types = require('./types');
4422
4470
  const sets = require('./sets');
4423
4471
  const CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?';
@@ -4510,56 +4558,8 @@
4510
4558
  throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);
4511
4559
  };
4512
4560
  }, {
4513
- "./sets": 40,
4514
- "./types": 41
4515
- }],
4516
- 43: [function (require, module, exports) {
4517
- 'use strict';
4518
-
4519
- var parse = require('ret');
4520
- var types = parse.types;
4521
- module.exports = function (re, opts) {
4522
- if (!opts) opts = {};
4523
- var replimit = opts.limit === undefined ? 25 : opts.limit;
4524
- if (isRegExp(re)) re = re.source;else if (typeof re !== 'string') re = String(re);
4525
- try {
4526
- re = parse(re);
4527
- } catch (err) {
4528
- return false;
4529
- }
4530
- var reps = 0;
4531
- return function walk(node, starHeight) {
4532
- var i;
4533
- var ok;
4534
- var len;
4535
- if (node.type === types.REPETITION) {
4536
- starHeight++;
4537
- reps++;
4538
- if (starHeight > 1) return false;
4539
- if (reps > replimit) return false;
4540
- }
4541
- if (node.options) {
4542
- for (i = 0, len = node.options.length; i < len; i++) {
4543
- ok = walk({
4544
- stack: node.options[i]
4545
- }, starHeight);
4546
- if (!ok) return false;
4547
- }
4548
- }
4549
- var stack = node.stack || node.value && node.value.stack;
4550
- if (!stack) return true;
4551
- for (i = 0; i < stack.length; i++) {
4552
- ok = walk(stack[i], starHeight);
4553
- if (!ok) return false;
4554
- }
4555
- return true;
4556
- }(re, 0);
4557
- };
4558
- function isRegExp(x) {
4559
- return {}.toString.call(x) === '[object RegExp]';
4560
- }
4561
- }, {
4562
- "ret": 38
4561
+ "./sets": 41,
4562
+ "./types": 42
4563
4563
  }],
4564
4564
  44: [function (require, module, exports) {
4565
4565
  (function (setImmediate, clearImmediate) {
@@ -4687,6 +4687,7 @@
4687
4687
  constructor(pOrator) {
4688
4688
  this.orator = pOrator;
4689
4689
  this.log = pOrator.log;
4690
+ this.ServiceServerType = 'Base';
4690
4691
  this.Name = this.orator.settings.Product;
4691
4692
  this.URL = 'BASE_SERVICE_SERVER';
4692
4693
  this.Port = this.orator.settings.ServicePort;
@@ -4709,13 +4710,17 @@
4709
4710
  * End of Service Lifecycle Functions
4710
4711
  */
4711
4712
 
4712
- use(fHandlerFunction) {
4713
- if (typeof fHandlerFunction != 'function') {
4714
- this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof fHandlerFunction} instead of a string.`);
4715
- return false;
4716
- }
4717
- return true;
4713
+ /*
4714
+ * Content parsing functions
4715
+ *************************************************************************/
4716
+ bodyParser(pOptions) {
4717
+ return (pRequest, pResponse, fNext) => {
4718
+ fNext();
4719
+ };
4718
4720
  }
4721
+ /*************************************************************************
4722
+ * End of Service Lifecycle Functions
4723
+ */
4719
4724
 
4720
4725
  /*
4721
4726
  * Service Route Creation Functions
@@ -4736,11 +4741,27 @@
4736
4741
  }
4737
4742
  * This pattern and calling super is totally optional, obviously.
4738
4743
  *************************************************************************/
4744
+ use(fHandlerFunction) {
4745
+ if (typeof fHandlerFunction != 'function') {
4746
+ this.log.error(`Orator USE global handler mapping failed -- parameter was expected to be a function with prototype function(Request, Response, Next) but type was ${typeof fHandlerFunction} instead of a string.`);
4747
+ return false;
4748
+ }
4749
+ return true;
4750
+ }
4751
+ doGet(pRoute, ...fRouteProcessingFunctions) {
4752
+ return true;
4753
+ }
4739
4754
  get(pRoute, ...fRouteProcessingFunctions) {
4740
4755
  if (typeof pRoute != 'string') {
4741
4756
  this.log.error(`Orator GET Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
4742
4757
  return false;
4743
4758
  }
4759
+ return this.doGet(pRoute, ...fRouteProcessingFunctions);
4760
+ }
4761
+ getWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4762
+ return this.get(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4763
+ }
4764
+ doPut(pRoute, ...fRouteProcessingFunctions) {
4744
4765
  return true;
4745
4766
  }
4746
4767
  put(pRoute, ...fRouteProcessingFunctions) {
@@ -4748,6 +4769,12 @@
4748
4769
  this.log.error(`Orator PUT Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
4749
4770
  return false;
4750
4771
  }
4772
+ return this.doPut(pRoute, ...fRouteProcessingFunctions);
4773
+ }
4774
+ putWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4775
+ return this.put(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4776
+ }
4777
+ doPost(pRoute, ...fRouteProcessingFunctions) {
4751
4778
  return true;
4752
4779
  }
4753
4780
  post(pRoute, ...fRouteProcessingFunctions) {
@@ -4757,6 +4784,12 @@
4757
4784
  }
4758
4785
  return true;
4759
4786
  }
4787
+ postWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4788
+ return this.post(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4789
+ }
4790
+ doDel(pRoute, ...fRouteProcessingFunctions) {
4791
+ return true;
4792
+ }
4760
4793
  del(pRoute, ...fRouteProcessingFunctions) {
4761
4794
  if (typeof pRoute != 'string') {
4762
4795
  this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
@@ -4764,6 +4797,9 @@
4764
4797
  }
4765
4798
  return true;
4766
4799
  }
4800
+ delWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4801
+ return this.del(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4802
+ }
4767
4803
  patch(pRoute, ...fRouteProcessingFunctions) {
4768
4804
  if (typeof pRoute != 'string') {
4769
4805
  this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
@@ -4771,6 +4807,9 @@
4771
4807
  }
4772
4808
  return true;
4773
4809
  }
4810
+ patchWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4811
+ return this.patch(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4812
+ }
4774
4813
  opts(pRoute, ...fRouteProcessingFunctions) {
4775
4814
  if (typeof pRoute != 'string') {
4776
4815
  this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
@@ -4778,6 +4817,9 @@
4778
4817
  }
4779
4818
  return true;
4780
4819
  }
4820
+ optsWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4821
+ return this.opts(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4822
+ }
4781
4823
  head(pRoute, ...fRouteProcessingFunctions) {
4782
4824
  if (typeof pRoute != 'string') {
4783
4825
  this.log.error(`Orator HEAD Route mapping failed -- route parameter was ${typeof pRoute} instead of a string.`);
@@ -4785,6 +4827,9 @@
4785
4827
  }
4786
4828
  return true;
4787
4829
  }
4830
+ headWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
4831
+ return this.head(pRoute, this.bodyParser(), ...fRouteProcessingFunctions);
4832
+ }
4788
4833
  /*************************************************************************
4789
4834
  * End of Service Route Creation Functions
4790
4835
  */
@@ -4886,6 +4931,7 @@
4886
4931
  this.routerOptions = this.orator.settings.hasOwnProperty('router_options') && typeof this.orator.settings.router_options == 'object' ? this.orator.settings.router_options : {};
4887
4932
  this.router = libFindMyWay(this.routerOptions);
4888
4933
  this.router.addConstraintStrategy(libOratorServiceServerIPCCustomConstrainer);
4934
+ this.ServiceServerType = 'IPC';
4889
4935
  this.URL = 'IPC';
4890
4936
  this.preBehaviorFunctions = [];
4891
4937
  this.behaviorMap = {};
@@ -4980,6 +5026,9 @@
4980
5026
  });
4981
5027
  return true;
4982
5028
  }
5029
+
5030
+ // This is the virtualized "body parser"
5031
+
4983
5032
  get(pRoute, ...fRouteProcessingFunctions) {
4984
5033
  if (!super.get(pRoute, ...fRouteProcessingFunctions)) {
4985
5034
  this.log.error(`IPC provider failed to map GET route [${pRoute}]!`);
@@ -4987,6 +5036,9 @@
4987
5036
  }
4988
5037
  return this.addRouteProcessor('GET', pRoute, Array.from(fRouteProcessingFunctions));
4989
5038
  }
5039
+ getWithBodyParser(pRoute, ...fRouteProcessingFunctions) {
5040
+ return this.get(pRoute, fS);
5041
+ }
4990
5042
  put(pRoute, ...fRouteProcessingFunctions) {
4991
5043
  if (!super.get(pRoute, ...fRouteProcessingFunctions)) {
4992
5044
  this.log.error(`IPC provider failed to map PUT route [${pRoute}]!`);