@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.
- package/example/example.js +12 -5
- package/lib/gateway/PortfolioGateway.js +11 -4
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.js
CHANGED
|
@@ -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
|
-
|
|
471
|
-
|
|
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',
|
|
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(
|
|
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.
|
|
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
|
-
|
|
453
|
-
|
|
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',
|
|
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(
|
|
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