@barchart/portfolio-client-js 2.0.0 → 3.1.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.
|
File without changes
|
|
@@ -84,7 +84,8 @@ module.exports = (() => {
|
|
|
84
84
|
.withHost(host)
|
|
85
85
|
.withPort(port)
|
|
86
86
|
.withPathBuilder((pb) => {
|
|
87
|
-
pb.withLiteralParameter('
|
|
87
|
+
pb.withLiteralParameter('version', 'v1')
|
|
88
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
88
89
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
89
90
|
})
|
|
90
91
|
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
@@ -99,7 +100,8 @@ module.exports = (() => {
|
|
|
99
100
|
.withHost(host)
|
|
100
101
|
.withPort(port)
|
|
101
102
|
.withPathBuilder((pb) => {
|
|
102
|
-
pb.withLiteralParameter('
|
|
103
|
+
pb.withLiteralParameter('version', 'v1')
|
|
104
|
+
.withLiteralParameter('portfolios', 'portfolios');
|
|
103
105
|
})
|
|
104
106
|
.withBody('portfolio')
|
|
105
107
|
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
@@ -115,7 +117,8 @@ module.exports = (() => {
|
|
|
115
117
|
.withHost(host)
|
|
116
118
|
.withPort(port)
|
|
117
119
|
.withPathBuilder((pb) => {
|
|
118
|
-
pb.withLiteralParameter('
|
|
120
|
+
pb.withLiteralParameter('version', 'v1')
|
|
121
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
119
122
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
120
123
|
})
|
|
121
124
|
.withBody('portfolio')
|
|
@@ -132,7 +135,8 @@ module.exports = (() => {
|
|
|
132
135
|
.withHost(host)
|
|
133
136
|
.withPort(port)
|
|
134
137
|
.withPathBuilder((pb) => {
|
|
135
|
-
pb.withLiteralParameter('
|
|
138
|
+
pb.withLiteralParameter('version', 'v1')
|
|
139
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
136
140
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
137
141
|
})
|
|
138
142
|
.withRequestInterceptor(requestInterceptor)
|
|
@@ -145,7 +149,8 @@ module.exports = (() => {
|
|
|
145
149
|
.withHost(host)
|
|
146
150
|
.withPort(port)
|
|
147
151
|
.withPathBuilder((pb) => {
|
|
148
|
-
pb.withLiteralParameter('
|
|
152
|
+
pb.withLiteralParameter('version', 'v1')
|
|
153
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
149
154
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
150
155
|
.withLiteralParameter('positions', 'positions')
|
|
151
156
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -165,7 +170,8 @@ module.exports = (() => {
|
|
|
165
170
|
.withHost(host)
|
|
166
171
|
.withPort(port)
|
|
167
172
|
.withPathBuilder((pb) => {
|
|
168
|
-
pb.withLiteralParameter('
|
|
173
|
+
pb.withLiteralParameter('version', 'v1')
|
|
174
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
169
175
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
170
176
|
.withLiteralParameter('positions', 'positions')
|
|
171
177
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -183,7 +189,8 @@ module.exports = (() => {
|
|
|
183
189
|
.withHost(host)
|
|
184
190
|
.withPort(port)
|
|
185
191
|
.withPathBuilder((pb) => {
|
|
186
|
-
pb.withLiteralParameter('
|
|
192
|
+
pb.withLiteralParameter('version', 'v1')
|
|
193
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
187
194
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
188
195
|
.withLiteralParameter('positions', 'positions')
|
|
189
196
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -200,7 +207,8 @@ module.exports = (() => {
|
|
|
200
207
|
.withHost(host)
|
|
201
208
|
.withPort(port)
|
|
202
209
|
.withPathBuilder((pb) => {
|
|
203
|
-
pb.withLiteralParameter('
|
|
210
|
+
pb.withLiteralParameter('version', 'v1')
|
|
211
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
204
212
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
205
213
|
.withLiteralParameter('summaries', 'summaries')
|
|
206
214
|
.withVariableParameter('position', 'position', 'position', false);
|
|
@@ -222,7 +230,8 @@ module.exports = (() => {
|
|
|
222
230
|
.withHost(host)
|
|
223
231
|
.withPort(port)
|
|
224
232
|
.withPathBuilder((pb) => {
|
|
225
|
-
pb.withLiteralParameter('
|
|
233
|
+
pb.withLiteralParameter('version', 'v1')
|
|
234
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
226
235
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
227
236
|
.withLiteralParameter('positions', 'positions')
|
|
228
237
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -240,7 +249,8 @@ module.exports = (() => {
|
|
|
240
249
|
.withHost(host)
|
|
241
250
|
.withPort(port)
|
|
242
251
|
.withPathBuilder((pb) => {
|
|
243
|
-
pb.withLiteralParameter('
|
|
252
|
+
pb.withLiteralParameter('version', 'v1')
|
|
253
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
244
254
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
245
255
|
.withLiteralParameter('positions', 'positions')
|
|
246
256
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -261,7 +271,8 @@ module.exports = (() => {
|
|
|
261
271
|
.withHost(host)
|
|
262
272
|
.withPort(port)
|
|
263
273
|
.withPathBuilder((pb) => {
|
|
264
|
-
pb.withLiteralParameter('
|
|
274
|
+
pb.withLiteralParameter('version', 'v1')
|
|
275
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
265
276
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
266
277
|
.withLiteralParameter('positions', 'positions')
|
|
267
278
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -282,7 +293,8 @@ module.exports = (() => {
|
|
|
282
293
|
.withHost(host)
|
|
283
294
|
.withPort(port)
|
|
284
295
|
.withPathBuilder((pb) => {
|
|
285
|
-
pb.withLiteralParameter('
|
|
296
|
+
pb.withLiteralParameter('version', 'v1')
|
|
297
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
286
298
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
287
299
|
.withLiteralParameter('positions', 'positions')
|
|
288
300
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -304,7 +316,8 @@ module.exports = (() => {
|
|
|
304
316
|
.withHost(host)
|
|
305
317
|
.withPort(port)
|
|
306
318
|
.withPathBuilder((pb) => {
|
|
307
|
-
pb.withLiteralParameter('
|
|
319
|
+
pb.withLiteralParameter('version', 'v1')
|
|
320
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
308
321
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
309
322
|
.withLiteralParameter('positions', 'positions')
|
|
310
323
|
.withVariableParameter('position', 'position', 'position', false)
|
|
@@ -327,7 +340,8 @@ module.exports = (() => {
|
|
|
327
340
|
.withHost(host)
|
|
328
341
|
.withPort(port)
|
|
329
342
|
.withPathBuilder((pb) => {
|
|
330
|
-
pb.withLiteralParameter('
|
|
343
|
+
pb.withLiteralParameter('version', 'v1')
|
|
344
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
331
345
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
332
346
|
.withLiteralParameter('positions', 'positions')
|
|
333
347
|
.withVariableParameter('position', 'position', 'position', true)
|
|
@@ -353,7 +367,8 @@ module.exports = (() => {
|
|
|
353
367
|
.withHost(host)
|
|
354
368
|
.withPort(port)
|
|
355
369
|
.withPathBuilder((pb) => {
|
|
356
|
-
pb.withLiteralParameter('
|
|
370
|
+
pb.withLiteralParameter('version', 'v1')
|
|
371
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
357
372
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
358
373
|
.withLiteralParameter('wealthscope', 'wealthscope')
|
|
359
374
|
.withLiteralParameter('token', 'token');
|
|
@@ -370,7 +385,8 @@ module.exports = (() => {
|
|
|
370
385
|
.withHost(host)
|
|
371
386
|
.withPort(port)
|
|
372
387
|
.withPathBuilder((pb) => {
|
|
373
|
-
pb.withLiteralParameter('
|
|
388
|
+
pb.withLiteralParameter('version', 'v1')
|
|
389
|
+
.withLiteralParameter('portfolios', 'portfolios')
|
|
374
390
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
375
391
|
.withLiteralParameter('reports', 'reports')
|
|
376
392
|
.withLiteralParameter('brokerage', 'brokerage')
|
|
@@ -391,7 +407,8 @@ module.exports = (() => {
|
|
|
391
407
|
.withHost(host)
|
|
392
408
|
.withPort(port)
|
|
393
409
|
.withPathBuilder((pb) => {
|
|
394
|
-
pb.withLiteralParameter('
|
|
410
|
+
pb.withLiteralParameter('version', 'v1')
|
|
411
|
+
.withLiteralParameter('system', 'system')
|
|
395
412
|
.withLiteralParameter('version', 'version');
|
|
396
413
|
})
|
|
397
414
|
.withRequestInterceptor(requestInterceptor)
|
|
@@ -1346,8 +1363,8 @@ module.exports = (() => {
|
|
|
1346
1363
|
}
|
|
1347
1364
|
});
|
|
1348
1365
|
|
|
1349
|
-
function start(gateway) {
|
|
1350
|
-
return gateway.
|
|
1366
|
+
function start(gateway, jwtProvider) {
|
|
1367
|
+
return gateway.connect(jwtProvider)
|
|
1351
1368
|
.then(() => {
|
|
1352
1369
|
return gateway;
|
|
1353
1370
|
});
|
package/lib/index.js
CHANGED
|
@@ -136,6 +136,22 @@ module.exports = (() => {
|
|
|
136
136
|
return getJwtProviderForImpersonation(Configuration.getJwtImpersonationHost, 'dev', userId, contextId, permissions);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Builds a {@link JwtProvider} which will generate tokens impersonating the specified
|
|
141
|
+
* user. The "admin" environment is for Barchart use only and access is restricted
|
|
142
|
+
* to Barchart's internal network.
|
|
143
|
+
*
|
|
144
|
+
* @public
|
|
145
|
+
* @static
|
|
146
|
+
* @param {String} userId - The user identifier to impersonate.
|
|
147
|
+
* @param {String} contextId - The context identifier of the user to impersonate.
|
|
148
|
+
* @param {String=} permissions - The desired permission level.
|
|
149
|
+
* @returns {JwtProvider}
|
|
150
|
+
*/
|
|
151
|
+
static forAdmin(userId, contextId, permissions) {
|
|
152
|
+
return getJwtProviderForImpersonation(Configuration.getJwtImpersonationHost, 'admin', userId, contextId, permissions);
|
|
153
|
+
}
|
|
154
|
+
|
|
139
155
|
_onDispose() {
|
|
140
156
|
this._scheduler.dispose();
|
|
141
157
|
this._scheduler = null;
|