@barchart/portfolio-client-js 1.2.4 → 1.2.7

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.
@@ -242,8 +242,20 @@ module.exports = function () {
242
242
  _this._createTransactionEndpoint = EndpointBuilder.for('create-transaction', 'create transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
243
243
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false).withLiteralParameter('transactions', 'transactions');
244
244
  }).withQueryBuilder(function (qb) {
245
- qb.withVariableParameter('type', 'type', 'type', false, function (i) {
246
- return i.code;
245
+ qb.withVariableParameter('type', 'type', 'type', false, function (t) {
246
+ return getTransactionTypeCode(t);
247
+ });
248
+ }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
249
+
250
+ _this._batchTransactionEndpoint = EndpointBuilder.for('batch-transactions', 'batch transactions').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
251
+ pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withLiteralParameter('multiple', 'multiple').withLiteralParameter('transactions', 'transactions');
252
+ }).withBody('transactions').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
253
+
254
+ _this._editTransactionEndpoint = EndpointBuilder.for('edit-transaction', 'edit transaction').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
255
+ 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);
256
+ }).withQueryBuilder(function (qb) {
257
+ qb.withVariableParameter('type', 'type', 'type', false, function (t) {
258
+ return getTransactionTypeCode(t);
247
259
  });
248
260
  }).withBody('transaction').withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionMutateDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
249
261
 
@@ -342,6 +354,28 @@ module.exports = function () {
342
354
  });
343
355
  }
344
356
 
357
+ /**
358
+ * Creates a new portfolio and immediately populates it with transactions.
359
+ *
360
+ * @public
361
+ * @param {Object} portfolio
362
+ * @return {Promise.<Portfolio>}
363
+ */
364
+
365
+ }, {
366
+ key: 'importPortfolio',
367
+ value: function importPortfolio(portfolio, transactions) {
368
+ var _this5 = this;
369
+
370
+ return Promise.resolve().then(function () {
371
+ checkStart.call(_this5);
372
+
373
+ return _this5.createPortfolio(portfolio).then(function (portfolio) {
374
+ return _this5.batchTransactions(portfolio, transactions);
375
+ });
376
+ });
377
+ }
378
+
345
379
  /**
346
380
  * Updates a portfolio
347
381
  *
@@ -353,14 +387,14 @@ module.exports = function () {
353
387
  }, {
354
388
  key: 'updatePortfolio',
355
389
  value: function updatePortfolio(portfolio) {
356
- var _this5 = this;
390
+ var _this6 = this;
357
391
 
358
392
  return Promise.resolve().then(function () {
359
- checkStart.call(_this5);
393
+ checkStart.call(_this6);
360
394
 
361
395
  assert.argumentIsRequired(portfolio, 'portfolio', Object);
362
396
 
363
- return Gateway.invoke(_this5._updatePortfolioEndpoint, PortfolioSchema.UPDATE.schema.format(portfolio));
397
+ return Gateway.invoke(_this6._updatePortfolioEndpoint, PortfolioSchema.UPDATE.schema.format(portfolio));
364
398
  });
365
399
  }
366
400
 
@@ -375,14 +409,14 @@ module.exports = function () {
375
409
  }, {
376
410
  key: 'deletePortfolio',
377
411
  value: function deletePortfolio(portfolio) {
378
- var _this6 = this;
412
+ var _this7 = this;
379
413
 
380
414
  return Promise.resolve().then(function () {
381
- checkStart.call(_this6);
415
+ checkStart.call(_this7);
382
416
 
383
417
  assert.argumentIsRequired(portfolio, 'portfolio', String);
384
418
 
385
- return Gateway.invoke(_this6._deletePortfolioEndpoint, { portfolio: portfolio });
419
+ return Gateway.invoke(_this7._deletePortfolioEndpoint, { portfolio: portfolio });
386
420
  });
387
421
  }
388
422
 
@@ -399,16 +433,16 @@ module.exports = function () {
399
433
  }, {
400
434
  key: 'readPositions',
401
435
  value: function readPositions(portfolio, position, includePreviousPrice) {
402
- var _this7 = this;
436
+ var _this8 = this;
403
437
 
404
438
  return Promise.resolve().then(function () {
405
- checkStart.call(_this7);
439
+ checkStart.call(_this8);
406
440
 
407
441
  assert.argumentIsOptional(portfolio, 'portfolio', String);
408
442
  assert.argumentIsOptional(position, 'position', String);
409
443
  assert.argumentIsOptional(includePreviousPrice, 'includePreviousPrice', Boolean);
410
444
 
411
- return Gateway.invoke(_this7._readPositionsEndpoint, { portfolio: portfolio || '*', position: position || '*', includePreviousPrice: includePreviousPrice });
445
+ return Gateway.invoke(_this8._readPositionsEndpoint, { portfolio: portfolio || '*', position: position || '*', includePreviousPrice: includePreviousPrice });
412
446
  });
413
447
  }
414
448
 
@@ -423,14 +457,14 @@ module.exports = function () {
423
457
  }, {
424
458
  key: 'updatePosition',
425
459
  value: function updatePosition(position) {
426
- var _this8 = this;
460
+ var _this9 = this;
427
461
 
428
462
  return Promise.resolve().then(function () {
429
- checkStart.call(_this8);
463
+ checkStart.call(_this9);
430
464
 
431
465
  assert.argumentIsRequired(position, 'position', Object);
432
466
 
433
- return Gateway.invoke(_this8._updatePositionEndpoint, PositionSchema.UPDATE.schema.format(position));
467
+ return Gateway.invoke(_this9._updatePositionEndpoint, PositionSchema.UPDATE.schema.format(position));
434
468
  });
435
469
  }
436
470
 
@@ -449,10 +483,10 @@ module.exports = function () {
449
483
  }, {
450
484
  key: 'readPositionSummaries',
451
485
  value: function readPositionSummaries(portfolio, position, frames, periods, start) {
452
- var _this9 = this;
486
+ var _this10 = this;
453
487
 
454
488
  return Promise.resolve().then(function () {
455
- checkStart.call(_this9);
489
+ checkStart.call(_this10);
456
490
 
457
491
  assert.argumentIsOptional(portfolio, 'portfolio', String);
458
492
  assert.argumentIsOptional(position, 'position', String);
@@ -505,7 +539,7 @@ module.exports = function () {
505
539
  query.start = s;
506
540
  }
507
541
 
508
- return Gateway.invoke(_this9._readPositionSummariesEndpoint, query);
542
+ return Gateway.invoke(_this10._readPositionSummariesEndpoint, query);
509
543
  });
510
544
  }
511
545
 
@@ -521,20 +555,20 @@ module.exports = function () {
521
555
  }, {
522
556
  key: 'deletePosition',
523
557
  value: function deletePosition(portfolio, position) {
524
- var _this10 = this;
558
+ var _this11 = this;
525
559
 
526
560
  return Promise.resolve().then(function () {
527
- checkStart.call(_this10);
561
+ checkStart.call(_this11);
528
562
 
529
563
  assert.argumentIsRequired(portfolio, 'portfolio', String);
530
564
  assert.argumentIsRequired(position, 'position', String);
531
565
 
532
- return Gateway.invoke(_this10._deletePositionEndpoint, { portfolio: portfolio, position: position });
566
+ return Gateway.invoke(_this11._deletePositionEndpoint, { portfolio: portfolio, position: position });
533
567
  });
534
568
  }
535
569
 
536
570
  /**
537
- * Retrieves transactions for a portfolio, or a single position.
571
+ * Creates a new transaction.
538
572
  *
539
573
  * @public
540
574
  * @param {Object} transaction
@@ -544,34 +578,91 @@ module.exports = function () {
544
578
  }, {
545
579
  key: 'createTransaction',
546
580
  value: function createTransaction(transaction) {
547
- var _this11 = this;
581
+ var _this12 = this;
548
582
 
549
583
  return Promise.resolve().then(function () {
550
- checkStart.call(_this11);
584
+ checkStart.call(_this12);
551
585
 
552
586
  assert.argumentIsRequired(transaction, 'transaction', Object);
553
587
  assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
554
588
  assert.argumentIsOptional(transaction.position, 'transaction.position', String);
555
589
 
556
- var code = void 0;
590
+ if (!transaction.position) {
591
+ transaction.position = 'new';
592
+ }
557
593
 
558
- if (is.string(transaction.type)) {
559
- assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
594
+ var schema = getTransactionSchema(transaction);
560
595
 
561
- code = transaction.type;
562
- } else {
563
- assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
596
+ return Gateway.invoke(_this12._createTransactionEndpoint, schema.schema.format(transaction));
597
+ });
598
+ }
564
599
 
565
- code = transaction.type.code;
566
- }
600
+ /**
601
+ * Creates one or more new transactions.
602
+ *
603
+ * @public
604
+ * @param {Object} transaction
605
+ * @returns {Promise}
606
+ */
567
607
 
568
- if (!transaction.position) {
569
- transaction.position = 'new';
570
- }
608
+ }, {
609
+ key: 'batchTransactions',
610
+ value: function batchTransactions(portfolio, transactions) {
611
+ var _this13 = this;
612
+
613
+ return Promise.resolve().then(function () {
614
+ checkStart.call(_this13);
615
+
616
+ assert.argumentIsRequired(portfolio, 'portfolio', Object);
617
+ assert.argumentIsArray(transactions, 'transactions', Object);
618
+
619
+ var batchData = transactions.reduce(function (data, transaction) {
620
+ transaction.portfolio = portfolio.portfolio;
621
+
622
+ if (!transaction.position) {
623
+ transaction.position = 'new';
624
+ }
625
+
626
+ var code = getTransactionTypeCode(transaction);
627
+ var schema = getTransactionSchema(transaction);
628
+
629
+ data.types.push(code);
630
+ data.transactions.push(JSON.stringify(schema.schema.format(transaction)));
631
+
632
+ return data;
633
+ }, {
634
+ types: [],
635
+ transactions: []
636
+ });
637
+
638
+ return Gateway.invoke(_this13._batchTransactionEndpoint, batchData);
639
+ });
640
+ }
641
+
642
+ /**
643
+ * Edits a transaction.
644
+ *
645
+ * @public
646
+ * @param {Object} transaction
647
+ * @returns {Promise.<TransactionMutateResult>}
648
+ */
571
649
 
572
- var schema = TransactionSchema.forCreate(Enum.fromCode(TransactionType, code));
650
+ }, {
651
+ key: 'editTransaction',
652
+ value: function editTransaction(transaction) {
653
+ var _this14 = this;
573
654
 
574
- return Gateway.invoke(_this11._createTransactionEndpoint, schema.schema.format(transaction));
655
+ return Promise.resolve().then(function () {
656
+ checkStart.call(_this14);
657
+
658
+ assert.argumentIsRequired(transaction, 'transaction', Object);
659
+ assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
660
+ assert.argumentIsRequired(transaction.position, 'transaction.position', String);
661
+ assert.argumentIsRequired(transaction.sequence, 'transaction.sequence', Number);
662
+
663
+ var schema = getTransactionSchema(transaction);
664
+
665
+ return Gateway.invoke(_this14._editTransactionEndpoint, schema.schema.format(transaction));
575
666
  });
576
667
  }
577
668
 
@@ -590,10 +681,10 @@ module.exports = function () {
590
681
  }, {
591
682
  key: 'deleteTransaction',
592
683
  value: function deleteTransaction(portfolio, position, sequence, force, echo) {
593
- var _this12 = this;
684
+ var _this15 = this;
594
685
 
595
686
  return Promise.resolve().then(function () {
596
- checkStart.call(_this12);
687
+ checkStart.call(_this15);
597
688
 
598
689
  assert.argumentIsRequired(portfolio, 'portfolio', String);
599
690
  assert.argumentIsRequired(position, 'position', String);
@@ -601,7 +692,7 @@ module.exports = function () {
601
692
  assert.argumentIsOptional(force, 'force', Boolean);
602
693
  assert.argumentIsOptional(echo, 'echo', Boolean);
603
694
 
604
- return Gateway.invoke(_this12._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force, echo: is.boolean(echo) && echo });
695
+ return Gateway.invoke(_this15._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force, echo: is.boolean(echo) && echo });
605
696
  });
606
697
  }
607
698
 
@@ -617,29 +708,29 @@ module.exports = function () {
617
708
  }, {
618
709
  key: 'readTransactions',
619
710
  value: function readTransactions(portfolio, position) {
620
- var _this13 = this;
711
+ var _this16 = this;
621
712
 
622
713
  return Promise.resolve().then(function () {
623
- checkStart.call(_this13);
714
+ checkStart.call(_this16);
624
715
 
625
716
  assert.argumentIsRequired(portfolio, 'portfolio', String);
626
717
  assert.argumentIsOptional(position, 'position', String);
627
718
 
628
- return Gateway.invoke(_this13._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
719
+ return Gateway.invoke(_this16._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
629
720
  });
630
721
  }
631
722
  }, {
632
723
  key: 'readTransactionsFormatted',
633
724
  value: function readTransactionsFormatted(portfolio, position) {
634
- var _this14 = this;
725
+ var _this17 = this;
635
726
 
636
727
  return Promise.resolve().then(function () {
637
- checkStart.call(_this14);
728
+ checkStart.call(_this17);
638
729
 
639
730
  assert.argumentIsRequired(portfolio, 'portfolio', String);
640
731
  assert.argumentIsOptional(position, 'position', String);
641
732
 
642
- return Gateway.invoke(_this14._readTransactionsReportEndpoint, { portfolio: portfolio, position: position || '*' });
733
+ return Gateway.invoke(_this17._readTransactionsReportEndpoint, { portfolio: portfolio, position: position || '*' });
643
734
  });
644
735
  }
645
736
 
@@ -738,6 +829,26 @@ module.exports = function () {
738
829
  return PortfolioGateway;
739
830
  }(Disposable);
740
831
 
832
+ function getTransactionTypeCode(transaction) {
833
+ var code = void 0;
834
+
835
+ if (is.string(transaction.type)) {
836
+ assert.argumentIsRequired(transaction.type, 'transaction.type', String);
837
+
838
+ code = transaction.type;
839
+ } else {
840
+ assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
841
+
842
+ code = transaction.type.code;
843
+ }
844
+
845
+ return code;
846
+ }
847
+
848
+ function getTransactionSchema(transaction) {
849
+ return TransactionSchema.forCreate(Enum.fromCode(TransactionType, getTransactionTypeCode(transaction)));
850
+ }
851
+
741
852
  var createPortfolioRequestInterceptor = function createPortfolioRequestInterceptor(request) {
742
853
  return FailureReason.validateSchema(PortfolioSchema.CREATE, request.data).then(function () {
743
854
  return Promise.resolve(request);
@@ -1210,7 +1321,7 @@ module.exports = function () {
1210
1321
  return {
1211
1322
  JwtGateway: JwtGateway,
1212
1323
  PortfolioGateway: PortfolioGateway,
1213
- version: '1.2.4'
1324
+ version: '1.2.7'
1214
1325
  };
1215
1326
  }();
1216
1327
 
@@ -229,7 +229,47 @@ module.exports = (() => {
229
229
  .withLiteralParameter('transactions', 'transactions');
230
230
  })
231
231
  .withQueryBuilder((qb) => {
232
- qb.withVariableParameter('type', 'type', 'type', false, i => i.code);
232
+ qb.withVariableParameter('type', 'type', 'type', false, t => getTransactionTypeCode(t));
233
+ })
234
+ .withBody('transaction')
235
+ .withRequestInterceptor(requestInterceptorToUse)
236
+ .withResponseInterceptor(responseInterceptorForPositionMutateDeserialization)
237
+ .withErrorInterceptor(ErrorInterceptor.GENERAL)
238
+ .endpoint;
239
+
240
+ this._batchTransactionEndpoint = EndpointBuilder.for('batch-transactions', 'batch transactions')
241
+ .withVerb(VerbType.POST)
242
+ .withProtocol(protocolType)
243
+ .withHost(host)
244
+ .withPort(port)
245
+ .withPathBuilder((pb) => {
246
+ pb.withLiteralParameter('portfolios', 'portfolios')
247
+ .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
248
+ .withLiteralParameter('positions', 'positions')
249
+ .withLiteralParameter('multiple', 'multiple')
250
+ .withLiteralParameter('transactions', 'transactions');
251
+ })
252
+ .withBody('transactions')
253
+ .withRequestInterceptor(requestInterceptorToUse)
254
+ .withResponseInterceptor(ResponseInterceptor.DATA)
255
+ .withErrorInterceptor(ErrorInterceptor.GENERAL)
256
+ .endpoint;
257
+
258
+ this._editTransactionEndpoint = EndpointBuilder.for('edit-transaction', 'edit transaction')
259
+ .withVerb(VerbType.POST)
260
+ .withProtocol(protocolType)
261
+ .withHost(host)
262
+ .withPort(port)
263
+ .withPathBuilder((pb) => {
264
+ pb.withLiteralParameter('portfolios', 'portfolios')
265
+ .withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
266
+ .withLiteralParameter('positions', 'positions')
267
+ .withVariableParameter('position', 'position', 'position', false)
268
+ .withLiteralParameter('transactions', 'transactions')
269
+ .withVariableParameter('sequence', 'sequence', 'sequence', false)
270
+ })
271
+ .withQueryBuilder((qb) => {
272
+ qb.withVariableParameter('type', 'type', 'type', false, t => getTransactionTypeCode(t));
233
273
  })
234
274
  .withBody('transaction')
235
275
  .withRequestInterceptor(requestInterceptorToUse)
@@ -351,6 +391,25 @@ module.exports = (() => {
351
391
  });
352
392
  }
353
393
 
394
+ /**
395
+ * Creates a new portfolio and immediately populates it with transactions.
396
+ *
397
+ * @public
398
+ * @param {Object} portfolio
399
+ * @return {Promise.<Portfolio>}
400
+ */
401
+ importPortfolio(portfolio, transactions) {
402
+ return Promise.resolve()
403
+ .then(() => {
404
+ checkStart.call(this);
405
+
406
+ return this.createPortfolio(portfolio)
407
+ .then((portfolio) => {
408
+ return this.batchTransactions(portfolio, transactions);
409
+ });
410
+ });
411
+ }
412
+
354
413
  /**
355
414
  * Updates a portfolio
356
415
  *
@@ -519,7 +578,7 @@ module.exports = (() => {
519
578
  }
520
579
 
521
580
  /**
522
- * Retrieves transactions for a portfolio, or a single position.
581
+ * Creates a new transaction.
523
582
  *
524
583
  * @public
525
584
  * @param {Object} transaction
@@ -534,28 +593,77 @@ module.exports = (() => {
534
593
  assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
535
594
  assert.argumentIsOptional(transaction.position, 'transaction.position', String);
536
595
 
537
- let code;
538
-
539
- if (is.string(transaction.type)) {
540
- assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
541
-
542
- code = transaction.type;
543
- } else {
544
- assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
545
-
546
- code = transaction.type.code;
547
- }
548
-
549
596
  if (!transaction.position) {
550
597
  transaction.position = 'new';
551
598
  }
552
599
 
553
- const schema = TransactionSchema.forCreate(Enum.fromCode(TransactionType, code));
600
+ const schema = getTransactionSchema(transaction);
554
601
 
555
602
  return Gateway.invoke(this._createTransactionEndpoint, schema.schema.format(transaction));
556
603
  });
557
604
  }
558
605
 
606
+ /**
607
+ * Creates one or more new transactions.
608
+ *
609
+ * @public
610
+ * @param {Object} transaction
611
+ * @returns {Promise}
612
+ */
613
+ batchTransactions(portfolio, transactions) {
614
+ return Promise.resolve()
615
+ .then(() => {
616
+ checkStart.call(this);
617
+
618
+ assert.argumentIsRequired(portfolio, 'portfolio', Object);
619
+ assert.argumentIsArray(transactions, 'transactions', Object);
620
+
621
+ const batchData = transactions.reduce((data, transaction) => {
622
+ transaction.portfolio = portfolio.portfolio;
623
+
624
+ if (!transaction.position) {
625
+ transaction.position = 'new';
626
+ }
627
+
628
+ const code = getTransactionTypeCode(transaction);
629
+ const schema = getTransactionSchema(transaction);
630
+
631
+ data.types.push(code);
632
+ data.transactions.push(JSON.stringify(schema.schema.format(transaction)));
633
+
634
+ return data;
635
+ }, {
636
+ types: [ ],
637
+ transactions: [ ]
638
+ });
639
+
640
+ return Gateway.invoke(this._batchTransactionEndpoint, batchData);
641
+ });
642
+ }
643
+
644
+ /**
645
+ * Edits a transaction.
646
+ *
647
+ * @public
648
+ * @param {Object} transaction
649
+ * @returns {Promise.<TransactionMutateResult>}
650
+ */
651
+ editTransaction(transaction) {
652
+ return Promise.resolve()
653
+ .then(() => {
654
+ checkStart.call(this);
655
+
656
+ assert.argumentIsRequired(transaction, 'transaction', Object);
657
+ assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
658
+ assert.argumentIsRequired(transaction.position, 'transaction.position', String);
659
+ assert.argumentIsRequired(transaction.sequence, 'transaction.sequence', Number);
660
+
661
+ const schema = getTransactionSchema(transaction);
662
+
663
+ return Gateway.invoke(this._editTransactionEndpoint, schema.schema.format(transaction));
664
+ });
665
+ }
666
+
559
667
  /**
560
668
  * Deletes a transaction.
561
669
  *
@@ -691,6 +799,26 @@ module.exports = (() => {
691
799
  }
692
800
  }
693
801
 
802
+ function getTransactionTypeCode(transaction) {
803
+ let code;
804
+
805
+ if (is.string(transaction.type)) {
806
+ assert.argumentIsRequired(transaction.type, 'transaction.type', String);
807
+
808
+ code = transaction.type;
809
+ } else {
810
+ assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
811
+
812
+ code = transaction.type.code;
813
+ }
814
+
815
+ return code;
816
+ }
817
+
818
+ function getTransactionSchema(transaction) {
819
+ return TransactionSchema.forCreate(Enum.fromCode(TransactionType, getTransactionTypeCode(transaction)));
820
+ }
821
+
694
822
  const createPortfolioRequestInterceptor = (request) => {
695
823
  return FailureReason.validateSchema(PortfolioSchema.CREATE, request.data)
696
824
  .then(() => {
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.2.4'
10
+ version: '1.2.7'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.2.4",
3
+ "version": "1.2.7",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",