New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

buildbot-data

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buildbot-data - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

2

bower.json
{
"name": "bbData",
"version": "1.0.0",
"version": "1.0.2",
"homepage": "https://github.com/tothandras/buildbot-data",

@@ -5,0 +5,0 @@ "authors": [

@@ -545,3 +545,3 @@ (function() {

} else {
socketPromise = $q.when();
socketPromise = $q.resolve();
}

@@ -548,0 +548,0 @@ return socketPromise.then(function() {

@@ -1,1 +0,1 @@

(function(){var t;t=function(){function t(){return[]}return t}(),angular.module("bbData",new t)}).call(this),function(){var t;t=function(){function t(t){t.interceptors.push(function(t,e){return{request:function(n){return 0===n.url.indexOf(e)&&t.debug(n.method+" "+n.url),n}}})}return t}(),angular.module("bbData").config(["$httpProvider",t])}.call(this),function(){var t,e;t=function(){function t(){return"api/v2/"}return t}(),e=function(){function t(){return["builders","builds","buildrequests","buildslaves","buildsets","changes","changesources","masters","sourcestamps","schedulers","forceschedulers"]}return t}(),angular.module("bbData").constant("API",t()).constant("ENDPOINTS",e())}.call(this),function(){var t,e=[].slice;t=function(){function t(t,n,r){var o;return o=function(){function o(t,e,n){var o;if(this.endpoint=e,null==n&&(n=[]),!angular.isString(this.endpoint))throw new TypeError("Parameter 'endpoint' must be a string, not "+typeof this.endpoint);this.update(t),this.constructor.generateFunctions(n),o=r.classId(this.endpoint),this.id=this[o],this.subscribe()}return o.prototype.update=function(t){return angular.extend(this,t)},o.prototype.get=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.get.apply(t,[this.endpoint,this.id].concat(e.call(n)))},o.prototype.subscribe=function(){var t;return t=function(t){return function(e){var n,r,o;return n=e.k,r=e.m,o=RegExp("^"+t.endpoint+"\\/"+t.id+"\\/\\w+$","g"),o.test(n)?t.update(r):void 0}}(this),this.unsubscribeEventListener=n.eventStream.subscribe(t),this.listenerId=t.id},o.prototype.unsubscribe=function(){var t,e;for(t in this)e=this[t],angular.isArray(e)&&e.forEach(function(t){return t instanceof o?t.unsubscribe():void 0});return this.unsubscribeEventListener()},o.generateFunctions=function(t){return t.forEach(function(t){return function(n){var o;return o=r.capitalize(n),t.prototype["load"+o]=function(){var t,r;return t=1<=arguments.length?e.call(arguments,0):[],r=this.get.apply(this,[n].concat(e.call(t))),this[n]=r.getArray(),r}}}(this))},o}()}return t}(),angular.module("bbData").factory("Base",["dataService","socketService","dataUtilsService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["changes","properties","steps"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Build",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["builds","buildrequests","forceschedulers","buildslaves","masters"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Builder",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["builds"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Buildrequest",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["properties"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Buildset",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Buildslave",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Change",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(n)}return t}(),angular.module("bbData").factory("Changesource",["dataService","Base",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Forcescheduler",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["builders","buildslaves","changesources","schedulers"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Master",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Scheduler",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["changes"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Sourcestamp",["Base","dataService",t])}.call(this),function(){var t,e=[].slice;t=function(){function t(){}return t.prototype.cache=!1,t.prototype.$get=function(t,n,r,o,u,i,s){var c;return new(c=function(){function c(){a=this,u.eventStream.onUnsubscribe=this.unsubscribeListener,this.listeners={},u.socket.onclose=function(t){return function(){var e,n,r,o;r=t.listeners,o=[];for(n in r)e=r[n],o.push(e.length>0?t.startConsuming(n):void 0);return o}}(this),this.constructor.generateEndpoints()}var a;return a=null,c.prototype.get=function(){var s,c,a,l,p,f;return s=1<=arguments.length?e.call(arguments,0):[],s=s.filter(function(t){return null!=t}),c=s[s.length-1],p=c.subscribe||null==c.subscribe,angular.isObject(c)&&(l=s.pop(),l.subscribe=null),f=[],a=r(function(e){return function(c,a){var d,h,b,v;return p?(d=[],v=u.eventStream.subscribe(function(t){return d.push(t)}),h=i.socketPath(s),b=e.startConsuming(h)):b=r.when(),b.then(function(){var r,b;return r=i.restPath(s),b=o.get(r,l),b.then(function(o){var l,b,y,g,m,_;_=i.type(r),o=o[_];try{y=i.className(r),l=n.get(y)}catch(S){g=S,l=n.get("Base")}return angular.isArray(o)?(m=i.endpointPath(s),o=o.map(function(t){return new l(t,m)}),null==(b=e.listeners)[h]&&(b[h]=[]),o.forEach(function(t){return e.listeners[h].push(t.listenerId)}),u.eventStream.subscribe(function(t){var n,r,o,u;return n=t.k,r=t.m,u=RegExp("^"+m+"\\/(\\w+|\\d+)\\/new$","g"),u.test(n)?(o=new l(r,m),f.push(o),e.listeners[h].push(o.listenerId)):void 0}),p&&(d.forEach(function(t){return u.eventStream.push(t)}),v()),angular.copy(o,f),c(f)):(g=o+" is not an array",t.error(g),a(g))},function(t){return a(t)})},function(t){return a(t)})}}(this)),a.getArray=function(){return f},a},c.prototype.startConsuming=function(t){return u.send({cmd:"startConsuming",path:t})},c.prototype.stopConsuming=function(t){return u.send({cmd:"stopConsuming",path:t})},c.prototype.unsubscribeListener=function(t){var e,n,r,o,u;r=a.listeners,o=[];for(n in r)u=r[n],e=u.indexOf(t.id),e>=0?(u.splice(e,1),o.push(0===u.length?a.stopConsuming(n):void 0)):o.push(void 0);return o},c.prototype.control=function(){},c.prototype.getNextId=function(){return null==this.jsonrpc&&(this.jsonrpc=0),this.jsonrpc++},c.generateEndpoints=function(){return s.forEach(function(t){return function(n){var r;return r=i.capitalize(n),t.prototype["get"+r]=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],a.get.apply(a,[n].concat(e.call(t)))}}}(this))},c.prototype.open=function(){var t;return new(t=function(){function t(){this.rootClasses=[],n=this.rootClasses,this.constructor.generateEndpoints()}var n;return n=null,t.prototype.close=function(){return this.rootClasses.forEach(function(t){return angular.isFunction(t.unsubscribe)?t.unsubscribe():void 0})},t.prototype.closeOnDestroy=function(t){if(!angular.isFunction(t.$on))throw new TypeError("Parameter 'scope' doesn't have an $on function");return t.$on("$destroy",function(t){return function(){return t.close()}}(this))},t.generateEndpoints=function(){return s.forEach(function(t){return function(r){var o;return o=i.capitalize(r),t.prototype["get"+o]=function(){var t,r;return t=1<=arguments.length?e.call(arguments,0):[],r=a["get"+o].apply(a,t),r.then(function(t){return t.forEach(function(t){return n.push(t)})}),r}}}(this))},t}())},c}())},t}(),angular.module("bbData").provider("dataProvider",[t])}.call(this),function(){describe("Data service",function(){var t,e;return beforeEach(module("bbData")),t=null,e=function(e){return t=e.get("dataService")},beforeEach(inject(e)),it("should be defined",function(){return expect(t).toBeDefined()})})}.call(this),function(){var t;t=function(){function t(){return new(t=function(){function t(){}return t.prototype.capitalize=function(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()},t.prototype.type=function(t){var e,n,r;for(r=t.split("/");;)if(e=r.pop(),n=parseInt(e),0===r.length||!angular.isNumber(n)||isNaN(n))break;return e},t.prototype.singularType=function(t){return this.type(t).replace(/s$/,"")},t.prototype.classId=function(t){return this.singularType(t)+"id"},t.prototype.className=function(t){return this.capitalize(this.singularType(t))},t.prototype.socketPath=function(t){var e;return e=["*"],t.length%2===1&&e.push("*"),t.concat(e).join("/")},t.prototype.restPath=function(t){return t.slice().join("/")},t.prototype.endpointPath=function(t){var e;return e=t.slice(),e.length%2===0&&e.pop(),e.join("/")},t}())}return t}(),angular.module("bbData").service("dataUtilsService",[t])}.call(this),function(){describe("Helper service",function(){var t,e;return beforeEach(module("bbData")),t=null,e=function(e){return t=e.get("dataUtilsService")},beforeEach(inject(e)),it("should be defined",function(){return expect(t).toBeDefined()}),it("should capitalize the first word",function(){return expect(t.capitalize("abc")).toBe("Abc"),expect(t.capitalize("abc cba")).toBe("Abc cba")}),it("should return the endpoint name for rest endpoints",function(){var e,n,r,o;r={"builders/100/forceschedulers":"forcescheduler","builders/1/builds":"build","builders/2/builds/1":"build"},n=[];for(e in r)o=r[e],n.push(expect(t.singularType(e)).toBe(o));return n}),it("should return the class name for rest endpoints",function(){var e,n,r,o;r={"builders/100/forceschedulers":"Forcescheduler","builders/1/builds":"Build","builders/2/builds/1":"Build"},n=[];for(e in r)o=r[e],n.push(expect(t.className(e)).toBe(o));return n}),it("should return the WebSocket path for an endpoint",function(){var e,n,r,o;r={"builders/100/forceschedulers/*/*":["builders",100,"forceschedulers"],"builders/1/builds/*/*":["builders",1,"builds"],"builders/2/builds/1/*":["builders",2,"builds",1]},n=[];for(e in r)o=r[e],n.push(expect(t.socketPath(o)).toBe(e));return n}),it("should return the path for an endpoint",function(){var e,n,r,o;r={"builders/100/forceschedulers":["builders",100,"forceschedulers"],"builders/1/builds":["builders",1,"builds"],"builders/2/builds":["builders",2,"builds",1]},n=[];for(e in r)o=r[e],n.push(expect(t.endpointPath(o)).toBe(e));return n})})}.call(this),function(){var t,e=[].slice;t=function(){function t(t,n,r){var o;return new(o=function(){function o(){}return o.prototype.execute=function(e){return n(function(n){return function(n,r){return t(e).success(function(t){var e,o;try{return e=angular.fromJson(t),n(e)}catch(u){return o=u,r(o)}}).error(function(t){return r(t)})}}(this))},o.prototype.get=function(t,e){var n;return null==e&&(e={}),n={method:"GET",url:this.parse(r,t),params:e,headers:{Accept:"application/json"}},this.execute(n)},o.prototype.post=function(t,e){var n;return null==e&&(e={}),n={method:"POST",url:this.parse(r,t),data:e,headers:{"Content-Type":"application/json"}},this.execute(n)},o.prototype.parse=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],t.join("/").replace(/\/\//,"/")},o}())}return t}(),angular.module("bbData").service("restService",["$http","$q","API",t])}.call(this),function(){describe("Rest service",function(){var t,e,n;return beforeEach(module("bbData")),beforeEach(function(){return module(function(t){return t.constant("API","/api/")})}),n=t=null,e=function(e){return n=e.get("restService"),t=e.get("$httpBackend")},beforeEach(inject(e)),afterEach(function(){return t.verifyNoOutstandingExpectation(),t.verifyNoOutstandingRequest()}),it("should be defined",function(){return expect(n).toBeDefined()}),it("should make an ajax GET call to /api/endpoint",function(){var e,r;return r={a:"A"},t.whenGET("/api/endpoint").respond(r),e=null,n.get("endpoint").then(function(t){return e=t}),expect(e).toBeNull(),t.flush(),expect(e).toEqual(r)}),it("should make an ajax GET call to /api/endpoint with parameters",function(){var e;return e={key:"value"},t.whenGET("/api/endpoint?key=value").respond(200),n.get("endpoint",e),t.flush()}),it("should reject the promise on error",function(){var e,r;return e="Internal server error",t.expectGET("/api/endpoint").respond(500,e),r=null,n.get("endpoint").then(function(t){return r=t},function(t){return r=t}),t.flush(),expect(r).toBe(e)}),it("should make an ajax POST call to /api/endpoint",function(){var e,r,o;return o={},e={b:"B"},t.expectPOST("/api/endpoint",e).respond(o),r=null,n.post("endpoint",e).then(function(t){return r=t}),t.flush(),expect(r).toEqual(o)}),it("should reject the promise when the response is not valid JSON",function(){var e,r,o;return o="aaa",e={b:"B"},t.expectPOST("/api/endpoint",e).respond(o),r=null,n.post("endpoint",e).then(function(t){return r=t},function(t){return r=t}),t.flush(),expect(r).not.toBeNull(),expect(r).not.toEqual(o)})})}.call(this),function(){var t;t=function(){function t(t,e,n,r,o,u){var i;return new(i=function(){function i(){this.queue=[],this.deferred={},this.open()}return i.prototype.eventStream=null,i.prototype.open=function(){return null==this.socket&&(this.socket=u.getWebSocket(this.getUrl())),this.socket.onopen=function(t){return function(){return t.flush()}}(this),this.setupEventStream()},i.prototype.setupEventStream=function(){return null==this.eventStream&&(this.eventStream=new o),this.socket.onmessage=function(e){return function(r){var o,u,i,s,c,a;try{return o=angular.fromJson(r.data),t.debug("WS message",o),null!=o.code?(i=o._id,200===o.code?null!=(s=e.deferred[i])?s.resolve(!0):void 0:null!=(c=e.deferred[i])?c.reject(o):void 0):n.$applyAsync(function(){return e.eventStream.push(o)})}catch(l){return u=l,null!=(a=e.deferred[i])?a.reject(u):void 0}}}(this)},i.prototype.close=function(){return this.socket.close()},i.prototype.send=function(n){var r,o;return o=this.nextId(),n._id=o,null==(r=this.deferred)[o]&&(r[o]=e.defer()),n=angular.toJson(n),this.socket.readyState===(this.socket.OPEN||1)?(t.debug("WS send",angular.fromJson(n)),this.socket.send(n)):this.queue.push(n),this.deferred[o].promise},i.prototype.flush=function(){var e,n;for(n=[];e=this.queue.pop();)t.debug("WS send",angular.fromJson(e)),n.push(this.socket.send(e));return n},i.prototype.nextId=function(){return null==this.id&&(this.id=0),this.id=this.id<1e3?this.id+1:0,this.id},i.prototype.getUrl=function(){var t,e;return t=r.host(),e=80===r.port()?"":":"+r.port(),"ws://"+t+e+"/ws"},i}())}return t}(),angular.module("bbData").service("socketService",["$log","$q","$rootScope","$location","Stream","webSocketService",t])}.call(this),function(){describe("Socket service",function(){var t,e,n,r,o,u;return e=function(){function e(){r=this,this.webSocket=new n}var n,r;return e.prototype.sendQueue=[],e.prototype.receiveQueue=[],r=null,e.prototype.send=function(t){var e;return e={data:t},this.sendQueue.push(e)},e.prototype.flush=function(){return t.$apply(function(t){return function(){var e,n;for(n=[];e=t.sendQueue.shift();)n.push(t.webSocket.onmessage(e));return n}}(this))},e.prototype.getWebSocket=function(){return this.webSocket},n=function(){function t(){}return t.prototype.OPEN=1,t.prototype.send=function(t){return r.receiveQueue.push(t)},t}(),e}(),u=new e,beforeEach(function(){return module("bbData"),module(function(t){return t.constant("webSocketService",u)})}),t=o=r=null,n=function(e){return t=e.get("$rootScope"),o=e.get("socketService"),r=o.socket,spyOn(r,"send").and.callThrough(),spyOn(r,"onmessage").and.callThrough()},beforeEach(inject(n)),it("should be defined",function(){return expect(o).toBeDefined()}),it("should send the data, when the WebSocket is open",function(){var t,e,n;return r.readyState=0,t={a:1},e={b:2},n={c:3},o.send(t),o.send(e),expect(r.send).not.toHaveBeenCalled(),r.onopen(),expect(r.send).toHaveBeenCalled(),expect(u.receiveQueue).toContain(angular.toJson(t)),expect(u.receiveQueue).toContain(angular.toJson(e)),expect(u.receiveQueue).not.toContain(angular.toJson(n))}),it("should add an _id to each message",function(){var t;return r.readyState=1,expect(r.send).not.toHaveBeenCalled(),o.send({a:1}),expect(r.send).toHaveBeenCalledWith(jasmine.any(String)),t=r.send.calls.argsFor(0)[0],expect(angular.fromJson(t)._id).toBeDefined()}),it("should resolve the promise when a response message is received with code 200",function(){var t,e,n,i,s,c;return r.readyState=1,i={cmd:"command"},s=o.send(i),e=jasmine.createSpy("handler"),s.then(e),expect(e).not.toHaveBeenCalled(),t=r.send.calls.argsFor(0)[0],n=angular.fromJson(t)._id,c=angular.toJson({_id:n,code:200}),u.send(c),u.flush(),expect(e).toHaveBeenCalled()}),it("should reject the promise when a response message is received, but the code is not 200",function(){var t,e,n,i,s,c,a;return r.readyState=1,s={cmd:"command"},c=o.send(s),n=jasmine.createSpy("handler"),e=jasmine.createSpy("errorHandler"),c.then(n,e),expect(n).not.toHaveBeenCalled(),expect(e).not.toHaveBeenCalled(),t=r.send.calls.argsFor(0)[0],i=angular.fromJson(t)._id,a=angular.toJson({_id:i,code:500}),u.send(a),u.flush(),expect(n).not.toHaveBeenCalled(),expect(e).toHaveBeenCalled()})})}.call(this),function(){var t;t=function(){function t(t){var e;return new(e=function(){function e(){}return e.prototype.getWebSocket=function(e){var n;if(n=/wss?:\/\//.exec(e),!n)throw new Error("Invalid url provided");return null!=t.ReconnectingWebSocket?new t.ReconnectingWebSocket(e):new t.WebSocket(e)},e}())}return t}(),angular.module("bbData").service("webSocketService",["$window",t])}.call(this),function(){var t;t=function(){function t(){var t;return t=function(){function t(){}return t.prototype.onUnsubscribe=null,t.prototype.listeners=[],t.prototype.subscribe=function(t){if(!angular.isFunction(t))throw new TypeError("Parameter 'listener' must be a function, not "+typeof t);return t.id=this.generateId(),this.listeners.push(t),function(e){return function(){var n,r;return n=e.listeners.indexOf(t),r=e.listeners.splice(n,1),angular.isFunction(e.onUnsubscribe)?e.onUnsubscribe(t):void 0}}(this)},t.prototype.push=function(t){var e,n,r,o,u;for(o=this.listeners,u=[],e=0,n=o.length;n>e;e++)r=o[e],u.push(r(t));return u},t.prototype.destroy=function(){var t;for(t=[];this.listeners.length>0;)t.push(this.listeners.pop());return t},t.prototype.generateId=function(){return null==this.lastId&&(this.lastId=0),this.lastId++},t}()}return t}(),angular.module("bbData").factory("Stream",[t])}.call(this),function(){describe("Stream service",function(){var t,e,n;return beforeEach(module("bbData")),t=n=null,e=function(e){return t=e.get("Stream"),n=new t},beforeEach(inject(e)),it("should be defined",function(){return expect(t).toBeDefined(),expect(n).toBeDefined()}),it("should add the listener to listeners on subscribe call",function(){var t;return t=n.listeners,expect(t.length).toBe(0),n.subscribe(function(){}),expect(t.length).toBe(1)}),it("should add a unique id to each listener passed in to subscribe",function(){var t,e,r;return r=n.listeners,t=function(){},e=function(){},n.subscribe(t),n.subscribe(e),expect(t.id).toBeDefined(),expect(e.id).toBeDefined(),expect(t.id).not.toBe(e.id)}),it("should return the unsubscribe function on subscribe call",function(){var t,e,r,o;return e=n.listeners,t=function(){},r=function(){},o=n.subscribe(t),n.subscribe(r),expect(e).toContain(t),o(),expect(e).not.toContain(t),expect(e).toContain(r)}),it("should call all listeners on push call",function(){var t,e;return t={a:"A",b:"B"},e={first:function(t){return expect(t).toEqual({a:"A",b:"B"})},second:function(t){return expect(t).toEqual({a:"A",b:"B"})}},spyOn(e,"first").and.callThrough(),spyOn(e,"second").and.callThrough(),n.subscribe(e.first),n.subscribe(e.second),expect(e.first).not.toHaveBeenCalled(),expect(e.second).not.toHaveBeenCalled(),n.push(t),expect(e.first).toHaveBeenCalled(),expect(e.second).toHaveBeenCalled()}),it("should remove all listeners on destroy call",function(){var t;return t=n.listeners,expect(t.length).toBe(0),n.subscribe(function(){}),n.subscribe(function(){}),expect(t.length).not.toBe(0),n.destroy(),expect(t.length).toBe(0)}),it("should call the unsubscribe listener on unsubscribe call",function(){var t,e;return spyOn(n,"onUnsubscribe"),t=function(){},e=n.subscribe(t),expect(n.onUnsubscribe).not.toHaveBeenCalled(),e(),expect(n.onUnsubscribe).toHaveBeenCalledWith(t)})})}.call(this);
(function(){var t;t=function(){function t(){return[]}return t}(),angular.module("bbData",new t)}).call(this),function(){var t;t=function(){function t(t){t.interceptors.push(function(t,e){return{request:function(n){return 0===n.url.indexOf(e)&&t.debug(n.method+" "+n.url),n}}})}return t}(),angular.module("bbData").config(["$httpProvider",t])}.call(this),function(){var t,e;t=function(){function t(){return"api/v2/"}return t}(),e=function(){function t(){return["builders","builds","buildrequests","buildslaves","buildsets","changes","changesources","masters","sourcestamps","schedulers","forceschedulers"]}return t}(),angular.module("bbData").constant("API",t()).constant("ENDPOINTS",e())}.call(this),function(){var t,e=[].slice;t=function(){function t(t,n,r){var o;return o=function(){function o(t,e,n){var o;if(this.endpoint=e,null==n&&(n=[]),!angular.isString(this.endpoint))throw new TypeError("Parameter 'endpoint' must be a string, not "+typeof this.endpoint);this.update(t),this.constructor.generateFunctions(n),o=r.classId(this.endpoint),this.id=this[o],this.subscribe()}return o.prototype.update=function(t){return angular.extend(this,t)},o.prototype.get=function(){var n;return n=1<=arguments.length?e.call(arguments,0):[],t.get.apply(t,[this.endpoint,this.id].concat(e.call(n)))},o.prototype.subscribe=function(){var t;return t=function(t){return function(e){var n,r,o;return n=e.k,r=e.m,o=RegExp("^"+t.endpoint+"\\/"+t.id+"\\/\\w+$","g"),o.test(n)?t.update(r):void 0}}(this),this.unsubscribeEventListener=n.eventStream.subscribe(t),this.listenerId=t.id},o.prototype.unsubscribe=function(){var t,e;for(t in this)e=this[t],angular.isArray(e)&&e.forEach(function(t){return t instanceof o?t.unsubscribe():void 0});return this.unsubscribeEventListener()},o.generateFunctions=function(t){return t.forEach(function(t){return function(n){var o;return o=r.capitalize(n),t.prototype["load"+o]=function(){var t,r;return t=1<=arguments.length?e.call(arguments,0):[],r=this.get.apply(this,[n].concat(e.call(t))),this[n]=r.getArray(),r}}}(this))},o}()}return t}(),angular.module("bbData").factory("Base",["dataService","socketService","dataUtilsService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["changes","properties","steps"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Build",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["builds","buildrequests","forceschedulers","buildslaves","masters"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Builder",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["builds"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Buildrequest",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["properties"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Buildset",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Buildslave",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Change",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(n)}return t}(),angular.module("bbData").factory("Changesource",["dataService","Base",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Forcescheduler",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["builders","buildslaves","changesources","schedulers"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Master",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){n.__super__.constructor.call(this,t,e)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Scheduler",["Base","dataService",t])}.call(this),function(){var t,e=function(t,e){function r(){this.constructor=t}for(var o in e)n.call(e,o)&&(t[o]=e[o]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},n={}.hasOwnProperty;t=function(){function t(t,n){var r;return r=function(t){function n(t,e){var r;r=["changes"],n.__super__.constructor.call(this,t,e,r)}return e(n,t),n}(t)}return t}(),angular.module("bbData").factory("Sourcestamp",["Base","dataService",t])}.call(this),function(){var t,e=[].slice;t=function(){function t(){}return t.prototype.cache=!1,t.prototype.$get=function(t,n,r,o,u,i,s){var c;return new(c=function(){function c(){a=this,u.eventStream.onUnsubscribe=this.unsubscribeListener,this.listeners={},u.socket.onclose=function(t){return function(){var e,n,r,o;r=t.listeners,o=[];for(n in r)e=r[n],o.push(e.length>0?t.startConsuming(n):void 0);return o}}(this),this.constructor.generateEndpoints()}var a;return a=null,c.prototype.get=function(){var s,c,a,l,p,f;return s=1<=arguments.length?e.call(arguments,0):[],s=s.filter(function(t){return null!=t}),c=s[s.length-1],p=c.subscribe||null==c.subscribe,angular.isObject(c)&&(l=s.pop(),l.subscribe=null),f=[],a=r(function(e){return function(c,a){var d,h,b,v;return p?(d=[],v=u.eventStream.subscribe(function(t){return d.push(t)}),h=i.socketPath(s),b=e.startConsuming(h)):b=r.resolve(),b.then(function(){var r,b;return r=i.restPath(s),b=o.get(r,l),b.then(function(o){var l,b,y,g,m,_;_=i.type(r),o=o[_];try{y=i.className(r),l=n.get(y)}catch(S){g=S,l=n.get("Base")}return angular.isArray(o)?(m=i.endpointPath(s),o=o.map(function(t){return new l(t,m)}),null==(b=e.listeners)[h]&&(b[h]=[]),o.forEach(function(t){return e.listeners[h].push(t.listenerId)}),u.eventStream.subscribe(function(t){var n,r,o,u;return n=t.k,r=t.m,u=RegExp("^"+m+"\\/(\\w+|\\d+)\\/new$","g"),u.test(n)?(o=new l(r,m),f.push(o),e.listeners[h].push(o.listenerId)):void 0}),p&&(d.forEach(function(t){return u.eventStream.push(t)}),v()),angular.copy(o,f),c(f)):(g=o+" is not an array",t.error(g),a(g))},function(t){return a(t)})},function(t){return a(t)})}}(this)),a.getArray=function(){return f},a},c.prototype.startConsuming=function(t){return u.send({cmd:"startConsuming",path:t})},c.prototype.stopConsuming=function(t){return u.send({cmd:"stopConsuming",path:t})},c.prototype.unsubscribeListener=function(t){var e,n,r,o,u;r=a.listeners,o=[];for(n in r)u=r[n],e=u.indexOf(t.id),e>=0?(u.splice(e,1),o.push(0===u.length?a.stopConsuming(n):void 0)):o.push(void 0);return o},c.prototype.control=function(){},c.prototype.getNextId=function(){return null==this.jsonrpc&&(this.jsonrpc=0),this.jsonrpc++},c.generateEndpoints=function(){return s.forEach(function(t){return function(n){var r;return r=i.capitalize(n),t.prototype["get"+r]=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],a.get.apply(a,[n].concat(e.call(t)))}}}(this))},c.prototype.open=function(){var t;return new(t=function(){function t(){this.rootClasses=[],n=this.rootClasses,this.constructor.generateEndpoints()}var n;return n=null,t.prototype.close=function(){return this.rootClasses.forEach(function(t){return angular.isFunction(t.unsubscribe)?t.unsubscribe():void 0})},t.prototype.closeOnDestroy=function(t){if(!angular.isFunction(t.$on))throw new TypeError("Parameter 'scope' doesn't have an $on function");return t.$on("$destroy",function(t){return function(){return t.close()}}(this))},t.generateEndpoints=function(){return s.forEach(function(t){return function(r){var o;return o=i.capitalize(r),t.prototype["get"+o]=function(){var t,r;return t=1<=arguments.length?e.call(arguments,0):[],r=a["get"+o].apply(a,t),r.then(function(t){return t.forEach(function(t){return n.push(t)})}),r}}}(this))},t}())},c}())},t}(),angular.module("bbData").provider("dataProvider",[t])}.call(this),function(){describe("Data service",function(){var t,e;return beforeEach(module("bbData")),t=null,e=function(e){return t=e.get("dataService")},beforeEach(inject(e)),it("should be defined",function(){return expect(t).toBeDefined()})})}.call(this),function(){var t;t=function(){function t(){return new(t=function(){function t(){}return t.prototype.capitalize=function(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()},t.prototype.type=function(t){var e,n,r;for(r=t.split("/");;)if(e=r.pop(),n=parseInt(e),0===r.length||!angular.isNumber(n)||isNaN(n))break;return e},t.prototype.singularType=function(t){return this.type(t).replace(/s$/,"")},t.prototype.classId=function(t){return this.singularType(t)+"id"},t.prototype.className=function(t){return this.capitalize(this.singularType(t))},t.prototype.socketPath=function(t){var e;return e=["*"],t.length%2===1&&e.push("*"),t.concat(e).join("/")},t.prototype.restPath=function(t){return t.slice().join("/")},t.prototype.endpointPath=function(t){var e;return e=t.slice(),e.length%2===0&&e.pop(),e.join("/")},t}())}return t}(),angular.module("bbData").service("dataUtilsService",[t])}.call(this),function(){describe("Helper service",function(){var t,e;return beforeEach(module("bbData")),t=null,e=function(e){return t=e.get("dataUtilsService")},beforeEach(inject(e)),it("should be defined",function(){return expect(t).toBeDefined()}),it("should capitalize the first word",function(){return expect(t.capitalize("abc")).toBe("Abc"),expect(t.capitalize("abc cba")).toBe("Abc cba")}),it("should return the endpoint name for rest endpoints",function(){var e,n,r,o;r={"builders/100/forceschedulers":"forcescheduler","builders/1/builds":"build","builders/2/builds/1":"build"},n=[];for(e in r)o=r[e],n.push(expect(t.singularType(e)).toBe(o));return n}),it("should return the class name for rest endpoints",function(){var e,n,r,o;r={"builders/100/forceschedulers":"Forcescheduler","builders/1/builds":"Build","builders/2/builds/1":"Build"},n=[];for(e in r)o=r[e],n.push(expect(t.className(e)).toBe(o));return n}),it("should return the WebSocket path for an endpoint",function(){var e,n,r,o;r={"builders/100/forceschedulers/*/*":["builders",100,"forceschedulers"],"builders/1/builds/*/*":["builders",1,"builds"],"builders/2/builds/1/*":["builders",2,"builds",1]},n=[];for(e in r)o=r[e],n.push(expect(t.socketPath(o)).toBe(e));return n}),it("should return the path for an endpoint",function(){var e,n,r,o;r={"builders/100/forceschedulers":["builders",100,"forceschedulers"],"builders/1/builds":["builders",1,"builds"],"builders/2/builds":["builders",2,"builds",1]},n=[];for(e in r)o=r[e],n.push(expect(t.endpointPath(o)).toBe(e));return n})})}.call(this),function(){var t,e=[].slice;t=function(){function t(t,n,r){var o;return new(o=function(){function o(){}return o.prototype.execute=function(e){return n(function(n){return function(n,r){return t(e).success(function(t){var e,o;try{return e=angular.fromJson(t),n(e)}catch(u){return o=u,r(o)}}).error(function(t){return r(t)})}}(this))},o.prototype.get=function(t,e){var n;return null==e&&(e={}),n={method:"GET",url:this.parse(r,t),params:e,headers:{Accept:"application/json"}},this.execute(n)},o.prototype.post=function(t,e){var n;return null==e&&(e={}),n={method:"POST",url:this.parse(r,t),data:e,headers:{"Content-Type":"application/json"}},this.execute(n)},o.prototype.parse=function(){var t;return t=1<=arguments.length?e.call(arguments,0):[],t.join("/").replace(/\/\//,"/")},o}())}return t}(),angular.module("bbData").service("restService",["$http","$q","API",t])}.call(this),function(){describe("Rest service",function(){var t,e,n;return beforeEach(module("bbData")),beforeEach(function(){return module(function(t){return t.constant("API","/api/")})}),n=t=null,e=function(e){return n=e.get("restService"),t=e.get("$httpBackend")},beforeEach(inject(e)),afterEach(function(){return t.verifyNoOutstandingExpectation(),t.verifyNoOutstandingRequest()}),it("should be defined",function(){return expect(n).toBeDefined()}),it("should make an ajax GET call to /api/endpoint",function(){var e,r;return r={a:"A"},t.whenGET("/api/endpoint").respond(r),e=null,n.get("endpoint").then(function(t){return e=t}),expect(e).toBeNull(),t.flush(),expect(e).toEqual(r)}),it("should make an ajax GET call to /api/endpoint with parameters",function(){var e;return e={key:"value"},t.whenGET("/api/endpoint?key=value").respond(200),n.get("endpoint",e),t.flush()}),it("should reject the promise on error",function(){var e,r;return e="Internal server error",t.expectGET("/api/endpoint").respond(500,e),r=null,n.get("endpoint").then(function(t){return r=t},function(t){return r=t}),t.flush(),expect(r).toBe(e)}),it("should make an ajax POST call to /api/endpoint",function(){var e,r,o;return o={},e={b:"B"},t.expectPOST("/api/endpoint",e).respond(o),r=null,n.post("endpoint",e).then(function(t){return r=t}),t.flush(),expect(r).toEqual(o)}),it("should reject the promise when the response is not valid JSON",function(){var e,r,o;return o="aaa",e={b:"B"},t.expectPOST("/api/endpoint",e).respond(o),r=null,n.post("endpoint",e).then(function(t){return r=t},function(t){return r=t}),t.flush(),expect(r).not.toBeNull(),expect(r).not.toEqual(o)})})}.call(this),function(){var t;t=function(){function t(t,e,n,r,o,u){var i;return new(i=function(){function i(){this.queue=[],this.deferred={},this.open()}return i.prototype.eventStream=null,i.prototype.open=function(){return null==this.socket&&(this.socket=u.getWebSocket(this.getUrl())),this.socket.onopen=function(t){return function(){return t.flush()}}(this),this.setupEventStream()},i.prototype.setupEventStream=function(){return null==this.eventStream&&(this.eventStream=new o),this.socket.onmessage=function(e){return function(r){var o,u,i,s,c,a;try{return o=angular.fromJson(r.data),t.debug("WS message",o),null!=o.code?(i=o._id,200===o.code?null!=(s=e.deferred[i])?s.resolve(!0):void 0:null!=(c=e.deferred[i])?c.reject(o):void 0):n.$applyAsync(function(){return e.eventStream.push(o)})}catch(l){return u=l,null!=(a=e.deferred[i])?a.reject(u):void 0}}}(this)},i.prototype.close=function(){return this.socket.close()},i.prototype.send=function(n){var r,o;return o=this.nextId(),n._id=o,null==(r=this.deferred)[o]&&(r[o]=e.defer()),n=angular.toJson(n),this.socket.readyState===(this.socket.OPEN||1)?(t.debug("WS send",angular.fromJson(n)),this.socket.send(n)):this.queue.push(n),this.deferred[o].promise},i.prototype.flush=function(){var e,n;for(n=[];e=this.queue.pop();)t.debug("WS send",angular.fromJson(e)),n.push(this.socket.send(e));return n},i.prototype.nextId=function(){return null==this.id&&(this.id=0),this.id=this.id<1e3?this.id+1:0,this.id},i.prototype.getUrl=function(){var t,e;return t=r.host(),e=80===r.port()?"":":"+r.port(),"ws://"+t+e+"/ws"},i}())}return t}(),angular.module("bbData").service("socketService",["$log","$q","$rootScope","$location","Stream","webSocketService",t])}.call(this),function(){describe("Socket service",function(){var t,e,n,r,o,u;return e=function(){function e(){r=this,this.webSocket=new n}var n,r;return e.prototype.sendQueue=[],e.prototype.receiveQueue=[],r=null,e.prototype.send=function(t){var e;return e={data:t},this.sendQueue.push(e)},e.prototype.flush=function(){return t.$apply(function(t){return function(){var e,n;for(n=[];e=t.sendQueue.shift();)n.push(t.webSocket.onmessage(e));return n}}(this))},e.prototype.getWebSocket=function(){return this.webSocket},n=function(){function t(){}return t.prototype.OPEN=1,t.prototype.send=function(t){return r.receiveQueue.push(t)},t}(),e}(),u=new e,beforeEach(function(){return module("bbData"),module(function(t){return t.constant("webSocketService",u)})}),t=o=r=null,n=function(e){return t=e.get("$rootScope"),o=e.get("socketService"),r=o.socket,spyOn(r,"send").and.callThrough(),spyOn(r,"onmessage").and.callThrough()},beforeEach(inject(n)),it("should be defined",function(){return expect(o).toBeDefined()}),it("should send the data, when the WebSocket is open",function(){var t,e,n;return r.readyState=0,t={a:1},e={b:2},n={c:3},o.send(t),o.send(e),expect(r.send).not.toHaveBeenCalled(),r.onopen(),expect(r.send).toHaveBeenCalled(),expect(u.receiveQueue).toContain(angular.toJson(t)),expect(u.receiveQueue).toContain(angular.toJson(e)),expect(u.receiveQueue).not.toContain(angular.toJson(n))}),it("should add an _id to each message",function(){var t;return r.readyState=1,expect(r.send).not.toHaveBeenCalled(),o.send({a:1}),expect(r.send).toHaveBeenCalledWith(jasmine.any(String)),t=r.send.calls.argsFor(0)[0],expect(angular.fromJson(t)._id).toBeDefined()}),it("should resolve the promise when a response message is received with code 200",function(){var t,e,n,i,s,c;return r.readyState=1,i={cmd:"command"},s=o.send(i),e=jasmine.createSpy("handler"),s.then(e),expect(e).not.toHaveBeenCalled(),t=r.send.calls.argsFor(0)[0],n=angular.fromJson(t)._id,c=angular.toJson({_id:n,code:200}),u.send(c),u.flush(),expect(e).toHaveBeenCalled()}),it("should reject the promise when a response message is received, but the code is not 200",function(){var t,e,n,i,s,c,a;return r.readyState=1,s={cmd:"command"},c=o.send(s),n=jasmine.createSpy("handler"),e=jasmine.createSpy("errorHandler"),c.then(n,e),expect(n).not.toHaveBeenCalled(),expect(e).not.toHaveBeenCalled(),t=r.send.calls.argsFor(0)[0],i=angular.fromJson(t)._id,a=angular.toJson({_id:i,code:500}),u.send(a),u.flush(),expect(n).not.toHaveBeenCalled(),expect(e).toHaveBeenCalled()})})}.call(this),function(){var t;t=function(){function t(t){var e;return new(e=function(){function e(){}return e.prototype.getWebSocket=function(e){var n;if(n=/wss?:\/\//.exec(e),!n)throw new Error("Invalid url provided");return null!=t.ReconnectingWebSocket?new t.ReconnectingWebSocket(e):new t.WebSocket(e)},e}())}return t}(),angular.module("bbData").service("webSocketService",["$window",t])}.call(this),function(){var t;t=function(){function t(){var t;return t=function(){function t(){}return t.prototype.onUnsubscribe=null,t.prototype.listeners=[],t.prototype.subscribe=function(t){if(!angular.isFunction(t))throw new TypeError("Parameter 'listener' must be a function, not "+typeof t);return t.id=this.generateId(),this.listeners.push(t),function(e){return function(){var n,r;return n=e.listeners.indexOf(t),r=e.listeners.splice(n,1),angular.isFunction(e.onUnsubscribe)?e.onUnsubscribe(t):void 0}}(this)},t.prototype.push=function(t){var e,n,r,o,u;for(o=this.listeners,u=[],e=0,n=o.length;n>e;e++)r=o[e],u.push(r(t));return u},t.prototype.destroy=function(){var t;for(t=[];this.listeners.length>0;)t.push(this.listeners.pop());return t},t.prototype.generateId=function(){return null==this.lastId&&(this.lastId=0),this.lastId++},t}()}return t}(),angular.module("bbData").factory("Stream",[t])}.call(this),function(){describe("Stream service",function(){var t,e,n;return beforeEach(module("bbData")),t=n=null,e=function(e){return t=e.get("Stream"),n=new t},beforeEach(inject(e)),it("should be defined",function(){return expect(t).toBeDefined(),expect(n).toBeDefined()}),it("should add the listener to listeners on subscribe call",function(){var t;return t=n.listeners,expect(t.length).toBe(0),n.subscribe(function(){}),expect(t.length).toBe(1)}),it("should add a unique id to each listener passed in to subscribe",function(){var t,e,r;return r=n.listeners,t=function(){},e=function(){},n.subscribe(t),n.subscribe(e),expect(t.id).toBeDefined(),expect(e.id).toBeDefined(),expect(t.id).not.toBe(e.id)}),it("should return the unsubscribe function on subscribe call",function(){var t,e,r,o;return e=n.listeners,t=function(){},r=function(){},o=n.subscribe(t),n.subscribe(r),expect(e).toContain(t),o(),expect(e).not.toContain(t),expect(e).toContain(r)}),it("should call all listeners on push call",function(){var t,e;return t={a:"A",b:"B"},e={first:function(t){return expect(t).toEqual({a:"A",b:"B"})},second:function(t){return expect(t).toEqual({a:"A",b:"B"})}},spyOn(e,"first").and.callThrough(),spyOn(e,"second").and.callThrough(),n.subscribe(e.first),n.subscribe(e.second),expect(e.first).not.toHaveBeenCalled(),expect(e.second).not.toHaveBeenCalled(),n.push(t),expect(e.first).toHaveBeenCalled(),expect(e.second).toHaveBeenCalled()}),it("should remove all listeners on destroy call",function(){var t;return t=n.listeners,expect(t.length).toBe(0),n.subscribe(function(){}),n.subscribe(function(){}),expect(t.length).not.toBe(0),n.destroy(),expect(t.length).toBe(0)}),it("should call the unsubscribe listener on unsubscribe call",function(){var t,e;return spyOn(n,"onUnsubscribe"),t=function(){},e=n.subscribe(t),expect(n.onUnsubscribe).not.toHaveBeenCalled(),e(),expect(n.onUnsubscribe).toHaveBeenCalledWith(t)})})}.call(this);
{
"name": "buildbot-data",
"version": "1.0.0",
"version": "1.0.2",
"description": "Buildbot AngularJS data module",

@@ -5,0 +5,0 @@ "readme": "README.md",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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