UNPKG

blast-graph-angular2

Version:

![Alt text](./resources/images/b-circle-trans-100.png) **with** ![Alt text](./resources/images/angular.png)

2 lines 22.7 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("rxjs/index")):"function"==typeof define&&define.amd?define("blast-graph-angular2",["exports","rxjs/index"],e):e(t["blast-graph-angular2"]={},t.rxjs.index)}(this,function(t,r){"use strict";var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var i=function(){function t(){}return t.isPresent=function(t){return t!==undefined&&null!==t},t.isString=function(t){return"string"==typeof t},t.isArray=function(t){return Array.isArray(t)},t.isFunction=function(t){return"function"==typeof t},t.isJson=function(t){try{return JSON.parse(t),!0}catch(e){return!1}},t}(),e="0.0.1",s={DEBUG:0,INFO:1,WARN:2,ERROR:3},n=function(){function t(t,e,n,o){if(this.url=t,this.protocols=n,this.config=o,this.reconnectAttempts=0,this.sendQueue=[],this.onMessageCallbacks=[],this.onOpenCallbacks=[],this.onErrorCallbacks=[],this.onCloseCallbacks=[],this.readyStateConstants={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3,RECONNECT_ABORTED:4},this.normalCloseCode=1e3,this.reconnectableStatusCodes=[4e3],this.logLevel=s.ERROR,!new RegExp("wss?://").test(t))throw new Error("Invalid url provided");this.config=o||{initialTimeout:500,maxTimeout:3e5,reconnectIfNotNormalClose:!0},this.dataStream=new r.Subject,(e===undefined||e)&&this.connect(!0)}return t.prototype.connect=function(t){var n=this;void 0===t&&(t=!1);var o=this;!t&&this.socket&&this.socket.readyState===this.readyStateConstants.OPEN||(o.socket=this.protocols?new WebSocket(this.url,this.protocols):new WebSocket(this.url),o.socket.onopen=function(t){n.onOpenHandler(t)},o.socket.onmessage=function(t){if(i.isJson(t.data)){var e=JSON.parse(t.data);if(n.debug("BlastService","jsonMessage","passing to handlers",t.data),!0===o.handleJsonMessage(e))return}o.onMessageHandler(t.data),n.dataStream.next(t.data)},this.socket.onclose=function(t){o.onCloseHandler(t)},this.socket.onerror=function(t){o.onErrorHandler(t),n.dataStream.error(t)})},t.prototype.sendMessage=function(t,e){return this.getReadyState()!==this.readyStateConstants.OPEN&&this.getReadyState()!==this.readyStateConstants.CONNECTING&&this.connect(),this.debug("BlastService","sendMessage",t),this.sendQueue.push({message:t,binary:e}),this.socket.readyState===this.readyStateConstants.OPEN&&(this.fireQueue(),!0)},t.prototype.send=function(t,e){return this.sendMessage(t,e)},t.prototype.getDataStream=function(){return this.dataStream},t.prototype.notifyOpenCallbacks=function(t){for(var e=0;e<this.onOpenCallbacks.length;e++)this.onOpenCallbacks[e].call(this,t)},t.prototype.fireQueue=function(){for(;this.sendQueue.length&&this.socket.readyState===this.readyStateConstants.OPEN;){var t=this.sendQueue.shift();t.binary?this.socket.send(t.message):this.socket.send(i.isString(t.message)?t.message:JSON.stringify(t.message))}},t.prototype.notifyCloseCallbacks=function(t){for(var e=0;e<this.onCloseCallbacks.length;e++)this.onCloseCallbacks[e].call(this,t)},t.prototype.notifyErrorCallbacks=function(t){for(var e=0;e<this.onErrorCallbacks.length;e++)this.onErrorCallbacks[e].call(this,t)},t.prototype.onOpen=function(t){return this.onOpenCallbacks.push(t),this},t.prototype.onClose=function(t){return this.onCloseCallbacks.push(t),this},t.prototype.onError=function(t){return this.onErrorCallbacks.push(t),this},t.prototype.onMessage=function(t,e){if(!i.isFunction(t))throw new Error("Callback must be a function");return this.onMessageCallbacks.push({fn:t,pattern:e?e.filter:undefined,autoApply:!e||e.autoApply}),this},t.prototype.handleJsonMessage=function(t){return!1},t.prototype.onMessageHandler=function(t){this.debug("BlastService","onMessageHandler",t.data);for(var e=0;e<this.onMessageCallbacks.length;e++)this.onMessageCallbacks[e].fn.apply(this,[t])},t.prototype.onOpenHandler=function(t){this.debug("BlastService","connected"),this.reconnectAttempts=0,this.notifyOpenCallbacks(t),this.fireQueue()},t.prototype.onCloseHandler=function(t){this.debug("BlastService","closed"),this.notifyCloseCallbacks(t),this.config.reconnectIfNotNormalClose&&t.code!==this.normalCloseCode||-1<this.reconnectableStatusCodes.indexOf(t.code)?this.reconnect():(this.sendQueue=[],this.dataStream.complete())},t.prototype.onErrorHandler=function(t){this.debug("BlastService","onErrorHandler",t),this.notifyErrorCallbacks(t)},t.prototype.reconnect=function(){var t=this;this.close(!0);var e=this.getBackoffDelay(++this.reconnectAttempts);return this.debug("BlastService","reconnectDelay",e),setTimeout(function(){return t.connect()},e),this},t.prototype.close=function(t){return void 0===t&&(t=!1),!t&&this.socket.bufferedAmount||this.socket.close(this.normalCloseCode),this},t.prototype.getBackoffDelay=function(t){var e=Math.random()+1,n=this.config.initialTimeout,o=t,r=this.config.maxTimeout;return Math.floor(Math.min(e*n*Math.pow(2,o),r))},t.prototype.setInternalState=function(t){if(Math.floor(t)!==t||t<0||4<t)throw new Error("state must be an integer between 0 and 4, got: "+t);this.internalConnectionState=t},t.prototype.getReadyState=function(){return null==this.socket?-1:this.internalConnectionState||this.socket.readyState},t.prototype.getVersion=function(){return e},t.prototype.hasConsole=function(){return console!==undefined},t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.hasConsole()&&this.logLevel<1&&console.debug.apply(console,t)},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.hasConsole()&&this.logLevel<2&&console.debug.apply(console,t)},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.hasConsole()&&this.logLevel<4&&console.debug.apply(console,t)},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];console.error.apply(console,t)},t.prototype.setLogLevel=function(t){this.logLevel=t},t}(),c=function a(t){this.message=t},l=function(){function a(){}return a.splitPath=function(t){var e=[];if(null===t||0===t.trim().length||"root"===t)return(n=new a).setRoot(),n.setNotCollectionOnly(),e.push(n),e;if(t.startsWith("/"))throw new c("key cannot start with / - must specify collection e.g. collection/keyname:value");var n,o=t.split("/");if(o[0].includes(":"))throw new c("must specify collection e.g. collection/keyname:value");if(1===o.length)return(n=new a).setNotRoot(),n.setCollection(t),n.setCollectionOnly(),e.push(n),e;var r=new a;r.setNotRoot(),r.setCollection(o[0]),e.push(r);for(var i=1;i<o.length;i++)if(o[i].includes(":")){var s=o[i].split(":");if(2!==s.length)throw new c("look up must be in form keyname:value - found: "+o[i]);r.setKeyField(s[0]),r.setKeyValue(s[1]),r.setNotCollectionOnly()}else o[i].startsWith("?")?r.setQueryParams(o[i].substring(1).split(",")):((r=new a).setNotRoot(),r.setCollectionOnly(),r.setCollection(o[i]),e.push(r));return e},a.prototype.setRoot=function(){this._isRoot=!0,this._collection="root"},a.prototype.setNotRoot=function(){this._isRoot=!1},a.prototype.setCollection=function(t){this._collection=t},a.prototype.setCollectionOnly=function(){this._isCollectionOnly=!0},a.prototype.setNotCollectionOnly=function(){this._isCollectionOnly=!1},a.prototype.setKeyField=function(t){this._keyField=t},a.prototype.setKeyValue=function(t){this._keyValue=t},a.prototype.setQueryParams=function(t){this._queryParams=t},a.prototype.getCollection=function(){return this._collection},a.prototype.getKeyField=function(){return this._keyField},a.prototype.getKeyValue=function(){return this._keyValue},a.prototype.getQueryParams=function(){return this._queryParams},a.prototype.isRoot=function(){return this._isRoot},a.prototype.isCollectionOnly=function(){return this._isCollectionOnly},a}(),h=function(){function t(t,e,n,o,r){e||l.splitPath(e),this._command=t,this._key=e,this._data=n,this._pathParameters=o,this._attachmentId=r}return t.prototype.setCommand=function(t){this._command=t},t.prototype.setKey=function(t){this._key=t},t.prototype.setParameters=function(t){this._pathParameters=t},t.prototype.setData=function(t){this._data=t},t.prototype.setCollection=function(t){this._collection=t},t.prototype.setCollectionList=function(t){this._collectionList=t},t.prototype.setCorrelationInfo=function(t,e,n){this._correlationId=t,this._onFulFilled=e,this._onError=n,this._requestTime=(new Date).getTime()},t.prototype.getMessage=function(){var t={cmd:this._command,correlationId:this._correlationId};return this._key&&(t.key=this._key),this._pathParameters&&(t.parameters=this._pathParameters.getParameters()),this._attachmentId&&(t.attachmentId=this._attachmentId),this._data&&(t.data=this._data),t},t}(),u=function(){function t(){}return t.findList=function(t,e){if("[object Array]"===Object.prototype.toString.call(e))return this.traverseUntilFinalList(t,e);var n=l.splitPath(t);if(1===n.length&&n[0].getKeyField()===undefined)return e[n[0].getCollection()];for(var o=[],r=0;r<n.length;r++)n[r].getKeyField()===undefined?o=e[n[r].getCollection()]:e=this.findARecord(r,n,e);return o===undefined?[]:o},t.findRecord=function(t,e){if("[object Array]"===Object.prototype.toString.call(e))return this.traverseUntilFinalRecord(t,e);for(var n=l.splitPath(t),o=0;o<n.length;o++)e=this.findARecord(o,n,e);return e},t.findRecordInList=function(t,e,n){if(n!==undefined)for(var o=0;o<n.length;o++){var r=n[o][t];if(r!==undefined&&this.matches(r,e))return n[o]}throw new c("[findRecordInList] failed to find record - field ["+t+" ] value ["+e+"]")},t.findRecordIndexInList=function(t,e,n){if(n!==undefined)for(var o=0;o<n.length;o++){var r=n[o][t];if(r!==undefined&&this.matches(r,e))return o}throw new c("[findRecordIndexInList] failed to find record - field ["+t+" ] value ["+e+"]")},t.findARecord=function(t,e,n){var o=n[e[t].getCollection()];return this.findRecordInList(e[t].getKeyField(),e[t].getKeyValue(),o)},t.traverseUntilFinalRecord=function(t,e){for(var n=l.splitPath(t),o=this.findRecordInList(n[0].getKeyField(),n[0].getKeyValue(),e),r=1;r<n.length;r++)o=this.findARecord(r,n,o);return o},t.traverseUntilFinalList=function(t,e){var n=l.splitPath(t);if(n[0].getKeyField()===undefined)return e;for(var o=[],r=this.findRecordInList(n[0].getKeyField(),n[0].getKeyValue(),e),i=1;i<n.length;i++)n[i].getKeyField()===undefined||i===n.length-1?o=r[n[i].getCollection()]:r=this.findARecord(i,n,r);return o===undefined?[]:o},t.matches=function(t,e){return"number"==typeof t?"number"==typeof e?t===e:t===Number(e):"string"==typeof e?t===e:t===String(e)},t}(),p={ADD:"ADD",UPDATE:"UPDATE",REMOVE:"REMOVE"},d=function(){function t(t){this._operation=t.operation,this._path=t.path,this._collection=t.collection,this._changes=t.changes,this._record=t.record}return t.prototype.getOperation=function(){return this._operation},t.prototype.getPath=function(){return this._path},t.prototype.getCollection=function(){return this._collection},t.prototype.getChanges=function(){return this._changes},t.prototype.getRecord=function(){return this._record},t}(),f={GRAPH_ADD_RESPONSE:"graph-add",GRAPH_UPDATE_RESPONSE:"graph-update",GRAPH_REMOVE_RESPONSE:"graph-remove",GRAPH_INITIAL_LOAD_RESPONSE:"graph-attach",GRAPH_FETCH_RESPONSE:"graph-fetch",GRAPH_SCHEMA_RESPONSE:"graph-schema",GRAPH_CLIENT_ATTACHMENTS_RESPONSE:"graph-current_attachments",GRAPH_OK_RESPONSE:"ok",GRAPH_FAIL_RESPONSE:"fail",GRAPH_DETACH_RESPONSE:"graph-detach",GRAPH_DETACH_ALL_RESPONSE:"graph-detach_all"},g=function(){function t(t){if(t.graphMessageType===undefined)throw new c("not a graph response message");if(this._graphMessageType=t.graphMessageType,f[this._graphMessageType]===undefined)throw new c("not a valid graph response message type");this._correlationId=t.correlationId,this._key=t.key,t.instruction&&(this._instruction=new d(t.instruction)),this._data=t.data,this._status=t.status,this._cmd=t.cmd,this._attachmentId=t.attachmentId,this._graphMessageType=t.graphMessageType}return t.prototype.getCorrelationId=function(){return this._correlationId},t.prototype.getKey=function(){return this._key},t.prototype.getInstruction=function(){return this._instruction},t.prototype.getData=function(){return this._data},t.prototype.getStatus=function(){return this._status},t.prototype.getGraphMessageType=function(){return this._graphMessageType},t.prototype.getCommand=function(){return this._cmd},t.prototype.getAttachmentId=function(){return this._attachmentId},t}(),y=function(){function t(t,e,n){this._key=e,this._attachmentId=t,this._loadStream=new r.Subject,this._addStream=new r.Subject,this._changeStream=new r.Subject,this._removeStream=new r.Subject,this._tickStream=new r.Subject,this._logService=n}return t.prototype.isList=function(){return this._isList},t.prototype.getAttachmentId=function(){return this._attachmentId},t.prototype.getKey=function(){return this._key},t.prototype.getData=function(){return this._data},t.prototype.getListData=function(){return this._listData},t.prototype.setData=function(t){t===undefined?this._data={}:this._data=t,this._isList=!1},t.prototype.setListData=function(t){t===undefined?this._listData=[]:this._listData=t,this._isList=!0},t.prototype.load=function(t){this._logService.log("attachment "+this._key+" loaded",t),t!==undefined?this._loadStream.next(t):(this._isList,this._loadStream.next(undefined)),this._tickStream.next(t)},t.prototype.added=function(t){this._logService.log("attachment "+this._key+" added",t),this._addStream.next(t),this._tickStream.next(t)},t.prototype.changed=function(t){this._logService.log("attachment "+this._key+" changed",t),this._changeStream.next(t),this._tickStream.next(t)},t.prototype.removed=function(t){this._logService.log("attachment "+this._key+" removed",t),this._removeStream.next(t),this._tickStream.next(t)},t.prototype.loadStream=function(){return this._loadStream},t.prototype.addedStream=function(){return this._addStream},t.prototype.changedStream=function(){return this._changeStream},t.prototype.removedStream=function(){return this._removeStream},t.prototype.onTick=function(){return this._tickStream},t}();function _(t){var e=t;return e=(e=(e=(e=e.replace(/([a-z][A-Z])/g,function(t){return t.substr(0,1)+"-"+t.substr(1,1).toLowerCase()})).toLowerCase()).replace(/[^-a-z0-9]+/g,"-")).replace(/^-+/,"").replace(/-$/,"")}function m(t){return t.replace(/-([a-z])/gi,function(t,e){return e.toUpperCase()})}function S(t){if("string"==typeof t)return m(t);var e,n,o;if(t instanceof Array)for(var r in e=[],t)t.hasOwnProperty(r)&&("object"==typeof(o=t[r])&&(o=S(o)),e.push(o));else for(var r in e={},t)t.hasOwnProperty(r)&&(n=m(r),null!==(o=t[r])&&o.constructor===Object?o=S(o):o instanceof Array&&(o=S(o)),e[n]=o);return e}var C=function(){function t(){this.logging=new r.BehaviorSubject(!1)}return t.prototype.setLog=function(t){this.logging.next(t)},t.prototype.log=function(t,e){var n=new Date;this.logging.getValue()&&(e===undefined?console.log("Blast ["+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()+"."+n.getMilliseconds()+"] "+t):console.log("Blast ["+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()+"."+n.getMilliseconds()+"] "+t,e))},t}(),v=function(s){function t(t,e,n,o,r){var i=s.call(this,t,n,o,r)||this;return i._url=t,i._logging=e,i._connectNow=n,i._protocols=o,i._config=r,i._correlatedGraphRequestMap=[],i._collectionMap={},i._correlationId=0,i._logService=new C,i._logService.setLog(e),i}return function e(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,s),t.prototype.add=function(t,e){return this.sendGraphRequest(new h("add",t,e))},t.prototype.update=function(t,e){return this.sendGraphRequest(new h("update",t,e))},t.prototype.remove=function(t){return this.sendGraphRequest(new h("remove",t))},t.prototype.randomId=function(){function t(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+t()+t()},t.prototype.attach=function(t,e,n){0===t.trim().length&&(t="root");var o=!1;"[object Array]"===Object.prototype.toString.call(e)&&(o=!0);var r=l.splitPath(t);if(r[r.length-1].getKeyField()!==undefined&&o)this.handlePromiseError(new c("Can only attach to a type of {} when keyField:keyValue is last element of path"));else{if(r[r.length-1].getKeyField()!==undefined||o){var i=this.randomId(),s=new y(i,t,this._logService);return o?s.setListData(e):s.setData(e),this._collectionMap[i]=s,this.sendGraphRequest(new h("attach",t,null,n,i)),s}this.handlePromiseError(new c("Can only attach to a type of [] when last element of path is a collection"))}},t.prototype.handlePromiseError=function(n){return new Promise(function(t,e){e(n.message)})},t.prototype.detach=function(t){return this.sendGraphRequest(new h("detach",t))},t.prototype.detachAll=function(){return this.sendGraphRequest(new h("detachAll"))},t.prototype.getAttachments=function(){return this.sendGraphRequest(new h("attachments"))},t.prototype.fetch=function(t,e){return this.sendGraphRequest(new h("fetch",t,e))},t.prototype.fetchRoot=function(){return this.sendGraphRequest(new h("fetch",""))},t.prototype.getSchema=function(){return this.sendGraphRequest(new h("schema"))},t.prototype.loggingOn=function(){this._logService.setLog(!0)},t.prototype.loggingOff=function(){this._logService.setLog(!1)},t.prototype.sendGraphRequest=function(t){var n,o,e=new Promise(function(t,e){n=t,o=e});return t.setCorrelationInfo(++this._correlationId,n,o),this._correlatedGraphRequestMap[t._correlationId]=t,this.send(function i(t){if("string"==typeof t)return _(t);var e,n,o;if(t instanceof Array)for(var r in e=[],t)t.hasOwnProperty(r)&&("object"==typeof(o=t[r])&&(o=i(o)),e.push(o));else for(var r in e={},t)t.hasOwnProperty(r)&&(n=_(r),null!==(o=t[r])&&o!==undefined&&o.constructor===Object&&(o=i(o)),e[n]=o);return e}(t.getMessage())),e},t.prototype.buildPath=function(t,e,n){for(var o="",r=t;r<e.length;r++)0<o.length&&(o+="/"),o+=e[r].getCollection(),(r<e.length-1||n)&&(o+="/",null!=e[r].getKeyField()&&(o=o+e[r].getKeyField()+":"+e[r].getKeyValue()));return o},t.prototype.calculateTruePath=function(t,e,n){var o=l.splitPath(t),r=l.splitPath(e),i="";if(o[o.length-1].isRoot())i=this.buildPath(0,r,n===p.UPDATE);else if(null==o[o.length-1].getKeyField()){for(var s=0;s<r.length;s++)if(r[s].getCollection()===o[o.length-1].getCollection()){i=this.buildPath(s,r,n===p.UPDATE);break}}else i=o.length===r.length?this.buildPath(r.length-1,r,n===p.UPDATE):this.buildPath(o.length,r,n===p.UPDATE);return i},t.prototype.applyChangeToRecord=function(t,e){for(var n=0;n<e.getChanges().length;n++)t[e.getChanges()[n].name]=e.getChanges()[n].value},t.prototype.getGraphMessage=function(t){return new g(JSON.parse(S(t)))},t.prototype.handleInitialLoad=function(t,e){var n=this._collectionMap[e.getAttachmentId()];if(null==n)return console.error("Failed to find collection for key: ",e.getAttachmentId()),void t._onError("Failed to find collection for key: "+e.getAttachmentId());n.isList()?(null!==e.getData()&&e.getData()!==undefined?(Array.prototype.push.apply(n.getListData(),e.getData()),n.load(e.getData())):n.load(undefined),t._onFulFilled(n.getListData())):(this.mergeMap(n.getData(),e.getData()),t._onFulFilled(n.getData()))},t.prototype.handleJsonMessage=function(t){try{this._logService.log("raw message ",t);var e=new g(S(t));return this._logService.log("graph message ",e),this.handleCommand(e),!0}catch(n){return console.error(n),!1}},t.prototype.handleCommand=function(t){this.handleTheCommand(t)},t.prototype.handleTheCommand=function(t){try{switch(t.getCommand()){case f.GRAPH_ADD_RESPONSE:case f.GRAPH_UPDATE_RESPONSE:case f.GRAPH_REMOVE_RESPONSE:return void this.handleGraphModify(t)}var e=this._correlatedGraphRequestMap[t.getCorrelationId()];if(e===undefined)throw new c("Failed to find correlation id: "+t.getCorrelationId());switch(t.getCommand()){case f.GRAPH_DETACH_RESPONSE:case f.GRAPH_DETACH_ALL_RESPONSE:case f.GRAPH_OK_RESPONSE:case f.GRAPH_FAIL_RESPONSE:e._onFulFilled(t);break;case f.GRAPH_INITIAL_LOAD_RESPONSE:this.handleInitialLoad(e,t);break;case f.GRAPH_CLIENT_ATTACHMENTS_RESPONSE:case f.GRAPH_SCHEMA_RESPONSE:case f.GRAPH_FETCH_RESPONSE:e._onFulFilled(t.getData())}}catch(n){}},t.prototype.handleGraphModify=function(t){if(!this.shouldAbandonProcessing(t)){var e=this._collectionMap[t.getAttachmentId()];if(e!==undefined){var n=this.calculateTruePath(t.getKey(),t.getInstruction().getPath(),t.getInstruction().getOperation()),o=[],r={};switch(t.getInstruction().getOperation()){case p.ADD:e.isList()?u.findList(n,e.getListData()).push(t.getInstruction().getRecord()):u.findList(n,e.getData()).push(t.getInstruction().getRecord()),e.added(t.getInstruction().getRecord());break;case p.UPDATE:r=e.isList()?u.findRecord(n,e.getListData()):0===n.length||t.getKey().endsWith(n)?e.getData():u.findRecord(n,e.getData()),this.applyChangeToRecord(r,t.getInstruction()),e.changed(r);break;case p.REMOVE:var i=l.splitPath(t.getInstruction().getPath()),s=i[i.length-1].getCollection()+"/"+i[i.length-1].getKeyField()+":"+i[i.length-1].getKeyValue(),a=void 0;e.isList()?(o=e.getListData(),a=u.findRecordIndexInList(i[i.length-1].getKeyField(),i[i.length-1].getKeyValue(),e.getListData())):(o=u.findList(n,e.getData()),a=0===s.length||t.getKey().endsWith(s)?0:u.findRecordIndexInList(i[i.length-1].getKeyField(),i[i.length-1].getKeyValue(),o)),o.splice(a,1),e.removed(r)}}}},t.prototype.shouldAbandonProcessing=function(t){if(!t.getInstruction())return!0;var e=t.getInstruction().getOperation()===p.REMOVE,n=!t.getInstruction().getChanges()||0===t.getInstruction().getChanges().length,o=t.getInstruction().getRecord();return e&&n&&o},t.prototype.mergeMap=function(t,e){for(var n in e)if(e.hasOwnProperty(n))try{e[n].constructor===Object?t[n]=this.mergeMap(t[n],e[n]):t[n]=e[n]}catch(o){t[n]=e[n]}},t}(n),R=function(){function t(t,e,n){this._includeChildren=!0,this._fields=[],this._predicates=[],t!==undefined?this._includeChildren=t:this._includeChildren=!0,e!==undefined&&(this._fields=e),n!==undefined&&(this._predicates=n)}return t.prototype.getParameters=function(){var t={includeChildren:this._includeChildren};return this._fields!==undefined&&(t.fields=this._fields),this._predicates!==undefined&&(t.predicates=this._predicates),t},t}(),E=function P(t,e,n){this._field=t,this._operand=e,this._value=n};t.useKebab=!0,t.GraphBlastService=v,t.CollectionTraversor=u,t.Attachment=y,t.PathParameters=R,t.PathDetails=l,t.QueryParameter=E,t.GraphRequest=h,t.GraphResponseMessage=g,t.Instruction=d,t.LogService=C,t.Operation=p,t.BlastHelpers=i,t.BlastException=c,t.BLAST_VERSION=e,t.LOG_LEVEL=s,t.BlastService=n,Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=blast-graph-angular2.umd.min.js.map