@barchart/portfolio-api-common 1.3.18 → 1.3.19

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/README.md CHANGED
@@ -1,2 +1,7 @@
1
1
  # @barchart/portfolio-api-common
2
2
  ## Barchart Portfolio API Common Components
3
+
4
+ Shared code, used by the serverless application and the client-side SDK. See:
5
+
6
+ * https://github.com/barchart/aws-lambda-portfolio and
7
+ * https://github.com/barchart/portfolio-client-js
package/gulpfile.js CHANGED
@@ -1,5 +1,7 @@
1
1
  const gulp = require('gulp');
2
2
 
3
+ const fs = require('fs');
4
+
3
5
  const browserify = require('browserify'),
4
6
  buffer = require('vinyl-buffer'),
5
7
  bump = require('gulp-bump'),
@@ -9,31 +11,30 @@ const browserify = require('browserify'),
9
11
  glob = require('glob'),
10
12
  jasmine = require('gulp-jasmine'),
11
13
  jshint = require('gulp-jshint'),
12
- runSequence = require('run-sequence'),
13
- source = require('vinyl-source-stream'),
14
- util = require('gulp-util');
15
-
16
- const fs = require('fs');
14
+ replace = require('gulp-replace'),
15
+ source = require('vinyl-source-stream');
17
16
 
18
17
  function getVersionFromPackage() {
19
18
  return JSON.parse(fs.readFileSync('./package.json', 'utf8')).version;
20
19
  }
21
20
 
22
- gulp.task('ensure-clean-working-directory', () => {
23
- gitStatus(function(err, status) {
21
+ gulp.task('ensure-clean-working-directory', (cb) => {
22
+ gitStatus((err, status) => {
24
23
  if (err, !status.clean) {
25
24
  throw new Error('Unable to proceed, your working directory is not clean.');
26
25
  }
26
+
27
+ cb();
27
28
  });
28
29
  });
29
30
 
30
31
  gulp.task('bump-version', () => {
31
- return gulp.src([ './package.json' ])
32
- .pipe(bump({ type: 'patch' }).on('error', util.log))
33
- .pipe(gulp.dest('./'));
32
+ return gulp.src([ './package.json' ])
33
+ .pipe(bump({ type: 'patch' }))
34
+ .pipe(gulp.dest('./'));
34
35
  });
35
36
 
36
- gulp.task('document', function (cb) {
37
+ gulp.task('document', (cb) => {
37
38
  exec('jsdoc . -c jsdoc.json -r -d docs', (error, stdout, stderr) => {
38
39
  console.log(stdout);
39
40
  console.log(stderr);
@@ -55,7 +56,7 @@ gulp.task('push-changes', (cb) => {
55
56
  gulp.task('create-tag', (cb) => {
56
57
  const version = getVersionFromPackage();
57
58
 
58
- git.tag(version, 'Release ' + version, function (error) {
59
+ git.tag(version, 'Release ' + version, (error) => {
59
60
  if (error) {
60
61
  return cb(error);
61
62
  }
@@ -82,41 +83,21 @@ gulp.task('execute-node-tests', () => {
82
83
  .pipe(jasmine());
83
84
  });
84
85
 
85
- gulp.task('execute-tests', (cb) => {
86
- runSequence(
87
- 'build-test-bundle',
88
- 'execute-browser-tests',
89
- 'execute-node-tests',
90
-
91
- function (error) {
92
- if (error) {
93
- console.log(error.message);
94
- }
95
-
96
- cb(error);
97
- });
98
- });
99
-
100
- gulp.task('release', (cb) => {
101
- runSequence(
102
- 'ensure-clean-working-directory',
103
- 'execute-tests',
104
- 'document',
105
- 'bump-version',
106
- 'commit-changes',
107
- 'push-changes',
108
- 'create-tag',
109
-
110
- function (error) {
111
- if (error) {
112
- console.log(error.message);
113
- } else {
114
- console.log('Release complete');
115
- }
116
-
117
- cb(error);
118
- });
119
- });
86
+ gulp.task('execute-tests', gulp.series(
87
+ 'build-test-bundle',
88
+ 'execute-browser-tests',
89
+ 'execute-node-tests'
90
+ ));
91
+
92
+ gulp.task('release', gulp.series(
93
+ 'ensure-clean-working-directory',
94
+ 'execute-tests',
95
+ 'document',
96
+ 'bump-version',
97
+ 'commit-changes',
98
+ 'push-changes',
99
+ 'create-tag'
100
+ ));
120
101
 
121
102
  gulp.task('lint', () => {
122
103
  return gulp.src([ './**/*.js', './test/specs/**/*.js', '!./node_modules/**', '!./docs/**', '!./test/SpecRunner.js' ])
@@ -124,6 +105,6 @@ gulp.task('lint', () => {
124
105
  .pipe(jshint.reporter('default'));
125
106
  });
126
107
 
127
- gulp.task('test', [ 'execute-tests' ]);
108
+ gulp.task('test', gulp.series('execute-tests'));
128
109
 
129
- gulp.task('default', [ 'lint' ]);
110
+ gulp.task('default', gulp.series('lint'));
@@ -298,7 +298,7 @@ module.exports = (() => {
298
298
  const transactionCreateFailedTypeInvalidForInstrument = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_INSTRUMENT', 'Unable to process transaction, {L|transactionType.description} transactions cannot be used with {L|instrumentType.description} positions.');
299
299
  const transactionCreateFailedTypeInvalidForDirection = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_DIRECTION', 'Unable to process transaction, a {L|positionDirection.description} position would be created (i.e. you would have {L|positionDirection.sign} shares/units). {u|instrumentType.description} positions cannot have {L|positionDirection.description} positions.', false);
300
300
  const transactionCreateFailedInvalidDirectionSwitch = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_DIRECTION_SWITCH', 'Unable to process transaction, the transaction would switch the position from {L|currentDirection.description} to {L|proposedDirection.description} (i.e. {L|currentDirection.sign} to {L|proposedDirection.sign} shares/units). This is not allowed. Please close the current position (i.e. zero it out) and then enter a second transaction.', false);
301
- const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_INITIAL_TYPE', 'Unable to process operation because the first transaction would to be a {U|transactionType.description}, which is not allowed -- since {U|transactionType.description} transactions cannot open a position.');
301
+ const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_INITIAL_TYPE', 'Unable to process operation because the first transaction would to be a {U|transactionType.description}, which is not allowed -- since {U|transactionType.description} transactions cannot open a position.', false);
302
302
 
303
303
  const transactionCreateFailedTypeReserved = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_RESERVED', 'Unable to create {U|type.description} transaction, this type of transaction is managed by the system.');
304
304
  const transactionCreateFailedReinvestPriceUnavailable = new FailureType('TRANSACTION_CREATE_FAILED_REINVEST_PRICE_UNAVAILABLE', 'Unable to create transaction, a dividend was paid on {L|day}; however no historical price is available for this day. To successfully create this transaction, please turn off dividend reinvestment for this position.');
@@ -218,7 +218,6 @@ module.exports = (() => {
218
218
  const last = array.last(transactions);
219
219
 
220
220
  const firstDate = first.date;
221
- const lastDate = last.date;
222
221
 
223
222
  let lastYear;
224
223
 
@@ -277,13 +276,12 @@ module.exports = (() => {
277
276
  const ranges = [ ];
278
277
 
279
278
  if (transactions.length !== 0) {
280
- const first = array.first(transactions);
281
279
  const last = array.last(transactions);
282
280
 
283
281
  const currentYear = Day.getToday().year;
284
282
 
285
283
  if (!last.snapshot.open.getIsZero() || last.date.year === currentYear) {
286
- let end = new Day(Day.getToday().year, 12, 31);
284
+ let end = new Day(currentYear, 12, 31);
287
285
  let start = end.subtractYears(1);
288
286
 
289
287
  ranges.push(getRange(start, end));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.3.18",
3
+ "version": "1.3.19",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -13,23 +13,22 @@
13
13
  "uuid": "3.1.0"
14
14
  },
15
15
  "devDependencies": {
16
- "babel-core": "^6.26.0",
17
- "babel-preset-es2015": "^6.24.1",
18
- "babelify": "^8.0.0",
19
- "browserify": "^14.5.0",
16
+ "@babel/core": "^7.6.2",
17
+ "babelify": "^10.0.0",
18
+ "browserify": "^16.5.0",
20
19
  "git-get-status": "^1.0.5",
21
20
  "glob": "^6.0.1",
22
- "gulp": "~3.9.0",
21
+ "gulp": "^4.0.2",
23
22
  "gulp-bump": "~1.0.0",
24
- "gulp-git": "^2.5.1",
23
+ "gulp-git": "^2.9.0",
25
24
  "gulp-jasmine": "^2.2.1",
25
+ "gulp-jsdoc3": "^1.0.1",
26
26
  "gulp-jshint": "~2.1.0",
27
- "gulp-util": "^3.0.7",
27
+ "gulp-replace": "^0.5.4",
28
28
  "jsdoc": "^3.5.5",
29
29
  "jshint": "2.9.5",
30
- "run-sequence": "~1.1.4",
31
- "vinyl-buffer": "^1.0.0",
32
- "vinyl-source-stream": "^1.1.0"
30
+ "vinyl-buffer": "^1.0.1",
31
+ "vinyl-source-stream": "^2.0.0"
33
32
  },
34
33
  "license": "GPL-3.0"
35
34
  }