@barchart/portfolio-api-common 1.3.25 → 1.4.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.
@@ -104,6 +104,10 @@ module.exports = (() => {
104
104
  static get SPINOFF() {
105
105
  return spinoff;
106
106
  }
107
+
108
+ toString() {
109
+ return `[CorporateActionType (code=${this.code})]`;
110
+ }
107
111
  }
108
112
 
109
113
  const split = new CorporateActionType('SPLIT', 'Split', false);
@@ -252,7 +252,7 @@ module.exports = (() => {
252
252
  }
253
253
 
254
254
  toString() {
255
- return '[InstrumentType]';
255
+ return `[InstrumentType (code=${this.code})]`;
256
256
  }
257
257
  }
258
258
 
@@ -118,6 +118,10 @@ module.exports = (() => {
118
118
  return even;
119
119
  }
120
120
  }
121
+
122
+ toString() {
123
+ return `[PositionDirection (code=${this.code})]`;
124
+ }
121
125
  }
122
126
 
123
127
  const long = new PositionDirection('LONG', 'Long', 'positive');
@@ -175,7 +175,7 @@ module.exports = (() => {
175
175
  }
176
176
 
177
177
  toString() {
178
- return '[PositionSummaryFrame]';
178
+ return `[PositionSummaryFrame (code=${this.code})]`;
179
179
  }
180
180
  }
181
181
 
@@ -494,7 +494,7 @@ module.exports = (() => {
494
494
  }
495
495
 
496
496
  toString() {
497
- return '[TransactionType]';
497
+ return `[TransactionType (code=${this.code})]`;
498
498
  }
499
499
  }
500
500
 
@@ -48,7 +48,7 @@ module.exports = (() => {
48
48
  }
49
49
 
50
50
  toString() {
51
- return '[ValuationType]';
51
+ return `[ValuationType (code=${this.code})]`;
52
52
  }
53
53
  }
54
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.3.25",
3
+ "version": "1.4.1",
4
4
  "description": "Common code used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -9,8 +9,8 @@
9
9
  },
10
10
  "scripts": {},
11
11
  "dependencies": {
12
- "@barchart/common-js": "~3.3.0",
13
- "uuid": "3.1.0"
12
+ "@barchart/common-js": "^3.5.1",
13
+ "uuid": "^3.4.0"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@babel/core": "^7.6.2",
@@ -253,7 +253,7 @@ module.exports = (() => {
253
253
  }
254
254
 
255
255
  toString() {
256
- return '[InstrumentType]';
256
+ return `[InstrumentType (code=${this.code})]`;
257
257
  }
258
258
  }
259
259
 
@@ -393,6 +393,10 @@ module.exports = (() => {
393
393
  return even;
394
394
  }
395
395
  }
396
+
397
+ toString() {
398
+ return `[PositionDirection (code=${this.code})]`;
399
+ }
396
400
  }
397
401
 
398
402
  const long = new PositionDirection('LONG', 'Long', 'positive');
@@ -580,7 +584,7 @@ module.exports = (() => {
580
584
  }
581
585
 
582
586
  toString() {
583
- return '[PositionSummaryFrame]';
587
+ return `[PositionSummaryFrame (code=${this.code})]`;
584
588
  }
585
589
  }
586
590
 
@@ -1247,7 +1251,7 @@ module.exports = (() => {
1247
1251
  }
1248
1252
 
1249
1253
  toString() {
1250
- return '[TransactionType]';
1254
+ return `[TransactionType (code=${this.code})]`;
1251
1255
  }
1252
1256
  }
1253
1257
 
@@ -8826,7 +8830,7 @@ module.exports = (() => {
8826
8830
 
8827
8831
  return {
8828
8832
  /**
8829
- * Returns true, if the argument is a number. NaN will return false.
8833
+ * Returns true if the argument is a number. NaN will return false.
8830
8834
  *
8831
8835
  * @static
8832
8836
  * @public
@@ -8838,7 +8842,7 @@ module.exports = (() => {
8838
8842
  },
8839
8843
 
8840
8844
  /**
8841
- * Returns true, if the argument is NaN.
8845
+ * Returns true if the argument is NaN.
8842
8846
  *
8843
8847
  * @static
8844
8848
  * @public
@@ -8850,7 +8854,7 @@ module.exports = (() => {
8850
8854
  },
8851
8855
 
8852
8856
  /**
8853
- * Returns true, if the argument is a valid 32-bit integer.
8857
+ * Returns true if the argument is a valid 32-bit integer.
8854
8858
  *
8855
8859
  * @static
8856
8860
  * @public
@@ -8862,7 +8866,7 @@ module.exports = (() => {
8862
8866
  },
8863
8867
 
8864
8868
  /**
8865
- * Returns true, if the argument is a valid integer (which can exceed 32 bits); however,
8869
+ * Returns true if the argument is a valid integer (which can exceed 32 bits); however,
8866
8870
  * the check can fail above the value of Number.MAX_SAFE_INTEGER.
8867
8871
  *
8868
8872
  * @static
@@ -8875,7 +8879,7 @@ module.exports = (() => {
8875
8879
  },
8876
8880
 
8877
8881
  /**
8878
- * Returns true, if the argument is a number that is positive.
8882
+ * Returns true if the argument is a number that is positive.
8879
8883
  *
8880
8884
  * @static
8881
8885
  * @public
@@ -8887,7 +8891,7 @@ module.exports = (() => {
8887
8891
  },
8888
8892
 
8889
8893
  /**
8890
- * Returns true, if the argument is a number that is negative.
8894
+ * Returns true if the argument is a number that is negative.
8891
8895
  *
8892
8896
  * @static
8893
8897
  * @public
@@ -8899,7 +8903,7 @@ module.exports = (() => {
8899
8903
  },
8900
8904
 
8901
8905
  /**
8902
- * Returns true, if the argument is a string.
8906
+ * Returns true if the argument is a string.
8903
8907
  *
8904
8908
  * @static
8905
8909
  * @public
@@ -8911,7 +8915,7 @@ module.exports = (() => {
8911
8915
  },
8912
8916
 
8913
8917
  /**
8914
- * Returns true, if the argument is a JavaScript Date instance.
8918
+ * Returns true if the argument is a JavaScript Date instance.
8915
8919
  *
8916
8920
  * @static
8917
8921
  * @public
@@ -8923,7 +8927,7 @@ module.exports = (() => {
8923
8927
  },
8924
8928
 
8925
8929
  /**
8926
- * Returns true, if the argument is a function.
8930
+ * Returns true if the argument is a function.
8927
8931
  *
8928
8932
  * @static
8929
8933
  * @public
@@ -8935,7 +8939,7 @@ module.exports = (() => {
8935
8939
  },
8936
8940
 
8937
8941
  /**
8938
- * Returns true, if the argument is an array.
8942
+ * Returns true if the argument is an array.
8939
8943
  *
8940
8944
  * @static
8941
8945
  * @public
@@ -8947,7 +8951,7 @@ module.exports = (() => {
8947
8951
  },
8948
8952
 
8949
8953
  /**
8950
- * Returns true, if the argument is a Boolean value.
8954
+ * Returns true if the argument is a Boolean value.
8951
8955
  *
8952
8956
  * @static
8953
8957
  * @public
@@ -8959,7 +8963,7 @@ module.exports = (() => {
8959
8963
  },
8960
8964
 
8961
8965
  /**
8962
- * Returns true, if the argument is an object.
8966
+ * Returns true if the argument is an object.
8963
8967
  *
8964
8968
  * @static
8965
8969
  * @public
@@ -8971,7 +8975,7 @@ module.exports = (() => {
8971
8975
  },
8972
8976
 
8973
8977
  /**
8974
- * Returns true, if the argument is a null value.
8978
+ * Returns true if the argument is a null value.
8975
8979
  *
8976
8980
  * @static
8977
8981
  * @public
@@ -8983,7 +8987,7 @@ module.exports = (() => {
8983
8987
  },
8984
8988
 
8985
8989
  /**
8986
- * Returns true, if the argument is an undefined value.
8990
+ * Returns true if the argument is an undefined value.
8987
8991
  *
8988
8992
  * @static
8989
8993
  * @public
@@ -8994,6 +8998,18 @@ module.exports = (() => {
8994
8998
  return candidate === undefined;
8995
8999
  },
8996
9000
 
9001
+ /**
9002
+ * Returns true if the argument is a zero-length string.
9003
+ *
9004
+ * @static
9005
+ * @public
9006
+ * @param {*} candidate
9007
+ * @returns {boolean}
9008
+ */
9009
+ zeroLengthString(candidate) {
9010
+ return this.string(candidate) && candidate.length === 0;
9011
+ },
9012
+
8997
9013
  /**
8998
9014
  * Given two classes, determines if the "child" class extends
8999
9015
  * the "parent" class (without instantiation).
@@ -10172,9 +10188,9 @@ module.exports = (() => {
10172
10188
 
10173
10189
  },{"./../../../lang/assert":29,"./../../../lang/is":33,"./../Component":36,"./../DataType":37,"./../Field":38,"./../Schema":39,"./ComponentBuilder":40}],42:[function(require,module,exports){
10174
10190
  /*
10175
- * big.js v5.0.3
10191
+ * big.js v5.2.2
10176
10192
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
10177
- * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
10193
+ * Copyright (c) 2018 Michael Mclaughlin <M8ch88l@gmail.com>
10178
10194
  * https://github.com/MikeMcl/big.js/LICENCE
10179
10195
  */
10180
10196
  ;(function (GLOBAL) {
@@ -10280,7 +10296,7 @@ module.exports = (() => {
10280
10296
  Big.RM = RM;
10281
10297
  Big.NE = NE;
10282
10298
  Big.PE = PE;
10283
- Big.version = '5.0.2';
10299
+ Big.version = '5.2.2';
10284
10300
 
10285
10301
  return Big;
10286
10302
  }
@@ -10364,7 +10380,7 @@ module.exports = (() => {
10364
10380
  more = xc[i] > 5 || xc[i] == 5 &&
10365
10381
  (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1);
10366
10382
  } else if (rm === 3) {
10367
- more = more || xc[i] !== UNDEFINED || i < 0;
10383
+ more = more || !!xc[0];
10368
10384
  } else {
10369
10385
  more = false;
10370
10386
  if (rm !== 0) throw Error(INVALID_RM);
@@ -10831,7 +10847,7 @@ module.exports = (() => {
10831
10847
  xc = xc.slice();
10832
10848
 
10833
10849
  // Prepend zeros to equalise exponents.
10834
- // Note: Faster to use reverse then do unshifts.
10850
+ // Note: reverse faster than unshifts.
10835
10851
  if (a = xe - ye) {
10836
10852
  if (a > 0) {
10837
10853
  ye = xe;
@@ -10903,18 +10919,19 @@ module.exports = (() => {
10903
10919
 
10904
10920
 
10905
10921
  /*
10906
- * Return a new Big whose value is the value of this Big rounded to a maximum of dp decimal
10907
- * places using rounding mode rm.
10922
+ * Return a new Big whose value is the value of this Big rounded using rounding mode rm
10923
+ * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a
10924
+ * multiple of 10**-dp.
10908
10925
  * If dp is not specified, round to 0 decimal places.
10909
10926
  * If rm is not specified, use Big.RM.
10910
10927
  *
10911
- * dp? {number} Integer, 0 to MAX_DP inclusive.
10928
+ * dp? {number} Integer, -MAX_DP to MAX_DP inclusive.
10912
10929
  * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP)
10913
10930
  */
10914
10931
  P.round = function (dp, rm) {
10915
10932
  var Big = this.constructor;
10916
10933
  if (dp === UNDEFINED) dp = 0;
10917
- else if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP);
10934
+ else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP);
10918
10935
  return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm);
10919
10936
  };
10920
10937
 
@@ -10938,17 +10955,18 @@ module.exports = (() => {
10938
10955
  if (s < 0) throw Error(NAME + 'No square root');
10939
10956
 
10940
10957
  // Estimate.
10941
- s = Math.sqrt(x.toString());
10958
+ s = Math.sqrt(x + '');
10942
10959
 
10943
10960
  // Math.sqrt underflow/overflow?
10944
- // Re-estimate: pass x to Math.sqrt as integer, then adjust the result exponent.
10961
+ // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent.
10945
10962
  if (s === 0 || s === 1 / 0) {
10946
10963
  c = x.c.join('');
10947
10964
  if (!(c.length + e & 1)) c += '0';
10948
- r = new Big(Math.sqrt(c).toString());
10949
- r.e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
10965
+ s = Math.sqrt(c);
10966
+ e = ((e + 1) / 2 | 0) - (e < 0 || e & 1);
10967
+ r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e);
10950
10968
  } else {
10951
- r = new Big(s.toString());
10969
+ r = new Big(s);
10952
10970
  }
10953
10971
 
10954
10972
  e = r.e + (Big.DP += 4);
@@ -16972,43 +16990,48 @@ for (var i = 0; i < 256; ++i) {
16972
16990
  function bytesToUuid(buf, offset) {
16973
16991
  var i = offset || 0;
16974
16992
  var bth = byteToHex;
16975
- return bth[buf[i++]] + bth[buf[i++]] +
16976
- bth[buf[i++]] + bth[buf[i++]] + '-' +
16977
- bth[buf[i++]] + bth[buf[i++]] + '-' +
16978
- bth[buf[i++]] + bth[buf[i++]] + '-' +
16979
- bth[buf[i++]] + bth[buf[i++]] + '-' +
16980
- bth[buf[i++]] + bth[buf[i++]] +
16981
- bth[buf[i++]] + bth[buf[i++]] +
16982
- bth[buf[i++]] + bth[buf[i++]];
16993
+ // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
16994
+ return ([
16995
+ bth[buf[i++]], bth[buf[i++]],
16996
+ bth[buf[i++]], bth[buf[i++]], '-',
16997
+ bth[buf[i++]], bth[buf[i++]], '-',
16998
+ bth[buf[i++]], bth[buf[i++]], '-',
16999
+ bth[buf[i++]], bth[buf[i++]], '-',
17000
+ bth[buf[i++]], bth[buf[i++]],
17001
+ bth[buf[i++]], bth[buf[i++]],
17002
+ bth[buf[i++]], bth[buf[i++]]
17003
+ ]).join('');
16983
17004
  }
16984
17005
 
16985
17006
  module.exports = bytesToUuid;
16986
17007
 
16987
17008
  },{}],49:[function(require,module,exports){
16988
- (function (global){
16989
17009
  // Unique ID creation requires a high quality random # generator. In the
16990
17010
  // browser this is a little complicated due to unknown quality of Math.random()
16991
17011
  // and inconsistent support for the `crypto` API. We do the best we can via
16992
17012
  // feature-detection
16993
- var rng;
16994
17013
 
16995
- var crypto = global.crypto || global.msCrypto; // for IE 11
16996
- if (crypto && crypto.getRandomValues) {
17014
+ // getRandomValues needs to be invoked in a context where "this" is a Crypto
17015
+ // implementation. Also, find the complete implementation of crypto on IE11.
17016
+ var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
17017
+ (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
17018
+
17019
+ if (getRandomValues) {
16997
17020
  // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
16998
17021
  var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
16999
- rng = function whatwgRNG() {
17000
- crypto.getRandomValues(rnds8);
17022
+
17023
+ module.exports = function whatwgRNG() {
17024
+ getRandomValues(rnds8);
17001
17025
  return rnds8;
17002
17026
  };
17003
- }
17004
-
17005
- if (!rng) {
17027
+ } else {
17006
17028
  // Math.random()-based (RNG)
17007
17029
  //
17008
17030
  // If all else fails, use Math.random(). It's fast, but is of unspecified
17009
17031
  // quality.
17010
17032
  var rnds = new Array(16);
17011
- rng = function() {
17033
+
17034
+ module.exports = function mathRNG() {
17012
17035
  for (var i = 0, r; i < 16; i++) {
17013
17036
  if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
17014
17037
  rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
@@ -17018,9 +17041,6 @@ if (!rng) {
17018
17041
  };
17019
17042
  }
17020
17043
 
17021
- module.exports = rng;
17022
-
17023
- }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
17024
17044
  },{}],50:[function(require,module,exports){
17025
17045
  var rng = require('./lib/rng');
17026
17046
  var bytesToUuid = require('./lib/bytesToUuid');
@@ -17030,30 +17050,40 @@ var bytesToUuid = require('./lib/bytesToUuid');
17030
17050
  // Inspired by https://github.com/LiosK/UUID.js
17031
17051
  // and http://docs.python.org/library/uuid.html
17032
17052
 
17033
- // random #'s we need to init node and clockseq
17034
- var _seedBytes = rng();
17035
-
17036
- // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
17037
- var _nodeId = [
17038
- _seedBytes[0] | 0x01,
17039
- _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
17040
- ];
17041
-
17042
- // Per 4.2.2, randomize (14 bit) clockseq
17043
- var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
17053
+ var _nodeId;
17054
+ var _clockseq;
17044
17055
 
17045
17056
  // Previous uuid creation time
17046
- var _lastMSecs = 0, _lastNSecs = 0;
17057
+ var _lastMSecs = 0;
17058
+ var _lastNSecs = 0;
17047
17059
 
17048
- // See https://github.com/broofa/node-uuid for API details
17060
+ // See https://github.com/uuidjs/uuid for API details
17049
17061
  function v1(options, buf, offset) {
17050
17062
  var i = buf && offset || 0;
17051
17063
  var b = buf || [];
17052
17064
 
17053
17065
  options = options || {};
17054
-
17066
+ var node = options.node || _nodeId;
17055
17067
  var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
17056
17068
 
17069
+ // node and clockseq need to be initialized to random values if they're not
17070
+ // specified. We do this lazily to minimize issues related to insufficient
17071
+ // system entropy. See #189
17072
+ if (node == null || clockseq == null) {
17073
+ var seedBytes = rng();
17074
+ if (node == null) {
17075
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
17076
+ node = _nodeId = [
17077
+ seedBytes[0] | 0x01,
17078
+ seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
17079
+ ];
17080
+ }
17081
+ if (clockseq == null) {
17082
+ // Per 4.2.2, randomize (14 bit) clockseq
17083
+ clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
17084
+ }
17085
+ }
17086
+
17057
17087
  // UUID timestamps are 100 nano-second units since the Gregorian epoch,
17058
17088
  // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
17059
17089
  // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
@@ -17113,7 +17143,6 @@ function v1(options, buf, offset) {
17113
17143
  b[i++] = clockseq & 0xff;
17114
17144
 
17115
17145
  // `node`
17116
- var node = options.node || _nodeId;
17117
17146
  for (var n = 0; n < 6; ++n) {
17118
17147
  b[i + n] = node[n];
17119
17148
  }
@@ -17131,7 +17160,7 @@ function v4(options, buf, offset) {
17131
17160
  var i = buf && offset || 0;
17132
17161
 
17133
17162
  if (typeof(options) == 'string') {
17134
- buf = options == 'binary' ? new Array(16) : null;
17163
+ buf = options === 'binary' ? new Array(16) : null;
17135
17164
  options = null;
17136
17165
  }
17137
17166
  options = options || {};