@barchart/portfolio-client-js 1.1.21 → 1.1.24

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.
@@ -467,17 +467,24 @@ module.exports = function () {
467
467
  assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
468
468
  assert.argumentIsOptional(transaction.position, 'transaction.position', String);
469
469
 
470
- if (transaction.type instanceof TransactionType) {
471
- assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
470
+ var code = void 0;
471
+
472
+ if (is.string(transaction.type)) {
473
+ assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
474
+
475
+ code = transaction.type;
472
476
  } else {
473
- assert.argumentIsRequired(transaction.type, 'transaction.type', String);
477
+ assert.argumentIsRequired(transaction.type, 'transaction.type', Object);
478
+ assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
479
+
480
+ code = transaction.type.code;
474
481
  }
475
482
 
476
483
  if (!transaction.position) {
477
484
  transaction.position = 'new';
478
485
  }
479
486
 
480
- var schema = TransactionSchema.forCreate(transaction.type);
487
+ var schema = TransactionSchema.forCreate(Enum.fromCode(TransactionType, code));
481
488
 
482
489
  return Gateway.invoke(_this10._createTransactionEndpoint, schema.schema.format(transaction));
483
490
  });
@@ -1004,7 +1011,7 @@ module.exports = function () {
1004
1011
  return {
1005
1012
  JwtGateway: JwtGateway,
1006
1013
  PortfolioGateway: PortfolioGateway,
1007
- version: '1.1.21'
1014
+ version: '1.1.24'
1008
1015
  };
1009
1016
  }();
1010
1017
 
@@ -449,17 +449,24 @@ module.exports = (() => {
449
449
  assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
450
450
  assert.argumentIsOptional(transaction.position, 'transaction.position', String);
451
451
 
452
- if (transaction.type instanceof TransactionType) {
453
- assert.argumentIsRequired(transaction.type, 'transaction.type', TransactionType, 'TransactionType');
452
+ let code;
453
+
454
+ if (is.string(transaction.type)) {
455
+ assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
456
+
457
+ code = transaction.type;
454
458
  } else {
455
- assert.argumentIsRequired(transaction.type, 'transaction.type', String);
459
+ assert.argumentIsRequired(transaction.type, 'transaction.type', Object);
460
+ assert.argumentIsRequired(transaction.type.code, 'transaction.type.code', String);
461
+
462
+ code = transaction.type.code;
456
463
  }
457
464
 
458
465
  if (!transaction.position) {
459
466
  transaction.position = 'new';
460
467
  }
461
468
 
462
- const schema = TransactionSchema.forCreate(transaction.type);
469
+ const schema = TransactionSchema.forCreate(Enum.fromCode(TransactionType, code));
463
470
 
464
471
  return Gateway.invoke(this._createTransactionEndpoint, schema.schema.format(transaction));
465
472
  });
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.21'
10
+ version: '1.1.24'
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.21",
3
+ "version": "1.1.24",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",