@barchart/portfolio-client-js 1.1.51 → 1.2.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.
@@ -26,7 +26,7 @@ module.exports = function () {
26
26
  window.Barchart.ValuationType = ValuationType;
27
27
  }();
28
28
 
29
- },{"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Timezones":35,"@barchart/portfolio-api-common/lib/data/TransactionType":53,"@barchart/portfolio-api-common/lib/data/ValuationType":54,"@barchart/tgam-jwt-js/lib/JwtGateway":59}],2:[function(require,module,exports){
29
+ },{"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Timezones":35,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/data/ValuationType":55,"@barchart/tgam-jwt-js/lib/JwtGateway":60}],2:[function(require,module,exports){
30
30
  'use strict';
31
31
 
32
32
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -802,7 +802,10 @@ module.exports = function () {
802
802
 
803
803
  var responseInterceptorForTransactionMutateDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
804
804
  try {
805
- var positions = response.data.positions.map(function (p) {
805
+ var saved = response.data.positions.saved.map(function (p) {
806
+ return JSON.parse(p, PositionSchema.CLIENT.schema.getReviver());
807
+ });
808
+ var deleted = response.data.positions.deleted.map(function (p) {
806
809
  return JSON.parse(p, PositionSchema.CLIENT.schema.getReviver());
807
810
  });
808
811
  var summaries = response.data.summaries.map(function (s) {
@@ -810,9 +813,11 @@ module.exports = function () {
810
813
  });
811
814
 
812
815
  var returnRef = {
813
- positions: positions,
814
- summaries: summaries,
815
- replaced: response.data.replaced
816
+ positions: {
817
+ saved: saved,
818
+ deleted: deleted
819
+ },
820
+ summaries: summaries
816
821
  };
817
822
 
818
823
  if (response.data.transactions) {
@@ -854,7 +859,7 @@ module.exports = function () {
854
859
  return PortfolioGateway;
855
860
  }();
856
861
 
857
- },{"./../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/ErrorInterceptor":20,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/portfolio-api-common/lib/data/PositionSummaryFrame":52,"@barchart/portfolio-api-common/lib/data/TransactionType":53,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":55,"@barchart/portfolio-api-common/lib/serialization/PositionSchema":56,"@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema":57,"@barchart/portfolio-api-common/lib/serialization/TransactionSchema":58}],4:[function(require,module,exports){
862
+ },{"./../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/ErrorInterceptor":20,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/portfolio-api-common/lib/data/PositionSummaryFrame":53,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":56,"@barchart/portfolio-api-common/lib/serialization/PositionSchema":57,"@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema":58,"@barchart/portfolio-api-common/lib/serialization/TransactionSchema":59}],4:[function(require,module,exports){
858
863
  'use strict';
859
864
 
860
865
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -1205,7 +1210,7 @@ module.exports = function () {
1205
1210
  return {
1206
1211
  JwtGateway: JwtGateway,
1207
1212
  PortfolioGateway: PortfolioGateway,
1208
- version: '1.1.51'
1213
+ version: '1.2.1'
1209
1214
  };
1210
1215
  }();
1211
1216
 
@@ -1942,7 +1947,7 @@ module.exports = function () {
1942
1947
  return Gateway;
1943
1948
  }();
1944
1949
 
1945
- },{"./../../lang/array":36,"./../../lang/assert":37,"./../../lang/attributes":38,"./../../lang/promise":42,"./../failures/FailureReason":6,"./../failures/FailureType":8,"./definitions/Endpoint":12,"./definitions/VerbType":16,"axios":61}],10:[function(require,module,exports){
1950
+ },{"./../../lang/array":36,"./../../lang/assert":37,"./../../lang/attributes":38,"./../../lang/promise":42,"./../failures/FailureReason":6,"./../failures/FailureType":8,"./definitions/Endpoint":12,"./definitions/VerbType":16,"axios":62}],10:[function(require,module,exports){
1946
1951
  'use strict';
1947
1952
 
1948
1953
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -5898,7 +5903,7 @@ module.exports = function () {
5898
5903
  return Decimal;
5899
5904
  }();
5900
5905
 
5901
- },{"./Enum":32,"./assert":37,"./is":40,"big.js":86}],31:[function(require,module,exports){
5906
+ },{"./Enum":32,"./assert":37,"./is":40,"big.js":87}],31:[function(require,module,exports){
5902
5907
  'use strict';
5903
5908
 
5904
5909
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -6435,7 +6440,7 @@ module.exports = function () {
6435
6440
  return Timestamp;
6436
6441
  }();
6437
6442
 
6438
- },{"./assert":37,"./is":40,"moment-timezone":91}],35:[function(require,module,exports){
6443
+ },{"./assert":37,"./is":40,"moment-timezone":92}],35:[function(require,module,exports){
6439
6444
  'use strict';
6440
6445
 
6441
6446
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -7918,7 +7923,7 @@ module.exports = function () {
7918
7923
  };
7919
7924
  }();
7920
7925
 
7921
- },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":89}],44:[function(require,module,exports){
7926
+ },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":90}],44:[function(require,module,exports){
7922
7927
  'use strict';
7923
7928
 
7924
7929
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -8394,7 +8399,7 @@ module.exports = function () {
8394
8399
  return DataType;
8395
8400
  }();
8396
8401
 
8397
- },{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":93}],46:[function(require,module,exports){
8402
+ },{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":94}],46:[function(require,module,exports){
8398
8403
  'use strict';
8399
8404
 
8400
8405
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -9327,6 +9332,8 @@ module.exports = function () {
9327
9332
  }();
9328
9333
 
9329
9334
  },{"./../lang/Disposable":31,"./../lang/assert":37,"./../lang/is":40,"./../lang/object":41,"./../lang/promise":42}],51:[function(require,module,exports){
9335
+ const uuid = require('uuid');
9336
+
9330
9337
  const assert = require('@barchart/common-js/lang/assert'),
9331
9338
  Enum = require('@barchart/common-js/lang/Enum');
9332
9339
 
@@ -9342,19 +9349,29 @@ module.exports = (() => {
9342
9349
  * @param {String} alternateDescription
9343
9350
  * @param {String} code
9344
9351
  * @param {Boolean} canReinvest
9352
+ * @param {Boolean} canShort
9353
+ * @param {Boolean} canSwitchDirection
9345
9354
  * @param {Boolean} usesSymbols
9355
+ * @param {Function} usesSymbols
9346
9356
  */
9347
9357
  class InstrumentType extends Enum {
9348
- constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
9358
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, generator) {
9349
9359
  super(code, description);
9350
9360
 
9351
9361
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
9352
9362
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
9363
+ assert.argumentIsRequired(canShort, 'canShort', Boolean);
9364
+ assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
9353
9365
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
9366
+ assert.argumentIsRequired(generator, 'generator', Function);
9354
9367
 
9355
9368
  this._alternateDescription = alternateDescription;
9356
9369
  this._canReinvest = canReinvest;
9370
+ this._canShort = canShort;
9371
+ this._canSwitchDirection = canSwitchDirection;
9357
9372
  this._usesSymbols = usesSymbols;
9373
+
9374
+ this._generator = generator;
9358
9375
  }
9359
9376
 
9360
9377
  /**
@@ -9377,6 +9394,27 @@ module.exports = (() => {
9377
9394
  return this._canReinvest;
9378
9395
  }
9379
9396
 
9397
+ /**
9398
+ * Indicates if short-selling is possible for this instrument type.
9399
+ *
9400
+ * @public
9401
+ * @returns {Boolean}
9402
+ */
9403
+ get canShort() {
9404
+ return this._canShort;
9405
+ }
9406
+
9407
+ /**
9408
+ * Indicates if one transaction is allowed to switch a position size from
9409
+ * positive to negative (or vice versa).
9410
+ *
9411
+ * @public
9412
+ * @returns {Boolean}
9413
+ */
9414
+ get canSwitchDirection() {
9415
+ return this._canSwitchDirection;
9416
+ }
9417
+
9380
9418
  /**
9381
9419
  * Indicates if an instrument of this type can be represented by a symbol.
9382
9420
  *
@@ -9387,6 +9425,23 @@ module.exports = (() => {
9387
9425
  return this._usesSymbols;
9388
9426
  }
9389
9427
 
9428
+ /**
9429
+ * Generates an identifier for the instrument.
9430
+ *
9431
+ * @public
9432
+ * @param {Object} instrument
9433
+ * @returns {String}
9434
+ */
9435
+ generateIdentifier(instrument) {
9436
+ assert.argumentIsRequired(instrument, 'instrument');
9437
+
9438
+ if (instrument.type !== this) {
9439
+ throw new Error('Unable to generate instrument identifier for incompatible type.');
9440
+ }
9441
+
9442
+ return this._generator(instrument);
9443
+ }
9444
+
9390
9445
  /**
9391
9446
  * Cash.
9392
9447
  *
@@ -9431,20 +9486,169 @@ module.exports = (() => {
9431
9486
  return other;
9432
9487
  }
9433
9488
 
9489
+ /**
9490
+ * Generates an identifier for the instrument.
9491
+ *
9492
+ * @static
9493
+ * @public
9494
+ * @param {Object} instrument
9495
+ * @returns {String}
9496
+ */
9497
+ static generateIdentifier(instrument) {
9498
+ return map[instrument.type.code].generateIdentifier(instrument);
9499
+ }
9500
+
9434
9501
  toString() {
9435
9502
  return '[InstrumentType]';
9436
9503
  }
9437
9504
  }
9438
9505
 
9439
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false);
9440
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true);
9441
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true);
9442
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false);
9506
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
9507
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
9508
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
9509
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
9510
+
9511
+ const map = { };
9512
+
9513
+ map[cash.code] = cash;
9514
+ map[equity.code] = equity;
9515
+ map[fund.code] = fund;
9516
+ map[other.code] = other;
9443
9517
 
9444
9518
  return InstrumentType;
9445
9519
  })();
9446
9520
 
9447
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
9521
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":95}],52:[function(require,module,exports){
9522
+ const assert = require('@barchart/common-js/lang/assert'),
9523
+ Decimal = require('@barchart/common-js/lang/Decimal'),
9524
+ Enum = require('@barchart/common-js/lang/Enum');
9525
+
9526
+ module.exports = (() => {
9527
+ 'use strict';
9528
+
9529
+ /**
9530
+ * Describes a position size -- positive values are long, negative values
9531
+ * are short and zero values are even.
9532
+ *
9533
+ * @public
9534
+ * @extends {Enum}
9535
+ * @param {String} code
9536
+ * @param {String} description
9537
+ * @param {sign} sign
9538
+ */
9539
+ class PositionDirection extends Enum {
9540
+ constructor(code, description, sign) {
9541
+ super(code, description);
9542
+
9543
+ assert.argumentIsRequired(sign, 'sign', String);
9544
+
9545
+ this._sign = sign;
9546
+ }
9547
+
9548
+ /**
9549
+ * A description of the positiveness or negativeness of the size of the
9550
+ * position.
9551
+ *
9552
+ * @public
9553
+ * @returns {String}
9554
+ */
9555
+ get sign() {
9556
+ return this._sign;
9557
+ }
9558
+
9559
+ /**
9560
+ * Indicates if the position size is positive (i.e. is {@link PositionDirection.LONG}).
9561
+ *
9562
+ * @public
9563
+ * @returns {boolean}
9564
+ */
9565
+ get positive() {
9566
+ return this === long;
9567
+ }
9568
+
9569
+ /**
9570
+ * Indicates if the position size is negative (i.e. is {@link PositionDirection.SHORT}).
9571
+ *
9572
+ * @public
9573
+ * @returns {boolean}
9574
+ */
9575
+ get negative() {
9576
+ return this === short;
9577
+ }
9578
+
9579
+ /**
9580
+ * Indicates if the position size is zero (i.e. is {@link PositionDirection.EVEN}).
9581
+ *
9582
+ * @public
9583
+ * @returns {boolean}
9584
+ */
9585
+ get closed() {
9586
+ return this === even;
9587
+ }
9588
+
9589
+ /**
9590
+ * A positive quantity position.
9591
+ *
9592
+ * @public
9593
+ * @static
9594
+ * @returns {PositionDirection}
9595
+ */
9596
+ static get LONG() {
9597
+ return long;
9598
+ }
9599
+
9600
+ /**
9601
+ * A positive quantity position.
9602
+ *
9603
+ * @public
9604
+ * @static
9605
+ * @returns {PositionDirection}
9606
+ */
9607
+ static get SHORT() {
9608
+ return short;
9609
+ }
9610
+
9611
+ /**
9612
+ * A zero quantity position.
9613
+ *
9614
+ * @public
9615
+ * @static
9616
+ * @returns {PositionDirection}
9617
+ */
9618
+ static get EVEN() {
9619
+ return even;
9620
+ }
9621
+
9622
+ /**
9623
+ * Given an open quantity, returns a {@link PositionDirection} that
9624
+ * describes the quantity.
9625
+ *
9626
+ * @public
9627
+ * @static
9628
+ * @param {Decimal} open
9629
+ * @returns {PositionDirection}
9630
+ */
9631
+ static for(open) {
9632
+ assert.argumentIsRequired(open, 'open', Decimal, 'Decimal');
9633
+
9634
+ if (open.getIsPositive()) {
9635
+ return long;
9636
+ } else if (open.getIsNegative()) {
9637
+ return short;
9638
+ } else {
9639
+ return even;
9640
+ }
9641
+ }
9642
+ }
9643
+
9644
+ const long = new PositionDirection('LONG', 'Long', 'positive');
9645
+ const short = new PositionDirection('SHORT', 'Short', 'negative');
9646
+ const even = new PositionDirection('EVEN', 'Even', 'zero');
9647
+
9648
+ return PositionDirection;
9649
+ })();
9650
+
9651
+ },{"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],53:[function(require,module,exports){
9448
9652
  const array = require('@barchart/common-js/lang/array'),
9449
9653
  assert = require('@barchart/common-js/lang/assert'),
9450
9654
  Day = require('@barchart/common-js/lang/Day'),
@@ -9701,7 +9905,7 @@ module.exports = (() => {
9701
9905
  return PositionSummaryFrame;
9702
9906
  })();
9703
9907
 
9704
- },{"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/array":36,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40}],53:[function(require,module,exports){
9908
+ },{"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/array":36,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40}],54:[function(require,module,exports){
9705
9909
  const assert = require('@barchart/common-js/lang/assert'),
9706
9910
  Enum = require('@barchart/common-js/lang/Enum');
9707
9911
 
@@ -10041,7 +10245,7 @@ module.exports = (() => {
10041
10245
  return TransactionType;
10042
10246
  })();
10043
10247
 
10044
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],54:[function(require,module,exports){
10248
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
10045
10249
  const assert = require('@barchart/common-js/lang/assert'),
10046
10250
  Enum = require('@barchart/common-js/lang/Enum');
10047
10251
 
@@ -10103,7 +10307,7 @@ module.exports = (() => {
10103
10307
  return ValuationType;
10104
10308
  })();
10105
10309
 
10106
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
10310
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],56:[function(require,module,exports){
10107
10311
  const assert = require('@barchart/common-js/lang/assert'),
10108
10312
  Currency = require('@barchart/common-js/lang/Currency'),
10109
10313
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -10273,7 +10477,7 @@ module.exports = (() => {
10273
10477
  return PortfolioSchema;
10274
10478
  })();
10275
10479
 
10276
- },{"./../data/ValuationType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/Timezones":35,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],56:[function(require,module,exports){
10480
+ },{"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/Timezones":35,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],57:[function(require,module,exports){
10277
10481
  const assert = require('@barchart/common-js/lang/assert'),
10278
10482
  Currency = require('@barchart/common-js/lang/Currency'),
10279
10483
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -10283,6 +10487,7 @@ const assert = require('@barchart/common-js/lang/assert'),
10283
10487
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10284
10488
 
10285
10489
  const InstrumentType = require('./../data/InstrumentType'),
10490
+ PositionDirection = require('./../data/PositionDirection'),
10286
10491
  ValuationType = require('./../data/ValuationType');
10287
10492
 
10288
10493
  module.exports = (() => {
@@ -10355,6 +10560,7 @@ module.exports = (() => {
10355
10560
  .withField('reinvest', DataType.BOOLEAN)
10356
10561
  .withField('snapshot.date', DataType.DAY)
10357
10562
  .withField('snapshot.open', DataType.DECIMAL)
10563
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10358
10564
  .withField('snapshot.buys', DataType.DECIMAL)
10359
10565
  .withField('snapshot.sells', DataType.DECIMAL)
10360
10566
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10386,6 +10592,7 @@ module.exports = (() => {
10386
10592
  .withField('reinvest', DataType.BOOLEAN)
10387
10593
  .withField('snapshot.date', DataType.DAY)
10388
10594
  .withField('snapshot.open', DataType.DECIMAL)
10595
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10389
10596
  .withField('snapshot.buys', DataType.DECIMAL)
10390
10597
  .withField('snapshot.sells', DataType.DECIMAL)
10391
10598
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10399,7 +10606,7 @@ module.exports = (() => {
10399
10606
  return PositionSchema;
10400
10607
  })();
10401
10608
 
10402
- },{"./../data/InstrumentType":51,"./../data/ValuationType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],57:[function(require,module,exports){
10609
+ },{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],58:[function(require,module,exports){
10403
10610
  const assert = require('@barchart/common-js/lang/assert'),
10404
10611
  Currency = require('@barchart/common-js/lang/Currency'),
10405
10612
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -10408,7 +10615,8 @@ const assert = require('@barchart/common-js/lang/assert'),
10408
10615
  Schema = require('@barchart/common-js/serialization/json/Schema'),
10409
10616
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10410
10617
 
10411
- const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
10618
+ const PositionDirection = require('./../data/PositionDirection'),
10619
+ PositionSummaryFrame = require('./../data/PositionSummaryFrame');
10412
10620
 
10413
10621
  module.exports = (() => {
10414
10622
  'use strict';
@@ -10478,11 +10686,13 @@ module.exports = (() => {
10478
10686
  .withField('start.date', DataType.DAY)
10479
10687
  .withField('start.sequence', DataType.NUMBER)
10480
10688
  .withField('start.open', DataType.DECIMAL)
10689
+ .withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10481
10690
  .withField('start.basis', DataType.DECIMAL)
10482
10691
  .withField('start.value', DataType.DECIMAL)
10483
10692
  .withField('end.date', DataType.DAY)
10484
10693
  .withField('end.sequence', DataType.NUMBER)
10485
10694
  .withField('end.open', DataType.DECIMAL)
10695
+ .withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10486
10696
  .withField('end.basis', DataType.DECIMAL)
10487
10697
  .withField('end.value', DataType.DECIMAL)
10488
10698
  .withField('period.buys', DataType.DECIMAL)
@@ -10510,11 +10720,13 @@ module.exports = (() => {
10510
10720
  .withField('start.date', DataType.DAY)
10511
10721
  .withField('start.sequence', DataType.NUMBER)
10512
10722
  .withField('start.open', DataType.DECIMAL)
10723
+ .withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10513
10724
  .withField('start.basis', DataType.DECIMAL)
10514
10725
  .withField('start.value', DataType.DECIMAL)
10515
10726
  .withField('end.date', DataType.DAY)
10516
10727
  .withField('end.sequence', DataType.NUMBER)
10517
10728
  .withField('end.open', DataType.DECIMAL)
10729
+ .withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10518
10730
  .withField('end.basis', DataType.DECIMAL)
10519
10731
  .withField('end.value', DataType.DECIMAL)
10520
10732
  .withField('period.buys', DataType.DECIMAL)
@@ -10528,7 +10740,7 @@ module.exports = (() => {
10528
10740
  return PositionSummarySchema;
10529
10741
  })();
10530
10742
 
10531
- },{"./../data/PositionSummaryFrame":52,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],58:[function(require,module,exports){
10743
+ },{"./../data/PositionDirection":52,"./../data/PositionSummaryFrame":53,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],59:[function(require,module,exports){
10532
10744
  const assert = require('@barchart/common-js/lang/assert'),
10533
10745
  is = require('@barchart/common-js/lang/is'),
10534
10746
  Currency = require('@barchart/common-js/lang/Currency'),
@@ -10538,6 +10750,7 @@ const assert = require('@barchart/common-js/lang/assert'),
10538
10750
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10539
10751
 
10540
10752
  const InstrumentType = require('./../data/InstrumentType'),
10753
+ PositionDirection = require('./../data/PositionDirection'),
10541
10754
  TransactionType = require('./../data/TransactionType');
10542
10755
 
10543
10756
  module.exports = (() => {
@@ -10707,6 +10920,7 @@ module.exports = (() => {
10707
10920
  .withField('reference.position', DataType.STRING, true)
10708
10921
  .withField('reference.sequence', DataType.NUMBER, true)
10709
10922
  .withField('snapshot.open', DataType.DECIMAL)
10923
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10710
10924
  .withField('snapshot.buys', DataType.DECIMAL)
10711
10925
  .withField('snapshot.sells', DataType.DECIMAL)
10712
10926
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10750,6 +10964,7 @@ module.exports = (() => {
10750
10964
  .withField('reference.position', DataType.STRING, true)
10751
10965
  .withField('reference.sequence', DataType.NUMBER, true)
10752
10966
  .withField('snapshot.open', DataType.DECIMAL)
10967
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10753
10968
  .withField('snapshot.buys', DataType.DECIMAL)
10754
10969
  .withField('snapshot.sells', DataType.DECIMAL)
10755
10970
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10979,7 +11194,6 @@ module.exports = (() => {
10979
11194
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10980
11195
  .withField('date', DataType.DAY)
10981
11196
  .withField('value', DataType.DECIMAL)
10982
- .withField('fee', DataType.DECIMAL, true)
10983
11197
  .withField('force', DataType.BOOLEAN, true)
10984
11198
  .schema
10985
11199
  );
@@ -11019,7 +11233,7 @@ module.exports = (() => {
11019
11233
  return TransactionSchema;
11020
11234
  })();
11021
11235
 
11022
- },{"./../data/InstrumentType":51,"./../data/TransactionType":53,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],59:[function(require,module,exports){
11236
+ },{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/TransactionType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],60:[function(require,module,exports){
11023
11237
  'use strict';
11024
11238
 
11025
11239
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -11057,26 +11271,27 @@ module.exports = function () {
11057
11271
  * Web service gateway for obtaining JWT tokens from TGAM (The Globe and Mail).
11058
11272
  *
11059
11273
  * @public
11060
- * @param {Enpoint} endpoint
11274
+ * @param {Enpoint=} endpoint
11061
11275
  * @param {Number=} refreshInterval - Interval, in milliseconds, which a token refresh should occur. If zero, the token does not need to be refreshed.
11276
+ * @param {Function=} overrideDelegate - Bypasses the standard token lookup, instead calls a delegate, which returns the token.
11062
11277
  * @extends {Disposable}
11063
11278
  */
11064
11279
 
11065
11280
  var JwtGateway = function (_Disposable) {
11066
11281
  _inherits(JwtGateway, _Disposable);
11067
11282
 
11068
- function JwtGateway(endpoint, refreshInterval) {
11283
+ function JwtGateway(tokenDelegate, refreshInterval) {
11069
11284
  _classCallCheck(this, JwtGateway);
11070
11285
 
11071
11286
  var _this = _possibleConstructorReturn(this, (JwtGateway.__proto__ || Object.getPrototypeOf(JwtGateway)).call(this));
11072
11287
 
11073
- assert.argumentIsRequired(endpoint, 'endpoint', Endpoint, 'Endpoint');
11288
+ assert.argumentIsRequired(tokenDelegate, 'tokenDelegate', Function);
11074
11289
  assert.argumentIsOptional(refreshInterval, 'refreshInterval', Number);
11075
11290
 
11076
11291
  _this._started = false;
11077
11292
  _this._startPromise = null;
11078
11293
 
11079
- _this._endpoint = endpoint;
11294
+ _this._tokenDelegate = tokenDelegate;
11080
11295
 
11081
11296
  _this._refreshInterval = refreshInterval || 0;
11082
11297
  _this._refreshJitter = Math.floor(_this._refreshInterval / 10);
@@ -11129,7 +11344,7 @@ module.exports = function () {
11129
11344
  return Promise.resolve().then(function () {
11130
11345
  checkStart.call(_this3);
11131
11346
 
11132
- return Gateway.invoke(_this3._endpoint);
11347
+ return _this3._tokenDelegate();
11133
11348
  }).catch(function (e) {
11134
11349
  var failure = FailureReason.forRequest({ endpoint: _this3._endpoint }).addItem(FailureType.REQUEST_IDENTITY_FAILURE).format();
11135
11350
 
@@ -11244,7 +11459,9 @@ module.exports = function () {
11244
11459
  key: 'forDevelopment',
11245
11460
  value: function forDevelopment(endpoint) {
11246
11461
  return Promise.resolve(endpoint).then(function (e) {
11247
- return start(new JwtGateway(e, 60000));
11462
+ return start(new JwtGateway(function () {
11463
+ return Gateway.invoke(e);
11464
+ }, 60000));
11248
11465
  });
11249
11466
  }
11250
11467
 
@@ -11253,7 +11470,7 @@ module.exports = function () {
11253
11470
  *
11254
11471
  * @public
11255
11472
  * @static
11256
- * @param {Promise.<Endpoint>|Endpoint}endpoint - The endpoint which vends JWT tokens.
11473
+ * @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
11257
11474
  * @returns {Promise.<RequestInterceptor>}
11258
11475
  */
11259
11476
 
@@ -11324,6 +11541,40 @@ module.exports = function () {
11324
11541
  return jwtGateway.toRequestInterceptor();
11325
11542
  });
11326
11543
  }
11544
+
11545
+ /**
11546
+ * Creates and starts a new {@link JwtGateway} for use by the "tracker" system.
11547
+ *
11548
+ * @public
11549
+ * @static
11550
+ * @param {Function} tokenDelegate - A function which returns the JWT token.
11551
+ * @returns {Promise.<JwtGateway>}
11552
+ */
11553
+
11554
+ }, {
11555
+ key: 'forTracker',
11556
+ value: function forTracker(tokenDelegate) {
11557
+ return Promise.resolve().then(function () {
11558
+ return start(new JwtGateway(tokenDelegate, 0));
11559
+ });
11560
+ }
11561
+
11562
+ /**
11563
+ * Creates and starts a new {@link RequestInterceptor} for use by "tracker" system.
11564
+ *
11565
+ * @public
11566
+ * @static
11567
+ * @param {Function} tokenDelegate - A function which returns the JWT token.
11568
+ * @returns {Promise.<RequestInterceptor>}
11569
+ */
11570
+
11571
+ }, {
11572
+ key: 'forTrackerClient',
11573
+ value: function forTrackerClient(tokenDelegate) {
11574
+ return JwtGateway.forTracker(tokenDelegate).then(function (jwtGateway) {
11575
+ return jwtGateway.toRequestInterceptor();
11576
+ });
11577
+ }
11327
11578
  }]);
11328
11579
 
11329
11580
  return JwtGateway;
@@ -11354,7 +11605,7 @@ module.exports = function () {
11354
11605
  }
11355
11606
 
11356
11607
  function forTgam(host, secret, environment) {
11357
- return EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11608
+ var endpoint = EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11358
11609
  return hb.withLiteralParameter('X-GAM-CLIENT-APP-ID', 'X-GAM-CLIENT-APP-ID', '1348').withLiteralParameter('X-GAM-CLIENT-APP-SECRET', 'X-GAM-CLIENT-APP-SECRET', secret);
11359
11610
  }).withHost(host).withRequestInterceptor(RequestInterceptor.fromDelegate(function (request) {
11360
11611
  request.withCredentials = true;
@@ -11363,6 +11614,10 @@ module.exports = function () {
11363
11614
  })).withResponseInterceptor(ResponseInterceptor.DATA).withResponseInterceptor(ResponseInterceptor.fromDelegate(function (response) {
11364
11615
  return response.token;
11365
11616
  })).endpoint;
11617
+
11618
+ return function () {
11619
+ return Gateway.invoke(endpoint);
11620
+ };
11366
11621
  }
11367
11622
 
11368
11623
  function getTime() {
@@ -11372,7 +11627,7 @@ module.exports = function () {
11372
11627
  return JwtGateway;
11373
11628
  }();
11374
11629
 
11375
- },{"./index":60,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/timing/Scheduler":50}],60:[function(require,module,exports){
11630
+ },{"./index":61,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/timing/Scheduler":50}],61:[function(require,module,exports){
11376
11631
  'use strict';
11377
11632
 
11378
11633
  var JwtGateway = require('./JwtGateway');
@@ -11382,13 +11637,13 @@ module.exports = function () {
11382
11637
 
11383
11638
  return {
11384
11639
  JwtGateway: JwtGateway,
11385
- version: '1.0.38'
11640
+ version: '1.0.39'
11386
11641
  };
11387
11642
  }();
11388
11643
 
11389
- },{"./JwtGateway":59}],61:[function(require,module,exports){
11644
+ },{"./JwtGateway":60}],62:[function(require,module,exports){
11390
11645
  module.exports = require('./lib/axios');
11391
- },{"./lib/axios":63}],62:[function(require,module,exports){
11646
+ },{"./lib/axios":64}],63:[function(require,module,exports){
11392
11647
  (function (process){
11393
11648
  'use strict';
11394
11649
 
@@ -11572,7 +11827,7 @@ module.exports = function xhrAdapter(config) {
11572
11827
  };
11573
11828
 
11574
11829
  }).call(this,require('_process'))
11575
- },{"../core/createError":69,"./../core/settle":72,"./../helpers/btoa":76,"./../helpers/buildURL":77,"./../helpers/cookies":79,"./../helpers/isURLSameOrigin":81,"./../helpers/parseHeaders":83,"./../utils":85,"_process":87}],63:[function(require,module,exports){
11830
+ },{"../core/createError":70,"./../core/settle":73,"./../helpers/btoa":77,"./../helpers/buildURL":78,"./../helpers/cookies":80,"./../helpers/isURLSameOrigin":82,"./../helpers/parseHeaders":84,"./../utils":86,"_process":88}],64:[function(require,module,exports){
11576
11831
  'use strict';
11577
11832
 
11578
11833
  var utils = require('./utils');
@@ -11626,7 +11881,7 @@ module.exports = axios;
11626
11881
  // Allow use of default import syntax in TypeScript
11627
11882
  module.exports.default = axios;
11628
11883
 
11629
- },{"./cancel/Cancel":64,"./cancel/CancelToken":65,"./cancel/isCancel":66,"./core/Axios":67,"./defaults":74,"./helpers/bind":75,"./helpers/spread":84,"./utils":85}],64:[function(require,module,exports){
11884
+ },{"./cancel/Cancel":65,"./cancel/CancelToken":66,"./cancel/isCancel":67,"./core/Axios":68,"./defaults":75,"./helpers/bind":76,"./helpers/spread":85,"./utils":86}],65:[function(require,module,exports){
11630
11885
  'use strict';
11631
11886
 
11632
11887
  /**
@@ -11647,7 +11902,7 @@ Cancel.prototype.__CANCEL__ = true;
11647
11902
 
11648
11903
  module.exports = Cancel;
11649
11904
 
11650
- },{}],65:[function(require,module,exports){
11905
+ },{}],66:[function(require,module,exports){
11651
11906
  'use strict';
11652
11907
 
11653
11908
  var Cancel = require('./Cancel');
@@ -11706,14 +11961,14 @@ CancelToken.source = function source() {
11706
11961
 
11707
11962
  module.exports = CancelToken;
11708
11963
 
11709
- },{"./Cancel":64}],66:[function(require,module,exports){
11964
+ },{"./Cancel":65}],67:[function(require,module,exports){
11710
11965
  'use strict';
11711
11966
 
11712
11967
  module.exports = function isCancel(value) {
11713
11968
  return !!(value && value.__CANCEL__);
11714
11969
  };
11715
11970
 
11716
- },{}],67:[function(require,module,exports){
11971
+ },{}],68:[function(require,module,exports){
11717
11972
  'use strict';
11718
11973
 
11719
11974
  var defaults = require('./../defaults');
@@ -11794,7 +12049,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11794
12049
 
11795
12050
  module.exports = Axios;
11796
12051
 
11797
- },{"./../defaults":74,"./../utils":85,"./InterceptorManager":68,"./dispatchRequest":70}],68:[function(require,module,exports){
12052
+ },{"./../defaults":75,"./../utils":86,"./InterceptorManager":69,"./dispatchRequest":71}],69:[function(require,module,exports){
11798
12053
  'use strict';
11799
12054
 
11800
12055
  var utils = require('./../utils');
@@ -11848,7 +12103,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
11848
12103
 
11849
12104
  module.exports = InterceptorManager;
11850
12105
 
11851
- },{"./../utils":85}],69:[function(require,module,exports){
12106
+ },{"./../utils":86}],70:[function(require,module,exports){
11852
12107
  'use strict';
11853
12108
 
11854
12109
  var enhanceError = require('./enhanceError');
@@ -11868,7 +12123,7 @@ module.exports = function createError(message, config, code, request, response)
11868
12123
  return enhanceError(error, config, code, request, response);
11869
12124
  };
11870
12125
 
11871
- },{"./enhanceError":71}],70:[function(require,module,exports){
12126
+ },{"./enhanceError":72}],71:[function(require,module,exports){
11872
12127
  'use strict';
11873
12128
 
11874
12129
  var utils = require('./../utils');
@@ -11956,7 +12211,7 @@ module.exports = function dispatchRequest(config) {
11956
12211
  });
11957
12212
  };
11958
12213
 
11959
- },{"../cancel/isCancel":66,"../defaults":74,"./../helpers/combineURLs":78,"./../helpers/isAbsoluteURL":80,"./../utils":85,"./transformData":73}],71:[function(require,module,exports){
12214
+ },{"../cancel/isCancel":67,"../defaults":75,"./../helpers/combineURLs":79,"./../helpers/isAbsoluteURL":81,"./../utils":86,"./transformData":74}],72:[function(require,module,exports){
11960
12215
  'use strict';
11961
12216
 
11962
12217
  /**
@@ -11979,7 +12234,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
11979
12234
  return error;
11980
12235
  };
11981
12236
 
11982
- },{}],72:[function(require,module,exports){
12237
+ },{}],73:[function(require,module,exports){
11983
12238
  'use strict';
11984
12239
 
11985
12240
  var createError = require('./createError');
@@ -12007,7 +12262,7 @@ module.exports = function settle(resolve, reject, response) {
12007
12262
  }
12008
12263
  };
12009
12264
 
12010
- },{"./createError":69}],73:[function(require,module,exports){
12265
+ },{"./createError":70}],74:[function(require,module,exports){
12011
12266
  'use strict';
12012
12267
 
12013
12268
  var utils = require('./../utils');
@@ -12029,7 +12284,7 @@ module.exports = function transformData(data, headers, fns) {
12029
12284
  return data;
12030
12285
  };
12031
12286
 
12032
- },{"./../utils":85}],74:[function(require,module,exports){
12287
+ },{"./../utils":86}],75:[function(require,module,exports){
12033
12288
  (function (process){
12034
12289
  'use strict';
12035
12290
 
@@ -12125,7 +12380,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
12125
12380
  module.exports = defaults;
12126
12381
 
12127
12382
  }).call(this,require('_process'))
12128
- },{"./adapters/http":62,"./adapters/xhr":62,"./helpers/normalizeHeaderName":82,"./utils":85,"_process":87}],75:[function(require,module,exports){
12383
+ },{"./adapters/http":63,"./adapters/xhr":63,"./helpers/normalizeHeaderName":83,"./utils":86,"_process":88}],76:[function(require,module,exports){
12129
12384
  'use strict';
12130
12385
 
12131
12386
  module.exports = function bind(fn, thisArg) {
@@ -12138,7 +12393,7 @@ module.exports = function bind(fn, thisArg) {
12138
12393
  };
12139
12394
  };
12140
12395
 
12141
- },{}],76:[function(require,module,exports){
12396
+ },{}],77:[function(require,module,exports){
12142
12397
  'use strict';
12143
12398
 
12144
12399
  // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
@@ -12176,7 +12431,7 @@ function btoa(input) {
12176
12431
 
12177
12432
  module.exports = btoa;
12178
12433
 
12179
- },{}],77:[function(require,module,exports){
12434
+ },{}],78:[function(require,module,exports){
12180
12435
  'use strict';
12181
12436
 
12182
12437
  var utils = require('./../utils');
@@ -12246,7 +12501,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
12246
12501
  return url;
12247
12502
  };
12248
12503
 
12249
- },{"./../utils":85}],78:[function(require,module,exports){
12504
+ },{"./../utils":86}],79:[function(require,module,exports){
12250
12505
  'use strict';
12251
12506
 
12252
12507
  /**
@@ -12262,7 +12517,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
12262
12517
  : baseURL;
12263
12518
  };
12264
12519
 
12265
- },{}],79:[function(require,module,exports){
12520
+ },{}],80:[function(require,module,exports){
12266
12521
  'use strict';
12267
12522
 
12268
12523
  var utils = require('./../utils');
@@ -12317,7 +12572,7 @@ module.exports = (
12317
12572
  })()
12318
12573
  );
12319
12574
 
12320
- },{"./../utils":85}],80:[function(require,module,exports){
12575
+ },{"./../utils":86}],81:[function(require,module,exports){
12321
12576
  'use strict';
12322
12577
 
12323
12578
  /**
@@ -12333,7 +12588,7 @@ module.exports = function isAbsoluteURL(url) {
12333
12588
  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
12334
12589
  };
12335
12590
 
12336
- },{}],81:[function(require,module,exports){
12591
+ },{}],82:[function(require,module,exports){
12337
12592
  'use strict';
12338
12593
 
12339
12594
  var utils = require('./../utils');
@@ -12403,7 +12658,7 @@ module.exports = (
12403
12658
  })()
12404
12659
  );
12405
12660
 
12406
- },{"./../utils":85}],82:[function(require,module,exports){
12661
+ },{"./../utils":86}],83:[function(require,module,exports){
12407
12662
  'use strict';
12408
12663
 
12409
12664
  var utils = require('../utils');
@@ -12417,7 +12672,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
12417
12672
  });
12418
12673
  };
12419
12674
 
12420
- },{"../utils":85}],83:[function(require,module,exports){
12675
+ },{"../utils":86}],84:[function(require,module,exports){
12421
12676
  'use strict';
12422
12677
 
12423
12678
  var utils = require('./../utils');
@@ -12472,7 +12727,7 @@ module.exports = function parseHeaders(headers) {
12472
12727
  return parsed;
12473
12728
  };
12474
12729
 
12475
- },{"./../utils":85}],84:[function(require,module,exports){
12730
+ },{"./../utils":86}],85:[function(require,module,exports){
12476
12731
  'use strict';
12477
12732
 
12478
12733
  /**
@@ -12501,7 +12756,7 @@ module.exports = function spread(callback) {
12501
12756
  };
12502
12757
  };
12503
12758
 
12504
- },{}],85:[function(require,module,exports){
12759
+ },{}],86:[function(require,module,exports){
12505
12760
  'use strict';
12506
12761
 
12507
12762
  var bind = require('./helpers/bind');
@@ -12806,7 +13061,7 @@ module.exports = {
12806
13061
  trim: trim
12807
13062
  };
12808
13063
 
12809
- },{"./helpers/bind":75,"is-buffer":88}],86:[function(require,module,exports){
13064
+ },{"./helpers/bind":76,"is-buffer":89}],87:[function(require,module,exports){
12810
13065
  /*
12811
13066
  * big.js v5.0.3
12812
13067
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -13747,7 +14002,7 @@ module.exports = {
13747
14002
  }
13748
14003
  })(this);
13749
14004
 
13750
- },{}],87:[function(require,module,exports){
14005
+ },{}],88:[function(require,module,exports){
13751
14006
  // shim for using process in browser
13752
14007
  var process = module.exports = {};
13753
14008
 
@@ -13933,7 +14188,7 @@ process.chdir = function (dir) {
13933
14188
  };
13934
14189
  process.umask = function() { return 0; };
13935
14190
 
13936
- },{}],88:[function(require,module,exports){
14191
+ },{}],89:[function(require,module,exports){
13937
14192
  /*!
13938
14193
  * Determine if an object is a Buffer
13939
14194
  *
@@ -13956,7 +14211,7 @@ function isSlowBuffer (obj) {
13956
14211
  return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
13957
14212
  }
13958
14213
 
13959
- },{}],89:[function(require,module,exports){
14214
+ },{}],90:[function(require,module,exports){
13960
14215
  //! moment-timezone.js
13961
14216
  //! version : 0.5.11
13962
14217
  //! Copyright (c) JS Foundation and other contributors
@@ -15158,7 +15413,7 @@ function isSlowBuffer (obj) {
15158
15413
  return moment;
15159
15414
  }));
15160
15415
 
15161
- },{"moment":93}],90:[function(require,module,exports){
15416
+ },{"moment":94}],91:[function(require,module,exports){
15162
15417
  module.exports={
15163
15418
  "version": "2016j",
15164
15419
  "zones": [
@@ -15758,11 +16013,11 @@ module.exports={
15758
16013
  "Pacific/Pohnpei|Pacific/Ponape"
15759
16014
  ]
15760
16015
  }
15761
- },{}],91:[function(require,module,exports){
16016
+ },{}],92:[function(require,module,exports){
15762
16017
  var moment = module.exports = require("./moment-timezone");
15763
16018
  moment.tz.load(require('./data/packed/latest.json'));
15764
16019
 
15765
- },{"./data/packed/latest.json":90,"./moment-timezone":92}],92:[function(require,module,exports){
16020
+ },{"./data/packed/latest.json":91,"./moment-timezone":93}],93:[function(require,module,exports){
15766
16021
  //! moment-timezone.js
15767
16022
  //! version : 0.5.11
15768
16023
  //! Copyright (c) JS Foundation and other contributors
@@ -16365,7 +16620,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16365
16620
  return moment;
16366
16621
  }));
16367
16622
 
16368
- },{"moment":93}],93:[function(require,module,exports){
16623
+ },{"moment":94}],94:[function(require,module,exports){
16369
16624
  //! moment.js
16370
16625
 
16371
16626
  ;(function (global, factory) {
@@ -20027,7 +20282,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20027
20282
 
20028
20283
  addUnitAlias('date', 'D');
20029
20284
 
20030
- // PRIOROITY
20285
+ // PRIORITY
20031
20286
  addUnitPriority('date', 9);
20032
20287
 
20033
20288
  // PARSING
@@ -20824,7 +21079,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20824
21079
  // Side effect imports
20825
21080
 
20826
21081
 
20827
- hooks.version = '2.22.0';
21082
+ hooks.version = '2.22.1';
20828
21083
 
20829
21084
  setHookCallback(createLocal);
20830
21085
 
@@ -20873,5 +21128,210 @@ moment.tz.load(require('./data/packed/latest.json'));
20873
21128
 
20874
21129
  })));
20875
21130
 
20876
- },{}]},{},[1,5])(5)
21131
+ },{}],95:[function(require,module,exports){
21132
+ var v1 = require('./v1');
21133
+ var v4 = require('./v4');
21134
+
21135
+ var uuid = v4;
21136
+ uuid.v1 = v1;
21137
+ uuid.v4 = v4;
21138
+
21139
+ module.exports = uuid;
21140
+
21141
+ },{"./v1":98,"./v4":99}],96:[function(require,module,exports){
21142
+ /**
21143
+ * Convert array of 16 byte values to UUID string format of the form:
21144
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
21145
+ */
21146
+ var byteToHex = [];
21147
+ for (var i = 0; i < 256; ++i) {
21148
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
21149
+ }
21150
+
21151
+ function bytesToUuid(buf, offset) {
21152
+ var i = offset || 0;
21153
+ var bth = byteToHex;
21154
+ return bth[buf[i++]] + bth[buf[i++]] +
21155
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21156
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21157
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21158
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21159
+ bth[buf[i++]] + bth[buf[i++]] +
21160
+ bth[buf[i++]] + bth[buf[i++]] +
21161
+ bth[buf[i++]] + bth[buf[i++]];
21162
+ }
21163
+
21164
+ module.exports = bytesToUuid;
21165
+
21166
+ },{}],97:[function(require,module,exports){
21167
+ (function (global){
21168
+ // Unique ID creation requires a high quality random # generator. In the
21169
+ // browser this is a little complicated due to unknown quality of Math.random()
21170
+ // and inconsistent support for the `crypto` API. We do the best we can via
21171
+ // feature-detection
21172
+ var rng;
21173
+
21174
+ var crypto = global.crypto || global.msCrypto; // for IE 11
21175
+ if (crypto && crypto.getRandomValues) {
21176
+ // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
21177
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
21178
+ rng = function whatwgRNG() {
21179
+ crypto.getRandomValues(rnds8);
21180
+ return rnds8;
21181
+ };
21182
+ }
21183
+
21184
+ if (!rng) {
21185
+ // Math.random()-based (RNG)
21186
+ //
21187
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
21188
+ // quality.
21189
+ var rnds = new Array(16);
21190
+ rng = function() {
21191
+ for (var i = 0, r; i < 16; i++) {
21192
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
21193
+ rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
21194
+ }
21195
+
21196
+ return rnds;
21197
+ };
21198
+ }
21199
+
21200
+ module.exports = rng;
21201
+
21202
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21203
+ },{}],98:[function(require,module,exports){
21204
+ var rng = require('./lib/rng');
21205
+ var bytesToUuid = require('./lib/bytesToUuid');
21206
+
21207
+ // **`v1()` - Generate time-based UUID**
21208
+ //
21209
+ // Inspired by https://github.com/LiosK/UUID.js
21210
+ // and http://docs.python.org/library/uuid.html
21211
+
21212
+ // random #'s we need to init node and clockseq
21213
+ var _seedBytes = rng();
21214
+
21215
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
21216
+ var _nodeId = [
21217
+ _seedBytes[0] | 0x01,
21218
+ _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
21219
+ ];
21220
+
21221
+ // Per 4.2.2, randomize (14 bit) clockseq
21222
+ var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
21223
+
21224
+ // Previous uuid creation time
21225
+ var _lastMSecs = 0, _lastNSecs = 0;
21226
+
21227
+ // See https://github.com/broofa/node-uuid for API details
21228
+ function v1(options, buf, offset) {
21229
+ var i = buf && offset || 0;
21230
+ var b = buf || [];
21231
+
21232
+ options = options || {};
21233
+
21234
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
21235
+
21236
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
21237
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
21238
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
21239
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
21240
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
21241
+
21242
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
21243
+ // cycle to simulate higher resolution clock
21244
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
21245
+
21246
+ // Time since last uuid creation (in msecs)
21247
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
21248
+
21249
+ // Per 4.2.1.2, Bump clockseq on clock regression
21250
+ if (dt < 0 && options.clockseq === undefined) {
21251
+ clockseq = clockseq + 1 & 0x3fff;
21252
+ }
21253
+
21254
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
21255
+ // time interval
21256
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
21257
+ nsecs = 0;
21258
+ }
21259
+
21260
+ // Per 4.2.1.2 Throw error if too many uuids are requested
21261
+ if (nsecs >= 10000) {
21262
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
21263
+ }
21264
+
21265
+ _lastMSecs = msecs;
21266
+ _lastNSecs = nsecs;
21267
+ _clockseq = clockseq;
21268
+
21269
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
21270
+ msecs += 12219292800000;
21271
+
21272
+ // `time_low`
21273
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
21274
+ b[i++] = tl >>> 24 & 0xff;
21275
+ b[i++] = tl >>> 16 & 0xff;
21276
+ b[i++] = tl >>> 8 & 0xff;
21277
+ b[i++] = tl & 0xff;
21278
+
21279
+ // `time_mid`
21280
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
21281
+ b[i++] = tmh >>> 8 & 0xff;
21282
+ b[i++] = tmh & 0xff;
21283
+
21284
+ // `time_high_and_version`
21285
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
21286
+ b[i++] = tmh >>> 16 & 0xff;
21287
+
21288
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
21289
+ b[i++] = clockseq >>> 8 | 0x80;
21290
+
21291
+ // `clock_seq_low`
21292
+ b[i++] = clockseq & 0xff;
21293
+
21294
+ // `node`
21295
+ var node = options.node || _nodeId;
21296
+ for (var n = 0; n < 6; ++n) {
21297
+ b[i + n] = node[n];
21298
+ }
21299
+
21300
+ return buf ? buf : bytesToUuid(b);
21301
+ }
21302
+
21303
+ module.exports = v1;
21304
+
21305
+ },{"./lib/bytesToUuid":96,"./lib/rng":97}],99:[function(require,module,exports){
21306
+ var rng = require('./lib/rng');
21307
+ var bytesToUuid = require('./lib/bytesToUuid');
21308
+
21309
+ function v4(options, buf, offset) {
21310
+ var i = buf && offset || 0;
21311
+
21312
+ if (typeof(options) == 'string') {
21313
+ buf = options == 'binary' ? new Array(16) : null;
21314
+ options = null;
21315
+ }
21316
+ options = options || {};
21317
+
21318
+ var rnds = options.random || (options.rng || rng)();
21319
+
21320
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
21321
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
21322
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
21323
+
21324
+ // Copy bytes to buffer, if provided
21325
+ if (buf) {
21326
+ for (var ii = 0; ii < 16; ++ii) {
21327
+ buf[i + ii] = rnds[ii];
21328
+ }
21329
+ }
21330
+
21331
+ return buf || bytesToUuid(rnds);
21332
+ }
21333
+
21334
+ module.exports = v4;
21335
+
21336
+ },{"./lib/bytesToUuid":96,"./lib/rng":97}]},{},[1,5])(5)
20877
21337
  });
@@ -714,13 +714,13 @@ module.exports = (() => {
714
714
 
715
715
  const updatePositionRequestInterceptor = (request) => {
716
716
  return FailureReason.validateSchema(PositionSchema.UPDATE, request.data)
717
- .then(() => {
718
- return Promise.resolve(request);
719
- }).catch((e) => {
720
- console.error('Error serializing data to update a position', e);
717
+ .then(() => {
718
+ return Promise.resolve(request);
719
+ }).catch((e) => {
720
+ console.error('Error serializing data to update a position', e);
721
721
 
722
- return Promise.reject();
723
- });
722
+ return Promise.reject();
723
+ });
724
724
  };
725
725
 
726
726
  const responseInterceptorForPortfolioDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
@@ -757,13 +757,16 @@ module.exports = (() => {
757
757
 
758
758
  const responseInterceptorForTransactionMutateDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
759
759
  try {
760
- const positions = response.data.positions.map(p => JSON.parse(p, PositionSchema.CLIENT.schema.getReviver()));
760
+ const saved = response.data.positions.saved.map(p => JSON.parse(p, PositionSchema.CLIENT.schema.getReviver()));
761
+ const deleted = response.data.positions.deleted.map(p => JSON.parse(p, PositionSchema.CLIENT.schema.getReviver()));
761
762
  const summaries = response.data.summaries.map(s => JSON.parse(s, PositionSummarySchema.CLIENT.schema.getReviver()));
762
763
 
763
764
  const returnRef = {
764
- positions: positions,
765
- summaries: summaries,
766
- replaced: response.data.replaced
765
+ positions: {
766
+ saved: saved,
767
+ deleted: deleted
768
+ },
769
+ summaries: summaries
767
770
  };
768
771
 
769
772
  if (response.data.transactions) {
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtGateway: JwtGateway,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '1.1.51'
10
+ version: '1.2.1'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.1.51",
3
+ "version": "1.2.1",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",