@barchart/portfolio-client-js 1.1.40 → 1.1.43

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.
@@ -244,7 +244,7 @@ module.exports = function () {
244
244
  }).withBody('portfolio data').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForTransactionCreateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
245
245
 
246
246
  _this._deleteTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions').withVerb(VerbType.DELETE).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
247
- pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions').withVariableParameter('transaction', 'transaction', 'transaction', false);
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
248
  }).withRequestInterceptor(requestInterceptorToUse).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
249
249
 
250
250
  _this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transactions', 'read transactions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
@@ -553,13 +553,13 @@ module.exports = function () {
553
553
  * @public
554
554
  * @param {String} portfolio
555
555
  * @param {String} position
556
- * @param {String} transaction
556
+ * @param {Number} transaction
557
557
  * @returns {Promise.<Transaction[]>}
558
558
  */
559
559
 
560
560
  }, {
561
561
  key: 'deleteTransaction',
562
- value: function deleteTransaction(portfolio, position, transaction) {
562
+ value: function deleteTransaction(portfolio, position, sequence) {
563
563
  var _this11 = this;
564
564
 
565
565
  return Promise.resolve().then(function () {
@@ -567,9 +567,9 @@ module.exports = function () {
567
567
 
568
568
  assert.argumentIsRequired(portfolio, 'portfolio', String);
569
569
  assert.argumentIsRequired(position, 'position', String);
570
- assert.argumentIsRequired(transaction, 'transaction', String);
570
+ assert.argumentIsRequired(sequence, 'sequence', Number);
571
571
 
572
- return Gateway.invoke(_this11._deleteTransactionsEndpoint, { portfolio: portfolio, position: position, transaction: transaction });
572
+ return Gateway.invoke(_this11._deleteTransactionsEndpoint, { portfolio: portfolio, position: position, sequence: sequence });
573
573
  });
574
574
  }
575
575
 
@@ -1060,8 +1060,8 @@ module.exports = function () {
1060
1060
 
1061
1061
  }, {
1062
1062
  key: 'forStagingClient',
1063
- value: function forStagingClient(externalRequestInterceptor) {
1064
- return JwtGateway.forStaging(externalRequestInterceptor).then(function (jwtGateway) {
1063
+ value: function forStagingClient(externalRequestInterceptorPromise) {
1064
+ return JwtGateway.forStaging(externalRequestInterceptorPromise).then(function (jwtGateway) {
1065
1065
  return jwtGateway.toRequestInterceptor();
1066
1066
  });
1067
1067
  }
@@ -1077,7 +1077,7 @@ module.exports = function () {
1077
1077
 
1078
1078
  }, {
1079
1079
  key: 'forProduction',
1080
- value: function forProduction(externalRequestInterceptor) {
1080
+ value: function forProduction(externalRequestInterceptorPromise) {
1081
1081
  return externalRequestInterceptorPromise.then(function (externalRequestInterceptor) {
1082
1082
  return start(new JwtGateway(_forProduction(externalRequestInterceptor), 300000));
1083
1083
  });
@@ -1094,8 +1094,8 @@ module.exports = function () {
1094
1094
 
1095
1095
  }, {
1096
1096
  key: 'forProductionClient',
1097
- value: function forProductionClient(externalRequestInterceptor) {
1098
- return JwtGateway.forProduction(externalRequestInterceptor).then(function (jwtGateway) {
1097
+ value: function forProductionClient(externalRequestInterceptorPromise) {
1098
+ return JwtGateway.forProduction(externalRequestInterceptorPromise).then(function (jwtGateway) {
1099
1099
  return jwtGateway.toRequestInterceptor();
1100
1100
  });
1101
1101
  }
@@ -1155,7 +1155,7 @@ module.exports = function () {
1155
1155
  return {
1156
1156
  JwtGateway: JwtGateway,
1157
1157
  PortfolioGateway: PortfolioGateway,
1158
- version: '1.1.40'
1158
+ version: '1.1.43'
1159
1159
  };
1160
1160
  }();
1161
1161
 
@@ -9277,6 +9277,8 @@ module.exports = function () {
9277
9277
  }();
9278
9278
 
9279
9279
  },{"./../lang/Disposable":31,"./../lang/assert":37,"./../lang/is":40,"./../lang/object":41,"./../lang/promise":42}],51:[function(require,module,exports){
9280
+ const uuid = require('uuid');
9281
+
9280
9282
  const assert = require('@barchart/common-js/lang/assert'),
9281
9283
  Enum = require('@barchart/common-js/lang/Enum');
9282
9284
 
@@ -9295,16 +9297,19 @@ module.exports = (() => {
9295
9297
  * @param {Boolean} usesSymbols
9296
9298
  */
9297
9299
  class InstrumentType extends Enum {
9298
- constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
9300
+ constructor(code, description, alternateDescription, canReinvest, usesSymbols, generator) {
9299
9301
  super(code, description);
9300
9302
 
9301
9303
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
9302
9304
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
9303
9305
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
9306
+ assert.argumentIsRequired(generator, 'generator', Function);
9304
9307
 
9305
9308
  this._alternateDescription = alternateDescription;
9306
9309
  this._canReinvest = canReinvest;
9307
9310
  this._usesSymbols = usesSymbols;
9311
+
9312
+ this._generator = generator;
9308
9313
  }
9309
9314
 
9310
9315
  /**
@@ -9337,6 +9342,23 @@ module.exports = (() => {
9337
9342
  return this._usesSymbols;
9338
9343
  }
9339
9344
 
9345
+ /**
9346
+ * Generates an identifier for the instrument.
9347
+ *
9348
+ * @public
9349
+ * @param {Object} instrument
9350
+ * @returns {String}
9351
+ */
9352
+ generateIdentifier(instrument) {
9353
+ assert.argumentIsRequired(instrument, 'instrument');
9354
+
9355
+ if (instrument.type !== this) {
9356
+ throw new Error('Unable to generate instrument identifier for incompatible type.');
9357
+ }
9358
+
9359
+ return this._generator(instrument);
9360
+ }
9361
+
9340
9362
  /**
9341
9363
  * Cash.
9342
9364
  *
@@ -9381,20 +9403,39 @@ module.exports = (() => {
9381
9403
  return other;
9382
9404
  }
9383
9405
 
9406
+ /**
9407
+ * Generates an identifier for the instrument.
9408
+ *
9409
+ * @static
9410
+ * @public
9411
+ * @param {Object} instrument
9412
+ * @returns {String}
9413
+ */
9414
+ static generateIdentifier(instrument) {
9415
+ return map[instrument.type.code].generateIdentifier(instrument);
9416
+ }
9417
+
9384
9418
  toString() {
9385
9419
  return '[InstrumentType]';
9386
9420
  }
9387
9421
  }
9388
9422
 
9389
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false);
9390
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true);
9391
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true);
9392
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false);
9423
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
9424
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
9425
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
9426
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
9427
+
9428
+ const map = { };
9429
+
9430
+ map[cash.code] = cash;
9431
+ map[equity.code] = equity;
9432
+ map[fund.code] = fund;
9433
+ map[other.code] = other;
9393
9434
 
9394
9435
  return InstrumentType;
9395
9436
  })();
9396
9437
 
9397
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
9438
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":94}],52:[function(require,module,exports){
9398
9439
  const array = require('@barchart/common-js/lang/array'),
9399
9440
  assert = require('@barchart/common-js/lang/assert'),
9400
9441
  Day = require('@barchart/common-js/lang/Day'),
@@ -10929,7 +10970,6 @@ module.exports = (() => {
10929
10970
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10930
10971
  .withField('date', DataType.DAY)
10931
10972
  .withField('value', DataType.DECIMAL)
10932
- .withField('fee', DataType.DECIMAL, true)
10933
10973
  .withField('force', DataType.BOOLEAN, true)
10934
10974
  .schema
10935
10975
  );
@@ -11007,26 +11047,27 @@ module.exports = function () {
11007
11047
  * Web service gateway for obtaining JWT tokens from TGAM (The Globe and Mail).
11008
11048
  *
11009
11049
  * @public
11010
- * @param {Enpoint} endpoint
11050
+ * @param {Enpoint=} endpoint
11011
11051
  * @param {Number=} refreshInterval - Interval, in milliseconds, which a token refresh should occur. If zero, the token does not need to be refreshed.
11052
+ * @param {Function=} overrideDelegate - Bypasses the standard token lookup, instead calls a delegate, which returns the token.
11012
11053
  * @extends {Disposable}
11013
11054
  */
11014
11055
 
11015
11056
  var JwtGateway = function (_Disposable) {
11016
11057
  _inherits(JwtGateway, _Disposable);
11017
11058
 
11018
- function JwtGateway(endpoint, refreshInterval) {
11059
+ function JwtGateway(tokenDelegate, refreshInterval) {
11019
11060
  _classCallCheck(this, JwtGateway);
11020
11061
 
11021
11062
  var _this = _possibleConstructorReturn(this, (JwtGateway.__proto__ || Object.getPrototypeOf(JwtGateway)).call(this));
11022
11063
 
11023
- assert.argumentIsRequired(endpoint, 'endpoint', Endpoint, 'Endpoint');
11064
+ assert.argumentIsRequired(tokenDelegate, 'tokenDelegate', Function);
11024
11065
  assert.argumentIsOptional(refreshInterval, 'refreshInterval', Number);
11025
11066
 
11026
11067
  _this._started = false;
11027
11068
  _this._startPromise = null;
11028
11069
 
11029
- _this._endpoint = endpoint;
11070
+ _this._tokenDelegate = tokenDelegate;
11030
11071
 
11031
11072
  _this._refreshInterval = refreshInterval || 0;
11032
11073
  _this._refreshJitter = Math.floor(_this._refreshInterval / 10);
@@ -11079,7 +11120,7 @@ module.exports = function () {
11079
11120
  return Promise.resolve().then(function () {
11080
11121
  checkStart.call(_this3);
11081
11122
 
11082
- return Gateway.invoke(_this3._endpoint);
11123
+ return _this3._tokenDelegate();
11083
11124
  }).catch(function (e) {
11084
11125
  var failure = FailureReason.forRequest({ endpoint: _this3._endpoint }).addItem(FailureType.REQUEST_IDENTITY_FAILURE).format();
11085
11126
 
@@ -11194,7 +11235,9 @@ module.exports = function () {
11194
11235
  key: 'forDevelopment',
11195
11236
  value: function forDevelopment(endpoint) {
11196
11237
  return Promise.resolve(endpoint).then(function (e) {
11197
- return start(new JwtGateway(e, 60000));
11238
+ return start(new JwtGateway(function () {
11239
+ return Gateway.invoke(e);
11240
+ }, 60000));
11198
11241
  });
11199
11242
  }
11200
11243
 
@@ -11203,7 +11246,7 @@ module.exports = function () {
11203
11246
  *
11204
11247
  * @public
11205
11248
  * @static
11206
- * @param {Promise.<Endpoint>|Endpoint}endpoint - The endpoint which vends JWT tokens.
11249
+ * @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
11207
11250
  * @returns {Promise.<RequestInterceptor>}
11208
11251
  */
11209
11252
 
@@ -11274,6 +11317,40 @@ module.exports = function () {
11274
11317
  return jwtGateway.toRequestInterceptor();
11275
11318
  });
11276
11319
  }
11320
+
11321
+ /**
11322
+ * Creates and starts a new {@link JwtGateway} for use by the "tracker" system.
11323
+ *
11324
+ * @public
11325
+ * @static
11326
+ * @param {Function} tokenDelegate - A function which returns the JWT token.
11327
+ * @returns {Promise.<JwtGateway>}
11328
+ */
11329
+
11330
+ }, {
11331
+ key: 'forTracker',
11332
+ value: function forTracker(tokenDelegate) {
11333
+ return Promise.resolve().then(function () {
11334
+ return start(new JwtGateway(tokenDelegate, 0));
11335
+ });
11336
+ }
11337
+
11338
+ /**
11339
+ * Creates and starts a new {@link RequestInterceptor} for use by "tracker" system.
11340
+ *
11341
+ * @public
11342
+ * @static
11343
+ * @param {Function} tokenDelegate - A function which returns the JWT token.
11344
+ * @returns {Promise.<RequestInterceptor>}
11345
+ */
11346
+
11347
+ }, {
11348
+ key: 'forTrackerClient',
11349
+ value: function forTrackerClient(tokenDelegate) {
11350
+ return JwtGateway.forTracker(tokenDelegate).then(function (jwtGateway) {
11351
+ return jwtGateway.toRequestInterceptor();
11352
+ });
11353
+ }
11277
11354
  }]);
11278
11355
 
11279
11356
  return JwtGateway;
@@ -11304,7 +11381,7 @@ module.exports = function () {
11304
11381
  }
11305
11382
 
11306
11383
  function forTgam(host, secret, environment) {
11307
- return EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11384
+ var endpoint = EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11308
11385
  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);
11309
11386
  }).withHost(host).withRequestInterceptor(RequestInterceptor.fromDelegate(function (request) {
11310
11387
  request.withCredentials = true;
@@ -11313,6 +11390,10 @@ module.exports = function () {
11313
11390
  })).withResponseInterceptor(ResponseInterceptor.DATA).withResponseInterceptor(ResponseInterceptor.fromDelegate(function (response) {
11314
11391
  return response.token;
11315
11392
  })).endpoint;
11393
+
11394
+ return function () {
11395
+ return Gateway.invoke(endpoint);
11396
+ };
11316
11397
  }
11317
11398
 
11318
11399
  function getTime() {
@@ -11332,7 +11413,7 @@ module.exports = function () {
11332
11413
 
11333
11414
  return {
11334
11415
  JwtGateway: JwtGateway,
11335
- version: '1.0.38'
11416
+ version: '1.0.39'
11336
11417
  };
11337
11418
  }();
11338
11419
 
@@ -19977,7 +20058,7 @@ moment.tz.load(require('./data/packed/latest.json'));
19977
20058
 
19978
20059
  addUnitAlias('date', 'D');
19979
20060
 
19980
- // PRIOROITY
20061
+ // PRIORITY
19981
20062
  addUnitPriority('date', 9);
19982
20063
 
19983
20064
  // PARSING
@@ -20774,7 +20855,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20774
20855
  // Side effect imports
20775
20856
 
20776
20857
 
20777
- hooks.version = '2.22.0';
20858
+ hooks.version = '2.22.1';
20778
20859
 
20779
20860
  setHookCallback(createLocal);
20780
20861
 
@@ -20823,5 +20904,210 @@ moment.tz.load(require('./data/packed/latest.json'));
20823
20904
 
20824
20905
  })));
20825
20906
 
20826
- },{}]},{},[1,5])(5)
20907
+ },{}],94:[function(require,module,exports){
20908
+ var v1 = require('./v1');
20909
+ var v4 = require('./v4');
20910
+
20911
+ var uuid = v4;
20912
+ uuid.v1 = v1;
20913
+ uuid.v4 = v4;
20914
+
20915
+ module.exports = uuid;
20916
+
20917
+ },{"./v1":97,"./v4":98}],95:[function(require,module,exports){
20918
+ /**
20919
+ * Convert array of 16 byte values to UUID string format of the form:
20920
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
20921
+ */
20922
+ var byteToHex = [];
20923
+ for (var i = 0; i < 256; ++i) {
20924
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
20925
+ }
20926
+
20927
+ function bytesToUuid(buf, offset) {
20928
+ var i = offset || 0;
20929
+ var bth = byteToHex;
20930
+ return bth[buf[i++]] + bth[buf[i++]] +
20931
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
20932
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
20933
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
20934
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
20935
+ bth[buf[i++]] + bth[buf[i++]] +
20936
+ bth[buf[i++]] + bth[buf[i++]] +
20937
+ bth[buf[i++]] + bth[buf[i++]];
20938
+ }
20939
+
20940
+ module.exports = bytesToUuid;
20941
+
20942
+ },{}],96:[function(require,module,exports){
20943
+ (function (global){
20944
+ // Unique ID creation requires a high quality random # generator. In the
20945
+ // browser this is a little complicated due to unknown quality of Math.random()
20946
+ // and inconsistent support for the `crypto` API. We do the best we can via
20947
+ // feature-detection
20948
+ var rng;
20949
+
20950
+ var crypto = global.crypto || global.msCrypto; // for IE 11
20951
+ if (crypto && crypto.getRandomValues) {
20952
+ // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
20953
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
20954
+ rng = function whatwgRNG() {
20955
+ crypto.getRandomValues(rnds8);
20956
+ return rnds8;
20957
+ };
20958
+ }
20959
+
20960
+ if (!rng) {
20961
+ // Math.random()-based (RNG)
20962
+ //
20963
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
20964
+ // quality.
20965
+ var rnds = new Array(16);
20966
+ rng = function() {
20967
+ for (var i = 0, r; i < 16; i++) {
20968
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
20969
+ rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
20970
+ }
20971
+
20972
+ return rnds;
20973
+ };
20974
+ }
20975
+
20976
+ module.exports = rng;
20977
+
20978
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
20979
+ },{}],97:[function(require,module,exports){
20980
+ var rng = require('./lib/rng');
20981
+ var bytesToUuid = require('./lib/bytesToUuid');
20982
+
20983
+ // **`v1()` - Generate time-based UUID**
20984
+ //
20985
+ // Inspired by https://github.com/LiosK/UUID.js
20986
+ // and http://docs.python.org/library/uuid.html
20987
+
20988
+ // random #'s we need to init node and clockseq
20989
+ var _seedBytes = rng();
20990
+
20991
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
20992
+ var _nodeId = [
20993
+ _seedBytes[0] | 0x01,
20994
+ _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
20995
+ ];
20996
+
20997
+ // Per 4.2.2, randomize (14 bit) clockseq
20998
+ var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
20999
+
21000
+ // Previous uuid creation time
21001
+ var _lastMSecs = 0, _lastNSecs = 0;
21002
+
21003
+ // See https://github.com/broofa/node-uuid for API details
21004
+ function v1(options, buf, offset) {
21005
+ var i = buf && offset || 0;
21006
+ var b = buf || [];
21007
+
21008
+ options = options || {};
21009
+
21010
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
21011
+
21012
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
21013
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
21014
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
21015
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
21016
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
21017
+
21018
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
21019
+ // cycle to simulate higher resolution clock
21020
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
21021
+
21022
+ // Time since last uuid creation (in msecs)
21023
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
21024
+
21025
+ // Per 4.2.1.2, Bump clockseq on clock regression
21026
+ if (dt < 0 && options.clockseq === undefined) {
21027
+ clockseq = clockseq + 1 & 0x3fff;
21028
+ }
21029
+
21030
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
21031
+ // time interval
21032
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
21033
+ nsecs = 0;
21034
+ }
21035
+
21036
+ // Per 4.2.1.2 Throw error if too many uuids are requested
21037
+ if (nsecs >= 10000) {
21038
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
21039
+ }
21040
+
21041
+ _lastMSecs = msecs;
21042
+ _lastNSecs = nsecs;
21043
+ _clockseq = clockseq;
21044
+
21045
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
21046
+ msecs += 12219292800000;
21047
+
21048
+ // `time_low`
21049
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
21050
+ b[i++] = tl >>> 24 & 0xff;
21051
+ b[i++] = tl >>> 16 & 0xff;
21052
+ b[i++] = tl >>> 8 & 0xff;
21053
+ b[i++] = tl & 0xff;
21054
+
21055
+ // `time_mid`
21056
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
21057
+ b[i++] = tmh >>> 8 & 0xff;
21058
+ b[i++] = tmh & 0xff;
21059
+
21060
+ // `time_high_and_version`
21061
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
21062
+ b[i++] = tmh >>> 16 & 0xff;
21063
+
21064
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
21065
+ b[i++] = clockseq >>> 8 | 0x80;
21066
+
21067
+ // `clock_seq_low`
21068
+ b[i++] = clockseq & 0xff;
21069
+
21070
+ // `node`
21071
+ var node = options.node || _nodeId;
21072
+ for (var n = 0; n < 6; ++n) {
21073
+ b[i + n] = node[n];
21074
+ }
21075
+
21076
+ return buf ? buf : bytesToUuid(b);
21077
+ }
21078
+
21079
+ module.exports = v1;
21080
+
21081
+ },{"./lib/bytesToUuid":95,"./lib/rng":96}],98:[function(require,module,exports){
21082
+ var rng = require('./lib/rng');
21083
+ var bytesToUuid = require('./lib/bytesToUuid');
21084
+
21085
+ function v4(options, buf, offset) {
21086
+ var i = buf && offset || 0;
21087
+
21088
+ if (typeof(options) == 'string') {
21089
+ buf = options == 'binary' ? new Array(16) : null;
21090
+ options = null;
21091
+ }
21092
+ options = options || {};
21093
+
21094
+ var rnds = options.random || (options.rng || rng)();
21095
+
21096
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
21097
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
21098
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
21099
+
21100
+ // Copy bytes to buffer, if provided
21101
+ if (buf) {
21102
+ for (var ii = 0; ii < 16; ++ii) {
21103
+ buf[i + ii] = rnds[ii];
21104
+ }
21105
+ }
21106
+
21107
+ return buf || bytesToUuid(rnds);
21108
+ }
21109
+
21110
+ module.exports = v4;
21111
+
21112
+ },{"./lib/bytesToUuid":95,"./lib/rng":96}]},{},[1,5])(5)
20827
21113
  });
@@ -228,7 +228,7 @@ module.exports = (() => {
228
228
  .withLiteralParameter('positions', 'positions')
229
229
  .withVariableParameter('position', 'position', 'position', false)
230
230
  .withLiteralParameter('transactions', 'transactions')
231
- .withVariableParameter('transaction', 'transaction', 'transaction', false);
231
+ .withVariableParameter('sequence', 'sequence', 'sequence', false);
232
232
  })
233
233
  .withRequestInterceptor(requestInterceptorToUse)
234
234
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
@@ -519,19 +519,19 @@ module.exports = (() => {
519
519
  * @public
520
520
  * @param {String} portfolio
521
521
  * @param {String} position
522
- * @param {String} transaction
522
+ * @param {Number} transaction
523
523
  * @returns {Promise.<Transaction[]>}
524
524
  */
525
- deleteTransaction(portfolio, position, transaction) {
525
+ deleteTransaction(portfolio, position, sequence) {
526
526
  return Promise.resolve()
527
527
  .then(() => {
528
528
  checkStart.call(this);
529
529
 
530
530
  assert.argumentIsRequired(portfolio, 'portfolio', String);
531
531
  assert.argumentIsRequired(position, 'position', String);
532
- assert.argumentIsRequired(transaction, 'transaction', String);
532
+ assert.argumentIsRequired(sequence, 'sequence', Number);
533
533
 
534
- return Gateway.invoke(this._deleteTransactionsEndpoint, { portfolio: portfolio, position: position, transaction: transaction });
534
+ return Gateway.invoke(this._deleteTransactionsEndpoint, { portfolio: portfolio, position: position, sequence: sequence });
535
535
  });
536
536
  }
537
537
 
@@ -204,8 +204,8 @@ module.exports = (() => {
204
204
  * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
205
205
  * @returns {Promise.<RequestInterceptor>}
206
206
  */
207
- static forStagingClient(externalRequestInterceptor) {
208
- return JwtGateway.forStaging(externalRequestInterceptor)
207
+ static forStagingClient(externalRequestInterceptorPromise) {
208
+ return JwtGateway.forStaging(externalRequestInterceptorPromise)
209
209
  .then((jwtGateway) => {
210
210
  return jwtGateway.toRequestInterceptor();
211
211
  });
@@ -219,7 +219,7 @@ module.exports = (() => {
219
219
  * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
220
220
  * @returns {Promise.<JwtGateway>}
221
221
  */
222
- static forProduction(externalRequestInterceptor) {
222
+ static forProduction(externalRequestInterceptorPromise) {
223
223
  return externalRequestInterceptorPromise.then((externalRequestInterceptor) => {
224
224
  return start(new JwtGateway(forProduction(externalRequestInterceptor), 300000));
225
225
  });
@@ -233,8 +233,8 @@ module.exports = (() => {
233
233
  * @param {Promise.<RequestInterceptor>} externalRequestInterceptorPromise
234
234
  * @returns {Promise.<RequestInterceptor>}
235
235
  */
236
- static forProductionClient(externalRequestInterceptor) {
237
- return JwtGateway.forProduction(externalRequestInterceptor)
236
+ static forProductionClient(externalRequestInterceptorPromise) {
237
+ return JwtGateway.forProduction(externalRequestInterceptorPromise)
238
238
  .then((jwtGateway) => {
239
239
  return jwtGateway.toRequestInterceptor();
240
240
  });
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtGateway: JwtGateway,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '1.1.40'
10
+ version: '1.1.43'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.1.40",
3
+ "version": "1.1.43",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",