@barchart/portfolio-client-js 1.1.45 → 1.1.46
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.
- package/example/example.js +533 -77
- package/lib/gateway/PortfolioGateway.js +9 -7
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.js
CHANGED
|
@@ -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":
|
|
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; }; }();
|
|
@@ -241,11 +241,11 @@ module.exports = function () {
|
|
|
241
241
|
qb.withVariableParameter('type', 'type', 'type', false, function (i) {
|
|
242
242
|
return i.code;
|
|
243
243
|
});
|
|
244
|
-
}).withBody('portfolio data').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(
|
|
244
|
+
}).withBody('portfolio data').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
245
245
|
|
|
246
246
|
_this._deleteTransactionEndpoint = EndpointBuilder.for('delete-transaction', 'delete transaction').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
247
247
|
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);
|
|
248
|
-
}).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
248
|
+
}).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
249
249
|
|
|
250
250
|
_this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
251
251
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
|
|
@@ -510,7 +510,7 @@ module.exports = function () {
|
|
|
510
510
|
*
|
|
511
511
|
* @public
|
|
512
512
|
* @param {Object} transaction
|
|
513
|
-
* @returns {Promise.<
|
|
513
|
+
* @returns {Promise.<TransactionMutateResult>}
|
|
514
514
|
*/
|
|
515
515
|
|
|
516
516
|
}, {
|
|
@@ -555,7 +555,7 @@ module.exports = function () {
|
|
|
555
555
|
* @param {String} position
|
|
556
556
|
* @param {Number} transaction
|
|
557
557
|
* @param {Boolean=} force
|
|
558
|
-
* @returns {Promise.<
|
|
558
|
+
* @returns {Promise.<TransactionMutateResult>}
|
|
559
559
|
*/
|
|
560
560
|
|
|
561
561
|
}, {
|
|
@@ -756,11 +756,11 @@ module.exports = function () {
|
|
|
756
756
|
try {
|
|
757
757
|
return JSON.parse(response.data, TransactionSchema.CLIENT.schema.getReviver());
|
|
758
758
|
} catch (e) {
|
|
759
|
-
console.error('Error
|
|
759
|
+
console.error('Error deserializing transaction data', e);
|
|
760
760
|
}
|
|
761
761
|
});
|
|
762
762
|
|
|
763
|
-
var
|
|
763
|
+
var responseInterceptorForTransactionMutateDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
|
|
764
764
|
try {
|
|
765
765
|
var positions = response.data.positions.map(function (p) {
|
|
766
766
|
return JSON.parse(p, PositionSchema.CLIENT.schema.getReviver());
|
|
@@ -775,7 +775,7 @@ module.exports = function () {
|
|
|
775
775
|
replaced: response.data.replaced
|
|
776
776
|
};
|
|
777
777
|
} catch (e) {
|
|
778
|
-
console.error('Error
|
|
778
|
+
console.error('Error deserializing mutate transaction data', e);
|
|
779
779
|
}
|
|
780
780
|
});
|
|
781
781
|
|
|
@@ -798,16 +798,17 @@ module.exports = function () {
|
|
|
798
798
|
/**
|
|
799
799
|
* The result of transaction create operation.
|
|
800
800
|
*
|
|
801
|
-
* @typedef
|
|
801
|
+
* @typedef TransactionMutateResult
|
|
802
802
|
* @type {Object}
|
|
803
803
|
* @property {Array.<Object>} positions - All positions updated as a consequence of processing the transaction.
|
|
804
804
|
* @property {Array.<Object>} summaries - All position summaries updated as a consequence of processing the transaction.
|
|
805
|
+
* @property {Boolean} replaced - If true, the position (and position summaries) need to be replaced.
|
|
805
806
|
*/
|
|
806
807
|
|
|
807
808
|
return PortfolioGateway;
|
|
808
809
|
}();
|
|
809
810
|
|
|
810
|
-
},{"./../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":
|
|
811
|
+
},{"./../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){
|
|
811
812
|
'use strict';
|
|
812
813
|
|
|
813
814
|
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; }; }();
|
|
@@ -1158,7 +1159,7 @@ module.exports = function () {
|
|
|
1158
1159
|
return {
|
|
1159
1160
|
JwtGateway: JwtGateway,
|
|
1160
1161
|
PortfolioGateway: PortfolioGateway,
|
|
1161
|
-
version: '1.1.
|
|
1162
|
+
version: '1.1.46'
|
|
1162
1163
|
};
|
|
1163
1164
|
}();
|
|
1164
1165
|
|
|
@@ -1895,7 +1896,7 @@ module.exports = function () {
|
|
|
1895
1896
|
return Gateway;
|
|
1896
1897
|
}();
|
|
1897
1898
|
|
|
1898
|
-
},{"./../../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":
|
|
1899
|
+
},{"./../../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){
|
|
1899
1900
|
'use strict';
|
|
1900
1901
|
|
|
1901
1902
|
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; }; }();
|
|
@@ -5851,7 +5852,7 @@ module.exports = function () {
|
|
|
5851
5852
|
return Decimal;
|
|
5852
5853
|
}();
|
|
5853
5854
|
|
|
5854
|
-
},{"./Enum":32,"./assert":37,"./is":40,"big.js":
|
|
5855
|
+
},{"./Enum":32,"./assert":37,"./is":40,"big.js":87}],31:[function(require,module,exports){
|
|
5855
5856
|
'use strict';
|
|
5856
5857
|
|
|
5857
5858
|
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; }; }();
|
|
@@ -6388,7 +6389,7 @@ module.exports = function () {
|
|
|
6388
6389
|
return Timestamp;
|
|
6389
6390
|
}();
|
|
6390
6391
|
|
|
6391
|
-
},{"./assert":37,"./is":40,"moment-timezone":
|
|
6392
|
+
},{"./assert":37,"./is":40,"moment-timezone":92}],35:[function(require,module,exports){
|
|
6392
6393
|
'use strict';
|
|
6393
6394
|
|
|
6394
6395
|
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; }; }();
|
|
@@ -7871,7 +7872,7 @@ module.exports = function () {
|
|
|
7871
7872
|
};
|
|
7872
7873
|
}();
|
|
7873
7874
|
|
|
7874
|
-
},{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":
|
|
7875
|
+
},{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":90}],44:[function(require,module,exports){
|
|
7875
7876
|
'use strict';
|
|
7876
7877
|
|
|
7877
7878
|
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; }; }();
|
|
@@ -8347,7 +8348,7 @@ module.exports = function () {
|
|
|
8347
8348
|
return DataType;
|
|
8348
8349
|
}();
|
|
8349
8350
|
|
|
8350
|
-
},{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":
|
|
8351
|
+
},{"./../../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){
|
|
8351
8352
|
'use strict';
|
|
8352
8353
|
|
|
8353
8354
|
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; }; }();
|
|
@@ -9280,6 +9281,8 @@ module.exports = function () {
|
|
|
9280
9281
|
}();
|
|
9281
9282
|
|
|
9282
9283
|
},{"./../lang/Disposable":31,"./../lang/assert":37,"./../lang/is":40,"./../lang/object":41,"./../lang/promise":42}],51:[function(require,module,exports){
|
|
9284
|
+
const uuid = require('uuid');
|
|
9285
|
+
|
|
9283
9286
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
9284
9287
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
9285
9288
|
|
|
@@ -9295,19 +9298,29 @@ module.exports = (() => {
|
|
|
9295
9298
|
* @param {String} alternateDescription
|
|
9296
9299
|
* @param {String} code
|
|
9297
9300
|
* @param {Boolean} canReinvest
|
|
9301
|
+
* @param {Boolean} canShort
|
|
9302
|
+
* @param {Boolean} canSwitchDirection
|
|
9298
9303
|
* @param {Boolean} usesSymbols
|
|
9304
|
+
* @param {Function} usesSymbols
|
|
9299
9305
|
*/
|
|
9300
9306
|
class InstrumentType extends Enum {
|
|
9301
|
-
constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
|
|
9307
|
+
constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, generator) {
|
|
9302
9308
|
super(code, description);
|
|
9303
9309
|
|
|
9304
9310
|
assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
|
|
9305
9311
|
assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
|
|
9312
|
+
assert.argumentIsRequired(canShort, 'canShort', Boolean);
|
|
9313
|
+
assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
|
|
9306
9314
|
assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
|
|
9315
|
+
assert.argumentIsRequired(generator, 'generator', Function);
|
|
9307
9316
|
|
|
9308
9317
|
this._alternateDescription = alternateDescription;
|
|
9309
9318
|
this._canReinvest = canReinvest;
|
|
9319
|
+
this._canShort = canShort;
|
|
9320
|
+
this._canSwitchDirection = canSwitchDirection;
|
|
9310
9321
|
this._usesSymbols = usesSymbols;
|
|
9322
|
+
|
|
9323
|
+
this._generator = generator;
|
|
9311
9324
|
}
|
|
9312
9325
|
|
|
9313
9326
|
/**
|
|
@@ -9330,6 +9343,27 @@ module.exports = (() => {
|
|
|
9330
9343
|
return this._canReinvest;
|
|
9331
9344
|
}
|
|
9332
9345
|
|
|
9346
|
+
/**
|
|
9347
|
+
* Indicates if short-selling is possible for this instrument type.
|
|
9348
|
+
*
|
|
9349
|
+
* @public
|
|
9350
|
+
* @returns {Boolean}
|
|
9351
|
+
*/
|
|
9352
|
+
get canShort() {
|
|
9353
|
+
return this._canShort;
|
|
9354
|
+
}
|
|
9355
|
+
|
|
9356
|
+
/**
|
|
9357
|
+
* Indicates if one transaction is allowed to switch a position size from
|
|
9358
|
+
* positive to negative (or vice versa).
|
|
9359
|
+
*
|
|
9360
|
+
* @public
|
|
9361
|
+
* @returns {Boolean}
|
|
9362
|
+
*/
|
|
9363
|
+
get canSwitchDirection() {
|
|
9364
|
+
return this._canSwitchDirection;
|
|
9365
|
+
}
|
|
9366
|
+
|
|
9333
9367
|
/**
|
|
9334
9368
|
* Indicates if an instrument of this type can be represented by a symbol.
|
|
9335
9369
|
*
|
|
@@ -9340,6 +9374,23 @@ module.exports = (() => {
|
|
|
9340
9374
|
return this._usesSymbols;
|
|
9341
9375
|
}
|
|
9342
9376
|
|
|
9377
|
+
/**
|
|
9378
|
+
* Generates an identifier for the instrument.
|
|
9379
|
+
*
|
|
9380
|
+
* @public
|
|
9381
|
+
* @param {Object} instrument
|
|
9382
|
+
* @returns {String}
|
|
9383
|
+
*/
|
|
9384
|
+
generateIdentifier(instrument) {
|
|
9385
|
+
assert.argumentIsRequired(instrument, 'instrument');
|
|
9386
|
+
|
|
9387
|
+
if (instrument.type !== this) {
|
|
9388
|
+
throw new Error('Unable to generate instrument identifier for incompatible type.');
|
|
9389
|
+
}
|
|
9390
|
+
|
|
9391
|
+
return this._generator(instrument);
|
|
9392
|
+
}
|
|
9393
|
+
|
|
9343
9394
|
/**
|
|
9344
9395
|
* Cash.
|
|
9345
9396
|
*
|
|
@@ -9384,20 +9435,169 @@ module.exports = (() => {
|
|
|
9384
9435
|
return other;
|
|
9385
9436
|
}
|
|
9386
9437
|
|
|
9438
|
+
/**
|
|
9439
|
+
* Generates an identifier for the instrument.
|
|
9440
|
+
*
|
|
9441
|
+
* @static
|
|
9442
|
+
* @public
|
|
9443
|
+
* @param {Object} instrument
|
|
9444
|
+
* @returns {String}
|
|
9445
|
+
*/
|
|
9446
|
+
static generateIdentifier(instrument) {
|
|
9447
|
+
return map[instrument.type.code].generateIdentifier(instrument);
|
|
9448
|
+
}
|
|
9449
|
+
|
|
9387
9450
|
toString() {
|
|
9388
9451
|
return '[InstrumentType]';
|
|
9389
9452
|
}
|
|
9390
9453
|
}
|
|
9391
9454
|
|
|
9392
|
-
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false);
|
|
9393
|
-
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true);
|
|
9394
|
-
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true);
|
|
9395
|
-
const other = new InstrumentType('OTHER', 'other', 'Other', false, false);
|
|
9455
|
+
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
|
|
9456
|
+
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
9457
|
+
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
9458
|
+
const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
|
|
9459
|
+
|
|
9460
|
+
const map = { };
|
|
9461
|
+
|
|
9462
|
+
map[cash.code] = cash;
|
|
9463
|
+
map[equity.code] = equity;
|
|
9464
|
+
map[fund.code] = fund;
|
|
9465
|
+
map[other.code] = other;
|
|
9396
9466
|
|
|
9397
9467
|
return InstrumentType;
|
|
9398
9468
|
})();
|
|
9399
9469
|
|
|
9400
|
-
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
|
|
9470
|
+
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":95}],52:[function(require,module,exports){
|
|
9471
|
+
const assert = require('@barchart/common-js/lang/assert'),
|
|
9472
|
+
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
9473
|
+
Enum = require('@barchart/common-js/lang/Enum');
|
|
9474
|
+
|
|
9475
|
+
module.exports = (() => {
|
|
9476
|
+
'use strict';
|
|
9477
|
+
|
|
9478
|
+
/**
|
|
9479
|
+
* Describes a position size -- positive values are long, negative values
|
|
9480
|
+
* are short and zero values are even.
|
|
9481
|
+
*
|
|
9482
|
+
* @public
|
|
9483
|
+
* @extends {Enum}
|
|
9484
|
+
* @param {String} code
|
|
9485
|
+
* @param {String} description
|
|
9486
|
+
* @param {sign} sign
|
|
9487
|
+
*/
|
|
9488
|
+
class PositionDirection extends Enum {
|
|
9489
|
+
constructor(code, description, sign) {
|
|
9490
|
+
super(code, description);
|
|
9491
|
+
|
|
9492
|
+
assert.argumentIsRequired(sign, 'sign', String);
|
|
9493
|
+
|
|
9494
|
+
this._sign = sign;
|
|
9495
|
+
}
|
|
9496
|
+
|
|
9497
|
+
/**
|
|
9498
|
+
* A description of the positiveness or negativeness of the size of the
|
|
9499
|
+
* position.
|
|
9500
|
+
*
|
|
9501
|
+
* @public
|
|
9502
|
+
* @returns {String}
|
|
9503
|
+
*/
|
|
9504
|
+
get sign() {
|
|
9505
|
+
return this._sign;
|
|
9506
|
+
}
|
|
9507
|
+
|
|
9508
|
+
/**
|
|
9509
|
+
* Indicates if the position size is positive (i.e. is {@link PositionDirection.LONG}).
|
|
9510
|
+
*
|
|
9511
|
+
* @public
|
|
9512
|
+
* @returns {boolean}
|
|
9513
|
+
*/
|
|
9514
|
+
get positive() {
|
|
9515
|
+
return this === long;
|
|
9516
|
+
}
|
|
9517
|
+
|
|
9518
|
+
/**
|
|
9519
|
+
* Indicates if the position size is negative (i.e. is {@link PositionDirection.SHORT}).
|
|
9520
|
+
*
|
|
9521
|
+
* @public
|
|
9522
|
+
* @returns {boolean}
|
|
9523
|
+
*/
|
|
9524
|
+
get negative() {
|
|
9525
|
+
return this === short;
|
|
9526
|
+
}
|
|
9527
|
+
|
|
9528
|
+
/**
|
|
9529
|
+
* Indicates if the position size is zero (i.e. is {@link PositionDirection.EVEN}).
|
|
9530
|
+
*
|
|
9531
|
+
* @public
|
|
9532
|
+
* @returns {boolean}
|
|
9533
|
+
*/
|
|
9534
|
+
get closed() {
|
|
9535
|
+
return this === even;
|
|
9536
|
+
}
|
|
9537
|
+
|
|
9538
|
+
/**
|
|
9539
|
+
* A positive quantity position.
|
|
9540
|
+
*
|
|
9541
|
+
* @public
|
|
9542
|
+
* @static
|
|
9543
|
+
* @returns {PositionDirection}
|
|
9544
|
+
*/
|
|
9545
|
+
static get LONG() {
|
|
9546
|
+
return long;
|
|
9547
|
+
}
|
|
9548
|
+
|
|
9549
|
+
/**
|
|
9550
|
+
* A positive quantity position.
|
|
9551
|
+
*
|
|
9552
|
+
* @public
|
|
9553
|
+
* @static
|
|
9554
|
+
* @returns {PositionDirection}
|
|
9555
|
+
*/
|
|
9556
|
+
static get SHORT() {
|
|
9557
|
+
return short;
|
|
9558
|
+
}
|
|
9559
|
+
|
|
9560
|
+
/**
|
|
9561
|
+
* A zero quantity position.
|
|
9562
|
+
*
|
|
9563
|
+
* @public
|
|
9564
|
+
* @static
|
|
9565
|
+
* @returns {PositionDirection}
|
|
9566
|
+
*/
|
|
9567
|
+
static get EVEN() {
|
|
9568
|
+
return even;
|
|
9569
|
+
}
|
|
9570
|
+
|
|
9571
|
+
/**
|
|
9572
|
+
* Given an open quantity, returns a {@link PositionDirection} that
|
|
9573
|
+
* describes the quantity.
|
|
9574
|
+
*
|
|
9575
|
+
* @public
|
|
9576
|
+
* @static
|
|
9577
|
+
* @param {Decimal} open
|
|
9578
|
+
* @returns {PositionDirection}
|
|
9579
|
+
*/
|
|
9580
|
+
static for(open) {
|
|
9581
|
+
assert.argumentIsRequired(open, 'open', Decimal, 'Decimal');
|
|
9582
|
+
|
|
9583
|
+
if (open.getIsPositive()) {
|
|
9584
|
+
return long;
|
|
9585
|
+
} else if (open.getIsNegative()) {
|
|
9586
|
+
return short;
|
|
9587
|
+
} else {
|
|
9588
|
+
return even;
|
|
9589
|
+
}
|
|
9590
|
+
}
|
|
9591
|
+
}
|
|
9592
|
+
|
|
9593
|
+
const long = new PositionDirection('LONG', 'Long', 'positive');
|
|
9594
|
+
const short = new PositionDirection('SHORT', 'Short', 'negative');
|
|
9595
|
+
const even = new PositionDirection('EVEN', 'Even', 'zero');
|
|
9596
|
+
|
|
9597
|
+
return PositionDirection;
|
|
9598
|
+
})();
|
|
9599
|
+
|
|
9600
|
+
},{"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],53:[function(require,module,exports){
|
|
9401
9601
|
const array = require('@barchart/common-js/lang/array'),
|
|
9402
9602
|
assert = require('@barchart/common-js/lang/assert'),
|
|
9403
9603
|
Day = require('@barchart/common-js/lang/Day'),
|
|
@@ -9654,7 +9854,7 @@ module.exports = (() => {
|
|
|
9654
9854
|
return PositionSummaryFrame;
|
|
9655
9855
|
})();
|
|
9656
9856
|
|
|
9657
|
-
},{"@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}],
|
|
9857
|
+
},{"@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){
|
|
9658
9858
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
9659
9859
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
9660
9860
|
|
|
@@ -9994,7 +10194,7 @@ module.exports = (() => {
|
|
|
9994
10194
|
return TransactionType;
|
|
9995
10195
|
})();
|
|
9996
10196
|
|
|
9997
|
-
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],
|
|
10197
|
+
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
|
|
9998
10198
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
9999
10199
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
10000
10200
|
|
|
@@ -10056,7 +10256,7 @@ module.exports = (() => {
|
|
|
10056
10256
|
return ValuationType;
|
|
10057
10257
|
})();
|
|
10058
10258
|
|
|
10059
|
-
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],
|
|
10259
|
+
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],56:[function(require,module,exports){
|
|
10060
10260
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
10061
10261
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
10062
10262
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
@@ -10226,7 +10426,7 @@ module.exports = (() => {
|
|
|
10226
10426
|
return PortfolioSchema;
|
|
10227
10427
|
})();
|
|
10228
10428
|
|
|
10229
|
-
},{"./../data/ValuationType":
|
|
10429
|
+
},{"./../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){
|
|
10230
10430
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
10231
10431
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
10232
10432
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
@@ -10236,6 +10436,7 @@ const assert = require('@barchart/common-js/lang/assert'),
|
|
|
10236
10436
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
10237
10437
|
|
|
10238
10438
|
const InstrumentType = require('./../data/InstrumentType'),
|
|
10439
|
+
PositionDirection = require('./../data/PositionDirection'),
|
|
10239
10440
|
ValuationType = require('./../data/ValuationType');
|
|
10240
10441
|
|
|
10241
10442
|
module.exports = (() => {
|
|
@@ -10308,6 +10509,7 @@ module.exports = (() => {
|
|
|
10308
10509
|
.withField('reinvest', DataType.BOOLEAN)
|
|
10309
10510
|
.withField('snapshot.date', DataType.DAY)
|
|
10310
10511
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
10512
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10311
10513
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10312
10514
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10313
10515
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10339,6 +10541,7 @@ module.exports = (() => {
|
|
|
10339
10541
|
.withField('reinvest', DataType.BOOLEAN)
|
|
10340
10542
|
.withField('snapshot.date', DataType.DAY)
|
|
10341
10543
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
10544
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10342
10545
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10343
10546
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10344
10547
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10352,7 +10555,7 @@ module.exports = (() => {
|
|
|
10352
10555
|
return PositionSchema;
|
|
10353
10556
|
})();
|
|
10354
10557
|
|
|
10355
|
-
},{"./../data/InstrumentType":51,"./../data/ValuationType":
|
|
10558
|
+
},{"./../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){
|
|
10356
10559
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
10357
10560
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
10358
10561
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
@@ -10361,7 +10564,8 @@ const assert = require('@barchart/common-js/lang/assert'),
|
|
|
10361
10564
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
10362
10565
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
10363
10566
|
|
|
10364
|
-
const
|
|
10567
|
+
const PositionDirection = require('./../data/PositionDirection'),
|
|
10568
|
+
PositionSummaryFrame = require('./../data/PositionSummaryFrame');
|
|
10365
10569
|
|
|
10366
10570
|
module.exports = (() => {
|
|
10367
10571
|
'use strict';
|
|
@@ -10431,11 +10635,13 @@ module.exports = (() => {
|
|
|
10431
10635
|
.withField('start.date', DataType.DAY)
|
|
10432
10636
|
.withField('start.sequence', DataType.NUMBER)
|
|
10433
10637
|
.withField('start.open', DataType.DECIMAL)
|
|
10638
|
+
.withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10434
10639
|
.withField('start.basis', DataType.DECIMAL)
|
|
10435
10640
|
.withField('start.value', DataType.DECIMAL)
|
|
10436
10641
|
.withField('end.date', DataType.DAY)
|
|
10437
10642
|
.withField('end.sequence', DataType.NUMBER)
|
|
10438
10643
|
.withField('end.open', DataType.DECIMAL)
|
|
10644
|
+
.withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10439
10645
|
.withField('end.basis', DataType.DECIMAL)
|
|
10440
10646
|
.withField('end.value', DataType.DECIMAL)
|
|
10441
10647
|
.withField('period.buys', DataType.DECIMAL)
|
|
@@ -10463,11 +10669,13 @@ module.exports = (() => {
|
|
|
10463
10669
|
.withField('start.date', DataType.DAY)
|
|
10464
10670
|
.withField('start.sequence', DataType.NUMBER)
|
|
10465
10671
|
.withField('start.open', DataType.DECIMAL)
|
|
10672
|
+
.withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10466
10673
|
.withField('start.basis', DataType.DECIMAL)
|
|
10467
10674
|
.withField('start.value', DataType.DECIMAL)
|
|
10468
10675
|
.withField('end.date', DataType.DAY)
|
|
10469
10676
|
.withField('end.sequence', DataType.NUMBER)
|
|
10470
10677
|
.withField('end.open', DataType.DECIMAL)
|
|
10678
|
+
.withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10471
10679
|
.withField('end.basis', DataType.DECIMAL)
|
|
10472
10680
|
.withField('end.value', DataType.DECIMAL)
|
|
10473
10681
|
.withField('period.buys', DataType.DECIMAL)
|
|
@@ -10481,7 +10689,7 @@ module.exports = (() => {
|
|
|
10481
10689
|
return PositionSummarySchema;
|
|
10482
10690
|
})();
|
|
10483
10691
|
|
|
10484
|
-
},{"./../data/
|
|
10692
|
+
},{"./../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){
|
|
10485
10693
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
10486
10694
|
is = require('@barchart/common-js/lang/is'),
|
|
10487
10695
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
@@ -10491,6 +10699,7 @@ const assert = require('@barchart/common-js/lang/assert'),
|
|
|
10491
10699
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
10492
10700
|
|
|
10493
10701
|
const InstrumentType = require('./../data/InstrumentType'),
|
|
10702
|
+
PositionDirection = require('./../data/PositionDirection'),
|
|
10494
10703
|
TransactionType = require('./../data/TransactionType');
|
|
10495
10704
|
|
|
10496
10705
|
module.exports = (() => {
|
|
@@ -10660,6 +10869,7 @@ module.exports = (() => {
|
|
|
10660
10869
|
.withField('reference.position', DataType.STRING, true)
|
|
10661
10870
|
.withField('reference.sequence', DataType.NUMBER, true)
|
|
10662
10871
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
10872
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10663
10873
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10664
10874
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10665
10875
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10703,6 +10913,7 @@ module.exports = (() => {
|
|
|
10703
10913
|
.withField('reference.position', DataType.STRING, true)
|
|
10704
10914
|
.withField('reference.sequence', DataType.NUMBER, true)
|
|
10705
10915
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
10916
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10706
10917
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10707
10918
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10708
10919
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10932,7 +11143,6 @@ module.exports = (() => {
|
|
|
10932
11143
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
10933
11144
|
.withField('date', DataType.DAY)
|
|
10934
11145
|
.withField('value', DataType.DECIMAL)
|
|
10935
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
10936
11146
|
.withField('force', DataType.BOOLEAN, true)
|
|
10937
11147
|
.schema
|
|
10938
11148
|
);
|
|
@@ -10972,7 +11182,7 @@ module.exports = (() => {
|
|
|
10972
11182
|
return TransactionSchema;
|
|
10973
11183
|
})();
|
|
10974
11184
|
|
|
10975
|
-
},{"./../data/InstrumentType":51,"./../data/TransactionType":
|
|
11185
|
+
},{"./../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){
|
|
10976
11186
|
'use strict';
|
|
10977
11187
|
|
|
10978
11188
|
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; }; }();
|
|
@@ -11010,26 +11220,27 @@ module.exports = function () {
|
|
|
11010
11220
|
* Web service gateway for obtaining JWT tokens from TGAM (The Globe and Mail).
|
|
11011
11221
|
*
|
|
11012
11222
|
* @public
|
|
11013
|
-
* @param {Enpoint} endpoint
|
|
11223
|
+
* @param {Enpoint=} endpoint
|
|
11014
11224
|
* @param {Number=} refreshInterval - Interval, in milliseconds, which a token refresh should occur. If zero, the token does not need to be refreshed.
|
|
11225
|
+
* @param {Function=} overrideDelegate - Bypasses the standard token lookup, instead calls a delegate, which returns the token.
|
|
11015
11226
|
* @extends {Disposable}
|
|
11016
11227
|
*/
|
|
11017
11228
|
|
|
11018
11229
|
var JwtGateway = function (_Disposable) {
|
|
11019
11230
|
_inherits(JwtGateway, _Disposable);
|
|
11020
11231
|
|
|
11021
|
-
function JwtGateway(
|
|
11232
|
+
function JwtGateway(tokenDelegate, refreshInterval) {
|
|
11022
11233
|
_classCallCheck(this, JwtGateway);
|
|
11023
11234
|
|
|
11024
11235
|
var _this = _possibleConstructorReturn(this, (JwtGateway.__proto__ || Object.getPrototypeOf(JwtGateway)).call(this));
|
|
11025
11236
|
|
|
11026
|
-
assert.argumentIsRequired(
|
|
11237
|
+
assert.argumentIsRequired(tokenDelegate, 'tokenDelegate', Function);
|
|
11027
11238
|
assert.argumentIsOptional(refreshInterval, 'refreshInterval', Number);
|
|
11028
11239
|
|
|
11029
11240
|
_this._started = false;
|
|
11030
11241
|
_this._startPromise = null;
|
|
11031
11242
|
|
|
11032
|
-
_this.
|
|
11243
|
+
_this._tokenDelegate = tokenDelegate;
|
|
11033
11244
|
|
|
11034
11245
|
_this._refreshInterval = refreshInterval || 0;
|
|
11035
11246
|
_this._refreshJitter = Math.floor(_this._refreshInterval / 10);
|
|
@@ -11082,7 +11293,7 @@ module.exports = function () {
|
|
|
11082
11293
|
return Promise.resolve().then(function () {
|
|
11083
11294
|
checkStart.call(_this3);
|
|
11084
11295
|
|
|
11085
|
-
return
|
|
11296
|
+
return _this3._tokenDelegate();
|
|
11086
11297
|
}).catch(function (e) {
|
|
11087
11298
|
var failure = FailureReason.forRequest({ endpoint: _this3._endpoint }).addItem(FailureType.REQUEST_IDENTITY_FAILURE).format();
|
|
11088
11299
|
|
|
@@ -11197,7 +11408,9 @@ module.exports = function () {
|
|
|
11197
11408
|
key: 'forDevelopment',
|
|
11198
11409
|
value: function forDevelopment(endpoint) {
|
|
11199
11410
|
return Promise.resolve(endpoint).then(function (e) {
|
|
11200
|
-
return start(new JwtGateway(
|
|
11411
|
+
return start(new JwtGateway(function () {
|
|
11412
|
+
return Gateway.invoke(e);
|
|
11413
|
+
}, 60000));
|
|
11201
11414
|
});
|
|
11202
11415
|
}
|
|
11203
11416
|
|
|
@@ -11206,7 +11419,7 @@ module.exports = function () {
|
|
|
11206
11419
|
*
|
|
11207
11420
|
* @public
|
|
11208
11421
|
* @static
|
|
11209
|
-
* @param {Promise.<Endpoint>|Endpoint}endpoint - The endpoint which vends JWT tokens.
|
|
11422
|
+
* @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
|
|
11210
11423
|
* @returns {Promise.<RequestInterceptor>}
|
|
11211
11424
|
*/
|
|
11212
11425
|
|
|
@@ -11277,6 +11490,40 @@ module.exports = function () {
|
|
|
11277
11490
|
return jwtGateway.toRequestInterceptor();
|
|
11278
11491
|
});
|
|
11279
11492
|
}
|
|
11493
|
+
|
|
11494
|
+
/**
|
|
11495
|
+
* Creates and starts a new {@link JwtGateway} for use by the "tracker" system.
|
|
11496
|
+
*
|
|
11497
|
+
* @public
|
|
11498
|
+
* @static
|
|
11499
|
+
* @param {Function} tokenDelegate - A function which returns the JWT token.
|
|
11500
|
+
* @returns {Promise.<JwtGateway>}
|
|
11501
|
+
*/
|
|
11502
|
+
|
|
11503
|
+
}, {
|
|
11504
|
+
key: 'forTracker',
|
|
11505
|
+
value: function forTracker(tokenDelegate) {
|
|
11506
|
+
return Promise.resolve().then(function () {
|
|
11507
|
+
return start(new JwtGateway(tokenDelegate, 0));
|
|
11508
|
+
});
|
|
11509
|
+
}
|
|
11510
|
+
|
|
11511
|
+
/**
|
|
11512
|
+
* Creates and starts a new {@link RequestInterceptor} for use by "tracker" system.
|
|
11513
|
+
*
|
|
11514
|
+
* @public
|
|
11515
|
+
* @static
|
|
11516
|
+
* @param {Function} tokenDelegate - A function which returns the JWT token.
|
|
11517
|
+
* @returns {Promise.<RequestInterceptor>}
|
|
11518
|
+
*/
|
|
11519
|
+
|
|
11520
|
+
}, {
|
|
11521
|
+
key: 'forTrackerClient',
|
|
11522
|
+
value: function forTrackerClient(tokenDelegate) {
|
|
11523
|
+
return JwtGateway.forTracker(tokenDelegate).then(function (jwtGateway) {
|
|
11524
|
+
return jwtGateway.toRequestInterceptor();
|
|
11525
|
+
});
|
|
11526
|
+
}
|
|
11280
11527
|
}]);
|
|
11281
11528
|
|
|
11282
11529
|
return JwtGateway;
|
|
@@ -11307,7 +11554,7 @@ module.exports = function () {
|
|
|
11307
11554
|
}
|
|
11308
11555
|
|
|
11309
11556
|
function forTgam(host, secret, environment) {
|
|
11310
|
-
|
|
11557
|
+
var endpoint = EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
|
|
11311
11558
|
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);
|
|
11312
11559
|
}).withHost(host).withRequestInterceptor(RequestInterceptor.fromDelegate(function (request) {
|
|
11313
11560
|
request.withCredentials = true;
|
|
@@ -11316,6 +11563,10 @@ module.exports = function () {
|
|
|
11316
11563
|
})).withResponseInterceptor(ResponseInterceptor.DATA).withResponseInterceptor(ResponseInterceptor.fromDelegate(function (response) {
|
|
11317
11564
|
return response.token;
|
|
11318
11565
|
})).endpoint;
|
|
11566
|
+
|
|
11567
|
+
return function () {
|
|
11568
|
+
return Gateway.invoke(endpoint);
|
|
11569
|
+
};
|
|
11319
11570
|
}
|
|
11320
11571
|
|
|
11321
11572
|
function getTime() {
|
|
@@ -11325,7 +11576,7 @@ module.exports = function () {
|
|
|
11325
11576
|
return JwtGateway;
|
|
11326
11577
|
}();
|
|
11327
11578
|
|
|
11328
|
-
},{"./index":
|
|
11579
|
+
},{"./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){
|
|
11329
11580
|
'use strict';
|
|
11330
11581
|
|
|
11331
11582
|
var JwtGateway = require('./JwtGateway');
|
|
@@ -11335,13 +11586,13 @@ module.exports = function () {
|
|
|
11335
11586
|
|
|
11336
11587
|
return {
|
|
11337
11588
|
JwtGateway: JwtGateway,
|
|
11338
|
-
version: '1.0.
|
|
11589
|
+
version: '1.0.39'
|
|
11339
11590
|
};
|
|
11340
11591
|
}();
|
|
11341
11592
|
|
|
11342
|
-
},{"./JwtGateway":
|
|
11593
|
+
},{"./JwtGateway":60}],62:[function(require,module,exports){
|
|
11343
11594
|
module.exports = require('./lib/axios');
|
|
11344
|
-
},{"./lib/axios":
|
|
11595
|
+
},{"./lib/axios":64}],63:[function(require,module,exports){
|
|
11345
11596
|
(function (process){
|
|
11346
11597
|
'use strict';
|
|
11347
11598
|
|
|
@@ -11525,7 +11776,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
11525
11776
|
};
|
|
11526
11777
|
|
|
11527
11778
|
}).call(this,require('_process'))
|
|
11528
|
-
},{"../core/createError":
|
|
11779
|
+
},{"../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){
|
|
11529
11780
|
'use strict';
|
|
11530
11781
|
|
|
11531
11782
|
var utils = require('./utils');
|
|
@@ -11579,7 +11830,7 @@ module.exports = axios;
|
|
|
11579
11830
|
// Allow use of default import syntax in TypeScript
|
|
11580
11831
|
module.exports.default = axios;
|
|
11581
11832
|
|
|
11582
|
-
},{"./cancel/Cancel":
|
|
11833
|
+
},{"./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){
|
|
11583
11834
|
'use strict';
|
|
11584
11835
|
|
|
11585
11836
|
/**
|
|
@@ -11600,7 +11851,7 @@ Cancel.prototype.__CANCEL__ = true;
|
|
|
11600
11851
|
|
|
11601
11852
|
module.exports = Cancel;
|
|
11602
11853
|
|
|
11603
|
-
},{}],
|
|
11854
|
+
},{}],66:[function(require,module,exports){
|
|
11604
11855
|
'use strict';
|
|
11605
11856
|
|
|
11606
11857
|
var Cancel = require('./Cancel');
|
|
@@ -11659,14 +11910,14 @@ CancelToken.source = function source() {
|
|
|
11659
11910
|
|
|
11660
11911
|
module.exports = CancelToken;
|
|
11661
11912
|
|
|
11662
|
-
},{"./Cancel":
|
|
11913
|
+
},{"./Cancel":65}],67:[function(require,module,exports){
|
|
11663
11914
|
'use strict';
|
|
11664
11915
|
|
|
11665
11916
|
module.exports = function isCancel(value) {
|
|
11666
11917
|
return !!(value && value.__CANCEL__);
|
|
11667
11918
|
};
|
|
11668
11919
|
|
|
11669
|
-
},{}],
|
|
11920
|
+
},{}],68:[function(require,module,exports){
|
|
11670
11921
|
'use strict';
|
|
11671
11922
|
|
|
11672
11923
|
var defaults = require('./../defaults');
|
|
@@ -11747,7 +11998,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
11747
11998
|
|
|
11748
11999
|
module.exports = Axios;
|
|
11749
12000
|
|
|
11750
|
-
},{"./../defaults":
|
|
12001
|
+
},{"./../defaults":75,"./../utils":86,"./InterceptorManager":69,"./dispatchRequest":71}],69:[function(require,module,exports){
|
|
11751
12002
|
'use strict';
|
|
11752
12003
|
|
|
11753
12004
|
var utils = require('./../utils');
|
|
@@ -11801,7 +12052,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
11801
12052
|
|
|
11802
12053
|
module.exports = InterceptorManager;
|
|
11803
12054
|
|
|
11804
|
-
},{"./../utils":
|
|
12055
|
+
},{"./../utils":86}],70:[function(require,module,exports){
|
|
11805
12056
|
'use strict';
|
|
11806
12057
|
|
|
11807
12058
|
var enhanceError = require('./enhanceError');
|
|
@@ -11821,7 +12072,7 @@ module.exports = function createError(message, config, code, request, response)
|
|
|
11821
12072
|
return enhanceError(error, config, code, request, response);
|
|
11822
12073
|
};
|
|
11823
12074
|
|
|
11824
|
-
},{"./enhanceError":
|
|
12075
|
+
},{"./enhanceError":72}],71:[function(require,module,exports){
|
|
11825
12076
|
'use strict';
|
|
11826
12077
|
|
|
11827
12078
|
var utils = require('./../utils');
|
|
@@ -11909,7 +12160,7 @@ module.exports = function dispatchRequest(config) {
|
|
|
11909
12160
|
});
|
|
11910
12161
|
};
|
|
11911
12162
|
|
|
11912
|
-
},{"../cancel/isCancel":
|
|
12163
|
+
},{"../cancel/isCancel":67,"../defaults":75,"./../helpers/combineURLs":79,"./../helpers/isAbsoluteURL":81,"./../utils":86,"./transformData":74}],72:[function(require,module,exports){
|
|
11913
12164
|
'use strict';
|
|
11914
12165
|
|
|
11915
12166
|
/**
|
|
@@ -11932,7 +12183,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
|
|
|
11932
12183
|
return error;
|
|
11933
12184
|
};
|
|
11934
12185
|
|
|
11935
|
-
},{}],
|
|
12186
|
+
},{}],73:[function(require,module,exports){
|
|
11936
12187
|
'use strict';
|
|
11937
12188
|
|
|
11938
12189
|
var createError = require('./createError');
|
|
@@ -11960,7 +12211,7 @@ module.exports = function settle(resolve, reject, response) {
|
|
|
11960
12211
|
}
|
|
11961
12212
|
};
|
|
11962
12213
|
|
|
11963
|
-
},{"./createError":
|
|
12214
|
+
},{"./createError":70}],74:[function(require,module,exports){
|
|
11964
12215
|
'use strict';
|
|
11965
12216
|
|
|
11966
12217
|
var utils = require('./../utils');
|
|
@@ -11982,7 +12233,7 @@ module.exports = function transformData(data, headers, fns) {
|
|
|
11982
12233
|
return data;
|
|
11983
12234
|
};
|
|
11984
12235
|
|
|
11985
|
-
},{"./../utils":
|
|
12236
|
+
},{"./../utils":86}],75:[function(require,module,exports){
|
|
11986
12237
|
(function (process){
|
|
11987
12238
|
'use strict';
|
|
11988
12239
|
|
|
@@ -12078,7 +12329,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
12078
12329
|
module.exports = defaults;
|
|
12079
12330
|
|
|
12080
12331
|
}).call(this,require('_process'))
|
|
12081
|
-
},{"./adapters/http":
|
|
12332
|
+
},{"./adapters/http":63,"./adapters/xhr":63,"./helpers/normalizeHeaderName":83,"./utils":86,"_process":88}],76:[function(require,module,exports){
|
|
12082
12333
|
'use strict';
|
|
12083
12334
|
|
|
12084
12335
|
module.exports = function bind(fn, thisArg) {
|
|
@@ -12091,7 +12342,7 @@ module.exports = function bind(fn, thisArg) {
|
|
|
12091
12342
|
};
|
|
12092
12343
|
};
|
|
12093
12344
|
|
|
12094
|
-
},{}],
|
|
12345
|
+
},{}],77:[function(require,module,exports){
|
|
12095
12346
|
'use strict';
|
|
12096
12347
|
|
|
12097
12348
|
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
|
@@ -12129,7 +12380,7 @@ function btoa(input) {
|
|
|
12129
12380
|
|
|
12130
12381
|
module.exports = btoa;
|
|
12131
12382
|
|
|
12132
|
-
},{}],
|
|
12383
|
+
},{}],78:[function(require,module,exports){
|
|
12133
12384
|
'use strict';
|
|
12134
12385
|
|
|
12135
12386
|
var utils = require('./../utils');
|
|
@@ -12199,7 +12450,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
|
|
|
12199
12450
|
return url;
|
|
12200
12451
|
};
|
|
12201
12452
|
|
|
12202
|
-
},{"./../utils":
|
|
12453
|
+
},{"./../utils":86}],79:[function(require,module,exports){
|
|
12203
12454
|
'use strict';
|
|
12204
12455
|
|
|
12205
12456
|
/**
|
|
@@ -12215,7 +12466,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
|
|
|
12215
12466
|
: baseURL;
|
|
12216
12467
|
};
|
|
12217
12468
|
|
|
12218
|
-
},{}],
|
|
12469
|
+
},{}],80:[function(require,module,exports){
|
|
12219
12470
|
'use strict';
|
|
12220
12471
|
|
|
12221
12472
|
var utils = require('./../utils');
|
|
@@ -12270,7 +12521,7 @@ module.exports = (
|
|
|
12270
12521
|
})()
|
|
12271
12522
|
);
|
|
12272
12523
|
|
|
12273
|
-
},{"./../utils":
|
|
12524
|
+
},{"./../utils":86}],81:[function(require,module,exports){
|
|
12274
12525
|
'use strict';
|
|
12275
12526
|
|
|
12276
12527
|
/**
|
|
@@ -12286,7 +12537,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
12286
12537
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
12287
12538
|
};
|
|
12288
12539
|
|
|
12289
|
-
},{}],
|
|
12540
|
+
},{}],82:[function(require,module,exports){
|
|
12290
12541
|
'use strict';
|
|
12291
12542
|
|
|
12292
12543
|
var utils = require('./../utils');
|
|
@@ -12356,7 +12607,7 @@ module.exports = (
|
|
|
12356
12607
|
})()
|
|
12357
12608
|
);
|
|
12358
12609
|
|
|
12359
|
-
},{"./../utils":
|
|
12610
|
+
},{"./../utils":86}],83:[function(require,module,exports){
|
|
12360
12611
|
'use strict';
|
|
12361
12612
|
|
|
12362
12613
|
var utils = require('../utils');
|
|
@@ -12370,7 +12621,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
|
12370
12621
|
});
|
|
12371
12622
|
};
|
|
12372
12623
|
|
|
12373
|
-
},{"../utils":
|
|
12624
|
+
},{"../utils":86}],84:[function(require,module,exports){
|
|
12374
12625
|
'use strict';
|
|
12375
12626
|
|
|
12376
12627
|
var utils = require('./../utils');
|
|
@@ -12425,7 +12676,7 @@ module.exports = function parseHeaders(headers) {
|
|
|
12425
12676
|
return parsed;
|
|
12426
12677
|
};
|
|
12427
12678
|
|
|
12428
|
-
},{"./../utils":
|
|
12679
|
+
},{"./../utils":86}],85:[function(require,module,exports){
|
|
12429
12680
|
'use strict';
|
|
12430
12681
|
|
|
12431
12682
|
/**
|
|
@@ -12454,7 +12705,7 @@ module.exports = function spread(callback) {
|
|
|
12454
12705
|
};
|
|
12455
12706
|
};
|
|
12456
12707
|
|
|
12457
|
-
},{}],
|
|
12708
|
+
},{}],86:[function(require,module,exports){
|
|
12458
12709
|
'use strict';
|
|
12459
12710
|
|
|
12460
12711
|
var bind = require('./helpers/bind');
|
|
@@ -12759,7 +13010,7 @@ module.exports = {
|
|
|
12759
13010
|
trim: trim
|
|
12760
13011
|
};
|
|
12761
13012
|
|
|
12762
|
-
},{"./helpers/bind":
|
|
13013
|
+
},{"./helpers/bind":76,"is-buffer":89}],87:[function(require,module,exports){
|
|
12763
13014
|
/*
|
|
12764
13015
|
* big.js v5.0.3
|
|
12765
13016
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
@@ -13700,7 +13951,7 @@ module.exports = {
|
|
|
13700
13951
|
}
|
|
13701
13952
|
})(this);
|
|
13702
13953
|
|
|
13703
|
-
},{}],
|
|
13954
|
+
},{}],88:[function(require,module,exports){
|
|
13704
13955
|
// shim for using process in browser
|
|
13705
13956
|
var process = module.exports = {};
|
|
13706
13957
|
|
|
@@ -13886,7 +14137,7 @@ process.chdir = function (dir) {
|
|
|
13886
14137
|
};
|
|
13887
14138
|
process.umask = function() { return 0; };
|
|
13888
14139
|
|
|
13889
|
-
},{}],
|
|
14140
|
+
},{}],89:[function(require,module,exports){
|
|
13890
14141
|
/*!
|
|
13891
14142
|
* Determine if an object is a Buffer
|
|
13892
14143
|
*
|
|
@@ -13909,7 +14160,7 @@ function isSlowBuffer (obj) {
|
|
|
13909
14160
|
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
|
13910
14161
|
}
|
|
13911
14162
|
|
|
13912
|
-
},{}],
|
|
14163
|
+
},{}],90:[function(require,module,exports){
|
|
13913
14164
|
//! moment-timezone.js
|
|
13914
14165
|
//! version : 0.5.11
|
|
13915
14166
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -15111,7 +15362,7 @@ function isSlowBuffer (obj) {
|
|
|
15111
15362
|
return moment;
|
|
15112
15363
|
}));
|
|
15113
15364
|
|
|
15114
|
-
},{"moment":
|
|
15365
|
+
},{"moment":94}],91:[function(require,module,exports){
|
|
15115
15366
|
module.exports={
|
|
15116
15367
|
"version": "2016j",
|
|
15117
15368
|
"zones": [
|
|
@@ -15711,11 +15962,11 @@ module.exports={
|
|
|
15711
15962
|
"Pacific/Pohnpei|Pacific/Ponape"
|
|
15712
15963
|
]
|
|
15713
15964
|
}
|
|
15714
|
-
},{}],
|
|
15965
|
+
},{}],92:[function(require,module,exports){
|
|
15715
15966
|
var moment = module.exports = require("./moment-timezone");
|
|
15716
15967
|
moment.tz.load(require('./data/packed/latest.json'));
|
|
15717
15968
|
|
|
15718
|
-
},{"./data/packed/latest.json":
|
|
15969
|
+
},{"./data/packed/latest.json":91,"./moment-timezone":93}],93:[function(require,module,exports){
|
|
15719
15970
|
//! moment-timezone.js
|
|
15720
15971
|
//! version : 0.5.11
|
|
15721
15972
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -16318,7 +16569,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16318
16569
|
return moment;
|
|
16319
16570
|
}));
|
|
16320
16571
|
|
|
16321
|
-
},{"moment":
|
|
16572
|
+
},{"moment":94}],94:[function(require,module,exports){
|
|
16322
16573
|
//! moment.js
|
|
16323
16574
|
|
|
16324
16575
|
;(function (global, factory) {
|
|
@@ -19980,7 +20231,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
19980
20231
|
|
|
19981
20232
|
addUnitAlias('date', 'D');
|
|
19982
20233
|
|
|
19983
|
-
//
|
|
20234
|
+
// PRIORITY
|
|
19984
20235
|
addUnitPriority('date', 9);
|
|
19985
20236
|
|
|
19986
20237
|
// PARSING
|
|
@@ -20777,7 +21028,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
20777
21028
|
// Side effect imports
|
|
20778
21029
|
|
|
20779
21030
|
|
|
20780
|
-
hooks.version = '2.22.
|
|
21031
|
+
hooks.version = '2.22.1';
|
|
20781
21032
|
|
|
20782
21033
|
setHookCallback(createLocal);
|
|
20783
21034
|
|
|
@@ -20826,5 +21077,210 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
20826
21077
|
|
|
20827
21078
|
})));
|
|
20828
21079
|
|
|
20829
|
-
},{}]
|
|
21080
|
+
},{}],95:[function(require,module,exports){
|
|
21081
|
+
var v1 = require('./v1');
|
|
21082
|
+
var v4 = require('./v4');
|
|
21083
|
+
|
|
21084
|
+
var uuid = v4;
|
|
21085
|
+
uuid.v1 = v1;
|
|
21086
|
+
uuid.v4 = v4;
|
|
21087
|
+
|
|
21088
|
+
module.exports = uuid;
|
|
21089
|
+
|
|
21090
|
+
},{"./v1":98,"./v4":99}],96:[function(require,module,exports){
|
|
21091
|
+
/**
|
|
21092
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
21093
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
21094
|
+
*/
|
|
21095
|
+
var byteToHex = [];
|
|
21096
|
+
for (var i = 0; i < 256; ++i) {
|
|
21097
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
21098
|
+
}
|
|
21099
|
+
|
|
21100
|
+
function bytesToUuid(buf, offset) {
|
|
21101
|
+
var i = offset || 0;
|
|
21102
|
+
var bth = byteToHex;
|
|
21103
|
+
return bth[buf[i++]] + bth[buf[i++]] +
|
|
21104
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21105
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21106
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21107
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21108
|
+
bth[buf[i++]] + bth[buf[i++]] +
|
|
21109
|
+
bth[buf[i++]] + bth[buf[i++]] +
|
|
21110
|
+
bth[buf[i++]] + bth[buf[i++]];
|
|
21111
|
+
}
|
|
21112
|
+
|
|
21113
|
+
module.exports = bytesToUuid;
|
|
21114
|
+
|
|
21115
|
+
},{}],97:[function(require,module,exports){
|
|
21116
|
+
(function (global){
|
|
21117
|
+
// Unique ID creation requires a high quality random # generator. In the
|
|
21118
|
+
// browser this is a little complicated due to unknown quality of Math.random()
|
|
21119
|
+
// and inconsistent support for the `crypto` API. We do the best we can via
|
|
21120
|
+
// feature-detection
|
|
21121
|
+
var rng;
|
|
21122
|
+
|
|
21123
|
+
var crypto = global.crypto || global.msCrypto; // for IE 11
|
|
21124
|
+
if (crypto && crypto.getRandomValues) {
|
|
21125
|
+
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
|
|
21126
|
+
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
|
|
21127
|
+
rng = function whatwgRNG() {
|
|
21128
|
+
crypto.getRandomValues(rnds8);
|
|
21129
|
+
return rnds8;
|
|
21130
|
+
};
|
|
21131
|
+
}
|
|
21132
|
+
|
|
21133
|
+
if (!rng) {
|
|
21134
|
+
// Math.random()-based (RNG)
|
|
21135
|
+
//
|
|
21136
|
+
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
|
21137
|
+
// quality.
|
|
21138
|
+
var rnds = new Array(16);
|
|
21139
|
+
rng = function() {
|
|
21140
|
+
for (var i = 0, r; i < 16; i++) {
|
|
21141
|
+
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
|
21142
|
+
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
|
21143
|
+
}
|
|
21144
|
+
|
|
21145
|
+
return rnds;
|
|
21146
|
+
};
|
|
21147
|
+
}
|
|
21148
|
+
|
|
21149
|
+
module.exports = rng;
|
|
21150
|
+
|
|
21151
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
21152
|
+
},{}],98:[function(require,module,exports){
|
|
21153
|
+
var rng = require('./lib/rng');
|
|
21154
|
+
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21155
|
+
|
|
21156
|
+
// **`v1()` - Generate time-based UUID**
|
|
21157
|
+
//
|
|
21158
|
+
// Inspired by https://github.com/LiosK/UUID.js
|
|
21159
|
+
// and http://docs.python.org/library/uuid.html
|
|
21160
|
+
|
|
21161
|
+
// random #'s we need to init node and clockseq
|
|
21162
|
+
var _seedBytes = rng();
|
|
21163
|
+
|
|
21164
|
+
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
21165
|
+
var _nodeId = [
|
|
21166
|
+
_seedBytes[0] | 0x01,
|
|
21167
|
+
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
|
|
21168
|
+
];
|
|
21169
|
+
|
|
21170
|
+
// Per 4.2.2, randomize (14 bit) clockseq
|
|
21171
|
+
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
|
|
21172
|
+
|
|
21173
|
+
// Previous uuid creation time
|
|
21174
|
+
var _lastMSecs = 0, _lastNSecs = 0;
|
|
21175
|
+
|
|
21176
|
+
// See https://github.com/broofa/node-uuid for API details
|
|
21177
|
+
function v1(options, buf, offset) {
|
|
21178
|
+
var i = buf && offset || 0;
|
|
21179
|
+
var b = buf || [];
|
|
21180
|
+
|
|
21181
|
+
options = options || {};
|
|
21182
|
+
|
|
21183
|
+
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
21184
|
+
|
|
21185
|
+
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
21186
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
21187
|
+
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
21188
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
21189
|
+
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
|
|
21190
|
+
|
|
21191
|
+
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
21192
|
+
// cycle to simulate higher resolution clock
|
|
21193
|
+
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
21194
|
+
|
|
21195
|
+
// Time since last uuid creation (in msecs)
|
|
21196
|
+
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
|
21197
|
+
|
|
21198
|
+
// Per 4.2.1.2, Bump clockseq on clock regression
|
|
21199
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
21200
|
+
clockseq = clockseq + 1 & 0x3fff;
|
|
21201
|
+
}
|
|
21202
|
+
|
|
21203
|
+
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
21204
|
+
// time interval
|
|
21205
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
21206
|
+
nsecs = 0;
|
|
21207
|
+
}
|
|
21208
|
+
|
|
21209
|
+
// Per 4.2.1.2 Throw error if too many uuids are requested
|
|
21210
|
+
if (nsecs >= 10000) {
|
|
21211
|
+
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
|
21212
|
+
}
|
|
21213
|
+
|
|
21214
|
+
_lastMSecs = msecs;
|
|
21215
|
+
_lastNSecs = nsecs;
|
|
21216
|
+
_clockseq = clockseq;
|
|
21217
|
+
|
|
21218
|
+
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
21219
|
+
msecs += 12219292800000;
|
|
21220
|
+
|
|
21221
|
+
// `time_low`
|
|
21222
|
+
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
21223
|
+
b[i++] = tl >>> 24 & 0xff;
|
|
21224
|
+
b[i++] = tl >>> 16 & 0xff;
|
|
21225
|
+
b[i++] = tl >>> 8 & 0xff;
|
|
21226
|
+
b[i++] = tl & 0xff;
|
|
21227
|
+
|
|
21228
|
+
// `time_mid`
|
|
21229
|
+
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
|
21230
|
+
b[i++] = tmh >>> 8 & 0xff;
|
|
21231
|
+
b[i++] = tmh & 0xff;
|
|
21232
|
+
|
|
21233
|
+
// `time_high_and_version`
|
|
21234
|
+
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
21235
|
+
b[i++] = tmh >>> 16 & 0xff;
|
|
21236
|
+
|
|
21237
|
+
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
21238
|
+
b[i++] = clockseq >>> 8 | 0x80;
|
|
21239
|
+
|
|
21240
|
+
// `clock_seq_low`
|
|
21241
|
+
b[i++] = clockseq & 0xff;
|
|
21242
|
+
|
|
21243
|
+
// `node`
|
|
21244
|
+
var node = options.node || _nodeId;
|
|
21245
|
+
for (var n = 0; n < 6; ++n) {
|
|
21246
|
+
b[i + n] = node[n];
|
|
21247
|
+
}
|
|
21248
|
+
|
|
21249
|
+
return buf ? buf : bytesToUuid(b);
|
|
21250
|
+
}
|
|
21251
|
+
|
|
21252
|
+
module.exports = v1;
|
|
21253
|
+
|
|
21254
|
+
},{"./lib/bytesToUuid":96,"./lib/rng":97}],99:[function(require,module,exports){
|
|
21255
|
+
var rng = require('./lib/rng');
|
|
21256
|
+
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21257
|
+
|
|
21258
|
+
function v4(options, buf, offset) {
|
|
21259
|
+
var i = buf && offset || 0;
|
|
21260
|
+
|
|
21261
|
+
if (typeof(options) == 'string') {
|
|
21262
|
+
buf = options == 'binary' ? new Array(16) : null;
|
|
21263
|
+
options = null;
|
|
21264
|
+
}
|
|
21265
|
+
options = options || {};
|
|
21266
|
+
|
|
21267
|
+
var rnds = options.random || (options.rng || rng)();
|
|
21268
|
+
|
|
21269
|
+
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
21270
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
21271
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
21272
|
+
|
|
21273
|
+
// Copy bytes to buffer, if provided
|
|
21274
|
+
if (buf) {
|
|
21275
|
+
for (var ii = 0; ii < 16; ++ii) {
|
|
21276
|
+
buf[i + ii] = rnds[ii];
|
|
21277
|
+
}
|
|
21278
|
+
}
|
|
21279
|
+
|
|
21280
|
+
return buf || bytesToUuid(rnds);
|
|
21281
|
+
}
|
|
21282
|
+
|
|
21283
|
+
module.exports = v4;
|
|
21284
|
+
|
|
21285
|
+
},{"./lib/bytesToUuid":96,"./lib/rng":97}]},{},[1,5])(5)
|
|
20830
21286
|
});
|
|
@@ -213,7 +213,7 @@ module.exports = (() => {
|
|
|
213
213
|
})
|
|
214
214
|
.withBody('portfolio data')
|
|
215
215
|
.withRequestInterceptor(requestInterceptorToUse)
|
|
216
|
-
.withResponseInterceptor(
|
|
216
|
+
.withResponseInterceptor(responseInterceptorForTransactionMutateDeserialization)
|
|
217
217
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
218
218
|
.endpoint;
|
|
219
219
|
|
|
@@ -231,6 +231,7 @@ module.exports = (() => {
|
|
|
231
231
|
.withVariableParameter('sequence', 'sequence', 'sequence', false);
|
|
232
232
|
})
|
|
233
233
|
.withRequestInterceptor(requestInterceptorToUse)
|
|
234
|
+
.withResponseInterceptor(responseInterceptorForTransactionMutateDeserialization)
|
|
234
235
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
235
236
|
.endpoint;
|
|
236
237
|
|
|
@@ -480,7 +481,7 @@ module.exports = (() => {
|
|
|
480
481
|
*
|
|
481
482
|
* @public
|
|
482
483
|
* @param {Object} transaction
|
|
483
|
-
* @returns {Promise.<
|
|
484
|
+
* @returns {Promise.<TransactionMutateResult>}
|
|
484
485
|
*/
|
|
485
486
|
createTransaction(transaction) {
|
|
486
487
|
return Promise.resolve()
|
|
@@ -521,7 +522,7 @@ module.exports = (() => {
|
|
|
521
522
|
* @param {String} position
|
|
522
523
|
* @param {Number} transaction
|
|
523
524
|
* @param {Boolean=} force
|
|
524
|
-
* @returns {Promise.<
|
|
525
|
+
* @returns {Promise.<TransactionMutateResult>}
|
|
525
526
|
*/
|
|
526
527
|
deleteTransaction(portfolio, position, sequence, force) {
|
|
527
528
|
return Promise.resolve()
|
|
@@ -696,11 +697,11 @@ module.exports = (() => {
|
|
|
696
697
|
try {
|
|
697
698
|
return JSON.parse(response.data, TransactionSchema.CLIENT.schema.getReviver());
|
|
698
699
|
} catch (e) {
|
|
699
|
-
console.error('Error
|
|
700
|
+
console.error('Error deserializing transaction data', e);
|
|
700
701
|
}
|
|
701
702
|
});
|
|
702
703
|
|
|
703
|
-
const
|
|
704
|
+
const responseInterceptorForTransactionMutateDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
|
|
704
705
|
try {
|
|
705
706
|
const positions = response.data.positions.map(p => JSON.parse(p, PositionSchema.CLIENT.schema.getReviver()));
|
|
706
707
|
const summaries = response.data.summaries.map(s => JSON.parse(s, PositionSummarySchema.CLIENT.schema.getReviver()));
|
|
@@ -711,7 +712,7 @@ module.exports = (() => {
|
|
|
711
712
|
replaced: response.data.replaced
|
|
712
713
|
};
|
|
713
714
|
} catch (e) {
|
|
714
|
-
console.error('Error
|
|
715
|
+
console.error('Error deserializing mutate transaction data', e);
|
|
715
716
|
}
|
|
716
717
|
});
|
|
717
718
|
|
|
@@ -735,10 +736,11 @@ module.exports = (() => {
|
|
|
735
736
|
/**
|
|
736
737
|
* The result of transaction create operation.
|
|
737
738
|
*
|
|
738
|
-
* @typedef
|
|
739
|
+
* @typedef TransactionMutateResult
|
|
739
740
|
* @type {Object}
|
|
740
741
|
* @property {Array.<Object>} positions - All positions updated as a consequence of processing the transaction.
|
|
741
742
|
* @property {Array.<Object>} summaries - All position summaries updated as a consequence of processing the transaction.
|
|
743
|
+
* @property {Boolean} replaced - If true, the position (and position summaries) need to be replaced.
|
|
742
744
|
*/
|
|
743
745
|
|
|
744
746
|
return PortfolioGateway;
|
package/lib/index.js
CHANGED