@barchart/portfolio-client-js 1.4.7 → 2.0.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/2.0.0.md +10 -0
- package/gulpfile.js +2 -11
- package/lib/common/Configuration.js +46 -23
- package/lib/gateway/PortfolioGateway.js +150 -127
- package/lib/index.js +2 -2
- package/lib/security/JwtProvider.js +188 -0
- package/lib/security/meta.js +14 -0
- package/package.json +6 -6
- package/example/example.css +0 -124
- package/example/example.html +0 -98
- package/example/example.js +0 -22074
- package/example/js/startup.js +0 -963
- package/lib/gateway/jwt/JwtGateway.js +0 -410
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
**Breaking Changes**
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
* The mechanism for passing JSON Web Tokens to the ```PortfolioGateway``` has changed. Consumers are now required to provide ```JwtProvider``` instances instead of a ```RequestInterceptor``` instances. Here are the specifics:
|
|
5
|
+
* The ```RequestInterceptor``` argument was replaced with a ```JwtProvider``` argument on static factory functions (e.g. ```PortfolioGateway.forProduction```).
|
|
6
|
+
* The ```RequestInterceptor``` argument was removed from the ```PortfolioGateway``` constructor.
|
|
7
|
+
* The ```PortfolioGateway.start``` function was renamed to ```PortfolioGateway.connect``` and now has a ```JwtProvider``` argument.
|
|
8
|
+
* The ```JwtGateway``` and ```JwtEndpoint``` classes were removed.
|
|
9
|
+
* Static factory functions for impersonating users in the ```test``` and ```development``` environments were added. See ```JwtProvider.forTest``` and ```JwtProvider.forDevelopment```.
|
|
10
|
+
* Removed ```PortfolioGateway.batchTransactions``` function.
|
package/gulpfile.js
CHANGED
|
@@ -65,7 +65,7 @@ gulp.task('embed-version', () => {
|
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
gulp.task('commit-changes', () => {
|
|
68
|
-
return gulp.src([ './', './test/', './package.json', './lib/index.js', './
|
|
68
|
+
return gulp.src([ './', './test/', './package.json', './lib/index.js', './test/SpecRunner.js' ])
|
|
69
69
|
.pipe(git.add())
|
|
70
70
|
.pipe(git.commit('Release. Bump version number'));
|
|
71
71
|
});
|
|
@@ -86,14 +86,6 @@ gulp.task('create-tag', (cb) => {
|
|
|
86
86
|
});
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
-
gulp.task('build-example-bundle', () => {
|
|
90
|
-
return browserify([ './lib/index.js', './example/js/startup.js', ])
|
|
91
|
-
.bundle()
|
|
92
|
-
.pipe(source('example.js'))
|
|
93
|
-
.pipe(buffer())
|
|
94
|
-
.pipe(gulp.dest('./example'));
|
|
95
|
-
});
|
|
96
|
-
|
|
97
89
|
gulp.task('build-test-bundle', () => {
|
|
98
90
|
return browserify({ entries: glob.sync('test/specs/**/*.js') })
|
|
99
91
|
.bundle()
|
|
@@ -124,14 +116,13 @@ gulp.task('release', gulp.series(
|
|
|
124
116
|
'bump-choice',
|
|
125
117
|
'bump-version',
|
|
126
118
|
'embed-version',
|
|
127
|
-
'build-example-bundle',
|
|
128
119
|
'commit-changes',
|
|
129
120
|
'push-changes',
|
|
130
121
|
'create-tag'
|
|
131
122
|
));
|
|
132
123
|
|
|
133
124
|
gulp.task('lint', () => {
|
|
134
|
-
return gulp.src([ './**/*.js', './test/specs/**/*.js', '!./node_modules/**', '!./docs/**', '!./test/SpecRunner.js'
|
|
125
|
+
return gulp.src([ './**/*.js', './test/specs/**/*.js', '!./node_modules/**', '!./docs/**', '!./test/SpecRunner.js' ])
|
|
135
126
|
.pipe(jshint({ esversion: 9 }))
|
|
136
127
|
.pipe(jshint.reporter('default'))
|
|
137
128
|
.pipe(jshint.reporter('fail'));
|
|
@@ -11,24 +11,8 @@ module.exports = (() => {
|
|
|
11
11
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
static getBrokerageHost(host) {
|
|
15
|
-
if (host === Configuration.developmentHost) {
|
|
16
|
-
return '7enbtpamgg.execute-api.us-east-1.amazonaws.com/dev';
|
|
17
|
-
} else if (host === Configuration.stagingHost) {
|
|
18
|
-
return 'i98b1sdxp6.execute-api.us-east-1.amazonaws.com/stage';
|
|
19
|
-
} else if (host === Configuration.productionHost) {
|
|
20
|
-
return 'xos40seq3e.execute-api.us-east-1.amazonaws.com/prod';
|
|
21
|
-
} else if (host === Configuration.adminHost) {
|
|
22
|
-
return 'q1x45oxon1.execute-api.us-east-1.amazonaws.com/admin';
|
|
23
|
-
} else if (host === Configuration.demoHost) {
|
|
24
|
-
return 'b9132ukaob.execute-api.us-east-1.amazonaws.com/demo';
|
|
25
|
-
} else {
|
|
26
|
-
return '';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
14
|
/**
|
|
31
|
-
* The
|
|
15
|
+
* The hostname of the REST API for the development environment (intended for Barchart use only).
|
|
32
16
|
*
|
|
33
17
|
* @public
|
|
34
18
|
* @static
|
|
@@ -39,7 +23,18 @@ module.exports = (() => {
|
|
|
39
23
|
}
|
|
40
24
|
|
|
41
25
|
/**
|
|
42
|
-
* The
|
|
26
|
+
* The hostname of the REST API for the test environment (public use allowed).
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @static
|
|
30
|
+
* @returns {String}
|
|
31
|
+
*/
|
|
32
|
+
static get testHost() {
|
|
33
|
+
return 'portfolio-test.aws.barchart.com';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The hostname of the REST API for the staging environment (public use allowed).
|
|
43
38
|
*
|
|
44
39
|
* @public
|
|
45
40
|
* @static
|
|
@@ -50,18 +45,18 @@ module.exports = (() => {
|
|
|
50
45
|
}
|
|
51
46
|
|
|
52
47
|
/**
|
|
53
|
-
* The
|
|
48
|
+
* The hostname of the REST API for the demo environment (intended for Barchart use only).
|
|
54
49
|
*
|
|
55
50
|
* @public
|
|
56
51
|
* @static
|
|
57
|
-
* @
|
|
52
|
+
* @returns {String}
|
|
58
53
|
*/
|
|
59
54
|
static get demoHost() {
|
|
60
55
|
return 'portfolio-demo.aws.barchart.com';
|
|
61
56
|
}
|
|
62
57
|
|
|
63
58
|
/**
|
|
64
|
-
* The
|
|
59
|
+
* The hostname of the REST API for the production environment (public use allowed).
|
|
65
60
|
*
|
|
66
61
|
* @public
|
|
67
62
|
* @static
|
|
@@ -72,16 +67,44 @@ module.exports = (() => {
|
|
|
72
67
|
}
|
|
73
68
|
|
|
74
69
|
/**
|
|
75
|
-
* The
|
|
70
|
+
* The hostname of the REST API for the admin environment (intended for Barchart use only).
|
|
76
71
|
*
|
|
77
72
|
* @public
|
|
78
73
|
* @static
|
|
79
|
-
* @
|
|
74
|
+
* @returns {String}
|
|
80
75
|
*/
|
|
81
76
|
static get adminHost() {
|
|
82
77
|
return 'portfolio-admin.aws.barchart.com';
|
|
83
78
|
}
|
|
84
79
|
|
|
80
|
+
/**
|
|
81
|
+
* The hostname of REST API which generates impersonation tokens for non-secure
|
|
82
|
+
* test and demo environments.
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
* @static
|
|
86
|
+
* @returns {string}
|
|
87
|
+
*/
|
|
88
|
+
static get getJwtImpersonationHost() {
|
|
89
|
+
return 'jwt-public-prod.aws.barchart.com';
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static getBrokerageHost(host) {
|
|
93
|
+
if (host === Configuration.developmentHost) {
|
|
94
|
+
return '7enbtpamgg.execute-api.us-east-1.amazonaws.com/dev';
|
|
95
|
+
} else if (host === Configuration.stagingHost) {
|
|
96
|
+
return 'i98b1sdxp6.execute-api.us-east-1.amazonaws.com/stage';
|
|
97
|
+
} else if (host === Configuration.productionHost) {
|
|
98
|
+
return 'xos40seq3e.execute-api.us-east-1.amazonaws.com/prod';
|
|
99
|
+
} else if (host === Configuration.adminHost) {
|
|
100
|
+
return 'q1x45oxon1.execute-api.us-east-1.amazonaws.com/admin';
|
|
101
|
+
} else if (host === Configuration.demoHost) {
|
|
102
|
+
return 'b9132ukaob.execute-api.us-east-1.amazonaws.com/demo';
|
|
103
|
+
} else {
|
|
104
|
+
return '';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
85
108
|
toString() {
|
|
86
109
|
return '[Configuration]';
|
|
87
110
|
}
|