@barchart/portfolio-client-js 3.2.0 → 3.3.0
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/.releases/3.2.0.md +1 -1
- package/.releases/3.3.0.md +3 -0
- package/lib/gateway/PortfolioGateway.js +9 -4
- package/lib/index.js +4 -4
- package/package.json +1 -1
package/.releases/3.2.0.md
CHANGED
|
@@ -34,7 +34,7 @@ module.exports = (() => {
|
|
|
34
34
|
|
|
35
35
|
const REST_API_SECURE_PROTOCOL = 'https';
|
|
36
36
|
const REST_API_SECURE_PORT = 443;
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
/**
|
|
39
39
|
* The **central component of the SDK**. It is responsible for connecting to Barchart's
|
|
40
40
|
* Portfolio Service. It can be used to query, edit, and delete portfolios.
|
|
@@ -44,19 +44,20 @@ module.exports = (() => {
|
|
|
44
44
|
* @param {String} host - The hostname of the Portfolio web service.
|
|
45
45
|
* @param {Number} port - The TCP port number of the Portfolio web service.
|
|
46
46
|
* @param {String} environment - A description of the environment we're connecting to.
|
|
47
|
+
* @param {String=} product - A product code which uses the gateway.
|
|
47
48
|
* @extends {Disposable}
|
|
48
49
|
*/
|
|
49
50
|
class PortfolioGateway extends Disposable {
|
|
50
|
-
constructor(protocol, host, port, environment) {
|
|
51
|
+
constructor(protocol, host, port, environment, product) {
|
|
51
52
|
super();
|
|
52
53
|
|
|
53
54
|
this._environment = environment;
|
|
54
55
|
|
|
55
56
|
this._jwtProvider = null;
|
|
56
|
-
|
|
57
|
+
|
|
57
58
|
this._started = false;
|
|
58
59
|
this._startPromise = null;
|
|
59
|
-
|
|
60
|
+
|
|
60
61
|
const requestInterceptor = RequestInterceptor.fromDelegate((options, endpoint) => {
|
|
61
62
|
return Promise.resolve()
|
|
62
63
|
.then(() => {
|
|
@@ -65,6 +66,10 @@ module.exports = (() => {
|
|
|
65
66
|
options.headers = options.headers || {};
|
|
66
67
|
options.headers.Authorization = `Bearer ${token}`;
|
|
67
68
|
|
|
69
|
+
if (is.string(product) && product.length > 0) {
|
|
70
|
+
options.headers['X-Barchart-Product'] = product;
|
|
71
|
+
}
|
|
72
|
+
|
|
68
73
|
return options;
|
|
69
74
|
});
|
|
70
75
|
}).catch((e) => {
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const JwtProvider = require('./security/JwtProvider'),
|
|
2
2
|
PortfolioGateway = require('./gateway/PortfolioGateway');
|
|
3
3
|
|
|
4
4
|
module.exports = (() => {
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
7
|
return {
|
|
8
|
-
|
|
8
|
+
JwtProvider: JwtProvider,
|
|
9
9
|
PortfolioGateway: PortfolioGateway,
|
|
10
|
-
version: '3.
|
|
10
|
+
version: '3.3.0'
|
|
11
11
|
};
|
|
12
|
-
})();
|
|
12
|
+
})();
|