Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ sudo: false
language: node_js
node_js: "4.0"
script:
- gulp build
- mocha test/cov.js --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js
- npm install -g bower
- bower install getstream
#node test/browser/runner.js
- npm run sauce
addons:
sauce_connect: true
env:
global:
- secure: KKcEWcF2eDpiU7HaHEQyHDXB81J1T41r3TQpFxKHIZoyns3P8ualSXQZIAq2XW0Szwkixd7sRpmKG36YGiMiYHivd0SQ1FzzUDcCUqvO4Vvr4Gdws2eJbTfjNDtRQXzhRx4GhkSADYqVI8rjusQmWAO+A4scy0KI5LmDSS1JTw0=
- secure: Rkd2w0xYZX47FM3u4SCMvHluWtB7SlfMEc3C2/AvgZBVDmzknI5LtCAohJhmVkSZZvlhxPRgFir3CVfZeP5V3IBsIwrLeOSVDQ0FOnpvZsQt1wxCHhebVdL681ufYDB8cjwbAegaaTZjoLCzIhfX6r69f90qhI/MZ1ERebW2U9E=
- secure: QmxG6aSNZfZlrXcA92/NzX2GNNzcyiFMwEVi9iC2AnHhcm2/YKBtJHQy2AlMpKOON80UZuzYHpKely7jOOASJ7Blr7S4e6uiJR5lPCsW5RFxylY81z1MGhYtMu/64Yau64dFu9Uzue07jwRLVwbLp/jQgkPT3/i/G4qAsx6gK6c=
- secure: FlnXcxMo1nfcsW2V8N/n6ZcVsdyxGS+opiaZNhnQNRotPBgGUYeysDVAdKENV1OPMLO3RCasxtxJc9l2vwQVHN6OpuLLqfuWuqK6ZlnlTSCZNHBNSSX0JyaKpu4/Kx9NF2Q2LWMN3dP8QhMG69OIP9Pzv9R0/jpI4+HOlOSWT5Y=
# - secure: KKcEWcF2eDpiU7HaHEQyHDXB81J1T41r3TQpFxKHIZoyns3P8ualSXQZIAq2XW0Szwkixd7sRpmKG36YGiMiYHivd0SQ1FzzUDcCUqvO4Vvr4Gdws2eJbTfjNDtRQXzhRx4GhkSADYqVI8rjusQmWAO+A4scy0KI5LmDSS1JTw0=
# - secure: Rkd2w0xYZX47FM3u4SCMvHluWtB7SlfMEc3C2/AvgZBVDmzknI5LtCAohJhmVkSZZvlhxPRgFir3CVfZeP5V3IBsIwrLeOSVDQ0FOnpvZsQt1wxCHhebVdL681ufYDB8cjwbAegaaTZjoLCzIhfX6r69f90qhI/MZ1ERebW2U9E=
105 changes: 99 additions & 6 deletions dist/js/getstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ return /******/ (function(modules) { // webpackBootstrap
*/
var description = this.node ? 'node' : 'browser';
// TODO: get the version here in a way which works in both and browserify
var version = 'unknown';

var version = __webpack_require__(14).version;

return 'stream-javascript-client-' + description + '-' + version;
},

Expand Down Expand Up @@ -514,7 +516,7 @@ return /******/ (function(modules) { // webpackBootstrap
kwargs.headers = {};

// auto-detect authentication type and set HTTP headers accordingly
if (signing.isJWTSignature(signature)) {
if (signature && signing.isJWTSignature(signature)) {
kwargs.headers['stream-auth-type'] = 'jwt';
signature = signature.split(' ').reverse()[0];
} else {
Expand Down Expand Up @@ -690,7 +692,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {array} events List of events to track
* @return {string} The redirect url
*/
var url = __webpack_require__(14);
var url = __webpack_require__(15);
var uri = url.parse(targetUrl);

if (!(uri.host || uri.hostname && uri.port) && !uri.isUnix) {
Expand Down Expand Up @@ -1864,7 +1866,7 @@ return /******/ (function(modules) { // webpackBootstrap
'use strict';

var Faye = {
VERSION: '1.1.1',
VERSION: '1.1.2',

BAYEUX_VERSION: '1.0',
ID_LENGTH: 160,
Expand Down Expand Up @@ -3555,8 +3557,8 @@ return /******/ (function(modules) { // webpackBootstrap
if (!this.batching) return Faye.Promise.fulfilled(this.request([message]));

this._outbox.push(message);
this._flushLargeBatch();
this._promise = this._promise || new Faye.Promise();
this._flushLargeBatch();

if (message.channel === Faye.Channel.HANDSHAKE) {
this.addTimeout('publish', 0.01, this._flush, this);
Expand Down Expand Up @@ -4230,7 +4232,7 @@ return /******/ (function(modules) { // webpackBootstrap
var promise = new Faye.Promise();

this.callback(function(socket) {
if (!socket) return;
if (!socket || socket.readyState !== 1) return;
socket.send(Faye.toJSON(messages));
Faye.Promise.fulfill(promise, socket);
}, this);
Expand Down Expand Up @@ -4507,6 +4509,7 @@ return /******/ (function(modules) { // webpackBootstrap
request: function(messages) {
var xhrClass = Faye.ENV.XDomainRequest ? XDomainRequest : XMLHttpRequest,
xhr = new xhrClass(),
id = ++Faye.Transport.CORS._id,
headers = this._dispatcher.headers,
self = this,
key;
Expand All @@ -4523,6 +4526,7 @@ return /******/ (function(modules) { // webpackBootstrap

var cleanUp = function() {
if (!xhr) return false;
Faye.Transport.CORS._pending.remove(id);
xhr.onload = xhr.onerror = xhr.ontimeout = xhr.onprogress = null;
xhr = null;
};
Expand All @@ -4547,10 +4551,17 @@ return /******/ (function(modules) { // webpackBootstrap
};

xhr.onprogress = function() {};

if (xhrClass === Faye.ENV.XDomainRequest)
Faye.Transport.CORS._pending.add({id: id, xhr: xhr});

xhr.send(this.encode(messages));
return xhr;
}
}), {
_id: 0,
_pending: new Faye.Set(),

isUsable: function(dispatcher, endpoint, callback, context) {
if (Faye.URI.isSameOrigin(endpoint))
return callback.call(context, false);
Expand Down Expand Up @@ -4711,6 +4722,88 @@ return /******/ (function(modules) { // webpackBootstrap

/***/ },
/* 14 */
/***/ function(module, exports) {

module.exports = {
"author": {
"name": "Thierry Schellenbach",
"company": "Stream.io Inc"
},
"name": "getstream",
"description": "The official low-level GetStream.io client for Node.js and the browser.",
"main": "./src/getstream.js",
"homepage": "https://getstream.io/",
"version": "3.0.0",
"browser": {
"request": "browser-request",
"crypto": false,
"jsonwebtoken": false,
"./src/lib/batch_operations.js": false,
"qs": false,
"url": false
},
"config": {
"blanket": {
"pattern": "src",
"data-cover-never": [
"node_modules"
]
}
},
"devDependencies": {
"async": "~0.9.0",
"babel-core": "^5.8.25",
"babel-loader": "^5.3.2",
"blanket": "~1.1.6",
"bluebird": "^2.1.3",
"connect": "^3.0.1",
"coveralls": "~2.10.1",
"expect.js": "~0.3.1",
"gulp": "^3.8.7",
"gulp-browserify": "^0.5.0",
"gulp-bump": "^0.1.8",
"gulp-git": "git://github.com/stevelacy/gulp-git.git",
"gulp-jscs": "^3.0.1",
"gulp-jscs-stylish": "^1.2.1",
"gulp-jshint": "^1.6.3",
"gulp-mocha": "^0.4.1",
"gulp-shell": "^0.2.7",
"gulp-uglify": "~0.3.1",
"gulp-util": "^2.2.17",
"jshint-stylish": "^2.0.1",
"json-loader": "^0.5.4",
"mocha": "^1.20.1",
"mocha-lcov-reporter": "0.0.1",
"mocha-sauce": "git://github.com/pbakaus/mocha-sauce.git",
"quickcheck": "0.0.4",
"serve-static": "^1.2.3",
"vinyl-source-stream": "^1.1.0",
"webpack": "^1.12.2"
},
"license": "BSD",
"dependencies": {
"Base64": "^0.3.0",
"browser-request": "matthisk/browser-request",
"faye": "^1.0.1",
"http-signature": "^1.0.2",
"jsonwebtoken": "^5.0.1",
"qs": "^5.2.0",
"request": "2.63.0"
},
"repository": {
"type": "git",
"url": "git://github.com/GetStream/stream-js.git"
},
"scripts": {
"test": "gulp test"
},
"engines": {
"node": ">=0.8 <0.11"
}
};

/***/ },
/* 15 */
/***/ function(module, exports) {

/* (ignored) */
Expand Down
4 changes: 2 additions & 2 deletions dist/js_min/getstream.js

Large diffs are not rendered by default.

26 changes: 12 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ gulp.task("build", function() {
runSynchronized(['build:webpack', 'build:test', 'build:optimize']);
});

var prodWebpackConfig = Object.create(webpackConfig);

gulp.task("build:webpack", function(callback) {
var myConfig = Object.create(webpackConfig);
webpack(myConfig, function(err, stats) {
webpack(prodWebpackConfig, function(err, stats) {
if(err) throw new gutil.PluginError("webpack:build", err);
gutil.log("[webpack:build]", stats.toString({
colors: true
Expand All @@ -94,19 +94,17 @@ gulp.task("build:webpack", function(callback) {
});
});

var testWebpackConfig = Object.create(webpackConfig);

testWebpackConfig.context = process.cwd();
testWebpackConfig.entry = './test/browser/index.js';
testWebpackConfig.output = {
path: __dirname + '/test/browser',
filename: 'browser.js'
};

gulp.task('build:test', function(callback) {
webpack({
entry: './test/browser/index.js',
output : {
path: __dirname + '/test/browser',
filename: 'browser.js'
},
resolve: {
alias: {
'request': 'browser-request',
}
}
}, function(err, stats) {
webpack(testWebpackConfig, function(err, stats) {
if(err) throw new gutil.PluginError("webpack:build:test", err);
gutil.log("[webpack:build:test]", stats.toString({
colors: true
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"gulp-uglify": "~0.3.1",
"gulp-util": "^2.2.17",
"jshint-stylish": "^2.0.1",
"json-loader": "^0.5.4",
"mocha": "^1.20.1",
"mocha-lcov-reporter": "0.0.1",
"mocha-sauce": "git://github.com/pbakaus/mocha-sauce.git",
Expand All @@ -68,7 +69,8 @@
"url": "git://github.com/GetStream/stream-js.git"
},
"scripts": {
"test": "gulp test"
"test": "gulp test",
"sauce": "node test/saucelabs.js"
},
"engines": {
"node": ">=0.8 <0.11"
Expand Down
7 changes: 4 additions & 3 deletions src/lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,9 @@ StreamClient.prototype = {
* @return {string} current user agent
*/
var description = (this.node) ? 'node' : 'browser';
// TODO: get the version here in a way which works in both and browserify
var version = 'unknown';

var version = require('../../package.json').version;

return 'stream-javascript-client-' + description + '-' + version;
},

Expand Down Expand Up @@ -301,7 +302,7 @@ StreamClient.prototype = {
kwargs.headers = {};

// auto-detect authentication type and set HTTP headers accordingly
if (signing.isJWTSignature(signature)) {
if (signature && signing.isJWTSignature(signature)) {
kwargs.headers['stream-auth-type'] = 'jwt';
signature = signature.split(' ').reverse()[0];
} else {
Expand Down
Loading