Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/haydn/json-api-store. An isomorphic JavaScript library that acts as an in memory data store for JSO particlesystem.com/json-api-store
Something went wrong. Try again.
94 kB · 2243 lines
JSON
at master
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243[ { "kind": "file", "static": true, "variation": null, "name": "src/ajax-adapter.js", "memberof": null, "longname": "src/ajax-adapter.js", "access": null, "description": null, "lineNumber": 1, "content": "import ajax from \"./ajax\";\n\nexport default class AjaxAdapter {\n\n constructor(options) {\n this._base = (options && options.base) || \"\";\n };\n\n create(store, type, partial, options) {\n\n if (!store._types[type]) {\n throw new Error(`Unknown type '${type}'`);\n }\n\n let source = ajax({\n body: JSON.stringify({\n data: store.convert(type, partial)\n }),\n crossDomain: true,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\"\n },\n method: \"POST\",\n responseType: \"auto\",\n url: this._getUrl(type, null, options)\n }).do(e => store.push(e.response))\n .map(e => store.find(e.response.data.type, e.response.data.id))\n .publish();\n\n source.connect();\n\n return source;\n\n }\n\n destroy(store, type, id, options) {\n\n if (!store._types[type]) {\n throw new Error(`Unknown type '${type}'`);\n }\n\n let source = ajax({\n crossDomain: true,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\"\n },\n method: \"DELETE\",\n responseType: \"auto\",\n url: this._getUrl(type, id, options)\n }).do(() => store.remove(type, id))\n .publish();\n\n source.connect();\n\n return source;\n\n }\n\n load(store, type, id, options) {\n\n if (id && typeof id === \"object\") {\n return this.load(store, type, null, id);\n }\n\n if (!store._types[type]) {\n throw new Error(`Unknown type '${type}'`);\n }\n\n let source = ajax({\n crossDomain: true,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\"\n },\n method: \"GET\",\n responseType: \"auto\",\n url: this._getUrl(type, id, options)\n }).do(e => store.push(e.response))\n .map(() => id ? store.find(type, id) : store.findAll(type))\n .publish();\n\n source.connect();\n\n return source;\n\n }\n\n update(store, type, id, partial, options) {\n\n if (!store._types[type]) {\n throw new Error(`Unknown type '${type}'`);\n }\n\n let data = store.convert(type, id, partial);\n\n let source = ajax({\n body: JSON.stringify({\n data: data\n }),\n crossDomain: true,\n headers: {\n \"Content-Type\": \"application/vnd.api+json\"\n },\n method: \"PATCH\",\n responseType: \"auto\",\n url: this._getUrl(type, id, options)\n }).do(() => store.add(data))\n .map(() => store.find(type, id))\n .publish();\n\n source.connect();\n\n return source;\n\n }\n\n _getUrl(type, id, options) {\n\n let params = [];\n let url = id ? `${this._base}/${type}/${id}` : `${this._base}/${type}`;\n\n if (options) {\n\n if (options.fields) {\n Object.keys(options.fields).forEach(field => {\n options[`fields[${field}]`] = options.fields[field];\n });\n delete options.fields;\n }\n\n params = Object.keys(options).map(key => {\n return key + \"=\" + encodeURIComponent(options[key]);\n }).sort();\n\n if (params.length) {\n url = `${url}?${params.join(\"&\")}`;\n }\n\n }\n\n return url;\n\n }\n\n}\n" }, { "kind": "class", "static": true, "variation": null, "name": "AjaxAdapter", "memberof": "src/ajax-adapter.js", "longname": "src/ajax-adapter.js~AjaxAdapter", "access": null, "export": true, "importPath": "json-api-store/src/ajax-adapter.js", "importStyle": "AjaxAdapter", "description": null, "lineNumber": 3, "undocument": true, "interface": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#constructor", "access": null, "description": null, "lineNumber": 5, "undocument": true, "params": [ { "name": "options", "types": [ "*" ] } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "_base", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#_base", "access": null, "description": null, "lineNumber": 6, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "method", "static": false, "variation": null, "name": "create", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#create", "access": null, "description": null, "lineNumber": 9, "undocument": true, "params": [ { "name": "store", "types": [ "*" ] }, { "name": "type", "types": [ "*" ] }, { "name": "partial", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#destroy", "access": null, "description": null, "lineNumber": 36, "undocument": true, "params": [ { "name": "store", "types": [ "*" ] }, { "name": "type", "types": [ "*" ] }, { "name": "id", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "load", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#load", "access": null, "description": null, "lineNumber": 59, "undocument": true, "params": [ { "name": "store", "types": [ "*" ] }, { "name": "type", "types": [ "*" ] }, { "name": "id", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "update", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#update", "access": null, "description": null, "lineNumber": 87, "undocument": true, "params": [ { "name": "store", "types": [ "*" ] }, { "name": "type", "types": [ "*" ] }, { "name": "id", "types": [ "*" ] }, { "name": "partial", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_getUrl", "memberof": "src/ajax-adapter.js~AjaxAdapter", "longname": "src/ajax-adapter.js~AjaxAdapter#_getUrl", "access": null, "description": null, "lineNumber": 116, "undocument": true, "params": [ { "name": "type", "types": [ "*" ] }, { "name": "id", "types": [ "*" ] }, { "name": "options", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "file", "static": true, "variation": null, "name": "src/ajax.js", "memberof": null, "longname": "src/ajax.js", "access": null, "description": null, "lineNumber": 1, "content": "import Rx from \"rx\";\n\n/**\n *\n * Derived from RxJS-DOM, Copyright (c) Microsoft Open Technologies, Inc:\n *\n * https://github.com/Reactive-Extensions/RxJS-DOM\n *\n * The original source file can be viewed here:\n *\n * https://github.com/Reactive-Extensions/RxJS-DOM/blob/fdb169c8bd1612318d530e6e54074b1c9e537906/src/ajax.js\n *\n * Licensed under the Apache License, Version 2.0:\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Modifications from original:\n *\n * - extracted from \"Rx.DOM\" namespace\n * - minor eslinter cleanup (\"var\" to \"let\" etc)\n * - addition of \"auto\" responseType\n *\n */\n\nvar root = (typeof window !== \"undefined\" && window) || this;\n\n// Gets the proper XMLHttpRequest for support for older IE\nfunction getXMLHttpRequest() {\n if (root.XMLHttpRequest) {\n return new root.XMLHttpRequest();\n } else {\n let progId;\n try {\n let progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];\n for(let i = 0; i < 3; i++) {\n try {\n progId = progIds[i];\n if (new root.ActiveXObject(progId)) {\n break;\n }\n } catch(e) { }\n }\n return new root.ActiveXObject(progId);\n } catch (e) {\n throw new Error('XMLHttpRequest is not supported by your browser');\n }\n }\n}\n\n// Get CORS support even for older IE\nfunction getCORSRequest() {\n var xhr = new root.XMLHttpRequest();\n if ('withCredentials' in xhr) {\n return xhr;\n } else if (!!root.XDomainRequest) {\n return new XDomainRequest();\n } else {\n throw new Error('CORS is not supported by your browser');\n }\n}\n\nfunction normalizeAjaxSuccessEvent(e, xhr, settings) {\n var response = ('response' in xhr) ? xhr.response : xhr.responseText;\n if (settings.responseType === 'auto') {\n try {\n response = JSON.parse(response);\n } catch (e) {}\n } else {\n response = settings.responseType === 'json' ? JSON.parse(response) : response;\n }\n return {\n response: response,\n status: xhr.status,\n responseType: xhr.responseType,\n xhr: xhr,\n originalEvent: e\n };\n}\n\nfunction normalizeAjaxErrorEvent(e, xhr, type) {\n return {\n type: type,\n status: xhr.status,\n xhr: xhr,\n originalEvent: e\n };\n}\n\n/**\n * Creates an observable for an Ajax request with either a settings object with url, headers, etc or a string for a URL.\n *\n * @example\n * source = ajax('/products');\n * source = ajax({ url: 'products', method: 'GET' });\n *\n * @param {Object} settings Can be one of the following:\n *\n * A string of the URL to make the Ajax call.\n * An object with the following properties\n * - url: URL of the request\n * - body: The body of the request\n * - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE\n * - async: Whether the request is async\n * - headers: Optional headers\n * - crossDomain: true if a cross domain request, else false\n * - responseType: \"text\" (default), \"json\" or \"auto\"\n *\n * @returns {Observable} An observable sequence containing the XMLHttpRequest.\n*/\nexport default function (options) {\n var settings = {\n method: 'GET',\n crossDomain: false,\n async: true,\n headers: {},\n responseType: 'text',\n createXHR: function(){\n return this.crossDomain ? getCORSRequest() : getXMLHttpRequest();\n },\n normalizeError: normalizeAjaxErrorEvent,\n normalizeSuccess: normalizeAjaxSuccessEvent\n };\n\n if(typeof options === 'string') {\n settings.url = options;\n } else {\n for(let prop in options) {\n if(hasOwnProperty.call(options, prop)) {\n settings[prop] = options[prop];\n }\n }\n }\n\n let normalizeError = settings.normalizeError;\n let normalizeSuccess = settings.normalizeSuccess;\n\n if (!settings.crossDomain && !settings.headers['X-Requested-With']) {\n settings.headers['X-Requested-With'] = 'XMLHttpRequest';\n }\n settings.hasContent = settings.body !== undefined;\n\n return new Rx.AnonymousObservable(function (observer) {\n var isDone = false;\n var xhr;\n\n var processResponse = function(xhr, e){\n var status = xhr.status === 1223 ? 204 : xhr.status;\n if ((status >= 200 && status <= 300) || status === 0 || status === '') {\n observer.onNext(normalizeSuccess(e, xhr, settings));\n observer.onCompleted();\n } else {\n observer.onError(normalizeError(e, xhr, 'error'));\n }\n isDone = true;\n };\n\n try {\n xhr = settings.createXHR();;\n } catch (err) {\n observer.onError(err);\n }\n\n try {\n if (settings.user) {\n xhr.open(settings.method, settings.url, settings.async, settings.user, settings.password);\n } else {\n xhr.open(settings.method, settings.url, settings.async);\n }\n\n let headers = settings.headers;\n for (let header in headers) {\n if (hasOwnProperty.call(headers, header)) {\n xhr.setRequestHeader(header, headers[header]);\n }\n }\n\n if(!!xhr.upload || (!('withCredentials' in xhr) && !!root.XDomainRequest)) {\n xhr.onload = function(e) {\n if(settings.progressObserver) {\n settings.progressObserver.onNext(e);\n settings.progressObserver.onCompleted();\n }\n processResponse(xhr, e);\n };\n\n if(settings.progressObserver) {\n xhr.onprogress = function(e) {\n settings.progressObserver.onNext(e);\n };\n }\n\n xhr.onerror = function(e) {\n if (settings.progressObserver) {\n settings.progressObserver.onError(e);\n }\n observer.onError(normalizeError(e, xhr, 'error'));\n isDone = true;\n };\n\n xhr.onabort = function(e) {\n if (settings.progressObserver) {\n settings.progressObserver.onError(e);\n }\n observer.onError(normalizeError(e, xhr, 'abort'));\n isDone = true;\n };\n } else {\n\n xhr.onreadystatechange = function (e) {\n if (xhr.readyState === 4) {\n processResponse(xhr, e);\n }\n };\n }\n\n xhr.send(settings.hasContent && settings.body || null);\n } catch (e) {\n observer.onError(e);\n }\n\n return function () {\n if (!isDone && xhr.readyState !== 4) { xhr.abort(); }\n };\n });\n};\n" }, { "kind": "variable", "static": true, "variation": null, "name": "root", "memberof": "src/ajax.js", "longname": "src/ajax.js~root", "access": null, "export": false, "importPath": "json-api-store/src/ajax.js", "importStyle": null, "description": "Derived from RxJS-DOM, Copyright (c) Microsoft Open Technologies, Inc:\n\nhttps://github.com/Reactive-Extensions/RxJS-DOM\n\nThe original source file can be viewed here:\n\nhttps://github.com/Reactive-Extensions/RxJS-DOM/blob/fdb169c8bd1612318d530e6e54074b1c9e537906/src/ajax.js\n\nLicensed under the Apache License, Version 2.0:\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nModifications from original:\n\n- extracted from \"Rx.DOM\" namespace\n- minor eslinter cleanup (\"var\" to \"let\" etc)\n- addition of \"auto\" responseType", "lineNumber": 25, "type": { "types": [ "*" ] } }, { "kind": "function", "static": true, "variation": null, "name": "getXMLHttpRequest", "memberof": "src/ajax.js", "longname": "src/ajax.js~getXMLHttpRequest", "access": null, "export": false, "importPath": "json-api-store/src/ajax.js", "importStyle": null, "description": null, "lineNumber": 28, "undocument": true, "params": [], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "function", "static": true, "variation": null, "name": "getCORSRequest", "memberof": "src/ajax.js", "longname": "src/ajax.js~getCORSRequest", "access": null, "export": false, "importPath": "json-api-store/src/ajax.js", "importStyle": null, "description": null, "lineNumber": 51, "undocument": true, "params": [], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "function", "static": true, "variation": null, "name": "normalizeAjaxSuccessEvent", "memberof": "src/ajax.js", "longname": "src/ajax.js~normalizeAjaxSuccessEvent", "access": null, "export": false, "importPath": "json-api-store/src/ajax.js", "importStyle": null, "description": null, "lineNumber": 62, "undocument": true, "params": [ { "name": "e", "types": [ "*" ] }, { "name": "xhr", "types": [ "*" ] }, { "name": "settings", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "function", "static": true, "variation": null, "name": "normalizeAjaxErrorEvent", "memberof": "src/ajax.js", "longname": "src/ajax.js~normalizeAjaxErrorEvent", "access": null, "export": false, "importPath": "json-api-store/src/ajax.js", "importStyle": null, "description": null, "lineNumber": 80, "undocument": true, "params": [ { "name": "e", "types": [ "*" ] }, { "name": "xhr", "types": [ "*" ] }, { "name": "type", "types": [ "*" ] } ], "return": { "types": [ "*" ] }, "generator": false }, { "kind": "function", "static": true, "variation": null, "name": "ajax", "memberof": "src/ajax.js", "longname": "src/ajax.js~ajax", "access": null, "export": true, "importPath": "json-api-store/src/ajax.js", "importStyle": "ajax", "description": "Creates an observable for an Ajax request with either a settings object with url, headers, etc or a string for a URL.", "examples": [ " source = ajax('/products');\n source = ajax({ url: 'products', method: 'GET' });" ], "lineNumber": 110, "unknown": [ { "tagName": "@returns", "tagValue": "{Observable} An observable sequence containing the XMLHttpRequest." } ], "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "settings", "description": "Can be one of the following:\n\n A string of the URL to make the Ajax call.\n An object with the following properties\n - url: URL of the request\n - body: The body of the request\n - method: Method of the request, such as GET, POST, PUT, PATCH, DELETE\n - async: Whether the request is async\n - headers: Optional headers\n - crossDomain: true if a cross domain request, else false\n - responseType: \"text\" (default), \"json\" or \"auto\"" } ], "return": { "nullable": null, "types": [ "Observable" ], "spread": false, "description": "An observable sequence containing the XMLHttpRequest." }, "generator": false }, { "kind": "file", "static": true, "variation": null, "name": "src/store.js", "memberof": null, "longname": "src/store.js", "access": null, "description": null, "lineNumber": 1, "content": "import \"array.prototype.find\";\nimport Rx from \"rx\";\nimport AjaxAdapter from \"./ajax-adapter\";\n\nexport default class Store {\n\n /**\n * Creates a field definition for an attribute.\n *\n * @since 0.1.0\n * @param {string} [name] - Name of the property to map this field from.\n * @param {Object} [options] - An options object.\n * @param {string} [options.default] - Default value for this field.\n * @return {Object} - Field definition.\n */\n static attr(name, options) {\n if (name && typeof name === 'object') {\n return Store.attr(null, name);\n } else {\n return {\n type: \"attr\",\n default: options && options.default,\n deserialize: function (data, key) {\n return data.attributes && data.attributes[name || key];\n },\n serialize: function (resource, data, key) {\n data.attributes[name || key] = resource[key];\n }\n };\n }\n }\n\n /**\n * Creates a field definition for an has-one relationship.\n *\n * @since 0.1.0\n * @param {string} [name] - Name of the property to map this field from.\n * @param {Object} [options] - An options object.\n * @param {string} [options.inverse] - Name of the inverse relationship.\n * @return {Object} - Field definition.\n */\n static hasOne(name, options) {\n if (name && typeof name === 'object') {\n return Store.hasOne(null, name);\n } else {\n return {\n type: \"has-one\",\n inverse: options && options.inverse,\n deserialize: function (data, key) {\n name = name || key;\n if (data.relationships && data.relationships[name]) {\n if (data.relationships[name].data === null) {\n return null;\n } else if (data.relationships[name].data) {\n return this.find(data.relationships[name].data.type, data.relationships[name].data.id);\n }\n }\n },\n serialize: function serialize(resource, data, key) {\n if (resource[key] === null) {\n data.relationships[name || key] = null;\n } else if (resource[key]) {\n data.relationships[name || key] = {\n data: {\n type: resource[key].type,\n id: resource[key].id\n }\n };\n }\n }\n };\n }\n }\n\n /**\n * Creates a field definition for an has-many relationship.\n *\n * @since 0.1.0\n * @param {string} [name] - Name of the property to map this field from.\n * @param {Object} [options] - An options object.\n * @param {string} [options.inverse] - Name of the inverse relationship.\n * @return {Object} - Field definition.\n */\n static hasMany(name, options) {\n if (name && typeof name === 'object') {\n return Store.hasMany(null, name);\n } else {\n return {\n type: \"has-many\",\n default: [],\n inverse: options && options.inverse,\n deserialize: function (data, key) {\n name = name || key;\n if (data.relationships && data.relationships[name]) {\n if (data.relationships[name].data === null) {\n return [];\n } else if (data.relationships[name].data) {\n return data.relationships[name].data.map((c) => {\n return this.find(c.type, c.id);\n });\n }\n }\n },\n serialize: function serialize(resource, data, key) {\n if (resource[key]) {\n data.relationships[name || key] = {\n data: resource[key].map(x => {\n return { type: x.type, id: x.id };\n })\n };\n }\n }\n };\n }\n }\n\n constructor(adapter) {\n\n this._adapter = adapter;\n this._data = {};\n this._subject = new Rx.Subject();\n this._subscriptions = {};\n this._types = {};\n\n /**\n * An observable that will emit events when any resource in added, updated\n * or removed. The object passed to listeners will be in this format:\n *\n * <p><pre class=\"source-code\">\n * { name: string, type: string, id: string, resource: object }\n * </pre></p>\n *\n * You can learn more about RxJS observables at the GitHub repo:\n * https://github.com/Reactive-Extensions/RxJS\n *\n * @type {Rx.Observable}\n * @since 0.6.0\n *\n * @example\n * let store = new Store();\n *\n * store.observable.filter(e => e.name === \"added\").subscribe(event => {\n * console.log(event.name); // \"added\"\n * console.log(event.type); // \"products\"\n * console.log(event.id); // \"1\"\n * console.log(event.resource); // Map {...}\n * });\n *\n * store.observable.filter(e => e.name === \"updated\").subscribe(event => {\n * console.log(event.name); // \"updated\"\n * console.log(event.type); // \"products\"\n * console.log(event.id); // \"1\"\n * console.log(event.resource); // Map {...}\n * });\n *\n * store.observable.filter(e => e.name === \"removed\").subscribe(event => {\n * console.log(event.name); // \"removed\"\n * console.log(event.type); // \"products\"\n * console.log(event.id); // \"1\"\n * console.log(event.resource); // null\n * });\n */\n this.observable = this._subject.asObservable();\n\n }\n\n /**\n * Add an individual resource to the store. This is used internally by the\n * `push()` method.\n *\n * @since 0.1.0\n * @param {!Object} object - A JSON API Resource Object to be added. See:\n http://jsonapi.org/format/#document-resource-objects\n */\n add(object) {\n if (object) {\n if (object.type && object.id) {\n let name = this._data[object.type] && this._data[object.type][object.id] ? \"updated\" : \"added\";\n let resource = this.find(object.type, object.id);\n let definition = this._types[object.type];\n Object.keys(definition).forEach(fieldName => {\n if (fieldName[0] !== \"_\") {\n this._addField(object, resource, definition, fieldName);\n }\n });\n this._subject.onNext({\n name: name,\n type: object.type,\n id: object.id,\n resource: resource\n });\n } else {\n throw new TypeError(`The data must have a type and id`);\n }\n } else {\n throw new TypeError(`You must provide data to add`);\n }\n }\n\n /**\n * Converts the given partial into a JSON API compliant representation.\n *\n * @since 0.5.0\n * @param {!string} [type] - The type of the resource. This can be omitted if the partial includes a type property.\n * @param {!string} [id] - The id of the resource. This can be omitted if the partial includes an id property.\n * @param {!object} partial - The data to convert.\n * @return {object} - JSON API version of the object.\n */\n convert(type, id, partial) {\n if (type && typeof type === \"object\") {\n return this.convert(type.type, type.id, type);\n } else if (id && typeof id === \"object\") {\n return this.convert(type, id.id, id);\n } else {\n let data = {\n type: type,\n attributes: {},\n relationships: {}\n };\n if (id) {\n data.id = id;\n }\n let definition = this._types[data.type];\n Object.keys(definition).forEach(fieldName => {\n if (fieldName[0] !== \"_\") {\n definition[fieldName].serialize(partial, data, fieldName);\n }\n });\n return data;\n }\n }\n\n /**\n * Attempts to create the resource through the adapter and adds it to the\n * store if successful.\n *\n * @since 0.5.0\n * @param {!string} type - Type of resource.\n * @param {!Object} partial - Data to create the resource with.\n * @param {Object} [options] - Options to pass to the adapter.\n * @return {Rx.Observable}\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.create(\"product\", { title: \"A Book\" }).subscribe((product) => {\n * console.log(product.title);\n * });\n */\n create(type, partial, options) {\n if (this._adapter) {\n return this._adapter.create(this, type, partial, options);\n } else {\n throw new Error(\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\");\n }\n }\n\n /**\n * Defines a type of resource.\n *\n * @since 0.2.0\n * @param {!string|string[]} names - Name(s) of the resource.\n * @param {!Object} definition - The resource's definition.\n */\n define(names, definition) {\n names = (names.constructor === Array) ? names : [ names ];\n if (definition) {\n definition._names = names;\n names.forEach(name => {\n if (!this._types[name]) {\n this._types[name] = definition;\n } else {\n throw new Error(`The type '${name}' has already been defined.`);\n }\n });\n } else {\n throw new Error(`You must provide a definition for the type '${names[0]}'.`);\n }\n }\n\n /**\n * Attempts to delete the resource through the adapter and removes it from\n * the store if successful.\n *\n * @since 0.5.0\n * @param {!string} type - Type of resource.\n * @param {!string} id - ID of resource.\n * @param {Object} [options] - Options to pass to the adapter.\n * @return {Rx.Observable}\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.destroy(\"product\", \"1\").subscribe(() => {\n * console.log(\"Destroyed!\");\n * });\n */\n destroy(type, id, options) {\n if (this._adapter) {\n return this._adapter.destroy(this, type, id, options);\n } else {\n throw new Error(\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\");\n }\n }\n\n /**\n * Finds a resource by type and id.\n *\n * NOTE: If the resource hasn't been loaded via an add() or push() call it\n * will be automatically created when find is called.\n *\n * @since 0.1.0\n * @param {!string} type - Type of the resource to find.\n * @param {!string} id - The id of the resource to find.\n * @return {Object} - The resource.\n */\n find(type, id) {\n if (type) {\n let definition = this._types[type];\n if (definition) {\n if (!this._data[type]) {\n let collection = {};\n definition._names.forEach(t => this._data[t] = collection);\n }\n if (id) {\n if (!this._data[type][id]) {\n this._data[type][id] = {\n _dependents: [],\n type: type,\n id: id\n };\n Object.keys(definition).forEach(key => {\n if (key[0] !== \"_\") {\n this._data[type][id][key] = definition[key].default;\n }\n });\n }\n return this._data[type][id];\n } else {\n // throw new TypeError(`You must provide an id`);\n /*eslint-disable*/\n console.warn([\n \"Using the `store.find()` method to find an entire collection has been deprecated in favour of `store.findAll()`.\",\n \"For more information see: https://github.com/haydn/json-api-store/releases/tag/v0.7.0\"\n ].join(\"\\n\"));\n /*eslint-enable*/\n return this.findAll(type);\n }\n } else {\n throw new TypeError(`Unknown type '${type}'`);\n }\n } else {\n throw new TypeError(`You must provide a type`);\n }\n }\n\n /**\n * Finds all the resources of a given type.\n *\n * @since 0.7.0\n * @param {!string} type - Type of the resource to find.\n * @return {Object[]} - An array of resources.\n */\n findAll(type) {\n if (type) {\n let definition = this._types[type];\n if (definition) {\n if (!this._data[type]) {\n let collection = {};\n definition._names.forEach(t => this._data[t] = collection);\n }\n return Object.keys(this._data[type]).map(x => this._data[type][x]);\n } else {\n throw new TypeError(`Unknown type '${type}'`);\n }\n } else {\n throw new TypeError(`You must provide a type`);\n }\n }\n\n /**\n * Attempts to load the given resource through the adapter and adds it to the\n * store if successful.\n *\n * @since 0.5.0\n * @param {!string} type - Type of resource.\n * @param {!string} id - ID of resource.\n * @param {Object} [options] - Options to pass to the adapter.\n * @return {Rx.Observable}\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.load(\"products\", \"1\").subscribe((product) => {\n * console.log(product.title);\n * });\n */\n load(type, id, options) {\n if (!id || typeof id === \"object\") {\n /*eslint-disable*/\n console.warn([\n \"Using the `store.load()` method to load an entire collection has been deprecated in favour of `store.loadAll()`.\",\n \"For more information see: https://github.com/haydn/json-api-store/releases/tag/v0.7.0\"\n ].join(\"\\n\"));\n /*eslint-enable*/\n }\n if (this._adapter) {\n return this._adapter.load(this, type, id, options);\n } else {\n throw new Error(\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\");\n }\n }\n\n /**\n * Attempts to load all the resources of the given type through the adapter\n * and adds them to the store if successful.\n *\n * @since 0.7.0\n * @param {!string} type - Type of resource.\n * @param {Object} [options] - Options to pass to the adapter.\n * @return {Rx.Observable}\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.loadAll(\"products\").subscribe((products) => {\n * console.log(products);\n * });\n */\n loadAll(type, options) {\n if (this._adapter) {\n return this._adapter.load(this, type, null, options);\n } else {\n throw new Error(\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\");\n }\n }\n\n /**\n * Unregister an event listener that was registered with on().\n *\n * @deprecated Use the <code>store.observable</code> property instead of this.\n * @since 0.4.0\n * @param {string} event - Name of the event.\n * @param {string} type - Name of resource to originally passed to on().\n * @param {string} [id] - ID of the resource to originally passed to on().\n * @param {function} callback - Function originally passed to on().\n */\n off(event, type, id, callback) {\n /*eslint-disable*/\n console.warn([\n \"The `store.off()` method has been deprecated in favour of `store.observable`.\",\n \"For more information see: https://github.com/haydn/json-api-store/releases/tag/v0.6.0\"\n ].join(\"\\n\"));\n /*eslint-enable*/\n if (event === \"added\" || event === \"updated\" || event === \"removed\") {\n if (this._types[type]) {\n if (id && ({}).toString.call(id) === '[object Function]') {\n this.off.call(this, event, type, null, id, callback);\n } else if (this._subscriptions[event] && this._subscriptions[event][type] && this._subscriptions[event][type][id || \"*\"]) {\n this._subscriptions[event][type][id || \"*\"].dispose();\n delete this._subscriptions[event][type][id || \"*\"];\n }\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n } else {\n throw new Error(`Unknown event '${event}'`);\n }\n }\n\n /**\n * Register an event listener: \"added\", \"updated\" or \"removed\".\n *\n * @deprecated Use the <code>store.observable</code> property instead of this.\n * @since 0.4.0\n * @param {string} event - Name of the event.\n * @param {string} type - Name of resource to watch.\n * @param {string} [id] - ID of the resource to watch.\n * @param {function} callback - Function to call when the event occurs.\n * @param {Object} [context] - Context in which to call the callback.\n */\n on(event, type, id, callback, context) {\n /*eslint-disable*/\n console.warn([\n \"The `store.on()` method has been deprecated in favour of `store.observable`.\",\n \"For more information see: https://github.com/haydn/json-api-store/releases/tag/v0.6.0\"\n ].join(\"\\n\"));\n /*eslint-enable*/\n if (event === \"added\" || event === \"updated\" || event === \"removed\") {\n if (this._types[type]) {\n if (id && ({}).toString.call(id) === '[object Function]') {\n this.on.call(this, event, type, null, id, callback);\n } else if (!this._subscriptions[event] || !this._subscriptions[event][type] || !this._subscriptions[event][type][id || \"*\"]) {\n let subscription = this._subject.filter(e => e.name === event);\n subscription = subscription.filter(e => this._types[type]._names.indexOf(e.type) !== -1);\n if (id) {\n subscription = subscription.filter(e => e.id === id);\n }\n subscription = subscription.map(e => this.find(e.type, e.id));\n this._subscriptions[event] = this._subscriptions[event] || {};\n if (!this._subscriptions[event][type]) {\n let obj = {};\n this._types[type]._names.forEach(type => {\n this._subscriptions[event][type] = obj;\n });\n }\n this._subscriptions[event][type][id || \"*\"] = subscription.subscribe(callback.bind(context));\n }\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n } else {\n throw new Error(`Unknown event '${event}'`);\n }\n }\n\n /**\n * Add a JSON API response to the store. This method can be used to handle a\n * successful GET or POST response from the server.\n *\n * @since 0.1.0\n * @param {Object} root - Top Level Object to push. See:\n http://jsonapi.org/format/#document-top-level\n */\n push(root) {\n if (root.data.constructor === Array) {\n root.data.forEach(x => this.add(x));\n } else {\n this.add(root.data);\n }\n if (root.included) {\n root.included.forEach(x => this.add(x));\n }\n }\n\n /**\n * Remove a resource or collection of resources from the store.\n *\n * @since 0.1.0\n * @param {!string} type - Type of the resource(s) to remove.\n * @param {string} [id] - The id of the resource to remove. If omitted all\n * resources of the type will be removed.\n */\n remove(type, id) {\n if (type) {\n if (this._types[type]) {\n if (id) {\n let resource = this._data[type] && this._data[type][id];\n if (resource) {\n this._remove(resource);\n this._subject.onNext({\n name: \"removed\",\n type: type,\n id: id,\n resource: null\n });\n }\n } else {\n Object.keys(this._data[type]).forEach(id => this.remove(type, id));\n }\n } else {\n throw new TypeError(`Unknown type '${type}'`);\n }\n } else {\n throw new TypeError(`You must provide a type to remove`);\n }\n }\n\n /**\n * Attempts to update the resource through the adapter and updates it in the\n * store if successful.\n *\n * @since 0.5.0\n * @param {!string} type - Type of resource.\n * @param {!string} id - ID of resource.\n * @param {!Object} partial - Data to update the resource with.\n * @param {Object} [options] - Options to pass to the adapter.\n * @return {Rx.Observable}\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.update(\"product\", \"1\", { title: \"foo\" }).subscribe((product) => {\n * console.log(product.title);\n * });\n */\n update(type, id, partial, options) {\n if (this._adapter) {\n return this._adapter.update(this, type, id, partial, options);\n } else {\n throw new Error(\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\");\n }\n }\n\n _addField(object, resource, definition, fieldName) {\n var field = definition[fieldName];\n var newValue = field.deserialize.call(this, object, fieldName);\n if (typeof newValue !== \"undefined\") {\n if (field.type === \"has-one\") {\n if (resource[fieldName]) {\n this._removeInverseRelationship(resource, fieldName, resource[fieldName], field);\n }\n if (newValue) {\n this._addInverseRelationship(resource, fieldName, newValue, field);\n }\n } else if (field.type === \"has-many\") {\n resource[fieldName].forEach(r => {\n if (resource[fieldName].indexOf(r) !== -1) {\n this._removeInverseRelationship(resource, fieldName, r, field);\n }\n });\n newValue.forEach(r => {\n this._addInverseRelationship(resource, fieldName, r, field);\n });\n }\n resource[fieldName] = newValue;\n }\n }\n\n _addInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) {\n var targetDefinition = this._types[targetResource.type];\n var sourceDefinition = this._types[sourceResource.type];\n if (targetDefinition) {\n let targetFieldName = [ sourceField.inverse ].concat(sourceDefinition._names).find(x => targetDefinition[x]);\n let targetField = targetDefinition && targetDefinition[targetFieldName];\n targetResource._dependents.push({ type: sourceResource.type, id: sourceResource.id, fieldName: sourceFieldName });\n if (targetField) {\n if (targetField.type === \"has-one\") {\n sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName });\n targetResource[targetFieldName] = sourceResource;\n } else if (targetField.type === \"has-many\") {\n sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName });\n if (targetResource[targetFieldName].indexOf(sourceResource) === -1) {\n targetResource[targetFieldName].push(sourceResource);\n }\n } else if (targetField.type === \"attr\") {\n throw new Error(`The the inverse relationship for '${sourceFieldName}' is an attribute ('${targetFieldName}')`);\n }\n } else if (sourceField.inverse) {\n throw new Error(`The the inverse relationship for '${sourceFieldName}' is missing ('${sourceField.inverse}')`);\n }\n }\n }\n\n _remove(resource) {\n resource._dependents.forEach(dependent => {\n let dependentResource = this._data[dependent.type][dependent.id];\n switch (this._types[dependent.type][dependent.fieldName].type) {\n case \"has-one\": {\n dependentResource[dependent.fieldName] = null;\n break;\n }\n case \"has-many\": {\n let index = dependentResource[dependent.fieldName].indexOf(resource);\n if (index !== -1) {\n dependentResource[dependent.fieldName].splice(index, 1);\n }\n break;\n }\n default: {\n break;\n }\n }\n // TODO: This only needs to be run once for each dependent.\n dependentResource._dependents = dependentResource._dependents.filter(d => {\n return !(d.type === resource.type && d.id === resource.id);\n });\n });\n delete this._data[resource.type][resource.id];\n }\n\n _removeInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) {\n var targetDefinition = this._types[targetResource.type];\n var targetFieldName = sourceField.inverse || sourceResource.type;\n var targetField = targetDefinition && targetDefinition[targetFieldName];\n targetResource._dependents = targetResource._dependents.filter(r => {\n return !(r.type === sourceResource.type && r.id === sourceResource.id && r.fieldName === sourceFieldName);\n });\n if (targetField) {\n if (targetField.type === \"has-one\") {\n sourceResource._dependents = sourceResource._dependents.filter(r => {\n return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName);\n });\n targetResource[targetFieldName] = null;\n } else if (targetField.type === \"has-many\") {\n sourceResource._dependents = sourceResource._dependents.filter(r => {\n return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName);\n });\n targetResource[targetFieldName] = targetResource[targetFieldName].filter(r => {\n return r !== sourceResource;\n });\n } else if (targetField.type === \"attr\") {\n throw new Error(`The the inverse relationship for '${sourceFieldName}' is an attribute ('${targetFieldName}')`);\n }\n } else if (sourceField.inverse) {\n throw new Error(`The the inverse relationship for '${sourceFieldName}' is missing ('${sourceField.inverse}')`);\n }\n }\n\n}\n\nStore.Rx = Rx;\nStore.AjaxAdapter = AjaxAdapter;\n" }, { "kind": "class", "static": true, "variation": null, "name": "Store", "memberof": "src/store.js", "longname": "src/store.js~Store", "access": null, "export": true, "importPath": "json-api-store/src/store.js", "importStyle": "Store", "description": null, "lineNumber": 5, "undocument": true, "interface": false }, { "kind": "method", "static": true, "variation": null, "name": "attr", "memberof": "src/store.js~Store", "longname": "src/store.js~Store.attr", "access": null, "description": "Creates a field definition for an attribute.", "lineNumber": 16, "since": "0.1.0", "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "name", "description": "Name of the property to map this field from." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "An options object." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "options.default", "description": "Default value for this field." } ], "return": { "nullable": null, "types": [ "Object" ], "spread": false, "description": "Field definition." }, "generator": false }, { "kind": "method", "static": true, "variation": null, "name": "hasOne", "memberof": "src/store.js~Store", "longname": "src/store.js~Store.hasOne", "access": null, "description": "Creates a field definition for an has-one relationship.", "lineNumber": 42, "since": "0.1.0", "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "name", "description": "Name of the property to map this field from." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "An options object." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "options.inverse", "description": "Name of the inverse relationship." } ], "return": { "nullable": null, "types": [ "Object" ], "spread": false, "description": "Field definition." }, "generator": false }, { "kind": "method", "static": true, "variation": null, "name": "hasMany", "memberof": "src/store.js~Store", "longname": "src/store.js~Store.hasMany", "access": null, "description": "Creates a field definition for an has-many relationship.", "lineNumber": 84, "since": "0.1.0", "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "name", "description": "Name of the property to map this field from." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "An options object." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "options.inverse", "description": "Name of the inverse relationship." } ], "return": { "nullable": null, "types": [ "Object" ], "spread": false, "description": "Field definition." }, "generator": false }, { "kind": "constructor", "static": false, "variation": null, "name": "constructor", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#constructor", "access": null, "description": null, "lineNumber": 117, "undocument": true, "params": [ { "name": "adapter", "types": [ "*" ] } ], "generator": false }, { "kind": "member", "static": false, "variation": null, "name": "_adapter", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_adapter", "access": null, "description": null, "lineNumber": 119, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "_data", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_data", "access": null, "description": null, "lineNumber": 120, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "_subject", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_subject", "access": null, "description": null, "lineNumber": 121, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "_subscriptions", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_subscriptions", "access": null, "description": null, "lineNumber": 122, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "_types", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_types", "access": null, "description": null, "lineNumber": 123, "undocument": true, "type": { "types": [ "*" ] } }, { "kind": "member", "static": false, "variation": null, "name": "observable", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#observable", "access": null, "description": "An observable that will emit events when any resource in added, updated\nor removed. The object passed to listeners will be in this format:\n\n<p><pre class=\"source-code\">\n{ name: string, type: string, id: string, resource: object }\n</pre></p>\n\nYou can learn more about RxJS observables at the GitHub repo:\nhttps://github.com/Reactive-Extensions/RxJS", "examples": [ "let store = new Store();\n\nstore.observable.filter(e => e.name === \"added\").subscribe(event => {\n console.log(event.name); // \"added\"\n console.log(event.type); // \"products\"\n console.log(event.id); // \"1\"\n console.log(event.resource); // Map {...}\n});\n\nstore.observable.filter(e => e.name === \"updated\").subscribe(event => {\n console.log(event.name); // \"updated\"\n console.log(event.type); // \"products\"\n console.log(event.id); // \"1\"\n console.log(event.resource); // Map {...}\n});\n\nstore.observable.filter(e => e.name === \"removed\").subscribe(event => {\n console.log(event.name); // \"removed\"\n console.log(event.type); // \"products\"\n console.log(event.id); // \"1\"\n console.log(event.resource); // null\n});" ], "lineNumber": 163, "since": "0.6.0", "type": { "nullable": null, "types": [ "Rx.Observable" ], "spread": false, "description": null } }, { "kind": "method", "static": false, "variation": null, "name": "add", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#add", "access": null, "description": "Add an individual resource to the store. This is used internally by the\n`push()` method.", "lineNumber": 175, "since": "0.1.0", "params": [ { "nullable": false, "types": [ "Object" ], "spread": false, "optional": false, "name": "object", "description": "A JSON API Resource Object to be added. See:\n http://jsonapi.org/format/#document-resource-objects" } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "convert", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#convert", "access": null, "description": "Converts the given partial into a JSON API compliant representation.", "lineNumber": 209, "since": "0.5.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": true, "name": "type", "description": "The type of the resource. This can be omitted if the partial includes a type property." }, { "nullable": false, "types": [ "string" ], "spread": false, "optional": true, "name": "id", "description": "The id of the resource. This can be omitted if the partial includes an id property." }, { "nullable": false, "types": [ "object" ], "spread": false, "optional": false, "name": "partial", "description": "The data to convert." } ], "return": { "nullable": null, "types": [ "object" ], "spread": false, "description": "JSON API version of the object." }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "create", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#create", "access": null, "description": "Attempts to create the resource through the adapter and adds it to the\nstore if successful.", "examples": [ "let adapter = new Store.AjaxAdapter();\nlet store = new Store(adpater);\nstore.create(\"product\", { title: \"A Book\" }).subscribe((product) => {\n console.log(product.title);\n});" ], "lineNumber": 250, "since": "0.5.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of resource." }, { "nullable": false, "types": [ "Object" ], "spread": false, "optional": false, "name": "partial", "description": "Data to create the resource with." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options to pass to the adapter." } ], "return": { "nullable": null, "types": [ "Rx.Observable" ], "spread": false, "description": "" }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "define", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#define", "access": null, "description": "Defines a type of resource.", "lineNumber": 265, "since": "0.2.0", "params": [ { "nullable": false, "types": [ "string", "string[]" ], "spread": false, "optional": false, "name": "names", "description": "Name(s) of the resource." }, { "nullable": false, "types": [ "Object" ], "spread": false, "optional": false, "name": "definition", "description": "The resource's definition." } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "destroy", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#destroy", "access": null, "description": "Attempts to delete the resource through the adapter and removes it from\nthe store if successful.", "examples": [ "let adapter = new Store.AjaxAdapter();\nlet store = new Store(adpater);\nstore.destroy(\"product\", \"1\").subscribe(() => {\n console.log(\"Destroyed!\");\n});" ], "lineNumber": 298, "since": "0.5.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of resource." }, { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "id", "description": "ID of resource." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options to pass to the adapter." } ], "return": { "nullable": null, "types": [ "Rx.Observable" ], "spread": false, "description": "" }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "find", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#find", "access": null, "description": "Finds a resource by type and id.\n\nNOTE: If the resource hasn't been loaded via an add() or push() call it\nwill be automatically created when find is called.", "lineNumber": 317, "since": "0.1.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of the resource to find." }, { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "id", "description": "The id of the resource to find." } ], "return": { "nullable": null, "types": [ "Object" ], "spread": false, "description": "The resource." }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "findAll", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#findAll", "access": null, "description": "Finds all the resources of a given type.", "lineNumber": 364, "since": "0.7.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of the resource to find." } ], "return": { "nullable": null, "types": [ "Object[]" ], "spread": false, "description": "An array of resources." }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "load", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#load", "access": null, "description": "Attempts to load the given resource through the adapter and adds it to the\nstore if successful.", "examples": [ "let adapter = new Store.AjaxAdapter();\nlet store = new Store(adpater);\nstore.load(\"products\", \"1\").subscribe((product) => {\n console.log(product.title);\n});" ], "lineNumber": 398, "since": "0.5.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of resource." }, { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "id", "description": "ID of resource." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options to pass to the adapter." } ], "return": { "nullable": null, "types": [ "Rx.Observable" ], "spread": false, "description": "" }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "loadAll", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#loadAll", "access": null, "description": "Attempts to load all the resources of the given type through the adapter\nand adds them to the store if successful.", "examples": [ "let adapter = new Store.AjaxAdapter();\nlet store = new Store(adpater);\nstore.loadAll(\"products\").subscribe((products) => {\n console.log(products);\n});" ], "lineNumber": 430, "since": "0.7.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of resource." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options to pass to the adapter." } ], "return": { "nullable": null, "types": [ "Rx.Observable" ], "spread": false, "description": "" }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "off", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#off", "access": null, "description": "Unregister an event listener that was registered with on().", "lineNumber": 448, "deprecated": "Use the <code>store.observable</code> property instead of this.", "since": "0.4.0", "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "event", "description": "Name of the event." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Name of resource to originally passed to on()." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "id", "description": "ID of the resource to originally passed to on()." }, { "nullable": null, "types": [ "function" ], "spread": false, "optional": false, "name": "callback", "description": "Function originally passed to on()." } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "on", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#on", "access": null, "description": "Register an event listener: \"added\", \"updated\" or \"removed\".", "lineNumber": 482, "deprecated": "Use the <code>store.observable</code> property instead of this.", "since": "0.4.0", "params": [ { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "event", "description": "Name of the event." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Name of resource to watch." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "id", "description": "ID of the resource to watch." }, { "nullable": null, "types": [ "function" ], "spread": false, "optional": false, "name": "callback", "description": "Function to call when the event occurs." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "context", "description": "Context in which to call the callback." } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "push", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#push", "access": null, "description": "Add a JSON API response to the store. This method can be used to handle a\nsuccessful GET or POST response from the server.", "lineNumber": 525, "since": "0.1.0", "params": [ { "nullable": null, "types": [ "Object" ], "spread": false, "optional": false, "name": "root", "description": "Top Level Object to push. See:\n http://jsonapi.org/format/#document-top-level" } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "remove", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#remove", "access": null, "description": "Remove a resource or collection of resources from the store.", "lineNumber": 544, "since": "0.1.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of the resource(s) to remove." }, { "nullable": null, "types": [ "string" ], "spread": false, "optional": true, "name": "id", "description": "The id of the resource to remove. If omitted all\n resources of the type will be removed." } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "update", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#update", "access": null, "description": "Attempts to update the resource through the adapter and updates it in the\nstore if successful.", "examples": [ "let adapter = new Store.AjaxAdapter();\nlet store = new Store(adpater);\nstore.update(\"product\", \"1\", { title: \"foo\" }).subscribe((product) => {\n console.log(product.title);\n});" ], "lineNumber": 587, "since": "0.5.0", "params": [ { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "type", "description": "Type of resource." }, { "nullable": false, "types": [ "string" ], "spread": false, "optional": false, "name": "id", "description": "ID of resource." }, { "nullable": false, "types": [ "Object" ], "spread": false, "optional": false, "name": "partial", "description": "Data to update the resource with." }, { "nullable": null, "types": [ "Object" ], "spread": false, "optional": true, "name": "options", "description": "Options to pass to the adapter." } ], "return": { "nullable": null, "types": [ "Rx.Observable" ], "spread": false, "description": "" }, "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_addField", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_addField", "access": null, "description": null, "lineNumber": 595, "undocument": true, "params": [ { "name": "object", "types": [ "*" ] }, { "name": "resource", "types": [ "*" ] }, { "name": "definition", "types": [ "*" ] }, { "name": "fieldName", "types": [ "*" ] } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_addInverseRelationship", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_addInverseRelationship", "access": null, "description": null, "lineNumber": 620, "undocument": true, "params": [ { "name": "sourceResource", "types": [ "*" ] }, { "name": "sourceFieldName", "types": [ "*" ] }, { "name": "targetResource", "types": [ "*" ] }, { "name": "sourceField", "types": [ "*" ] } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_remove", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_remove", "access": null, "description": null, "lineNumber": 645, "undocument": true, "params": [ { "name": "resource", "types": [ "*" ] } ], "generator": false }, { "kind": "method", "static": false, "variation": null, "name": "_removeInverseRelationship", "memberof": "src/store.js~Store", "longname": "src/store.js~Store#_removeInverseRelationship", "access": null, "description": null, "lineNumber": 672, "undocument": true, "params": [ { "name": "sourceResource", "types": [ "*" ] }, { "name": "sourceFieldName", "types": [ "*" ] }, { "name": "targetResource", "types": [ "*" ] }, { "name": "sourceField", "types": [ "*" ] } ], "generator": false }, { "kind": "external", "static": true, "variation": null, "name": "Infinity", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Infinity", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "NaN", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~NaN", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "undefined", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~undefined", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "null", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~null", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Object", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "object", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~object", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Function", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "function", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~function", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Boolean", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "boolean", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~boolean", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Symbol", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Symbol", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Error", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Error", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "EvalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~EvalError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "InternalError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~InternalError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "RangeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~RangeError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "ReferenceError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~ReferenceError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "SyntaxError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~SyntaxError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "TypeError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~TypeError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "URIError", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~URIError", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Number", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "number", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~number", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Date", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Date", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "String", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~String", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "string", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~string", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "RegExp", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~RegExp", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Int8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Int8Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Uint8Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint8Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Uint8ClampedArray", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint8ClampedArray", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Int16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Int16Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Uint16Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint16Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Int32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Int32Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Uint32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint32Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Float32Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Float32Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Float64Array", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Float64Array", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Map", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Map", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Set", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Set", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "WeakMap", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~WeakMap", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "WeakSet", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~WeakSet", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "ArrayBuffer", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~ArrayBuffer", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "DataView", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~DataView", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "JSON", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~JSON", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Promise", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Promise", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Generator", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Generator", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "GeneratorFunction", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~GeneratorFunction", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Reflect", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Reflect", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Proxy", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy", "memberof": "BuiltinExternal/ECMAScriptExternal.js", "longname": "BuiltinExternal/ECMAScriptExternal.js~Proxy", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "CanvasRenderingContext2D", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~CanvasRenderingContext2D", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "DocumentFragment", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~DocumentFragment", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Element", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Element", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~Element", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Event", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Event", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~Event", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "Node", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Node", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~Node", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "NodeList", "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/NodeList", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~NodeList", "access": null, "description": null, "builtinExternal": true }, { "kind": "external", "static": true, "variation": null, "name": "XMLHttpRequest", "externalLink": "https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest", "memberof": "BuiltinExternal/WebAPIExternal.js", "longname": "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest", "access": null, "description": null, "builtinExternal": true }]