@barchart/portfolio-client-js 1.2.18 → 1.2.21
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 +1188 -390
- package/lib/gateway/PortfolioGateway.js +85 -11
- 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; }; }();
|
|
@@ -131,7 +131,8 @@ var assert = require('@barchart/common-js/lang/assert'),
|
|
|
131
131
|
Day = require('@barchart/common-js/lang/Day'),
|
|
132
132
|
Disposable = require('@barchart/common-js/lang/Disposable'),
|
|
133
133
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
134
|
-
is = require('@barchart/common-js/lang/is')
|
|
134
|
+
is = require('@barchart/common-js/lang/is'),
|
|
135
|
+
promise = require('@barchart/common-js/lang/promise');
|
|
135
136
|
|
|
136
137
|
var TransactionType = require('@barchart/portfolio-api-common/lib/data/TransactionType');
|
|
137
138
|
|
|
@@ -191,6 +192,8 @@ module.exports = function () {
|
|
|
191
192
|
requestInterceptorToUse = RequestInterceptor.EMPTY;
|
|
192
193
|
}
|
|
193
194
|
|
|
195
|
+
_this._positionObservers = {};
|
|
196
|
+
|
|
194
197
|
_this._readPortfoliosEndpoint = EndpointBuilder.for('read-portfolios', 'read portfolios').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
195
198
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
196
199
|
}).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
@@ -272,7 +275,7 @@ module.exports = function () {
|
|
|
272
275
|
return x.format();
|
|
273
276
|
}).withVariableParameter('end', 'end', 'end', true, function (x) {
|
|
274
277
|
return x.format();
|
|
275
|
-
});
|
|
278
|
+
}).withVariableParameter('page', 'page', 'page', true).withVariableParameter('sequence', 'sequence', 'sequence', true).withVariableParameter('count', 'count', 'count', true).withVariableParameter('descending', 'descending', 'descending', true);
|
|
276
279
|
}).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
277
280
|
return _this;
|
|
278
281
|
}
|
|
@@ -281,7 +284,7 @@ module.exports = function () {
|
|
|
281
284
|
* Returns a description of the environment (e.g. development or production).
|
|
282
285
|
*
|
|
283
286
|
* @public
|
|
284
|
-
* @
|
|
287
|
+
* @returns {*}
|
|
285
288
|
*/
|
|
286
289
|
|
|
287
290
|
|
|
@@ -321,7 +324,7 @@ module.exports = function () {
|
|
|
321
324
|
*
|
|
322
325
|
* @public
|
|
323
326
|
* @param {String=} portfolio
|
|
324
|
-
* @
|
|
327
|
+
* @returns {Promise.<Portfolio[]>}
|
|
325
328
|
*/
|
|
326
329
|
|
|
327
330
|
}, {
|
|
@@ -343,7 +346,7 @@ module.exports = function () {
|
|
|
343
346
|
*
|
|
344
347
|
* @public
|
|
345
348
|
* @param {Object} portfolio
|
|
346
|
-
* @
|
|
349
|
+
* @returns {Promise.<Portfolio>}
|
|
347
350
|
*/
|
|
348
351
|
|
|
349
352
|
}, {
|
|
@@ -365,7 +368,7 @@ module.exports = function () {
|
|
|
365
368
|
*
|
|
366
369
|
* @public
|
|
367
370
|
* @param {Object} portfolio
|
|
368
|
-
* @
|
|
371
|
+
* @returns {Promise.<Portfolio>}
|
|
369
372
|
*/
|
|
370
373
|
|
|
371
374
|
}, {
|
|
@@ -387,7 +390,7 @@ module.exports = function () {
|
|
|
387
390
|
*
|
|
388
391
|
* @public
|
|
389
392
|
* @param {Object} portfolio
|
|
390
|
-
* @
|
|
393
|
+
* @returns {Promise.<Portfolio>}
|
|
391
394
|
*/
|
|
392
395
|
|
|
393
396
|
}, {
|
|
@@ -409,7 +412,7 @@ module.exports = function () {
|
|
|
409
412
|
*
|
|
410
413
|
* @public
|
|
411
414
|
* @param {String} portfolio - ID of the portfolio to update
|
|
412
|
-
* @
|
|
415
|
+
* @returns {Promise.<Portfolio>}
|
|
413
416
|
*/
|
|
414
417
|
|
|
415
418
|
}, {
|
|
@@ -457,7 +460,7 @@ module.exports = function () {
|
|
|
457
460
|
*
|
|
458
461
|
* @public
|
|
459
462
|
* @param {Object} position
|
|
460
|
-
* @
|
|
463
|
+
* @returns {Promise.<Position>}
|
|
461
464
|
*/
|
|
462
465
|
|
|
463
466
|
}, {
|
|
@@ -474,6 +477,51 @@ module.exports = function () {
|
|
|
474
477
|
});
|
|
475
478
|
}
|
|
476
479
|
|
|
480
|
+
/**
|
|
481
|
+
* Returns a promise which resolves as soon as the position's lock status
|
|
482
|
+
* changes to false.
|
|
483
|
+
*
|
|
484
|
+
* @public
|
|
485
|
+
* @param {String} portfolio
|
|
486
|
+
* @param {String} position
|
|
487
|
+
* @returns {Promise}
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
}, {
|
|
491
|
+
key: 'observePositionLock',
|
|
492
|
+
value: function observePositionLock(portfolio, position) {
|
|
493
|
+
var _this10 = this;
|
|
494
|
+
|
|
495
|
+
return promise.build(function (resolveCallback) {
|
|
496
|
+
assert.argumentIsOptional(portfolio, 'portfolio', String);
|
|
497
|
+
assert.argumentIsOptional(position, 'position', String);
|
|
498
|
+
|
|
499
|
+
var scheduleCheck = function scheduleCheck(delay) {
|
|
500
|
+
setTimeout(function () {
|
|
501
|
+
Gateway.invoke(_this10._readPositionsEndpoint, { portfolio: portfolio, position: position, includePreviousPrice: false }).then(function (positions) {
|
|
502
|
+
var p = positions.find(function (p) {
|
|
503
|
+
return p.position === position;
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
if (is.object(p)) {
|
|
507
|
+
if (is.object(p.system) && is.object(p.system) && is.boolean(p.system.locked)) {
|
|
508
|
+
scheduleCheck(5000);
|
|
509
|
+
} else {
|
|
510
|
+
resolveCallback(p);
|
|
511
|
+
}
|
|
512
|
+
} else {
|
|
513
|
+
resolveCallback(null);
|
|
514
|
+
}
|
|
515
|
+
}).catch(function (e) {
|
|
516
|
+
scheduleCheck(delay + 5000);
|
|
517
|
+
});
|
|
518
|
+
}, delay);
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
scheduleCheck(2500);
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
|
|
477
525
|
/**
|
|
478
526
|
* Retrieves positions for a user, a user's portfolio, or a single position.
|
|
479
527
|
*
|
|
@@ -489,10 +537,10 @@ module.exports = function () {
|
|
|
489
537
|
}, {
|
|
490
538
|
key: 'readPositionSummaries',
|
|
491
539
|
value: function readPositionSummaries(portfolio, position, frames, periods, start) {
|
|
492
|
-
var
|
|
540
|
+
var _this11 = this;
|
|
493
541
|
|
|
494
542
|
return Promise.resolve().then(function () {
|
|
495
|
-
checkStart.call(
|
|
543
|
+
checkStart.call(_this11);
|
|
496
544
|
|
|
497
545
|
assert.argumentIsOptional(portfolio, 'portfolio', String);
|
|
498
546
|
assert.argumentIsOptional(position, 'position', String);
|
|
@@ -545,7 +593,7 @@ module.exports = function () {
|
|
|
545
593
|
query.start = s;
|
|
546
594
|
}
|
|
547
595
|
|
|
548
|
-
return Gateway.invoke(
|
|
596
|
+
return Gateway.invoke(_this11._readPositionSummariesEndpoint, query);
|
|
549
597
|
});
|
|
550
598
|
}
|
|
551
599
|
|
|
@@ -561,15 +609,15 @@ module.exports = function () {
|
|
|
561
609
|
}, {
|
|
562
610
|
key: 'deletePosition',
|
|
563
611
|
value: function deletePosition(portfolio, position) {
|
|
564
|
-
var
|
|
612
|
+
var _this12 = this;
|
|
565
613
|
|
|
566
614
|
return Promise.resolve().then(function () {
|
|
567
|
-
checkStart.call(
|
|
615
|
+
checkStart.call(_this12);
|
|
568
616
|
|
|
569
617
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
570
618
|
assert.argumentIsRequired(position, 'position', String);
|
|
571
619
|
|
|
572
|
-
return Gateway.invoke(
|
|
620
|
+
return Gateway.invoke(_this12._deletePositionEndpoint, { portfolio: portfolio, position: position });
|
|
573
621
|
});
|
|
574
622
|
}
|
|
575
623
|
|
|
@@ -584,10 +632,10 @@ module.exports = function () {
|
|
|
584
632
|
}, {
|
|
585
633
|
key: 'createTransaction',
|
|
586
634
|
value: function createTransaction(transaction) {
|
|
587
|
-
var
|
|
635
|
+
var _this13 = this;
|
|
588
636
|
|
|
589
637
|
return Promise.resolve().then(function () {
|
|
590
|
-
checkStart.call(
|
|
638
|
+
checkStart.call(_this13);
|
|
591
639
|
|
|
592
640
|
assert.argumentIsRequired(transaction, 'transaction', Object);
|
|
593
641
|
assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
|
|
@@ -599,7 +647,7 @@ module.exports = function () {
|
|
|
599
647
|
|
|
600
648
|
var schema = getTransactionSchema(transaction);
|
|
601
649
|
|
|
602
|
-
return Gateway.invoke(
|
|
650
|
+
return Gateway.invoke(_this13._createTransactionEndpoint, schema.schema.format(transaction));
|
|
603
651
|
});
|
|
604
652
|
}
|
|
605
653
|
|
|
@@ -614,10 +662,10 @@ module.exports = function () {
|
|
|
614
662
|
}, {
|
|
615
663
|
key: 'batchTransactions',
|
|
616
664
|
value: function batchTransactions(portfolio, transactions) {
|
|
617
|
-
var
|
|
665
|
+
var _this14 = this;
|
|
618
666
|
|
|
619
667
|
return Promise.resolve().then(function () {
|
|
620
|
-
checkStart.call(
|
|
668
|
+
checkStart.call(_this14);
|
|
621
669
|
|
|
622
670
|
assert.argumentIsRequired(portfolio, 'portfolio', Object);
|
|
623
671
|
assert.argumentIsArray(transactions, 'transactions', Object);
|
|
@@ -642,7 +690,7 @@ module.exports = function () {
|
|
|
642
690
|
batchData.transactionItems.push(JSON.stringify(schema.schema.format(transaction)));
|
|
643
691
|
});
|
|
644
692
|
|
|
645
|
-
return Gateway.invoke(
|
|
693
|
+
return Gateway.invoke(_this14._batchTransactionEndpoint, batchData);
|
|
646
694
|
});
|
|
647
695
|
}
|
|
648
696
|
|
|
@@ -657,10 +705,10 @@ module.exports = function () {
|
|
|
657
705
|
}, {
|
|
658
706
|
key: 'editTransaction',
|
|
659
707
|
value: function editTransaction(transaction) {
|
|
660
|
-
var
|
|
708
|
+
var _this15 = this;
|
|
661
709
|
|
|
662
710
|
return Promise.resolve().then(function () {
|
|
663
|
-
checkStart.call(
|
|
711
|
+
checkStart.call(_this15);
|
|
664
712
|
|
|
665
713
|
assert.argumentIsRequired(transaction, 'transaction', Object);
|
|
666
714
|
assert.argumentIsRequired(transaction.portfolio, 'transaction.portfolio', String);
|
|
@@ -669,7 +717,7 @@ module.exports = function () {
|
|
|
669
717
|
|
|
670
718
|
var schema = getTransactionSchema(transaction);
|
|
671
719
|
|
|
672
|
-
return Gateway.invoke(
|
|
720
|
+
return Gateway.invoke(_this15._editTransactionEndpoint, schema.schema.format(transaction));
|
|
673
721
|
});
|
|
674
722
|
}
|
|
675
723
|
|
|
@@ -688,10 +736,10 @@ module.exports = function () {
|
|
|
688
736
|
}, {
|
|
689
737
|
key: 'deleteTransaction',
|
|
690
738
|
value: function deleteTransaction(portfolio, position, sequence, force, echo) {
|
|
691
|
-
var
|
|
739
|
+
var _this16 = this;
|
|
692
740
|
|
|
693
741
|
return Promise.resolve().then(function () {
|
|
694
|
-
checkStart.call(
|
|
742
|
+
checkStart.call(_this16);
|
|
695
743
|
|
|
696
744
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
697
745
|
assert.argumentIsRequired(position, 'position', String);
|
|
@@ -699,7 +747,7 @@ module.exports = function () {
|
|
|
699
747
|
assert.argumentIsOptional(force, 'force', Boolean);
|
|
700
748
|
assert.argumentIsOptional(echo, 'echo', Boolean);
|
|
701
749
|
|
|
702
|
-
return Gateway.invoke(
|
|
750
|
+
return Gateway.invoke(_this16._deleteTransactionEndpoint, { portfolio: portfolio, position: position, sequence: sequence, force: is.boolean(force) && force, echo: is.boolean(echo) && echo });
|
|
703
751
|
});
|
|
704
752
|
}
|
|
705
753
|
|
|
@@ -715,15 +763,15 @@ module.exports = function () {
|
|
|
715
763
|
}, {
|
|
716
764
|
key: 'readTransactions',
|
|
717
765
|
value: function readTransactions(portfolio, position) {
|
|
718
|
-
var
|
|
766
|
+
var _this17 = this;
|
|
719
767
|
|
|
720
768
|
return Promise.resolve().then(function () {
|
|
721
|
-
checkStart.call(
|
|
769
|
+
checkStart.call(_this17);
|
|
722
770
|
|
|
723
771
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
724
772
|
assert.argumentIsOptional(position, 'position', String);
|
|
725
773
|
|
|
726
|
-
return Gateway.invoke(
|
|
774
|
+
return Gateway.invoke(_this17._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
|
|
727
775
|
});
|
|
728
776
|
}
|
|
729
777
|
|
|
@@ -742,10 +790,10 @@ module.exports = function () {
|
|
|
742
790
|
}, {
|
|
743
791
|
key: 'readTransactionsFormatted',
|
|
744
792
|
value: function readTransactionsFormatted(portfolio, position, startDay, endDay) {
|
|
745
|
-
var
|
|
793
|
+
var _this18 = this;
|
|
746
794
|
|
|
747
795
|
return Promise.resolve().then(function () {
|
|
748
|
-
checkStart.call(
|
|
796
|
+
checkStart.call(_this18);
|
|
749
797
|
|
|
750
798
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
751
799
|
assert.argumentIsOptional(position, 'position', String);
|
|
@@ -765,13 +813,42 @@ module.exports = function () {
|
|
|
765
813
|
payload.end = endDay;
|
|
766
814
|
}
|
|
767
815
|
|
|
768
|
-
return Gateway.invoke(
|
|
816
|
+
return Gateway.invoke(_this18._readTransactionsReportEndpoint, payload);
|
|
769
817
|
});
|
|
770
818
|
}
|
|
771
819
|
}, {
|
|
772
820
|
key: 'readTransactionsFormattedPage',
|
|
773
|
-
value: function readTransactionsFormattedPage(portfolio, position,
|
|
774
|
-
|
|
821
|
+
value: function readTransactionsFormattedPage(portfolio, position, sequence, count, descending) {
|
|
822
|
+
var _this19 = this;
|
|
823
|
+
|
|
824
|
+
return Promise.resolve().then(function () {
|
|
825
|
+
checkStart.call(_this19);
|
|
826
|
+
|
|
827
|
+
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
828
|
+
assert.argumentIsRequired(position, 'position', String);
|
|
829
|
+
assert.argumentIsOptional(sequence, 'sequence', Number);
|
|
830
|
+
assert.argumentIsOptional(count, 'count', Number);
|
|
831
|
+
assert.argumentIsOptional(descending, 'descending', Boolean);
|
|
832
|
+
|
|
833
|
+
var payload = {};
|
|
834
|
+
|
|
835
|
+
payload.portfolio = portfolio;
|
|
836
|
+
payload.position = position;
|
|
837
|
+
|
|
838
|
+
payload.page = true;
|
|
839
|
+
|
|
840
|
+
if (sequence) {
|
|
841
|
+
payload.sequence = sequence;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
if (count) {
|
|
845
|
+
payload.count = count;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
payload.descending = is.boolean(descending) && descending;
|
|
849
|
+
|
|
850
|
+
return Gateway.invoke(_this19._readTransactionsReportEndpoint, payload);
|
|
851
|
+
});
|
|
775
852
|
}
|
|
776
853
|
|
|
777
854
|
/**
|
|
@@ -1010,7 +1087,7 @@ module.exports = function () {
|
|
|
1010
1087
|
return PortfolioGateway;
|
|
1011
1088
|
}();
|
|
1012
1089
|
|
|
1013
|
-
},{"./../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":
|
|
1090
|
+
},{"./../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/common-js/lang/promise":42,"@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){
|
|
1014
1091
|
'use strict';
|
|
1015
1092
|
|
|
1016
1093
|
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; }; }();
|
|
@@ -1361,7 +1438,7 @@ module.exports = function () {
|
|
|
1361
1438
|
return {
|
|
1362
1439
|
JwtGateway: JwtGateway,
|
|
1363
1440
|
PortfolioGateway: PortfolioGateway,
|
|
1364
|
-
version: '1.2.
|
|
1441
|
+
version: '1.2.21'
|
|
1365
1442
|
};
|
|
1366
1443
|
}();
|
|
1367
1444
|
|
|
@@ -1464,10 +1541,29 @@ module.exports = function () {
|
|
|
1464
1541
|
|
|
1465
1542
|
return reasons.children;
|
|
1466
1543
|
}
|
|
1544
|
+
|
|
1545
|
+
/**
|
|
1546
|
+
* Indicates if the tree of {@link FailureReasonItem} instances contains
|
|
1547
|
+
* at least one item with a matching {@link FailureType}.
|
|
1548
|
+
*
|
|
1549
|
+
* @public
|
|
1550
|
+
* @param {FailureType} type
|
|
1551
|
+
* @returns {Boolean}
|
|
1552
|
+
*/
|
|
1553
|
+
|
|
1554
|
+
}, {
|
|
1555
|
+
key: 'hasFailureType',
|
|
1556
|
+
value: function hasFailureType(type) {
|
|
1557
|
+
assert.argumentIsRequired(type, 'type', FailureType, 'FailureType');
|
|
1558
|
+
|
|
1559
|
+
return this._head.search(function (item) {
|
|
1560
|
+
return item.type === type;
|
|
1561
|
+
}, false, false) !== null;
|
|
1562
|
+
}
|
|
1467
1563
|
}, {
|
|
1468
1564
|
key: 'toJSON',
|
|
1469
1565
|
value: function toJSON() {
|
|
1470
|
-
return
|
|
1566
|
+
return this.format();
|
|
1471
1567
|
}
|
|
1472
1568
|
|
|
1473
1569
|
/**
|
|
@@ -1866,7 +1962,7 @@ module.exports = function () {
|
|
|
1866
1962
|
var requestIdentifyFailure = new FailureType('REQUEST_IDENTITY_FAILURE', 'An attempt to {L|root.endpoint.description} failed because your identity could not be determined.');
|
|
1867
1963
|
var requestAuthorizationFailure = new FailureType('REQUEST_AUTHORIZATION_FAILURE', 'An attempt to {L|root.endpoint.description} failed. You are not authorized to perform this action.');
|
|
1868
1964
|
var requestInputMalformed = new FailureType('REQUEST_INPUT_MALFORMED', 'An attempt to {L|root.endpoint.description} failed, the data structure is invalid.');
|
|
1869
|
-
var schemaValidationFailure = new FailureType('SCHEMA_VALIDATION_FAILURE', 'An attempt
|
|
1965
|
+
var schemaValidationFailure = new FailureType('SCHEMA_VALIDATION_FAILURE', 'An attempt to read {U|schema} data failed (found "{L|key}" when expecting "{L|name}")');
|
|
1870
1966
|
var requestGeneralFailure = new FailureType('REQUEST_GENERAL_FAILURE', 'An attempt to {L|root.endpoint.description} failed for unspecified reason(s).');
|
|
1871
1967
|
|
|
1872
1968
|
return FailureType;
|
|
@@ -2098,7 +2194,7 @@ module.exports = function () {
|
|
|
2098
2194
|
return Gateway;
|
|
2099
2195
|
}();
|
|
2100
2196
|
|
|
2101
|
-
},{"./../../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":
|
|
2197
|
+
},{"./../../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){
|
|
2102
2198
|
'use strict';
|
|
2103
2199
|
|
|
2104
2200
|
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; }; }();
|
|
@@ -3122,6 +3218,15 @@ module.exports = function () {
|
|
|
3122
3218
|
get: function get() {
|
|
3123
3219
|
return this._parameters;
|
|
3124
3220
|
}
|
|
3221
|
+
}], [{
|
|
3222
|
+
key: 'merge',
|
|
3223
|
+
value: function merge(a, b) {
|
|
3224
|
+
return new Parameters(a.parameters.slice(0).concat(b.parameters.filter(function (candidate) {
|
|
3225
|
+
return !a.parameters.some(function (existing) {
|
|
3226
|
+
return existing.key === candidate.key;
|
|
3227
|
+
});
|
|
3228
|
+
})));
|
|
3229
|
+
}
|
|
3125
3230
|
}]);
|
|
3126
3231
|
|
|
3127
3232
|
return Parameters;
|
|
@@ -3793,7 +3898,7 @@ module.exports = function () {
|
|
|
3793
3898
|
*
|
|
3794
3899
|
* @public
|
|
3795
3900
|
* @static
|
|
3796
|
-
* @
|
|
3901
|
+
* @returns {DelegateRequestInterceptor}
|
|
3797
3902
|
*/
|
|
3798
3903
|
|
|
3799
3904
|
}, {
|
|
@@ -4381,6 +4486,33 @@ module.exports = function () {
|
|
|
4381
4486
|
}
|
|
4382
4487
|
}
|
|
4383
4488
|
|
|
4489
|
+
/**
|
|
4490
|
+
* Climbs the tree, evaluating each parent until a predicate is matched. Once matched,
|
|
4491
|
+
* the {@link Tree} node is returned. Otherwise, if the predicate cannot be matched,
|
|
4492
|
+
* a null value is returned.
|
|
4493
|
+
*
|
|
4494
|
+
* @public
|
|
4495
|
+
* @param {Tree~nodePredicate} predicate - A predicate that tests each child node. The predicate takes two arguments -- the node's value, and the node itself.
|
|
4496
|
+
* @param {boolean=} includeCurrentNode - If true, the predicate will be applied to the current node.
|
|
4497
|
+
* @returns {Tree|null}
|
|
4498
|
+
*/
|
|
4499
|
+
|
|
4500
|
+
}, {
|
|
4501
|
+
key: 'findParent',
|
|
4502
|
+
value: function findParent(predicate, includeCurrentNode) {
|
|
4503
|
+
var returnRef = void 0;
|
|
4504
|
+
|
|
4505
|
+
if (is.boolean(includeCurrentNode) && includeCurrentNode && predicate(this.getValue(), this)) {
|
|
4506
|
+
returnRef = this;
|
|
4507
|
+
} else if (this._parent !== null) {
|
|
4508
|
+
returnRef = this._parent.findParent(predicate, true);
|
|
4509
|
+
} else {
|
|
4510
|
+
returnRef = null;
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
return returnRef;
|
|
4514
|
+
}
|
|
4515
|
+
|
|
4384
4516
|
/**
|
|
4385
4517
|
* Creates a representation of the tree using JavaScript objects and arrays.
|
|
4386
4518
|
*
|
|
@@ -4639,8 +4771,8 @@ module.exports = function () {
|
|
|
4639
4771
|
* Compares two strings (in ascending order), using {@link String#localeCompare}.
|
|
4640
4772
|
*
|
|
4641
4773
|
* @static
|
|
4642
|
-
* @param {
|
|
4643
|
-
* @param {
|
|
4774
|
+
* @param {String} a
|
|
4775
|
+
* @param {String} b
|
|
4644
4776
|
* @returns {Number}
|
|
4645
4777
|
*/
|
|
4646
4778
|
compareStrings: function compareStrings(a, b) {
|
|
@@ -5222,7 +5354,7 @@ module.exports = function () {
|
|
|
5222
5354
|
* @returns {String}
|
|
5223
5355
|
*/
|
|
5224
5356
|
value: function format() {
|
|
5225
|
-
return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
|
|
5357
|
+
return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
|
|
5226
5358
|
}
|
|
5227
5359
|
|
|
5228
5360
|
/**
|
|
@@ -5239,12 +5371,11 @@ module.exports = function () {
|
|
|
5239
5371
|
}
|
|
5240
5372
|
|
|
5241
5373
|
/**
|
|
5242
|
-
*
|
|
5243
|
-
* a {@link Day} instance.
|
|
5374
|
+
* Clones a {@link Day} instance.
|
|
5244
5375
|
*
|
|
5245
5376
|
* @public
|
|
5246
5377
|
* @static
|
|
5247
|
-
* @param {
|
|
5378
|
+
* @param {Day} value
|
|
5248
5379
|
* @returns {Day}
|
|
5249
5380
|
*/
|
|
5250
5381
|
|
|
@@ -5285,6 +5416,24 @@ module.exports = function () {
|
|
|
5285
5416
|
return this._day;
|
|
5286
5417
|
}
|
|
5287
5418
|
}], [{
|
|
5419
|
+
key: 'clone',
|
|
5420
|
+
value: function clone(value) {
|
|
5421
|
+
assert.argumentIsRequired(value, 'value', Day, 'Day');
|
|
5422
|
+
|
|
5423
|
+
return new Day(value.year, value.month, value.day);
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5426
|
+
/**
|
|
5427
|
+
* Converts a string (which matches the output of {@link Day#format} into
|
|
5428
|
+
* a {@link Day} instance.
|
|
5429
|
+
*
|
|
5430
|
+
* @public
|
|
5431
|
+
* @static
|
|
5432
|
+
* @param {String} value
|
|
5433
|
+
* @returns {Day}
|
|
5434
|
+
*/
|
|
5435
|
+
|
|
5436
|
+
}, {
|
|
5288
5437
|
key: 'parse',
|
|
5289
5438
|
value: function parse(value) {
|
|
5290
5439
|
assert.argumentIsRequired(value, 'value', String);
|
|
@@ -5339,7 +5488,7 @@ module.exports = function () {
|
|
|
5339
5488
|
*
|
|
5340
5489
|
* @static
|
|
5341
5490
|
* @public
|
|
5342
|
-
* @
|
|
5491
|
+
* @returns {Day}
|
|
5343
5492
|
*/
|
|
5344
5493
|
|
|
5345
5494
|
}, {
|
|
@@ -5431,8 +5580,11 @@ module.exports = function () {
|
|
|
5431
5580
|
|
|
5432
5581
|
var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
|
|
5433
5582
|
|
|
5434
|
-
function leftPad(value) {
|
|
5435
|
-
|
|
5583
|
+
function leftPad(value, digits, character) {
|
|
5584
|
+
var string = value.toString();
|
|
5585
|
+
var padding = digits - string.length;
|
|
5586
|
+
|
|
5587
|
+
return '' + character.repeat(padding) + string;
|
|
5436
5588
|
}
|
|
5437
5589
|
|
|
5438
5590
|
var comparator = ComparatorBuilder.startWith(function (a, b) {
|
|
@@ -5598,15 +5750,17 @@ module.exports = function () {
|
|
|
5598
5750
|
*
|
|
5599
5751
|
* @public
|
|
5600
5752
|
* @param {Boolean=} approximate
|
|
5753
|
+
* @param {Number=} places
|
|
5601
5754
|
* @returns {Boolean}
|
|
5602
5755
|
*/
|
|
5603
5756
|
|
|
5604
5757
|
}, {
|
|
5605
5758
|
key: 'getIsZero',
|
|
5606
|
-
value: function getIsZero(approximate) {
|
|
5759
|
+
value: function getIsZero(approximate, places) {
|
|
5607
5760
|
assert.argumentIsOptional(approximate, 'approximate', Boolean);
|
|
5761
|
+
assert.argumentIsOptional(places, 'places', Number);
|
|
5608
5762
|
|
|
5609
|
-
return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(
|
|
5763
|
+
return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(places || Big.DP, RoundingMode.NORMAL).getIsZero();
|
|
5610
5764
|
}
|
|
5611
5765
|
|
|
5612
5766
|
/**
|
|
@@ -5705,6 +5859,43 @@ module.exports = function () {
|
|
|
5705
5859
|
return this._big.eq(getBig(other));
|
|
5706
5860
|
}
|
|
5707
5861
|
|
|
5862
|
+
/**
|
|
5863
|
+
* Returns true if the current instance is an integer (i.e. has no decimal
|
|
5864
|
+
* component).
|
|
5865
|
+
*
|
|
5866
|
+
* @public
|
|
5867
|
+
* @return {Boolean}
|
|
5868
|
+
*/
|
|
5869
|
+
|
|
5870
|
+
}, {
|
|
5871
|
+
key: 'getIsInteger',
|
|
5872
|
+
value: function getIsInteger() {
|
|
5873
|
+
return this.getIsEqual(this.round(0));
|
|
5874
|
+
}
|
|
5875
|
+
|
|
5876
|
+
/**
|
|
5877
|
+
* Returns the number of decimal places used.
|
|
5878
|
+
*
|
|
5879
|
+
* @public
|
|
5880
|
+
* @returns {Number}
|
|
5881
|
+
*/
|
|
5882
|
+
|
|
5883
|
+
}, {
|
|
5884
|
+
key: 'getDecimalPlaces',
|
|
5885
|
+
value: function getDecimalPlaces() {
|
|
5886
|
+
var matches = this.toFixed().match(/-?\d*\.(\d*)/);
|
|
5887
|
+
|
|
5888
|
+
var returnVal = void 0;
|
|
5889
|
+
|
|
5890
|
+
if (matches === null) {
|
|
5891
|
+
returnVal = 0;
|
|
5892
|
+
} else {
|
|
5893
|
+
returnVal = matches[1].length;
|
|
5894
|
+
}
|
|
5895
|
+
|
|
5896
|
+
return returnVal;
|
|
5897
|
+
}
|
|
5898
|
+
|
|
5708
5899
|
/**
|
|
5709
5900
|
* Emits a floating point value that approximates the value of the current
|
|
5710
5901
|
* instance.
|
|
@@ -5753,10 +5944,11 @@ module.exports = function () {
|
|
|
5753
5944
|
}
|
|
5754
5945
|
|
|
5755
5946
|
/**
|
|
5756
|
-
*
|
|
5947
|
+
* Clones a {@link Decimal} instance.
|
|
5757
5948
|
*
|
|
5758
5949
|
* @public
|
|
5759
|
-
* @
|
|
5950
|
+
* @static
|
|
5951
|
+
* @param {Decimal} value
|
|
5760
5952
|
* @returns {Decimal}
|
|
5761
5953
|
*/
|
|
5762
5954
|
|
|
@@ -5766,6 +5958,22 @@ module.exports = function () {
|
|
|
5766
5958
|
return '[Decimal]';
|
|
5767
5959
|
}
|
|
5768
5960
|
}], [{
|
|
5961
|
+
key: 'clone',
|
|
5962
|
+
value: function clone(value) {
|
|
5963
|
+
assert.argumentIsRequired(value, 'value', Decimal, 'Decimal');
|
|
5964
|
+
|
|
5965
|
+
return new Decimal(value._big);
|
|
5966
|
+
}
|
|
5967
|
+
|
|
5968
|
+
/**
|
|
5969
|
+
* Parses the value emitted by {@link Decimal#toJSON}.
|
|
5970
|
+
*
|
|
5971
|
+
* @public
|
|
5972
|
+
* @param {String} value
|
|
5973
|
+
* @returns {Decimal}
|
|
5974
|
+
*/
|
|
5975
|
+
|
|
5976
|
+
}, {
|
|
5769
5977
|
key: 'parse',
|
|
5770
5978
|
value: function parse(value) {
|
|
5771
5979
|
return new Decimal(value);
|
|
@@ -5787,7 +5995,7 @@ module.exports = function () {
|
|
|
5787
5995
|
*
|
|
5788
5996
|
* @public
|
|
5789
5997
|
* @param {Decimal} instance
|
|
5790
|
-
* @
|
|
5998
|
+
* @returns {Boolean}
|
|
5791
5999
|
*/
|
|
5792
6000
|
value: function getIsZero(instance) {
|
|
5793
6001
|
assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
|
|
@@ -5800,7 +6008,7 @@ module.exports = function () {
|
|
|
5800
6008
|
*
|
|
5801
6009
|
* @public
|
|
5802
6010
|
* @param {Decimal} instance
|
|
5803
|
-
* @
|
|
6011
|
+
* @returns {Boolean}
|
|
5804
6012
|
*/
|
|
5805
6013
|
|
|
5806
6014
|
}, {
|
|
@@ -5816,7 +6024,7 @@ module.exports = function () {
|
|
|
5816
6024
|
*
|
|
5817
6025
|
* @public
|
|
5818
6026
|
* @param {Decimal} instance
|
|
5819
|
-
* @
|
|
6027
|
+
* @returns {Boolean}
|
|
5820
6028
|
*/
|
|
5821
6029
|
|
|
5822
6030
|
}, {
|
|
@@ -5832,7 +6040,7 @@ module.exports = function () {
|
|
|
5832
6040
|
*
|
|
5833
6041
|
* @public
|
|
5834
6042
|
* @param {Decimal} instance
|
|
5835
|
-
* @
|
|
6043
|
+
* @returns {Boolean}
|
|
5836
6044
|
*/
|
|
5837
6045
|
|
|
5838
6046
|
}, {
|
|
@@ -5848,7 +6056,7 @@ module.exports = function () {
|
|
|
5848
6056
|
*
|
|
5849
6057
|
* @public
|
|
5850
6058
|
* @param {Decimal} instance
|
|
5851
|
-
* @
|
|
6059
|
+
* @returns {Boolean}
|
|
5852
6060
|
*/
|
|
5853
6061
|
|
|
5854
6062
|
}, {
|
|
@@ -5864,7 +6072,7 @@ module.exports = function () {
|
|
|
5864
6072
|
*
|
|
5865
6073
|
* @public
|
|
5866
6074
|
* @param {Decimal} instance
|
|
5867
|
-
* @
|
|
6075
|
+
* @returns {Boolean}
|
|
5868
6076
|
*/
|
|
5869
6077
|
|
|
5870
6078
|
}, {
|
|
@@ -6054,7 +6262,7 @@ module.exports = function () {
|
|
|
6054
6262
|
return Decimal;
|
|
6055
6263
|
}();
|
|
6056
6264
|
|
|
6057
|
-
},{"./Enum":32,"./assert":37,"./is":40,"big.js":
|
|
6265
|
+
},{"./Enum":32,"./assert":37,"./is":40,"big.js":87}],31:[function(require,module,exports){
|
|
6058
6266
|
'use strict';
|
|
6059
6267
|
|
|
6060
6268
|
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; }; }();
|
|
@@ -6254,6 +6462,7 @@ module.exports = function () {
|
|
|
6254
6462
|
/**
|
|
6255
6463
|
* The unique code.
|
|
6256
6464
|
*
|
|
6465
|
+
* @public
|
|
6257
6466
|
* @returns {String}
|
|
6258
6467
|
*/
|
|
6259
6468
|
|
|
@@ -6266,6 +6475,7 @@ module.exports = function () {
|
|
|
6266
6475
|
* Returns true if the provided {@link Enum} argument is equal
|
|
6267
6476
|
* to the instance.
|
|
6268
6477
|
*
|
|
6478
|
+
* @public
|
|
6269
6479
|
* @param {Enum} other
|
|
6270
6480
|
* @returns {boolean}
|
|
6271
6481
|
*/
|
|
@@ -6290,6 +6500,7 @@ module.exports = function () {
|
|
|
6290
6500
|
* Looks up a enumeration item; given the enumeration type and the enumeration
|
|
6291
6501
|
* item's value. If no matching item can be found, a null value is returned.
|
|
6292
6502
|
*
|
|
6503
|
+
* @public
|
|
6293
6504
|
* @param {Function} type - The enumeration type.
|
|
6294
6505
|
* @param {String} code - The enumeration item's code.
|
|
6295
6506
|
* @returns {*|null}
|
|
@@ -6309,6 +6520,7 @@ module.exports = function () {
|
|
|
6309
6520
|
/**
|
|
6310
6521
|
* The description.
|
|
6311
6522
|
*
|
|
6523
|
+
* @public
|
|
6312
6524
|
* @returns {String}
|
|
6313
6525
|
*/
|
|
6314
6526
|
|
|
@@ -6328,6 +6540,7 @@ module.exports = function () {
|
|
|
6328
6540
|
/**
|
|
6329
6541
|
* Returns all of the enumeration's items (given an enumeration type).
|
|
6330
6542
|
*
|
|
6543
|
+
* @public
|
|
6331
6544
|
* @param {Function} type - The enumeration to list.
|
|
6332
6545
|
* @returns {Array}
|
|
6333
6546
|
*/
|
|
@@ -6527,10 +6740,11 @@ module.exports = function () {
|
|
|
6527
6740
|
}
|
|
6528
6741
|
|
|
6529
6742
|
/**
|
|
6530
|
-
*
|
|
6743
|
+
* Clones a {@link Timestamp} instance.
|
|
6531
6744
|
*
|
|
6532
6745
|
* @public
|
|
6533
|
-
* @
|
|
6746
|
+
* @static
|
|
6747
|
+
* @param {Timestamp} value
|
|
6534
6748
|
* @returns {Timestamp}
|
|
6535
6749
|
*/
|
|
6536
6750
|
|
|
@@ -6566,6 +6780,22 @@ module.exports = function () {
|
|
|
6566
6780
|
return this._moment;
|
|
6567
6781
|
}
|
|
6568
6782
|
}], [{
|
|
6783
|
+
key: 'clone',
|
|
6784
|
+
value: function clone(value) {
|
|
6785
|
+
assert.argumentIsRequired(value, 'value', Timestamp, 'Timestamp');
|
|
6786
|
+
|
|
6787
|
+
return new Timestamp(value._timestamp, value._timezone);
|
|
6788
|
+
}
|
|
6789
|
+
|
|
6790
|
+
/**
|
|
6791
|
+
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
6792
|
+
*
|
|
6793
|
+
* @public
|
|
6794
|
+
* @param {Number} value
|
|
6795
|
+
* @returns {Timestamp}
|
|
6796
|
+
*/
|
|
6797
|
+
|
|
6798
|
+
}, {
|
|
6569
6799
|
key: 'parse',
|
|
6570
6800
|
value: function parse(value) {
|
|
6571
6801
|
return new Timestamp(value);
|
|
@@ -6591,7 +6821,7 @@ module.exports = function () {
|
|
|
6591
6821
|
return Timestamp;
|
|
6592
6822
|
}();
|
|
6593
6823
|
|
|
6594
|
-
},{"./assert":37,"./is":40,"moment-timezone":
|
|
6824
|
+
},{"./assert":37,"./is":40,"moment-timezone":92}],35:[function(require,module,exports){
|
|
6595
6825
|
'use strict';
|
|
6596
6826
|
|
|
6597
6827
|
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; }; }();
|
|
@@ -6717,8 +6947,8 @@ module.exports = function () {
|
|
|
6717
6947
|
unique: function unique(a) {
|
|
6718
6948
|
assert.argumentIsArray(a, 'a');
|
|
6719
6949
|
|
|
6720
|
-
return
|
|
6721
|
-
return
|
|
6950
|
+
return this.uniqueBy(a, function (item) {
|
|
6951
|
+
return item;
|
|
6722
6952
|
});
|
|
6723
6953
|
},
|
|
6724
6954
|
|
|
@@ -6729,7 +6959,7 @@ module.exports = function () {
|
|
|
6729
6959
|
*
|
|
6730
6960
|
* @static
|
|
6731
6961
|
* @param {Array} a
|
|
6732
|
-
* @param {Function} keySelector -
|
|
6962
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
6733
6963
|
* @returns {Array}
|
|
6734
6964
|
*/
|
|
6735
6965
|
uniqueBy: function uniqueBy(a, keySelector) {
|
|
@@ -6747,12 +6977,12 @@ module.exports = function () {
|
|
|
6747
6977
|
|
|
6748
6978
|
/**
|
|
6749
6979
|
* Splits array into groups and returns an object (where the properties have
|
|
6750
|
-
* arrays). Unlike the indexBy function, there can be many items
|
|
6751
|
-
*
|
|
6980
|
+
* arrays). Unlike the indexBy function, there can be many items which share
|
|
6981
|
+
* the same key.
|
|
6752
6982
|
*
|
|
6753
6983
|
* @static
|
|
6754
6984
|
* @param {Array} a
|
|
6755
|
-
* @param {Function} keySelector -
|
|
6985
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
6756
6986
|
* @returns {Object}
|
|
6757
6987
|
*/
|
|
6758
6988
|
groupBy: function groupBy(a, keySelector) {
|
|
@@ -6779,7 +7009,7 @@ module.exports = function () {
|
|
|
6779
7009
|
*
|
|
6780
7010
|
* @static
|
|
6781
7011
|
* @param {Array} a
|
|
6782
|
-
* @param {Function} keySelector -
|
|
7012
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
6783
7013
|
* @returns {Array}
|
|
6784
7014
|
*/
|
|
6785
7015
|
batchBy: function batchBy(a, keySelector) {
|
|
@@ -6808,12 +7038,11 @@ module.exports = function () {
|
|
|
6808
7038
|
|
|
6809
7039
|
/**
|
|
6810
7040
|
* Splits array into groups and returns an object (where the properties are items from the
|
|
6811
|
-
* original array). Unlike the groupBy,
|
|
6812
|
-
* value.
|
|
7041
|
+
* original array). Unlike the groupBy, only one item can have a given key value.
|
|
6813
7042
|
*
|
|
6814
7043
|
* @static
|
|
6815
7044
|
* @param {Array} a
|
|
6816
|
-
* @param {Function} keySelector -
|
|
7045
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
6817
7046
|
* @returns {Object}
|
|
6818
7047
|
*/
|
|
6819
7048
|
indexBy: function indexBy(a, keySelector) {
|
|
@@ -6979,14 +7208,31 @@ module.exports = function () {
|
|
|
6979
7208
|
* @returns {Array}
|
|
6980
7209
|
*/
|
|
6981
7210
|
difference: function difference(a, b) {
|
|
7211
|
+
return this.differenceBy(a, b, function (item) {
|
|
7212
|
+
return item;
|
|
7213
|
+
});
|
|
7214
|
+
},
|
|
7215
|
+
|
|
7216
|
+
|
|
7217
|
+
/**
|
|
7218
|
+
* Set difference operation, where the uniqueness is determined by a delegate.
|
|
7219
|
+
*
|
|
7220
|
+
* @static
|
|
7221
|
+
* @param {Array} a
|
|
7222
|
+
* @param {Array} b
|
|
7223
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
7224
|
+
* @returns {Array}
|
|
7225
|
+
*/
|
|
7226
|
+
differenceBy: function differenceBy(a, b, keySelector) {
|
|
6982
7227
|
assert.argumentIsArray(a, 'a');
|
|
6983
7228
|
assert.argumentIsArray(b, 'b');
|
|
7229
|
+
assert.argumentIsRequired(keySelector, 'keySelector', Function);
|
|
6984
7230
|
|
|
6985
7231
|
var returnRef = [];
|
|
6986
7232
|
|
|
6987
7233
|
a.forEach(function (candidate) {
|
|
6988
7234
|
var exclude = b.some(function (comparison) {
|
|
6989
|
-
return candidate === comparison;
|
|
7235
|
+
return keySelector(candidate) === keySelector(comparison);
|
|
6990
7236
|
});
|
|
6991
7237
|
|
|
6992
7238
|
if (!exclude) {
|
|
@@ -7009,7 +7255,23 @@ module.exports = function () {
|
|
|
7009
7255
|
* @returns {Array}
|
|
7010
7256
|
*/
|
|
7011
7257
|
differenceSymmetric: function differenceSymmetric(a, b) {
|
|
7012
|
-
return this.
|
|
7258
|
+
return this.differenceSymmetricBy(a, b, function (item) {
|
|
7259
|
+
return item;
|
|
7260
|
+
});
|
|
7261
|
+
},
|
|
7262
|
+
|
|
7263
|
+
|
|
7264
|
+
/**
|
|
7265
|
+
* Set symmetric difference operation, where the uniqueness is determined by a delegate.
|
|
7266
|
+
*
|
|
7267
|
+
* @static
|
|
7268
|
+
* @param {Array} a
|
|
7269
|
+
* @param {Array} b
|
|
7270
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
7271
|
+
* @returns {Array}
|
|
7272
|
+
*/
|
|
7273
|
+
differenceSymmetricBy: function differenceSymmetricBy(a, b, keySelector) {
|
|
7274
|
+
return this.unionBy(this.differenceBy(a, b, keySelector), this.differenceBy(b, a, keySelector), keySelector);
|
|
7013
7275
|
},
|
|
7014
7276
|
|
|
7015
7277
|
|
|
@@ -7022,14 +7284,31 @@ module.exports = function () {
|
|
|
7022
7284
|
* @returns {Array}
|
|
7023
7285
|
*/
|
|
7024
7286
|
union: function union(a, b) {
|
|
7287
|
+
return this.unionBy(a, b, function (item) {
|
|
7288
|
+
return item;
|
|
7289
|
+
});
|
|
7290
|
+
},
|
|
7291
|
+
|
|
7292
|
+
|
|
7293
|
+
/**
|
|
7294
|
+
* Set union operation, where the uniqueness is determined by a delegate.
|
|
7295
|
+
*
|
|
7296
|
+
* @static
|
|
7297
|
+
* @param {Array} a
|
|
7298
|
+
* @param {Array} b
|
|
7299
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
7300
|
+
* @returns {Array}
|
|
7301
|
+
*/
|
|
7302
|
+
unionBy: function unionBy(a, b, keySelector) {
|
|
7025
7303
|
assert.argumentIsArray(a, 'a');
|
|
7026
7304
|
assert.argumentIsArray(b, 'b');
|
|
7305
|
+
assert.argumentIsRequired(keySelector, 'keySelector', Function);
|
|
7027
7306
|
|
|
7028
7307
|
var returnRef = a.slice();
|
|
7029
7308
|
|
|
7030
7309
|
b.forEach(function (candidate) {
|
|
7031
7310
|
var exclude = returnRef.some(function (comparison) {
|
|
7032
|
-
return candidate === comparison;
|
|
7311
|
+
return keySelector(candidate) === keySelector(comparison);
|
|
7033
7312
|
});
|
|
7034
7313
|
|
|
7035
7314
|
if (!exclude) {
|
|
@@ -7050,6 +7329,22 @@ module.exports = function () {
|
|
|
7050
7329
|
* @returns {Array}
|
|
7051
7330
|
*/
|
|
7052
7331
|
intersection: function intersection(a, b) {
|
|
7332
|
+
return this.intersectionBy(a, b, function (item) {
|
|
7333
|
+
return item;
|
|
7334
|
+
});
|
|
7335
|
+
},
|
|
7336
|
+
|
|
7337
|
+
|
|
7338
|
+
/**
|
|
7339
|
+
* Set intersection operation, where the uniqueness is determined by a delegate.
|
|
7340
|
+
*
|
|
7341
|
+
* @static
|
|
7342
|
+
* @param {Array} a
|
|
7343
|
+
* @param {Array} b
|
|
7344
|
+
* @param {Function} keySelector - A function that returns a unique key for an item.
|
|
7345
|
+
* @returns {Array}
|
|
7346
|
+
*/
|
|
7347
|
+
intersectionBy: function intersectionBy(a, b, keySelector) {
|
|
7053
7348
|
assert.argumentIsArray(a, 'a');
|
|
7054
7349
|
assert.argumentIsArray(b, 'b');
|
|
7055
7350
|
|
|
@@ -7057,7 +7352,7 @@ module.exports = function () {
|
|
|
7057
7352
|
|
|
7058
7353
|
a.forEach(function (candidate) {
|
|
7059
7354
|
var include = b.some(function (comparison) {
|
|
7060
|
-
return candidate === comparison;
|
|
7355
|
+
return keySelector(candidate) === comparison;
|
|
7061
7356
|
});
|
|
7062
7357
|
|
|
7063
7358
|
if (include) {
|
|
@@ -7076,16 +7371,20 @@ module.exports = function () {
|
|
|
7076
7371
|
* @public
|
|
7077
7372
|
* @param {Array} a
|
|
7078
7373
|
* @param {Function} predicate
|
|
7374
|
+
* @returns {Boolean}
|
|
7079
7375
|
*/
|
|
7080
7376
|
remove: function remove(a, predicate) {
|
|
7081
7377
|
assert.argumentIsArray(a, 'a');
|
|
7082
7378
|
assert.argumentIsRequired(predicate, 'predicate', Function);
|
|
7083
7379
|
|
|
7084
7380
|
var index = a.findIndex(predicate);
|
|
7381
|
+
var found = !(index < 0);
|
|
7085
7382
|
|
|
7086
|
-
if (
|
|
7383
|
+
if (found) {
|
|
7087
7384
|
a.splice(index, 1);
|
|
7088
7385
|
}
|
|
7386
|
+
|
|
7387
|
+
return found;
|
|
7089
7388
|
}
|
|
7090
7389
|
};
|
|
7091
7390
|
}();
|
|
@@ -7195,7 +7494,7 @@ module.exports = function () {
|
|
|
7195
7494
|
|
|
7196
7495
|
if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
|
|
7197
7496
|
itemValidator = function itemValidator(value, index) {
|
|
7198
|
-
return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
7497
|
+
return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
7199
7498
|
};
|
|
7200
7499
|
} else {
|
|
7201
7500
|
itemValidator = function itemValidator(value, index) {
|
|
@@ -7305,7 +7604,7 @@ module.exports = function () {
|
|
|
7305
7604
|
*
|
|
7306
7605
|
* @static
|
|
7307
7606
|
* @param {Object} target - The object to check for existence of the property.
|
|
7308
|
-
* @param {String|Array
|
|
7607
|
+
* @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
|
|
7309
7608
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
7310
7609
|
* @returns {boolean}
|
|
7311
7610
|
*/
|
|
@@ -7331,7 +7630,7 @@ module.exports = function () {
|
|
|
7331
7630
|
*
|
|
7332
7631
|
* @static
|
|
7333
7632
|
* @param {Object} target - The object to read from.
|
|
7334
|
-
* @param {String|Array
|
|
7633
|
+
* @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
|
|
7335
7634
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
7336
7635
|
* @returns {*}
|
|
7337
7636
|
*/
|
|
@@ -7366,7 +7665,8 @@ module.exports = function () {
|
|
|
7366
7665
|
*
|
|
7367
7666
|
* @static
|
|
7368
7667
|
* @param {Object} target - The object to write to.
|
|
7369
|
-
* @param {String|Array
|
|
7668
|
+
* @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
7669
|
+
* @param {*} value - The value to assign.
|
|
7370
7670
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
7371
7671
|
*/
|
|
7372
7672
|
write: function write(target, propertyNames, value, separator) {
|
|
@@ -7392,7 +7692,7 @@ module.exports = function () {
|
|
|
7392
7692
|
*
|
|
7393
7693
|
* @static
|
|
7394
7694
|
* @param {Object} target - The object to erase a property from.
|
|
7395
|
-
* @param {String|Array
|
|
7695
|
+
* @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
7396
7696
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
7397
7697
|
*/
|
|
7398
7698
|
erase: function erase(target, propertyNames, separator) {
|
|
@@ -7745,18 +8045,22 @@ module.exports = function () {
|
|
|
7745
8045
|
*
|
|
7746
8046
|
* @static
|
|
7747
8047
|
* @param {Object} source - The object to copy.
|
|
8048
|
+
* @param {Function=} canExtract - An optional function which indicates if the "extractor" can be used.
|
|
8049
|
+
* @param {Function=} extractor - An optional function which returns a cloned value for a property for assignment to the cloned object.
|
|
7748
8050
|
* @returns {Object}
|
|
7749
8051
|
*/
|
|
7750
|
-
clone: function clone(source) {
|
|
8052
|
+
clone: function clone(source, canExtract, extractor) {
|
|
7751
8053
|
var c = void 0;
|
|
7752
8054
|
|
|
7753
|
-
if (is.
|
|
8055
|
+
if (is.fn(canExtract) && canExtract(source)) {
|
|
8056
|
+
c = extractor(source);
|
|
8057
|
+
} else if (is.array(source)) {
|
|
7754
8058
|
c = source.map(function (sourceItem) {
|
|
7755
|
-
return object.clone(sourceItem);
|
|
8059
|
+
return object.clone(sourceItem, canExtract, extractor);
|
|
7756
8060
|
});
|
|
7757
8061
|
} else if (is.object(source)) {
|
|
7758
8062
|
c = object.keys(source).reduce(function (accumulator, key) {
|
|
7759
|
-
accumulator[key] = object.clone(source[key]);
|
|
8063
|
+
accumulator[key] = object.clone(source[key], canExtract, extractor);
|
|
7760
8064
|
|
|
7761
8065
|
return accumulator;
|
|
7762
8066
|
}, {});
|
|
@@ -8074,7 +8378,7 @@ module.exports = function () {
|
|
|
8074
8378
|
};
|
|
8075
8379
|
}();
|
|
8076
8380
|
|
|
8077
|
-
},{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":
|
|
8381
|
+
},{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":90}],44:[function(require,module,exports){
|
|
8078
8382
|
'use strict';
|
|
8079
8383
|
|
|
8080
8384
|
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; }; }();
|
|
@@ -8550,7 +8854,7 @@ module.exports = function () {
|
|
|
8550
8854
|
return DataType;
|
|
8551
8855
|
}();
|
|
8552
8856
|
|
|
8553
|
-
},{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":
|
|
8857
|
+
},{"./../../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){
|
|
8554
8858
|
'use strict';
|
|
8555
8859
|
|
|
8556
8860
|
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; }; }();
|
|
@@ -8732,7 +9036,7 @@ module.exports = function () {
|
|
|
8732
9036
|
}
|
|
8733
9037
|
|
|
8734
9038
|
/**
|
|
8735
|
-
* Generates a function suitable for use by JSON.parse.
|
|
9039
|
+
* Generates a function suitable for use by {@link JSON.parse}.
|
|
8736
9040
|
*
|
|
8737
9041
|
* @public
|
|
8738
9042
|
* @returns {Function}
|
|
@@ -9483,6 +9787,8 @@ module.exports = function () {
|
|
|
9483
9787
|
}();
|
|
9484
9788
|
|
|
9485
9789
|
},{"./../lang/Disposable":31,"./../lang/assert":37,"./../lang/is":40,"./../lang/object":41,"./../lang/promise":42}],51:[function(require,module,exports){
|
|
9790
|
+
const uuid = require('uuid');
|
|
9791
|
+
|
|
9486
9792
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
9487
9793
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
9488
9794
|
|
|
@@ -9498,26 +9804,48 @@ module.exports = (() => {
|
|
|
9498
9804
|
* @param {String} alternateDescription
|
|
9499
9805
|
* @param {String} code
|
|
9500
9806
|
* @param {Boolean} canReinvest
|
|
9807
|
+
* @param {Boolean} canShort
|
|
9808
|
+
* @param {Boolean} canSwitchDirection
|
|
9501
9809
|
* @param {Boolean} usesSymbols
|
|
9810
|
+
* @param {Boolean} hasCorporateActions
|
|
9811
|
+
* @param {Boolean} closeFractional
|
|
9812
|
+
* @param {Boolean} roundQuantity
|
|
9813
|
+
* @param {Boolean} strictOrdering
|
|
9814
|
+
* @param {Function} generator
|
|
9502
9815
|
*/
|
|
9503
9816
|
class InstrumentType extends Enum {
|
|
9504
|
-
constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
|
|
9817
|
+
constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
|
|
9505
9818
|
super(code, description);
|
|
9506
9819
|
|
|
9507
9820
|
assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
|
|
9508
9821
|
assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
|
|
9822
|
+
assert.argumentIsRequired(canShort, 'canShort', Boolean);
|
|
9823
|
+
assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
|
|
9509
9824
|
assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
|
|
9825
|
+
assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
|
|
9826
|
+
assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
|
|
9827
|
+
assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
|
|
9828
|
+
assert.argumentIsRequired(roundQuantity, 'strictOrdering', Boolean);
|
|
9829
|
+
assert.argumentIsRequired(generator, 'generator', Function);
|
|
9510
9830
|
|
|
9511
9831
|
this._alternateDescription = alternateDescription;
|
|
9512
9832
|
this._canReinvest = canReinvest;
|
|
9833
|
+
this._canShort = canShort;
|
|
9834
|
+
this._canSwitchDirection = canSwitchDirection;
|
|
9513
9835
|
this._usesSymbols = usesSymbols;
|
|
9836
|
+
this._hasCorporateActions = hasCorporateActions;
|
|
9837
|
+
this._closeFractional = closeFractional;
|
|
9838
|
+
this._roundQuantity = roundQuantity;
|
|
9839
|
+
this._strictOrdering = strictOrdering;
|
|
9840
|
+
|
|
9841
|
+
this._generator = generator;
|
|
9514
9842
|
}
|
|
9515
9843
|
|
|
9516
9844
|
/**
|
|
9517
9845
|
* A human-readable description.
|
|
9518
9846
|
*
|
|
9519
9847
|
* @public
|
|
9520
|
-
* @
|
|
9848
|
+
* @returns {String}
|
|
9521
9849
|
*/
|
|
9522
9850
|
get alternateDescription() {
|
|
9523
9851
|
return this._alternateDescription;
|
|
@@ -9533,6 +9861,27 @@ module.exports = (() => {
|
|
|
9533
9861
|
return this._canReinvest;
|
|
9534
9862
|
}
|
|
9535
9863
|
|
|
9864
|
+
/**
|
|
9865
|
+
* Indicates if short-selling is possible for this instrument type.
|
|
9866
|
+
*
|
|
9867
|
+
* @public
|
|
9868
|
+
* @returns {Boolean}
|
|
9869
|
+
*/
|
|
9870
|
+
get canShort() {
|
|
9871
|
+
return this._canShort;
|
|
9872
|
+
}
|
|
9873
|
+
|
|
9874
|
+
/**
|
|
9875
|
+
* Indicates if one transaction is allowed to switch a position size from
|
|
9876
|
+
* positive to negative (or vice versa).
|
|
9877
|
+
*
|
|
9878
|
+
* @public
|
|
9879
|
+
* @returns {Boolean}
|
|
9880
|
+
*/
|
|
9881
|
+
get canSwitchDirection() {
|
|
9882
|
+
return this._canSwitchDirection;
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9536
9885
|
/**
|
|
9537
9886
|
* Indicates if an instrument of this type can be represented by a symbol.
|
|
9538
9887
|
*
|
|
@@ -9543,6 +9892,65 @@ module.exports = (() => {
|
|
|
9543
9892
|
return this._usesSymbols;
|
|
9544
9893
|
}
|
|
9545
9894
|
|
|
9895
|
+
/**
|
|
9896
|
+
* Indicates if corporate actions are possible for this type of instrument.
|
|
9897
|
+
*
|
|
9898
|
+
* @public
|
|
9899
|
+
* @returns {Boolean}
|
|
9900
|
+
*/
|
|
9901
|
+
get hasCorporateActions() {
|
|
9902
|
+
return this._hasCorporateActions;
|
|
9903
|
+
}
|
|
9904
|
+
|
|
9905
|
+
/**
|
|
9906
|
+
* Indicates if fractional shares should be closed when the position
|
|
9907
|
+
* size is less than one (or some of the fractional shares are closed).
|
|
9908
|
+
*
|
|
9909
|
+
* @public
|
|
9910
|
+
* @returns {Boolean}
|
|
9911
|
+
*/
|
|
9912
|
+
get closeFractional() {
|
|
9913
|
+
return this._closeFractional;
|
|
9914
|
+
}
|
|
9915
|
+
|
|
9916
|
+
/**
|
|
9917
|
+
* Indicates if transaction sequences must be honored before calculating position
|
|
9918
|
+
* totals.
|
|
9919
|
+
*
|
|
9920
|
+
* @public
|
|
9921
|
+
* @returns {Boolean}
|
|
9922
|
+
*/
|
|
9923
|
+
get strictOrdering() {
|
|
9924
|
+
return this._strictOrdering;
|
|
9925
|
+
}
|
|
9926
|
+
|
|
9927
|
+
/**
|
|
9928
|
+
* Indicates transaction quantities should be rounded.
|
|
9929
|
+
*
|
|
9930
|
+
* @public
|
|
9931
|
+
* @returns {Boolean}
|
|
9932
|
+
*/
|
|
9933
|
+
get roundQuantity() {
|
|
9934
|
+
return this._roundQuantity;
|
|
9935
|
+
}
|
|
9936
|
+
|
|
9937
|
+
/**
|
|
9938
|
+
* Generates an identifier for the instrument.
|
|
9939
|
+
*
|
|
9940
|
+
* @public
|
|
9941
|
+
* @param {Object} instrument
|
|
9942
|
+
* @returns {String}
|
|
9943
|
+
*/
|
|
9944
|
+
generateIdentifier(instrument) {
|
|
9945
|
+
assert.argumentIsRequired(instrument, 'instrument');
|
|
9946
|
+
|
|
9947
|
+
if (instrument.type !== this) {
|
|
9948
|
+
throw new Error('Unable to generate instrument identifier for incompatible type.');
|
|
9949
|
+
}
|
|
9950
|
+
|
|
9951
|
+
return this._generator(instrument);
|
|
9952
|
+
}
|
|
9953
|
+
|
|
9546
9954
|
/**
|
|
9547
9955
|
* Cash.
|
|
9548
9956
|
*
|
|
@@ -9587,26 +9995,193 @@ module.exports = (() => {
|
|
|
9587
9995
|
return other;
|
|
9588
9996
|
}
|
|
9589
9997
|
|
|
9998
|
+
/**
|
|
9999
|
+
* Generates an identifier for the instrument.
|
|
10000
|
+
*
|
|
10001
|
+
* @public
|
|
10002
|
+
* @static
|
|
10003
|
+
* @param {Object} instrument
|
|
10004
|
+
* @returns {String}
|
|
10005
|
+
*/
|
|
10006
|
+
static generateIdentifier(instrument) {
|
|
10007
|
+
return map[instrument.type.code].generateIdentifier(instrument);
|
|
10008
|
+
}
|
|
10009
|
+
|
|
10010
|
+
/**
|
|
10011
|
+
*
|
|
10012
|
+
* @public
|
|
10013
|
+
* @static
|
|
10014
|
+
* @param code
|
|
10015
|
+
* @returns {InstrumentType}
|
|
10016
|
+
*/
|
|
10017
|
+
static fromSymbolType(code) {
|
|
10018
|
+
assert.argumentIsRequired(code, 'code', Number);
|
|
10019
|
+
|
|
10020
|
+
if (code === 1 || code === 6 || code === 7 || code === 11) {
|
|
10021
|
+
return InstrumentType.EQUITY;
|
|
10022
|
+
} else if (code === 5 || code == 15) {
|
|
10023
|
+
return InstrumentType.FUND;
|
|
10024
|
+
} else {
|
|
10025
|
+
throw new Error(`Unable to determine InstrumentType for [ ${code} ]`);
|
|
10026
|
+
}
|
|
10027
|
+
}
|
|
10028
|
+
|
|
9590
10029
|
toString() {
|
|
9591
10030
|
return '[InstrumentType]';
|
|
9592
10031
|
}
|
|
9593
10032
|
}
|
|
9594
10033
|
|
|
9595
|
-
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false);
|
|
9596
|
-
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true);
|
|
9597
|
-
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true);
|
|
9598
|
-
const other = new InstrumentType('OTHER', 'other', 'Other', false, false);
|
|
10034
|
+
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
|
|
10035
|
+
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
10036
|
+
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
10037
|
+
const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
|
|
10038
|
+
|
|
10039
|
+
const map = { };
|
|
10040
|
+
|
|
10041
|
+
map[cash.code] = cash;
|
|
10042
|
+
map[equity.code] = equity;
|
|
10043
|
+
map[fund.code] = fund;
|
|
10044
|
+
map[other.code] = other;
|
|
9599
10045
|
|
|
9600
10046
|
return InstrumentType;
|
|
9601
10047
|
})();
|
|
9602
10048
|
|
|
9603
|
-
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
|
|
10049
|
+
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":95}],52:[function(require,module,exports){
|
|
10050
|
+
const assert = require('@barchart/common-js/lang/assert'),
|
|
10051
|
+
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
10052
|
+
Enum = require('@barchart/common-js/lang/Enum');
|
|
10053
|
+
|
|
10054
|
+
module.exports = (() => {
|
|
10055
|
+
'use strict';
|
|
10056
|
+
|
|
10057
|
+
/**
|
|
10058
|
+
* Describes a position size -- positive values are long, negative values
|
|
10059
|
+
* are short and zero values are even.
|
|
10060
|
+
*
|
|
10061
|
+
* @public
|
|
10062
|
+
* @extends {Enum}
|
|
10063
|
+
* @param {String} code
|
|
10064
|
+
* @param {String} description
|
|
10065
|
+
* @param {sign} sign
|
|
10066
|
+
*/
|
|
10067
|
+
class PositionDirection extends Enum {
|
|
10068
|
+
constructor(code, description, sign) {
|
|
10069
|
+
super(code, description);
|
|
10070
|
+
|
|
10071
|
+
assert.argumentIsRequired(sign, 'sign', String);
|
|
10072
|
+
|
|
10073
|
+
this._sign = sign;
|
|
10074
|
+
}
|
|
10075
|
+
|
|
10076
|
+
/**
|
|
10077
|
+
* A description of the positiveness or negativeness of the size of the
|
|
10078
|
+
* position.
|
|
10079
|
+
*
|
|
10080
|
+
* @public
|
|
10081
|
+
* @returns {String}
|
|
10082
|
+
*/
|
|
10083
|
+
get sign() {
|
|
10084
|
+
return this._sign;
|
|
10085
|
+
}
|
|
10086
|
+
|
|
10087
|
+
/**
|
|
10088
|
+
* Indicates if the position size is positive (i.e. is {@link PositionDirection.LONG}).
|
|
10089
|
+
*
|
|
10090
|
+
* @public
|
|
10091
|
+
* @returns {boolean}
|
|
10092
|
+
*/
|
|
10093
|
+
get positive() {
|
|
10094
|
+
return this === long;
|
|
10095
|
+
}
|
|
10096
|
+
|
|
10097
|
+
/**
|
|
10098
|
+
* Indicates if the position size is negative (i.e. is {@link PositionDirection.SHORT}).
|
|
10099
|
+
*
|
|
10100
|
+
* @public
|
|
10101
|
+
* @returns {boolean}
|
|
10102
|
+
*/
|
|
10103
|
+
get negative() {
|
|
10104
|
+
return this === short;
|
|
10105
|
+
}
|
|
10106
|
+
|
|
10107
|
+
/**
|
|
10108
|
+
* Indicates if the position size is zero (i.e. is {@link PositionDirection.EVEN}).
|
|
10109
|
+
*
|
|
10110
|
+
* @public
|
|
10111
|
+
* @returns {boolean}
|
|
10112
|
+
*/
|
|
10113
|
+
get closed() {
|
|
10114
|
+
return this === even;
|
|
10115
|
+
}
|
|
10116
|
+
|
|
10117
|
+
/**
|
|
10118
|
+
* A positive quantity position.
|
|
10119
|
+
*
|
|
10120
|
+
* @public
|
|
10121
|
+
* @static
|
|
10122
|
+
* @returns {PositionDirection}
|
|
10123
|
+
*/
|
|
10124
|
+
static get LONG() {
|
|
10125
|
+
return long;
|
|
10126
|
+
}
|
|
10127
|
+
|
|
10128
|
+
/**
|
|
10129
|
+
* A positive quantity position.
|
|
10130
|
+
*
|
|
10131
|
+
* @public
|
|
10132
|
+
* @static
|
|
10133
|
+
* @returns {PositionDirection}
|
|
10134
|
+
*/
|
|
10135
|
+
static get SHORT() {
|
|
10136
|
+
return short;
|
|
10137
|
+
}
|
|
10138
|
+
|
|
10139
|
+
/**
|
|
10140
|
+
* A zero quantity position.
|
|
10141
|
+
*
|
|
10142
|
+
* @public
|
|
10143
|
+
* @static
|
|
10144
|
+
* @returns {PositionDirection}
|
|
10145
|
+
*/
|
|
10146
|
+
static get EVEN() {
|
|
10147
|
+
return even;
|
|
10148
|
+
}
|
|
10149
|
+
|
|
10150
|
+
/**
|
|
10151
|
+
* Given an open quantity, returns a {@link PositionDirection} that
|
|
10152
|
+
* describes the quantity.
|
|
10153
|
+
*
|
|
10154
|
+
* @public
|
|
10155
|
+
* @static
|
|
10156
|
+
* @param {Decimal} open
|
|
10157
|
+
* @returns {PositionDirection}
|
|
10158
|
+
*/
|
|
10159
|
+
static for(open) {
|
|
10160
|
+
assert.argumentIsRequired(open, 'open', Decimal, 'Decimal');
|
|
10161
|
+
|
|
10162
|
+
if (open.getIsPositive()) {
|
|
10163
|
+
return long;
|
|
10164
|
+
} else if (open.getIsNegative()) {
|
|
10165
|
+
return short;
|
|
10166
|
+
} else {
|
|
10167
|
+
return even;
|
|
10168
|
+
}
|
|
10169
|
+
}
|
|
10170
|
+
}
|
|
10171
|
+
|
|
10172
|
+
const long = new PositionDirection('LONG', 'Long', 'positive');
|
|
10173
|
+
const short = new PositionDirection('SHORT', 'Short', 'negative');
|
|
10174
|
+
const even = new PositionDirection('EVEN', 'Even', 'zero');
|
|
10175
|
+
|
|
10176
|
+
return PositionDirection;
|
|
10177
|
+
})();
|
|
10178
|
+
|
|
10179
|
+
},{"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],53:[function(require,module,exports){
|
|
9604
10180
|
const array = require('@barchart/common-js/lang/array'),
|
|
9605
10181
|
assert = require('@barchart/common-js/lang/assert'),
|
|
9606
10182
|
Day = require('@barchart/common-js/lang/Day'),
|
|
9607
10183
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
9608
|
-
Enum = require('@barchart/common-js/lang/Enum')
|
|
9609
|
-
is = require('@barchart/common-js/lang/is');
|
|
10184
|
+
Enum = require('@barchart/common-js/lang/Enum');
|
|
9610
10185
|
|
|
9611
10186
|
module.exports = (() => {
|
|
9612
10187
|
'use strict';
|
|
@@ -9623,25 +10198,41 @@ module.exports = (() => {
|
|
|
9623
10198
|
* @param {Function} descriptionCalculator
|
|
9624
10199
|
*/
|
|
9625
10200
|
class PositionSummaryFrame extends Enum {
|
|
9626
|
-
constructor(code, description, rangeCalculator, startDateCalculator, descriptionCalculator) {
|
|
10201
|
+
constructor(code, description, unique, rangeCalculator, startDateCalculator, descriptionCalculator) {
|
|
9627
10202
|
super(code, description);
|
|
9628
10203
|
|
|
10204
|
+
assert.argumentIsRequired(unique, 'unique', Boolean);
|
|
10205
|
+
|
|
9629
10206
|
assert.argumentIsRequired(rangeCalculator, 'rangeCalculator', Function);
|
|
9630
10207
|
assert.argumentIsRequired(startDateCalculator, 'startDateCalculator', Function);
|
|
9631
10208
|
assert.argumentIsRequired(descriptionCalculator, 'descriptionCalculator', Function);
|
|
9632
10209
|
|
|
10210
|
+
this._unique = unique;
|
|
10211
|
+
|
|
9633
10212
|
this._rangeCalculator = rangeCalculator;
|
|
9634
10213
|
this._startDateCalculator = startDateCalculator;
|
|
9635
10214
|
this._descriptionCalculator = descriptionCalculator;
|
|
9636
10215
|
}
|
|
9637
10216
|
|
|
10217
|
+
/**
|
|
10218
|
+
* If true, only one summary, of the given type, can exist for a
|
|
10219
|
+
* position. If false, multiple summaries, of the given type, can
|
|
10220
|
+
* exist for a position.
|
|
10221
|
+
*
|
|
10222
|
+
* @public
|
|
10223
|
+
* @returns {Boolean}
|
|
10224
|
+
*/
|
|
10225
|
+
get unique() {
|
|
10226
|
+
return this._unique;
|
|
10227
|
+
}
|
|
10228
|
+
|
|
9638
10229
|
/**
|
|
9639
10230
|
* Returns a human-readable description of the frame, given
|
|
9640
10231
|
* start and end dates.
|
|
9641
10232
|
*
|
|
9642
10233
|
* @public
|
|
9643
|
-
* @
|
|
9644
|
-
* @
|
|
10234
|
+
* @returns {PositionSummaryRange} range
|
|
10235
|
+
* @returns {String}
|
|
9645
10236
|
*/
|
|
9646
10237
|
describeRange(range) {
|
|
9647
10238
|
return this._descriptionCalculator(range.start, range.end);
|
|
@@ -9732,10 +10323,10 @@ module.exports = (() => {
|
|
|
9732
10323
|
}
|
|
9733
10324
|
}
|
|
9734
10325
|
|
|
9735
|
-
const yearly = new PositionSummaryFrame('YEARLY', 'year', getYearlyRanges, getYearlyStartDate, getYearlyRangeDescription);
|
|
9736
|
-
const quarterly = new PositionSummaryFrame('QUARTER', 'quarter', getQuarterlyRanges, getQuarterlyStartDate, getQuarterlyRangeDescription);
|
|
9737
|
-
const monthly = new PositionSummaryFrame('MONTH', 'month', getMonthlyRanges, getMonthlyStartDate, getMonthlyRangeDescription);
|
|
9738
|
-
const ytd = new PositionSummaryFrame('YTD', 'year-to-date', getYearToDateRanges, getYearToDateStartDate, getYearToDateRangeDescription);
|
|
10326
|
+
const yearly = new PositionSummaryFrame('YEARLY', 'year', false, getYearlyRanges, getYearlyStartDate, getYearlyRangeDescription);
|
|
10327
|
+
const quarterly = new PositionSummaryFrame('QUARTER', 'quarter', false, getQuarterlyRanges, getQuarterlyStartDate, getQuarterlyRangeDescription);
|
|
10328
|
+
const monthly = new PositionSummaryFrame('MONTH', 'month', false, getMonthlyRanges, getMonthlyStartDate, getMonthlyRangeDescription);
|
|
10329
|
+
const ytd = new PositionSummaryFrame('YTD', 'year-to-date', true, getYearToDateRanges, getYearToDateStartDate, getYearToDateRangeDescription);
|
|
9739
10330
|
|
|
9740
10331
|
/**
|
|
9741
10332
|
* The start and and date for a {@link PositionSummaryFrame}
|
|
@@ -9857,7 +10448,7 @@ module.exports = (() => {
|
|
|
9857
10448
|
return PositionSummaryFrame;
|
|
9858
10449
|
})();
|
|
9859
10450
|
|
|
9860
|
-
},{"@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
|
|
10451
|
+
},{"@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}],54:[function(require,module,exports){
|
|
9861
10452
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
9862
10453
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
9863
10454
|
|
|
@@ -9872,29 +10463,45 @@ module.exports = (() => {
|
|
|
9872
10463
|
* @param {String} code
|
|
9873
10464
|
* @param {String} description
|
|
9874
10465
|
* @param {String} display
|
|
10466
|
+
* @param {Number} sequence
|
|
9875
10467
|
* @param {Boolean} purchase
|
|
9876
10468
|
* @param {Boolean} sale
|
|
9877
10469
|
* @param {Boolean} income
|
|
9878
10470
|
* @param {Boolean} opening
|
|
9879
10471
|
* @param {Boolean} closing
|
|
9880
|
-
|
|
10472
|
+
* @param {Boolean} fee
|
|
10473
|
+
* @param {Boolean} corporateAction
|
|
10474
|
+
* @param {Boolean} initial
|
|
10475
|
+
* @param {Boolean} significant
|
|
10476
|
+
* @param {Boolean} eod
|
|
10477
|
+
*/
|
|
9881
10478
|
class TransactionType extends Enum {
|
|
9882
|
-
constructor(code, description, display, purchase, sale, income, opening, closing) {
|
|
10479
|
+
constructor(code, description, display, sequence, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
9883
10480
|
super(code, description);
|
|
9884
10481
|
|
|
9885
10482
|
assert.argumentIsRequired(display, 'display', String);
|
|
10483
|
+
assert.argumentIsRequired(sequence, 'sequence', Number);
|
|
9886
10484
|
assert.argumentIsRequired(purchase, 'purchase', Boolean);
|
|
9887
10485
|
assert.argumentIsRequired(sale, 'sale', Boolean);
|
|
9888
10486
|
assert.argumentIsRequired(income, 'income', Boolean);
|
|
9889
10487
|
assert.argumentIsRequired(opening, 'opening', Boolean);
|
|
9890
10488
|
assert.argumentIsRequired(closing, 'closing', Boolean);
|
|
10489
|
+
assert.argumentIsRequired(fee, 'fee', Boolean);
|
|
10490
|
+
assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
|
|
10491
|
+
assert.argumentIsRequired(initial, 'initial', Boolean);
|
|
10492
|
+
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
9891
10493
|
|
|
9892
10494
|
this._display = display;
|
|
10495
|
+
this._sequence = sequence;
|
|
9893
10496
|
this._purchase = purchase;
|
|
9894
10497
|
this._sale = sale;
|
|
9895
10498
|
this._income = income;
|
|
9896
10499
|
this._opening = opening;
|
|
9897
10500
|
this._closing = closing;
|
|
10501
|
+
this._fee = fee;
|
|
10502
|
+
this._corporateAction = corporateAction;
|
|
10503
|
+
this._initial = initial;
|
|
10504
|
+
this._significant = significant;
|
|
9898
10505
|
}
|
|
9899
10506
|
|
|
9900
10507
|
/**
|
|
@@ -9907,6 +10514,17 @@ module.exports = (() => {
|
|
|
9907
10514
|
return this._display;
|
|
9908
10515
|
}
|
|
9909
10516
|
|
|
10517
|
+
/**
|
|
10518
|
+
* Specifies ordering when multiple transactions occur on the same day, for
|
|
10519
|
+
* the same position.
|
|
10520
|
+
*
|
|
10521
|
+
* @public
|
|
10522
|
+
* @returns {Number}
|
|
10523
|
+
*/
|
|
10524
|
+
get sequence() {
|
|
10525
|
+
return this._sequence;
|
|
10526
|
+
}
|
|
10527
|
+
|
|
9910
10528
|
/**
|
|
9911
10529
|
* Indicates if the transaction was a trade.
|
|
9912
10530
|
*
|
|
@@ -9918,7 +10536,7 @@ module.exports = (() => {
|
|
|
9918
10536
|
}
|
|
9919
10537
|
|
|
9920
10538
|
/**
|
|
9921
|
-
* Indicates if the
|
|
10539
|
+
* Indicates if the transaction was a purchase.
|
|
9922
10540
|
*
|
|
9923
10541
|
* @public
|
|
9924
10542
|
* @returns {Boolean}
|
|
@@ -9928,7 +10546,7 @@ module.exports = (() => {
|
|
|
9928
10546
|
}
|
|
9929
10547
|
|
|
9930
10548
|
/**
|
|
9931
|
-
* Indicates if the
|
|
10549
|
+
* Indicates if the transaction was a sale.
|
|
9932
10550
|
*
|
|
9933
10551
|
* @public
|
|
9934
10552
|
* @returns {Boolean}
|
|
@@ -9948,7 +10566,7 @@ module.exports = (() => {
|
|
|
9948
10566
|
}
|
|
9949
10567
|
|
|
9950
10568
|
/**
|
|
9951
|
-
* Indicates if the
|
|
10569
|
+
* Indicates if the transaction opens the position (i.e. increases its
|
|
9952
10570
|
* magnitude).
|
|
9953
10571
|
*
|
|
9954
10572
|
* @public
|
|
@@ -9959,7 +10577,7 @@ module.exports = (() => {
|
|
|
9959
10577
|
}
|
|
9960
10578
|
|
|
9961
10579
|
/**
|
|
9962
|
-
* Indicates if the
|
|
10580
|
+
* Indicates if the transaction closes the position (i.e. decreases its
|
|
9963
10581
|
* magnitude).
|
|
9964
10582
|
*
|
|
9965
10583
|
* @public
|
|
@@ -9969,6 +10587,47 @@ module.exports = (() => {
|
|
|
9969
10587
|
return this._closing;
|
|
9970
10588
|
}
|
|
9971
10589
|
|
|
10590
|
+
/**
|
|
10591
|
+
* Indicates if the transaction is a chart that neither opens nor
|
|
10592
|
+
* closes the position.
|
|
10593
|
+
*
|
|
10594
|
+
* @public
|
|
10595
|
+
* @returns {Boolean}
|
|
10596
|
+
*/
|
|
10597
|
+
get fee() {
|
|
10598
|
+
return this._fee;
|
|
10599
|
+
}
|
|
10600
|
+
|
|
10601
|
+
/**
|
|
10602
|
+
* Indicates if the transaction is a corporate action.
|
|
10603
|
+
*
|
|
10604
|
+
* @public
|
|
10605
|
+
* @returns {Boolean}
|
|
10606
|
+
*/
|
|
10607
|
+
get corporateAction() {
|
|
10608
|
+
return this._corporateAction;
|
|
10609
|
+
}
|
|
10610
|
+
|
|
10611
|
+
/**
|
|
10612
|
+
* Indicates if the transaction can be the first transaction for a position.
|
|
10613
|
+
*
|
|
10614
|
+
* @public
|
|
10615
|
+
* @returns {Boolean}
|
|
10616
|
+
*/
|
|
10617
|
+
get initial() {
|
|
10618
|
+
return this._initial;
|
|
10619
|
+
}
|
|
10620
|
+
|
|
10621
|
+
/**
|
|
10622
|
+
* Significant transactions cannot be discarded during transaction re-write.
|
|
10623
|
+
*
|
|
10624
|
+
* @public
|
|
10625
|
+
* @returns {Boolean}
|
|
10626
|
+
*/
|
|
10627
|
+
get significant() {
|
|
10628
|
+
return this._significant;
|
|
10629
|
+
}
|
|
10630
|
+
|
|
9972
10631
|
/**
|
|
9973
10632
|
* A purchase.
|
|
9974
10633
|
*
|
|
@@ -10068,6 +10727,17 @@ module.exports = (() => {
|
|
|
10068
10727
|
return distributionFund;
|
|
10069
10728
|
}
|
|
10070
10729
|
|
|
10730
|
+
/**
|
|
10731
|
+
* A mutual fund distribution in cash, reinvested.
|
|
10732
|
+
*
|
|
10733
|
+
* @public
|
|
10734
|
+
* @static
|
|
10735
|
+
* @returns {TransactionType}
|
|
10736
|
+
*/
|
|
10737
|
+
static get DISTRIBUTION_REINVEST() {
|
|
10738
|
+
return distributionReinvest;
|
|
10739
|
+
}
|
|
10740
|
+
|
|
10071
10741
|
/**
|
|
10072
10742
|
* A split.
|
|
10073
10743
|
*
|
|
@@ -10172,34 +10842,34 @@ module.exports = (() => {
|
|
|
10172
10842
|
}
|
|
10173
10843
|
}
|
|
10174
10844
|
|
|
10175
|
-
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true,
|
|
10176
|
-
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true);
|
|
10177
|
-
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true);
|
|
10178
|
-
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false);
|
|
10179
|
-
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false);
|
|
10180
|
-
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false);
|
|
10181
|
-
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false);
|
|
10182
|
-
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false);
|
|
10183
|
-
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, true, false);
|
|
10184
|
-
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, false);
|
|
10185
|
-
|
|
10186
|
-
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false);
|
|
10187
|
-
const
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
const
|
|
10191
|
-
const
|
|
10192
|
-
const
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
const
|
|
10845
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', 0, true, false, false, true, false, false, false, true, true);
|
|
10846
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', 0, false, true, false, false, true, false, false, false, true);
|
|
10847
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', 0, true, false, false, false, true, false, false, false, true);
|
|
10848
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', 0, false, true, false, true, false, false, false, true, true);
|
|
10849
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', 1, false, false, true, false, false, false, true, false, false);
|
|
10850
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', 1, false, false, false, true, false, false, true, false, false);
|
|
10851
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', 1, false, false, false, true, false, false, true, false, false);
|
|
10852
|
+
const split = new TransactionType('SP', 'Split', 'Split', 1, false, false, false, true, false, false, true, false, false);
|
|
10853
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', 0, false, false, false, false, false, true, false, false, false);
|
|
10854
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', 0, false, false, false, false, true, false, false, false, false);
|
|
10855
|
+
|
|
10856
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', 1, false, false, true, false, false, false, true, false, false);
|
|
10857
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', 1, false, false, false, true, false, false, true, false, false);
|
|
10858
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', 1, false, false, false, true, false, false, true, false, false);
|
|
10859
|
+
|
|
10860
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', 0, false, false, false, false, false, false, false, true, true);
|
|
10861
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', 0, false, false, false, false, false, false, false, true, true);
|
|
10862
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', 0, false, false, false, false, false, false, false, true, true);
|
|
10863
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', 0, false, false, false, false, false, false, false, true, true);
|
|
10864
|
+
|
|
10865
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', 0, false, false, false, false, false, false, false, false, false);
|
|
10866
|
+
const income = new TransactionType('I', 'Income', 'Income', 0, false, false, true, false, false, false, false, false, false);
|
|
10196
10867
|
|
|
10197
10868
|
return TransactionType;
|
|
10198
10869
|
})();
|
|
10199
10870
|
|
|
10200
|
-
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],
|
|
10201
|
-
const
|
|
10202
|
-
Enum = require('@barchart/common-js/lang/Enum');
|
|
10871
|
+
},{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
|
|
10872
|
+
const Enum = require('@barchart/common-js/lang/Enum');
|
|
10203
10873
|
|
|
10204
10874
|
module.exports = (() => {
|
|
10205
10875
|
'use strict';
|
|
@@ -10259,12 +10929,10 @@ module.exports = (() => {
|
|
|
10259
10929
|
return ValuationType;
|
|
10260
10930
|
})();
|
|
10261
10931
|
|
|
10262
|
-
},{"@barchart/common-js/lang/Enum":32
|
|
10263
|
-
const
|
|
10264
|
-
Currency = require('@barchart/common-js/lang/Currency'),
|
|
10932
|
+
},{"@barchart/common-js/lang/Enum":32}],56:[function(require,module,exports){
|
|
10933
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
10265
10934
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
10266
10935
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
10267
|
-
is = require('@barchart/common-js/lang/is'),
|
|
10268
10936
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
10269
10937
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder'),
|
|
10270
10938
|
Timezones = require('@barchart/common-js/lang/Timezones');
|
|
@@ -10363,7 +11031,7 @@ module.exports = (() => {
|
|
|
10363
11031
|
.withField('name', DataType.STRING)
|
|
10364
11032
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
10365
11033
|
.withField('dates.create', DataType.DAY)
|
|
10366
|
-
.withField('
|
|
11034
|
+
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
10367
11035
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
|
|
10368
11036
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
10369
11037
|
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
@@ -10385,7 +11053,7 @@ module.exports = (() => {
|
|
|
10385
11053
|
.withField('name', DataType.STRING)
|
|
10386
11054
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
10387
11055
|
.withField('dates.create', DataType.DAY)
|
|
10388
|
-
.withField('
|
|
11056
|
+
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
10389
11057
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
|
|
10390
11058
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
10391
11059
|
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
@@ -10408,7 +11076,7 @@ module.exports = (() => {
|
|
|
10408
11076
|
const create = new PortfolioSchema(SchemaBuilder.withName('create')
|
|
10409
11077
|
.withField('name', DataType.STRING)
|
|
10410
11078
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
10411
|
-
.withField('
|
|
11079
|
+
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
10412
11080
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
10413
11081
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
10414
11082
|
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'), true)
|
|
@@ -10420,6 +11088,7 @@ module.exports = (() => {
|
|
|
10420
11088
|
.withField('portfolio', DataType.STRING)
|
|
10421
11089
|
.withField('name', DataType.STRING)
|
|
10422
11090
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'), true)
|
|
11091
|
+
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
10423
11092
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
10424
11093
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
10425
11094
|
.withField('miscellany', DataType.AD_HOC, true)
|
|
@@ -10429,16 +11098,15 @@ module.exports = (() => {
|
|
|
10429
11098
|
return PortfolioSchema;
|
|
10430
11099
|
})();
|
|
10431
11100
|
|
|
10432
|
-
},{"./../data/ValuationType":
|
|
10433
|
-
const
|
|
10434
|
-
Currency = require('@barchart/common-js/lang/Currency'),
|
|
11101
|
+
},{"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/Timezones":35,"@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){
|
|
11102
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
10435
11103
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
10436
11104
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
10437
|
-
is = require('@barchart/common-js/lang/is'),
|
|
10438
11105
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
10439
11106
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
10440
11107
|
|
|
10441
11108
|
const InstrumentType = require('./../data/InstrumentType'),
|
|
11109
|
+
PositionDirection = require('./../data/PositionDirection'),
|
|
10442
11110
|
ValuationType = require('./../data/ValuationType');
|
|
10443
11111
|
|
|
10444
11112
|
module.exports = (() => {
|
|
@@ -10489,6 +11157,17 @@ module.exports = (() => {
|
|
|
10489
11157
|
return client;
|
|
10490
11158
|
}
|
|
10491
11159
|
|
|
11160
|
+
/**
|
|
11161
|
+
* Data required to update a position.
|
|
11162
|
+
*
|
|
11163
|
+
* @static
|
|
11164
|
+
* @public
|
|
11165
|
+
* @returns {PositionSchema}
|
|
11166
|
+
*/
|
|
11167
|
+
static get UPDATE() {
|
|
11168
|
+
return update;
|
|
11169
|
+
}
|
|
11170
|
+
|
|
10492
11171
|
toString() {
|
|
10493
11172
|
return '[PositionSchema]';
|
|
10494
11173
|
}
|
|
@@ -10507,10 +11186,12 @@ module.exports = (() => {
|
|
|
10507
11186
|
.withField('position', DataType.STRING)
|
|
10508
11187
|
.withField('open', DataType.BOOLEAN, true)
|
|
10509
11188
|
.withField('transaction', DataType.NUMBER)
|
|
11189
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
11190
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
10510
11191
|
.withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
10511
|
-
.withField('reinvest', DataType.BOOLEAN)
|
|
10512
11192
|
.withField('snapshot.date', DataType.DAY)
|
|
10513
11193
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
11194
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10514
11195
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10515
11196
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10516
11197
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10522,6 +11203,7 @@ module.exports = (() => {
|
|
|
10522
11203
|
.withField('legacy.portfolio', DataType.STRING, true)
|
|
10523
11204
|
.withField('legacy.position', DataType.STRING, true)
|
|
10524
11205
|
.withField('system.version', DataType.NUMBER, true)
|
|
11206
|
+
.withField('root', DataType.STRING, true)
|
|
10525
11207
|
.schema
|
|
10526
11208
|
);
|
|
10527
11209
|
|
|
@@ -10538,10 +11220,12 @@ module.exports = (() => {
|
|
|
10538
11220
|
.withField('position', DataType.STRING)
|
|
10539
11221
|
.withField('open', DataType.BOOLEAN, true)
|
|
10540
11222
|
.withField('transaction', DataType.NUMBER)
|
|
11223
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
11224
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
10541
11225
|
.withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
10542
|
-
.withField('reinvest', DataType.BOOLEAN)
|
|
10543
11226
|
.withField('snapshot.date', DataType.DAY)
|
|
10544
11227
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
11228
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10545
11229
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10546
11230
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10547
11231
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10552,19 +11236,31 @@ module.exports = (() => {
|
|
|
10552
11236
|
.schema
|
|
10553
11237
|
);
|
|
10554
11238
|
|
|
11239
|
+
const update = new PositionSchema(SchemaBuilder.withName('update')
|
|
11240
|
+
.withField('portfolio', DataType.STRING)
|
|
11241
|
+
.withField('position', DataType.STRING)
|
|
11242
|
+
.withField('mapping.name', DataType.STRING, true)
|
|
11243
|
+
.withField('mapping.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
|
|
11244
|
+
.withField('mapping.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
11245
|
+
.withField('mapping.symbol.barchart', DataType.STRING, true)
|
|
11246
|
+
.withField('mapping.symbol.display', DataType.STRING, true)
|
|
11247
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
11248
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
11249
|
+
.schema
|
|
11250
|
+
);
|
|
11251
|
+
|
|
10555
11252
|
return PositionSchema;
|
|
10556
11253
|
})();
|
|
10557
11254
|
|
|
10558
|
-
},{"./../data/InstrumentType":51,"./../data/ValuationType":
|
|
10559
|
-
const
|
|
10560
|
-
Currency = require('@barchart/common-js/lang/Currency'),
|
|
11255
|
+
},{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@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){
|
|
11256
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
10561
11257
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
10562
11258
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
10563
|
-
is = require('@barchart/common-js/lang/is'),
|
|
10564
11259
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
10565
11260
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
10566
11261
|
|
|
10567
|
-
const
|
|
11262
|
+
const PositionDirection = require('./../data/PositionDirection'),
|
|
11263
|
+
PositionSummaryFrame = require('./../data/PositionSummaryFrame');
|
|
10568
11264
|
|
|
10569
11265
|
module.exports = (() => {
|
|
10570
11266
|
'use strict';
|
|
@@ -10623,22 +11319,17 @@ module.exports = (() => {
|
|
|
10623
11319
|
.withField('user', DataType.STRING)
|
|
10624
11320
|
.withField('portfolio', DataType.STRING)
|
|
10625
11321
|
.withField('position', DataType.STRING)
|
|
10626
|
-
.withField('instrument.id', DataType.STRING)
|
|
10627
|
-
.withField('instrument.name', DataType.STRING)
|
|
10628
|
-
.withField('instrument.type', DataType.STRING)
|
|
10629
|
-
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
10630
|
-
.withField('instrument.delist', DataType.DAY, true)
|
|
10631
|
-
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
10632
|
-
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
10633
11322
|
.withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
|
|
10634
11323
|
.withField('start.date', DataType.DAY)
|
|
10635
11324
|
.withField('start.sequence', DataType.NUMBER)
|
|
10636
11325
|
.withField('start.open', DataType.DECIMAL)
|
|
11326
|
+
.withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10637
11327
|
.withField('start.basis', DataType.DECIMAL)
|
|
10638
11328
|
.withField('start.value', DataType.DECIMAL)
|
|
10639
11329
|
.withField('end.date', DataType.DAY)
|
|
10640
11330
|
.withField('end.sequence', DataType.NUMBER)
|
|
10641
11331
|
.withField('end.open', DataType.DECIMAL)
|
|
11332
|
+
.withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10642
11333
|
.withField('end.basis', DataType.DECIMAL)
|
|
10643
11334
|
.withField('end.value', DataType.DECIMAL)
|
|
10644
11335
|
.withField('period.buys', DataType.DECIMAL)
|
|
@@ -10655,22 +11346,17 @@ module.exports = (() => {
|
|
|
10655
11346
|
.withField('user', DataType.STRING)
|
|
10656
11347
|
.withField('portfolio', DataType.STRING)
|
|
10657
11348
|
.withField('position', DataType.STRING)
|
|
10658
|
-
.withField('instrument.id', DataType.STRING)
|
|
10659
|
-
.withField('instrument.name', DataType.STRING)
|
|
10660
|
-
.withField('instrument.type', DataType.STRING)
|
|
10661
|
-
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
10662
|
-
.withField('instrument.delist', DataType.DAY, true)
|
|
10663
|
-
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
10664
|
-
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
10665
11349
|
.withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
|
|
10666
11350
|
.withField('start.date', DataType.DAY)
|
|
10667
11351
|
.withField('start.sequence', DataType.NUMBER)
|
|
10668
11352
|
.withField('start.open', DataType.DECIMAL)
|
|
11353
|
+
.withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10669
11354
|
.withField('start.basis', DataType.DECIMAL)
|
|
10670
11355
|
.withField('start.value', DataType.DECIMAL)
|
|
10671
11356
|
.withField('end.date', DataType.DAY)
|
|
10672
11357
|
.withField('end.sequence', DataType.NUMBER)
|
|
10673
11358
|
.withField('end.open', DataType.DECIMAL)
|
|
11359
|
+
.withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10674
11360
|
.withField('end.basis', DataType.DECIMAL)
|
|
10675
11361
|
.withField('end.value', DataType.DECIMAL)
|
|
10676
11362
|
.withField('period.buys', DataType.DECIMAL)
|
|
@@ -10684,9 +11370,8 @@ module.exports = (() => {
|
|
|
10684
11370
|
return PositionSummarySchema;
|
|
10685
11371
|
})();
|
|
10686
11372
|
|
|
10687
|
-
},{"./../data/
|
|
10688
|
-
const
|
|
10689
|
-
is = require('@barchart/common-js/lang/is'),
|
|
11373
|
+
},{"./../data/PositionDirection":52,"./../data/PositionSummaryFrame":53,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@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){
|
|
11374
|
+
const is = require('@barchart/common-js/lang/is'),
|
|
10690
11375
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
10691
11376
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
10692
11377
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
@@ -10694,6 +11379,7 @@ const assert = require('@barchart/common-js/lang/assert'),
|
|
|
10694
11379
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
10695
11380
|
|
|
10696
11381
|
const InstrumentType = require('./../data/InstrumentType'),
|
|
11382
|
+
PositionDirection = require('./../data/PositionDirection'),
|
|
10697
11383
|
TransactionType = require('./../data/TransactionType');
|
|
10698
11384
|
|
|
10699
11385
|
module.exports = (() => {
|
|
@@ -10789,38 +11475,6 @@ module.exports = (() => {
|
|
|
10789
11475
|
return sellShort;
|
|
10790
11476
|
}
|
|
10791
11477
|
|
|
10792
|
-
static get DIVIDEND() {
|
|
10793
|
-
return dividend;
|
|
10794
|
-
}
|
|
10795
|
-
|
|
10796
|
-
static get DIVIDEND_REINVEST() {
|
|
10797
|
-
return dividendReinvest;
|
|
10798
|
-
}
|
|
10799
|
-
|
|
10800
|
-
static get DIVIDEND_STOCK() {
|
|
10801
|
-
return dividendStock;
|
|
10802
|
-
}
|
|
10803
|
-
|
|
10804
|
-
static get DISTRIBUTION_CASH() {
|
|
10805
|
-
return distributionCash;
|
|
10806
|
-
}
|
|
10807
|
-
|
|
10808
|
-
static get DISTRIBUTION_FUND() {
|
|
10809
|
-
return distributionFund;
|
|
10810
|
-
}
|
|
10811
|
-
|
|
10812
|
-
static get SPLIT() {
|
|
10813
|
-
return split;
|
|
10814
|
-
}
|
|
10815
|
-
|
|
10816
|
-
static get FEE() {
|
|
10817
|
-
return fee;
|
|
10818
|
-
}
|
|
10819
|
-
|
|
10820
|
-
static get FEE_UNITS() {
|
|
10821
|
-
return feeUnits;
|
|
10822
|
-
}
|
|
10823
|
-
|
|
10824
11478
|
static get DEPOSIT() {
|
|
10825
11479
|
return deposit;
|
|
10826
11480
|
}
|
|
@@ -10829,14 +11483,6 @@ module.exports = (() => {
|
|
|
10829
11483
|
return withdrawal;
|
|
10830
11484
|
}
|
|
10831
11485
|
|
|
10832
|
-
static get DEBIT() {
|
|
10833
|
-
return debit;
|
|
10834
|
-
}
|
|
10835
|
-
|
|
10836
|
-
static get CREDIT() {
|
|
10837
|
-
return credit;
|
|
10838
|
-
}
|
|
10839
|
-
|
|
10840
11486
|
static get VALUATION() {
|
|
10841
11487
|
return valuation;
|
|
10842
11488
|
}
|
|
@@ -10863,6 +11509,7 @@ module.exports = (() => {
|
|
|
10863
11509
|
.withField('reference.position', DataType.STRING, true)
|
|
10864
11510
|
.withField('reference.sequence', DataType.NUMBER, true)
|
|
10865
11511
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
11512
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10866
11513
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10867
11514
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10868
11515
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10886,6 +11533,7 @@ module.exports = (() => {
|
|
|
10886
11533
|
.withField('split.reference', DataType.STRING, true)
|
|
10887
11534
|
.withField('charge.amount', DataType.DECIMAL, true)
|
|
10888
11535
|
.withField('income.amount', DataType.DECIMAL, true)
|
|
11536
|
+
.withField('valuation.rate', DataType.DECIMAL, true)
|
|
10889
11537
|
.withField('valuation.value', DataType.DECIMAL, true)
|
|
10890
11538
|
.withField('system.sequence', DataType.NUMBER)
|
|
10891
11539
|
.withField('system.version', DataType.STRING)
|
|
@@ -10906,6 +11554,7 @@ module.exports = (() => {
|
|
|
10906
11554
|
.withField('reference.position', DataType.STRING, true)
|
|
10907
11555
|
.withField('reference.sequence', DataType.NUMBER, true)
|
|
10908
11556
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
11557
|
+
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
10909
11558
|
.withField('snapshot.buys', DataType.DECIMAL)
|
|
10910
11559
|
.withField('snapshot.sells', DataType.DECIMAL)
|
|
10911
11560
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
@@ -10917,13 +11566,13 @@ module.exports = (() => {
|
|
|
10917
11566
|
.withField('dividend.effective', DataType.DAY, true)
|
|
10918
11567
|
.withField('dividend.price', DataType.DECIMAL, true)
|
|
10919
11568
|
.withField('dividend.amount', DataType.DECIMAL, true)
|
|
10920
|
-
.withField('dividend.reference', DataType.STRING, true)
|
|
10921
11569
|
.withField('split.numerator', DataType.DECIMAL, true)
|
|
10922
11570
|
.withField('split.denominator', DataType.DECIMAL, true)
|
|
10923
11571
|
.withField('split.effective', DataType.DAY, true)
|
|
10924
11572
|
.withField('split.reference', DataType.STRING, true)
|
|
10925
11573
|
.withField('charge.amount', DataType.DECIMAL, true)
|
|
10926
11574
|
.withField('income.amount', DataType.DECIMAL, true)
|
|
11575
|
+
.withField('valuation.rate', DataType.DECIMAL, true)
|
|
10927
11576
|
.withField('valuation.value', DataType.DECIMAL, true)
|
|
10928
11577
|
.schema
|
|
10929
11578
|
);
|
|
@@ -10931,16 +11580,21 @@ module.exports = (() => {
|
|
|
10931
11580
|
const buy = new TransactionSchema(SchemaBuilder.withName(TransactionType.BUY.code)
|
|
10932
11581
|
.withField('portfolio', DataType.STRING)
|
|
10933
11582
|
.withField('position', DataType.STRING)
|
|
11583
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
10934
11584
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
10935
11585
|
.withField('instrument.name', DataType.STRING, true)
|
|
11586
|
+
.withField('instrument.exchange', DataType.STRING, true)
|
|
11587
|
+
.withField('instrument.code', DataType.NUMBER, true)
|
|
10936
11588
|
.withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
|
|
10937
11589
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
10938
11590
|
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
10939
11591
|
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
10940
11592
|
.withField('date', DataType.DAY)
|
|
10941
|
-
.withField('price', DataType.DECIMAL)
|
|
11593
|
+
.withField('price', DataType.DECIMAL, true)
|
|
10942
11594
|
.withField('quantity', DataType.DECIMAL)
|
|
10943
11595
|
.withField('fee', DataType.DECIMAL, true)
|
|
11596
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
11597
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
10944
11598
|
.withField('force', DataType.BOOLEAN, true)
|
|
10945
11599
|
.schema
|
|
10946
11600
|
);
|
|
@@ -10948,9 +11602,10 @@ module.exports = (() => {
|
|
|
10948
11602
|
const sell = new TransactionSchema(SchemaBuilder.withName(TransactionType.SELL.code)
|
|
10949
11603
|
.withField('portfolio', DataType.STRING)
|
|
10950
11604
|
.withField('position', DataType.STRING)
|
|
11605
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
10951
11606
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
10952
11607
|
.withField('date', DataType.DAY)
|
|
10953
|
-
.withField('price', DataType.DECIMAL)
|
|
11608
|
+
.withField('price', DataType.DECIMAL, true)
|
|
10954
11609
|
.withField('quantity', DataType.DECIMAL)
|
|
10955
11610
|
.withField('fee', DataType.DECIMAL, true)
|
|
10956
11611
|
.withField('force', DataType.BOOLEAN, true)
|
|
@@ -10960,6 +11615,7 @@ module.exports = (() => {
|
|
|
10960
11615
|
const buyShort = new TransactionSchema(SchemaBuilder.withName(TransactionType.BUY_SHORT.code)
|
|
10961
11616
|
.withField('portfolio', DataType.STRING)
|
|
10962
11617
|
.withField('position', DataType.STRING)
|
|
11618
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
10963
11619
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
10964
11620
|
.withField('date', DataType.DAY)
|
|
10965
11621
|
.withField('price', DataType.DECIMAL)
|
|
@@ -10972,8 +11628,11 @@ module.exports = (() => {
|
|
|
10972
11628
|
const sellShort = new TransactionSchema(SchemaBuilder.withName(TransactionType.SELL_SHORT.code)
|
|
10973
11629
|
.withField('portfolio', DataType.STRING)
|
|
10974
11630
|
.withField('position', DataType.STRING)
|
|
11631
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
10975
11632
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
10976
11633
|
.withField('instrument.name', DataType.STRING, true)
|
|
11634
|
+
.withField('instrument.exchange', DataType.STRING, true)
|
|
11635
|
+
.withField('instrument.code', DataType.NUMBER, true)
|
|
10977
11636
|
.withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
|
|
10978
11637
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
10979
11638
|
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
@@ -10982,82 +11641,8 @@ module.exports = (() => {
|
|
|
10982
11641
|
.withField('price', DataType.DECIMAL)
|
|
10983
11642
|
.withField('quantity', DataType.DECIMAL)
|
|
10984
11643
|
.withField('fee', DataType.DECIMAL, true)
|
|
10985
|
-
.withField('
|
|
10986
|
-
.
|
|
10987
|
-
);
|
|
10988
|
-
|
|
10989
|
-
const dividend = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND.code)
|
|
10990
|
-
.withField('portfolio', DataType.STRING)
|
|
10991
|
-
.withField('position', DataType.STRING)
|
|
10992
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
10993
|
-
.withField('date', DataType.DAY)
|
|
10994
|
-
.withField('rate', DataType.DECIMAL)
|
|
10995
|
-
.withField('effective', DataType.DAY)
|
|
10996
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
10997
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
10998
|
-
.schema
|
|
10999
|
-
);
|
|
11000
|
-
|
|
11001
|
-
const dividendReinvest = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_REINVEST.code)
|
|
11002
|
-
.withField('portfolio', DataType.STRING)
|
|
11003
|
-
.withField('position', DataType.STRING)
|
|
11004
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11005
|
-
.withField('date', DataType.DAY)
|
|
11006
|
-
.withField('rate', DataType.DECIMAL)
|
|
11007
|
-
.withField('effective', DataType.DAY)
|
|
11008
|
-
.withField('price', DataType.DECIMAL)
|
|
11009
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11010
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11011
|
-
.schema
|
|
11012
|
-
);
|
|
11013
|
-
|
|
11014
|
-
const dividendStock = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_STOCK.code)
|
|
11015
|
-
.withField('portfolio', DataType.STRING)
|
|
11016
|
-
.withField('position', DataType.STRING)
|
|
11017
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11018
|
-
.withField('date', DataType.DAY)
|
|
11019
|
-
.withField('rate', DataType.DECIMAL)
|
|
11020
|
-
.withField('effective', DataType.DAY)
|
|
11021
|
-
.withField('price', DataType.DECIMAL)
|
|
11022
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11023
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11024
|
-
.schema
|
|
11025
|
-
);
|
|
11026
|
-
|
|
11027
|
-
const distributionCash = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_CASH.code)
|
|
11028
|
-
.withField('portfolio', DataType.STRING)
|
|
11029
|
-
.withField('position', DataType.STRING)
|
|
11030
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11031
|
-
.withField('date', DataType.DAY)
|
|
11032
|
-
.withField('rate', DataType.DECIMAL)
|
|
11033
|
-
.withField('effective', DataType.DAY)
|
|
11034
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11035
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11036
|
-
.schema
|
|
11037
|
-
);
|
|
11038
|
-
|
|
11039
|
-
const distributionFund = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_FUND.code)
|
|
11040
|
-
.withField('portfolio', DataType.STRING)
|
|
11041
|
-
.withField('position', DataType.STRING)
|
|
11042
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11043
|
-
.withField('date', DataType.DAY)
|
|
11044
|
-
.withField('rate', DataType.DECIMAL)
|
|
11045
|
-
.withField('effective', DataType.DAY)
|
|
11046
|
-
.withField('price', DataType.DECIMAL)
|
|
11047
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11048
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11049
|
-
.schema
|
|
11050
|
-
);
|
|
11051
|
-
|
|
11052
|
-
const split = new TransactionSchema(SchemaBuilder.withName(TransactionType.SPLIT.code)
|
|
11053
|
-
.withField('portfolio', DataType.STRING)
|
|
11054
|
-
.withField('position', DataType.STRING)
|
|
11055
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11056
|
-
.withField('date', DataType.DAY)
|
|
11057
|
-
.withField('numerator', DataType.DECIMAL)
|
|
11058
|
-
.withField('denominator', DataType.DECIMAL)
|
|
11059
|
-
.withField('effective', DataType.DAY)
|
|
11060
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11644
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
11645
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
11061
11646
|
.withField('force', DataType.BOOLEAN, true)
|
|
11062
11647
|
.schema
|
|
11063
11648
|
);
|
|
@@ -11065,6 +11650,7 @@ module.exports = (() => {
|
|
|
11065
11650
|
const fee = new TransactionSchema(SchemaBuilder.withName(TransactionType.FEE.code)
|
|
11066
11651
|
.withField('portfolio', DataType.STRING)
|
|
11067
11652
|
.withField('position', DataType.STRING)
|
|
11653
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
11068
11654
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11069
11655
|
.withField('date', DataType.DAY)
|
|
11070
11656
|
.withField('fee', DataType.DECIMAL)
|
|
@@ -11072,26 +11658,15 @@ module.exports = (() => {
|
|
|
11072
11658
|
.schema
|
|
11073
11659
|
);
|
|
11074
11660
|
|
|
11075
|
-
const feeUnits = new TransactionSchema(SchemaBuilder.withName(TransactionType.FEE_UNITS.code)
|
|
11076
|
-
.withField('portfolio', DataType.STRING)
|
|
11077
|
-
.withField('position', DataType.STRING)
|
|
11078
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11079
|
-
.withField('date', DataType.DAY)
|
|
11080
|
-
.withField('fee', DataType.DECIMAL)
|
|
11081
|
-
.withField('price', DataType.DECIMAL)
|
|
11082
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11083
|
-
.schema
|
|
11084
|
-
);
|
|
11085
|
-
|
|
11086
11661
|
const deposit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEPOSIT.code)
|
|
11087
11662
|
.withField('portfolio', DataType.STRING)
|
|
11088
11663
|
.withField('position', DataType.STRING)
|
|
11664
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
11089
11665
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11090
11666
|
.withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
|
|
11091
11667
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
11092
11668
|
.withField('date', DataType.DAY)
|
|
11093
11669
|
.withField('amount', DataType.DECIMAL)
|
|
11094
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11095
11670
|
.withField('force', DataType.BOOLEAN, true)
|
|
11096
11671
|
.schema
|
|
11097
11672
|
);
|
|
@@ -11099,32 +11674,12 @@ module.exports = (() => {
|
|
|
11099
11674
|
const withdrawal = new TransactionSchema(SchemaBuilder.withName(TransactionType.WITHDRAWAL.code)
|
|
11100
11675
|
.withField('portfolio', DataType.STRING)
|
|
11101
11676
|
.withField('position', DataType.STRING)
|
|
11677
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
11102
11678
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11679
|
+
.withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
|
|
11680
|
+
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
11103
11681
|
.withField('date', DataType.DAY)
|
|
11104
11682
|
.withField('amount', DataType.DECIMAL)
|
|
11105
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11106
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11107
|
-
.schema
|
|
11108
|
-
);
|
|
11109
|
-
|
|
11110
|
-
const debit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEBIT.code)
|
|
11111
|
-
.withField('portfolio', DataType.STRING)
|
|
11112
|
-
.withField('position', DataType.STRING)
|
|
11113
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11114
|
-
.withField('date', DataType.DAY)
|
|
11115
|
-
.withField('amount', DataType.DECIMAL)
|
|
11116
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11117
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
11118
|
-
.schema
|
|
11119
|
-
);
|
|
11120
|
-
|
|
11121
|
-
const credit = new TransactionSchema(SchemaBuilder.withName(TransactionType.CREDIT.code)
|
|
11122
|
-
.withField('portfolio', DataType.STRING)
|
|
11123
|
-
.withField('position', DataType.STRING)
|
|
11124
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11125
|
-
.withField('date', DataType.DAY)
|
|
11126
|
-
.withField('amount', DataType.DECIMAL)
|
|
11127
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11128
11683
|
.withField('force', DataType.BOOLEAN, true)
|
|
11129
11684
|
.schema
|
|
11130
11685
|
);
|
|
@@ -11132,10 +11687,10 @@ module.exports = (() => {
|
|
|
11132
11687
|
const valuation = new TransactionSchema(SchemaBuilder.withName(TransactionType.VALUATION.code)
|
|
11133
11688
|
.withField('portfolio', DataType.STRING)
|
|
11134
11689
|
.withField('position', DataType.STRING)
|
|
11690
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
11135
11691
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11136
11692
|
.withField('date', DataType.DAY)
|
|
11137
11693
|
.withField('value', DataType.DECIMAL)
|
|
11138
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
11139
11694
|
.withField('force', DataType.BOOLEAN, true)
|
|
11140
11695
|
.schema
|
|
11141
11696
|
);
|
|
@@ -11143,6 +11698,7 @@ module.exports = (() => {
|
|
|
11143
11698
|
const income = new TransactionSchema(SchemaBuilder.withName(TransactionType.INCOME.code)
|
|
11144
11699
|
.withField('portfolio', DataType.STRING)
|
|
11145
11700
|
.withField('position', DataType.STRING)
|
|
11701
|
+
.withField('sequence', DataType.NUMBER, true)
|
|
11146
11702
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
11147
11703
|
.withField('date', DataType.DAY)
|
|
11148
11704
|
.withField('income', DataType.DECIMAL)
|
|
@@ -11161,12 +11717,7 @@ module.exports = (() => {
|
|
|
11161
11717
|
addSchemaToMap(TransactionType.SELL, sell);
|
|
11162
11718
|
addSchemaToMap(TransactionType.BUY_SHORT, buyShort);
|
|
11163
11719
|
addSchemaToMap(TransactionType.SELL_SHORT, sellShort);
|
|
11164
|
-
addSchemaToMap(TransactionType.DIVIDEND, dividend);
|
|
11165
|
-
addSchemaToMap(TransactionType.DIVIDEND_STOCK, dividendStock);
|
|
11166
|
-
addSchemaToMap(TransactionType.DIVIDEND_REINVEST, dividendReinvest);
|
|
11167
|
-
addSchemaToMap(TransactionType.SPLIT, split);
|
|
11168
11720
|
addSchemaToMap(TransactionType.FEE, fee);
|
|
11169
|
-
addSchemaToMap(TransactionType.FEE_UNITS, feeUnits);
|
|
11170
11721
|
addSchemaToMap(TransactionType.DEPOSIT, deposit);
|
|
11171
11722
|
addSchemaToMap(TransactionType.WITHDRAWAL, withdrawal);
|
|
11172
11723
|
addSchemaToMap(TransactionType.VALUATION, valuation);
|
|
@@ -11175,7 +11726,7 @@ module.exports = (() => {
|
|
|
11175
11726
|
return TransactionSchema;
|
|
11176
11727
|
})();
|
|
11177
11728
|
|
|
11178
|
-
},{"./../data/InstrumentType":51,"./../data/TransactionType":
|
|
11729
|
+
},{"./../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/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){
|
|
11179
11730
|
'use strict';
|
|
11180
11731
|
|
|
11181
11732
|
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; }; }();
|
|
@@ -11188,8 +11739,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
11188
11739
|
|
|
11189
11740
|
var assert = require('@barchart/common-js/lang/assert'),
|
|
11190
11741
|
Disposable = require('@barchart/common-js/lang/Disposable'),
|
|
11191
|
-
Enum = require('@barchart/common-js/lang/Enum'),
|
|
11192
|
-
is = require('@barchart/common-js/lang/is'),
|
|
11193
11742
|
Scheduler = require('@barchart/common-js/timing/Scheduler');
|
|
11194
11743
|
|
|
11195
11744
|
var EndpointBuilder = require('@barchart/common-js/api/http/builders/EndpointBuilder'),
|
|
@@ -11213,7 +11762,7 @@ module.exports = function () {
|
|
|
11213
11762
|
* Web service gateway for obtaining JWT tokens from TGAM (The Globe and Mail).
|
|
11214
11763
|
*
|
|
11215
11764
|
* @public
|
|
11216
|
-
* @param {
|
|
11765
|
+
* @param {JwtGateway~tokenGenerator} tokenGenerator
|
|
11217
11766
|
* @param {Number=} refreshInterval - Interval, in milliseconds, which a token refresh should occur. If zero, the token does not need to be refreshed.
|
|
11218
11767
|
* @extends {Disposable}
|
|
11219
11768
|
*/
|
|
@@ -11221,18 +11770,18 @@ module.exports = function () {
|
|
|
11221
11770
|
var JwtGateway = function (_Disposable) {
|
|
11222
11771
|
_inherits(JwtGateway, _Disposable);
|
|
11223
11772
|
|
|
11224
|
-
function JwtGateway(
|
|
11773
|
+
function JwtGateway(tokenGenerator, refreshInterval) {
|
|
11225
11774
|
_classCallCheck(this, JwtGateway);
|
|
11226
11775
|
|
|
11227
11776
|
var _this = _possibleConstructorReturn(this, (JwtGateway.__proto__ || Object.getPrototypeOf(JwtGateway)).call(this));
|
|
11228
11777
|
|
|
11229
|
-
assert.argumentIsRequired(
|
|
11778
|
+
assert.argumentIsRequired(tokenGenerator, 'tokenGenerator', Function);
|
|
11230
11779
|
assert.argumentIsOptional(refreshInterval, 'refreshInterval', Number);
|
|
11231
11780
|
|
|
11232
11781
|
_this._started = false;
|
|
11233
11782
|
_this._startPromise = null;
|
|
11234
11783
|
|
|
11235
|
-
_this.
|
|
11784
|
+
_this._tokenGenerator = tokenGenerator;
|
|
11236
11785
|
|
|
11237
11786
|
_this._refreshInterval = refreshInterval || 0;
|
|
11238
11787
|
_this._refreshJitter = Math.floor(_this._refreshInterval / 10);
|
|
@@ -11285,7 +11834,7 @@ module.exports = function () {
|
|
|
11285
11834
|
return Promise.resolve().then(function () {
|
|
11286
11835
|
checkStart.call(_this3);
|
|
11287
11836
|
|
|
11288
|
-
return
|
|
11837
|
+
return _this3._tokenGenerator();
|
|
11289
11838
|
}).catch(function (e) {
|
|
11290
11839
|
var failure = FailureReason.forRequest({ endpoint: _this3._endpoint }).addItem(FailureType.REQUEST_IDENTITY_FAILURE).format();
|
|
11291
11840
|
|
|
@@ -11400,7 +11949,9 @@ module.exports = function () {
|
|
|
11400
11949
|
key: 'forDevelopment',
|
|
11401
11950
|
value: function forDevelopment(endpoint) {
|
|
11402
11951
|
return Promise.resolve(endpoint).then(function (e) {
|
|
11403
|
-
return start(new JwtGateway(
|
|
11952
|
+
return start(new JwtGateway(function () {
|
|
11953
|
+
return Gateway.invoke(e);
|
|
11954
|
+
}, 60000));
|
|
11404
11955
|
});
|
|
11405
11956
|
}
|
|
11406
11957
|
|
|
@@ -11409,7 +11960,7 @@ module.exports = function () {
|
|
|
11409
11960
|
*
|
|
11410
11961
|
* @public
|
|
11411
11962
|
* @static
|
|
11412
|
-
* @param {Promise.<Endpoint>|Endpoint}endpoint - The endpoint which vends JWT tokens.
|
|
11963
|
+
* @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
|
|
11413
11964
|
* @returns {Promise.<RequestInterceptor>}
|
|
11414
11965
|
*/
|
|
11415
11966
|
|
|
@@ -11480,6 +12031,40 @@ module.exports = function () {
|
|
|
11480
12031
|
return jwtGateway.toRequestInterceptor();
|
|
11481
12032
|
});
|
|
11482
12033
|
}
|
|
12034
|
+
|
|
12035
|
+
/**
|
|
12036
|
+
* Creates and starts a new {@link JwtGateway} for use by the "tracker" system.
|
|
12037
|
+
*
|
|
12038
|
+
* @public
|
|
12039
|
+
* @static
|
|
12040
|
+
* @param {Function} tokenGenerator - A function which returns the JWT token.
|
|
12041
|
+
* @returns {Promise.<JwtGateway>}
|
|
12042
|
+
*/
|
|
12043
|
+
|
|
12044
|
+
}, {
|
|
12045
|
+
key: 'forTracker',
|
|
12046
|
+
value: function forTracker(tokenGenerator) {
|
|
12047
|
+
return Promise.resolve().then(function () {
|
|
12048
|
+
return start(new JwtGateway(tokenGenerator, 0));
|
|
12049
|
+
});
|
|
12050
|
+
}
|
|
12051
|
+
|
|
12052
|
+
/**
|
|
12053
|
+
* Creates and starts a new {@link RequestInterceptor} for use by "tracker" system.
|
|
12054
|
+
*
|
|
12055
|
+
* @public
|
|
12056
|
+
* @static
|
|
12057
|
+
* @param {JwtGateway~tokenGenerator} tokenGenerator - A function which returns the JWT token.
|
|
12058
|
+
* @returns {Promise.<RequestInterceptor>}
|
|
12059
|
+
*/
|
|
12060
|
+
|
|
12061
|
+
}, {
|
|
12062
|
+
key: 'forTrackerClient',
|
|
12063
|
+
value: function forTrackerClient(tokenGenerator) {
|
|
12064
|
+
return JwtGateway.forTracker(tokenGenerator).then(function (jwtGateway) {
|
|
12065
|
+
return jwtGateway.toRequestInterceptor();
|
|
12066
|
+
});
|
|
12067
|
+
}
|
|
11483
12068
|
}]);
|
|
11484
12069
|
|
|
11485
12070
|
return JwtGateway;
|
|
@@ -11510,7 +12095,7 @@ module.exports = function () {
|
|
|
11510
12095
|
}
|
|
11511
12096
|
|
|
11512
12097
|
function forTgam(host, secret, environment) {
|
|
11513
|
-
|
|
12098
|
+
var endpoint = EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
|
|
11514
12099
|
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);
|
|
11515
12100
|
}).withHost(host).withRequestInterceptor(RequestInterceptor.fromDelegate(function (request) {
|
|
11516
12101
|
request.withCredentials = true;
|
|
@@ -11519,32 +12104,40 @@ module.exports = function () {
|
|
|
11519
12104
|
})).withResponseInterceptor(ResponseInterceptor.DATA).withResponseInterceptor(ResponseInterceptor.fromDelegate(function (response) {
|
|
11520
12105
|
return response.token;
|
|
11521
12106
|
})).endpoint;
|
|
12107
|
+
|
|
12108
|
+
return function () {
|
|
12109
|
+
return Gateway.invoke(endpoint);
|
|
12110
|
+
};
|
|
11522
12111
|
}
|
|
11523
12112
|
|
|
11524
12113
|
function getTime() {
|
|
11525
12114
|
return new Date().getTime();
|
|
11526
12115
|
}
|
|
11527
12116
|
|
|
12117
|
+
/**
|
|
12118
|
+
* A function returns a JWT token (or a promise for a JWT token).
|
|
12119
|
+
*
|
|
12120
|
+
* @callback JwtGateway~tokenGenerator
|
|
12121
|
+
* @returns {String|Promise.<String>}
|
|
12122
|
+
*/
|
|
12123
|
+
|
|
11528
12124
|
return JwtGateway;
|
|
11529
12125
|
}();
|
|
11530
12126
|
|
|
11531
|
-
},{"./index":
|
|
12127
|
+
},{"./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/assert":37,"@barchart/common-js/timing/Scheduler":50}],61:[function(require,module,exports){
|
|
11532
12128
|
'use strict';
|
|
11533
12129
|
|
|
11534
|
-
var JwtGateway = require('./JwtGateway');
|
|
11535
|
-
|
|
11536
12130
|
module.exports = function () {
|
|
11537
12131
|
'use strict';
|
|
11538
12132
|
|
|
11539
12133
|
return {
|
|
11540
|
-
|
|
11541
|
-
version: '1.0.38'
|
|
12134
|
+
version: '1.0.42'
|
|
11542
12135
|
};
|
|
11543
12136
|
}();
|
|
11544
12137
|
|
|
11545
|
-
},{
|
|
12138
|
+
},{}],62:[function(require,module,exports){
|
|
11546
12139
|
module.exports = require('./lib/axios');
|
|
11547
|
-
},{"./lib/axios":
|
|
12140
|
+
},{"./lib/axios":64}],63:[function(require,module,exports){
|
|
11548
12141
|
(function (process){
|
|
11549
12142
|
'use strict';
|
|
11550
12143
|
|
|
@@ -11728,7 +12321,7 @@ module.exports = function xhrAdapter(config) {
|
|
|
11728
12321
|
};
|
|
11729
12322
|
|
|
11730
12323
|
}).call(this,require('_process'))
|
|
11731
|
-
},{"../core/createError":
|
|
12324
|
+
},{"../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){
|
|
11732
12325
|
'use strict';
|
|
11733
12326
|
|
|
11734
12327
|
var utils = require('./utils');
|
|
@@ -11782,7 +12375,7 @@ module.exports = axios;
|
|
|
11782
12375
|
// Allow use of default import syntax in TypeScript
|
|
11783
12376
|
module.exports.default = axios;
|
|
11784
12377
|
|
|
11785
|
-
},{"./cancel/Cancel":
|
|
12378
|
+
},{"./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){
|
|
11786
12379
|
'use strict';
|
|
11787
12380
|
|
|
11788
12381
|
/**
|
|
@@ -11803,7 +12396,7 @@ Cancel.prototype.__CANCEL__ = true;
|
|
|
11803
12396
|
|
|
11804
12397
|
module.exports = Cancel;
|
|
11805
12398
|
|
|
11806
|
-
},{}],
|
|
12399
|
+
},{}],66:[function(require,module,exports){
|
|
11807
12400
|
'use strict';
|
|
11808
12401
|
|
|
11809
12402
|
var Cancel = require('./Cancel');
|
|
@@ -11862,14 +12455,14 @@ CancelToken.source = function source() {
|
|
|
11862
12455
|
|
|
11863
12456
|
module.exports = CancelToken;
|
|
11864
12457
|
|
|
11865
|
-
},{"./Cancel":
|
|
12458
|
+
},{"./Cancel":65}],67:[function(require,module,exports){
|
|
11866
12459
|
'use strict';
|
|
11867
12460
|
|
|
11868
12461
|
module.exports = function isCancel(value) {
|
|
11869
12462
|
return !!(value && value.__CANCEL__);
|
|
11870
12463
|
};
|
|
11871
12464
|
|
|
11872
|
-
},{}],
|
|
12465
|
+
},{}],68:[function(require,module,exports){
|
|
11873
12466
|
'use strict';
|
|
11874
12467
|
|
|
11875
12468
|
var defaults = require('./../defaults');
|
|
@@ -11950,7 +12543,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
11950
12543
|
|
|
11951
12544
|
module.exports = Axios;
|
|
11952
12545
|
|
|
11953
|
-
},{"./../defaults":
|
|
12546
|
+
},{"./../defaults":75,"./../utils":86,"./InterceptorManager":69,"./dispatchRequest":71}],69:[function(require,module,exports){
|
|
11954
12547
|
'use strict';
|
|
11955
12548
|
|
|
11956
12549
|
var utils = require('./../utils');
|
|
@@ -12004,7 +12597,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
|
|
|
12004
12597
|
|
|
12005
12598
|
module.exports = InterceptorManager;
|
|
12006
12599
|
|
|
12007
|
-
},{"./../utils":
|
|
12600
|
+
},{"./../utils":86}],70:[function(require,module,exports){
|
|
12008
12601
|
'use strict';
|
|
12009
12602
|
|
|
12010
12603
|
var enhanceError = require('./enhanceError');
|
|
@@ -12024,7 +12617,7 @@ module.exports = function createError(message, config, code, request, response)
|
|
|
12024
12617
|
return enhanceError(error, config, code, request, response);
|
|
12025
12618
|
};
|
|
12026
12619
|
|
|
12027
|
-
},{"./enhanceError":
|
|
12620
|
+
},{"./enhanceError":72}],71:[function(require,module,exports){
|
|
12028
12621
|
'use strict';
|
|
12029
12622
|
|
|
12030
12623
|
var utils = require('./../utils');
|
|
@@ -12112,7 +12705,7 @@ module.exports = function dispatchRequest(config) {
|
|
|
12112
12705
|
});
|
|
12113
12706
|
};
|
|
12114
12707
|
|
|
12115
|
-
},{"../cancel/isCancel":
|
|
12708
|
+
},{"../cancel/isCancel":67,"../defaults":75,"./../helpers/combineURLs":79,"./../helpers/isAbsoluteURL":81,"./../utils":86,"./transformData":74}],72:[function(require,module,exports){
|
|
12116
12709
|
'use strict';
|
|
12117
12710
|
|
|
12118
12711
|
/**
|
|
@@ -12135,7 +12728,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
|
|
|
12135
12728
|
return error;
|
|
12136
12729
|
};
|
|
12137
12730
|
|
|
12138
|
-
},{}],
|
|
12731
|
+
},{}],73:[function(require,module,exports){
|
|
12139
12732
|
'use strict';
|
|
12140
12733
|
|
|
12141
12734
|
var createError = require('./createError');
|
|
@@ -12163,7 +12756,7 @@ module.exports = function settle(resolve, reject, response) {
|
|
|
12163
12756
|
}
|
|
12164
12757
|
};
|
|
12165
12758
|
|
|
12166
|
-
},{"./createError":
|
|
12759
|
+
},{"./createError":70}],74:[function(require,module,exports){
|
|
12167
12760
|
'use strict';
|
|
12168
12761
|
|
|
12169
12762
|
var utils = require('./../utils');
|
|
@@ -12185,7 +12778,7 @@ module.exports = function transformData(data, headers, fns) {
|
|
|
12185
12778
|
return data;
|
|
12186
12779
|
};
|
|
12187
12780
|
|
|
12188
|
-
},{"./../utils":
|
|
12781
|
+
},{"./../utils":86}],75:[function(require,module,exports){
|
|
12189
12782
|
(function (process){
|
|
12190
12783
|
'use strict';
|
|
12191
12784
|
|
|
@@ -12281,7 +12874,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
|
|
12281
12874
|
module.exports = defaults;
|
|
12282
12875
|
|
|
12283
12876
|
}).call(this,require('_process'))
|
|
12284
|
-
},{"./adapters/http":
|
|
12877
|
+
},{"./adapters/http":63,"./adapters/xhr":63,"./helpers/normalizeHeaderName":83,"./utils":86,"_process":88}],76:[function(require,module,exports){
|
|
12285
12878
|
'use strict';
|
|
12286
12879
|
|
|
12287
12880
|
module.exports = function bind(fn, thisArg) {
|
|
@@ -12294,7 +12887,7 @@ module.exports = function bind(fn, thisArg) {
|
|
|
12294
12887
|
};
|
|
12295
12888
|
};
|
|
12296
12889
|
|
|
12297
|
-
},{}],
|
|
12890
|
+
},{}],77:[function(require,module,exports){
|
|
12298
12891
|
'use strict';
|
|
12299
12892
|
|
|
12300
12893
|
// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
|
|
@@ -12332,7 +12925,7 @@ function btoa(input) {
|
|
|
12332
12925
|
|
|
12333
12926
|
module.exports = btoa;
|
|
12334
12927
|
|
|
12335
|
-
},{}],
|
|
12928
|
+
},{}],78:[function(require,module,exports){
|
|
12336
12929
|
'use strict';
|
|
12337
12930
|
|
|
12338
12931
|
var utils = require('./../utils');
|
|
@@ -12402,7 +12995,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
|
|
|
12402
12995
|
return url;
|
|
12403
12996
|
};
|
|
12404
12997
|
|
|
12405
|
-
},{"./../utils":
|
|
12998
|
+
},{"./../utils":86}],79:[function(require,module,exports){
|
|
12406
12999
|
'use strict';
|
|
12407
13000
|
|
|
12408
13001
|
/**
|
|
@@ -12418,7 +13011,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
|
|
|
12418
13011
|
: baseURL;
|
|
12419
13012
|
};
|
|
12420
13013
|
|
|
12421
|
-
},{}],
|
|
13014
|
+
},{}],80:[function(require,module,exports){
|
|
12422
13015
|
'use strict';
|
|
12423
13016
|
|
|
12424
13017
|
var utils = require('./../utils');
|
|
@@ -12473,7 +13066,7 @@ module.exports = (
|
|
|
12473
13066
|
})()
|
|
12474
13067
|
);
|
|
12475
13068
|
|
|
12476
|
-
},{"./../utils":
|
|
13069
|
+
},{"./../utils":86}],81:[function(require,module,exports){
|
|
12477
13070
|
'use strict';
|
|
12478
13071
|
|
|
12479
13072
|
/**
|
|
@@ -12489,7 +13082,7 @@ module.exports = function isAbsoluteURL(url) {
|
|
|
12489
13082
|
return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
|
|
12490
13083
|
};
|
|
12491
13084
|
|
|
12492
|
-
},{}],
|
|
13085
|
+
},{}],82:[function(require,module,exports){
|
|
12493
13086
|
'use strict';
|
|
12494
13087
|
|
|
12495
13088
|
var utils = require('./../utils');
|
|
@@ -12559,7 +13152,7 @@ module.exports = (
|
|
|
12559
13152
|
})()
|
|
12560
13153
|
);
|
|
12561
13154
|
|
|
12562
|
-
},{"./../utils":
|
|
13155
|
+
},{"./../utils":86}],83:[function(require,module,exports){
|
|
12563
13156
|
'use strict';
|
|
12564
13157
|
|
|
12565
13158
|
var utils = require('../utils');
|
|
@@ -12573,7 +13166,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
|
|
|
12573
13166
|
});
|
|
12574
13167
|
};
|
|
12575
13168
|
|
|
12576
|
-
},{"../utils":
|
|
13169
|
+
},{"../utils":86}],84:[function(require,module,exports){
|
|
12577
13170
|
'use strict';
|
|
12578
13171
|
|
|
12579
13172
|
var utils = require('./../utils');
|
|
@@ -12628,7 +13221,7 @@ module.exports = function parseHeaders(headers) {
|
|
|
12628
13221
|
return parsed;
|
|
12629
13222
|
};
|
|
12630
13223
|
|
|
12631
|
-
},{"./../utils":
|
|
13224
|
+
},{"./../utils":86}],85:[function(require,module,exports){
|
|
12632
13225
|
'use strict';
|
|
12633
13226
|
|
|
12634
13227
|
/**
|
|
@@ -12657,7 +13250,7 @@ module.exports = function spread(callback) {
|
|
|
12657
13250
|
};
|
|
12658
13251
|
};
|
|
12659
13252
|
|
|
12660
|
-
},{}],
|
|
13253
|
+
},{}],86:[function(require,module,exports){
|
|
12661
13254
|
'use strict';
|
|
12662
13255
|
|
|
12663
13256
|
var bind = require('./helpers/bind');
|
|
@@ -12962,7 +13555,7 @@ module.exports = {
|
|
|
12962
13555
|
trim: trim
|
|
12963
13556
|
};
|
|
12964
13557
|
|
|
12965
|
-
},{"./helpers/bind":
|
|
13558
|
+
},{"./helpers/bind":76,"is-buffer":89}],87:[function(require,module,exports){
|
|
12966
13559
|
/*
|
|
12967
13560
|
* big.js v5.0.3
|
|
12968
13561
|
* A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
|
|
@@ -13903,7 +14496,7 @@ module.exports = {
|
|
|
13903
14496
|
}
|
|
13904
14497
|
})(this);
|
|
13905
14498
|
|
|
13906
|
-
},{}],
|
|
14499
|
+
},{}],88:[function(require,module,exports){
|
|
13907
14500
|
// shim for using process in browser
|
|
13908
14501
|
var process = module.exports = {};
|
|
13909
14502
|
|
|
@@ -14089,7 +14682,7 @@ process.chdir = function (dir) {
|
|
|
14089
14682
|
};
|
|
14090
14683
|
process.umask = function() { return 0; };
|
|
14091
14684
|
|
|
14092
|
-
},{}],
|
|
14685
|
+
},{}],89:[function(require,module,exports){
|
|
14093
14686
|
/*!
|
|
14094
14687
|
* Determine if an object is a Buffer
|
|
14095
14688
|
*
|
|
@@ -14112,7 +14705,7 @@ function isSlowBuffer (obj) {
|
|
|
14112
14705
|
return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
|
|
14113
14706
|
}
|
|
14114
14707
|
|
|
14115
|
-
},{}],
|
|
14708
|
+
},{}],90:[function(require,module,exports){
|
|
14116
14709
|
//! moment-timezone.js
|
|
14117
14710
|
//! version : 0.5.11
|
|
14118
14711
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -15314,7 +15907,7 @@ function isSlowBuffer (obj) {
|
|
|
15314
15907
|
return moment;
|
|
15315
15908
|
}));
|
|
15316
15909
|
|
|
15317
|
-
},{"moment":
|
|
15910
|
+
},{"moment":94}],91:[function(require,module,exports){
|
|
15318
15911
|
module.exports={
|
|
15319
15912
|
"version": "2016j",
|
|
15320
15913
|
"zones": [
|
|
@@ -15914,11 +16507,11 @@ module.exports={
|
|
|
15914
16507
|
"Pacific/Pohnpei|Pacific/Ponape"
|
|
15915
16508
|
]
|
|
15916
16509
|
}
|
|
15917
|
-
},{}],
|
|
16510
|
+
},{}],92:[function(require,module,exports){
|
|
15918
16511
|
var moment = module.exports = require("./moment-timezone");
|
|
15919
16512
|
moment.tz.load(require('./data/packed/latest.json'));
|
|
15920
16513
|
|
|
15921
|
-
},{"./data/packed/latest.json":
|
|
16514
|
+
},{"./data/packed/latest.json":91,"./moment-timezone":93}],93:[function(require,module,exports){
|
|
15922
16515
|
//! moment-timezone.js
|
|
15923
16516
|
//! version : 0.5.11
|
|
15924
16517
|
//! Copyright (c) JS Foundation and other contributors
|
|
@@ -16521,7 +17114,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16521
17114
|
return moment;
|
|
16522
17115
|
}));
|
|
16523
17116
|
|
|
16524
|
-
},{"moment":
|
|
17117
|
+
},{"moment":94}],94:[function(require,module,exports){
|
|
16525
17118
|
//! moment.js
|
|
16526
17119
|
|
|
16527
17120
|
;(function (global, factory) {
|
|
@@ -17996,9 +18589,9 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
17996
18589
|
|
|
17997
18590
|
mom = createUTC([2000, 1]).day(i);
|
|
17998
18591
|
if (strict && !this._fullWeekdaysParse[i]) {
|
|
17999
|
-
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '
|
|
18000
|
-
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '
|
|
18001
|
-
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '
|
|
18592
|
+
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
18593
|
+
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
18594
|
+
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
18002
18595
|
}
|
|
18003
18596
|
if (!this._weekdaysParse[i]) {
|
|
18004
18597
|
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
|
@@ -18801,7 +19394,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
18801
19394
|
|
|
18802
19395
|
function preprocessRFC2822(s) {
|
|
18803
19396
|
// Remove comments and folding whitespace and replace multiple-spaces with a single space
|
|
18804
|
-
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').
|
|
19397
|
+
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
|
18805
19398
|
}
|
|
18806
19399
|
|
|
18807
19400
|
function checkWeekday(weekdayStr, parsedInput, config) {
|
|
@@ -20183,7 +20776,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
20183
20776
|
|
|
20184
20777
|
addUnitAlias('date', 'D');
|
|
20185
20778
|
|
|
20186
|
-
//
|
|
20779
|
+
// PRIORITY
|
|
20187
20780
|
addUnitPriority('date', 9);
|
|
20188
20781
|
|
|
20189
20782
|
// PARSING
|
|
@@ -20980,7 +21573,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
20980
21573
|
// Side effect imports
|
|
20981
21574
|
|
|
20982
21575
|
|
|
20983
|
-
hooks.version = '2.22.
|
|
21576
|
+
hooks.version = '2.22.2';
|
|
20984
21577
|
|
|
20985
21578
|
setHookCallback(createLocal);
|
|
20986
21579
|
|
|
@@ -21029,5 +21622,210 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
21029
21622
|
|
|
21030
21623
|
})));
|
|
21031
21624
|
|
|
21032
|
-
},{}]
|
|
21625
|
+
},{}],95:[function(require,module,exports){
|
|
21626
|
+
var v1 = require('./v1');
|
|
21627
|
+
var v4 = require('./v4');
|
|
21628
|
+
|
|
21629
|
+
var uuid = v4;
|
|
21630
|
+
uuid.v1 = v1;
|
|
21631
|
+
uuid.v4 = v4;
|
|
21632
|
+
|
|
21633
|
+
module.exports = uuid;
|
|
21634
|
+
|
|
21635
|
+
},{"./v1":98,"./v4":99}],96:[function(require,module,exports){
|
|
21636
|
+
/**
|
|
21637
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
21638
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
21639
|
+
*/
|
|
21640
|
+
var byteToHex = [];
|
|
21641
|
+
for (var i = 0; i < 256; ++i) {
|
|
21642
|
+
byteToHex[i] = (i + 0x100).toString(16).substr(1);
|
|
21643
|
+
}
|
|
21644
|
+
|
|
21645
|
+
function bytesToUuid(buf, offset) {
|
|
21646
|
+
var i = offset || 0;
|
|
21647
|
+
var bth = byteToHex;
|
|
21648
|
+
return bth[buf[i++]] + bth[buf[i++]] +
|
|
21649
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21650
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21651
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21652
|
+
bth[buf[i++]] + bth[buf[i++]] + '-' +
|
|
21653
|
+
bth[buf[i++]] + bth[buf[i++]] +
|
|
21654
|
+
bth[buf[i++]] + bth[buf[i++]] +
|
|
21655
|
+
bth[buf[i++]] + bth[buf[i++]];
|
|
21656
|
+
}
|
|
21657
|
+
|
|
21658
|
+
module.exports = bytesToUuid;
|
|
21659
|
+
|
|
21660
|
+
},{}],97:[function(require,module,exports){
|
|
21661
|
+
(function (global){
|
|
21662
|
+
// Unique ID creation requires a high quality random # generator. In the
|
|
21663
|
+
// browser this is a little complicated due to unknown quality of Math.random()
|
|
21664
|
+
// and inconsistent support for the `crypto` API. We do the best we can via
|
|
21665
|
+
// feature-detection
|
|
21666
|
+
var rng;
|
|
21667
|
+
|
|
21668
|
+
var crypto = global.crypto || global.msCrypto; // for IE 11
|
|
21669
|
+
if (crypto && crypto.getRandomValues) {
|
|
21670
|
+
// WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
|
|
21671
|
+
var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
|
|
21672
|
+
rng = function whatwgRNG() {
|
|
21673
|
+
crypto.getRandomValues(rnds8);
|
|
21674
|
+
return rnds8;
|
|
21675
|
+
};
|
|
21676
|
+
}
|
|
21677
|
+
|
|
21678
|
+
if (!rng) {
|
|
21679
|
+
// Math.random()-based (RNG)
|
|
21680
|
+
//
|
|
21681
|
+
// If all else fails, use Math.random(). It's fast, but is of unspecified
|
|
21682
|
+
// quality.
|
|
21683
|
+
var rnds = new Array(16);
|
|
21684
|
+
rng = function() {
|
|
21685
|
+
for (var i = 0, r; i < 16; i++) {
|
|
21686
|
+
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
|
|
21687
|
+
rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
|
|
21688
|
+
}
|
|
21689
|
+
|
|
21690
|
+
return rnds;
|
|
21691
|
+
};
|
|
21692
|
+
}
|
|
21693
|
+
|
|
21694
|
+
module.exports = rng;
|
|
21695
|
+
|
|
21696
|
+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
|
21697
|
+
},{}],98:[function(require,module,exports){
|
|
21698
|
+
var rng = require('./lib/rng');
|
|
21699
|
+
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21700
|
+
|
|
21701
|
+
// **`v1()` - Generate time-based UUID**
|
|
21702
|
+
//
|
|
21703
|
+
// Inspired by https://github.com/LiosK/UUID.js
|
|
21704
|
+
// and http://docs.python.org/library/uuid.html
|
|
21705
|
+
|
|
21706
|
+
// random #'s we need to init node and clockseq
|
|
21707
|
+
var _seedBytes = rng();
|
|
21708
|
+
|
|
21709
|
+
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
|
|
21710
|
+
var _nodeId = [
|
|
21711
|
+
_seedBytes[0] | 0x01,
|
|
21712
|
+
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
|
|
21713
|
+
];
|
|
21714
|
+
|
|
21715
|
+
// Per 4.2.2, randomize (14 bit) clockseq
|
|
21716
|
+
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
|
|
21717
|
+
|
|
21718
|
+
// Previous uuid creation time
|
|
21719
|
+
var _lastMSecs = 0, _lastNSecs = 0;
|
|
21720
|
+
|
|
21721
|
+
// See https://github.com/broofa/node-uuid for API details
|
|
21722
|
+
function v1(options, buf, offset) {
|
|
21723
|
+
var i = buf && offset || 0;
|
|
21724
|
+
var b = buf || [];
|
|
21725
|
+
|
|
21726
|
+
options = options || {};
|
|
21727
|
+
|
|
21728
|
+
var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
|
|
21729
|
+
|
|
21730
|
+
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
|
|
21731
|
+
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
|
|
21732
|
+
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
|
|
21733
|
+
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
|
|
21734
|
+
var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
|
|
21735
|
+
|
|
21736
|
+
// Per 4.2.1.2, use count of uuid's generated during the current clock
|
|
21737
|
+
// cycle to simulate higher resolution clock
|
|
21738
|
+
var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
|
|
21739
|
+
|
|
21740
|
+
// Time since last uuid creation (in msecs)
|
|
21741
|
+
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
|
|
21742
|
+
|
|
21743
|
+
// Per 4.2.1.2, Bump clockseq on clock regression
|
|
21744
|
+
if (dt < 0 && options.clockseq === undefined) {
|
|
21745
|
+
clockseq = clockseq + 1 & 0x3fff;
|
|
21746
|
+
}
|
|
21747
|
+
|
|
21748
|
+
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
|
|
21749
|
+
// time interval
|
|
21750
|
+
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
|
|
21751
|
+
nsecs = 0;
|
|
21752
|
+
}
|
|
21753
|
+
|
|
21754
|
+
// Per 4.2.1.2 Throw error if too many uuids are requested
|
|
21755
|
+
if (nsecs >= 10000) {
|
|
21756
|
+
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
|
|
21757
|
+
}
|
|
21758
|
+
|
|
21759
|
+
_lastMSecs = msecs;
|
|
21760
|
+
_lastNSecs = nsecs;
|
|
21761
|
+
_clockseq = clockseq;
|
|
21762
|
+
|
|
21763
|
+
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
|
|
21764
|
+
msecs += 12219292800000;
|
|
21765
|
+
|
|
21766
|
+
// `time_low`
|
|
21767
|
+
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
|
|
21768
|
+
b[i++] = tl >>> 24 & 0xff;
|
|
21769
|
+
b[i++] = tl >>> 16 & 0xff;
|
|
21770
|
+
b[i++] = tl >>> 8 & 0xff;
|
|
21771
|
+
b[i++] = tl & 0xff;
|
|
21772
|
+
|
|
21773
|
+
// `time_mid`
|
|
21774
|
+
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
|
|
21775
|
+
b[i++] = tmh >>> 8 & 0xff;
|
|
21776
|
+
b[i++] = tmh & 0xff;
|
|
21777
|
+
|
|
21778
|
+
// `time_high_and_version`
|
|
21779
|
+
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
|
|
21780
|
+
b[i++] = tmh >>> 16 & 0xff;
|
|
21781
|
+
|
|
21782
|
+
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
|
|
21783
|
+
b[i++] = clockseq >>> 8 | 0x80;
|
|
21784
|
+
|
|
21785
|
+
// `clock_seq_low`
|
|
21786
|
+
b[i++] = clockseq & 0xff;
|
|
21787
|
+
|
|
21788
|
+
// `node`
|
|
21789
|
+
var node = options.node || _nodeId;
|
|
21790
|
+
for (var n = 0; n < 6; ++n) {
|
|
21791
|
+
b[i + n] = node[n];
|
|
21792
|
+
}
|
|
21793
|
+
|
|
21794
|
+
return buf ? buf : bytesToUuid(b);
|
|
21795
|
+
}
|
|
21796
|
+
|
|
21797
|
+
module.exports = v1;
|
|
21798
|
+
|
|
21799
|
+
},{"./lib/bytesToUuid":96,"./lib/rng":97}],99:[function(require,module,exports){
|
|
21800
|
+
var rng = require('./lib/rng');
|
|
21801
|
+
var bytesToUuid = require('./lib/bytesToUuid');
|
|
21802
|
+
|
|
21803
|
+
function v4(options, buf, offset) {
|
|
21804
|
+
var i = buf && offset || 0;
|
|
21805
|
+
|
|
21806
|
+
if (typeof(options) == 'string') {
|
|
21807
|
+
buf = options == 'binary' ? new Array(16) : null;
|
|
21808
|
+
options = null;
|
|
21809
|
+
}
|
|
21810
|
+
options = options || {};
|
|
21811
|
+
|
|
21812
|
+
var rnds = options.random || (options.rng || rng)();
|
|
21813
|
+
|
|
21814
|
+
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
21815
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
21816
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
21817
|
+
|
|
21818
|
+
// Copy bytes to buffer, if provided
|
|
21819
|
+
if (buf) {
|
|
21820
|
+
for (var ii = 0; ii < 16; ++ii) {
|
|
21821
|
+
buf[i + ii] = rnds[ii];
|
|
21822
|
+
}
|
|
21823
|
+
}
|
|
21824
|
+
|
|
21825
|
+
return buf || bytesToUuid(rnds);
|
|
21826
|
+
}
|
|
21827
|
+
|
|
21828
|
+
module.exports = v4;
|
|
21829
|
+
|
|
21830
|
+
},{"./lib/bytesToUuid":96,"./lib/rng":97}]},{},[1,5])(5)
|
|
21033
21831
|
});
|