@barchart/portfolio-client-js 1.2.2 → 1.2.5

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":54,"@barchart/portfolio-api-common/lib/data/ValuationType":55,"@barchart/tgam-jwt-js/lib/JwtGateway":60}],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":53,"@barchart/portfolio-api-common/lib/data/ValuationType":54,"@barchart/tgam-jwt-js/lib/JwtGateway":59}],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; }; }();
@@ -215,11 +215,11 @@ module.exports = function () {
215
215
 
216
216
  _this._updatePositionEndpoint = EndpointBuilder.for('update-position', 'update position').withVerb(VerbType.PUT).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
217
217
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
218
- }).withBody('portfolio').withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(RequestInterceptor.fromDelegate(updatePositionRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
218
+ }).withBody('portfolio').withRequestInterceptor(RequestInterceptor.fromDelegate(updatePositionRequestInterceptor)).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
219
219
 
220
220
  _this._deletePositionEndpoint = EndpointBuilder.for('delete-position', 'delete position').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
221
221
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
222
- }).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
222
+ }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
223
223
 
224
224
  _this._readPositionSummariesEndpoint = EndpointBuilder.for('read-position-summaries', 'read position summaries').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
225
225
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withVariableParameter('position', 'position', 'position', false);
@@ -245,13 +245,21 @@ module.exports = function () {
245
245
  qb.withVariableParameter('type', 'type', 'type', false, function (i) {
246
246
  return i.code;
247
247
  });
248
- }).withBody('portfolio data').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
248
+ }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
249
+
250
+ _this._editTransactionEndpoint = EndpointBuilder.for('edit-transaction', 'edit transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
251
+ pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
252
+ }).withQueryBuilder(function (qb) {
253
+ qb.withVariableParameter('type', 'type', 'type', false, function (i) {
254
+ return i.code;
255
+ });
256
+ }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
249
257
 
250
258
  _this._deleteTransactionEndpoint = EndpointBuilder.for('delete-transaction', 'delete transaction').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
251
259
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('sequence', 'sequence', 'sequence', false);
252
260
  }).withQueryBuilder(function (qb) {
253
261
  qb.withVariableParameter('force', 'force', 'force', false).withVariableParameter('echo', 'echo', 'echo', false);
254
- }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
262
+ }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
255
263
 
256
264
  _this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
257
265
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
@@ -575,13 +583,52 @@ module.exports = function () {
575
583
  });
576
584
  }
577
585
 
586
+ /**
587
+ * Edits a transaction.
588
+ *
589
+ * @public
590
+ * @param {Object} transaction
591
+ * @returns {Promise.<TransactionMutateResult>}
592
+ */
593
+
594
+ }, {
595
+ key: 'editTransaction',
596
+ value: function editTransaction(transaction) {
597
+ var _this12 = this;
598
+
599
+ return Promise.resolve().then(function () {
600
+ checkStart.call(_this12);
601
+
602
+ assert.argumentIsRequired(transaction, 'transaction', Object);
603
+ assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
604
+ assert.argumentIsRequired(transaction.position, 'transaction.position', String);
605
+ assert.argumentIsRequired(transaction.sequence, 'transaction.sequence', String);
606
+
607
+ var code = void 0;
608
+
609
+ if (is.string(transaction.type)) {
610
+ assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
611
+
612
+ code = transaction.type;
613
+ } else {
614
+ assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
615
+
616
+ code = transaction.type.code;
617
+ }
618
+
619
+ var schema = TransactionSchema.forCreate(Enum.fromCode(TransactionType, code));
620
+
621
+ return Gateway.invoke(_this12._editTransactionEndpoint, schema.schema.format(transaction));
622
+ });
623
+ }
624
+
578
625
  /**
579
626
  * Deletes a transaction.
580
627
  *
581
628
  * @public
582
629
  * @param {String} portfolio
583
630
  * @param {String} position
584
- * @param {Number} transaction
631
+ * @param {Number} sequence
585
632
  * @param {Boolean=} force
586
633
  * @param {Boolean=} echo
587
634
  * @returns {Promise.<TransactionMutateResult>}
@@ -590,10 +637,10 @@ module.exports = function () {
590
637
  }, {
591
638
  key: 'deleteTransaction',
592
639
  value: function deleteTransaction(portfolio, position, sequence, force, echo) {
593
- var _this12 = this;
640
+ var _this13 = this;
594
641
 
595
642
  return Promise.resolve().then(function () {
596
- checkStart.call(_this12);
643
+ checkStart.call(_this13);
597
644
 
598
645
  assert.argumentIsRequired(portfolio, 'portfolio', String);
599
646
  assert.argumentIsRequired(position, 'position', String);
@@ -601,7 +648,7 @@ module.exports = function () {
601
648
  assert.argumentIsOptional(force, 'force', Boolean);
602
649
  assert.argumentIsOptional(echo, 'echo', Boolean);
603
650
 
604
- return Gateway.invoke(_this12._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force, echo: is.boolean(echo) && echo });
651
+ return Gateway.invoke(_this13._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force, echo: is.boolean(echo) && echo });
605
652
  });
606
653
  }
607
654
 
@@ -617,29 +664,29 @@ module.exports = function () {
617
664
  }, {
618
665
  key: 'readTransactions',
619
666
  value: function readTransactions(portfolio, position) {
620
- var _this13 = this;
667
+ var _this14 = this;
621
668
 
622
669
  return Promise.resolve().then(function () {
623
- checkStart.call(_this13);
670
+ checkStart.call(_this14);
624
671
 
625
672
  assert.argumentIsRequired(portfolio, 'portfolio', String);
626
673
  assert.argumentIsOptional(position, 'position', String);
627
674
 
628
- return Gateway.invoke(_this13._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
675
+ return Gateway.invoke(_this14._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
629
676
  });
630
677
  }
631
678
  }, {
632
679
  key: 'readTransactionsFormatted',
633
680
  value: function readTransactionsFormatted(portfolio, position) {
634
- var _this14 = this;
681
+ var _this15 = this;
635
682
 
636
683
  return Promise.resolve().then(function () {
637
- checkStart.call(_this14);
684
+ checkStart.call(_this15);
638
685
 
639
686
  assert.argumentIsRequired(portfolio, 'portfolio', String);
640
687
  assert.argumentIsOptional(position, 'position', String);
641
688
 
642
- return Gateway.invoke(_this14._readTransactionsReportEndpoint, { portfolio: portfolio, position: position || '*' });
689
+ return Gateway.invoke(_this15._readTransactionsReportEndpoint, { portfolio: portfolio, position: position || '*' });
643
690
  });
644
691
  }
645
692
 
@@ -800,7 +847,7 @@ module.exports = function () {
800
847
  }
801
848
  });
802
849
 
803
- var responseInterceptorForTransactionMutateDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
850
+ var responseInterceptorForPositionMutateDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
804
851
  try {
805
852
  var saved = response.data.positions.saved.map(function (p) {
806
853
  return JSON.parse(p, PositionSchema.CLIENT.schema.getReviver());
@@ -826,7 +873,7 @@ module.exports = function () {
826
873
 
827
874
  return returnRef;
828
875
  } catch (e) {
829
- console.error('Error deserializing mutate transaction data', e);
876
+ console.error('Error deserializing position mutate data', e);
830
877
  }
831
878
  });
832
879
 
@@ -859,7 +906,7 @@ module.exports = function () {
859
906
  return PortfolioGateway;
860
907
  }();
861
908
 
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){
909
+ },{"./../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){
863
910
  'use strict';
864
911
 
865
912
  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; }; }();
@@ -1210,7 +1257,7 @@ module.exports = function () {
1210
1257
  return {
1211
1258
  JwtGateway: JwtGateway,
1212
1259
  PortfolioGateway: PortfolioGateway,
1213
- version: '1.2.2'
1260
+ version: '1.2.5'
1214
1261
  };
1215
1262
  }();
1216
1263
 
@@ -1947,7 +1994,7 @@ module.exports = function () {
1947
1994
  return Gateway;
1948
1995
  }();
1949
1996
 
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){
1997
+ },{"./../../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){
1951
1998
  'use strict';
1952
1999
 
1953
2000
  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; }; }();
@@ -5903,7 +5950,7 @@ module.exports = function () {
5903
5950
  return Decimal;
5904
5951
  }();
5905
5952
 
5906
- },{"./Enum":32,"./assert":37,"./is":40,"big.js":87}],31:[function(require,module,exports){
5953
+ },{"./Enum":32,"./assert":37,"./is":40,"big.js":86}],31:[function(require,module,exports){
5907
5954
  'use strict';
5908
5955
 
5909
5956
  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; }; }();
@@ -6440,7 +6487,7 @@ module.exports = function () {
6440
6487
  return Timestamp;
6441
6488
  }();
6442
6489
 
6443
- },{"./assert":37,"./is":40,"moment-timezone":92}],35:[function(require,module,exports){
6490
+ },{"./assert":37,"./is":40,"moment-timezone":91}],35:[function(require,module,exports){
6444
6491
  'use strict';
6445
6492
 
6446
6493
  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; }; }();
@@ -7923,7 +7970,7 @@ module.exports = function () {
7923
7970
  };
7924
7971
  }();
7925
7972
 
7926
- },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":90}],44:[function(require,module,exports){
7973
+ },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":89}],44:[function(require,module,exports){
7927
7974
  'use strict';
7928
7975
 
7929
7976
  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; }; }();
@@ -8399,7 +8446,7 @@ module.exports = function () {
8399
8446
  return DataType;
8400
8447
  }();
8401
8448
 
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){
8449
+ },{"./../../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){
8403
8450
  'use strict';
8404
8451
 
8405
8452
  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; }; }();
@@ -9332,8 +9379,6 @@ module.exports = function () {
9332
9379
  }();
9333
9380
 
9334
9381
  },{"./../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
-
9337
9382
  const assert = require('@barchart/common-js/lang/assert'),
9338
9383
  Enum = require('@barchart/common-js/lang/Enum');
9339
9384
 
@@ -9349,29 +9394,19 @@ module.exports = (() => {
9349
9394
  * @param {String} alternateDescription
9350
9395
  * @param {String} code
9351
9396
  * @param {Boolean} canReinvest
9352
- * @param {Boolean} canShort
9353
- * @param {Boolean} canSwitchDirection
9354
9397
  * @param {Boolean} usesSymbols
9355
- * @param {Function} usesSymbols
9356
9398
  */
9357
9399
  class InstrumentType extends Enum {
9358
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, generator) {
9400
+ constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
9359
9401
  super(code, description);
9360
9402
 
9361
9403
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
9362
9404
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
9363
- assert.argumentIsRequired(canShort, 'canShort', Boolean);
9364
- assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
9365
9405
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
9366
- assert.argumentIsRequired(generator, 'generator', Function);
9367
9406
 
9368
9407
  this._alternateDescription = alternateDescription;
9369
9408
  this._canReinvest = canReinvest;
9370
- this._canShort = canShort;
9371
- this._canSwitchDirection = canSwitchDirection;
9372
9409
  this._usesSymbols = usesSymbols;
9373
-
9374
- this._generator = generator;
9375
9410
  }
9376
9411
 
9377
9412
  /**
@@ -9394,27 +9429,6 @@ module.exports = (() => {
9394
9429
  return this._canReinvest;
9395
9430
  }
9396
9431
 
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
-
9418
9432
  /**
9419
9433
  * Indicates if an instrument of this type can be represented by a symbol.
9420
9434
  *
@@ -9425,23 +9439,6 @@ module.exports = (() => {
9425
9439
  return this._usesSymbols;
9426
9440
  }
9427
9441
 
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
-
9445
9442
  /**
9446
9443
  * Cash.
9447
9444
  *
@@ -9486,169 +9483,20 @@ module.exports = (() => {
9486
9483
  return other;
9487
9484
  }
9488
9485
 
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
-
9501
9486
  toString() {
9502
9487
  return '[InstrumentType]';
9503
9488
  }
9504
9489
  }
9505
9490
 
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;
9491
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false);
9492
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true);
9493
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true);
9494
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false);
9517
9495
 
9518
9496
  return InstrumentType;
9519
9497
  })();
9520
9498
 
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){
9499
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
9652
9500
  const array = require('@barchart/common-js/lang/array'),
9653
9501
  assert = require('@barchart/common-js/lang/assert'),
9654
9502
  Day = require('@barchart/common-js/lang/Day'),
@@ -9905,7 +9753,7 @@ module.exports = (() => {
9905
9753
  return PositionSummaryFrame;
9906
9754
  })();
9907
9755
 
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){
9756
+ },{"@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){
9909
9757
  const assert = require('@barchart/common-js/lang/assert'),
9910
9758
  Enum = require('@barchart/common-js/lang/Enum');
9911
9759
 
@@ -10245,7 +10093,7 @@ module.exports = (() => {
10245
10093
  return TransactionType;
10246
10094
  })();
10247
10095
 
10248
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
10096
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],54:[function(require,module,exports){
10249
10097
  const assert = require('@barchart/common-js/lang/assert'),
10250
10098
  Enum = require('@barchart/common-js/lang/Enum');
10251
10099
 
@@ -10307,7 +10155,7 @@ module.exports = (() => {
10307
10155
  return ValuationType;
10308
10156
  })();
10309
10157
 
10310
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],56:[function(require,module,exports){
10158
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
10311
10159
  const assert = require('@barchart/common-js/lang/assert'),
10312
10160
  Currency = require('@barchart/common-js/lang/Currency'),
10313
10161
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -10477,7 +10325,7 @@ module.exports = (() => {
10477
10325
  return PortfolioSchema;
10478
10326
  })();
10479
10327
 
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){
10328
+ },{"./../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){
10481
10329
  const assert = require('@barchart/common-js/lang/assert'),
10482
10330
  Currency = require('@barchart/common-js/lang/Currency'),
10483
10331
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -10487,7 +10335,6 @@ const assert = require('@barchart/common-js/lang/assert'),
10487
10335
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10488
10336
 
10489
10337
  const InstrumentType = require('./../data/InstrumentType'),
10490
- PositionDirection = require('./../data/PositionDirection'),
10491
10338
  ValuationType = require('./../data/ValuationType');
10492
10339
 
10493
10340
  module.exports = (() => {
@@ -10560,7 +10407,6 @@ module.exports = (() => {
10560
10407
  .withField('reinvest', DataType.BOOLEAN)
10561
10408
  .withField('snapshot.date', DataType.DAY)
10562
10409
  .withField('snapshot.open', DataType.DECIMAL)
10563
- .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10564
10410
  .withField('snapshot.buys', DataType.DECIMAL)
10565
10411
  .withField('snapshot.sells', DataType.DECIMAL)
10566
10412
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10592,7 +10438,6 @@ module.exports = (() => {
10592
10438
  .withField('reinvest', DataType.BOOLEAN)
10593
10439
  .withField('snapshot.date', DataType.DAY)
10594
10440
  .withField('snapshot.open', DataType.DECIMAL)
10595
- .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10596
10441
  .withField('snapshot.buys', DataType.DECIMAL)
10597
10442
  .withField('snapshot.sells', DataType.DECIMAL)
10598
10443
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10606,7 +10451,7 @@ module.exports = (() => {
10606
10451
  return PositionSchema;
10607
10452
  })();
10608
10453
 
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){
10454
+ },{"./../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){
10610
10455
  const assert = require('@barchart/common-js/lang/assert'),
10611
10456
  Currency = require('@barchart/common-js/lang/Currency'),
10612
10457
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -10615,8 +10460,7 @@ const assert = require('@barchart/common-js/lang/assert'),
10615
10460
  Schema = require('@barchart/common-js/serialization/json/Schema'),
10616
10461
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10617
10462
 
10618
- const PositionDirection = require('./../data/PositionDirection'),
10619
- PositionSummaryFrame = require('./../data/PositionSummaryFrame');
10463
+ const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
10620
10464
 
10621
10465
  module.exports = (() => {
10622
10466
  'use strict';
@@ -10686,13 +10530,11 @@ module.exports = (() => {
10686
10530
  .withField('start.date', DataType.DAY)
10687
10531
  .withField('start.sequence', DataType.NUMBER)
10688
10532
  .withField('start.open', DataType.DECIMAL)
10689
- .withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10690
10533
  .withField('start.basis', DataType.DECIMAL)
10691
10534
  .withField('start.value', DataType.DECIMAL)
10692
10535
  .withField('end.date', DataType.DAY)
10693
10536
  .withField('end.sequence', DataType.NUMBER)
10694
10537
  .withField('end.open', DataType.DECIMAL)
10695
- .withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10696
10538
  .withField('end.basis', DataType.DECIMAL)
10697
10539
  .withField('end.value', DataType.DECIMAL)
10698
10540
  .withField('period.buys', DataType.DECIMAL)
@@ -10720,13 +10562,11 @@ module.exports = (() => {
10720
10562
  .withField('start.date', DataType.DAY)
10721
10563
  .withField('start.sequence', DataType.NUMBER)
10722
10564
  .withField('start.open', DataType.DECIMAL)
10723
- .withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10724
10565
  .withField('start.basis', DataType.DECIMAL)
10725
10566
  .withField('start.value', DataType.DECIMAL)
10726
10567
  .withField('end.date', DataType.DAY)
10727
10568
  .withField('end.sequence', DataType.NUMBER)
10728
10569
  .withField('end.open', DataType.DECIMAL)
10729
- .withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10730
10570
  .withField('end.basis', DataType.DECIMAL)
10731
10571
  .withField('end.value', DataType.DECIMAL)
10732
10572
  .withField('period.buys', DataType.DECIMAL)
@@ -10740,7 +10580,7 @@ module.exports = (() => {
10740
10580
  return PositionSummarySchema;
10741
10581
  })();
10742
10582
 
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){
10583
+ },{"./../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){
10744
10584
  const assert = require('@barchart/common-js/lang/assert'),
10745
10585
  is = require('@barchart/common-js/lang/is'),
10746
10586
  Currency = require('@barchart/common-js/lang/Currency'),
@@ -10750,7 +10590,6 @@ const assert = require('@barchart/common-js/lang/assert'),
10750
10590
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10751
10591
 
10752
10592
  const InstrumentType = require('./../data/InstrumentType'),
10753
- PositionDirection = require('./../data/PositionDirection'),
10754
10593
  TransactionType = require('./../data/TransactionType');
10755
10594
 
10756
10595
  module.exports = (() => {
@@ -10920,7 +10759,6 @@ module.exports = (() => {
10920
10759
  .withField('reference.position', DataType.STRING, true)
10921
10760
  .withField('reference.sequence', DataType.NUMBER, true)
10922
10761
  .withField('snapshot.open', DataType.DECIMAL)
10923
- .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10924
10762
  .withField('snapshot.buys', DataType.DECIMAL)
10925
10763
  .withField('snapshot.sells', DataType.DECIMAL)
10926
10764
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10964,7 +10802,6 @@ module.exports = (() => {
10964
10802
  .withField('reference.position', DataType.STRING, true)
10965
10803
  .withField('reference.sequence', DataType.NUMBER, true)
10966
10804
  .withField('snapshot.open', DataType.DECIMAL)
10967
- .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10968
10805
  .withField('snapshot.buys', DataType.DECIMAL)
10969
10806
  .withField('snapshot.sells', DataType.DECIMAL)
10970
10807
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -11194,6 +11031,7 @@ module.exports = (() => {
11194
11031
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11195
11032
  .withField('date', DataType.DAY)
11196
11033
  .withField('value', DataType.DECIMAL)
11034
+ .withField('fee', DataType.DECIMAL, true)
11197
11035
  .withField('force', DataType.BOOLEAN, true)
11198
11036
  .schema
11199
11037
  );
@@ -11233,7 +11071,7 @@ module.exports = (() => {
11233
11071
  return TransactionSchema;
11234
11072
  })();
11235
11073
 
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){
11074
+ },{"./../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){
11237
11075
  'use strict';
11238
11076
 
11239
11077
  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; }; }();
@@ -11271,27 +11109,26 @@ module.exports = function () {
11271
11109
  * Web service gateway for obtaining JWT tokens from TGAM (The Globe and Mail).
11272
11110
  *
11273
11111
  * @public
11274
- * @param {Enpoint=} endpoint
11112
+ * @param {Enpoint} endpoint
11275
11113
  * @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.
11277
11114
  * @extends {Disposable}
11278
11115
  */
11279
11116
 
11280
11117
  var JwtGateway = function (_Disposable) {
11281
11118
  _inherits(JwtGateway, _Disposable);
11282
11119
 
11283
- function JwtGateway(tokenDelegate, refreshInterval) {
11120
+ function JwtGateway(endpoint, refreshInterval) {
11284
11121
  _classCallCheck(this, JwtGateway);
11285
11122
 
11286
11123
  var _this = _possibleConstructorReturn(this, (JwtGateway.__proto__ || Object.getPrototypeOf(JwtGateway)).call(this));
11287
11124
 
11288
- assert.argumentIsRequired(tokenDelegate, 'tokenDelegate', Function);
11125
+ assert.argumentIsRequired(endpoint, 'endpoint', Endpoint, 'Endpoint');
11289
11126
  assert.argumentIsOptional(refreshInterval, 'refreshInterval', Number);
11290
11127
 
11291
11128
  _this._started = false;
11292
11129
  _this._startPromise = null;
11293
11130
 
11294
- _this._tokenDelegate = tokenDelegate;
11131
+ _this._endpoint = endpoint;
11295
11132
 
11296
11133
  _this._refreshInterval = refreshInterval || 0;
11297
11134
  _this._refreshJitter = Math.floor(_this._refreshInterval / 10);
@@ -11344,7 +11181,7 @@ module.exports = function () {
11344
11181
  return Promise.resolve().then(function () {
11345
11182
  checkStart.call(_this3);
11346
11183
 
11347
- return _this3._tokenDelegate();
11184
+ return Gateway.invoke(_this3._endpoint);
11348
11185
  }).catch(function (e) {
11349
11186
  var failure = FailureReason.forRequest({ endpoint: _this3._endpoint }).addItem(FailureType.REQUEST_IDENTITY_FAILURE).format();
11350
11187
 
@@ -11459,9 +11296,7 @@ module.exports = function () {
11459
11296
  key: 'forDevelopment',
11460
11297
  value: function forDevelopment(endpoint) {
11461
11298
  return Promise.resolve(endpoint).then(function (e) {
11462
- return start(new JwtGateway(function () {
11463
- return Gateway.invoke(e);
11464
- }, 60000));
11299
+ return start(new JwtGateway(e, 60000));
11465
11300
  });
11466
11301
  }
11467
11302
 
@@ -11470,7 +11305,7 @@ module.exports = function () {
11470
11305
  *
11471
11306
  * @public
11472
11307
  * @static
11473
- * @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
11308
+ * @param {Promise.<Endpoint>|Endpoint}endpoint - The endpoint which vends JWT tokens.
11474
11309
  * @returns {Promise.<RequestInterceptor>}
11475
11310
  */
11476
11311
 
@@ -11541,40 +11376,6 @@ module.exports = function () {
11541
11376
  return jwtGateway.toRequestInterceptor();
11542
11377
  });
11543
11378
  }
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
- }
11578
11379
  }]);
11579
11380
 
11580
11381
  return JwtGateway;
@@ -11605,7 +11406,7 @@ module.exports = function () {
11605
11406
  }
11606
11407
 
11607
11408
  function forTgam(host, secret, environment) {
11608
- var endpoint = EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11409
+ return EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11609
11410
  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);
11610
11411
  }).withHost(host).withRequestInterceptor(RequestInterceptor.fromDelegate(function (request) {
11611
11412
  request.withCredentials = true;
@@ -11614,10 +11415,6 @@ module.exports = function () {
11614
11415
  })).withResponseInterceptor(ResponseInterceptor.DATA).withResponseInterceptor(ResponseInterceptor.fromDelegate(function (response) {
11615
11416
  return response.token;
11616
11417
  })).endpoint;
11617
-
11618
- return function () {
11619
- return Gateway.invoke(endpoint);
11620
- };
11621
11418
  }
11622
11419
 
11623
11420
  function getTime() {
@@ -11627,7 +11424,7 @@ module.exports = function () {
11627
11424
  return JwtGateway;
11628
11425
  }();
11629
11426
 
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){
11427
+ },{"./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){
11631
11428
  'use strict';
11632
11429
 
11633
11430
  var JwtGateway = require('./JwtGateway');
@@ -11637,13 +11434,13 @@ module.exports = function () {
11637
11434
 
11638
11435
  return {
11639
11436
  JwtGateway: JwtGateway,
11640
- version: '1.0.39'
11437
+ version: '1.0.38'
11641
11438
  };
11642
11439
  }();
11643
11440
 
11644
- },{"./JwtGateway":60}],62:[function(require,module,exports){
11441
+ },{"./JwtGateway":59}],61:[function(require,module,exports){
11645
11442
  module.exports = require('./lib/axios');
11646
- },{"./lib/axios":64}],63:[function(require,module,exports){
11443
+ },{"./lib/axios":63}],62:[function(require,module,exports){
11647
11444
  (function (process){
11648
11445
  'use strict';
11649
11446
 
@@ -11827,7 +11624,7 @@ module.exports = function xhrAdapter(config) {
11827
11624
  };
11828
11625
 
11829
11626
  }).call(this,require('_process'))
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){
11627
+ },{"../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){
11831
11628
  'use strict';
11832
11629
 
11833
11630
  var utils = require('./utils');
@@ -11881,7 +11678,7 @@ module.exports = axios;
11881
11678
  // Allow use of default import syntax in TypeScript
11882
11679
  module.exports.default = axios;
11883
11680
 
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){
11681
+ },{"./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){
11885
11682
  'use strict';
11886
11683
 
11887
11684
  /**
@@ -11902,7 +11699,7 @@ Cancel.prototype.__CANCEL__ = true;
11902
11699
 
11903
11700
  module.exports = Cancel;
11904
11701
 
11905
- },{}],66:[function(require,module,exports){
11702
+ },{}],65:[function(require,module,exports){
11906
11703
  'use strict';
11907
11704
 
11908
11705
  var Cancel = require('./Cancel');
@@ -11961,14 +11758,14 @@ CancelToken.source = function source() {
11961
11758
 
11962
11759
  module.exports = CancelToken;
11963
11760
 
11964
- },{"./Cancel":65}],67:[function(require,module,exports){
11761
+ },{"./Cancel":64}],66:[function(require,module,exports){
11965
11762
  'use strict';
11966
11763
 
11967
11764
  module.exports = function isCancel(value) {
11968
11765
  return !!(value && value.__CANCEL__);
11969
11766
  };
11970
11767
 
11971
- },{}],68:[function(require,module,exports){
11768
+ },{}],67:[function(require,module,exports){
11972
11769
  'use strict';
11973
11770
 
11974
11771
  var defaults = require('./../defaults');
@@ -12049,7 +11846,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
12049
11846
 
12050
11847
  module.exports = Axios;
12051
11848
 
12052
- },{"./../defaults":75,"./../utils":86,"./InterceptorManager":69,"./dispatchRequest":71}],69:[function(require,module,exports){
11849
+ },{"./../defaults":74,"./../utils":85,"./InterceptorManager":68,"./dispatchRequest":70}],68:[function(require,module,exports){
12053
11850
  'use strict';
12054
11851
 
12055
11852
  var utils = require('./../utils');
@@ -12103,7 +11900,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
12103
11900
 
12104
11901
  module.exports = InterceptorManager;
12105
11902
 
12106
- },{"./../utils":86}],70:[function(require,module,exports){
11903
+ },{"./../utils":85}],69:[function(require,module,exports){
12107
11904
  'use strict';
12108
11905
 
12109
11906
  var enhanceError = require('./enhanceError');
@@ -12123,7 +11920,7 @@ module.exports = function createError(message, config, code, request, response)
12123
11920
  return enhanceError(error, config, code, request, response);
12124
11921
  };
12125
11922
 
12126
- },{"./enhanceError":72}],71:[function(require,module,exports){
11923
+ },{"./enhanceError":71}],70:[function(require,module,exports){
12127
11924
  'use strict';
12128
11925
 
12129
11926
  var utils = require('./../utils');
@@ -12211,7 +12008,7 @@ module.exports = function dispatchRequest(config) {
12211
12008
  });
12212
12009
  };
12213
12010
 
12214
- },{"../cancel/isCancel":67,"../defaults":75,"./../helpers/combineURLs":79,"./../helpers/isAbsoluteURL":81,"./../utils":86,"./transformData":74}],72:[function(require,module,exports){
12011
+ },{"../cancel/isCancel":66,"../defaults":74,"./../helpers/combineURLs":78,"./../helpers/isAbsoluteURL":80,"./../utils":85,"./transformData":73}],71:[function(require,module,exports){
12215
12012
  'use strict';
12216
12013
 
12217
12014
  /**
@@ -12234,7 +12031,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
12234
12031
  return error;
12235
12032
  };
12236
12033
 
12237
- },{}],73:[function(require,module,exports){
12034
+ },{}],72:[function(require,module,exports){
12238
12035
  'use strict';
12239
12036
 
12240
12037
  var createError = require('./createError');
@@ -12262,7 +12059,7 @@ module.exports = function settle(resolve, reject, response) {
12262
12059
  }
12263
12060
  };
12264
12061
 
12265
- },{"./createError":70}],74:[function(require,module,exports){
12062
+ },{"./createError":69}],73:[function(require,module,exports){
12266
12063
  'use strict';
12267
12064
 
12268
12065
  var utils = require('./../utils');
@@ -12284,7 +12081,7 @@ module.exports = function transformData(data, headers, fns) {
12284
12081
  return data;
12285
12082
  };
12286
12083
 
12287
- },{"./../utils":86}],75:[function(require,module,exports){
12084
+ },{"./../utils":85}],74:[function(require,module,exports){
12288
12085
  (function (process){
12289
12086
  'use strict';
12290
12087
 
@@ -12380,7 +12177,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
12380
12177
  module.exports = defaults;
12381
12178
 
12382
12179
  }).call(this,require('_process'))
12383
- },{"./adapters/http":63,"./adapters/xhr":63,"./helpers/normalizeHeaderName":83,"./utils":86,"_process":88}],76:[function(require,module,exports){
12180
+ },{"./adapters/http":62,"./adapters/xhr":62,"./helpers/normalizeHeaderName":82,"./utils":85,"_process":87}],75:[function(require,module,exports){
12384
12181
  'use strict';
12385
12182
 
12386
12183
  module.exports = function bind(fn, thisArg) {
@@ -12393,7 +12190,7 @@ module.exports = function bind(fn, thisArg) {
12393
12190
  };
12394
12191
  };
12395
12192
 
12396
- },{}],77:[function(require,module,exports){
12193
+ },{}],76:[function(require,module,exports){
12397
12194
  'use strict';
12398
12195
 
12399
12196
  // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
@@ -12431,7 +12228,7 @@ function btoa(input) {
12431
12228
 
12432
12229
  module.exports = btoa;
12433
12230
 
12434
- },{}],78:[function(require,module,exports){
12231
+ },{}],77:[function(require,module,exports){
12435
12232
  'use strict';
12436
12233
 
12437
12234
  var utils = require('./../utils');
@@ -12501,7 +12298,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
12501
12298
  return url;
12502
12299
  };
12503
12300
 
12504
- },{"./../utils":86}],79:[function(require,module,exports){
12301
+ },{"./../utils":85}],78:[function(require,module,exports){
12505
12302
  'use strict';
12506
12303
 
12507
12304
  /**
@@ -12517,7 +12314,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
12517
12314
  : baseURL;
12518
12315
  };
12519
12316
 
12520
- },{}],80:[function(require,module,exports){
12317
+ },{}],79:[function(require,module,exports){
12521
12318
  'use strict';
12522
12319
 
12523
12320
  var utils = require('./../utils');
@@ -12572,7 +12369,7 @@ module.exports = (
12572
12369
  })()
12573
12370
  );
12574
12371
 
12575
- },{"./../utils":86}],81:[function(require,module,exports){
12372
+ },{"./../utils":85}],80:[function(require,module,exports){
12576
12373
  'use strict';
12577
12374
 
12578
12375
  /**
@@ -12588,7 +12385,7 @@ module.exports = function isAbsoluteURL(url) {
12588
12385
  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
12589
12386
  };
12590
12387
 
12591
- },{}],82:[function(require,module,exports){
12388
+ },{}],81:[function(require,module,exports){
12592
12389
  'use strict';
12593
12390
 
12594
12391
  var utils = require('./../utils');
@@ -12658,7 +12455,7 @@ module.exports = (
12658
12455
  })()
12659
12456
  );
12660
12457
 
12661
- },{"./../utils":86}],83:[function(require,module,exports){
12458
+ },{"./../utils":85}],82:[function(require,module,exports){
12662
12459
  'use strict';
12663
12460
 
12664
12461
  var utils = require('../utils');
@@ -12672,7 +12469,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
12672
12469
  });
12673
12470
  };
12674
12471
 
12675
- },{"../utils":86}],84:[function(require,module,exports){
12472
+ },{"../utils":85}],83:[function(require,module,exports){
12676
12473
  'use strict';
12677
12474
 
12678
12475
  var utils = require('./../utils');
@@ -12727,7 +12524,7 @@ module.exports = function parseHeaders(headers) {
12727
12524
  return parsed;
12728
12525
  };
12729
12526
 
12730
- },{"./../utils":86}],85:[function(require,module,exports){
12527
+ },{"./../utils":85}],84:[function(require,module,exports){
12731
12528
  'use strict';
12732
12529
 
12733
12530
  /**
@@ -12756,7 +12553,7 @@ module.exports = function spread(callback) {
12756
12553
  };
12757
12554
  };
12758
12555
 
12759
- },{}],86:[function(require,module,exports){
12556
+ },{}],85:[function(require,module,exports){
12760
12557
  'use strict';
12761
12558
 
12762
12559
  var bind = require('./helpers/bind');
@@ -13061,7 +12858,7 @@ module.exports = {
13061
12858
  trim: trim
13062
12859
  };
13063
12860
 
13064
- },{"./helpers/bind":76,"is-buffer":89}],87:[function(require,module,exports){
12861
+ },{"./helpers/bind":75,"is-buffer":88}],86:[function(require,module,exports){
13065
12862
  /*
13066
12863
  * big.js v5.0.3
13067
12864
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -14002,7 +13799,7 @@ module.exports = {
14002
13799
  }
14003
13800
  })(this);
14004
13801
 
14005
- },{}],88:[function(require,module,exports){
13802
+ },{}],87:[function(require,module,exports){
14006
13803
  // shim for using process in browser
14007
13804
  var process = module.exports = {};
14008
13805
 
@@ -14188,7 +13985,7 @@ process.chdir = function (dir) {
14188
13985
  };
14189
13986
  process.umask = function() { return 0; };
14190
13987
 
14191
- },{}],89:[function(require,module,exports){
13988
+ },{}],88:[function(require,module,exports){
14192
13989
  /*!
14193
13990
  * Determine if an object is a Buffer
14194
13991
  *
@@ -14211,7 +14008,7 @@ function isSlowBuffer (obj) {
14211
14008
  return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
14212
14009
  }
14213
14010
 
14214
- },{}],90:[function(require,module,exports){
14011
+ },{}],89:[function(require,module,exports){
14215
14012
  //! moment-timezone.js
14216
14013
  //! version : 0.5.11
14217
14014
  //! Copyright (c) JS Foundation and other contributors
@@ -15413,7 +15210,7 @@ function isSlowBuffer (obj) {
15413
15210
  return moment;
15414
15211
  }));
15415
15212
 
15416
- },{"moment":94}],91:[function(require,module,exports){
15213
+ },{"moment":93}],90:[function(require,module,exports){
15417
15214
  module.exports={
15418
15215
  "version": "2016j",
15419
15216
  "zones": [
@@ -16013,11 +15810,11 @@ module.exports={
16013
15810
  "Pacific/Pohnpei|Pacific/Ponape"
16014
15811
  ]
16015
15812
  }
16016
- },{}],92:[function(require,module,exports){
15813
+ },{}],91:[function(require,module,exports){
16017
15814
  var moment = module.exports = require("./moment-timezone");
16018
15815
  moment.tz.load(require('./data/packed/latest.json'));
16019
15816
 
16020
- },{"./data/packed/latest.json":91,"./moment-timezone":93}],93:[function(require,module,exports){
15817
+ },{"./data/packed/latest.json":90,"./moment-timezone":92}],92:[function(require,module,exports){
16021
15818
  //! moment-timezone.js
16022
15819
  //! version : 0.5.11
16023
15820
  //! Copyright (c) JS Foundation and other contributors
@@ -16620,7 +16417,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16620
16417
  return moment;
16621
16418
  }));
16622
16419
 
16623
- },{"moment":94}],94:[function(require,module,exports){
16420
+ },{"moment":93}],93:[function(require,module,exports){
16624
16421
  //! moment.js
16625
16422
 
16626
16423
  ;(function (global, factory) {
@@ -20282,7 +20079,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20282
20079
 
20283
20080
  addUnitAlias('date', 'D');
20284
20081
 
20285
- // PRIORITY
20082
+ // PRIOROITY
20286
20083
  addUnitPriority('date', 9);
20287
20084
 
20288
20085
  // PARSING
@@ -21079,7 +20876,7 @@ moment.tz.load(require('./data/packed/latest.json'));
21079
20876
  // Side effect imports
21080
20877
 
21081
20878
 
21082
- hooks.version = '2.22.1';
20879
+ hooks.version = '2.22.0';
21083
20880
 
21084
20881
  setHookCallback(createLocal);
21085
20882
 
@@ -21128,210 +20925,5 @@ moment.tz.load(require('./data/packed/latest.json'));
21128
20925
 
21129
20926
  })));
21130
20927
 
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)
20928
+ },{}]},{},[1,5])(5)
21337
20929
  });