@barchart/portfolio-client-js 5.1.1 → 5.1.2

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/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtProvider: JwtProvider,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '5.1.1'
10
+ version: '5.1.2'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
7
7
  "email": "bryan.ingle@barchart.com",
8
- "url": "http://www.barchart.com"
8
+ "url": "https://www.barchart.com"
9
9
  },
10
10
  "scripts": {
11
11
  "test": "echo \"Error: Please use gulp to run tests\" && exit 1"
package/.jshintrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "esversion": 9,
3
- "validthis": true,
4
- "-W018": true
5
- }
@@ -1,9 +0,0 @@
1
- **Breaking Changes**
2
-
3
- * 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:
4
- * The ```RequestInterceptor``` argument was replaced with a ```JwtProvider``` argument on static factory functions (e.g. ```PortfolioGateway.forProduction```).
5
- * The ```RequestInterceptor``` argument was removed from the ```PortfolioGateway``` constructor.
6
- * The ```PortfolioGateway.start``` function was renamed to ```PortfolioGateway.connect``` and now has a ```JwtProvider``` argument.
7
- * The ```JwtGateway``` and ```JwtEndpoint``` classes were removed.
8
- * Static factory functions for impersonating users in the ```test``` and ```development``` environments were added. See ```JwtProvider.forTest``` and ```JwtProvider.forDevelopment```.
9
- * Removed ```PortfolioGateway.batchTransactions``` function.
@@ -1,3 +0,0 @@
1
- **New Features**
2
-
3
- * Added ```JwtProvider.forAdmin``` function.
@@ -1,3 +0,0 @@
1
- **New Features**
2
-
3
- * Added ```PortfolioGateway.queryPositionsForSymbol``` function.
@@ -1,3 +0,0 @@
1
- **New Features**
2
-
3
- * Added optional ```product``` argument to the ```PortfolioGateway``` constructor.
@@ -1,3 +0,0 @@
1
- **New Features**
2
-
3
- * Added ```PortfolioGateway.readMarketValue``` function.
@@ -1,3 +0,0 @@
1
- **Bug Fix**
2
-
3
- * Fixed ```PortfolioGateway.readMarketValue``` function.
@@ -1,6 +0,0 @@
1
- **Breaking Changes**
2
-
3
- * Renamed ```PortfolioGateway.readPositionsValues``` function to ```PortfolioGateway.readPositionValuations```.
4
- * Renamed ```PortfolioGateway.readMarketValue``` function to ```PortfolioGateway.queryPositionValuations```.
5
- * Renamed ```PortfolioGateway.observePositionCalculating``` function to ```PortfolioGateway.observeValuationsForPosition```.
6
- * Renamed ```PortfolioGateway.observePortfolioCalculating``` function to ```PortfolioGateway.observeValuationsForPortfolio```.
@@ -1,3 +0,0 @@
1
- **New Features**
2
-
3
- * Added `sequence` parameter for the `readTransactions` function.
@@ -1,3 +0,0 @@
1
- **Other**
2
-
3
- * Correct internal implementation of SDK to address breaking changes to remote API.
@@ -1,8 +0,0 @@
1
- **New Features**
2
-
3
- * Added `PortfolioGateway.switchTransaction` function, allowing the reinvestment choice for a single dividend or distribution to be changed.
4
- * Added `readPositionValuationsAvailability` method.
5
-
6
- **Other**
7
-
8
- * Removed legacy `observeValuationsForPortfolio` and `observeValuationsForPositions` methods.
@@ -1,4 +0,0 @@
1
- **Technical Enhancements**
2
-
3
- * Updated `barchart/common-js` to the v4.9.0.
4
- * Updated `gulp` script.
package/buildspec.yml DELETED
@@ -1,20 +0,0 @@
1
- version: 0.2
2
-
3
- env:
4
- secrets-manager:
5
- NPM_READONLY_TOKEN: NPM_READONLY_TOKEN
6
-
7
- phases:
8
- install:
9
- runtime-versions:
10
- nodejs: 12.x
11
-
12
- pre_build:
13
- commands:
14
- - echo -e $'\n'//registry.npmjs.org/:_authToken=$NPM_READONLY_TOKEN >> .npmrc
15
- - npm install
16
-
17
- build:
18
- commands:
19
- - ./node_modules/.bin/gulp lint
20
- - ./node_modules/.bin/gulp test
@@ -1,59 +0,0 @@
1
- const PortfolioGateway = require('./../../lib/gateway/PortfolioGateway'),
2
- JwtProvider = require('./../../lib/security/JwtProvider');
3
-
4
- console.info(`Example: Node.js example script started.`);
5
-
6
- let portfolioGateway = null;
7
-
8
- process.on('SIGINT', () => {
9
- console.info('Example: Processing SIGINT');
10
-
11
- if (portfolioGateway !== null) {
12
- portfolioGateway.dispose();
13
- }
14
-
15
- process.exit();
16
- });
17
-
18
- process.on('unhandledRejection', (error) => {
19
- console.error('Unhandled Promise Rejection', error);
20
- });
21
-
22
- process.on('uncaughtException', (error) => {
23
- console.error('Unhandled Error', error);
24
- });
25
-
26
- const userId = process.argv[2];
27
- const contextId = process.argv[3];
28
-
29
- const symbol = process.argv[4];
30
-
31
- if (typeof(userId) !== 'string' || userId.length === 0) {
32
- console.error('A user identifier must be specified. Usage example: "node example.js user-123"');
33
- process.exit();
34
- }
35
-
36
- console.info(`Example: Initializing PortfolioGateway, connecting to test environment as [ ${userId} ] [ ${contextId} ].`);
37
-
38
- PortfolioGateway.forDevelopment(JwtProvider.forDevelopment(userId, contextId))
39
- .then((gateway) => {
40
- portfolioGateway = gateway;
41
-
42
- console.info(`Example: Retrieving portfolio(s) for [ ${userId} ] [ ${contextId} ].`);
43
-
44
- return portfolioGateway.readPortfolios()
45
- .then((portfolios) => {
46
- console.info(`Example: Retrieved [ ${portfolios.length} ] portfolio(s) for [ ${userId} ] [ ${contextId} ].`);
47
- });
48
- }).then(() => {
49
- console.info(`Example: Querying positions(s) for [ ${userId} ] [ ${contextId} ] [ ${symbol} ].`);
50
-
51
- return portfolioGateway.queryPositionsForSymbol(symbol)
52
- .then((portfolios) => {
53
- console.info(`Example: Retrieved [ ${portfolios.length} ] portion(s) for [ ${userId} ] [ ${contextId} ] [ ${symbol} ].`);
54
- });
55
- }).then(() => {
56
- portfolioGateway.dispose();
57
-
58
- console.info(`Example: Node.js example script completed normally.`);
59
- });
package/gulpfile.js DELETED
@@ -1,148 +0,0 @@
1
- const gulp = require('gulp');
2
-
3
- const fs = require('fs');
4
-
5
- const browserify = require('browserify'),
6
- buffer = require('vinyl-buffer'),
7
- exec = require('child_process').exec,
8
- git = require('gulp-git'),
9
- gitStatus = require('git-get-status'),
10
- glob = require('glob'),
11
- jasmine = require('gulp-jasmine'),
12
- jshint = require('gulp-jshint'),
13
- prompt = require('gulp-prompt'),
14
- replace = require('gulp-replace'),
15
- source = require('vinyl-source-stream');
16
-
17
- function getVersionFromPackage() {
18
- return JSON.parse(fs.readFileSync('./package.json', 'utf8')).version;
19
- }
20
-
21
- function getGitHubLink() {
22
- const pkg = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
23
-
24
- const link = pkg.homepage.replace(/#.*/g, '');
25
-
26
- return `Project GitHub: ${link}`;
27
- }
28
-
29
- gulp.task('ensure-clean-working-directory', (cb) => {
30
- gitStatus((err, status) => {
31
- if (err, !status.clean) {
32
- throw new Error('Unable to proceed, your working directory is not clean.');
33
- }
34
-
35
- cb();
36
- });
37
- });
38
-
39
-
40
- gulp.task('bump-choice', (cb) => {
41
- const processor = prompt.prompt({
42
- type: 'list',
43
- name: 'bump',
44
- message: 'What type of bump would you like to do?',
45
- choices: ['patch', 'minor', 'major'],
46
- }, (res) => {
47
- global.bump = res.bump;
48
-
49
- return cb();
50
- });
51
-
52
- return gulp.src(['./package.json']).pipe(processor);
53
- });
54
-
55
- gulp.task('bump-version', (cb) => {
56
- exec(`npm version ${global.bump || 'patch'} --no-git-tag-version`, {
57
- cwd: './'
58
- }, (error) => {
59
- if (error) {
60
- cb(error);
61
- }
62
-
63
- cb();
64
- });
65
- });
66
-
67
- gulp.task('embed-version', () => {
68
- var version = getVersionFromPackage();
69
-
70
- return gulp.src(['./lib/index.js'])
71
- .pipe(replace(/(version:\s*')([0-9]+\.[0-9]+\.[0-9]+)(')/g, '$1' + version + '$3'))
72
- .pipe(gulp.dest('./lib/'));
73
- });
74
-
75
- gulp.task('commit-changes', () => {
76
- return gulp.src([ './', './test/', './package.json', './lib/index.js', './test/SpecRunner.js' ])
77
- .pipe(git.add())
78
- .pipe(git.commit('Release. Bump version number'));
79
- });
80
-
81
- gulp.task('push-changes', (cb) => {
82
- git.push('origin', 'master', cb);
83
- });
84
-
85
- gulp.task('create-tag', (cb) => {
86
- const version = getVersionFromPackage();
87
-
88
- git.tag(version, 'Release ' + version, (error) => {
89
- if (error) {
90
- return cb(error);
91
- }
92
-
93
- git.push('origin', 'master', { args: '--tags' }, cb);
94
- });
95
- });
96
-
97
- gulp.task('build-test-bundle', () => {
98
- return browserify({ entries: glob.sync('test/specs/**/*.js') })
99
- .bundle()
100
- .pipe(source('SpecRunner.js'))
101
- .pipe(buffer())
102
- .pipe(gulp.dest('test'));
103
- });
104
-
105
- gulp.task('execute-browser-tests', () => {
106
- return gulp.src('test/SpecRunner.js')
107
- .pipe(jasmine());
108
- });
109
-
110
- gulp.task('execute-node-tests', () => {
111
- return gulp.src(['test/specs/**/*.js'])
112
- .pipe(jasmine());
113
- });
114
-
115
- gulp.task('print-github', () => {
116
- return Promise.resolve().then(() => {
117
- console.info(getGitHubLink());
118
- });
119
- });
120
-
121
- gulp.task('execute-tests', gulp.series(
122
- 'build-test-bundle',
123
- 'execute-browser-tests',
124
- 'execute-node-tests'
125
- ));
126
-
127
- gulp.task('release', gulp.series(
128
- 'ensure-clean-working-directory',
129
- 'execute-tests',
130
- 'bump-choice',
131
- 'bump-version',
132
- 'embed-version',
133
- 'commit-changes',
134
- 'push-changes',
135
- 'create-tag',
136
- 'print-github'
137
- ));
138
-
139
- gulp.task('lint', () => {
140
- return gulp.src([ './**/*.js', './test/specs/**/*.js', '!./node_modules/**', '!./docs/**', '!./test/SpecRunner.js' ])
141
- .pipe(jshint({ esversion: 9 }))
142
- .pipe(jshint.reporter('default'))
143
- .pipe(jshint.reporter('fail'));
144
- });
145
-
146
- gulp.task('test', gulp.series('execute-tests'));
147
-
148
- gulp.task('default', gulp.series('lint'));
@@ -1 +0,0 @@
1
- (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({},{},[]);