Socket
Socket
Sign inDemoInstall

@barchart/events-client-js

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@barchart/events-client-js - npm Package Compare versions

Comparing version 1.3.7 to 1.3.9

example/browser/example.css

163

gulpfile.js
const gulp = require('gulp');
const browserify = require('browserify'),
const fs = require('fs');
const AWS = require('aws-sdk'),
awspublish = require('gulp-awspublish'),
browserify = require('browserify'),
buffer = require('vinyl-buffer'),

@@ -11,10 +15,8 @@ bump = require('gulp-bump'),

jasmine = require('gulp-jasmine'),
jsdoc = require('gulp-jsdoc3'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
replace = require('gulp-replace'),
runSequence = require('run-sequence'),
source = require('vinyl-source-stream'),
util = require('gulp-util');
source = require('vinyl-source-stream');
const fs = require('fs');
function getVersionFromPackage() {

@@ -24,7 +26,18 @@ return JSON.parse(fs.readFileSync('./package.json', 'utf8')).version;

gulp.task('ensure-clean-working-directory', () => {
gitStatus(function(err, status) {
gulp.task('document', (cb) => {
exec('jsdoc . -c jsdoc.json -r -d docs', (error, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb();
});
});
gulp.task('ensure-clean-working-directory', (cb) => {
gitStatus((err, status) => {
if (err, !status.clean) {
throw new Error('Unable to proceed, your working directory is not clean.');
}
cb();
});

@@ -35,10 +48,10 @@ });

return gulp.src([ './package.json' ])
.pipe(bump({ type: 'patch' }).on('error', util.log))
.pipe(bump({ type: 'patch' }))
.pipe(gulp.dest('./'));
});
gulp.task('embed-version', function () {
var version = getVersionFromPackage();
gulp.task('embed-version', () => {
const version = getVersionFromPackage();
return gulp.src(['./lib/index.js'])
return gulp.src(['./lib/meta.js'])
.pipe(replace(/(version:\s*')([0-9]+\.[0-9]+\.[0-9]+)(')/g, '$1' + version + '$3'))

@@ -48,13 +61,5 @@ .pipe(gulp.dest('./lib/'));

gulp.task('document', function (cb) {
exec('jsdoc . -c jsdoc.json -r -d docs', (error, stdout, stderr) => {
console.log(stdout);
console.log(stderr);
cb();
});
});
gulp.task('commit-changes', () => {
return gulp.src([ './', './test/', './package.json', './lib/index.js', './example/example.js', './test/SpecRunner.js' ])
return gulp.src([ './', './test/', './package.json', './lib/meta.js', './example/browser/example.event.js', './example/browser/example.report.js', './test/SpecRunner.js' ])
.pipe(git.add())

@@ -71,3 +76,3 @@ .pipe(git.commit('Release. Bump version number'));

git.tag(version, 'Release ' + version, function (error) {
git.tag(version, 'Release ' + version, (error) => {
if (error) {

@@ -81,32 +86,48 @@ return cb(error);

gulp.task('build-example-bundles', (cb) => {
runSequence(
'build-example-event-bundle',
'build-example-report-bundle',
function (error) {
if (error) {
console.log(error.message);
}
cb(error);
});
});
gulp.task('build-example-event-bundle', function() {
return browserify([ './example/src/js/example.shim.js', './example/src/js/example.event.vue.js' ])
gulp.task('build-example-event-bundle', () => {
return browserify([ './example/browser/js/startup.event.vue.js' ])
.bundle()
.pipe(source('example.event.js'))
.pipe(buffer())
.pipe(gulp.dest('./example'));
.pipe(gulp.dest('./example/browser'));
});
gulp.task('build-example-report-bundle', function() {
return browserify([ './example/src/js/example.shim.js', './example/src/js/example.report.vue.js' ])
gulp.task('build-example-report-bundle', () => {
return browserify([ './example/browser/js/startup.report.vue.js' ])
.bundle()
.pipe(source('example.report.js'))
.pipe(buffer())
.pipe(gulp.dest('./example'));
.pipe(gulp.dest('./example/browser'));
});
gulp.task('build-example-bundles', gulp.series(
'build-example-event-bundle',
'build-example-report-bundle'
));
gulp.task('build', gulp.series('build-example-bundles'));
gulp.task('upload-example-to-S3', () => {
let publisher = awspublish.create({
region: 'us-east-1',
params: {
Bucket: 'barchart-examples'
},
credentials: new AWS.SharedIniFileCredentials({profile: 'default'})
});
let headers = {'Cache-Control': 'no-cache'};
let options = {};
return gulp.src(['./example/browser/example.css', './example/browser/example.event.html', './example/browser/example.event.js', './example/browser/example.report.html', './example/browser/example.report.js'])
.pipe(rename((path) => {
path.dirname = 'events-client-js';
}))
.pipe(publisher.publish(headers, options))
.pipe(publisher.cache())
.pipe(awspublish.reporter());
});
gulp.task('deploy-examples', gulp.series('upload-example-to-S3'));
gulp.task('build-test-bundle', () => {

@@ -130,42 +151,22 @@ return browserify({ entries: glob.sync('test/specs/**/*.js') })

gulp.task('execute-tests', (cb) => {
runSequence(
'build-test-bundle',
'execute-browser-tests',
'execute-node-tests',
gulp.task('execute-tests', gulp.series(
'build-test-bundle',
'execute-browser-tests',
'execute-node-tests'
));
function (error) {
if (error) {
console.log(error.message);
}
gulp.task('release', gulp.series(
'ensure-clean-working-directory',
'execute-tests',
'document',
'bump-version',
'embed-version',
'build-example-bundles',
'commit-changes',
'push-changes',
'create-tag'
));
cb(error);
});
});
gulp.task('release', (cb) => {
runSequence(
'ensure-clean-working-directory',
'execute-tests',
'document',
'bump-version',
'embed-version',
'build-example-bundles',
'commit-changes',
'push-changes',
'create-tag',
function (error) {
if (error) {
console.log(error.message);
} else {
console.log('Release complete');
}
cb(error);
});
});
gulp.task('lint', () => {
return gulp.src([ './**/*.js', './test/specs/**/*.js', '!./node_modules/**', '!./docs/**', '!./test/SpecRunner.js', '!./example/example.event.js', '!./example/example.report.js' ])
return gulp.src([ './**/*.js', './test/specs/**/*.js', '!./node_modules/**', '!./docs/**', '!./test/SpecRunner.js', '!./example/browser/example.event.js', '!./example/browser/example.report.js' ])
.pipe(jshint({'esversion': 6}))

@@ -175,4 +176,4 @@ .pipe(jshint.reporter('default'));

gulp.task('test', [ 'execute-tests' ]);
gulp.task('test', gulp.series('execute-tests'));
gulp.task('default', [ 'lint' ]);
gulp.task('default', gulp.series('lint'));

@@ -28,7 +28,12 @@ const assert = require('@barchart/common-js/lang/assert'),

* @param {Number} port - The TCP port number of the Events web service.
* @param {Object} credentials - The credentials of the Report API.
*/
class ReportGateway extends Disposable {
constructor(protocol, host, port) {
constructor(protocol, host, port, credentials) {
super();
assert.argumentIsRequired(credentials, 'credentials', Object);
assert.argumentIsRequired(credentials.username, 'credentials.username', String, 'String');
assert.argumentIsRequired(credentials.password, 'credentials.password', String, 'String');
this._started = false;

@@ -48,2 +53,3 @@ this._startPromise = null;

.withBody('filter')
.withBasicAuthentication(credentials.username, credentials.password)
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)

@@ -64,2 +70,3 @@ .withResponseInterceptor(responseInterceptorForReportDeserialization)

})
.withBasicAuthentication(credentials.username, credentials.password)
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)

@@ -70,5 +77,16 @@ .withResponseInterceptor(responseInterceptorForReportAvailabilityDeserialization)

this._reportUrlGenerator = (source) => {
return `https://${host}/reports/${source}`;
};
this._getReportEndpoint = EndpointBuilder.for('get-report', 'get report')
.withVerb(VerbType.GET)
.withProtocol(protocolType)
.withHost(host)
.withPort(port)
.withPathBuilder((pb) => {
pb.withLiteralParameter('reports', 'reports')
.withVariableParameter('source', 'source', 'source', false);
})
.withBasicAuthentication(credentials.username, credentials.password)
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
.withResponseInterceptor(responseInterceptorForGetReport)
.withErrorInterceptor(ErrorInterceptor.GENERAL)
.endpoint;
}

@@ -143,14 +161,20 @@

/**
* Generates a URL suitable for downloading a report (as a CSV)
* Downloads a report (as a CSV)
*
* @public
* @param {String} source
* @return {String}
* @return {Promise<Object>}
*/
getReportUrl(source) {
checkStart.call(this);
getReport(source) {
return Promise.resolve()
.then(() => {
checkStart.call(this);
assert.argumentIsRequired(source, 'source', String);
assert.argumentIsRequired(source, 'source', String);
return this._reportUrlGenerator(source);
const payload = { };
payload.source = source;
return Gateway.invoke(this._getReportEndpoint, payload);
});
}

@@ -165,6 +189,6 @@

*/
static forStaging() {
static forStaging(credentials) {
return Promise.resolve()
.then(() => {
return start(new ReportGateway('https', Configuration.stagingHost, 443));
return start(new ReportGateway('https', Configuration.stagingHost, 443, credentials));
});

@@ -180,6 +204,6 @@ }

*/
static forProduction() {
static forProduction(credentials) {
return Promise.resolve()
.then(() => {
return start(new ReportGateway('https', Configuration.productionHost, 443));
return start(new ReportGateway('https', Configuration.productionHost, 443, credentials));
});

@@ -193,2 +217,10 @@ }

const responseInterceptorForGetReport = ResponseInterceptor.fromDelegate((response) => {
try {
return JSON.parse(response.data);
} catch (e) {
console.log('Error deserializing report', e);
}
});
const responseInterceptorForReportDeserialization = ResponseInterceptor.fromDelegate((response) => {

@@ -195,0 +227,0 @@ try {

{
"name": "@barchart/events-client-js",
"version": "1.3.7",
"version": "1.3.9",
"description": "JavaScript library for interfacing with Barchart's Events API",

@@ -18,9 +18,11 @@ "author": {

"devDependencies": {
"babel-core": "^6.26.0",
"@babel/core": "^7.6.2",
"aws-sdk": "^2.546.0",
"babel-preset-es2015": "^6.24.1",
"babelify": "^8.0.0",
"browserify": "^14.5.0",
"babelify": "^10.0.0",
"browserify": "^16.5.0",
"git-get-status": "^1.0.5",
"glob": "^6.0.1",
"gulp": "~3.9.0",
"gulp": "^4.0.2",
"gulp-awspublish": "^4.0.0",
"gulp-bump": "~1.0.0",

@@ -30,11 +32,9 @@ "gulp-git": "^2.5.1",

"gulp-jsdoc3": "^1.0.1",
"gulp-jshint": "~1.11.2",
"gulp-rename": "^1.2.2",
"gulp-jshint": "~2.1.0",
"gulp-rename": "^1.4.0",
"gulp-replace": "^0.5.4",
"gulp-util": "^3.0.7",
"jsdoc": "^3.5.5",
"run-sequence": "~1.1.4",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"vinyl-transform": "^1.0.0"
"jshint": "2.9.5",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
},

@@ -44,8 +44,3 @@ "browserify": {

[
"babelify",
{
"presets": [
"es2015"
]
}
"babelify"
]

@@ -52,0 +47,0 @@ ]

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc