From 46f77e313193af30c6b4884ef476592383766984 Mon Sep 17 00:00:00 2001 From: Haydn Ewers Date: Wed, 23 Sep 2015 09:48:03 +0930 Subject: [PATCH] Release v0.5.1. --- dist/ajax-adapter.js | 209 + .../ast/source/src/ajax-adapter.js.json | 15157 ++++++ docs/v0.5.1/ast/source/src/store.js.json | 43100 ++++++++++++++++ docs/v0.5.1/badge.svg | 17 + .../src/ajax-adapter.js~AjaxAdapter.html | 668 + docs/v0.5.1/class/src/store.js~Store.html | 1945 + docs/v0.5.1/coverage.json | 15 + docs/v0.5.1/css/prettify-tomorrow.css | 132 + docs/v0.5.1/css/style.css | 818 + docs/v0.5.1/dump.json | 2073 + docs/v0.5.1/file/src/ajax-adapter.js.html | 254 + docs/v0.5.1/file/src/store.js.html | 656 + docs/v0.5.1/identifiers.html | 126 + docs/v0.5.1/image/badge.svg | 17 + docs/v0.5.1/image/github.png | Bin 0 -> 4268 bytes docs/v0.5.1/image/search.png | Bin 0 -> 12704 bytes docs/v0.5.1/index.html | 159 + docs/v0.5.1/package.json | 33 + docs/v0.5.1/script/inherited-summary.js | 28 + docs/v0.5.1/script/inner-link.js | 18 + docs/v0.5.1/script/patch-for-local.js | 8 + .../script/prettify/Apache-License-2.0.txt | 202 + docs/v0.5.1/script/prettify/prettify.js | 28 + docs/v0.5.1/script/pretty-print.js | 12 + docs/v0.5.1/script/search.js | 117 + docs/v0.5.1/script/search_index.js | 476 + docs/v0.5.1/script/test-summary.js | 54 + docs/v0.5.1/source.html | 97 + index.html | 6 +- releases/v0.5.1/ajax-adapter.js | 209 + releases/v0.5.1/store.dev.js | 968 + releases/v0.5.1/store.dev.js.map | 19 + releases/v0.5.1/store.js | 717 + releases/v0.5.1/store.prod.js | 43 + 34 files changed, 68378 insertions(+), 3 deletions(-) create mode 100644 dist/ajax-adapter.js create mode 100644 docs/v0.5.1/ast/source/src/ajax-adapter.js.json create mode 100644 docs/v0.5.1/ast/source/src/store.js.json create mode 100644 docs/v0.5.1/badge.svg create mode 100644 docs/v0.5.1/class/src/ajax-adapter.js~AjaxAdapter.html create mode 100644 docs/v0.5.1/class/src/store.js~Store.html create mode 100644 docs/v0.5.1/coverage.json create mode 100644 docs/v0.5.1/css/prettify-tomorrow.css create mode 100644 docs/v0.5.1/css/style.css create mode 100644 docs/v0.5.1/dump.json create mode 100644 docs/v0.5.1/file/src/ajax-adapter.js.html create mode 100644 docs/v0.5.1/file/src/store.js.html create mode 100644 docs/v0.5.1/identifiers.html create mode 100644 docs/v0.5.1/image/badge.svg create mode 100644 docs/v0.5.1/image/github.png create mode 100644 docs/v0.5.1/image/search.png create mode 100644 docs/v0.5.1/index.html create mode 100644 docs/v0.5.1/package.json create mode 100644 docs/v0.5.1/script/inherited-summary.js create mode 100644 docs/v0.5.1/script/inner-link.js create mode 100644 docs/v0.5.1/script/patch-for-local.js create mode 100644 docs/v0.5.1/script/prettify/Apache-License-2.0.txt create mode 100644 docs/v0.5.1/script/prettify/prettify.js create mode 100644 docs/v0.5.1/script/pretty-print.js create mode 100644 docs/v0.5.1/script/search.js create mode 100644 docs/v0.5.1/script/search_index.js create mode 100644 docs/v0.5.1/script/test-summary.js create mode 100644 docs/v0.5.1/source.html create mode 100644 releases/v0.5.1/ajax-adapter.js create mode 100644 releases/v0.5.1/store.dev.js create mode 100644 releases/v0.5.1/store.dev.js.map create mode 100644 releases/v0.5.1/store.js create mode 100644 releases/v0.5.1/store.prod.js diff --git a/dist/ajax-adapter.js b/dist/ajax-adapter.js new file mode 100644 index 0000000..67ff286 --- /dev/null +++ b/dist/ajax-adapter.js @@ -0,0 +1,209 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var AjaxAdapter = (function () { + function AjaxAdapter(options) { + _classCallCheck(this, AjaxAdapter); + + this._base = options && options.base || ""; + } + + _createClass(AjaxAdapter, [{ + key: 'create', + value: function create(store, type, partial, success, error, context) { + var _this = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.create(store, type, partial, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + + request.open('POST', _this._base + '/' + type, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + var response = JSON.parse(request.responseText); + try { + store.push(response); + if (success) { + success.call(context, store.find(response.data.type, response.data.id)); + } + } catch (e) { + if (error) { + error.call(context, e); + } + } + } else { + if (error) { + error.call(context); + } + } + }; + + request.send({ + data: JSON.stringify(store.convert(type, partial)) + }); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'destroy', + value: function destroy(store, type, id, success, error, context) { + var _this2 = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.destroy(store, type, id, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + + request.open('DELETE', _this2._base + '/' + type + '/' + id, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.remove(type, id); + if (success) { + success.call(context); + } + } catch (e) { + error.call(context, e); + } + } else if (error) { + error.call(context); + } + }; + + request.send(); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'load', + value: function load(store, type, id, options, success, error, context) { + var _this3 = this; + + if (id && ({}).toString.call(id) === '[object Function]') { + this.load(store, type, null, null, id, options, success); + } else if (id && typeof id === "object") { + this.load(store, type, null, id, options, success, error); + } else if (options && ({}).toString.call(options) === '[object Function]') { + this.load(store, type, id, {}, options, success, error); + } else if (error && ({}).toString.call(error) !== '[object Function]') { + this.load(store, type, id, options, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + var url = undefined; + + options = options || {}; + url = id ? _this3._base + '/' + type + '/' + id : _this3._base + '/' + type; + + if (options) { + + var params = []; + + if (options.fields) { + Object.keys(options.fields).forEach(function (field) { + options['fields[' + field + ']'] = options.fields[field]; + }); + delete options.fields; + } + + params = Object.keys(options).map(function (key) { + return key + "=" + encodeURIComponent(options[key]); + }).sort(); + + if (params.length) { + url = url + '?' + params.join("&"); + } + } + + request.open('GET', url, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.push(JSON.parse(request.responseText)); + if (success) { + success.call(context, id ? store.find(type, id) : store.find(type)); + } + } catch (e) { + error.call({}, e); + } + } else if (error) { + error.call(context); + } + }; + + request.send(); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'update', + value: function update(store, type, id, partial, success, error, context) { + var _this4 = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.update(store, type, id, partial, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + var data = store.convert(type, id, partial); + + request.open('PATCH', _this4._base + '/' + type + '/' + id, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.add(data); + if (success) { + success.call(context, store.find(data.type, data.id)); + } + } catch (e) { + if (error) { + error.call(context, e); + } + } + } else if (error) { + error.call(context); + } + }; + + request.send({ + data: JSON.stringify(data) + }); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }]); + + return AjaxAdapter; +})(); + +exports['default'] = AjaxAdapter; +module.exports = exports['default']; diff --git a/docs/v0.5.1/ast/source/src/ajax-adapter.js.json b/docs/v0.5.1/ast/source/src/ajax-adapter.js.json new file mode 100644 index 0000000..d65a7fe --- /dev/null +++ b/docs/v0.5.1/ast/source/src/ajax-adapter.js.json @@ -0,0 +1,15157 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "AjaxAdapter", + "range": [ + 21, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 38, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "options", + "range": [ + 50, + 57 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 65, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "_base", + "range": [ + 70, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "range": [ + 65, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 79, + 86 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 90, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "base", + "range": [ + 98, + 102 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 41 + } + } + }, + "range": [ + 90, + 102 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 41 + } + } + }, + "range": [ + 79, + 102 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 41 + } + } + }, + "right": { + "type": "Literal", + "value": "", + "raw": "\"\"", + "range": [ + 107, + 109 + ], + "loc": { + "start": { + "line": 4, + "column": 46 + }, + "end": { + "line": 4, + "column": 48 + } + } + }, + "range": [ + 78, + 109 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 48 + } + } + }, + "range": [ + 65, + 109 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 48 + } + } + }, + "range": [ + 65, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 49 + } + } + } + ], + "range": [ + 59, + 114 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 49, + 114 + ], + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 5, + "column": 3 + } + } + }, + "kind": "constructor", + "computed": false, + "range": [ + 38, + 114 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "create", + "range": [ + 119, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 126, + 131 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 133, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 139, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 22 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 148, + 155 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 38 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 157, + 162 + ], + "loc": { + "start": { + "line": 7, + "column": 40 + }, + "end": { + "line": 7, + "column": 45 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 164, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 47 + }, + "end": { + "line": 7, + "column": 54 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 184, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 193, + 195 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 196, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "range": [ + 193, + 204 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 9, + "column": 29 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + "range": [ + 193, + 209 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 210, + 215 + ], + "loc": { + "start": { + "line": 9, + "column": 34 + }, + "end": { + "line": 9, + "column": 39 + } + } + } + ], + "range": [ + 193, + 216 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 221, + 240 + ], + "loc": { + "start": { + "line": 9, + "column": 45 + }, + "end": { + "line": 9, + "column": 64 + } + } + }, + "range": [ + 193, + 240 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 64 + } + } + }, + "range": [ + 184, + 240 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 64 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 251, + 255 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "create", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "range": [ + 251, + 262 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 270, + 274 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 276, + 283 + ], + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 38 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 285, + 292 + ], + "loc": { + "start": { + "line": 11, + "column": 40 + }, + "end": { + "line": 11, + "column": 47 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 294, + 298 + ], + "loc": { + "start": { + "line": 11, + "column": 49 + }, + "end": { + "line": 11, + "column": 53 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 300, + 305 + ], + "loc": { + "start": { + "line": 11, + "column": 55 + }, + "end": { + "line": 11, + "column": 60 + } + } + } + ], + "range": [ + 251, + 306 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 61 + } + } + }, + "range": [ + 251, + 307 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 62 + } + } + } + ], + "range": [ + 242, + 314 + ], + "loc": { + "start": { + "line": 9, + "column": 66 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 324, + 329 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 330, + 336 + ], + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "range": [ + 324, + 336 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 337, + 341 + ], + "loc": { + "start": { + "line": 13, + "column": 28 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + "range": [ + 324, + 342 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 33 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "request", + "range": [ + 357, + 364 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "init": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "XMLHttpRequest", + "range": [ + 371, + 385 + ], + "loc": { + "start": { + "line": 15, + "column": 24 + }, + "end": { + "line": 15, + "column": 38 + } + } + }, + "arguments": [], + "range": [ + 367, + 387 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 40 + } + } + }, + "range": [ + 357, + 387 + ], + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 40 + } + } + } + ], + "kind": "let", + "range": [ + 353, + 388 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 41 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 396, + 403 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "open", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + "range": [ + 396, + 408 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "POST", + "raw": "'POST'", + "range": [ + 409, + 415 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 417, + 420 + ], + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 30 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 430, + 434 + ], + "loc": { + "start": { + "line": 17, + "column": 40 + }, + "end": { + "line": 17, + "column": 44 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 438, + 440 + ], + "loc": { + "start": { + "line": 17, + "column": 48 + }, + "end": { + "line": 17, + "column": 50 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 420, + 424 + ], + "loc": { + "start": { + "line": 17, + "column": 30 + }, + "end": { + "line": 17, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "_base", + "range": [ + 425, + 430 + ], + "loc": { + "start": { + "line": 17, + "column": 35 + }, + "end": { + "line": 17, + "column": 40 + } + } + }, + "range": [ + 420, + 430 + ], + "loc": { + "start": { + "line": 17, + "column": 30 + }, + "end": { + "line": 17, + "column": 40 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 434, + 438 + ], + "loc": { + "start": { + "line": 17, + "column": 44 + }, + "end": { + "line": 17, + "column": 48 + } + } + } + ], + "range": [ + 417, + 440 + ], + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 50 + } + } + }, + { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 442, + 446 + ], + "loc": { + "start": { + "line": 17, + "column": 52 + }, + "end": { + "line": 17, + "column": 56 + } + } + } + ], + "range": [ + 396, + 447 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 57 + } + } + }, + "range": [ + 396, + 448 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 58 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 456, + 463 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "onload", + "range": [ + 464, + 470 + ], + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + "range": [ + 456, + 470 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 499, + 506 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 507, + 513 + ], + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + "range": [ + 499, + 513 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + "right": { + "type": "Literal", + "value": 200, + "raw": "200", + "range": [ + 517, + 520 + ], + "loc": { + "start": { + "line": 20, + "column": 30 + }, + "end": { + "line": 20, + "column": 33 + } + } + }, + "range": [ + 499, + 520 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 33 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 524, + 531 + ], + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 532, + 538 + ], + "loc": { + "start": { + "line": 20, + "column": 45 + }, + "end": { + "line": 20, + "column": 51 + } + } + }, + "range": [ + 524, + 538 + ], + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 51 + } + } + }, + "right": { + "type": "Literal", + "value": 300, + "raw": "300", + "range": [ + 541, + 544 + ], + "loc": { + "start": { + "line": 20, + "column": 54 + }, + "end": { + "line": 20, + "column": 57 + } + } + }, + "range": [ + 524, + 544 + ], + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 57 + } + } + }, + "range": [ + 499, + 544 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 57 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "response", + "range": [ + 562, + 570 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 22 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "JSON", + "range": [ + 573, + 577 + ], + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "parse", + "range": [ + 578, + 583 + ], + "loc": { + "start": { + "line": 21, + "column": 30 + }, + "end": { + "line": 21, + "column": 35 + } + } + }, + "range": [ + 573, + 583 + ], + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 35 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 584, + 591 + ], + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 43 + } + } + }, + "property": { + "type": "Identifier", + "name": "responseText", + "range": [ + 592, + 604 + ], + "loc": { + "start": { + "line": 21, + "column": 44 + }, + "end": { + "line": 21, + "column": 56 + } + } + }, + "range": [ + 584, + 604 + ], + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 56 + } + } + } + ], + "range": [ + 573, + 605 + ], + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 57 + } + } + }, + "range": [ + 562, + 605 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 57 + } + } + } + ], + "kind": "let", + "range": [ + 558, + 606 + ], + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 58 + } + } + }, + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 635, + 640 + ], + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 641, + 645 + ], + "loc": { + "start": { + "line": 23, + "column": 18 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + "range": [ + 635, + 645 + ], + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "response", + "range": [ + 646, + 654 + ], + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 31 + } + } + } + ], + "range": [ + 635, + 655 + ], + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 32 + } + } + }, + "range": [ + 635, + 656 + ], + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 33 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "success", + "range": [ + 673, + 680 + ], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 23 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "success", + "range": [ + 698, + 705 + ], + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 706, + 710 + ], + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "range": [ + 698, + 710 + ], + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 711, + 718 + ], + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 34 + } + } + }, + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 720, + 725 + ], + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 726, + 730 + ], + "loc": { + "start": { + "line": 25, + "column": 42 + }, + "end": { + "line": 25, + "column": 46 + } + } + }, + "range": [ + 720, + 730 + ], + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 46 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "response", + "range": [ + 731, + 739 + ], + "loc": { + "start": { + "line": 25, + "column": 47 + }, + "end": { + "line": 25, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 740, + 744 + ], + "loc": { + "start": { + "line": 25, + "column": 56 + }, + "end": { + "line": 25, + "column": 60 + } + } + }, + "range": [ + 731, + 744 + ], + "loc": { + "start": { + "line": 25, + "column": 47 + }, + "end": { + "line": 25, + "column": 60 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 745, + 749 + ], + "loc": { + "start": { + "line": 25, + "column": 61 + }, + "end": { + "line": 25, + "column": 65 + } + } + }, + "range": [ + 731, + 749 + ], + "loc": { + "start": { + "line": 25, + "column": 47 + }, + "end": { + "line": 25, + "column": 65 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "response", + "range": [ + 751, + 759 + ], + "loc": { + "start": { + "line": 25, + "column": 67 + }, + "end": { + "line": 25, + "column": 75 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 760, + 764 + ], + "loc": { + "start": { + "line": 25, + "column": 76 + }, + "end": { + "line": 25, + "column": 80 + } + } + }, + "range": [ + 751, + 764 + ], + "loc": { + "start": { + "line": 25, + "column": 67 + }, + "end": { + "line": 25, + "column": 80 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 765, + 767 + ], + "loc": { + "start": { + "line": 25, + "column": 81 + }, + "end": { + "line": 25, + "column": 83 + } + } + }, + "range": [ + 751, + 767 + ], + "loc": { + "start": { + "line": 25, + "column": 67 + }, + "end": { + "line": 25, + "column": 83 + } + } + } + ], + "range": [ + 720, + 768 + ], + "loc": { + "start": { + "line": 25, + "column": 36 + }, + "end": { + "line": 25, + "column": 84 + } + } + } + ], + "range": [ + 698, + 769 + ], + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 85 + } + } + }, + "range": [ + 698, + 770 + ], + "loc": { + "start": { + "line": 25, + "column": 14 + }, + "end": { + "line": 25, + "column": 86 + } + } + } + ], + "range": [ + 682, + 784 + ], + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 669, + 784 + ], + "loc": { + "start": { + "line": 24, + "column": 12 + }, + "end": { + "line": 26, + "column": 13 + } + } + } + ], + "range": [ + 621, + 796 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 27, + "column": 11 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 804, + 805 + ], + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "error", + "range": [ + 825, + 830 + ], + "loc": { + "start": { + "line": 28, + "column": 16 + }, + "end": { + "line": 28, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 848, + 853 + ], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 854, + 858 + ], + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + "range": [ + 848, + 858 + ], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 859, + 866 + ], + "loc": { + "start": { + "line": 29, + "column": 25 + }, + "end": { + "line": 29, + "column": 32 + } + } + }, + { + "type": "Identifier", + "name": "e", + "range": [ + 868, + 869 + ], + "loc": { + "start": { + "line": 29, + "column": 34 + }, + "end": { + "line": 29, + "column": 35 + } + } + } + ], + "range": [ + 848, + 870 + ], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 36 + } + } + }, + "range": [ + 848, + 871 + ], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 37 + } + } + } + ], + "range": [ + 832, + 885 + ], + "loc": { + "start": { + "line": 28, + "column": 23 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 821, + 885 + ], + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + } + ], + "range": [ + 807, + 897 + ], + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 31, + "column": 11 + } + } + }, + "range": [ + 797, + 897 + ], + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 31, + "column": 11 + } + } + }, + "finalizer": null, + "range": [ + 617, + 897 + ], + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } + } + } + ], + "range": [ + 546, + 907 + ], + "loc": { + "start": { + "line": 20, + "column": 59 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "error", + "range": [ + 929, + 934 + ], + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 19 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 950, + 955 + ], + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 956, + 960 + ], + "loc": { + "start": { + "line": 34, + "column": 18 + }, + "end": { + "line": 34, + "column": 22 + } + } + }, + "range": [ + 950, + 960 + ], + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 961, + 968 + ], + "loc": { + "start": { + "line": 34, + "column": 23 + }, + "end": { + "line": 34, + "column": 30 + } + } + } + ], + "range": [ + 950, + 969 + ], + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 31 + } + } + }, + "range": [ + 950, + 970 + ], + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 32 + } + } + } + ], + "range": [ + 936, + 982 + ], + "loc": { + "start": { + "line": 33, + "column": 21 + }, + "end": { + "line": 35, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 925, + 982 + ], + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 35, + "column": 11 + } + } + } + ], + "range": [ + 913, + 992 + ], + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 36, + "column": 9 + } + } + }, + "range": [ + 495, + 992 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 36, + "column": 9 + } + } + } + ], + "range": [ + 485, + 1000 + ], + "loc": { + "start": { + "line": 19, + "column": 35 + }, + "end": { + "line": 37, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 473, + 1000 + ], + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 37, + "column": 7 + } + } + }, + "range": [ + 456, + 1000 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 37, + "column": 7 + } + } + }, + "range": [ + 456, + 1001 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 37, + "column": 8 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 1009, + 1016 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "send", + "range": [ + 1017, + 1021 + ], + "loc": { + "start": { + "line": 39, + "column": 14 + }, + "end": { + "line": 39, + "column": 18 + } + } + }, + "range": [ + 1009, + 1021 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 1032, + 1036 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 12 + } + } + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "JSON", + "range": [ + 1038, + 1042 + ], + "loc": { + "start": { + "line": 40, + "column": 14 + }, + "end": { + "line": 40, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "stringify", + "range": [ + 1043, + 1052 + ], + "loc": { + "start": { + "line": 40, + "column": 19 + }, + "end": { + "line": 40, + "column": 28 + } + } + }, + "range": [ + 1038, + 1052 + ], + "loc": { + "start": { + "line": 40, + "column": 14 + }, + "end": { + "line": 40, + "column": 28 + } + } + }, + "arguments": [ + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 1053, + 1058 + ], + "loc": { + "start": { + "line": 40, + "column": 29 + }, + "end": { + "line": 40, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "convert", + "range": [ + 1059, + 1066 + ], + "loc": { + "start": { + "line": 40, + "column": 35 + }, + "end": { + "line": 40, + "column": 42 + } + } + }, + "range": [ + 1053, + 1066 + ], + "loc": { + "start": { + "line": 40, + "column": 29 + }, + "end": { + "line": 40, + "column": 42 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 1067, + 1071 + ], + "loc": { + "start": { + "line": 40, + "column": 43 + }, + "end": { + "line": 40, + "column": 47 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 1073, + 1080 + ], + "loc": { + "start": { + "line": 40, + "column": 49 + }, + "end": { + "line": 40, + "column": 56 + } + } + } + ], + "range": [ + 1053, + 1081 + ], + "loc": { + "start": { + "line": 40, + "column": 29 + }, + "end": { + "line": 40, + "column": 57 + } + } + } + ], + "range": [ + 1038, + 1082 + ], + "loc": { + "start": { + "line": 40, + "column": 14 + }, + "end": { + "line": 40, + "column": 58 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 1032, + 1082 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 58 + } + } + } + ], + "range": [ + 1022, + 1090 + ], + "loc": { + "start": { + "line": 39, + "column": 19 + }, + "end": { + "line": 41, + "column": 7 + } + } + } + ], + "range": [ + 1009, + 1091 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 41, + "column": 8 + } + } + }, + "range": [ + 1009, + 1092 + ], + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 41, + "column": 9 + } + } + } + ], + "range": [ + 344, + 1099 + ], + "loc": { + "start": { + "line": 13, + "column": 35 + }, + "end": { + "line": 43, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 1123, + 1128 + ], + "loc": { + "start": { + "line": 44, + "column": 16 + }, + "end": { + "line": 44, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 1129, + 1146 + ], + "loc": { + "start": { + "line": 44, + "column": 22 + }, + "end": { + "line": 44, + "column": 39 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 1150, + 1153 + ], + "loc": { + "start": { + "line": 44, + "column": 43 + }, + "end": { + "line": 44, + "column": 46 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 1146, + 1150 + ], + "loc": { + "start": { + "line": 44, + "column": 39 + }, + "end": { + "line": 44, + "column": 43 + } + } + } + ], + "range": [ + 1129, + 1153 + ], + "loc": { + "start": { + "line": 44, + "column": 22 + }, + "end": { + "line": 44, + "column": 46 + } + } + } + ], + "range": [ + 1119, + 1154 + ], + "loc": { + "start": { + "line": 44, + "column": 12 + }, + "end": { + "line": 44, + "column": 47 + } + } + }, + "range": [ + 1113, + 1155 + ], + "loc": { + "start": { + "line": 44, + "column": 6 + }, + "end": { + "line": 44, + "column": 48 + } + } + } + ], + "range": [ + 1105, + 1161 + ], + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 45, + "column": 5 + } + } + }, + "range": [ + 320, + 1161 + ], + "loc": { + "start": { + "line": 13, + "column": 11 + }, + "end": { + "line": 45, + "column": 5 + } + } + }, + "range": [ + 180, + 1161 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 45, + "column": 5 + } + } + } + ], + "range": [ + 173, + 1166 + ], + "loc": { + "start": { + "line": 7, + "column": 56 + }, + "end": { + "line": 47, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 125, + 1166 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 47, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 119, + 1166 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 47, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "destroy", + "range": [ + 1170, + 1177 + ], + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 9 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 1178, + 1183 + ], + "loc": { + "start": { + "line": 49, + "column": 10 + }, + "end": { + "line": 49, + "column": 15 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 1185, + 1189 + ], + "loc": { + "start": { + "line": 49, + "column": 17 + }, + "end": { + "line": 49, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 1191, + 1193 + ], + "loc": { + "start": { + "line": 49, + "column": 23 + }, + "end": { + "line": 49, + "column": 25 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 1195, + 1202 + ], + "loc": { + "start": { + "line": 49, + "column": 27 + }, + "end": { + "line": 49, + "column": 34 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 1204, + 1209 + ], + "loc": { + "start": { + "line": 49, + "column": 36 + }, + "end": { + "line": 49, + "column": 41 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 1211, + 1218 + ], + "loc": { + "start": { + "line": 49, + "column": 43 + }, + "end": { + "line": 49, + "column": 50 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 1231, + 1236 + ], + "loc": { + "start": { + "line": 51, + "column": 8 + }, + "end": { + "line": 51, + "column": 13 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 1240, + 1242 + ], + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 1243, + 1251 + ], + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 28 + } + } + }, + "range": [ + 1240, + 1251 + ], + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 1252, + 1256 + ], + "loc": { + "start": { + "line": 51, + "column": 29 + }, + "end": { + "line": 51, + "column": 33 + } + } + }, + "range": [ + 1240, + 1256 + ], + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 1257, + 1262 + ], + "loc": { + "start": { + "line": 51, + "column": 34 + }, + "end": { + "line": 51, + "column": 39 + } + } + } + ], + "range": [ + 1240, + 1263 + ], + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 40 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 1268, + 1287 + ], + "loc": { + "start": { + "line": 51, + "column": 45 + }, + "end": { + "line": 51, + "column": 64 + } + } + }, + "range": [ + 1240, + 1287 + ], + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 64 + } + } + }, + "range": [ + 1231, + 1287 + ], + "loc": { + "start": { + "line": 51, + "column": 8 + }, + "end": { + "line": 51, + "column": 64 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1298, + 1302 + ], + "loc": { + "start": { + "line": 53, + "column": 6 + }, + "end": { + "line": 53, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "destroy", + "range": [ + 1303, + 1310 + ], + "loc": { + "start": { + "line": 53, + "column": 11 + }, + "end": { + "line": 53, + "column": 18 + } + } + }, + "range": [ + 1298, + 1310 + ], + "loc": { + "start": { + "line": 53, + "column": 6 + }, + "end": { + "line": 53, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 1311, + 1316 + ], + "loc": { + "start": { + "line": 53, + "column": 19 + }, + "end": { + "line": 53, + "column": 24 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 1318, + 1322 + ], + "loc": { + "start": { + "line": 53, + "column": 26 + }, + "end": { + "line": 53, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 1324, + 1326 + ], + "loc": { + "start": { + "line": 53, + "column": 32 + }, + "end": { + "line": 53, + "column": 34 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 1328, + 1335 + ], + "loc": { + "start": { + "line": 53, + "column": 36 + }, + "end": { + "line": 53, + "column": 43 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1337, + 1341 + ], + "loc": { + "start": { + "line": 53, + "column": 45 + }, + "end": { + "line": 53, + "column": 49 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 1343, + 1348 + ], + "loc": { + "start": { + "line": 53, + "column": 51 + }, + "end": { + "line": 53, + "column": 56 + } + } + } + ], + "range": [ + 1298, + 1349 + ], + "loc": { + "start": { + "line": 53, + "column": 6 + }, + "end": { + "line": 53, + "column": 57 + } + } + }, + "range": [ + 1298, + 1350 + ], + "loc": { + "start": { + "line": 53, + "column": 6 + }, + "end": { + "line": 53, + "column": 58 + } + } + } + ], + "range": [ + 1289, + 1357 + ], + "loc": { + "start": { + "line": 51, + "column": 66 + }, + "end": { + "line": 55, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 1367, + 1372 + ], + "loc": { + "start": { + "line": 55, + "column": 15 + }, + "end": { + "line": 55, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 1373, + 1379 + ], + "loc": { + "start": { + "line": 55, + "column": 21 + }, + "end": { + "line": 55, + "column": 27 + } + } + }, + "range": [ + 1367, + 1379 + ], + "loc": { + "start": { + "line": 55, + "column": 15 + }, + "end": { + "line": 55, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 1380, + 1384 + ], + "loc": { + "start": { + "line": 55, + "column": 28 + }, + "end": { + "line": 55, + "column": 32 + } + } + }, + "range": [ + 1367, + 1385 + ], + "loc": { + "start": { + "line": 55, + "column": 15 + }, + "end": { + "line": 55, + "column": 33 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "request", + "range": [ + 1400, + 1407 + ], + "loc": { + "start": { + "line": 57, + "column": 10 + }, + "end": { + "line": 57, + "column": 17 + } + } + }, + "init": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "XMLHttpRequest", + "range": [ + 1414, + 1428 + ], + "loc": { + "start": { + "line": 57, + "column": 24 + }, + "end": { + "line": 57, + "column": 38 + } + } + }, + "arguments": [], + "range": [ + 1410, + 1430 + ], + "loc": { + "start": { + "line": 57, + "column": 20 + }, + "end": { + "line": 57, + "column": 40 + } + } + }, + "range": [ + 1400, + 1430 + ], + "loc": { + "start": { + "line": 57, + "column": 10 + }, + "end": { + "line": 57, + "column": 40 + } + } + } + ], + "kind": "let", + "range": [ + 1396, + 1431 + ], + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 41 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 1439, + 1446 + ], + "loc": { + "start": { + "line": 59, + "column": 6 + }, + "end": { + "line": 59, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "open", + "range": [ + 1447, + 1451 + ], + "loc": { + "start": { + "line": 59, + "column": 14 + }, + "end": { + "line": 59, + "column": 18 + } + } + }, + "range": [ + 1439, + 1451 + ], + "loc": { + "start": { + "line": 59, + "column": 6 + }, + "end": { + "line": 59, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "DELETE", + "raw": "'DELETE'", + "range": [ + 1452, + 1460 + ], + "loc": { + "start": { + "line": 59, + "column": 19 + }, + "end": { + "line": 59, + "column": 27 + } + } + }, + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 1462, + 1465 + ], + "loc": { + "start": { + "line": 59, + "column": 29 + }, + "end": { + "line": 59, + "column": 32 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 1475, + 1479 + ], + "loc": { + "start": { + "line": 59, + "column": 42 + }, + "end": { + "line": 59, + "column": 46 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 1483, + 1487 + ], + "loc": { + "start": { + "line": 59, + "column": 50 + }, + "end": { + "line": 59, + "column": 54 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 1489, + 1491 + ], + "loc": { + "start": { + "line": 59, + "column": 56 + }, + "end": { + "line": 59, + "column": 58 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1465, + 1469 + ], + "loc": { + "start": { + "line": 59, + "column": 32 + }, + "end": { + "line": 59, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "_base", + "range": [ + 1470, + 1475 + ], + "loc": { + "start": { + "line": 59, + "column": 37 + }, + "end": { + "line": 59, + "column": 42 + } + } + }, + "range": [ + 1465, + 1475 + ], + "loc": { + "start": { + "line": 59, + "column": 32 + }, + "end": { + "line": 59, + "column": 42 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 1479, + 1483 + ], + "loc": { + "start": { + "line": 59, + "column": 46 + }, + "end": { + "line": 59, + "column": 50 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 1487, + 1489 + ], + "loc": { + "start": { + "line": 59, + "column": 54 + }, + "end": { + "line": 59, + "column": 56 + } + } + } + ], + "range": [ + 1462, + 1491 + ], + "loc": { + "start": { + "line": 59, + "column": 29 + }, + "end": { + "line": 59, + "column": 58 + } + } + }, + { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 1493, + 1497 + ], + "loc": { + "start": { + "line": 59, + "column": 60 + }, + "end": { + "line": 59, + "column": 64 + } + } + } + ], + "range": [ + 1439, + 1498 + ], + "loc": { + "start": { + "line": 59, + "column": 6 + }, + "end": { + "line": 59, + "column": 65 + } + } + }, + "range": [ + 1439, + 1499 + ], + "loc": { + "start": { + "line": 59, + "column": 6 + }, + "end": { + "line": 59, + "column": 66 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 1507, + 1514 + ], + "loc": { + "start": { + "line": 61, + "column": 6 + }, + "end": { + "line": 61, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "onload", + "range": [ + 1515, + 1521 + ], + "loc": { + "start": { + "line": 61, + "column": 14 + }, + "end": { + "line": 61, + "column": 20 + } + } + }, + "range": [ + 1507, + 1521 + ], + "loc": { + "start": { + "line": 61, + "column": 6 + }, + "end": { + "line": 61, + "column": 20 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 1550, + 1557 + ], + "loc": { + "start": { + "line": 62, + "column": 12 + }, + "end": { + "line": 62, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 1558, + 1564 + ], + "loc": { + "start": { + "line": 62, + "column": 20 + }, + "end": { + "line": 62, + "column": 26 + } + } + }, + "range": [ + 1550, + 1564 + ], + "loc": { + "start": { + "line": 62, + "column": 12 + }, + "end": { + "line": 62, + "column": 26 + } + } + }, + "right": { + "type": "Literal", + "value": 200, + "raw": "200", + "range": [ + 1568, + 1571 + ], + "loc": { + "start": { + "line": 62, + "column": 30 + }, + "end": { + "line": 62, + "column": 33 + } + } + }, + "range": [ + 1550, + 1571 + ], + "loc": { + "start": { + "line": 62, + "column": 12 + }, + "end": { + "line": 62, + "column": 33 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 1575, + 1582 + ], + "loc": { + "start": { + "line": 62, + "column": 37 + }, + "end": { + "line": 62, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 1583, + 1589 + ], + "loc": { + "start": { + "line": 62, + "column": 45 + }, + "end": { + "line": 62, + "column": 51 + } + } + }, + "range": [ + 1575, + 1589 + ], + "loc": { + "start": { + "line": 62, + "column": 37 + }, + "end": { + "line": 62, + "column": 51 + } + } + }, + "right": { + "type": "Literal", + "value": 300, + "raw": "300", + "range": [ + 1592, + 1595 + ], + "loc": { + "start": { + "line": 62, + "column": 54 + }, + "end": { + "line": 62, + "column": 57 + } + } + }, + "range": [ + 1575, + 1595 + ], + "loc": { + "start": { + "line": 62, + "column": 37 + }, + "end": { + "line": 62, + "column": 57 + } + } + }, + "range": [ + 1550, + 1595 + ], + "loc": { + "start": { + "line": 62, + "column": 12 + }, + "end": { + "line": 62, + "column": 57 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 1627, + 1632 + ], + "loc": { + "start": { + "line": 64, + "column": 12 + }, + "end": { + "line": 64, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "remove", + "range": [ + 1633, + 1639 + ], + "loc": { + "start": { + "line": 64, + "column": 18 + }, + "end": { + "line": 64, + "column": 24 + } + } + }, + "range": [ + 1627, + 1639 + ], + "loc": { + "start": { + "line": 64, + "column": 12 + }, + "end": { + "line": 64, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 1640, + 1644 + ], + "loc": { + "start": { + "line": 64, + "column": 25 + }, + "end": { + "line": 64, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 1646, + 1648 + ], + "loc": { + "start": { + "line": 64, + "column": 31 + }, + "end": { + "line": 64, + "column": 33 + } + } + } + ], + "range": [ + 1627, + 1649 + ], + "loc": { + "start": { + "line": 64, + "column": 12 + }, + "end": { + "line": 64, + "column": 34 + } + } + }, + "range": [ + 1627, + 1650 + ], + "loc": { + "start": { + "line": 64, + "column": 12 + }, + "end": { + "line": 64, + "column": 35 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "success", + "range": [ + 1667, + 1674 + ], + "loc": { + "start": { + "line": 65, + "column": 16 + }, + "end": { + "line": 65, + "column": 23 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "success", + "range": [ + 1692, + 1699 + ], + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 1700, + 1704 + ], + "loc": { + "start": { + "line": 66, + "column": 22 + }, + "end": { + "line": 66, + "column": 26 + } + } + }, + "range": [ + 1692, + 1704 + ], + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 1705, + 1712 + ], + "loc": { + "start": { + "line": 66, + "column": 27 + }, + "end": { + "line": 66, + "column": 34 + } + } + } + ], + "range": [ + 1692, + 1713 + ], + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 35 + } + } + }, + "range": [ + 1692, + 1714 + ], + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 36 + } + } + } + ], + "range": [ + 1676, + 1728 + ], + "loc": { + "start": { + "line": 65, + "column": 25 + }, + "end": { + "line": 67, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 1663, + 1728 + ], + "loc": { + "start": { + "line": 65, + "column": 12 + }, + "end": { + "line": 67, + "column": 13 + } + } + } + ], + "range": [ + 1613, + 1740 + ], + "loc": { + "start": { + "line": 63, + "column": 14 + }, + "end": { + "line": 68, + "column": 11 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 1748, + 1749 + ], + "loc": { + "start": { + "line": 68, + "column": 19 + }, + "end": { + "line": 68, + "column": 20 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 1765, + 1770 + ], + "loc": { + "start": { + "line": 69, + "column": 12 + }, + "end": { + "line": 69, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 1771, + 1775 + ], + "loc": { + "start": { + "line": 69, + "column": 18 + }, + "end": { + "line": 69, + "column": 22 + } + } + }, + "range": [ + 1765, + 1775 + ], + "loc": { + "start": { + "line": 69, + "column": 12 + }, + "end": { + "line": 69, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 1776, + 1783 + ], + "loc": { + "start": { + "line": 69, + "column": 23 + }, + "end": { + "line": 69, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "e", + "range": [ + 1785, + 1786 + ], + "loc": { + "start": { + "line": 69, + "column": 32 + }, + "end": { + "line": 69, + "column": 33 + } + } + } + ], + "range": [ + 1765, + 1787 + ], + "loc": { + "start": { + "line": 69, + "column": 12 + }, + "end": { + "line": 69, + "column": 34 + } + } + }, + "range": [ + 1765, + 1788 + ], + "loc": { + "start": { + "line": 69, + "column": 12 + }, + "end": { + "line": 69, + "column": 35 + } + } + } + ], + "range": [ + 1751, + 1800 + ], + "loc": { + "start": { + "line": 68, + "column": 22 + }, + "end": { + "line": 70, + "column": 11 + } + } + }, + "range": [ + 1741, + 1800 + ], + "loc": { + "start": { + "line": 68, + "column": 12 + }, + "end": { + "line": 70, + "column": 11 + } + } + }, + "finalizer": null, + "range": [ + 1609, + 1800 + ], + "loc": { + "start": { + "line": 63, + "column": 10 + }, + "end": { + "line": 70, + "column": 11 + } + } + } + ], + "range": [ + 1597, + 1810 + ], + "loc": { + "start": { + "line": 62, + "column": 59 + }, + "end": { + "line": 71, + "column": 9 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "error", + "range": [ + 1820, + 1825 + ], + "loc": { + "start": { + "line": 71, + "column": 19 + }, + "end": { + "line": 71, + "column": 24 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 1839, + 1844 + ], + "loc": { + "start": { + "line": 72, + "column": 10 + }, + "end": { + "line": 72, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 1845, + 1849 + ], + "loc": { + "start": { + "line": 72, + "column": 16 + }, + "end": { + "line": 72, + "column": 20 + } + } + }, + "range": [ + 1839, + 1849 + ], + "loc": { + "start": { + "line": 72, + "column": 10 + }, + "end": { + "line": 72, + "column": 20 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 1850, + 1857 + ], + "loc": { + "start": { + "line": 72, + "column": 21 + }, + "end": { + "line": 72, + "column": 28 + } + } + } + ], + "range": [ + 1839, + 1858 + ], + "loc": { + "start": { + "line": 72, + "column": 10 + }, + "end": { + "line": 72, + "column": 29 + } + } + }, + "range": [ + 1839, + 1859 + ], + "loc": { + "start": { + "line": 72, + "column": 10 + }, + "end": { + "line": 72, + "column": 30 + } + } + } + ], + "range": [ + 1827, + 1869 + ], + "loc": { + "start": { + "line": 71, + "column": 26 + }, + "end": { + "line": 73, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 1816, + 1869 + ], + "loc": { + "start": { + "line": 71, + "column": 15 + }, + "end": { + "line": 73, + "column": 9 + } + } + }, + "range": [ + 1546, + 1869 + ], + "loc": { + "start": { + "line": 62, + "column": 8 + }, + "end": { + "line": 73, + "column": 9 + } + } + } + ], + "range": [ + 1536, + 1877 + ], + "loc": { + "start": { + "line": 61, + "column": 35 + }, + "end": { + "line": 74, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1524, + 1877 + ], + "loc": { + "start": { + "line": 61, + "column": 23 + }, + "end": { + "line": 74, + "column": 7 + } + } + }, + "range": [ + 1507, + 1877 + ], + "loc": { + "start": { + "line": 61, + "column": 6 + }, + "end": { + "line": 74, + "column": 7 + } + } + }, + "range": [ + 1507, + 1878 + ], + "loc": { + "start": { + "line": 61, + "column": 6 + }, + "end": { + "line": 74, + "column": 8 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 1886, + 1893 + ], + "loc": { + "start": { + "line": 76, + "column": 6 + }, + "end": { + "line": 76, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "send", + "range": [ + 1894, + 1898 + ], + "loc": { + "start": { + "line": 76, + "column": 14 + }, + "end": { + "line": 76, + "column": 18 + } + } + }, + "range": [ + 1886, + 1898 + ], + "loc": { + "start": { + "line": 76, + "column": 6 + }, + "end": { + "line": 76, + "column": 18 + } + } + }, + "arguments": [], + "range": [ + 1886, + 1900 + ], + "loc": { + "start": { + "line": 76, + "column": 6 + }, + "end": { + "line": 76, + "column": 20 + } + } + }, + "range": [ + 1886, + 1901 + ], + "loc": { + "start": { + "line": 76, + "column": 6 + }, + "end": { + "line": 76, + "column": 21 + } + } + } + ], + "range": [ + 1387, + 1908 + ], + "loc": { + "start": { + "line": 55, + "column": 35 + }, + "end": { + "line": 78, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 1932, + 1937 + ], + "loc": { + "start": { + "line": 79, + "column": 16 + }, + "end": { + "line": 79, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 1938, + 1955 + ], + "loc": { + "start": { + "line": 79, + "column": 22 + }, + "end": { + "line": 79, + "column": 39 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 1959, + 1962 + ], + "loc": { + "start": { + "line": 79, + "column": 43 + }, + "end": { + "line": 79, + "column": 46 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 1955, + 1959 + ], + "loc": { + "start": { + "line": 79, + "column": 39 + }, + "end": { + "line": 79, + "column": 43 + } + } + } + ], + "range": [ + 1938, + 1962 + ], + "loc": { + "start": { + "line": 79, + "column": 22 + }, + "end": { + "line": 79, + "column": 46 + } + } + } + ], + "range": [ + 1928, + 1963 + ], + "loc": { + "start": { + "line": 79, + "column": 12 + }, + "end": { + "line": 79, + "column": 47 + } + } + }, + "range": [ + 1922, + 1964 + ], + "loc": { + "start": { + "line": 79, + "column": 6 + }, + "end": { + "line": 79, + "column": 48 + } + } + } + ], + "range": [ + 1914, + 1970 + ], + "loc": { + "start": { + "line": 78, + "column": 11 + }, + "end": { + "line": 80, + "column": 5 + } + } + }, + "range": [ + 1363, + 1970 + ], + "loc": { + "start": { + "line": 55, + "column": 11 + }, + "end": { + "line": 80, + "column": 5 + } + } + }, + "range": [ + 1227, + 1970 + ], + "loc": { + "start": { + "line": 51, + "column": 4 + }, + "end": { + "line": 80, + "column": 5 + } + } + } + ], + "range": [ + 1220, + 1975 + ], + "loc": { + "start": { + "line": 49, + "column": 52 + }, + "end": { + "line": 82, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1177, + 1975 + ], + "loc": { + "start": { + "line": 49, + "column": 9 + }, + "end": { + "line": 82, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 1170, + 1975 + ], + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 82, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "load", + "range": [ + 1979, + 1983 + ], + "loc": { + "start": { + "line": 84, + "column": 2 + }, + "end": { + "line": 84, + "column": 6 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 1984, + 1989 + ], + "loc": { + "start": { + "line": 84, + "column": 7 + }, + "end": { + "line": 84, + "column": 12 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 1991, + 1995 + ], + "loc": { + "start": { + "line": 84, + "column": 14 + }, + "end": { + "line": 84, + "column": 18 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 1997, + 1999 + ], + "loc": { + "start": { + "line": 84, + "column": 20 + }, + "end": { + "line": 84, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 2001, + 2008 + ], + "loc": { + "start": { + "line": 84, + "column": 24 + }, + "end": { + "line": 84, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 2010, + 2017 + ], + "loc": { + "start": { + "line": 84, + "column": 33 + }, + "end": { + "line": 84, + "column": 40 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 2019, + 2024 + ], + "loc": { + "start": { + "line": 84, + "column": 42 + }, + "end": { + "line": 84, + "column": 47 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 2026, + 2033 + ], + "loc": { + "start": { + "line": 84, + "column": 49 + }, + "end": { + "line": 84, + "column": 56 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "id", + "range": [ + 2046, + 2048 + ], + "loc": { + "start": { + "line": 86, + "column": 8 + }, + "end": { + "line": 86, + "column": 10 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 2052, + 2054 + ], + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 2055, + 2063 + ], + "loc": { + "start": { + "line": 86, + "column": 17 + }, + "end": { + "line": 86, + "column": 25 + } + } + }, + "range": [ + 2052, + 2063 + ], + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 2064, + 2068 + ], + "loc": { + "start": { + "line": 86, + "column": 26 + }, + "end": { + "line": 86, + "column": 30 + } + } + }, + "range": [ + 2052, + 2068 + ], + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 30 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "id", + "range": [ + 2069, + 2071 + ], + "loc": { + "start": { + "line": 86, + "column": 31 + }, + "end": { + "line": 86, + "column": 33 + } + } + } + ], + "range": [ + 2052, + 2072 + ], + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 34 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 2077, + 2096 + ], + "loc": { + "start": { + "line": 86, + "column": 39 + }, + "end": { + "line": 86, + "column": 58 + } + } + }, + "range": [ + 2052, + 2096 + ], + "loc": { + "start": { + "line": 86, + "column": 14 + }, + "end": { + "line": 86, + "column": 58 + } + } + }, + "range": [ + 2046, + 2096 + ], + "loc": { + "start": { + "line": 86, + "column": 8 + }, + "end": { + "line": 86, + "column": 58 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2106, + 2110 + ], + "loc": { + "start": { + "line": 87, + "column": 6 + }, + "end": { + "line": 87, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "load", + "range": [ + 2111, + 2115 + ], + "loc": { + "start": { + "line": 87, + "column": 11 + }, + "end": { + "line": 87, + "column": 15 + } + } + }, + "range": [ + 2106, + 2115 + ], + "loc": { + "start": { + "line": 87, + "column": 6 + }, + "end": { + "line": 87, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 2116, + 2121 + ], + "loc": { + "start": { + "line": 87, + "column": 16 + }, + "end": { + "line": 87, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 2123, + 2127 + ], + "loc": { + "start": { + "line": 87, + "column": 23 + }, + "end": { + "line": 87, + "column": 27 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 2129, + 2133 + ], + "loc": { + "start": { + "line": 87, + "column": 29 + }, + "end": { + "line": 87, + "column": 33 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 2135, + 2139 + ], + "loc": { + "start": { + "line": 87, + "column": 35 + }, + "end": { + "line": 87, + "column": 39 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 2141, + 2143 + ], + "loc": { + "start": { + "line": 87, + "column": 41 + }, + "end": { + "line": 87, + "column": 43 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 2145, + 2152 + ], + "loc": { + "start": { + "line": 87, + "column": 45 + }, + "end": { + "line": 87, + "column": 52 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 2154, + 2161 + ], + "loc": { + "start": { + "line": 87, + "column": 54 + }, + "end": { + "line": 87, + "column": 61 + } + } + } + ], + "range": [ + 2106, + 2162 + ], + "loc": { + "start": { + "line": 87, + "column": 6 + }, + "end": { + "line": 87, + "column": 62 + } + } + }, + "range": [ + 2106, + 2163 + ], + "loc": { + "start": { + "line": 87, + "column": 6 + }, + "end": { + "line": 87, + "column": 63 + } + } + } + ], + "range": [ + 2098, + 2169 + ], + "loc": { + "start": { + "line": 86, + "column": 60 + }, + "end": { + "line": 88, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "id", + "range": [ + 2179, + 2181 + ], + "loc": { + "start": { + "line": 88, + "column": 15 + }, + "end": { + "line": 88, + "column": 17 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "id", + "range": [ + 2192, + 2194 + ], + "loc": { + "start": { + "line": 88, + "column": 28 + }, + "end": { + "line": 88, + "column": 30 + } + } + }, + "prefix": true, + "range": [ + 2185, + 2194 + ], + "loc": { + "start": { + "line": 88, + "column": 21 + }, + "end": { + "line": 88, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": "object", + "raw": "\"object\"", + "range": [ + 2199, + 2207 + ], + "loc": { + "start": { + "line": 88, + "column": 35 + }, + "end": { + "line": 88, + "column": 43 + } + } + }, + "range": [ + 2185, + 2207 + ], + "loc": { + "start": { + "line": 88, + "column": 21 + }, + "end": { + "line": 88, + "column": 43 + } + } + }, + "range": [ + 2179, + 2207 + ], + "loc": { + "start": { + "line": 88, + "column": 15 + }, + "end": { + "line": 88, + "column": 43 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2217, + 2221 + ], + "loc": { + "start": { + "line": 89, + "column": 6 + }, + "end": { + "line": 89, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "load", + "range": [ + 2222, + 2226 + ], + "loc": { + "start": { + "line": 89, + "column": 11 + }, + "end": { + "line": 89, + "column": 15 + } + } + }, + "range": [ + 2217, + 2226 + ], + "loc": { + "start": { + "line": 89, + "column": 6 + }, + "end": { + "line": 89, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 2227, + 2232 + ], + "loc": { + "start": { + "line": 89, + "column": 16 + }, + "end": { + "line": 89, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 2234, + 2238 + ], + "loc": { + "start": { + "line": 89, + "column": 23 + }, + "end": { + "line": 89, + "column": 27 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 2240, + 2244 + ], + "loc": { + "start": { + "line": 89, + "column": 29 + }, + "end": { + "line": 89, + "column": 33 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 2246, + 2248 + ], + "loc": { + "start": { + "line": 89, + "column": 35 + }, + "end": { + "line": 89, + "column": 37 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 2250, + 2257 + ], + "loc": { + "start": { + "line": 89, + "column": 39 + }, + "end": { + "line": 89, + "column": 46 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 2259, + 2266 + ], + "loc": { + "start": { + "line": 89, + "column": 48 + }, + "end": { + "line": 89, + "column": 55 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 2268, + 2273 + ], + "loc": { + "start": { + "line": 89, + "column": 57 + }, + "end": { + "line": 89, + "column": 62 + } + } + } + ], + "range": [ + 2217, + 2274 + ], + "loc": { + "start": { + "line": 89, + "column": 6 + }, + "end": { + "line": 89, + "column": 63 + } + } + }, + "range": [ + 2217, + 2275 + ], + "loc": { + "start": { + "line": 89, + "column": 6 + }, + "end": { + "line": 89, + "column": 64 + } + } + } + ], + "range": [ + 2209, + 2281 + ], + "loc": { + "start": { + "line": 88, + "column": 45 + }, + "end": { + "line": 90, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 2291, + 2298 + ], + "loc": { + "start": { + "line": 90, + "column": 15 + }, + "end": { + "line": 90, + "column": 22 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 2302, + 2304 + ], + "loc": { + "start": { + "line": 90, + "column": 26 + }, + "end": { + "line": 90, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 2305, + 2313 + ], + "loc": { + "start": { + "line": 90, + "column": 29 + }, + "end": { + "line": 90, + "column": 37 + } + } + }, + "range": [ + 2302, + 2313 + ], + "loc": { + "start": { + "line": 90, + "column": 26 + }, + "end": { + "line": 90, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 2314, + 2318 + ], + "loc": { + "start": { + "line": 90, + "column": 38 + }, + "end": { + "line": 90, + "column": 42 + } + } + }, + "range": [ + 2302, + 2318 + ], + "loc": { + "start": { + "line": 90, + "column": 26 + }, + "end": { + "line": 90, + "column": 42 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "options", + "range": [ + 2319, + 2326 + ], + "loc": { + "start": { + "line": 90, + "column": 43 + }, + "end": { + "line": 90, + "column": 50 + } + } + } + ], + "range": [ + 2302, + 2327 + ], + "loc": { + "start": { + "line": 90, + "column": 26 + }, + "end": { + "line": 90, + "column": 51 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 2332, + 2351 + ], + "loc": { + "start": { + "line": 90, + "column": 56 + }, + "end": { + "line": 90, + "column": 75 + } + } + }, + "range": [ + 2302, + 2351 + ], + "loc": { + "start": { + "line": 90, + "column": 26 + }, + "end": { + "line": 90, + "column": 75 + } + } + }, + "range": [ + 2291, + 2351 + ], + "loc": { + "start": { + "line": 90, + "column": 15 + }, + "end": { + "line": 90, + "column": 75 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2361, + 2365 + ], + "loc": { + "start": { + "line": 91, + "column": 6 + }, + "end": { + "line": 91, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "load", + "range": [ + 2366, + 2370 + ], + "loc": { + "start": { + "line": 91, + "column": 11 + }, + "end": { + "line": 91, + "column": 15 + } + } + }, + "range": [ + 2361, + 2370 + ], + "loc": { + "start": { + "line": 91, + "column": 6 + }, + "end": { + "line": 91, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 2371, + 2376 + ], + "loc": { + "start": { + "line": 91, + "column": 16 + }, + "end": { + "line": 91, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 2378, + 2382 + ], + "loc": { + "start": { + "line": 91, + "column": 23 + }, + "end": { + "line": 91, + "column": 27 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 2384, + 2386 + ], + "loc": { + "start": { + "line": 91, + "column": 29 + }, + "end": { + "line": 91, + "column": 31 + } + } + }, + { + "type": "ObjectExpression", + "properties": [], + "range": [ + 2388, + 2390 + ], + "loc": { + "start": { + "line": 91, + "column": 33 + }, + "end": { + "line": 91, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 2392, + 2399 + ], + "loc": { + "start": { + "line": 91, + "column": 37 + }, + "end": { + "line": 91, + "column": 44 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 2401, + 2408 + ], + "loc": { + "start": { + "line": 91, + "column": 46 + }, + "end": { + "line": 91, + "column": 53 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 2410, + 2415 + ], + "loc": { + "start": { + "line": 91, + "column": 55 + }, + "end": { + "line": 91, + "column": 60 + } + } + } + ], + "range": [ + 2361, + 2416 + ], + "loc": { + "start": { + "line": 91, + "column": 6 + }, + "end": { + "line": 91, + "column": 61 + } + } + }, + "range": [ + 2361, + 2417 + ], + "loc": { + "start": { + "line": 91, + "column": 6 + }, + "end": { + "line": 91, + "column": 62 + } + } + } + ], + "range": [ + 2353, + 2423 + ], + "loc": { + "start": { + "line": 90, + "column": 77 + }, + "end": { + "line": 92, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 2433, + 2438 + ], + "loc": { + "start": { + "line": 92, + "column": 15 + }, + "end": { + "line": 92, + "column": 20 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 2442, + 2444 + ], + "loc": { + "start": { + "line": 92, + "column": 24 + }, + "end": { + "line": 92, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 2445, + 2453 + ], + "loc": { + "start": { + "line": 92, + "column": 27 + }, + "end": { + "line": 92, + "column": 35 + } + } + }, + "range": [ + 2442, + 2453 + ], + "loc": { + "start": { + "line": 92, + "column": 24 + }, + "end": { + "line": 92, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 2454, + 2458 + ], + "loc": { + "start": { + "line": 92, + "column": 36 + }, + "end": { + "line": 92, + "column": 40 + } + } + }, + "range": [ + 2442, + 2458 + ], + "loc": { + "start": { + "line": 92, + "column": 24 + }, + "end": { + "line": 92, + "column": 40 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 2459, + 2464 + ], + "loc": { + "start": { + "line": 92, + "column": 41 + }, + "end": { + "line": 92, + "column": 46 + } + } + } + ], + "range": [ + 2442, + 2465 + ], + "loc": { + "start": { + "line": 92, + "column": 24 + }, + "end": { + "line": 92, + "column": 47 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 2470, + 2489 + ], + "loc": { + "start": { + "line": 92, + "column": 52 + }, + "end": { + "line": 92, + "column": 71 + } + } + }, + "range": [ + 2442, + 2489 + ], + "loc": { + "start": { + "line": 92, + "column": 24 + }, + "end": { + "line": 92, + "column": 71 + } + } + }, + "range": [ + 2433, + 2489 + ], + "loc": { + "start": { + "line": 92, + "column": 15 + }, + "end": { + "line": 92, + "column": 71 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2499, + 2503 + ], + "loc": { + "start": { + "line": 93, + "column": 6 + }, + "end": { + "line": 93, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "load", + "range": [ + 2504, + 2508 + ], + "loc": { + "start": { + "line": 93, + "column": 11 + }, + "end": { + "line": 93, + "column": 15 + } + } + }, + "range": [ + 2499, + 2508 + ], + "loc": { + "start": { + "line": 93, + "column": 6 + }, + "end": { + "line": 93, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 2509, + 2514 + ], + "loc": { + "start": { + "line": 93, + "column": 16 + }, + "end": { + "line": 93, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 2516, + 2520 + ], + "loc": { + "start": { + "line": 93, + "column": 23 + }, + "end": { + "line": 93, + "column": 27 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 2522, + 2524 + ], + "loc": { + "start": { + "line": 93, + "column": 29 + }, + "end": { + "line": 93, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 2526, + 2533 + ], + "loc": { + "start": { + "line": 93, + "column": 33 + }, + "end": { + "line": 93, + "column": 40 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 2535, + 2542 + ], + "loc": { + "start": { + "line": 93, + "column": 42 + }, + "end": { + "line": 93, + "column": 49 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 2544, + 2548 + ], + "loc": { + "start": { + "line": 93, + "column": 51 + }, + "end": { + "line": 93, + "column": 55 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 2550, + 2555 + ], + "loc": { + "start": { + "line": 93, + "column": 57 + }, + "end": { + "line": 93, + "column": 62 + } + } + } + ], + "range": [ + 2499, + 2556 + ], + "loc": { + "start": { + "line": 93, + "column": 6 + }, + "end": { + "line": 93, + "column": 63 + } + } + }, + "range": [ + 2499, + 2557 + ], + "loc": { + "start": { + "line": 93, + "column": 6 + }, + "end": { + "line": 93, + "column": 64 + } + } + } + ], + "range": [ + 2491, + 2563 + ], + "loc": { + "start": { + "line": 92, + "column": 73 + }, + "end": { + "line": 94, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 2573, + 2578 + ], + "loc": { + "start": { + "line": 94, + "column": 15 + }, + "end": { + "line": 94, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 2579, + 2585 + ], + "loc": { + "start": { + "line": 94, + "column": 21 + }, + "end": { + "line": 94, + "column": 27 + } + } + }, + "range": [ + 2573, + 2585 + ], + "loc": { + "start": { + "line": 94, + "column": 15 + }, + "end": { + "line": 94, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 2586, + 2590 + ], + "loc": { + "start": { + "line": 94, + "column": 28 + }, + "end": { + "line": 94, + "column": 32 + } + } + }, + "range": [ + 2573, + 2591 + ], + "loc": { + "start": { + "line": 94, + "column": 15 + }, + "end": { + "line": 94, + "column": 33 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "request", + "range": [ + 2606, + 2613 + ], + "loc": { + "start": { + "line": 96, + "column": 10 + }, + "end": { + "line": 96, + "column": 17 + } + } + }, + "init": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "XMLHttpRequest", + "range": [ + 2620, + 2634 + ], + "loc": { + "start": { + "line": 96, + "column": 24 + }, + "end": { + "line": 96, + "column": 38 + } + } + }, + "arguments": [], + "range": [ + 2616, + 2636 + ], + "loc": { + "start": { + "line": 96, + "column": 20 + }, + "end": { + "line": 96, + "column": 40 + } + } + }, + "range": [ + 2606, + 2636 + ], + "loc": { + "start": { + "line": 96, + "column": 10 + }, + "end": { + "line": 96, + "column": 40 + } + } + } + ], + "kind": "let", + "range": [ + 2602, + 2637 + ], + "loc": { + "start": { + "line": 96, + "column": 6 + }, + "end": { + "line": 96, + "column": 41 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "url", + "range": [ + 2648, + 2651 + ], + "loc": { + "start": { + "line": 97, + "column": 10 + }, + "end": { + "line": 97, + "column": 13 + } + } + }, + "init": null, + "range": [ + 2648, + 2651 + ], + "loc": { + "start": { + "line": 97, + "column": 10 + }, + "end": { + "line": 97, + "column": 13 + } + } + } + ], + "kind": "let", + "range": [ + 2644, + 2652 + ], + "loc": { + "start": { + "line": 97, + "column": 6 + }, + "end": { + "line": 97, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 2660, + 2667 + ], + "loc": { + "start": { + "line": 99, + "column": 6 + }, + "end": { + "line": 99, + "column": 13 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 2670, + 2677 + ], + "loc": { + "start": { + "line": 99, + "column": 16 + }, + "end": { + "line": 99, + "column": 23 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 2681, + 2683 + ], + "loc": { + "start": { + "line": 99, + "column": 27 + }, + "end": { + "line": 99, + "column": 29 + } + } + }, + "range": [ + 2670, + 2683 + ], + "loc": { + "start": { + "line": 99, + "column": 16 + }, + "end": { + "line": 99, + "column": 29 + } + } + }, + "range": [ + 2660, + 2683 + ], + "loc": { + "start": { + "line": 99, + "column": 6 + }, + "end": { + "line": 99, + "column": 29 + } + } + }, + "range": [ + 2660, + 2684 + ], + "loc": { + "start": { + "line": 99, + "column": 6 + }, + "end": { + "line": 99, + "column": 30 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "url", + "range": [ + 2691, + 2694 + ], + "loc": { + "start": { + "line": 100, + "column": 6 + }, + "end": { + "line": 100, + "column": 9 + } + } + }, + "right": { + "type": "ConditionalExpression", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 2697, + 2699 + ], + "loc": { + "start": { + "line": 100, + "column": 12 + }, + "end": { + "line": 100, + "column": 14 + } + } + }, + "consequent": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 2702, + 2705 + ], + "loc": { + "start": { + "line": 100, + "column": 17 + }, + "end": { + "line": 100, + "column": 20 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 2715, + 2719 + ], + "loc": { + "start": { + "line": 100, + "column": 30 + }, + "end": { + "line": 100, + "column": 34 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 2723, + 2727 + ], + "loc": { + "start": { + "line": 100, + "column": 38 + }, + "end": { + "line": 100, + "column": 42 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 2729, + 2731 + ], + "loc": { + "start": { + "line": 100, + "column": 44 + }, + "end": { + "line": 100, + "column": 46 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2705, + 2709 + ], + "loc": { + "start": { + "line": 100, + "column": 20 + }, + "end": { + "line": 100, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "_base", + "range": [ + 2710, + 2715 + ], + "loc": { + "start": { + "line": 100, + "column": 25 + }, + "end": { + "line": 100, + "column": 30 + } + } + }, + "range": [ + 2705, + 2715 + ], + "loc": { + "start": { + "line": 100, + "column": 20 + }, + "end": { + "line": 100, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 2719, + 2723 + ], + "loc": { + "start": { + "line": 100, + "column": 34 + }, + "end": { + "line": 100, + "column": 38 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 2727, + 2729 + ], + "loc": { + "start": { + "line": 100, + "column": 42 + }, + "end": { + "line": 100, + "column": 44 + } + } + } + ], + "range": [ + 2702, + 2731 + ], + "loc": { + "start": { + "line": 100, + "column": 17 + }, + "end": { + "line": 100, + "column": 46 + } + } + }, + "alternate": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 2734, + 2737 + ], + "loc": { + "start": { + "line": 100, + "column": 49 + }, + "end": { + "line": 100, + "column": 52 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 2747, + 2751 + ], + "loc": { + "start": { + "line": 100, + "column": 62 + }, + "end": { + "line": 100, + "column": 66 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 2755, + 2757 + ], + "loc": { + "start": { + "line": 100, + "column": 70 + }, + "end": { + "line": 100, + "column": 72 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2737, + 2741 + ], + "loc": { + "start": { + "line": 100, + "column": 52 + }, + "end": { + "line": 100, + "column": 56 + } + } + }, + "property": { + "type": "Identifier", + "name": "_base", + "range": [ + 2742, + 2747 + ], + "loc": { + "start": { + "line": 100, + "column": 57 + }, + "end": { + "line": 100, + "column": 62 + } + } + }, + "range": [ + 2737, + 2747 + ], + "loc": { + "start": { + "line": 100, + "column": 52 + }, + "end": { + "line": 100, + "column": 62 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 2751, + 2755 + ], + "loc": { + "start": { + "line": 100, + "column": 66 + }, + "end": { + "line": 100, + "column": 70 + } + } + } + ], + "range": [ + 2734, + 2757 + ], + "loc": { + "start": { + "line": 100, + "column": 49 + }, + "end": { + "line": 100, + "column": 72 + } + } + }, + "range": [ + 2697, + 2757 + ], + "loc": { + "start": { + "line": 100, + "column": 12 + }, + "end": { + "line": 100, + "column": 72 + } + } + }, + "range": [ + 2691, + 2757 + ], + "loc": { + "start": { + "line": 100, + "column": 6 + }, + "end": { + "line": 100, + "column": 72 + } + } + }, + "range": [ + 2691, + 2758 + ], + "loc": { + "start": { + "line": 100, + "column": 6 + }, + "end": { + "line": 100, + "column": 73 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "options", + "range": [ + 2770, + 2777 + ], + "loc": { + "start": { + "line": 102, + "column": 10 + }, + "end": { + "line": 102, + "column": 17 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "params", + "range": [ + 2794, + 2800 + ], + "loc": { + "start": { + "line": 104, + "column": 12 + }, + "end": { + "line": 104, + "column": 18 + } + } + }, + "init": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 2803, + 2805 + ], + "loc": { + "start": { + "line": 104, + "column": 21 + }, + "end": { + "line": 104, + "column": 23 + } + } + }, + "range": [ + 2794, + 2805 + ], + "loc": { + "start": { + "line": 104, + "column": 12 + }, + "end": { + "line": 104, + "column": 23 + } + } + } + ], + "kind": "let", + "range": [ + 2790, + 2806 + ], + "loc": { + "start": { + "line": 104, + "column": 8 + }, + "end": { + "line": 104, + "column": 24 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 2820, + 2827 + ], + "loc": { + "start": { + "line": 106, + "column": 12 + }, + "end": { + "line": 106, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "fields", + "range": [ + 2828, + 2834 + ], + "loc": { + "start": { + "line": 106, + "column": 20 + }, + "end": { + "line": 106, + "column": 26 + } + } + }, + "range": [ + 2820, + 2834 + ], + "loc": { + "start": { + "line": 106, + "column": 12 + }, + "end": { + "line": 106, + "column": 26 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 2848, + 2854 + ], + "loc": { + "start": { + "line": 107, + "column": 10 + }, + "end": { + "line": 107, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 2855, + 2859 + ], + "loc": { + "start": { + "line": 107, + "column": 17 + }, + "end": { + "line": 107, + "column": 21 + } + } + }, + "range": [ + 2848, + 2859 + ], + "loc": { + "start": { + "line": 107, + "column": 10 + }, + "end": { + "line": 107, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 2860, + 2867 + ], + "loc": { + "start": { + "line": 107, + "column": 22 + }, + "end": { + "line": 107, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "fields", + "range": [ + 2868, + 2874 + ], + "loc": { + "start": { + "line": 107, + "column": 30 + }, + "end": { + "line": 107, + "column": 36 + } + } + }, + "range": [ + 2860, + 2874 + ], + "loc": { + "start": { + "line": 107, + "column": 22 + }, + "end": { + "line": 107, + "column": 36 + } + } + } + ], + "range": [ + 2848, + 2875 + ], + "loc": { + "start": { + "line": 107, + "column": 10 + }, + "end": { + "line": 107, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 2876, + 2883 + ], + "loc": { + "start": { + "line": 107, + "column": 38 + }, + "end": { + "line": 107, + "column": 45 + } + } + }, + "range": [ + 2848, + 2883 + ], + "loc": { + "start": { + "line": 107, + "column": 10 + }, + "end": { + "line": 107, + "column": 45 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "field", + "range": [ + 2884, + 2889 + ], + "loc": { + "start": { + "line": 107, + "column": 46 + }, + "end": { + "line": 107, + "column": 51 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 2907, + 2914 + ], + "loc": { + "start": { + "line": 108, + "column": 12 + }, + "end": { + "line": 108, + "column": 19 + } + } + }, + "property": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "fields[", + "cooked": "fields[" + }, + "tail": false, + "range": [ + 2915, + 2925 + ], + "loc": { + "start": { + "line": 108, + "column": 20 + }, + "end": { + "line": 108, + "column": 30 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "]", + "cooked": "]" + }, + "tail": true, + "range": [ + 2930, + 2933 + ], + "loc": { + "start": { + "line": 108, + "column": 35 + }, + "end": { + "line": 108, + "column": 38 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "field", + "range": [ + 2925, + 2930 + ], + "loc": { + "start": { + "line": 108, + "column": 30 + }, + "end": { + "line": 108, + "column": 35 + } + } + } + ], + "range": [ + 2915, + 2933 + ], + "loc": { + "start": { + "line": 108, + "column": 20 + }, + "end": { + "line": 108, + "column": 38 + } + } + }, + "range": [ + 2907, + 2934 + ], + "loc": { + "start": { + "line": 108, + "column": 12 + }, + "end": { + "line": 108, + "column": 39 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 2937, + 2944 + ], + "loc": { + "start": { + "line": 108, + "column": 42 + }, + "end": { + "line": 108, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "fields", + "range": [ + 2945, + 2951 + ], + "loc": { + "start": { + "line": 108, + "column": 50 + }, + "end": { + "line": 108, + "column": 56 + } + } + }, + "range": [ + 2937, + 2951 + ], + "loc": { + "start": { + "line": 108, + "column": 42 + }, + "end": { + "line": 108, + "column": 56 + } + } + }, + "property": { + "type": "Identifier", + "name": "field", + "range": [ + 2952, + 2957 + ], + "loc": { + "start": { + "line": 108, + "column": 57 + }, + "end": { + "line": 108, + "column": 62 + } + } + }, + "range": [ + 2937, + 2958 + ], + "loc": { + "start": { + "line": 108, + "column": 42 + }, + "end": { + "line": 108, + "column": 63 + } + } + }, + "range": [ + 2907, + 2958 + ], + "loc": { + "start": { + "line": 108, + "column": 12 + }, + "end": { + "line": 108, + "column": 63 + } + } + }, + "range": [ + 2907, + 2959 + ], + "loc": { + "start": { + "line": 108, + "column": 12 + }, + "end": { + "line": 108, + "column": 64 + } + } + } + ], + "range": [ + 2893, + 2971 + ], + "loc": { + "start": { + "line": 107, + "column": 55 + }, + "end": { + "line": 109, + "column": 11 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 2884, + 2971 + ], + "loc": { + "start": { + "line": 107, + "column": 46 + }, + "end": { + "line": 109, + "column": 11 + } + } + } + ], + "range": [ + 2848, + 2972 + ], + "loc": { + "start": { + "line": 107, + "column": 10 + }, + "end": { + "line": 109, + "column": 12 + } + } + }, + "range": [ + 2848, + 2973 + ], + "loc": { + "start": { + "line": 107, + "column": 10 + }, + "end": { + "line": 109, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 2991, + 2998 + ], + "loc": { + "start": { + "line": 110, + "column": 17 + }, + "end": { + "line": 110, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "fields", + "range": [ + 2999, + 3005 + ], + "loc": { + "start": { + "line": 110, + "column": 25 + }, + "end": { + "line": 110, + "column": 31 + } + } + }, + "range": [ + 2991, + 3005 + ], + "loc": { + "start": { + "line": 110, + "column": 17 + }, + "end": { + "line": 110, + "column": 31 + } + } + }, + "prefix": true, + "range": [ + 2984, + 3005 + ], + "loc": { + "start": { + "line": 110, + "column": 10 + }, + "end": { + "line": 110, + "column": 31 + } + } + }, + "range": [ + 2984, + 3006 + ], + "loc": { + "start": { + "line": 110, + "column": 10 + }, + "end": { + "line": 110, + "column": 32 + } + } + } + ], + "range": [ + 2836, + 3016 + ], + "loc": { + "start": { + "line": 106, + "column": 28 + }, + "end": { + "line": 111, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 2816, + 3016 + ], + "loc": { + "start": { + "line": 106, + "column": 8 + }, + "end": { + "line": 111, + "column": 9 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "params", + "range": [ + 3026, + 3032 + ], + "loc": { + "start": { + "line": 113, + "column": 8 + }, + "end": { + "line": 113, + "column": 14 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 3035, + 3041 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 113, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 3042, + 3046 + ], + "loc": { + "start": { + "line": 113, + "column": 24 + }, + "end": { + "line": 113, + "column": 28 + } + } + }, + "range": [ + 3035, + 3046 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 113, + "column": 28 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "options", + "range": [ + 3047, + 3054 + ], + "loc": { + "start": { + "line": 113, + "column": 29 + }, + "end": { + "line": 113, + "column": 36 + } + } + } + ], + "range": [ + 3035, + 3055 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 113, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "map", + "range": [ + 3056, + 3059 + ], + "loc": { + "start": { + "line": 113, + "column": 38 + }, + "end": { + "line": 113, + "column": 41 + } + } + }, + "range": [ + 3035, + 3059 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 113, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "key", + "range": [ + 3060, + 3063 + ], + "loc": { + "start": { + "line": 113, + "column": 42 + }, + "end": { + "line": 113, + "column": 45 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "BinaryExpression", + "operator": "+", + "left": { + "type": "Identifier", + "name": "key", + "range": [ + 3086, + 3089 + ], + "loc": { + "start": { + "line": 114, + "column": 17 + }, + "end": { + "line": 114, + "column": 20 + } + } + }, + "right": { + "type": "Literal", + "value": "=", + "raw": "\"=\"", + "range": [ + 3092, + 3095 + ], + "loc": { + "start": { + "line": 114, + "column": 23 + }, + "end": { + "line": 114, + "column": 26 + } + } + }, + "range": [ + 3086, + 3095 + ], + "loc": { + "start": { + "line": 114, + "column": 17 + }, + "end": { + "line": 114, + "column": 26 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "encodeURIComponent", + "range": [ + 3098, + 3116 + ], + "loc": { + "start": { + "line": 114, + "column": 29 + }, + "end": { + "line": 114, + "column": 47 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 3117, + 3124 + ], + "loc": { + "start": { + "line": 114, + "column": 48 + }, + "end": { + "line": 114, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 3125, + 3128 + ], + "loc": { + "start": { + "line": 114, + "column": 56 + }, + "end": { + "line": 114, + "column": 59 + } + } + }, + "range": [ + 3117, + 3129 + ], + "loc": { + "start": { + "line": 114, + "column": 48 + }, + "end": { + "line": 114, + "column": 60 + } + } + } + ], + "range": [ + 3098, + 3130 + ], + "loc": { + "start": { + "line": 114, + "column": 29 + }, + "end": { + "line": 114, + "column": 61 + } + } + }, + "range": [ + 3086, + 3130 + ], + "loc": { + "start": { + "line": 114, + "column": 17 + }, + "end": { + "line": 114, + "column": 61 + } + } + }, + "range": [ + 3079, + 3131 + ], + "loc": { + "start": { + "line": 114, + "column": 10 + }, + "end": { + "line": 114, + "column": 62 + } + } + } + ], + "range": [ + 3067, + 3141 + ], + "loc": { + "start": { + "line": 113, + "column": 49 + }, + "end": { + "line": 115, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3060, + 3141 + ], + "loc": { + "start": { + "line": 113, + "column": 42 + }, + "end": { + "line": 115, + "column": 9 + } + } + } + ], + "range": [ + 3035, + 3142 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 115, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "sort", + "range": [ + 3143, + 3147 + ], + "loc": { + "start": { + "line": 115, + "column": 11 + }, + "end": { + "line": 115, + "column": 15 + } + } + }, + "range": [ + 3035, + 3147 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 115, + "column": 15 + } + } + }, + "arguments": [], + "range": [ + 3035, + 3149 + ], + "loc": { + "start": { + "line": 113, + "column": 17 + }, + "end": { + "line": 115, + "column": 17 + } + } + }, + "range": [ + 3026, + 3149 + ], + "loc": { + "start": { + "line": 113, + "column": 8 + }, + "end": { + "line": 115, + "column": 17 + } + } + }, + "range": [ + 3026, + 3150 + ], + "loc": { + "start": { + "line": 113, + "column": 8 + }, + "end": { + "line": 115, + "column": 18 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "params", + "range": [ + 3164, + 3170 + ], + "loc": { + "start": { + "line": 117, + "column": 12 + }, + "end": { + "line": 117, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "length", + "range": [ + 3171, + 3177 + ], + "loc": { + "start": { + "line": 117, + "column": 19 + }, + "end": { + "line": 117, + "column": 25 + } + } + }, + "range": [ + 3164, + 3177 + ], + "loc": { + "start": { + "line": 117, + "column": 12 + }, + "end": { + "line": 117, + "column": 25 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "url", + "range": [ + 3191, + 3194 + ], + "loc": { + "start": { + "line": 118, + "column": 10 + }, + "end": { + "line": 118, + "column": 13 + } + } + }, + "right": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 3197, + 3200 + ], + "loc": { + "start": { + "line": 118, + "column": 16 + }, + "end": { + "line": 118, + "column": 19 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "?", + "cooked": "?" + }, + "tail": false, + "range": [ + 3203, + 3207 + ], + "loc": { + "start": { + "line": 118, + "column": 22 + }, + "end": { + "line": 118, + "column": 26 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 3223, + 3225 + ], + "loc": { + "start": { + "line": 118, + "column": 42 + }, + "end": { + "line": 118, + "column": 44 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "url", + "range": [ + 3200, + 3203 + ], + "loc": { + "start": { + "line": 118, + "column": 19 + }, + "end": { + "line": 118, + "column": 22 + } + } + }, + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "params", + "range": [ + 3207, + 3213 + ], + "loc": { + "start": { + "line": 118, + "column": 26 + }, + "end": { + "line": 118, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "join", + "range": [ + 3214, + 3218 + ], + "loc": { + "start": { + "line": 118, + "column": 33 + }, + "end": { + "line": 118, + "column": 37 + } + } + }, + "range": [ + 3207, + 3218 + ], + "loc": { + "start": { + "line": 118, + "column": 26 + }, + "end": { + "line": 118, + "column": 37 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "&", + "raw": "\"&\"", + "range": [ + 3219, + 3222 + ], + "loc": { + "start": { + "line": 118, + "column": 38 + }, + "end": { + "line": 118, + "column": 41 + } + } + } + ], + "range": [ + 3207, + 3223 + ], + "loc": { + "start": { + "line": 118, + "column": 26 + }, + "end": { + "line": 118, + "column": 42 + } + } + } + ], + "range": [ + 3197, + 3225 + ], + "loc": { + "start": { + "line": 118, + "column": 16 + }, + "end": { + "line": 118, + "column": 44 + } + } + }, + "range": [ + 3191, + 3225 + ], + "loc": { + "start": { + "line": 118, + "column": 10 + }, + "end": { + "line": 118, + "column": 44 + } + } + }, + "range": [ + 3191, + 3226 + ], + "loc": { + "start": { + "line": 118, + "column": 10 + }, + "end": { + "line": 118, + "column": 45 + } + } + } + ], + "range": [ + 3179, + 3236 + ], + "loc": { + "start": { + "line": 117, + "column": 27 + }, + "end": { + "line": 119, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 3160, + 3236 + ], + "loc": { + "start": { + "line": 117, + "column": 8 + }, + "end": { + "line": 119, + "column": 9 + } + } + } + ], + "range": [ + 2779, + 3245 + ], + "loc": { + "start": { + "line": 102, + "column": 19 + }, + "end": { + "line": 121, + "column": 7 + } + } + }, + "alternate": null, + "range": [ + 2766, + 3245 + ], + "loc": { + "start": { + "line": 102, + "column": 6 + }, + "end": { + "line": 121, + "column": 7 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 3253, + 3260 + ], + "loc": { + "start": { + "line": 123, + "column": 6 + }, + "end": { + "line": 123, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "open", + "range": [ + 3261, + 3265 + ], + "loc": { + "start": { + "line": 123, + "column": 14 + }, + "end": { + "line": 123, + "column": 18 + } + } + }, + "range": [ + 3253, + 3265 + ], + "loc": { + "start": { + "line": 123, + "column": 6 + }, + "end": { + "line": 123, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "GET", + "raw": "'GET'", + "range": [ + 3266, + 3271 + ], + "loc": { + "start": { + "line": 123, + "column": 19 + }, + "end": { + "line": 123, + "column": 24 + } + } + }, + { + "type": "Identifier", + "name": "url", + "range": [ + 3273, + 3276 + ], + "loc": { + "start": { + "line": 123, + "column": 26 + }, + "end": { + "line": 123, + "column": 29 + } + } + }, + { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 3278, + 3282 + ], + "loc": { + "start": { + "line": 123, + "column": 31 + }, + "end": { + "line": 123, + "column": 35 + } + } + } + ], + "range": [ + 3253, + 3283 + ], + "loc": { + "start": { + "line": 123, + "column": 6 + }, + "end": { + "line": 123, + "column": 36 + } + } + }, + "range": [ + 3253, + 3284 + ], + "loc": { + "start": { + "line": 123, + "column": 6 + }, + "end": { + "line": 123, + "column": 37 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 3292, + 3299 + ], + "loc": { + "start": { + "line": 125, + "column": 6 + }, + "end": { + "line": 125, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "onload", + "range": [ + 3300, + 3306 + ], + "loc": { + "start": { + "line": 125, + "column": 14 + }, + "end": { + "line": 125, + "column": 20 + } + } + }, + "range": [ + 3292, + 3306 + ], + "loc": { + "start": { + "line": 125, + "column": 6 + }, + "end": { + "line": 125, + "column": 20 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 3335, + 3342 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 3343, + 3349 + ], + "loc": { + "start": { + "line": 126, + "column": 20 + }, + "end": { + "line": 126, + "column": 26 + } + } + }, + "range": [ + 3335, + 3349 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 26 + } + } + }, + "right": { + "type": "Literal", + "value": 200, + "raw": "200", + "range": [ + 3353, + 3356 + ], + "loc": { + "start": { + "line": 126, + "column": 30 + }, + "end": { + "line": 126, + "column": 33 + } + } + }, + "range": [ + 3335, + 3356 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 33 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 3360, + 3367 + ], + "loc": { + "start": { + "line": 126, + "column": 37 + }, + "end": { + "line": 126, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 3368, + 3374 + ], + "loc": { + "start": { + "line": 126, + "column": 45 + }, + "end": { + "line": 126, + "column": 51 + } + } + }, + "range": [ + 3360, + 3374 + ], + "loc": { + "start": { + "line": 126, + "column": 37 + }, + "end": { + "line": 126, + "column": 51 + } + } + }, + "right": { + "type": "Literal", + "value": 300, + "raw": "300", + "range": [ + 3377, + 3380 + ], + "loc": { + "start": { + "line": 126, + "column": 54 + }, + "end": { + "line": 126, + "column": 57 + } + } + }, + "range": [ + 3360, + 3380 + ], + "loc": { + "start": { + "line": 126, + "column": 37 + }, + "end": { + "line": 126, + "column": 57 + } + } + }, + "range": [ + 3335, + 3380 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 57 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 3412, + 3417 + ], + "loc": { + "start": { + "line": 128, + "column": 12 + }, + "end": { + "line": 128, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 3418, + 3422 + ], + "loc": { + "start": { + "line": 128, + "column": 18 + }, + "end": { + "line": 128, + "column": 22 + } + } + }, + "range": [ + 3412, + 3422 + ], + "loc": { + "start": { + "line": 128, + "column": 12 + }, + "end": { + "line": 128, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "JSON", + "range": [ + 3423, + 3427 + ], + "loc": { + "start": { + "line": 128, + "column": 23 + }, + "end": { + "line": 128, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "parse", + "range": [ + 3428, + 3433 + ], + "loc": { + "start": { + "line": 128, + "column": 28 + }, + "end": { + "line": 128, + "column": 33 + } + } + }, + "range": [ + 3423, + 3433 + ], + "loc": { + "start": { + "line": 128, + "column": 23 + }, + "end": { + "line": 128, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 3434, + 3441 + ], + "loc": { + "start": { + "line": 128, + "column": 34 + }, + "end": { + "line": 128, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "responseText", + "range": [ + 3442, + 3454 + ], + "loc": { + "start": { + "line": 128, + "column": 42 + }, + "end": { + "line": 128, + "column": 54 + } + } + }, + "range": [ + 3434, + 3454 + ], + "loc": { + "start": { + "line": 128, + "column": 34 + }, + "end": { + "line": 128, + "column": 54 + } + } + } + ], + "range": [ + 3423, + 3455 + ], + "loc": { + "start": { + "line": 128, + "column": 23 + }, + "end": { + "line": 128, + "column": 55 + } + } + } + ], + "range": [ + 3412, + 3456 + ], + "loc": { + "start": { + "line": 128, + "column": 12 + }, + "end": { + "line": 128, + "column": 56 + } + } + }, + "range": [ + 3412, + 3457 + ], + "loc": { + "start": { + "line": 128, + "column": 12 + }, + "end": { + "line": 128, + "column": 57 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "success", + "range": [ + 3474, + 3481 + ], + "loc": { + "start": { + "line": 129, + "column": 16 + }, + "end": { + "line": 129, + "column": 23 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "success", + "range": [ + 3499, + 3506 + ], + "loc": { + "start": { + "line": 130, + "column": 14 + }, + "end": { + "line": 130, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 3507, + 3511 + ], + "loc": { + "start": { + "line": 130, + "column": 22 + }, + "end": { + "line": 130, + "column": 26 + } + } + }, + "range": [ + 3499, + 3511 + ], + "loc": { + "start": { + "line": 130, + "column": 14 + }, + "end": { + "line": 130, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 3512, + 3519 + ], + "loc": { + "start": { + "line": 130, + "column": 27 + }, + "end": { + "line": 130, + "column": 34 + } + } + }, + { + "type": "ConditionalExpression", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 3521, + 3523 + ], + "loc": { + "start": { + "line": 130, + "column": 36 + }, + "end": { + "line": 130, + "column": 38 + } + } + }, + "consequent": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 3526, + 3531 + ], + "loc": { + "start": { + "line": 130, + "column": 41 + }, + "end": { + "line": 130, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 3532, + 3536 + ], + "loc": { + "start": { + "line": 130, + "column": 47 + }, + "end": { + "line": 130, + "column": 51 + } + } + }, + "range": [ + 3526, + 3536 + ], + "loc": { + "start": { + "line": 130, + "column": 41 + }, + "end": { + "line": 130, + "column": 51 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 3537, + 3541 + ], + "loc": { + "start": { + "line": 130, + "column": 52 + }, + "end": { + "line": 130, + "column": 56 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 3543, + 3545 + ], + "loc": { + "start": { + "line": 130, + "column": 58 + }, + "end": { + "line": 130, + "column": 60 + } + } + } + ], + "range": [ + 3526, + 3546 + ], + "loc": { + "start": { + "line": 130, + "column": 41 + }, + "end": { + "line": 130, + "column": 61 + } + } + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 3549, + 3554 + ], + "loc": { + "start": { + "line": 130, + "column": 64 + }, + "end": { + "line": 130, + "column": 69 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 3555, + 3559 + ], + "loc": { + "start": { + "line": 130, + "column": 70 + }, + "end": { + "line": 130, + "column": 74 + } + } + }, + "range": [ + 3549, + 3559 + ], + "loc": { + "start": { + "line": 130, + "column": 64 + }, + "end": { + "line": 130, + "column": 74 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 3560, + 3564 + ], + "loc": { + "start": { + "line": 130, + "column": 75 + }, + "end": { + "line": 130, + "column": 79 + } + } + } + ], + "range": [ + 3549, + 3565 + ], + "loc": { + "start": { + "line": 130, + "column": 64 + }, + "end": { + "line": 130, + "column": 80 + } + } + }, + "range": [ + 3521, + 3565 + ], + "loc": { + "start": { + "line": 130, + "column": 36 + }, + "end": { + "line": 130, + "column": 80 + } + } + } + ], + "range": [ + 3499, + 3566 + ], + "loc": { + "start": { + "line": 130, + "column": 14 + }, + "end": { + "line": 130, + "column": 81 + } + } + }, + "range": [ + 3499, + 3567 + ], + "loc": { + "start": { + "line": 130, + "column": 14 + }, + "end": { + "line": 130, + "column": 82 + } + } + } + ], + "range": [ + 3483, + 3581 + ], + "loc": { + "start": { + "line": 129, + "column": 25 + }, + "end": { + "line": 131, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 3470, + 3581 + ], + "loc": { + "start": { + "line": 129, + "column": 12 + }, + "end": { + "line": 131, + "column": 13 + } + } + } + ], + "range": [ + 3398, + 3593 + ], + "loc": { + "start": { + "line": 127, + "column": 14 + }, + "end": { + "line": 132, + "column": 11 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 3601, + 3602 + ], + "loc": { + "start": { + "line": 132, + "column": 19 + }, + "end": { + "line": 132, + "column": 20 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 3618, + 3623 + ], + "loc": { + "start": { + "line": 133, + "column": 12 + }, + "end": { + "line": 133, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 3624, + 3628 + ], + "loc": { + "start": { + "line": 133, + "column": 18 + }, + "end": { + "line": 133, + "column": 22 + } + } + }, + "range": [ + 3618, + 3628 + ], + "loc": { + "start": { + "line": 133, + "column": 12 + }, + "end": { + "line": 133, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3629, + 3631 + ], + "loc": { + "start": { + "line": 133, + "column": 23 + }, + "end": { + "line": 133, + "column": 25 + } + } + }, + { + "type": "Identifier", + "name": "e", + "range": [ + 3633, + 3634 + ], + "loc": { + "start": { + "line": 133, + "column": 27 + }, + "end": { + "line": 133, + "column": 28 + } + } + } + ], + "range": [ + 3618, + 3635 + ], + "loc": { + "start": { + "line": 133, + "column": 12 + }, + "end": { + "line": 133, + "column": 29 + } + } + }, + "range": [ + 3618, + 3636 + ], + "loc": { + "start": { + "line": 133, + "column": 12 + }, + "end": { + "line": 133, + "column": 30 + } + } + } + ], + "range": [ + 3604, + 3648 + ], + "loc": { + "start": { + "line": 132, + "column": 22 + }, + "end": { + "line": 134, + "column": 11 + } + } + }, + "range": [ + 3594, + 3648 + ], + "loc": { + "start": { + "line": 132, + "column": 12 + }, + "end": { + "line": 134, + "column": 11 + } + } + }, + "finalizer": null, + "range": [ + 3394, + 3648 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 134, + "column": 11 + } + } + } + ], + "range": [ + 3382, + 3658 + ], + "loc": { + "start": { + "line": 126, + "column": 59 + }, + "end": { + "line": 135, + "column": 9 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "error", + "range": [ + 3668, + 3673 + ], + "loc": { + "start": { + "line": 135, + "column": 19 + }, + "end": { + "line": 135, + "column": 24 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 3687, + 3692 + ], + "loc": { + "start": { + "line": 136, + "column": 10 + }, + "end": { + "line": 136, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 3693, + 3697 + ], + "loc": { + "start": { + "line": 136, + "column": 16 + }, + "end": { + "line": 136, + "column": 20 + } + } + }, + "range": [ + 3687, + 3697 + ], + "loc": { + "start": { + "line": 136, + "column": 10 + }, + "end": { + "line": 136, + "column": 20 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 3698, + 3705 + ], + "loc": { + "start": { + "line": 136, + "column": 21 + }, + "end": { + "line": 136, + "column": 28 + } + } + } + ], + "range": [ + 3687, + 3706 + ], + "loc": { + "start": { + "line": 136, + "column": 10 + }, + "end": { + "line": 136, + "column": 29 + } + } + }, + "range": [ + 3687, + 3707 + ], + "loc": { + "start": { + "line": 136, + "column": 10 + }, + "end": { + "line": 136, + "column": 30 + } + } + } + ], + "range": [ + 3675, + 3717 + ], + "loc": { + "start": { + "line": 135, + "column": 26 + }, + "end": { + "line": 137, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 3664, + 3717 + ], + "loc": { + "start": { + "line": 135, + "column": 15 + }, + "end": { + "line": 137, + "column": 9 + } + } + }, + "range": [ + 3331, + 3717 + ], + "loc": { + "start": { + "line": 126, + "column": 8 + }, + "end": { + "line": 137, + "column": 9 + } + } + } + ], + "range": [ + 3321, + 3725 + ], + "loc": { + "start": { + "line": 125, + "column": 35 + }, + "end": { + "line": 138, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3309, + 3725 + ], + "loc": { + "start": { + "line": 125, + "column": 23 + }, + "end": { + "line": 138, + "column": 7 + } + } + }, + "range": [ + 3292, + 3725 + ], + "loc": { + "start": { + "line": 125, + "column": 6 + }, + "end": { + "line": 138, + "column": 7 + } + } + }, + "range": [ + 3292, + 3726 + ], + "loc": { + "start": { + "line": 125, + "column": 6 + }, + "end": { + "line": 138, + "column": 8 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 3734, + 3741 + ], + "loc": { + "start": { + "line": 140, + "column": 6 + }, + "end": { + "line": 140, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "send", + "range": [ + 3742, + 3746 + ], + "loc": { + "start": { + "line": 140, + "column": 14 + }, + "end": { + "line": 140, + "column": 18 + } + } + }, + "range": [ + 3734, + 3746 + ], + "loc": { + "start": { + "line": 140, + "column": 6 + }, + "end": { + "line": 140, + "column": 18 + } + } + }, + "arguments": [], + "range": [ + 3734, + 3748 + ], + "loc": { + "start": { + "line": 140, + "column": 6 + }, + "end": { + "line": 140, + "column": 20 + } + } + }, + "range": [ + 3734, + 3749 + ], + "loc": { + "start": { + "line": 140, + "column": 6 + }, + "end": { + "line": 140, + "column": 21 + } + } + } + ], + "range": [ + 2593, + 3756 + ], + "loc": { + "start": { + "line": 94, + "column": 35 + }, + "end": { + "line": 142, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 3780, + 3785 + ], + "loc": { + "start": { + "line": 143, + "column": 16 + }, + "end": { + "line": 143, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 3786, + 3803 + ], + "loc": { + "start": { + "line": 143, + "column": 22 + }, + "end": { + "line": 143, + "column": 39 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 3807, + 3810 + ], + "loc": { + "start": { + "line": 143, + "column": 43 + }, + "end": { + "line": 143, + "column": 46 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 3803, + 3807 + ], + "loc": { + "start": { + "line": 143, + "column": 39 + }, + "end": { + "line": 143, + "column": 43 + } + } + } + ], + "range": [ + 3786, + 3810 + ], + "loc": { + "start": { + "line": 143, + "column": 22 + }, + "end": { + "line": 143, + "column": 46 + } + } + } + ], + "range": [ + 3776, + 3811 + ], + "loc": { + "start": { + "line": 143, + "column": 12 + }, + "end": { + "line": 143, + "column": 47 + } + } + }, + "range": [ + 3770, + 3812 + ], + "loc": { + "start": { + "line": 143, + "column": 6 + }, + "end": { + "line": 143, + "column": 48 + } + } + } + ], + "range": [ + 3762, + 3818 + ], + "loc": { + "start": { + "line": 142, + "column": 11 + }, + "end": { + "line": 144, + "column": 5 + } + } + }, + "range": [ + 2569, + 3818 + ], + "loc": { + "start": { + "line": 94, + "column": 11 + }, + "end": { + "line": 144, + "column": 5 + } + } + }, + "range": [ + 2429, + 3818 + ], + "loc": { + "start": { + "line": 92, + "column": 11 + }, + "end": { + "line": 144, + "column": 5 + } + } + }, + "range": [ + 2287, + 3818 + ], + "loc": { + "start": { + "line": 90, + "column": 11 + }, + "end": { + "line": 144, + "column": 5 + } + } + }, + "range": [ + 2175, + 3818 + ], + "loc": { + "start": { + "line": 88, + "column": 11 + }, + "end": { + "line": 144, + "column": 5 + } + } + }, + "range": [ + 2042, + 3818 + ], + "loc": { + "start": { + "line": 86, + "column": 4 + }, + "end": { + "line": 144, + "column": 5 + } + } + } + ], + "range": [ + 2035, + 3823 + ], + "loc": { + "start": { + "line": 84, + "column": 58 + }, + "end": { + "line": 146, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1983, + 3823 + ], + "loc": { + "start": { + "line": 84, + "column": 6 + }, + "end": { + "line": 146, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 1979, + 3823 + ], + "loc": { + "start": { + "line": 84, + "column": 2 + }, + "end": { + "line": 146, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "update", + "range": [ + 3827, + 3833 + ], + "loc": { + "start": { + "line": 148, + "column": 2 + }, + "end": { + "line": 148, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 3834, + 3839 + ], + "loc": { + "start": { + "line": 148, + "column": 9 + }, + "end": { + "line": 148, + "column": 14 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 3841, + 3845 + ], + "loc": { + "start": { + "line": 148, + "column": 16 + }, + "end": { + "line": 148, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 3847, + 3849 + ], + "loc": { + "start": { + "line": 148, + "column": 22 + }, + "end": { + "line": 148, + "column": 24 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 3851, + 3858 + ], + "loc": { + "start": { + "line": 148, + "column": 26 + }, + "end": { + "line": 148, + "column": 33 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 3860, + 3867 + ], + "loc": { + "start": { + "line": 148, + "column": 35 + }, + "end": { + "line": 148, + "column": 42 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 3869, + 3874 + ], + "loc": { + "start": { + "line": 148, + "column": 44 + }, + "end": { + "line": 148, + "column": 49 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 3876, + 3883 + ], + "loc": { + "start": { + "line": 148, + "column": 51 + }, + "end": { + "line": 148, + "column": 58 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "error", + "range": [ + 3896, + 3901 + ], + "loc": { + "start": { + "line": 150, + "column": 8 + }, + "end": { + "line": 150, + "column": 13 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3905, + 3907 + ], + "loc": { + "start": { + "line": 150, + "column": 17 + }, + "end": { + "line": 150, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 3908, + 3916 + ], + "loc": { + "start": { + "line": 150, + "column": 20 + }, + "end": { + "line": 150, + "column": 28 + } + } + }, + "range": [ + 3905, + 3916 + ], + "loc": { + "start": { + "line": 150, + "column": 17 + }, + "end": { + "line": 150, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 3917, + 3921 + ], + "loc": { + "start": { + "line": 150, + "column": 29 + }, + "end": { + "line": 150, + "column": 33 + } + } + }, + "range": [ + 3905, + 3921 + ], + "loc": { + "start": { + "line": 150, + "column": 17 + }, + "end": { + "line": 150, + "column": 33 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "error", + "range": [ + 3922, + 3927 + ], + "loc": { + "start": { + "line": 150, + "column": 34 + }, + "end": { + "line": 150, + "column": 39 + } + } + } + ], + "range": [ + 3905, + 3928 + ], + "loc": { + "start": { + "line": 150, + "column": 17 + }, + "end": { + "line": 150, + "column": 40 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 3933, + 3952 + ], + "loc": { + "start": { + "line": 150, + "column": 45 + }, + "end": { + "line": 150, + "column": 64 + } + } + }, + "range": [ + 3905, + 3952 + ], + "loc": { + "start": { + "line": 150, + "column": 17 + }, + "end": { + "line": 150, + "column": 64 + } + } + }, + "range": [ + 3896, + 3952 + ], + "loc": { + "start": { + "line": 150, + "column": 8 + }, + "end": { + "line": 150, + "column": 64 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3963, + 3967 + ], + "loc": { + "start": { + "line": 152, + "column": 6 + }, + "end": { + "line": 152, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "update", + "range": [ + 3968, + 3974 + ], + "loc": { + "start": { + "line": 152, + "column": 11 + }, + "end": { + "line": 152, + "column": 17 + } + } + }, + "range": [ + 3963, + 3974 + ], + "loc": { + "start": { + "line": 152, + "column": 6 + }, + "end": { + "line": 152, + "column": 17 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "store", + "range": [ + 3975, + 3980 + ], + "loc": { + "start": { + "line": 152, + "column": 18 + }, + "end": { + "line": 152, + "column": 23 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 3982, + 3986 + ], + "loc": { + "start": { + "line": 152, + "column": 25 + }, + "end": { + "line": 152, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 3988, + 3990 + ], + "loc": { + "start": { + "line": 152, + "column": 31 + }, + "end": { + "line": 152, + "column": 33 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 3992, + 3999 + ], + "loc": { + "start": { + "line": 152, + "column": 35 + }, + "end": { + "line": 152, + "column": 42 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 4001, + 4008 + ], + "loc": { + "start": { + "line": 152, + "column": 44 + }, + "end": { + "line": 152, + "column": 51 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 4010, + 4014 + ], + "loc": { + "start": { + "line": 152, + "column": 53 + }, + "end": { + "line": 152, + "column": 57 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 4016, + 4021 + ], + "loc": { + "start": { + "line": 152, + "column": 59 + }, + "end": { + "line": 152, + "column": 64 + } + } + } + ], + "range": [ + 3963, + 4022 + ], + "loc": { + "start": { + "line": 152, + "column": 6 + }, + "end": { + "line": 152, + "column": 65 + } + } + }, + "range": [ + 3963, + 4023 + ], + "loc": { + "start": { + "line": 152, + "column": 6 + }, + "end": { + "line": 152, + "column": 66 + } + } + } + ], + "range": [ + 3954, + 4030 + ], + "loc": { + "start": { + "line": 150, + "column": 66 + }, + "end": { + "line": 154, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 4040, + 4045 + ], + "loc": { + "start": { + "line": 154, + "column": 15 + }, + "end": { + "line": 154, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 4046, + 4052 + ], + "loc": { + "start": { + "line": 154, + "column": 21 + }, + "end": { + "line": 154, + "column": 27 + } + } + }, + "range": [ + 4040, + 4052 + ], + "loc": { + "start": { + "line": 154, + "column": 15 + }, + "end": { + "line": 154, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4053, + 4057 + ], + "loc": { + "start": { + "line": 154, + "column": 28 + }, + "end": { + "line": 154, + "column": 32 + } + } + }, + "range": [ + 4040, + 4058 + ], + "loc": { + "start": { + "line": 154, + "column": 15 + }, + "end": { + "line": 154, + "column": 33 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "request", + "range": [ + 4073, + 4080 + ], + "loc": { + "start": { + "line": 156, + "column": 10 + }, + "end": { + "line": 156, + "column": 17 + } + } + }, + "init": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "XMLHttpRequest", + "range": [ + 4087, + 4101 + ], + "loc": { + "start": { + "line": 156, + "column": 24 + }, + "end": { + "line": 156, + "column": 38 + } + } + }, + "arguments": [], + "range": [ + 4083, + 4103 + ], + "loc": { + "start": { + "line": 156, + "column": 20 + }, + "end": { + "line": 156, + "column": 40 + } + } + }, + "range": [ + 4073, + 4103 + ], + "loc": { + "start": { + "line": 156, + "column": 10 + }, + "end": { + "line": 156, + "column": 40 + } + } + } + ], + "kind": "let", + "range": [ + 4069, + 4104 + ], + "loc": { + "start": { + "line": 156, + "column": 6 + }, + "end": { + "line": 156, + "column": 41 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "data", + "range": [ + 4115, + 4119 + ], + "loc": { + "start": { + "line": 157, + "column": 10 + }, + "end": { + "line": 157, + "column": 14 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 4122, + 4127 + ], + "loc": { + "start": { + "line": 157, + "column": 17 + }, + "end": { + "line": 157, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "convert", + "range": [ + 4128, + 4135 + ], + "loc": { + "start": { + "line": 157, + "column": 23 + }, + "end": { + "line": 157, + "column": 30 + } + } + }, + "range": [ + 4122, + 4135 + ], + "loc": { + "start": { + "line": 157, + "column": 17 + }, + "end": { + "line": 157, + "column": 30 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 4136, + 4140 + ], + "loc": { + "start": { + "line": 157, + "column": 31 + }, + "end": { + "line": 157, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 4142, + 4144 + ], + "loc": { + "start": { + "line": 157, + "column": 37 + }, + "end": { + "line": 157, + "column": 39 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 4146, + 4153 + ], + "loc": { + "start": { + "line": 157, + "column": 41 + }, + "end": { + "line": 157, + "column": 48 + } + } + } + ], + "range": [ + 4122, + 4154 + ], + "loc": { + "start": { + "line": 157, + "column": 17 + }, + "end": { + "line": 157, + "column": 49 + } + } + }, + "range": [ + 4115, + 4154 + ], + "loc": { + "start": { + "line": 157, + "column": 10 + }, + "end": { + "line": 157, + "column": 49 + } + } + } + ], + "kind": "let", + "range": [ + 4111, + 4155 + ], + "loc": { + "start": { + "line": 157, + "column": 6 + }, + "end": { + "line": 157, + "column": 50 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 4163, + 4170 + ], + "loc": { + "start": { + "line": 159, + "column": 6 + }, + "end": { + "line": 159, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "open", + "range": [ + 4171, + 4175 + ], + "loc": { + "start": { + "line": 159, + "column": 14 + }, + "end": { + "line": 159, + "column": 18 + } + } + }, + "range": [ + 4163, + 4175 + ], + "loc": { + "start": { + "line": 159, + "column": 6 + }, + "end": { + "line": 159, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "PATCH", + "raw": "'PATCH'", + "range": [ + 4176, + 4183 + ], + "loc": { + "start": { + "line": 159, + "column": 19 + }, + "end": { + "line": 159, + "column": 26 + } + } + }, + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": false, + "range": [ + 4185, + 4188 + ], + "loc": { + "start": { + "line": 159, + "column": 28 + }, + "end": { + "line": 159, + "column": 31 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 4198, + 4202 + ], + "loc": { + "start": { + "line": 159, + "column": 41 + }, + "end": { + "line": 159, + "column": 45 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "/", + "cooked": "/" + }, + "tail": false, + "range": [ + 4206, + 4210 + ], + "loc": { + "start": { + "line": 159, + "column": 49 + }, + "end": { + "line": 159, + "column": 53 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "", + "cooked": "" + }, + "tail": true, + "range": [ + 4212, + 4214 + ], + "loc": { + "start": { + "line": 159, + "column": 55 + }, + "end": { + "line": 159, + "column": 57 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 4188, + 4192 + ], + "loc": { + "start": { + "line": 159, + "column": 31 + }, + "end": { + "line": 159, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "_base", + "range": [ + 4193, + 4198 + ], + "loc": { + "start": { + "line": 159, + "column": 36 + }, + "end": { + "line": 159, + "column": 41 + } + } + }, + "range": [ + 4188, + 4198 + ], + "loc": { + "start": { + "line": 159, + "column": 31 + }, + "end": { + "line": 159, + "column": 41 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 4202, + 4206 + ], + "loc": { + "start": { + "line": 159, + "column": 45 + }, + "end": { + "line": 159, + "column": 49 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 4210, + 4212 + ], + "loc": { + "start": { + "line": 159, + "column": 53 + }, + "end": { + "line": 159, + "column": 55 + } + } + } + ], + "range": [ + 4185, + 4214 + ], + "loc": { + "start": { + "line": 159, + "column": 28 + }, + "end": { + "line": 159, + "column": 57 + } + } + }, + { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 4216, + 4220 + ], + "loc": { + "start": { + "line": 159, + "column": 59 + }, + "end": { + "line": 159, + "column": 63 + } + } + } + ], + "range": [ + 4163, + 4221 + ], + "loc": { + "start": { + "line": 159, + "column": 6 + }, + "end": { + "line": 159, + "column": 64 + } + } + }, + "range": [ + 4163, + 4222 + ], + "loc": { + "start": { + "line": 159, + "column": 6 + }, + "end": { + "line": 159, + "column": 65 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 4230, + 4237 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 161, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "onload", + "range": [ + 4238, + 4244 + ], + "loc": { + "start": { + "line": 161, + "column": 14 + }, + "end": { + "line": 161, + "column": 20 + } + } + }, + "range": [ + 4230, + 4244 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 161, + "column": 20 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 4273, + 4280 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 4281, + 4287 + ], + "loc": { + "start": { + "line": 162, + "column": 20 + }, + "end": { + "line": 162, + "column": 26 + } + } + }, + "range": [ + 4273, + 4287 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 26 + } + } + }, + "right": { + "type": "Literal", + "value": 200, + "raw": "200", + "range": [ + 4291, + 4294 + ], + "loc": { + "start": { + "line": 162, + "column": 30 + }, + "end": { + "line": 162, + "column": 33 + } + } + }, + "range": [ + 4273, + 4294 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 33 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 4298, + 4305 + ], + "loc": { + "start": { + "line": 162, + "column": 37 + }, + "end": { + "line": 162, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "status", + "range": [ + 4306, + 4312 + ], + "loc": { + "start": { + "line": 162, + "column": 45 + }, + "end": { + "line": 162, + "column": 51 + } + } + }, + "range": [ + 4298, + 4312 + ], + "loc": { + "start": { + "line": 162, + "column": 37 + }, + "end": { + "line": 162, + "column": 51 + } + } + }, + "right": { + "type": "Literal", + "value": 300, + "raw": "300", + "range": [ + 4315, + 4318 + ], + "loc": { + "start": { + "line": 162, + "column": 54 + }, + "end": { + "line": 162, + "column": 57 + } + } + }, + "range": [ + 4298, + 4318 + ], + "loc": { + "start": { + "line": 162, + "column": 37 + }, + "end": { + "line": 162, + "column": 57 + } + } + }, + "range": [ + 4273, + 4318 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 57 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "TryStatement", + "block": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 4350, + 4355 + ], + "loc": { + "start": { + "line": 164, + "column": 12 + }, + "end": { + "line": 164, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "add", + "range": [ + 4356, + 4359 + ], + "loc": { + "start": { + "line": 164, + "column": 18 + }, + "end": { + "line": 164, + "column": 21 + } + } + }, + "range": [ + 4350, + 4359 + ], + "loc": { + "start": { + "line": 164, + "column": 12 + }, + "end": { + "line": 164, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 4360, + 4364 + ], + "loc": { + "start": { + "line": 164, + "column": 22 + }, + "end": { + "line": 164, + "column": 26 + } + } + } + ], + "range": [ + 4350, + 4365 + ], + "loc": { + "start": { + "line": 164, + "column": 12 + }, + "end": { + "line": 164, + "column": 27 + } + } + }, + "range": [ + 4350, + 4366 + ], + "loc": { + "start": { + "line": 164, + "column": 12 + }, + "end": { + "line": 164, + "column": 28 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "success", + "range": [ + 4383, + 4390 + ], + "loc": { + "start": { + "line": 165, + "column": 16 + }, + "end": { + "line": 165, + "column": 23 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "success", + "range": [ + 4408, + 4415 + ], + "loc": { + "start": { + "line": 166, + "column": 14 + }, + "end": { + "line": 166, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 4416, + 4420 + ], + "loc": { + "start": { + "line": 166, + "column": 22 + }, + "end": { + "line": 166, + "column": 26 + } + } + }, + "range": [ + 4408, + 4420 + ], + "loc": { + "start": { + "line": 166, + "column": 14 + }, + "end": { + "line": 166, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 4421, + 4428 + ], + "loc": { + "start": { + "line": 166, + "column": 27 + }, + "end": { + "line": 166, + "column": 34 + } + } + }, + { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "store", + "range": [ + 4430, + 4435 + ], + "loc": { + "start": { + "line": 166, + "column": 36 + }, + "end": { + "line": 166, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 4436, + 4440 + ], + "loc": { + "start": { + "line": 166, + "column": 42 + }, + "end": { + "line": 166, + "column": 46 + } + } + }, + "range": [ + 4430, + 4440 + ], + "loc": { + "start": { + "line": 166, + "column": 36 + }, + "end": { + "line": 166, + "column": 46 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 4441, + 4445 + ], + "loc": { + "start": { + "line": 166, + "column": 47 + }, + "end": { + "line": 166, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4446, + 4450 + ], + "loc": { + "start": { + "line": 166, + "column": 52 + }, + "end": { + "line": 166, + "column": 56 + } + } + }, + "range": [ + 4441, + 4450 + ], + "loc": { + "start": { + "line": 166, + "column": 47 + }, + "end": { + "line": 166, + "column": 56 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 4452, + 4456 + ], + "loc": { + "start": { + "line": 166, + "column": 58 + }, + "end": { + "line": 166, + "column": 62 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 4457, + 4459 + ], + "loc": { + "start": { + "line": 166, + "column": 63 + }, + "end": { + "line": 166, + "column": 65 + } + } + }, + "range": [ + 4452, + 4459 + ], + "loc": { + "start": { + "line": 166, + "column": 58 + }, + "end": { + "line": 166, + "column": 65 + } + } + } + ], + "range": [ + 4430, + 4460 + ], + "loc": { + "start": { + "line": 166, + "column": 36 + }, + "end": { + "line": 166, + "column": 66 + } + } + } + ], + "range": [ + 4408, + 4461 + ], + "loc": { + "start": { + "line": 166, + "column": 14 + }, + "end": { + "line": 166, + "column": 67 + } + } + }, + "range": [ + 4408, + 4462 + ], + "loc": { + "start": { + "line": 166, + "column": 14 + }, + "end": { + "line": 166, + "column": 68 + } + } + } + ], + "range": [ + 4392, + 4476 + ], + "loc": { + "start": { + "line": 165, + "column": 25 + }, + "end": { + "line": 167, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 4379, + 4476 + ], + "loc": { + "start": { + "line": 165, + "column": 12 + }, + "end": { + "line": 167, + "column": 13 + } + } + } + ], + "range": [ + 4336, + 4488 + ], + "loc": { + "start": { + "line": 163, + "column": 14 + }, + "end": { + "line": 168, + "column": 11 + } + } + }, + "handler": { + "type": "CatchClause", + "param": { + "type": "Identifier", + "name": "e", + "range": [ + 4496, + 4497 + ], + "loc": { + "start": { + "line": 168, + "column": 19 + }, + "end": { + "line": 168, + "column": 20 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "error", + "range": [ + 4517, + 4522 + ], + "loc": { + "start": { + "line": 169, + "column": 16 + }, + "end": { + "line": 169, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 4540, + 4545 + ], + "loc": { + "start": { + "line": 170, + "column": 14 + }, + "end": { + "line": 170, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 4546, + 4550 + ], + "loc": { + "start": { + "line": 170, + "column": 20 + }, + "end": { + "line": 170, + "column": 24 + } + } + }, + "range": [ + 4540, + 4550 + ], + "loc": { + "start": { + "line": 170, + "column": 14 + }, + "end": { + "line": 170, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 4551, + 4558 + ], + "loc": { + "start": { + "line": 170, + "column": 25 + }, + "end": { + "line": 170, + "column": 32 + } + } + }, + { + "type": "Identifier", + "name": "e", + "range": [ + 4560, + 4561 + ], + "loc": { + "start": { + "line": 170, + "column": 34 + }, + "end": { + "line": 170, + "column": 35 + } + } + } + ], + "range": [ + 4540, + 4562 + ], + "loc": { + "start": { + "line": 170, + "column": 14 + }, + "end": { + "line": 170, + "column": 36 + } + } + }, + "range": [ + 4540, + 4563 + ], + "loc": { + "start": { + "line": 170, + "column": 14 + }, + "end": { + "line": 170, + "column": 37 + } + } + } + ], + "range": [ + 4524, + 4577 + ], + "loc": { + "start": { + "line": 169, + "column": 23 + }, + "end": { + "line": 171, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 4513, + 4577 + ], + "loc": { + "start": { + "line": 169, + "column": 12 + }, + "end": { + "line": 171, + "column": 13 + } + } + } + ], + "range": [ + 4499, + 4589 + ], + "loc": { + "start": { + "line": 168, + "column": 22 + }, + "end": { + "line": 172, + "column": 11 + } + } + }, + "range": [ + 4489, + 4589 + ], + "loc": { + "start": { + "line": 168, + "column": 12 + }, + "end": { + "line": 172, + "column": 11 + } + } + }, + "finalizer": null, + "range": [ + 4332, + 4589 + ], + "loc": { + "start": { + "line": 163, + "column": 10 + }, + "end": { + "line": 172, + "column": 11 + } + } + } + ], + "range": [ + 4320, + 4599 + ], + "loc": { + "start": { + "line": 162, + "column": 59 + }, + "end": { + "line": 173, + "column": 9 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "error", + "range": [ + 4609, + 4614 + ], + "loc": { + "start": { + "line": 173, + "column": 19 + }, + "end": { + "line": 173, + "column": 24 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "error", + "range": [ + 4628, + 4633 + ], + "loc": { + "start": { + "line": 174, + "column": 10 + }, + "end": { + "line": 174, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 4634, + 4638 + ], + "loc": { + "start": { + "line": 174, + "column": 16 + }, + "end": { + "line": 174, + "column": 20 + } + } + }, + "range": [ + 4628, + 4638 + ], + "loc": { + "start": { + "line": 174, + "column": 10 + }, + "end": { + "line": 174, + "column": 20 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "context", + "range": [ + 4639, + 4646 + ], + "loc": { + "start": { + "line": 174, + "column": 21 + }, + "end": { + "line": 174, + "column": 28 + } + } + } + ], + "range": [ + 4628, + 4647 + ], + "loc": { + "start": { + "line": 174, + "column": 10 + }, + "end": { + "line": 174, + "column": 29 + } + } + }, + "range": [ + 4628, + 4648 + ], + "loc": { + "start": { + "line": 174, + "column": 10 + }, + "end": { + "line": 174, + "column": 30 + } + } + } + ], + "range": [ + 4616, + 4658 + ], + "loc": { + "start": { + "line": 173, + "column": 26 + }, + "end": { + "line": 175, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 4605, + 4658 + ], + "loc": { + "start": { + "line": 173, + "column": 15 + }, + "end": { + "line": 175, + "column": 9 + } + } + }, + "range": [ + 4269, + 4658 + ], + "loc": { + "start": { + "line": 162, + "column": 8 + }, + "end": { + "line": 175, + "column": 9 + } + } + } + ], + "range": [ + 4259, + 4666 + ], + "loc": { + "start": { + "line": 161, + "column": 35 + }, + "end": { + "line": 176, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4247, + 4666 + ], + "loc": { + "start": { + "line": 161, + "column": 23 + }, + "end": { + "line": 176, + "column": 7 + } + } + }, + "range": [ + 4230, + 4666 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 176, + "column": 7 + } + } + }, + "range": [ + 4230, + 4667 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 176, + "column": 8 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "request", + "range": [ + 4675, + 4682 + ], + "loc": { + "start": { + "line": 178, + "column": 6 + }, + "end": { + "line": 178, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "send", + "range": [ + 4683, + 4687 + ], + "loc": { + "start": { + "line": 178, + "column": 14 + }, + "end": { + "line": 178, + "column": 18 + } + } + }, + "range": [ + 4675, + 4687 + ], + "loc": { + "start": { + "line": 178, + "column": 6 + }, + "end": { + "line": 178, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "data", + "range": [ + 4698, + 4702 + ], + "loc": { + "start": { + "line": 179, + "column": 8 + }, + "end": { + "line": 179, + "column": 12 + } + } + }, + "value": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "JSON", + "range": [ + 4704, + 4708 + ], + "loc": { + "start": { + "line": 179, + "column": 14 + }, + "end": { + "line": 179, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "stringify", + "range": [ + 4709, + 4718 + ], + "loc": { + "start": { + "line": 179, + "column": 19 + }, + "end": { + "line": 179, + "column": 28 + } + } + }, + "range": [ + 4704, + 4718 + ], + "loc": { + "start": { + "line": 179, + "column": 14 + }, + "end": { + "line": 179, + "column": 28 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 4719, + 4723 + ], + "loc": { + "start": { + "line": 179, + "column": 29 + }, + "end": { + "line": 179, + "column": 33 + } + } + } + ], + "range": [ + 4704, + 4724 + ], + "loc": { + "start": { + "line": 179, + "column": 14 + }, + "end": { + "line": 179, + "column": 34 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 4698, + 4724 + ], + "loc": { + "start": { + "line": 179, + "column": 8 + }, + "end": { + "line": 179, + "column": 34 + } + } + } + ], + "range": [ + 4688, + 4732 + ], + "loc": { + "start": { + "line": 178, + "column": 19 + }, + "end": { + "line": 180, + "column": 7 + } + } + } + ], + "range": [ + 4675, + 4733 + ], + "loc": { + "start": { + "line": 178, + "column": 6 + }, + "end": { + "line": 180, + "column": 8 + } + } + }, + "range": [ + 4675, + 4734 + ], + "loc": { + "start": { + "line": 178, + "column": 6 + }, + "end": { + "line": 180, + "column": 9 + } + } + } + ], + "range": [ + 4060, + 4741 + ], + "loc": { + "start": { + "line": 154, + "column": 35 + }, + "end": { + "line": 182, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 4765, + 4770 + ], + "loc": { + "start": { + "line": 183, + "column": 16 + }, + "end": { + "line": 183, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 4771, + 4788 + ], + "loc": { + "start": { + "line": 183, + "column": 22 + }, + "end": { + "line": 183, + "column": 39 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 4792, + 4795 + ], + "loc": { + "start": { + "line": 183, + "column": 43 + }, + "end": { + "line": 183, + "column": 46 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 4788, + 4792 + ], + "loc": { + "start": { + "line": 183, + "column": 39 + }, + "end": { + "line": 183, + "column": 43 + } + } + } + ], + "range": [ + 4771, + 4795 + ], + "loc": { + "start": { + "line": 183, + "column": 22 + }, + "end": { + "line": 183, + "column": 46 + } + } + } + ], + "range": [ + 4761, + 4796 + ], + "loc": { + "start": { + "line": 183, + "column": 12 + }, + "end": { + "line": 183, + "column": 47 + } + } + }, + "range": [ + 4755, + 4797 + ], + "loc": { + "start": { + "line": 183, + "column": 6 + }, + "end": { + "line": 183, + "column": 48 + } + } + } + ], + "range": [ + 4747, + 4803 + ], + "loc": { + "start": { + "line": 182, + "column": 11 + }, + "end": { + "line": 184, + "column": 5 + } + } + }, + "range": [ + 4036, + 4803 + ], + "loc": { + "start": { + "line": 154, + "column": 11 + }, + "end": { + "line": 184, + "column": 5 + } + } + }, + "range": [ + 3892, + 4803 + ], + "loc": { + "start": { + "line": 150, + "column": 4 + }, + "end": { + "line": 184, + "column": 5 + } + } + } + ], + "range": [ + 3885, + 4808 + ], + "loc": { + "start": { + "line": 148, + "column": 60 + }, + "end": { + "line": 186, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3833, + 4808 + ], + "loc": { + "start": { + "line": 148, + "column": 8 + }, + "end": { + "line": 186, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 3827, + 4808 + ], + "loc": { + "start": { + "line": 148, + "column": 2 + }, + "end": { + "line": 186, + "column": 3 + } + }, + "static": false + } + ], + "range": [ + 33, + 4811 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 188, + "column": 1 + } + } + }, + "range": [ + 15, + 4811 + ], + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 188, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "range": [ + 0, + 4811 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 188, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 4811 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 188, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/docs/v0.5.1/ast/source/src/store.js.json b/docs/v0.5.1/ast/source/src/store.js.json new file mode 100644 index 0000000..00c017d --- /dev/null +++ b/docs/v0.5.1/ast/source/src/store.js.json @@ -0,0 +1,43100 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [], + "source": { + "type": "Literal", + "value": "array.prototype.find", + "raw": "\"array.prototype.find\"", + "range": [ + 7, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "AjaxAdapter", + "range": [ + 38, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + "range": [ + 38, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 18 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./ajax-adapter", + "raw": "\"./ajax-adapter\"", + "range": [ + 55, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "range": [ + 31, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 41 + } + } + }, + { + "type": "ExportDefaultDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "Store", + "range": [ + 95, + 100 + ], + "loc": { + "start": { + "line": 4, + "column": 21 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "attr", + "range": [ + 438, + 442 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 443, + 447 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 449, + 456 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 27 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 468, + 472 + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "name", + "range": [ + 483, + 487 + ], + "loc": { + "start": { + "line": 16, + "column": 23 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "prefix": true, + "range": [ + 476, + 487 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + "right": { + "type": "Literal", + "value": "object", + "raw": "'object'", + "range": [ + 492, + 500 + ], + "loc": { + "start": { + "line": 16, + "column": 32 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + "range": [ + 476, + 500 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + "range": [ + 468, + 500 + ], + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 40 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Store", + "range": [ + 517, + 522 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "attr", + "range": [ + 523, + 527 + ], + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 23 + } + } + }, + "range": [ + 517, + 527 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 528, + 532 + ], + "loc": { + "start": { + "line": 17, + "column": 24 + }, + "end": { + "line": 17, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "name", + "range": [ + 534, + 538 + ], + "loc": { + "start": { + "line": 17, + "column": 30 + }, + "end": { + "line": 17, + "column": 34 + } + } + } + ], + "range": [ + 517, + 539 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 35 + } + } + }, + "range": [ + 510, + 540 + ], + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 36 + } + } + } + ], + "range": [ + 502, + 546 + ], + "loc": { + "start": { + "line": 16, + "column": 42 + }, + "end": { + "line": 18, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 577, + 581 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 12 + } + } + }, + "value": { + "type": "Literal", + "value": "attr", + "raw": "\"attr\"", + "range": [ + 583, + 589 + ], + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 577, + 589 + ], + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "default", + "range": [ + 599, + 606 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 15 + } + } + }, + "value": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 608, + 615 + ], + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 619, + 626 + ], + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 21, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "default", + "range": [ + 627, + 634 + ], + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 43 + } + } + }, + "range": [ + 619, + 634 + ], + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 21, + "column": 43 + } + } + }, + "range": [ + 608, + 634 + ], + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 43 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 599, + 634 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 43 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "deserialize", + "range": [ + 644, + 655 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 667, + 671 + ], + "loc": { + "start": { + "line": 22, + "column": 31 + }, + "end": { + "line": 22, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "key", + "range": [ + 673, + 676 + ], + "loc": { + "start": { + "line": 22, + "column": 37 + }, + "end": { + "line": 22, + "column": 40 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 697, + 701 + ], + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "attributes", + "range": [ + 702, + 712 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 32 + } + } + }, + "range": [ + 697, + 712 + ], + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 32 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 716, + 720 + ], + "loc": { + "start": { + "line": 23, + "column": 36 + }, + "end": { + "line": 23, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "attributes", + "range": [ + 721, + 731 + ], + "loc": { + "start": { + "line": 23, + "column": 41 + }, + "end": { + "line": 23, + "column": 51 + } + } + }, + "range": [ + 716, + 731 + ], + "loc": { + "start": { + "line": 23, + "column": 36 + }, + "end": { + "line": 23, + "column": 51 + } + } + }, + "property": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 732, + 736 + ], + "loc": { + "start": { + "line": 23, + "column": 52 + }, + "end": { + "line": 23, + "column": 56 + } + } + }, + "right": { + "type": "Identifier", + "name": "key", + "range": [ + 740, + 743 + ], + "loc": { + "start": { + "line": 23, + "column": 60 + }, + "end": { + "line": 23, + "column": 63 + } + } + }, + "range": [ + 732, + 743 + ], + "loc": { + "start": { + "line": 23, + "column": 52 + }, + "end": { + "line": 23, + "column": 63 + } + } + }, + "range": [ + 716, + 744 + ], + "loc": { + "start": { + "line": 23, + "column": 36 + }, + "end": { + "line": 23, + "column": 64 + } + } + }, + "range": [ + 697, + 744 + ], + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 64 + } + } + }, + "range": [ + 690, + 745 + ], + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 65 + } + } + } + ], + "range": [ + 678, + 755 + ], + "loc": { + "start": { + "line": 22, + "column": 42 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 657, + 755 + ], + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 644, + 755 + ], + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "serialize", + "range": [ + 765, + 774 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 17 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 786, + 794 + ], + "loc": { + "start": { + "line": 25, + "column": 29 + }, + "end": { + "line": 25, + "column": 37 + } + } + }, + { + "type": "Identifier", + "name": "data", + "range": [ + 796, + 800 + ], + "loc": { + "start": { + "line": 25, + "column": 39 + }, + "end": { + "line": 25, + "column": 43 + } + } + }, + { + "type": "Identifier", + "name": "key", + "range": [ + 802, + 805 + ], + "loc": { + "start": { + "line": 25, + "column": 45 + }, + "end": { + "line": 25, + "column": 48 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 819, + 823 + ], + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "attributes", + "range": [ + 824, + 834 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "range": [ + 819, + 834 + ], + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + "property": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 835, + 839 + ], + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 30 + } + } + }, + "right": { + "type": "Identifier", + "name": "key", + "range": [ + 843, + 846 + ], + "loc": { + "start": { + "line": 26, + "column": 34 + }, + "end": { + "line": 26, + "column": 37 + } + } + }, + "range": [ + 835, + 846 + ], + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 37 + } + } + }, + "range": [ + 819, + 847 + ], + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 38 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 850, + 858 + ], + "loc": { + "start": { + "line": 26, + "column": 41 + }, + "end": { + "line": 26, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 859, + 862 + ], + "loc": { + "start": { + "line": 26, + "column": 50 + }, + "end": { + "line": 26, + "column": 53 + } + } + }, + "range": [ + 850, + 863 + ], + "loc": { + "start": { + "line": 26, + "column": 41 + }, + "end": { + "line": 26, + "column": 54 + } + } + }, + "range": [ + 819, + 863 + ], + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 54 + } + } + }, + "range": [ + 819, + 864 + ], + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 55 + } + } + } + ], + "range": [ + 807, + 874 + ], + "loc": { + "start": { + "line": 25, + "column": 50 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 776, + 874 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 765, + 874 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + } + ], + "range": [ + 567, + 882 + ], + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 28, + "column": 7 + } + } + }, + "range": [ + 560, + 883 + ], + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 28, + "column": 8 + } + } + } + ], + "range": [ + 552, + 889 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 29, + "column": 5 + } + } + }, + "range": [ + 464, + 889 + ], + "loc": { + "start": { + "line": 16, + "column": 4 + }, + "end": { + "line": 29, + "column": 5 + } + } + } + ], + "range": [ + 458, + 893 + ], + "loc": { + "start": { + "line": 15, + "column": 29 + }, + "end": { + "line": 30, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 442, + 893 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 30, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 431, + 893 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 30, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 106, + 428 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 14, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 897, + 1234 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 40, + "column": 5 + } + } + } + ], + "static": true + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "hasOne", + "range": [ + 1244, + 1250 + ], + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 15 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 1251, + 1255 + ], + "loc": { + "start": { + "line": 41, + "column": 16 + }, + "end": { + "line": 41, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 1257, + 1264 + ], + "loc": { + "start": { + "line": 41, + "column": 22 + }, + "end": { + "line": 41, + "column": 29 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 1276, + 1280 + ], + "loc": { + "start": { + "line": 42, + "column": 8 + }, + "end": { + "line": 42, + "column": 12 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "name", + "range": [ + 1291, + 1295 + ], + "loc": { + "start": { + "line": 42, + "column": 23 + }, + "end": { + "line": 42, + "column": 27 + } + } + }, + "prefix": true, + "range": [ + 1284, + 1295 + ], + "loc": { + "start": { + "line": 42, + "column": 16 + }, + "end": { + "line": 42, + "column": 27 + } + } + }, + "right": { + "type": "Literal", + "value": "object", + "raw": "'object'", + "range": [ + 1300, + 1308 + ], + "loc": { + "start": { + "line": 42, + "column": 32 + }, + "end": { + "line": 42, + "column": 40 + } + } + }, + "range": [ + 1284, + 1308 + ], + "loc": { + "start": { + "line": 42, + "column": 16 + }, + "end": { + "line": 42, + "column": 40 + } + } + }, + "range": [ + 1276, + 1308 + ], + "loc": { + "start": { + "line": 42, + "column": 8 + }, + "end": { + "line": 42, + "column": 40 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Store", + "range": [ + 1325, + 1330 + ], + "loc": { + "start": { + "line": 43, + "column": 13 + }, + "end": { + "line": 43, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "hasOne", + "range": [ + 1331, + 1337 + ], + "loc": { + "start": { + "line": 43, + "column": 19 + }, + "end": { + "line": 43, + "column": 25 + } + } + }, + "range": [ + 1325, + 1337 + ], + "loc": { + "start": { + "line": 43, + "column": 13 + }, + "end": { + "line": 43, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1338, + 1342 + ], + "loc": { + "start": { + "line": 43, + "column": 26 + }, + "end": { + "line": 43, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "name", + "range": [ + 1344, + 1348 + ], + "loc": { + "start": { + "line": 43, + "column": 32 + }, + "end": { + "line": 43, + "column": 36 + } + } + } + ], + "range": [ + 1325, + 1349 + ], + "loc": { + "start": { + "line": 43, + "column": 13 + }, + "end": { + "line": 43, + "column": 37 + } + } + }, + "range": [ + 1318, + 1350 + ], + "loc": { + "start": { + "line": 43, + "column": 6 + }, + "end": { + "line": 43, + "column": 38 + } + } + } + ], + "range": [ + 1310, + 1356 + ], + "loc": { + "start": { + "line": 42, + "column": 42 + }, + "end": { + "line": 44, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 1387, + 1391 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 12 + } + } + }, + "value": { + "type": "Literal", + "value": "has-one", + "raw": "\"has-one\"", + "range": [ + 1393, + 1402 + ], + "loc": { + "start": { + "line": 46, + "column": 14 + }, + "end": { + "line": 46, + "column": 23 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 1387, + 1402 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 23 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "inverse", + "range": [ + 1412, + 1419 + ], + "loc": { + "start": { + "line": 47, + "column": 8 + }, + "end": { + "line": 47, + "column": 15 + } + } + }, + "value": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 1421, + 1428 + ], + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 24 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 1432, + 1439 + ], + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 1440, + 1447 + ], + "loc": { + "start": { + "line": 47, + "column": 36 + }, + "end": { + "line": 47, + "column": 43 + } + } + }, + "range": [ + 1432, + 1447 + ], + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 43 + } + } + }, + "range": [ + 1421, + 1447 + ], + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 43 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 1412, + 1447 + ], + "loc": { + "start": { + "line": 47, + "column": 8 + }, + "end": { + "line": 47, + "column": 43 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "deserialize", + "range": [ + 1457, + 1468 + ], + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 19 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 1480, + 1484 + ], + "loc": { + "start": { + "line": 48, + "column": 31 + }, + "end": { + "line": 48, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "key", + "range": [ + 1486, + 1489 + ], + "loc": { + "start": { + "line": 48, + "column": 37 + }, + "end": { + "line": 48, + "column": 40 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 1503, + 1507 + ], + "loc": { + "start": { + "line": 49, + "column": 10 + }, + "end": { + "line": 49, + "column": 14 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 1510, + 1514 + ], + "loc": { + "start": { + "line": 49, + "column": 17 + }, + "end": { + "line": 49, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "key", + "range": [ + 1518, + 1521 + ], + "loc": { + "start": { + "line": 49, + "column": 25 + }, + "end": { + "line": 49, + "column": 28 + } + } + }, + "range": [ + 1510, + 1521 + ], + "loc": { + "start": { + "line": 49, + "column": 17 + }, + "end": { + "line": 49, + "column": 28 + } + } + }, + "range": [ + 1503, + 1521 + ], + "loc": { + "start": { + "line": 49, + "column": 10 + }, + "end": { + "line": 49, + "column": 28 + } + } + }, + "range": [ + 1503, + 1522 + ], + "loc": { + "start": { + "line": 49, + "column": 10 + }, + "end": { + "line": 49, + "column": 29 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 1537, + 1541 + ], + "loc": { + "start": { + "line": 50, + "column": 14 + }, + "end": { + "line": 50, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 1542, + 1555 + ], + "loc": { + "start": { + "line": 50, + "column": 19 + }, + "end": { + "line": 50, + "column": 32 + } + } + }, + "range": [ + 1537, + 1555 + ], + "loc": { + "start": { + "line": 50, + "column": 14 + }, + "end": { + "line": 50, + "column": 32 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 1559, + 1563 + ], + "loc": { + "start": { + "line": 50, + "column": 36 + }, + "end": { + "line": 50, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 1564, + 1577 + ], + "loc": { + "start": { + "line": 50, + "column": 41 + }, + "end": { + "line": 50, + "column": 54 + } + } + }, + "range": [ + 1559, + 1577 + ], + "loc": { + "start": { + "line": 50, + "column": 36 + }, + "end": { + "line": 50, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 1578, + 1582 + ], + "loc": { + "start": { + "line": 50, + "column": 55 + }, + "end": { + "line": 50, + "column": 59 + } + } + }, + "range": [ + 1559, + 1583 + ], + "loc": { + "start": { + "line": 50, + "column": 36 + }, + "end": { + "line": 50, + "column": 60 + } + } + }, + "range": [ + 1537, + 1583 + ], + "loc": { + "start": { + "line": 50, + "column": 14 + }, + "end": { + "line": 50, + "column": 60 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 1603, + 1607 + ], + "loc": { + "start": { + "line": 51, + "column": 16 + }, + "end": { + "line": 51, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 1608, + 1621 + ], + "loc": { + "start": { + "line": 51, + "column": 21 + }, + "end": { + "line": 51, + "column": 34 + } + } + }, + "range": [ + 1603, + 1621 + ], + "loc": { + "start": { + "line": 51, + "column": 16 + }, + "end": { + "line": 51, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 1622, + 1626 + ], + "loc": { + "start": { + "line": 51, + "column": 35 + }, + "end": { + "line": 51, + "column": 39 + } + } + }, + "range": [ + 1603, + 1627 + ], + "loc": { + "start": { + "line": 51, + "column": 16 + }, + "end": { + "line": 51, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 1628, + 1632 + ], + "loc": { + "start": { + "line": 51, + "column": 41 + }, + "end": { + "line": 51, + "column": 45 + } + } + }, + "range": [ + 1603, + 1632 + ], + "loc": { + "start": { + "line": 51, + "column": 16 + }, + "end": { + "line": 51, + "column": 45 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1637, + 1641 + ], + "loc": { + "start": { + "line": 51, + "column": 50 + }, + "end": { + "line": 51, + "column": 54 + } + } + }, + "range": [ + 1603, + 1641 + ], + "loc": { + "start": { + "line": 51, + "column": 16 + }, + "end": { + "line": 51, + "column": 54 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1666, + 1670 + ], + "loc": { + "start": { + "line": 52, + "column": 21 + }, + "end": { + "line": 52, + "column": 25 + } + } + }, + "range": [ + 1659, + 1671 + ], + "loc": { + "start": { + "line": 52, + "column": 14 + }, + "end": { + "line": 52, + "column": 26 + } + } + } + ], + "range": [ + 1643, + 1685 + ], + "loc": { + "start": { + "line": 51, + "column": 56 + }, + "end": { + "line": 53, + "column": 13 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 1695, + 1699 + ], + "loc": { + "start": { + "line": 53, + "column": 23 + }, + "end": { + "line": 53, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 1700, + 1713 + ], + "loc": { + "start": { + "line": 53, + "column": 28 + }, + "end": { + "line": 53, + "column": 41 + } + } + }, + "range": [ + 1695, + 1713 + ], + "loc": { + "start": { + "line": 53, + "column": 23 + }, + "end": { + "line": 53, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 1714, + 1718 + ], + "loc": { + "start": { + "line": 53, + "column": 42 + }, + "end": { + "line": 53, + "column": 46 + } + } + }, + "range": [ + 1695, + 1719 + ], + "loc": { + "start": { + "line": 53, + "column": 23 + }, + "end": { + "line": 53, + "column": 47 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 1720, + 1724 + ], + "loc": { + "start": { + "line": 53, + "column": 48 + }, + "end": { + "line": 53, + "column": 52 + } + } + }, + "range": [ + 1695, + 1724 + ], + "loc": { + "start": { + "line": 53, + "column": 23 + }, + "end": { + "line": 53, + "column": 52 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1749, + 1753 + ], + "loc": { + "start": { + "line": 54, + "column": 21 + }, + "end": { + "line": 54, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 1754, + 1758 + ], + "loc": { + "start": { + "line": 54, + "column": 26 + }, + "end": { + "line": 54, + "column": 30 + } + } + }, + "range": [ + 1749, + 1758 + ], + "loc": { + "start": { + "line": 54, + "column": 21 + }, + "end": { + "line": 54, + "column": 30 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 1759, + 1763 + ], + "loc": { + "start": { + "line": 54, + "column": 31 + }, + "end": { + "line": 54, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 1764, + 1777 + ], + "loc": { + "start": { + "line": 54, + "column": 36 + }, + "end": { + "line": 54, + "column": 49 + } + } + }, + "range": [ + 1759, + 1777 + ], + "loc": { + "start": { + "line": 54, + "column": 31 + }, + "end": { + "line": 54, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 1778, + 1782 + ], + "loc": { + "start": { + "line": 54, + "column": 50 + }, + "end": { + "line": 54, + "column": 54 + } + } + }, + "range": [ + 1759, + 1783 + ], + "loc": { + "start": { + "line": 54, + "column": 31 + }, + "end": { + "line": 54, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 1784, + 1788 + ], + "loc": { + "start": { + "line": 54, + "column": 56 + }, + "end": { + "line": 54, + "column": 60 + } + } + }, + "range": [ + 1759, + 1788 + ], + "loc": { + "start": { + "line": 54, + "column": 31 + }, + "end": { + "line": 54, + "column": 60 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 1789, + 1793 + ], + "loc": { + "start": { + "line": 54, + "column": 61 + }, + "end": { + "line": 54, + "column": 65 + } + } + }, + "range": [ + 1759, + 1793 + ], + "loc": { + "start": { + "line": 54, + "column": 31 + }, + "end": { + "line": 54, + "column": 65 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 1795, + 1799 + ], + "loc": { + "start": { + "line": 54, + "column": 67 + }, + "end": { + "line": 54, + "column": 71 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 1800, + 1813 + ], + "loc": { + "start": { + "line": 54, + "column": 72 + }, + "end": { + "line": 54, + "column": 85 + } + } + }, + "range": [ + 1795, + 1813 + ], + "loc": { + "start": { + "line": 54, + "column": 67 + }, + "end": { + "line": 54, + "column": 85 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 1814, + 1818 + ], + "loc": { + "start": { + "line": 54, + "column": 86 + }, + "end": { + "line": 54, + "column": 90 + } + } + }, + "range": [ + 1795, + 1819 + ], + "loc": { + "start": { + "line": 54, + "column": 67 + }, + "end": { + "line": 54, + "column": 91 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 1820, + 1824 + ], + "loc": { + "start": { + "line": 54, + "column": 92 + }, + "end": { + "line": 54, + "column": 96 + } + } + }, + "range": [ + 1795, + 1824 + ], + "loc": { + "start": { + "line": 54, + "column": 67 + }, + "end": { + "line": 54, + "column": 96 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 1825, + 1827 + ], + "loc": { + "start": { + "line": 54, + "column": 97 + }, + "end": { + "line": 54, + "column": 99 + } + } + }, + "range": [ + 1795, + 1827 + ], + "loc": { + "start": { + "line": 54, + "column": 67 + }, + "end": { + "line": 54, + "column": 99 + } + } + } + ], + "range": [ + 1749, + 1828 + ], + "loc": { + "start": { + "line": 54, + "column": 21 + }, + "end": { + "line": 54, + "column": 100 + } + } + }, + "range": [ + 1742, + 1829 + ], + "loc": { + "start": { + "line": 54, + "column": 14 + }, + "end": { + "line": 54, + "column": 101 + } + } + } + ], + "range": [ + 1726, + 1843 + ], + "loc": { + "start": { + "line": 53, + "column": 54 + }, + "end": { + "line": 55, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 1691, + 1843 + ], + "loc": { + "start": { + "line": 53, + "column": 19 + }, + "end": { + "line": 55, + "column": 13 + } + } + }, + "range": [ + 1599, + 1843 + ], + "loc": { + "start": { + "line": 51, + "column": 12 + }, + "end": { + "line": 55, + "column": 13 + } + } + } + ], + "range": [ + 1585, + 1855 + ], + "loc": { + "start": { + "line": 50, + "column": 62 + }, + "end": { + "line": 56, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 1533, + 1855 + ], + "loc": { + "start": { + "line": 50, + "column": 10 + }, + "end": { + "line": 56, + "column": 11 + } + } + } + ], + "range": [ + 1491, + 1865 + ], + "loc": { + "start": { + "line": 48, + "column": 42 + }, + "end": { + "line": 57, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1470, + 1865 + ], + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 57, + "column": 9 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 1457, + 1865 + ], + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 57, + "column": 9 + } + } + } + ], + "range": [ + 1377, + 1873 + ], + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 58, + "column": 7 + } + } + }, + "range": [ + 1370, + 1874 + ], + "loc": { + "start": { + "line": 45, + "column": 6 + }, + "end": { + "line": 58, + "column": 8 + } + } + } + ], + "range": [ + 1362, + 1880 + ], + "loc": { + "start": { + "line": 44, + "column": 11 + }, + "end": { + "line": 59, + "column": 5 + } + } + }, + "range": [ + 1272, + 1880 + ], + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 59, + "column": 5 + } + } + } + ], + "range": [ + 1266, + 1884 + ], + "loc": { + "start": { + "line": 41, + "column": 31 + }, + "end": { + "line": 60, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1250, + 1884 + ], + "loc": { + "start": { + "line": 41, + "column": 15 + }, + "end": { + "line": 60, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 1237, + 1884 + ], + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 60, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 897, + 1234 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 40, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 1888, + 2226 + ], + "loc": { + "start": { + "line": 62, + "column": 2 + }, + "end": { + "line": 70, + "column": 5 + } + } + } + ], + "static": true + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "hasMany", + "range": [ + 2236, + 2243 + ], + "loc": { + "start": { + "line": 71, + "column": 9 + }, + "end": { + "line": 71, + "column": 16 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 2244, + 2248 + ], + "loc": { + "start": { + "line": 71, + "column": 17 + }, + "end": { + "line": 71, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 2250, + 2257 + ], + "loc": { + "start": { + "line": 71, + "column": 23 + }, + "end": { + "line": 71, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 2269, + 2273 + ], + "loc": { + "start": { + "line": 72, + "column": 8 + }, + "end": { + "line": 72, + "column": 12 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "name", + "range": [ + 2284, + 2288 + ], + "loc": { + "start": { + "line": 72, + "column": 23 + }, + "end": { + "line": 72, + "column": 27 + } + } + }, + "prefix": true, + "range": [ + 2277, + 2288 + ], + "loc": { + "start": { + "line": 72, + "column": 16 + }, + "end": { + "line": 72, + "column": 27 + } + } + }, + "right": { + "type": "Literal", + "value": "object", + "raw": "'object'", + "range": [ + 2293, + 2301 + ], + "loc": { + "start": { + "line": 72, + "column": 32 + }, + "end": { + "line": 72, + "column": 40 + } + } + }, + "range": [ + 2277, + 2301 + ], + "loc": { + "start": { + "line": 72, + "column": 16 + }, + "end": { + "line": 72, + "column": 40 + } + } + }, + "range": [ + 2269, + 2301 + ], + "loc": { + "start": { + "line": 72, + "column": 8 + }, + "end": { + "line": 72, + "column": 40 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Store", + "range": [ + 2318, + 2323 + ], + "loc": { + "start": { + "line": 73, + "column": 13 + }, + "end": { + "line": 73, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "hasMany", + "range": [ + 2324, + 2331 + ], + "loc": { + "start": { + "line": 73, + "column": 19 + }, + "end": { + "line": 73, + "column": 26 + } + } + }, + "range": [ + 2318, + 2331 + ], + "loc": { + "start": { + "line": 73, + "column": 13 + }, + "end": { + "line": 73, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 2332, + 2336 + ], + "loc": { + "start": { + "line": 73, + "column": 27 + }, + "end": { + "line": 73, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "name", + "range": [ + 2338, + 2342 + ], + "loc": { + "start": { + "line": 73, + "column": 33 + }, + "end": { + "line": 73, + "column": 37 + } + } + } + ], + "range": [ + 2318, + 2343 + ], + "loc": { + "start": { + "line": 73, + "column": 13 + }, + "end": { + "line": 73, + "column": 38 + } + } + }, + "range": [ + 2311, + 2344 + ], + "loc": { + "start": { + "line": 73, + "column": 6 + }, + "end": { + "line": 73, + "column": 39 + } + } + } + ], + "range": [ + 2303, + 2350 + ], + "loc": { + "start": { + "line": 72, + "column": 42 + }, + "end": { + "line": 74, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 2381, + 2385 + ], + "loc": { + "start": { + "line": 76, + "column": 8 + }, + "end": { + "line": 76, + "column": 12 + } + } + }, + "value": { + "type": "Literal", + "value": "has-many", + "raw": "\"has-many\"", + "range": [ + 2387, + 2397 + ], + "loc": { + "start": { + "line": 76, + "column": 14 + }, + "end": { + "line": 76, + "column": 24 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 2381, + 2397 + ], + "loc": { + "start": { + "line": 76, + "column": 8 + }, + "end": { + "line": 76, + "column": 24 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "default", + "range": [ + 2407, + 2414 + ], + "loc": { + "start": { + "line": 77, + "column": 8 + }, + "end": { + "line": 77, + "column": 15 + } + } + }, + "value": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 2416, + 2418 + ], + "loc": { + "start": { + "line": 77, + "column": 17 + }, + "end": { + "line": 77, + "column": 19 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 2407, + 2418 + ], + "loc": { + "start": { + "line": 77, + "column": 8 + }, + "end": { + "line": 77, + "column": 19 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "inverse", + "range": [ + 2428, + 2435 + ], + "loc": { + "start": { + "line": 78, + "column": 8 + }, + "end": { + "line": 78, + "column": 15 + } + } + }, + "value": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "options", + "range": [ + 2437, + 2444 + ], + "loc": { + "start": { + "line": 78, + "column": 17 + }, + "end": { + "line": 78, + "column": 24 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "options", + "range": [ + 2448, + 2455 + ], + "loc": { + "start": { + "line": 78, + "column": 28 + }, + "end": { + "line": 78, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 2456, + 2463 + ], + "loc": { + "start": { + "line": 78, + "column": 36 + }, + "end": { + "line": 78, + "column": 43 + } + } + }, + "range": [ + 2448, + 2463 + ], + "loc": { + "start": { + "line": 78, + "column": 28 + }, + "end": { + "line": 78, + "column": 43 + } + } + }, + "range": [ + 2437, + 2463 + ], + "loc": { + "start": { + "line": 78, + "column": 17 + }, + "end": { + "line": 78, + "column": 43 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 2428, + 2463 + ], + "loc": { + "start": { + "line": 78, + "column": 8 + }, + "end": { + "line": 78, + "column": 43 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "deserialize", + "range": [ + 2473, + 2484 + ], + "loc": { + "start": { + "line": 79, + "column": 8 + }, + "end": { + "line": 79, + "column": 19 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "data", + "range": [ + 2496, + 2500 + ], + "loc": { + "start": { + "line": 79, + "column": 31 + }, + "end": { + "line": 79, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "key", + "range": [ + 2502, + 2505 + ], + "loc": { + "start": { + "line": 79, + "column": 37 + }, + "end": { + "line": 79, + "column": 40 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 2519, + 2523 + ], + "loc": { + "start": { + "line": 80, + "column": 10 + }, + "end": { + "line": 80, + "column": 14 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "Identifier", + "name": "name", + "range": [ + 2526, + 2530 + ], + "loc": { + "start": { + "line": 80, + "column": 17 + }, + "end": { + "line": 80, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "key", + "range": [ + 2534, + 2537 + ], + "loc": { + "start": { + "line": 80, + "column": 25 + }, + "end": { + "line": 80, + "column": 28 + } + } + }, + "range": [ + 2526, + 2537 + ], + "loc": { + "start": { + "line": 80, + "column": 17 + }, + "end": { + "line": 80, + "column": 28 + } + } + }, + "range": [ + 2519, + 2537 + ], + "loc": { + "start": { + "line": 80, + "column": 10 + }, + "end": { + "line": 80, + "column": 28 + } + } + }, + "range": [ + 2519, + 2538 + ], + "loc": { + "start": { + "line": 80, + "column": 10 + }, + "end": { + "line": 80, + "column": 29 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 2553, + 2557 + ], + "loc": { + "start": { + "line": 81, + "column": 14 + }, + "end": { + "line": 81, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 2558, + 2571 + ], + "loc": { + "start": { + "line": 81, + "column": 19 + }, + "end": { + "line": 81, + "column": 32 + } + } + }, + "range": [ + 2553, + 2571 + ], + "loc": { + "start": { + "line": 81, + "column": 14 + }, + "end": { + "line": 81, + "column": 32 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 2575, + 2579 + ], + "loc": { + "start": { + "line": 81, + "column": 36 + }, + "end": { + "line": 81, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 2580, + 2593 + ], + "loc": { + "start": { + "line": 81, + "column": 41 + }, + "end": { + "line": 81, + "column": 54 + } + } + }, + "range": [ + 2575, + 2593 + ], + "loc": { + "start": { + "line": 81, + "column": 36 + }, + "end": { + "line": 81, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 2594, + 2598 + ], + "loc": { + "start": { + "line": 81, + "column": 55 + }, + "end": { + "line": 81, + "column": 59 + } + } + }, + "range": [ + 2575, + 2599 + ], + "loc": { + "start": { + "line": 81, + "column": 36 + }, + "end": { + "line": 81, + "column": 60 + } + } + }, + "range": [ + 2553, + 2599 + ], + "loc": { + "start": { + "line": 81, + "column": 14 + }, + "end": { + "line": 81, + "column": 60 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 2619, + 2623 + ], + "loc": { + "start": { + "line": 82, + "column": 16 + }, + "end": { + "line": 82, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 2624, + 2637 + ], + "loc": { + "start": { + "line": 82, + "column": 21 + }, + "end": { + "line": 82, + "column": 34 + } + } + }, + "range": [ + 2619, + 2637 + ], + "loc": { + "start": { + "line": 82, + "column": 16 + }, + "end": { + "line": 82, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 2638, + 2642 + ], + "loc": { + "start": { + "line": 82, + "column": 35 + }, + "end": { + "line": 82, + "column": 39 + } + } + }, + "range": [ + 2619, + 2643 + ], + "loc": { + "start": { + "line": 82, + "column": 16 + }, + "end": { + "line": 82, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 2644, + 2648 + ], + "loc": { + "start": { + "line": 82, + "column": 41 + }, + "end": { + "line": 82, + "column": 45 + } + } + }, + "range": [ + 2619, + 2648 + ], + "loc": { + "start": { + "line": 82, + "column": 16 + }, + "end": { + "line": 82, + "column": 45 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 2653, + 2657 + ], + "loc": { + "start": { + "line": 82, + "column": 50 + }, + "end": { + "line": 82, + "column": 54 + } + } + }, + "range": [ + 2619, + 2657 + ], + "loc": { + "start": { + "line": 82, + "column": 16 + }, + "end": { + "line": 82, + "column": 54 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 2682, + 2684 + ], + "loc": { + "start": { + "line": 83, + "column": 21 + }, + "end": { + "line": 83, + "column": 23 + } + } + }, + "range": [ + 2675, + 2685 + ], + "loc": { + "start": { + "line": 83, + "column": 14 + }, + "end": { + "line": 83, + "column": 24 + } + } + } + ], + "range": [ + 2659, + 2699 + ], + "loc": { + "start": { + "line": 82, + "column": 56 + }, + "end": { + "line": 84, + "column": 13 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 2709, + 2713 + ], + "loc": { + "start": { + "line": 84, + "column": 23 + }, + "end": { + "line": 84, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 2714, + 2727 + ], + "loc": { + "start": { + "line": 84, + "column": 28 + }, + "end": { + "line": 84, + "column": 41 + } + } + }, + "range": [ + 2709, + 2727 + ], + "loc": { + "start": { + "line": 84, + "column": 23 + }, + "end": { + "line": 84, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 2728, + 2732 + ], + "loc": { + "start": { + "line": 84, + "column": 42 + }, + "end": { + "line": 84, + "column": 46 + } + } + }, + "range": [ + 2709, + 2733 + ], + "loc": { + "start": { + "line": 84, + "column": 23 + }, + "end": { + "line": 84, + "column": 47 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 2734, + 2738 + ], + "loc": { + "start": { + "line": 84, + "column": 48 + }, + "end": { + "line": 84, + "column": 52 + } + } + }, + "range": [ + 2709, + 2738 + ], + "loc": { + "start": { + "line": 84, + "column": 23 + }, + "end": { + "line": 84, + "column": 52 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 2763, + 2767 + ], + "loc": { + "start": { + "line": 85, + "column": 21 + }, + "end": { + "line": 85, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "relationships", + "range": [ + 2768, + 2781 + ], + "loc": { + "start": { + "line": 85, + "column": 26 + }, + "end": { + "line": 85, + "column": 39 + } + } + }, + "range": [ + 2763, + 2781 + ], + "loc": { + "start": { + "line": 85, + "column": 21 + }, + "end": { + "line": 85, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 2782, + 2786 + ], + "loc": { + "start": { + "line": 85, + "column": 40 + }, + "end": { + "line": 85, + "column": 44 + } + } + }, + "range": [ + 2763, + 2787 + ], + "loc": { + "start": { + "line": 85, + "column": 21 + }, + "end": { + "line": 85, + "column": 45 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 2788, + 2792 + ], + "loc": { + "start": { + "line": 85, + "column": 46 + }, + "end": { + "line": 85, + "column": 50 + } + } + }, + "range": [ + 2763, + 2792 + ], + "loc": { + "start": { + "line": 85, + "column": 21 + }, + "end": { + "line": 85, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "map", + "range": [ + 2793, + 2796 + ], + "loc": { + "start": { + "line": 85, + "column": 51 + }, + "end": { + "line": 85, + "column": 54 + } + } + }, + "range": [ + 2763, + 2796 + ], + "loc": { + "start": { + "line": 85, + "column": 21 + }, + "end": { + "line": 85, + "column": 54 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "c", + "range": [ + 2798, + 2799 + ], + "loc": { + "start": { + "line": 85, + "column": 56 + }, + "end": { + "line": 85, + "column": 57 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2829, + 2833 + ], + "loc": { + "start": { + "line": 86, + "column": 23 + }, + "end": { + "line": 86, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 2834, + 2838 + ], + "loc": { + "start": { + "line": 86, + "column": 28 + }, + "end": { + "line": 86, + "column": 32 + } + } + }, + "range": [ + 2829, + 2838 + ], + "loc": { + "start": { + "line": 86, + "column": 23 + }, + "end": { + "line": 86, + "column": 32 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "c", + "range": [ + 2839, + 2840 + ], + "loc": { + "start": { + "line": 86, + "column": 33 + }, + "end": { + "line": 86, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 2841, + 2845 + ], + "loc": { + "start": { + "line": 86, + "column": 35 + }, + "end": { + "line": 86, + "column": 39 + } + } + }, + "range": [ + 2839, + 2845 + ], + "loc": { + "start": { + "line": 86, + "column": 33 + }, + "end": { + "line": 86, + "column": 39 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "c", + "range": [ + 2847, + 2848 + ], + "loc": { + "start": { + "line": 86, + "column": 41 + }, + "end": { + "line": 86, + "column": 42 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 2849, + 2851 + ], + "loc": { + "start": { + "line": 86, + "column": 43 + }, + "end": { + "line": 86, + "column": 45 + } + } + }, + "range": [ + 2847, + 2851 + ], + "loc": { + "start": { + "line": 86, + "column": 41 + }, + "end": { + "line": 86, + "column": 45 + } + } + } + ], + "range": [ + 2829, + 2852 + ], + "loc": { + "start": { + "line": 86, + "column": 23 + }, + "end": { + "line": 86, + "column": 46 + } + } + }, + "range": [ + 2822, + 2853 + ], + "loc": { + "start": { + "line": 86, + "column": 16 + }, + "end": { + "line": 86, + "column": 47 + } + } + } + ], + "range": [ + 2804, + 2869 + ], + "loc": { + "start": { + "line": 85, + "column": 62 + }, + "end": { + "line": 87, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 2797, + 2869 + ], + "loc": { + "start": { + "line": 85, + "column": 55 + }, + "end": { + "line": 87, + "column": 15 + } + } + } + ], + "range": [ + 2763, + 2870 + ], + "loc": { + "start": { + "line": 85, + "column": 21 + }, + "end": { + "line": 87, + "column": 16 + } + } + }, + "range": [ + 2756, + 2871 + ], + "loc": { + "start": { + "line": 85, + "column": 14 + }, + "end": { + "line": 87, + "column": 17 + } + } + } + ], + "range": [ + 2740, + 2885 + ], + "loc": { + "start": { + "line": 84, + "column": 54 + }, + "end": { + "line": 88, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 2705, + 2885 + ], + "loc": { + "start": { + "line": 84, + "column": 19 + }, + "end": { + "line": 88, + "column": 13 + } + } + }, + "range": [ + 2615, + 2885 + ], + "loc": { + "start": { + "line": 82, + "column": 12 + }, + "end": { + "line": 88, + "column": 13 + } + } + } + ], + "range": [ + 2601, + 2897 + ], + "loc": { + "start": { + "line": 81, + "column": 62 + }, + "end": { + "line": 89, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 2549, + 2897 + ], + "loc": { + "start": { + "line": 81, + "column": 10 + }, + "end": { + "line": 89, + "column": 11 + } + } + } + ], + "range": [ + 2507, + 2907 + ], + "loc": { + "start": { + "line": 79, + "column": 42 + }, + "end": { + "line": 90, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 2486, + 2907 + ], + "loc": { + "start": { + "line": 79, + "column": 21 + }, + "end": { + "line": 90, + "column": 9 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 2473, + 2907 + ], + "loc": { + "start": { + "line": 79, + "column": 8 + }, + "end": { + "line": 90, + "column": 9 + } + } + } + ], + "range": [ + 2371, + 2915 + ], + "loc": { + "start": { + "line": 75, + "column": 13 + }, + "end": { + "line": 91, + "column": 7 + } + } + }, + "range": [ + 2364, + 2916 + ], + "loc": { + "start": { + "line": 75, + "column": 6 + }, + "end": { + "line": 91, + "column": 8 + } + } + } + ], + "range": [ + 2356, + 2922 + ], + "loc": { + "start": { + "line": 74, + "column": 11 + }, + "end": { + "line": 92, + "column": 5 + } + } + }, + "range": [ + 2265, + 2922 + ], + "loc": { + "start": { + "line": 72, + "column": 4 + }, + "end": { + "line": 92, + "column": 5 + } + } + } + ], + "range": [ + 2259, + 2926 + ], + "loc": { + "start": { + "line": 71, + "column": 32 + }, + "end": { + "line": 93, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 2243, + 2926 + ], + "loc": { + "start": { + "line": 71, + "column": 16 + }, + "end": { + "line": 93, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 2229, + 2926 + ], + "loc": { + "start": { + "line": 71, + "column": 2 + }, + "end": { + "line": 93, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 1888, + 2226 + ], + "loc": { + "start": { + "line": 62, + "column": 2 + }, + "end": { + "line": 70, + "column": 5 + } + } + } + ], + "static": true + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 2930, + 2941 + ], + "loc": { + "start": { + "line": 95, + "column": 2 + }, + "end": { + "line": 95, + "column": 13 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "adapter", + "range": [ + 2942, + 2949 + ], + "loc": { + "start": { + "line": 95, + "column": 14 + }, + "end": { + "line": 95, + "column": 21 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2957, + 2961 + ], + "loc": { + "start": { + "line": 96, + "column": 4 + }, + "end": { + "line": 96, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 2962, + 2970 + ], + "loc": { + "start": { + "line": 96, + "column": 9 + }, + "end": { + "line": 96, + "column": 17 + } + } + }, + "range": [ + 2957, + 2970 + ], + "loc": { + "start": { + "line": 96, + "column": 4 + }, + "end": { + "line": 96, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "adapter", + "range": [ + 2973, + 2980 + ], + "loc": { + "start": { + "line": 96, + "column": 20 + }, + "end": { + "line": 96, + "column": 27 + } + } + }, + "range": [ + 2957, + 2980 + ], + "loc": { + "start": { + "line": 96, + "column": 4 + }, + "end": { + "line": 96, + "column": 27 + } + } + }, + "range": [ + 2957, + 2981 + ], + "loc": { + "start": { + "line": 96, + "column": 4 + }, + "end": { + "line": 96, + "column": 28 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2986, + 2990 + ], + "loc": { + "start": { + "line": 97, + "column": 4 + }, + "end": { + "line": 97, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 2991, + 3011 + ], + "loc": { + "start": { + "line": 97, + "column": 9 + }, + "end": { + "line": 97, + "column": 29 + } + } + }, + "range": [ + 2986, + 3011 + ], + "loc": { + "start": { + "line": 97, + "column": 4 + }, + "end": { + "line": 97, + "column": 29 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "added", + "raw": "\"added\"", + "range": [ + 3016, + 3023 + ], + "loc": { + "start": { + "line": 97, + "column": 34 + }, + "end": { + "line": 97, + "column": 41 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3025, + 3027 + ], + "loc": { + "start": { + "line": 97, + "column": 43 + }, + "end": { + "line": 97, + "column": 45 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3016, + 3027 + ], + "loc": { + "start": { + "line": 97, + "column": 34 + }, + "end": { + "line": 97, + "column": 45 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "updated", + "raw": "\"updated\"", + "range": [ + 3029, + 3038 + ], + "loc": { + "start": { + "line": 97, + "column": 47 + }, + "end": { + "line": 97, + "column": 56 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3040, + 3042 + ], + "loc": { + "start": { + "line": 97, + "column": 58 + }, + "end": { + "line": 97, + "column": 60 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3029, + 3042 + ], + "loc": { + "start": { + "line": 97, + "column": 47 + }, + "end": { + "line": 97, + "column": 60 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 3044, + 3053 + ], + "loc": { + "start": { + "line": 97, + "column": 62 + }, + "end": { + "line": 97, + "column": 71 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3055, + 3057 + ], + "loc": { + "start": { + "line": 97, + "column": 73 + }, + "end": { + "line": 97, + "column": 75 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3044, + 3057 + ], + "loc": { + "start": { + "line": 97, + "column": 62 + }, + "end": { + "line": 97, + "column": 75 + } + } + } + ], + "range": [ + 3014, + 3059 + ], + "loc": { + "start": { + "line": 97, + "column": 32 + }, + "end": { + "line": 97, + "column": 77 + } + } + }, + "range": [ + 2986, + 3059 + ], + "loc": { + "start": { + "line": 97, + "column": 4 + }, + "end": { + "line": 97, + "column": 77 + } + } + }, + "range": [ + 2986, + 3060 + ], + "loc": { + "start": { + "line": 97, + "column": 4 + }, + "end": { + "line": 97, + "column": 78 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3065, + 3069 + ], + "loc": { + "start": { + "line": 98, + "column": 4 + }, + "end": { + "line": 98, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 3070, + 3075 + ], + "loc": { + "start": { + "line": 98, + "column": 9 + }, + "end": { + "line": 98, + "column": 14 + } + } + }, + "range": [ + 3065, + 3075 + ], + "loc": { + "start": { + "line": 98, + "column": 4 + }, + "end": { + "line": 98, + "column": 14 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3078, + 3080 + ], + "loc": { + "start": { + "line": 98, + "column": 17 + }, + "end": { + "line": 98, + "column": 19 + } + } + }, + "range": [ + 3065, + 3080 + ], + "loc": { + "start": { + "line": 98, + "column": 4 + }, + "end": { + "line": 98, + "column": 19 + } + } + }, + "range": [ + 3065, + 3081 + ], + "loc": { + "start": { + "line": 98, + "column": 4 + }, + "end": { + "line": 98, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3086, + 3090 + ], + "loc": { + "start": { + "line": 99, + "column": 4 + }, + "end": { + "line": 99, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 3091, + 3109 + ], + "loc": { + "start": { + "line": 99, + "column": 9 + }, + "end": { + "line": 99, + "column": 27 + } + } + }, + "range": [ + 3086, + 3109 + ], + "loc": { + "start": { + "line": 99, + "column": 4 + }, + "end": { + "line": 99, + "column": 27 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Literal", + "value": "added", + "raw": "\"added\"", + "range": [ + 3114, + 3121 + ], + "loc": { + "start": { + "line": 99, + "column": 32 + }, + "end": { + "line": 99, + "column": 39 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3123, + 3125 + ], + "loc": { + "start": { + "line": 99, + "column": 41 + }, + "end": { + "line": 99, + "column": 43 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3114, + 3125 + ], + "loc": { + "start": { + "line": 99, + "column": 32 + }, + "end": { + "line": 99, + "column": 43 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "updated", + "raw": "\"updated\"", + "range": [ + 3127, + 3136 + ], + "loc": { + "start": { + "line": 99, + "column": 45 + }, + "end": { + "line": 99, + "column": 54 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3138, + 3140 + ], + "loc": { + "start": { + "line": 99, + "column": 56 + }, + "end": { + "line": 99, + "column": 58 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3127, + 3140 + ], + "loc": { + "start": { + "line": 99, + "column": 45 + }, + "end": { + "line": 99, + "column": 58 + } + } + }, + { + "type": "Property", + "key": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 3142, + 3151 + ], + "loc": { + "start": { + "line": 99, + "column": 60 + }, + "end": { + "line": 99, + "column": 69 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3153, + 3155 + ], + "loc": { + "start": { + "line": 99, + "column": 71 + }, + "end": { + "line": 99, + "column": 73 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 3142, + 3155 + ], + "loc": { + "start": { + "line": 99, + "column": 60 + }, + "end": { + "line": 99, + "column": 73 + } + } + } + ], + "range": [ + 3112, + 3157 + ], + "loc": { + "start": { + "line": 99, + "column": 30 + }, + "end": { + "line": 99, + "column": 75 + } + } + }, + "range": [ + 3086, + 3157 + ], + "loc": { + "start": { + "line": 99, + "column": 4 + }, + "end": { + "line": 99, + "column": 75 + } + } + }, + "range": [ + 3086, + 3158 + ], + "loc": { + "start": { + "line": 99, + "column": 4 + }, + "end": { + "line": 99, + "column": 76 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3163, + 3167 + ], + "loc": { + "start": { + "line": 100, + "column": 4 + }, + "end": { + "line": 100, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 3168, + 3174 + ], + "loc": { + "start": { + "line": 100, + "column": 9 + }, + "end": { + "line": 100, + "column": 15 + } + } + }, + "range": [ + 3163, + 3174 + ], + "loc": { + "start": { + "line": 100, + "column": 4 + }, + "end": { + "line": 100, + "column": 15 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 3177, + 3179 + ], + "loc": { + "start": { + "line": 100, + "column": 18 + }, + "end": { + "line": 100, + "column": 20 + } + } + }, + "range": [ + 3163, + 3179 + ], + "loc": { + "start": { + "line": 100, + "column": 4 + }, + "end": { + "line": 100, + "column": 20 + } + } + }, + "range": [ + 3163, + 3180 + ], + "loc": { + "start": { + "line": 100, + "column": 4 + }, + "end": { + "line": 100, + "column": 21 + } + } + } + ], + "range": [ + 2951, + 3184 + ], + "loc": { + "start": { + "line": 95, + "column": 23 + }, + "end": { + "line": 101, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 2941, + 3184 + ], + "loc": { + "start": { + "line": 95, + "column": 13 + }, + "end": { + "line": 101, + "column": 3 + } + } + }, + "kind": "constructor", + "computed": false, + "range": [ + 2930, + 3184 + ], + "loc": { + "start": { + "line": 95, + "column": 2 + }, + "end": { + "line": 101, + "column": 3 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\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 - Resource Object to add. See:\n http://jsonapi.org/format/#document-resource-objects\n * @return {undefined} - Nothing.\n ", + "range": [ + 3188, + 3480 + ], + "loc": { + "start": { + "line": 103, + "column": 2 + }, + "end": { + "line": 111, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "add", + "range": [ + 3483, + 3486 + ], + "loc": { + "start": { + "line": 112, + "column": 2 + }, + "end": { + "line": 112, + "column": 5 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "object", + "range": [ + 3487, + 3493 + ], + "loc": { + "start": { + "line": 112, + "column": 6 + }, + "end": { + "line": 112, + "column": 12 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "object", + "range": [ + 3505, + 3511 + ], + "loc": { + "start": { + "line": 113, + "column": 8 + }, + "end": { + "line": 113, + "column": 14 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3525, + 3531 + ], + "loc": { + "start": { + "line": 114, + "column": 10 + }, + "end": { + "line": 114, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 3532, + 3536 + ], + "loc": { + "start": { + "line": 114, + "column": 17 + }, + "end": { + "line": 114, + "column": 21 + } + } + }, + "range": [ + 3525, + 3536 + ], + "loc": { + "start": { + "line": 114, + "column": 10 + }, + "end": { + "line": 114, + "column": 21 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3540, + 3546 + ], + "loc": { + "start": { + "line": 114, + "column": 25 + }, + "end": { + "line": 114, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 3547, + 3549 + ], + "loc": { + "start": { + "line": 114, + "column": 32 + }, + "end": { + "line": 114, + "column": 34 + } + } + }, + "range": [ + 3540, + 3549 + ], + "loc": { + "start": { + "line": 114, + "column": 25 + }, + "end": { + "line": 114, + "column": 34 + } + } + }, + "range": [ + 3525, + 3549 + ], + "loc": { + "start": { + "line": 114, + "column": 10 + }, + "end": { + "line": 114, + "column": 34 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "event", + "range": [ + 3565, + 3570 + ], + "loc": { + "start": { + "line": 115, + "column": 12 + }, + "end": { + "line": 115, + "column": 17 + } + } + }, + "init": { + "type": "ConditionalExpression", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3573, + 3577 + ], + "loc": { + "start": { + "line": 115, + "column": 20 + }, + "end": { + "line": 115, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 3578, + 3583 + ], + "loc": { + "start": { + "line": 115, + "column": 25 + }, + "end": { + "line": 115, + "column": 30 + } + } + }, + "range": [ + 3573, + 3583 + ], + "loc": { + "start": { + "line": 115, + "column": 20 + }, + "end": { + "line": 115, + "column": 30 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3584, + 3590 + ], + "loc": { + "start": { + "line": 115, + "column": 31 + }, + "end": { + "line": 115, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 3591, + 3595 + ], + "loc": { + "start": { + "line": 115, + "column": 38 + }, + "end": { + "line": 115, + "column": 42 + } + } + }, + "range": [ + 3584, + 3595 + ], + "loc": { + "start": { + "line": 115, + "column": 31 + }, + "end": { + "line": 115, + "column": 42 + } + } + }, + "range": [ + 3573, + 3596 + ], + "loc": { + "start": { + "line": 115, + "column": 20 + }, + "end": { + "line": 115, + "column": 43 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3600, + 3604 + ], + "loc": { + "start": { + "line": 115, + "column": 47 + }, + "end": { + "line": 115, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 3605, + 3610 + ], + "loc": { + "start": { + "line": 115, + "column": 52 + }, + "end": { + "line": 115, + "column": 57 + } + } + }, + "range": [ + 3600, + 3610 + ], + "loc": { + "start": { + "line": 115, + "column": 47 + }, + "end": { + "line": 115, + "column": 57 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3611, + 3617 + ], + "loc": { + "start": { + "line": 115, + "column": 58 + }, + "end": { + "line": 115, + "column": 64 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 3618, + 3622 + ], + "loc": { + "start": { + "line": 115, + "column": 65 + }, + "end": { + "line": 115, + "column": 69 + } + } + }, + "range": [ + 3611, + 3622 + ], + "loc": { + "start": { + "line": 115, + "column": 58 + }, + "end": { + "line": 115, + "column": 69 + } + } + }, + "range": [ + 3600, + 3623 + ], + "loc": { + "start": { + "line": 115, + "column": 47 + }, + "end": { + "line": 115, + "column": 70 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3624, + 3630 + ], + "loc": { + "start": { + "line": 115, + "column": 71 + }, + "end": { + "line": 115, + "column": 77 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 3631, + 3633 + ], + "loc": { + "start": { + "line": 115, + "column": 78 + }, + "end": { + "line": 115, + "column": 80 + } + } + }, + "range": [ + 3624, + 3633 + ], + "loc": { + "start": { + "line": 115, + "column": 71 + }, + "end": { + "line": 115, + "column": 80 + } + } + }, + "range": [ + 3600, + 3634 + ], + "loc": { + "start": { + "line": 115, + "column": 47 + }, + "end": { + "line": 115, + "column": 81 + } + } + }, + "range": [ + 3573, + 3634 + ], + "loc": { + "start": { + "line": 115, + "column": 20 + }, + "end": { + "line": 115, + "column": 81 + } + } + }, + "consequent": { + "type": "Literal", + "value": "updated", + "raw": "\"updated\"", + "range": [ + 3637, + 3646 + ], + "loc": { + "start": { + "line": 115, + "column": 84 + }, + "end": { + "line": 115, + "column": 93 + } + } + }, + "alternate": { + "type": "Literal", + "value": "added", + "raw": "\"added\"", + "range": [ + 3649, + 3656 + ], + "loc": { + "start": { + "line": 115, + "column": 96 + }, + "end": { + "line": 115, + "column": 103 + } + } + }, + "range": [ + 3573, + 3656 + ], + "loc": { + "start": { + "line": 115, + "column": 20 + }, + "end": { + "line": 115, + "column": 103 + } + } + }, + "range": [ + 3565, + 3656 + ], + "loc": { + "start": { + "line": 115, + "column": 12 + }, + "end": { + "line": 115, + "column": 103 + } + } + } + ], + "kind": "let", + "range": [ + 3561, + 3657 + ], + "loc": { + "start": { + "line": 115, + "column": 8 + }, + "end": { + "line": 115, + "column": 104 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "resource", + "range": [ + 3670, + 3678 + ], + "loc": { + "start": { + "line": 116, + "column": 12 + }, + "end": { + "line": 116, + "column": 20 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3681, + 3685 + ], + "loc": { + "start": { + "line": 116, + "column": 23 + }, + "end": { + "line": 116, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 3686, + 3690 + ], + "loc": { + "start": { + "line": 116, + "column": 28 + }, + "end": { + "line": 116, + "column": 32 + } + } + }, + "range": [ + 3681, + 3690 + ], + "loc": { + "start": { + "line": 116, + "column": 23 + }, + "end": { + "line": 116, + "column": 32 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3691, + 3697 + ], + "loc": { + "start": { + "line": 116, + "column": 33 + }, + "end": { + "line": 116, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 3698, + 3702 + ], + "loc": { + "start": { + "line": 116, + "column": 40 + }, + "end": { + "line": 116, + "column": 44 + } + } + }, + "range": [ + 3691, + 3702 + ], + "loc": { + "start": { + "line": 116, + "column": 33 + }, + "end": { + "line": 116, + "column": 44 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3704, + 3710 + ], + "loc": { + "start": { + "line": 116, + "column": 46 + }, + "end": { + "line": 116, + "column": 52 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 3711, + 3713 + ], + "loc": { + "start": { + "line": 116, + "column": 53 + }, + "end": { + "line": 116, + "column": 55 + } + } + }, + "range": [ + 3704, + 3713 + ], + "loc": { + "start": { + "line": 116, + "column": 46 + }, + "end": { + "line": 116, + "column": 55 + } + } + } + ], + "range": [ + 3681, + 3714 + ], + "loc": { + "start": { + "line": 116, + "column": 23 + }, + "end": { + "line": 116, + "column": 56 + } + } + }, + "range": [ + 3670, + 3714 + ], + "loc": { + "start": { + "line": 116, + "column": 12 + }, + "end": { + "line": 116, + "column": 56 + } + } + } + ], + "kind": "let", + "range": [ + 3666, + 3715 + ], + "loc": { + "start": { + "line": 116, + "column": 8 + }, + "end": { + "line": 116, + "column": 57 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "definition", + "range": [ + 3728, + 3738 + ], + "loc": { + "start": { + "line": 117, + "column": 12 + }, + "end": { + "line": 117, + "column": 22 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3741, + 3745 + ], + "loc": { + "start": { + "line": 117, + "column": 25 + }, + "end": { + "line": 117, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 3746, + 3752 + ], + "loc": { + "start": { + "line": 117, + "column": 30 + }, + "end": { + "line": 117, + "column": 36 + } + } + }, + "range": [ + 3741, + 3752 + ], + "loc": { + "start": { + "line": 117, + "column": 25 + }, + "end": { + "line": 117, + "column": 36 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3753, + 3759 + ], + "loc": { + "start": { + "line": 117, + "column": 37 + }, + "end": { + "line": 117, + "column": 43 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 3760, + 3764 + ], + "loc": { + "start": { + "line": 117, + "column": 44 + }, + "end": { + "line": 117, + "column": 48 + } + } + }, + "range": [ + 3753, + 3764 + ], + "loc": { + "start": { + "line": 117, + "column": 37 + }, + "end": { + "line": 117, + "column": 48 + } + } + }, + "range": [ + 3741, + 3765 + ], + "loc": { + "start": { + "line": 117, + "column": 25 + }, + "end": { + "line": 117, + "column": 49 + } + } + }, + "range": [ + 3728, + 3765 + ], + "loc": { + "start": { + "line": 117, + "column": 12 + }, + "end": { + "line": 117, + "column": 49 + } + } + } + ], + "kind": "let", + "range": [ + 3724, + 3766 + ], + "loc": { + "start": { + "line": 117, + "column": 8 + }, + "end": { + "line": 117, + "column": 50 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 3775, + 3781 + ], + "loc": { + "start": { + "line": 118, + "column": 8 + }, + "end": { + "line": 118, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 3782, + 3786 + ], + "loc": { + "start": { + "line": 118, + "column": 15 + }, + "end": { + "line": 118, + "column": 19 + } + } + }, + "range": [ + 3775, + 3786 + ], + "loc": { + "start": { + "line": 118, + "column": 8 + }, + "end": { + "line": 118, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "definition", + "range": [ + 3787, + 3797 + ], + "loc": { + "start": { + "line": 118, + "column": 20 + }, + "end": { + "line": 118, + "column": 30 + } + } + } + ], + "range": [ + 3775, + 3798 + ], + "loc": { + "start": { + "line": 118, + "column": 8 + }, + "end": { + "line": 118, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 3799, + 3806 + ], + "loc": { + "start": { + "line": 118, + "column": 32 + }, + "end": { + "line": 118, + "column": 39 + } + } + }, + "range": [ + 3775, + 3806 + ], + "loc": { + "start": { + "line": 118, + "column": 8 + }, + "end": { + "line": 118, + "column": 39 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 3807, + 3816 + ], + "loc": { + "start": { + "line": 118, + "column": 40 + }, + "end": { + "line": 118, + "column": 49 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 3836, + 3845 + ], + "loc": { + "start": { + "line": 119, + "column": 14 + }, + "end": { + "line": 119, + "column": 23 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 3846, + 3847 + ], + "loc": { + "start": { + "line": 119, + "column": 24 + }, + "end": { + "line": 119, + "column": 25 + } + } + }, + "range": [ + 3836, + 3848 + ], + "loc": { + "start": { + "line": 119, + "column": 14 + }, + "end": { + "line": 119, + "column": 26 + } + } + }, + "right": { + "type": "Literal", + "value": "_", + "raw": "\"_\"", + "range": [ + 3853, + 3856 + ], + "loc": { + "start": { + "line": 119, + "column": 31 + }, + "end": { + "line": 119, + "column": 34 + } + } + }, + "range": [ + 3836, + 3856 + ], + "loc": { + "start": { + "line": 119, + "column": 14 + }, + "end": { + "line": 119, + "column": 34 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3872, + 3876 + ], + "loc": { + "start": { + "line": 120, + "column": 12 + }, + "end": { + "line": 120, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_addField", + "range": [ + 3877, + 3886 + ], + "loc": { + "start": { + "line": 120, + "column": 17 + }, + "end": { + "line": 120, + "column": 26 + } + } + }, + "range": [ + 3872, + 3886 + ], + "loc": { + "start": { + "line": 120, + "column": 12 + }, + "end": { + "line": 120, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "object", + "range": [ + 3887, + 3893 + ], + "loc": { + "start": { + "line": 120, + "column": 27 + }, + "end": { + "line": 120, + "column": 33 + } + } + }, + { + "type": "Identifier", + "name": "resource", + "range": [ + 3895, + 3903 + ], + "loc": { + "start": { + "line": 120, + "column": 35 + }, + "end": { + "line": 120, + "column": 43 + } + } + }, + { + "type": "Identifier", + "name": "definition", + "range": [ + 3905, + 3915 + ], + "loc": { + "start": { + "line": 120, + "column": 45 + }, + "end": { + "line": 120, + "column": 55 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 3917, + 3926 + ], + "loc": { + "start": { + "line": 120, + "column": 57 + }, + "end": { + "line": 120, + "column": 66 + } + } + } + ], + "range": [ + 3872, + 3927 + ], + "loc": { + "start": { + "line": 120, + "column": 12 + }, + "end": { + "line": 120, + "column": 67 + } + } + }, + "range": [ + 3872, + 3928 + ], + "loc": { + "start": { + "line": 120, + "column": 12 + }, + "end": { + "line": 120, + "column": 68 + } + } + } + ], + "range": [ + 3858, + 3940 + ], + "loc": { + "start": { + "line": 119, + "column": 36 + }, + "end": { + "line": 121, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 3832, + 3940 + ], + "loc": { + "start": { + "line": 119, + "column": 10 + }, + "end": { + "line": 121, + "column": 11 + } + } + } + ], + "range": [ + 3820, + 3950 + ], + "loc": { + "start": { + "line": 118, + "column": 53 + }, + "end": { + "line": 122, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3807, + 3950 + ], + "loc": { + "start": { + "line": 118, + "column": 40 + }, + "end": { + "line": 122, + "column": 9 + } + } + } + ], + "range": [ + 3775, + 3951 + ], + "loc": { + "start": { + "line": 118, + "column": 8 + }, + "end": { + "line": 122, + "column": 10 + } + } + }, + "range": [ + 3775, + 3952 + ], + "loc": { + "start": { + "line": 118, + "column": 8 + }, + "end": { + "line": 122, + "column": 11 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 3965, + 3969 + ], + "loc": { + "start": { + "line": 123, + "column": 12 + }, + "end": { + "line": 123, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 3970, + 3988 + ], + "loc": { + "start": { + "line": 123, + "column": 17 + }, + "end": { + "line": 123, + "column": 35 + } + } + }, + "range": [ + 3965, + 3988 + ], + "loc": { + "start": { + "line": 123, + "column": 12 + }, + "end": { + "line": 123, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 3989, + 3994 + ], + "loc": { + "start": { + "line": 123, + "column": 36 + }, + "end": { + "line": 123, + "column": 41 + } + } + }, + "range": [ + 3965, + 3995 + ], + "loc": { + "start": { + "line": 123, + "column": 12 + }, + "end": { + "line": 123, + "column": 42 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 3996, + 4002 + ], + "loc": { + "start": { + "line": 123, + "column": 43 + }, + "end": { + "line": 123, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4003, + 4007 + ], + "loc": { + "start": { + "line": 123, + "column": 50 + }, + "end": { + "line": 123, + "column": 54 + } + } + }, + "range": [ + 3996, + 4007 + ], + "loc": { + "start": { + "line": 123, + "column": 43 + }, + "end": { + "line": 123, + "column": 54 + } + } + }, + "range": [ + 3965, + 4008 + ], + "loc": { + "start": { + "line": 123, + "column": 12 + }, + "end": { + "line": 123, + "column": 55 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 4012, + 4016 + ], + "loc": { + "start": { + "line": 123, + "column": 59 + }, + "end": { + "line": 123, + "column": 63 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 4017, + 4035 + ], + "loc": { + "start": { + "line": 123, + "column": 64 + }, + "end": { + "line": 123, + "column": 82 + } + } + }, + "range": [ + 4012, + 4035 + ], + "loc": { + "start": { + "line": 123, + "column": 59 + }, + "end": { + "line": 123, + "column": 82 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 4036, + 4041 + ], + "loc": { + "start": { + "line": 123, + "column": 83 + }, + "end": { + "line": 123, + "column": 88 + } + } + }, + "range": [ + 4012, + 4042 + ], + "loc": { + "start": { + "line": 123, + "column": 59 + }, + "end": { + "line": 123, + "column": 89 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 4043, + 4049 + ], + "loc": { + "start": { + "line": 123, + "column": 90 + }, + "end": { + "line": 123, + "column": 96 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4050, + 4054 + ], + "loc": { + "start": { + "line": 123, + "column": 97 + }, + "end": { + "line": 123, + "column": 101 + } + } + }, + "range": [ + 4043, + 4054 + ], + "loc": { + "start": { + "line": 123, + "column": 90 + }, + "end": { + "line": 123, + "column": 101 + } + } + }, + "range": [ + 4012, + 4055 + ], + "loc": { + "start": { + "line": 123, + "column": 59 + }, + "end": { + "line": 123, + "column": 102 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 4056, + 4062 + ], + "loc": { + "start": { + "line": 123, + "column": 103 + }, + "end": { + "line": 123, + "column": 109 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 4063, + 4065 + ], + "loc": { + "start": { + "line": 123, + "column": 110 + }, + "end": { + "line": 123, + "column": 112 + } + } + }, + "range": [ + 4056, + 4065 + ], + "loc": { + "start": { + "line": 123, + "column": 103 + }, + "end": { + "line": 123, + "column": 112 + } + } + }, + "range": [ + 4012, + 4066 + ], + "loc": { + "start": { + "line": 123, + "column": 59 + }, + "end": { + "line": 123, + "column": 113 + } + } + }, + "range": [ + 3965, + 4066 + ], + "loc": { + "start": { + "line": 123, + "column": 12 + }, + "end": { + "line": 123, + "column": 113 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 4081, + 4085 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 4086, + 4104 + ], + "loc": { + "start": { + "line": 124, + "column": 16 + }, + "end": { + "line": 124, + "column": 34 + } + } + }, + "range": [ + 4081, + 4104 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 4105, + 4110 + ], + "loc": { + "start": { + "line": 124, + "column": 35 + }, + "end": { + "line": 124, + "column": 40 + } + } + }, + "range": [ + 4081, + 4111 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 41 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 4112, + 4118 + ], + "loc": { + "start": { + "line": 124, + "column": 42 + }, + "end": { + "line": 124, + "column": 48 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4119, + 4123 + ], + "loc": { + "start": { + "line": 124, + "column": 49 + }, + "end": { + "line": 124, + "column": 53 + } + } + }, + "range": [ + 4112, + 4123 + ], + "loc": { + "start": { + "line": 124, + "column": 42 + }, + "end": { + "line": 124, + "column": 53 + } + } + }, + "range": [ + 4081, + 4124 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 54 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 4125, + 4131 + ], + "loc": { + "start": { + "line": 124, + "column": 55 + }, + "end": { + "line": 124, + "column": 61 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 4132, + 4134 + ], + "loc": { + "start": { + "line": 124, + "column": 62 + }, + "end": { + "line": 124, + "column": 64 + } + } + }, + "range": [ + 4125, + 4134 + ], + "loc": { + "start": { + "line": 124, + "column": 55 + }, + "end": { + "line": 124, + "column": 64 + } + } + }, + "range": [ + 4081, + 4135 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 65 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 4136, + 4143 + ], + "loc": { + "start": { + "line": 124, + "column": 66 + }, + "end": { + "line": 124, + "column": 73 + } + } + }, + "range": [ + 4081, + 4143 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 73 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 4144, + 4145 + ], + "loc": { + "start": { + "line": 124, + "column": 74 + }, + "end": { + "line": 124, + "column": 75 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 4149, + 4150 + ], + "loc": { + "start": { + "line": 124, + "column": 79 + }, + "end": { + "line": 124, + "column": 80 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 4151, + 4152 + ], + "loc": { + "start": { + "line": 124, + "column": 81 + }, + "end": { + "line": 124, + "column": 82 + } + } + }, + "range": [ + 4149, + 4153 + ], + "loc": { + "start": { + "line": 124, + "column": 79 + }, + "end": { + "line": 124, + "column": 83 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 4154, + 4158 + ], + "loc": { + "start": { + "line": 124, + "column": 84 + }, + "end": { + "line": 124, + "column": 88 + } + } + }, + "range": [ + 4149, + 4158 + ], + "loc": { + "start": { + "line": 124, + "column": 79 + }, + "end": { + "line": 124, + "column": 88 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 4159, + 4160 + ], + "loc": { + "start": { + "line": 124, + "column": 89 + }, + "end": { + "line": 124, + "column": 90 + } + } + }, + "property": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 4161, + 4162 + ], + "loc": { + "start": { + "line": 124, + "column": 91 + }, + "end": { + "line": 124, + "column": 92 + } + } + }, + "range": [ + 4159, + 4163 + ], + "loc": { + "start": { + "line": 124, + "column": 89 + }, + "end": { + "line": 124, + "column": 93 + } + } + }, + { + "type": "Identifier", + "name": "resource", + "range": [ + 4165, + 4173 + ], + "loc": { + "start": { + "line": 124, + "column": 95 + }, + "end": { + "line": 124, + "column": 103 + } + } + } + ], + "range": [ + 4149, + 4174 + ], + "loc": { + "start": { + "line": 124, + "column": 79 + }, + "end": { + "line": 124, + "column": 104 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 4144, + 4174 + ], + "loc": { + "start": { + "line": 124, + "column": 74 + }, + "end": { + "line": 124, + "column": 104 + } + } + } + ], + "range": [ + 4081, + 4175 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 105 + } + } + }, + "range": [ + 4081, + 4176 + ], + "loc": { + "start": { + "line": 124, + "column": 11 + }, + "end": { + "line": 124, + "column": 106 + } + } + } + ], + "range": [ + 4068, + 4186 + ], + "loc": { + "start": { + "line": 123, + "column": 115 + }, + "end": { + "line": 125, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 3961, + 4186 + ], + "loc": { + "start": { + "line": 123, + "column": 8 + }, + "end": { + "line": 125, + "column": 9 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 4199, + 4203 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 4204, + 4224 + ], + "loc": { + "start": { + "line": 126, + "column": 17 + }, + "end": { + "line": 126, + "column": 37 + } + } + }, + "range": [ + 4199, + 4224 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 4225, + 4230 + ], + "loc": { + "start": { + "line": 126, + "column": 38 + }, + "end": { + "line": 126, + "column": 43 + } + } + }, + "range": [ + 4199, + 4231 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 44 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 4232, + 4238 + ], + "loc": { + "start": { + "line": 126, + "column": 45 + }, + "end": { + "line": 126, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4239, + 4243 + ], + "loc": { + "start": { + "line": 126, + "column": 52 + }, + "end": { + "line": 126, + "column": 56 + } + } + }, + "range": [ + 4232, + 4243 + ], + "loc": { + "start": { + "line": 126, + "column": 45 + }, + "end": { + "line": 126, + "column": 56 + } + } + }, + "range": [ + 4199, + 4244 + ], + "loc": { + "start": { + "line": 126, + "column": 12 + }, + "end": { + "line": 126, + "column": 57 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 4258, + 4262 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 4263, + 4283 + ], + "loc": { + "start": { + "line": 127, + "column": 15 + }, + "end": { + "line": 127, + "column": 35 + } + } + }, + "range": [ + 4258, + 4283 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 4284, + 4289 + ], + "loc": { + "start": { + "line": 127, + "column": 36 + }, + "end": { + "line": 127, + "column": 41 + } + } + }, + "range": [ + 4258, + 4290 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 42 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "object", + "range": [ + 4291, + 4297 + ], + "loc": { + "start": { + "line": 127, + "column": 43 + }, + "end": { + "line": 127, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 4298, + 4302 + ], + "loc": { + "start": { + "line": 127, + "column": 50 + }, + "end": { + "line": 127, + "column": 54 + } + } + }, + "range": [ + 4291, + 4302 + ], + "loc": { + "start": { + "line": 127, + "column": 43 + }, + "end": { + "line": 127, + "column": 54 + } + } + }, + "range": [ + 4258, + 4303 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 4304, + 4311 + ], + "loc": { + "start": { + "line": 127, + "column": 56 + }, + "end": { + "line": 127, + "column": 63 + } + } + }, + "range": [ + 4258, + 4311 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 63 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 4312, + 4313 + ], + "loc": { + "start": { + "line": 127, + "column": 64 + }, + "end": { + "line": 127, + "column": 65 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 4317, + 4318 + ], + "loc": { + "start": { + "line": 127, + "column": 69 + }, + "end": { + "line": 127, + "column": 70 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 4319, + 4320 + ], + "loc": { + "start": { + "line": 127, + "column": 71 + }, + "end": { + "line": 127, + "column": 72 + } + } + }, + "range": [ + 4317, + 4321 + ], + "loc": { + "start": { + "line": 127, + "column": 69 + }, + "end": { + "line": 127, + "column": 73 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 4322, + 4326 + ], + "loc": { + "start": { + "line": 127, + "column": 74 + }, + "end": { + "line": 127, + "column": 78 + } + } + }, + "range": [ + 4317, + 4326 + ], + "loc": { + "start": { + "line": 127, + "column": 69 + }, + "end": { + "line": 127, + "column": 78 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 4327, + 4328 + ], + "loc": { + "start": { + "line": 127, + "column": 79 + }, + "end": { + "line": 127, + "column": 80 + } + } + }, + "property": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 4329, + 4330 + ], + "loc": { + "start": { + "line": 127, + "column": 81 + }, + "end": { + "line": 127, + "column": 82 + } + } + }, + "range": [ + 4327, + 4331 + ], + "loc": { + "start": { + "line": 127, + "column": 79 + }, + "end": { + "line": 127, + "column": 83 + } + } + }, + { + "type": "Identifier", + "name": "resource", + "range": [ + 4333, + 4341 + ], + "loc": { + "start": { + "line": 127, + "column": 85 + }, + "end": { + "line": 127, + "column": 93 + } + } + } + ], + "range": [ + 4317, + 4342 + ], + "loc": { + "start": { + "line": 127, + "column": 69 + }, + "end": { + "line": 127, + "column": 94 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 4312, + 4342 + ], + "loc": { + "start": { + "line": 127, + "column": 64 + }, + "end": { + "line": 127, + "column": 94 + } + } + } + ], + "range": [ + 4258, + 4343 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 95 + } + } + }, + "range": [ + 4258, + 4344 + ], + "loc": { + "start": { + "line": 127, + "column": 10 + }, + "end": { + "line": 127, + "column": 96 + } + } + } + ], + "range": [ + 4246, + 4354 + ], + "loc": { + "start": { + "line": 126, + "column": 59 + }, + "end": { + "line": 128, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 4195, + 4354 + ], + "loc": { + "start": { + "line": 126, + "column": 8 + }, + "end": { + "line": 128, + "column": 9 + } + } + } + ], + "range": [ + 3551, + 4362 + ], + "loc": { + "start": { + "line": 114, + "column": 36 + }, + "end": { + "line": 129, + "column": 7 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "TypeError", + "range": [ + 4388, + 4397 + ], + "loc": { + "start": { + "line": 130, + "column": 18 + }, + "end": { + "line": 130, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "The data must have a type and id", + "cooked": "The data must have a type and id" + }, + "tail": true, + "range": [ + 4398, + 4432 + ], + "loc": { + "start": { + "line": 130, + "column": 28 + }, + "end": { + "line": 130, + "column": 62 + } + } + } + ], + "expressions": [], + "range": [ + 4398, + 4432 + ], + "loc": { + "start": { + "line": 130, + "column": 28 + }, + "end": { + "line": 130, + "column": 62 + } + } + } + ], + "range": [ + 4384, + 4433 + ], + "loc": { + "start": { + "line": 130, + "column": 14 + }, + "end": { + "line": 130, + "column": 63 + } + } + }, + "range": [ + 4378, + 4434 + ], + "loc": { + "start": { + "line": 130, + "column": 8 + }, + "end": { + "line": 130, + "column": 64 + } + } + } + ], + "range": [ + 4368, + 4442 + ], + "loc": { + "start": { + "line": 129, + "column": 13 + }, + "end": { + "line": 131, + "column": 7 + } + } + }, + "range": [ + 3521, + 4442 + ], + "loc": { + "start": { + "line": 114, + "column": 6 + }, + "end": { + "line": 131, + "column": 7 + } + } + } + ], + "range": [ + 3513, + 4448 + ], + "loc": { + "start": { + "line": 113, + "column": 16 + }, + "end": { + "line": 132, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "TypeError", + "range": [ + 4472, + 4481 + ], + "loc": { + "start": { + "line": 133, + "column": 16 + }, + "end": { + "line": 133, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "You must provide data to add", + "cooked": "You must provide data to add" + }, + "tail": true, + "range": [ + 4482, + 4512 + ], + "loc": { + "start": { + "line": 133, + "column": 26 + }, + "end": { + "line": 133, + "column": 56 + } + } + } + ], + "expressions": [], + "range": [ + 4482, + 4512 + ], + "loc": { + "start": { + "line": 133, + "column": 26 + }, + "end": { + "line": 133, + "column": 56 + } + } + } + ], + "range": [ + 4468, + 4513 + ], + "loc": { + "start": { + "line": 133, + "column": 12 + }, + "end": { + "line": 133, + "column": 57 + } + } + }, + "range": [ + 4462, + 4514 + ], + "loc": { + "start": { + "line": 133, + "column": 6 + }, + "end": { + "line": 133, + "column": 58 + } + } + } + ], + "range": [ + 4454, + 4520 + ], + "loc": { + "start": { + "line": 132, + "column": 11 + }, + "end": { + "line": 134, + "column": 5 + } + } + }, + "range": [ + 3501, + 4520 + ], + "loc": { + "start": { + "line": 113, + "column": 4 + }, + "end": { + "line": 134, + "column": 5 + } + } + } + ], + "range": [ + 3495, + 4524 + ], + "loc": { + "start": { + "line": 112, + "column": 14 + }, + "end": { + "line": 135, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 3486, + 4524 + ], + "loc": { + "start": { + "line": 112, + "column": 5 + }, + "end": { + "line": 135, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 3483, + 4524 + ], + "loc": { + "start": { + "line": 112, + "column": 2 + }, + "end": { + "line": 135, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 - Resource Object to add. See:\n http://jsonapi.org/format/#document-resource-objects\n * @return {undefined} - Nothing.\n ", + "range": [ + 3188, + 3480 + ], + "loc": { + "start": { + "line": 103, + "column": 2 + }, + "end": { + "line": 111, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 4528, + 4974 + ], + "loc": { + "start": { + "line": 137, + "column": 2 + }, + "end": { + "line": 145, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "convert", + "range": [ + 4977, + 4984 + ], + "loc": { + "start": { + "line": 146, + "column": 2 + }, + "end": { + "line": 146, + "column": 9 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 4985, + 4989 + ], + "loc": { + "start": { + "line": 146, + "column": 10 + }, + "end": { + "line": 146, + "column": 14 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 4991, + 4993 + ], + "loc": { + "start": { + "line": 146, + "column": 16 + }, + "end": { + "line": 146, + "column": 18 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 4995, + 5002 + ], + "loc": { + "start": { + "line": 146, + "column": 20 + }, + "end": { + "line": 146, + "column": 27 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "type", + "range": [ + 5014, + 5018 + ], + "loc": { + "start": { + "line": 147, + "column": 8 + }, + "end": { + "line": 147, + "column": 12 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "type", + "range": [ + 5029, + 5033 + ], + "loc": { + "start": { + "line": 147, + "column": 23 + }, + "end": { + "line": 147, + "column": 27 + } + } + }, + "prefix": true, + "range": [ + 5022, + 5033 + ], + "loc": { + "start": { + "line": 147, + "column": 16 + }, + "end": { + "line": 147, + "column": 27 + } + } + }, + "right": { + "type": "Literal", + "value": "object", + "raw": "\"object\"", + "range": [ + 5038, + 5046 + ], + "loc": { + "start": { + "line": 147, + "column": 32 + }, + "end": { + "line": 147, + "column": 40 + } + } + }, + "range": [ + 5022, + 5046 + ], + "loc": { + "start": { + "line": 147, + "column": 16 + }, + "end": { + "line": 147, + "column": 40 + } + } + }, + "range": [ + 5014, + 5046 + ], + "loc": { + "start": { + "line": 147, + "column": 8 + }, + "end": { + "line": 147, + "column": 40 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 5063, + 5067 + ], + "loc": { + "start": { + "line": 148, + "column": 13 + }, + "end": { + "line": 148, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "convert", + "range": [ + 5068, + 5075 + ], + "loc": { + "start": { + "line": 148, + "column": 18 + }, + "end": { + "line": 148, + "column": 25 + } + } + }, + "range": [ + 5063, + 5075 + ], + "loc": { + "start": { + "line": 148, + "column": 13 + }, + "end": { + "line": 148, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "type", + "range": [ + 5076, + 5080 + ], + "loc": { + "start": { + "line": 148, + "column": 26 + }, + "end": { + "line": 148, + "column": 30 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 5081, + 5085 + ], + "loc": { + "start": { + "line": 148, + "column": 31 + }, + "end": { + "line": 148, + "column": 35 + } + } + }, + "range": [ + 5076, + 5085 + ], + "loc": { + "start": { + "line": 148, + "column": 26 + }, + "end": { + "line": 148, + "column": 35 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "type", + "range": [ + 5087, + 5091 + ], + "loc": { + "start": { + "line": 148, + "column": 37 + }, + "end": { + "line": 148, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 5092, + 5094 + ], + "loc": { + "start": { + "line": 148, + "column": 42 + }, + "end": { + "line": 148, + "column": 44 + } + } + }, + "range": [ + 5087, + 5094 + ], + "loc": { + "start": { + "line": 148, + "column": 37 + }, + "end": { + "line": 148, + "column": 44 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 5096, + 5100 + ], + "loc": { + "start": { + "line": 148, + "column": 46 + }, + "end": { + "line": 148, + "column": 50 + } + } + } + ], + "range": [ + 5063, + 5101 + ], + "loc": { + "start": { + "line": 148, + "column": 13 + }, + "end": { + "line": 148, + "column": 51 + } + } + }, + "range": [ + 5056, + 5102 + ], + "loc": { + "start": { + "line": 148, + "column": 6 + }, + "end": { + "line": 148, + "column": 52 + } + } + } + ], + "range": [ + 5048, + 5108 + ], + "loc": { + "start": { + "line": 147, + "column": 42 + }, + "end": { + "line": 149, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "id", + "range": [ + 5118, + 5120 + ], + "loc": { + "start": { + "line": 149, + "column": 15 + }, + "end": { + "line": 149, + "column": 17 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "id", + "range": [ + 5131, + 5133 + ], + "loc": { + "start": { + "line": 149, + "column": 28 + }, + "end": { + "line": 149, + "column": 30 + } + } + }, + "prefix": true, + "range": [ + 5124, + 5133 + ], + "loc": { + "start": { + "line": 149, + "column": 21 + }, + "end": { + "line": 149, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": "object", + "raw": "\"object\"", + "range": [ + 5138, + 5146 + ], + "loc": { + "start": { + "line": 149, + "column": 35 + }, + "end": { + "line": 149, + "column": 43 + } + } + }, + "range": [ + 5124, + 5146 + ], + "loc": { + "start": { + "line": 149, + "column": 21 + }, + "end": { + "line": 149, + "column": 43 + } + } + }, + "range": [ + 5118, + 5146 + ], + "loc": { + "start": { + "line": 149, + "column": 15 + }, + "end": { + "line": 149, + "column": 43 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 5163, + 5167 + ], + "loc": { + "start": { + "line": 150, + "column": 13 + }, + "end": { + "line": 150, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "convert", + "range": [ + 5168, + 5175 + ], + "loc": { + "start": { + "line": 150, + "column": 18 + }, + "end": { + "line": 150, + "column": 25 + } + } + }, + "range": [ + 5163, + 5175 + ], + "loc": { + "start": { + "line": 150, + "column": 13 + }, + "end": { + "line": 150, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 5176, + 5180 + ], + "loc": { + "start": { + "line": 150, + "column": 26 + }, + "end": { + "line": 150, + "column": 30 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "id", + "range": [ + 5182, + 5184 + ], + "loc": { + "start": { + "line": 150, + "column": 32 + }, + "end": { + "line": 150, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 5185, + 5187 + ], + "loc": { + "start": { + "line": 150, + "column": 35 + }, + "end": { + "line": 150, + "column": 37 + } + } + }, + "range": [ + 5182, + 5187 + ], + "loc": { + "start": { + "line": 150, + "column": 32 + }, + "end": { + "line": 150, + "column": 37 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 5189, + 5191 + ], + "loc": { + "start": { + "line": 150, + "column": 39 + }, + "end": { + "line": 150, + "column": 41 + } + } + } + ], + "range": [ + 5163, + 5192 + ], + "loc": { + "start": { + "line": 150, + "column": 13 + }, + "end": { + "line": 150, + "column": 42 + } + } + }, + "range": [ + 5156, + 5193 + ], + "loc": { + "start": { + "line": 150, + "column": 6 + }, + "end": { + "line": 150, + "column": 43 + } + } + } + ], + "range": [ + 5148, + 5199 + ], + "loc": { + "start": { + "line": 149, + "column": 45 + }, + "end": { + "line": 151, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "data", + "range": [ + 5217, + 5221 + ], + "loc": { + "start": { + "line": 152, + "column": 10 + }, + "end": { + "line": 152, + "column": 14 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 5234, + 5238 + ], + "loc": { + "start": { + "line": 153, + "column": 8 + }, + "end": { + "line": 153, + "column": 12 + } + } + }, + "value": { + "type": "Identifier", + "name": "type", + "range": [ + 5240, + 5244 + ], + "loc": { + "start": { + "line": 153, + "column": 14 + }, + "end": { + "line": 153, + "column": 18 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 5234, + 5244 + ], + "loc": { + "start": { + "line": 153, + "column": 8 + }, + "end": { + "line": 153, + "column": 18 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "attributes", + "range": [ + 5254, + 5264 + ], + "loc": { + "start": { + "line": 154, + "column": 8 + }, + "end": { + "line": 154, + "column": 18 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 5266, + 5268 + ], + "loc": { + "start": { + "line": 154, + "column": 20 + }, + "end": { + "line": 154, + "column": 22 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 5254, + 5268 + ], + "loc": { + "start": { + "line": 154, + "column": 8 + }, + "end": { + "line": 154, + "column": 22 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "relationships", + "range": [ + 5278, + 5291 + ], + "loc": { + "start": { + "line": 155, + "column": 8 + }, + "end": { + "line": 155, + "column": 21 + } + } + }, + "value": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 5293, + 5295 + ], + "loc": { + "start": { + "line": 155, + "column": 23 + }, + "end": { + "line": 155, + "column": 25 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 5278, + 5295 + ], + "loc": { + "start": { + "line": 155, + "column": 8 + }, + "end": { + "line": 155, + "column": 25 + } + } + } + ], + "range": [ + 5224, + 5303 + ], + "loc": { + "start": { + "line": 152, + "column": 17 + }, + "end": { + "line": 156, + "column": 7 + } + } + }, + "range": [ + 5217, + 5303 + ], + "loc": { + "start": { + "line": 152, + "column": 10 + }, + "end": { + "line": 156, + "column": 7 + } + } + } + ], + "kind": "let", + "range": [ + 5213, + 5304 + ], + "loc": { + "start": { + "line": 152, + "column": 6 + }, + "end": { + "line": 156, + "column": 8 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 5315, + 5317 + ], + "loc": { + "start": { + "line": 157, + "column": 10 + }, + "end": { + "line": 157, + "column": 12 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 5329, + 5333 + ], + "loc": { + "start": { + "line": 158, + "column": 8 + }, + "end": { + "line": 158, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 5334, + 5336 + ], + "loc": { + "start": { + "line": 158, + "column": 13 + }, + "end": { + "line": 158, + "column": 15 + } + } + }, + "range": [ + 5329, + 5336 + ], + "loc": { + "start": { + "line": 158, + "column": 8 + }, + "end": { + "line": 158, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "id", + "range": [ + 5339, + 5341 + ], + "loc": { + "start": { + "line": 158, + "column": 18 + }, + "end": { + "line": 158, + "column": 20 + } + } + }, + "range": [ + 5329, + 5341 + ], + "loc": { + "start": { + "line": 158, + "column": 8 + }, + "end": { + "line": 158, + "column": 20 + } + } + }, + "range": [ + 5329, + 5342 + ], + "loc": { + "start": { + "line": 158, + "column": 8 + }, + "end": { + "line": 158, + "column": 21 + } + } + } + ], + "range": [ + 5319, + 5350 + ], + "loc": { + "start": { + "line": 157, + "column": 14 + }, + "end": { + "line": 159, + "column": 7 + } + } + }, + "alternate": null, + "range": [ + 5311, + 5350 + ], + "loc": { + "start": { + "line": 157, + "column": 6 + }, + "end": { + "line": 159, + "column": 7 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "definition", + "range": [ + 5361, + 5371 + ], + "loc": { + "start": { + "line": 160, + "column": 10 + }, + "end": { + "line": 160, + "column": 20 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 5374, + 5378 + ], + "loc": { + "start": { + "line": 160, + "column": 23 + }, + "end": { + "line": 160, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 5379, + 5385 + ], + "loc": { + "start": { + "line": 160, + "column": 28 + }, + "end": { + "line": 160, + "column": 34 + } + } + }, + "range": [ + 5374, + 5385 + ], + "loc": { + "start": { + "line": 160, + "column": 23 + }, + "end": { + "line": 160, + "column": 34 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "data", + "range": [ + 5386, + 5390 + ], + "loc": { + "start": { + "line": 160, + "column": 35 + }, + "end": { + "line": 160, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 5391, + 5395 + ], + "loc": { + "start": { + "line": 160, + "column": 40 + }, + "end": { + "line": 160, + "column": 44 + } + } + }, + "range": [ + 5386, + 5395 + ], + "loc": { + "start": { + "line": 160, + "column": 35 + }, + "end": { + "line": 160, + "column": 44 + } + } + }, + "range": [ + 5374, + 5396 + ], + "loc": { + "start": { + "line": 160, + "column": 23 + }, + "end": { + "line": 160, + "column": 45 + } + } + }, + "range": [ + 5361, + 5396 + ], + "loc": { + "start": { + "line": 160, + "column": 10 + }, + "end": { + "line": 160, + "column": 45 + } + } + } + ], + "kind": "let", + "range": [ + 5357, + 5397 + ], + "loc": { + "start": { + "line": 160, + "column": 6 + }, + "end": { + "line": 160, + "column": 46 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 5404, + 5410 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 161, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 5411, + 5415 + ], + "loc": { + "start": { + "line": 161, + "column": 13 + }, + "end": { + "line": 161, + "column": 17 + } + } + }, + "range": [ + 5404, + 5415 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 161, + "column": 17 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "definition", + "range": [ + 5416, + 5426 + ], + "loc": { + "start": { + "line": 161, + "column": 18 + }, + "end": { + "line": 161, + "column": 28 + } + } + } + ], + "range": [ + 5404, + 5427 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 161, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 5428, + 5435 + ], + "loc": { + "start": { + "line": 161, + "column": 30 + }, + "end": { + "line": 161, + "column": 37 + } + } + }, + "range": [ + 5404, + 5435 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 161, + "column": 37 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 5436, + 5445 + ], + "loc": { + "start": { + "line": 161, + "column": 38 + }, + "end": { + "line": 161, + "column": 47 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 5463, + 5472 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 21 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 5473, + 5474 + ], + "loc": { + "start": { + "line": 162, + "column": 22 + }, + "end": { + "line": 162, + "column": 23 + } + } + }, + "range": [ + 5463, + 5475 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 24 + } + } + }, + "right": { + "type": "Literal", + "value": "_", + "raw": "\"_\"", + "range": [ + 5480, + 5483 + ], + "loc": { + "start": { + "line": 162, + "column": 29 + }, + "end": { + "line": 162, + "column": 32 + } + } + }, + "range": [ + 5463, + 5483 + ], + "loc": { + "start": { + "line": 162, + "column": 12 + }, + "end": { + "line": 162, + "column": 32 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "definition", + "range": [ + 5497, + 5507 + ], + "loc": { + "start": { + "line": 163, + "column": 10 + }, + "end": { + "line": 163, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 5508, + 5517 + ], + "loc": { + "start": { + "line": 163, + "column": 21 + }, + "end": { + "line": 163, + "column": 30 + } + } + }, + "range": [ + 5497, + 5518 + ], + "loc": { + "start": { + "line": 163, + "column": 10 + }, + "end": { + "line": 163, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "serialize", + "range": [ + 5519, + 5528 + ], + "loc": { + "start": { + "line": 163, + "column": 32 + }, + "end": { + "line": 163, + "column": 41 + } + } + }, + "range": [ + 5497, + 5528 + ], + "loc": { + "start": { + "line": 163, + "column": 10 + }, + "end": { + "line": 163, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "partial", + "range": [ + 5529, + 5536 + ], + "loc": { + "start": { + "line": 163, + "column": 42 + }, + "end": { + "line": 163, + "column": 49 + } + } + }, + { + "type": "Identifier", + "name": "data", + "range": [ + 5538, + 5542 + ], + "loc": { + "start": { + "line": 163, + "column": 51 + }, + "end": { + "line": 163, + "column": 55 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 5544, + 5553 + ], + "loc": { + "start": { + "line": 163, + "column": 57 + }, + "end": { + "line": 163, + "column": 66 + } + } + } + ], + "range": [ + 5497, + 5554 + ], + "loc": { + "start": { + "line": 163, + "column": 10 + }, + "end": { + "line": 163, + "column": 67 + } + } + }, + "range": [ + 5497, + 5555 + ], + "loc": { + "start": { + "line": 163, + "column": 10 + }, + "end": { + "line": 163, + "column": 68 + } + } + } + ], + "range": [ + 5485, + 5565 + ], + "loc": { + "start": { + "line": 162, + "column": 34 + }, + "end": { + "line": 164, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 5459, + 5565 + ], + "loc": { + "start": { + "line": 162, + "column": 8 + }, + "end": { + "line": 164, + "column": 9 + } + } + } + ], + "range": [ + 5449, + 5573 + ], + "loc": { + "start": { + "line": 161, + "column": 51 + }, + "end": { + "line": 165, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 5436, + 5573 + ], + "loc": { + "start": { + "line": 161, + "column": 38 + }, + "end": { + "line": 165, + "column": 7 + } + } + } + ], + "range": [ + 5404, + 5574 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 165, + "column": 8 + } + } + }, + "range": [ + 5404, + 5575 + ], + "loc": { + "start": { + "line": 161, + "column": 6 + }, + "end": { + "line": 165, + "column": 9 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "data", + "range": [ + 5589, + 5593 + ], + "loc": { + "start": { + "line": 166, + "column": 13 + }, + "end": { + "line": 166, + "column": 17 + } + } + }, + "range": [ + 5582, + 5594 + ], + "loc": { + "start": { + "line": 166, + "column": 6 + }, + "end": { + "line": 166, + "column": 18 + } + } + } + ], + "range": [ + 5205, + 5600 + ], + "loc": { + "start": { + "line": 151, + "column": 11 + }, + "end": { + "line": 167, + "column": 5 + } + } + }, + "range": [ + 5114, + 5600 + ], + "loc": { + "start": { + "line": 149, + "column": 11 + }, + "end": { + "line": 167, + "column": 5 + } + } + }, + "range": [ + 5010, + 5600 + ], + "loc": { + "start": { + "line": 147, + "column": 4 + }, + "end": { + "line": 167, + "column": 5 + } + } + } + ], + "range": [ + 5004, + 5604 + ], + "loc": { + "start": { + "line": 146, + "column": 29 + }, + "end": { + "line": 168, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 4984, + 5604 + ], + "loc": { + "start": { + "line": 146, + "column": 9 + }, + "end": { + "line": 168, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 4977, + 5604 + ], + "loc": { + "start": { + "line": 146, + "column": 2 + }, + "end": { + "line": 168, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 4528, + 4974 + ], + "loc": { + "start": { + "line": 137, + "column": 2 + }, + "end": { + "line": 145, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.create(\"product\", { title: \"A Book\" }, (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 5608, + 6269 + ], + "loc": { + "start": { + "line": 170, + "column": 2 + }, + "end": { + "line": 188, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "create", + "range": [ + 6272, + 6278 + ], + "loc": { + "start": { + "line": 189, + "column": 2 + }, + "end": { + "line": 189, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 6279, + 6283 + ], + "loc": { + "start": { + "line": 189, + "column": 9 + }, + "end": { + "line": 189, + "column": 13 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 6285, + 6292 + ], + "loc": { + "start": { + "line": 189, + "column": 15 + }, + "end": { + "line": 189, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 6294, + 6301 + ], + "loc": { + "start": { + "line": 189, + "column": 24 + }, + "end": { + "line": 189, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 6303, + 6308 + ], + "loc": { + "start": { + "line": 189, + "column": 33 + }, + "end": { + "line": 189, + "column": 38 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 6310, + 6317 + ], + "loc": { + "start": { + "line": 189, + "column": 40 + }, + "end": { + "line": 189, + "column": 47 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 6329, + 6333 + ], + "loc": { + "start": { + "line": 190, + "column": 8 + }, + "end": { + "line": 190, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 6334, + 6342 + ], + "loc": { + "start": { + "line": 190, + "column": 13 + }, + "end": { + "line": 190, + "column": 21 + } + } + }, + "range": [ + 6329, + 6342 + ], + "loc": { + "start": { + "line": 190, + "column": 8 + }, + "end": { + "line": 190, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 6352, + 6356 + ], + "loc": { + "start": { + "line": 191, + "column": 6 + }, + "end": { + "line": 191, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 6357, + 6365 + ], + "loc": { + "start": { + "line": 191, + "column": 11 + }, + "end": { + "line": 191, + "column": 19 + } + } + }, + "range": [ + 6352, + 6365 + ], + "loc": { + "start": { + "line": 191, + "column": 6 + }, + "end": { + "line": 191, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "create", + "range": [ + 6366, + 6372 + ], + "loc": { + "start": { + "line": 191, + "column": 20 + }, + "end": { + "line": 191, + "column": 26 + } + } + }, + "range": [ + 6352, + 6372 + ], + "loc": { + "start": { + "line": 191, + "column": 6 + }, + "end": { + "line": 191, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 6373, + 6377 + ], + "loc": { + "start": { + "line": 191, + "column": 27 + }, + "end": { + "line": 191, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 6379, + 6383 + ], + "loc": { + "start": { + "line": 191, + "column": 33 + }, + "end": { + "line": 191, + "column": 37 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 6385, + 6392 + ], + "loc": { + "start": { + "line": 191, + "column": 39 + }, + "end": { + "line": 191, + "column": 46 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 6394, + 6401 + ], + "loc": { + "start": { + "line": 191, + "column": 48 + }, + "end": { + "line": 191, + "column": 55 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 6403, + 6408 + ], + "loc": { + "start": { + "line": 191, + "column": 57 + }, + "end": { + "line": 191, + "column": 62 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 6410, + 6417 + ], + "loc": { + "start": { + "line": 191, + "column": 64 + }, + "end": { + "line": 191, + "column": 71 + } + } + } + ], + "range": [ + 6352, + 6418 + ], + "loc": { + "start": { + "line": 191, + "column": 6 + }, + "end": { + "line": 191, + "column": 72 + } + } + }, + "range": [ + 6352, + 6419 + ], + "loc": { + "start": { + "line": 191, + "column": 6 + }, + "end": { + "line": 191, + "column": 73 + } + } + } + ], + "range": [ + 6344, + 6425 + ], + "loc": { + "start": { + "line": 190, + "column": 23 + }, + "end": { + "line": 192, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 6449, + 6454 + ], + "loc": { + "start": { + "line": 193, + "column": 16 + }, + "end": { + "line": 193, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`", + "raw": "\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\"", + "range": [ + 6455, + 6551 + ], + "loc": { + "start": { + "line": 193, + "column": 22 + }, + "end": { + "line": 193, + "column": 118 + } + } + } + ], + "range": [ + 6445, + 6552 + ], + "loc": { + "start": { + "line": 193, + "column": 12 + }, + "end": { + "line": 193, + "column": 119 + } + } + }, + "range": [ + 6439, + 6553 + ], + "loc": { + "start": { + "line": 193, + "column": 6 + }, + "end": { + "line": 193, + "column": 120 + } + } + } + ], + "range": [ + 6431, + 6559 + ], + "loc": { + "start": { + "line": 192, + "column": 11 + }, + "end": { + "line": 194, + "column": 5 + } + } + }, + "range": [ + 6325, + 6559 + ], + "loc": { + "start": { + "line": 190, + "column": 4 + }, + "end": { + "line": 194, + "column": 5 + } + } + } + ], + "range": [ + 6319, + 6563 + ], + "loc": { + "start": { + "line": 189, + "column": 49 + }, + "end": { + "line": 195, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 6278, + 6563 + ], + "loc": { + "start": { + "line": 189, + "column": 8 + }, + "end": { + "line": 195, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 6272, + 6563 + ], + "loc": { + "start": { + "line": 189, + "column": 2 + }, + "end": { + "line": 195, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.create(\"product\", { title: \"A Book\" }, (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 5608, + 6269 + ], + "loc": { + "start": { + "line": 170, + "column": 2 + }, + "end": { + "line": 188, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 6567, + 6794 + ], + "loc": { + "start": { + "line": 197, + "column": 2 + }, + "end": { + "line": 204, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "define", + "range": [ + 6797, + 6803 + ], + "loc": { + "start": { + "line": 205, + "column": 2 + }, + "end": { + "line": 205, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "names", + "range": [ + 6804, + 6809 + ], + "loc": { + "start": { + "line": 205, + "column": 9 + }, + "end": { + "line": 205, + "column": 14 + } + } + }, + { + "type": "Identifier", + "name": "definition", + "range": [ + 6811, + 6821 + ], + "loc": { + "start": { + "line": 205, + "column": 16 + }, + "end": { + "line": 205, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "names", + "range": [ + 6829, + 6834 + ], + "loc": { + "start": { + "line": 206, + "column": 4 + }, + "end": { + "line": 206, + "column": 9 + } + } + }, + "right": { + "type": "ConditionalExpression", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "names", + "range": [ + 6838, + 6843 + ], + "loc": { + "start": { + "line": 206, + "column": 13 + }, + "end": { + "line": 206, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "constructor", + "range": [ + 6844, + 6855 + ], + "loc": { + "start": { + "line": 206, + "column": 19 + }, + "end": { + "line": 206, + "column": 30 + } + } + }, + "range": [ + 6838, + 6855 + ], + "loc": { + "start": { + "line": 206, + "column": 13 + }, + "end": { + "line": 206, + "column": 30 + } + } + }, + "right": { + "type": "Identifier", + "name": "Array", + "range": [ + 6860, + 6865 + ], + "loc": { + "start": { + "line": 206, + "column": 35 + }, + "end": { + "line": 206, + "column": 40 + } + } + }, + "range": [ + 6838, + 6865 + ], + "loc": { + "start": { + "line": 206, + "column": 13 + }, + "end": { + "line": 206, + "column": 40 + } + } + }, + "consequent": { + "type": "Identifier", + "name": "names", + "range": [ + 6869, + 6874 + ], + "loc": { + "start": { + "line": 206, + "column": 44 + }, + "end": { + "line": 206, + "column": 49 + } + } + }, + "alternate": { + "type": "ArrayExpression", + "elements": [ + { + "type": "Identifier", + "name": "names", + "range": [ + 6879, + 6884 + ], + "loc": { + "start": { + "line": 206, + "column": 54 + }, + "end": { + "line": 206, + "column": 59 + } + } + } + ], + "range": [ + 6877, + 6886 + ], + "loc": { + "start": { + "line": 206, + "column": 52 + }, + "end": { + "line": 206, + "column": 61 + } + } + }, + "range": [ + 6837, + 6886 + ], + "loc": { + "start": { + "line": 206, + "column": 12 + }, + "end": { + "line": 206, + "column": 61 + } + } + }, + "range": [ + 6829, + 6886 + ], + "loc": { + "start": { + "line": 206, + "column": 4 + }, + "end": { + "line": 206, + "column": 61 + } + } + }, + "range": [ + 6829, + 6887 + ], + "loc": { + "start": { + "line": 206, + "column": 4 + }, + "end": { + "line": 206, + "column": 62 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "definition", + "range": [ + 6896, + 6906 + ], + "loc": { + "start": { + "line": 207, + "column": 8 + }, + "end": { + "line": 207, + "column": 18 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "definition", + "range": [ + 6916, + 6926 + ], + "loc": { + "start": { + "line": 208, + "column": 6 + }, + "end": { + "line": 208, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_names", + "range": [ + 6927, + 6933 + ], + "loc": { + "start": { + "line": 208, + "column": 17 + }, + "end": { + "line": 208, + "column": 23 + } + } + }, + "range": [ + 6916, + 6933 + ], + "loc": { + "start": { + "line": 208, + "column": 6 + }, + "end": { + "line": 208, + "column": 23 + } + } + }, + "right": { + "type": "Identifier", + "name": "names", + "range": [ + 6936, + 6941 + ], + "loc": { + "start": { + "line": 208, + "column": 26 + }, + "end": { + "line": 208, + "column": 31 + } + } + }, + "range": [ + 6916, + 6941 + ], + "loc": { + "start": { + "line": 208, + "column": 6 + }, + "end": { + "line": 208, + "column": 31 + } + } + }, + "range": [ + 6916, + 6942 + ], + "loc": { + "start": { + "line": 208, + "column": 6 + }, + "end": { + "line": 208, + "column": 32 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "names", + "range": [ + 6949, + 6954 + ], + "loc": { + "start": { + "line": 209, + "column": 6 + }, + "end": { + "line": 209, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 6955, + 6962 + ], + "loc": { + "start": { + "line": 209, + "column": 12 + }, + "end": { + "line": 209, + "column": 19 + } + } + }, + "range": [ + 6949, + 6962 + ], + "loc": { + "start": { + "line": 209, + "column": 6 + }, + "end": { + "line": 209, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 6963, + 6967 + ], + "loc": { + "start": { + "line": 209, + "column": 20 + }, + "end": { + "line": 209, + "column": 24 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 6986, + 6990 + ], + "loc": { + "start": { + "line": 210, + "column": 13 + }, + "end": { + "line": 210, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 6991, + 6997 + ], + "loc": { + "start": { + "line": 210, + "column": 18 + }, + "end": { + "line": 210, + "column": 24 + } + } + }, + "range": [ + 6986, + 6997 + ], + "loc": { + "start": { + "line": 210, + "column": 13 + }, + "end": { + "line": 210, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 6998, + 7002 + ], + "loc": { + "start": { + "line": 210, + "column": 25 + }, + "end": { + "line": 210, + "column": 29 + } + } + }, + "range": [ + 6986, + 7003 + ], + "loc": { + "start": { + "line": 210, + "column": 13 + }, + "end": { + "line": 210, + "column": 30 + } + } + }, + "prefix": true, + "range": [ + 6985, + 7003 + ], + "loc": { + "start": { + "line": 210, + "column": 12 + }, + "end": { + "line": 210, + "column": 30 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 7017, + 7021 + ], + "loc": { + "start": { + "line": 211, + "column": 10 + }, + "end": { + "line": 211, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 7022, + 7028 + ], + "loc": { + "start": { + "line": 211, + "column": 15 + }, + "end": { + "line": 211, + "column": 21 + } + } + }, + "range": [ + 7017, + 7028 + ], + "loc": { + "start": { + "line": 211, + "column": 10 + }, + "end": { + "line": 211, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "name", + "range": [ + 7029, + 7033 + ], + "loc": { + "start": { + "line": 211, + "column": 22 + }, + "end": { + "line": 211, + "column": 26 + } + } + }, + "range": [ + 7017, + 7034 + ], + "loc": { + "start": { + "line": 211, + "column": 10 + }, + "end": { + "line": 211, + "column": 27 + } + } + }, + "right": { + "type": "Identifier", + "name": "definition", + "range": [ + 7037, + 7047 + ], + "loc": { + "start": { + "line": 211, + "column": 30 + }, + "end": { + "line": 211, + "column": 40 + } + } + }, + "range": [ + 7017, + 7047 + ], + "loc": { + "start": { + "line": 211, + "column": 10 + }, + "end": { + "line": 211, + "column": 40 + } + } + }, + "range": [ + 7017, + 7048 + ], + "loc": { + "start": { + "line": 211, + "column": 10 + }, + "end": { + "line": 211, + "column": 41 + } + } + } + ], + "range": [ + 7005, + 7058 + ], + "loc": { + "start": { + "line": 210, + "column": 32 + }, + "end": { + "line": 212, + "column": 9 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 7086, + 7091 + ], + "loc": { + "start": { + "line": 213, + "column": 20 + }, + "end": { + "line": 213, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "The type '", + "cooked": "The type '" + }, + "tail": false, + "range": [ + 7092, + 7105 + ], + "loc": { + "start": { + "line": 213, + "column": 26 + }, + "end": { + "line": 213, + "column": 39 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "' has already been defined.", + "cooked": "' has already been defined." + }, + "tail": true, + "range": [ + 7109, + 7138 + ], + "loc": { + "start": { + "line": 213, + "column": 43 + }, + "end": { + "line": 213, + "column": 72 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "name", + "range": [ + 7105, + 7109 + ], + "loc": { + "start": { + "line": 213, + "column": 39 + }, + "end": { + "line": 213, + "column": 43 + } + } + } + ], + "range": [ + 7092, + 7138 + ], + "loc": { + "start": { + "line": 213, + "column": 26 + }, + "end": { + "line": 213, + "column": 72 + } + } + } + ], + "range": [ + 7082, + 7139 + ], + "loc": { + "start": { + "line": 213, + "column": 16 + }, + "end": { + "line": 213, + "column": 73 + } + } + }, + "range": [ + 7076, + 7140 + ], + "loc": { + "start": { + "line": 213, + "column": 10 + }, + "end": { + "line": 213, + "column": 74 + } + } + } + ], + "range": [ + 7064, + 7150 + ], + "loc": { + "start": { + "line": 212, + "column": 15 + }, + "end": { + "line": 214, + "column": 9 + } + } + }, + "range": [ + 6981, + 7150 + ], + "loc": { + "start": { + "line": 210, + "column": 8 + }, + "end": { + "line": 214, + "column": 9 + } + } + } + ], + "range": [ + 6971, + 7158 + ], + "loc": { + "start": { + "line": 209, + "column": 28 + }, + "end": { + "line": 215, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 6963, + 7158 + ], + "loc": { + "start": { + "line": 209, + "column": 20 + }, + "end": { + "line": 215, + "column": 7 + } + } + } + ], + "range": [ + 6949, + 7159 + ], + "loc": { + "start": { + "line": 209, + "column": 6 + }, + "end": { + "line": 215, + "column": 8 + } + } + }, + "range": [ + 6949, + 7160 + ], + "loc": { + "start": { + "line": 209, + "column": 6 + }, + "end": { + "line": 215, + "column": 9 + } + } + } + ], + "range": [ + 6908, + 7166 + ], + "loc": { + "start": { + "line": 207, + "column": 20 + }, + "end": { + "line": 216, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 7190, + 7195 + ], + "loc": { + "start": { + "line": 217, + "column": 16 + }, + "end": { + "line": 217, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "You must provide a definition for the type '", + "cooked": "You must provide a definition for the type '" + }, + "tail": false, + "range": [ + 7196, + 7243 + ], + "loc": { + "start": { + "line": 217, + "column": 22 + }, + "end": { + "line": 217, + "column": 69 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'.", + "cooked": "'." + }, + "tail": true, + "range": [ + 7251, + 7255 + ], + "loc": { + "start": { + "line": 217, + "column": 77 + }, + "end": { + "line": 217, + "column": 81 + } + } + } + ], + "expressions": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "names", + "range": [ + 7243, + 7248 + ], + "loc": { + "start": { + "line": 217, + "column": 69 + }, + "end": { + "line": 217, + "column": 74 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 7249, + 7250 + ], + "loc": { + "start": { + "line": 217, + "column": 75 + }, + "end": { + "line": 217, + "column": 76 + } + } + }, + "range": [ + 7243, + 7251 + ], + "loc": { + "start": { + "line": 217, + "column": 69 + }, + "end": { + "line": 217, + "column": 77 + } + } + } + ], + "range": [ + 7196, + 7255 + ], + "loc": { + "start": { + "line": 217, + "column": 22 + }, + "end": { + "line": 217, + "column": 81 + } + } + } + ], + "range": [ + 7186, + 7256 + ], + "loc": { + "start": { + "line": 217, + "column": 12 + }, + "end": { + "line": 217, + "column": 82 + } + } + }, + "range": [ + 7180, + 7257 + ], + "loc": { + "start": { + "line": 217, + "column": 6 + }, + "end": { + "line": 217, + "column": 83 + } + } + } + ], + "range": [ + 7172, + 7263 + ], + "loc": { + "start": { + "line": 216, + "column": 11 + }, + "end": { + "line": 218, + "column": 5 + } + } + }, + "range": [ + 6892, + 7263 + ], + "loc": { + "start": { + "line": 207, + "column": 4 + }, + "end": { + "line": 218, + "column": 5 + } + } + } + ], + "range": [ + 6823, + 7267 + ], + "loc": { + "start": { + "line": 205, + "column": 28 + }, + "end": { + "line": 219, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 6803, + 7267 + ], + "loc": { + "start": { + "line": 205, + "column": 8 + }, + "end": { + "line": 219, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 6797, + 7267 + ], + "loc": { + "start": { + "line": 205, + "column": 2 + }, + "end": { + "line": 219, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 6567, + 6794 + ], + "loc": { + "start": { + "line": 197, + "column": 2 + }, + "end": { + "line": 204, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.destroy(\"product\", \"1\", () => {\n * console.log(\"Destroyed!\");\n * });\n ", + "range": [ + 7271, + 7890 + ], + "loc": { + "start": { + "line": 221, + "column": 2 + }, + "end": { + "line": 239, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "destroy", + "range": [ + 7893, + 7900 + ], + "loc": { + "start": { + "line": 240, + "column": 2 + }, + "end": { + "line": 240, + "column": 9 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 7901, + 7905 + ], + "loc": { + "start": { + "line": 240, + "column": 10 + }, + "end": { + "line": 240, + "column": 14 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 7907, + 7909 + ], + "loc": { + "start": { + "line": 240, + "column": 16 + }, + "end": { + "line": 240, + "column": 18 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 7911, + 7918 + ], + "loc": { + "start": { + "line": 240, + "column": 20 + }, + "end": { + "line": 240, + "column": 27 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 7920, + 7925 + ], + "loc": { + "start": { + "line": 240, + "column": 29 + }, + "end": { + "line": 240, + "column": 34 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 7927, + 7934 + ], + "loc": { + "start": { + "line": 240, + "column": 36 + }, + "end": { + "line": 240, + "column": 43 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 7946, + 7950 + ], + "loc": { + "start": { + "line": 241, + "column": 8 + }, + "end": { + "line": 241, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 7951, + 7959 + ], + "loc": { + "start": { + "line": 241, + "column": 13 + }, + "end": { + "line": 241, + "column": 21 + } + } + }, + "range": [ + 7946, + 7959 + ], + "loc": { + "start": { + "line": 241, + "column": 8 + }, + "end": { + "line": 241, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 7969, + 7973 + ], + "loc": { + "start": { + "line": 242, + "column": 6 + }, + "end": { + "line": 242, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 7974, + 7982 + ], + "loc": { + "start": { + "line": 242, + "column": 11 + }, + "end": { + "line": 242, + "column": 19 + } + } + }, + "range": [ + 7969, + 7982 + ], + "loc": { + "start": { + "line": 242, + "column": 6 + }, + "end": { + "line": 242, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "destroy", + "range": [ + 7983, + 7990 + ], + "loc": { + "start": { + "line": 242, + "column": 20 + }, + "end": { + "line": 242, + "column": 27 + } + } + }, + "range": [ + 7969, + 7990 + ], + "loc": { + "start": { + "line": 242, + "column": 6 + }, + "end": { + "line": 242, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 7991, + 7995 + ], + "loc": { + "start": { + "line": 242, + "column": 28 + }, + "end": { + "line": 242, + "column": 32 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 7997, + 8001 + ], + "loc": { + "start": { + "line": 242, + "column": 34 + }, + "end": { + "line": 242, + "column": 38 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 8003, + 8005 + ], + "loc": { + "start": { + "line": 242, + "column": 40 + }, + "end": { + "line": 242, + "column": 42 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 8007, + 8014 + ], + "loc": { + "start": { + "line": 242, + "column": 44 + }, + "end": { + "line": 242, + "column": 51 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 8016, + 8021 + ], + "loc": { + "start": { + "line": 242, + "column": 53 + }, + "end": { + "line": 242, + "column": 58 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 8023, + 8030 + ], + "loc": { + "start": { + "line": 242, + "column": 60 + }, + "end": { + "line": 242, + "column": 67 + } + } + } + ], + "range": [ + 7969, + 8031 + ], + "loc": { + "start": { + "line": 242, + "column": 6 + }, + "end": { + "line": 242, + "column": 68 + } + } + }, + "range": [ + 7969, + 8032 + ], + "loc": { + "start": { + "line": 242, + "column": 6 + }, + "end": { + "line": 242, + "column": 69 + } + } + } + ], + "range": [ + 7961, + 8038 + ], + "loc": { + "start": { + "line": 241, + "column": 23 + }, + "end": { + "line": 243, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 8062, + 8067 + ], + "loc": { + "start": { + "line": 244, + "column": 16 + }, + "end": { + "line": 244, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`", + "raw": "\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\"", + "range": [ + 8068, + 8164 + ], + "loc": { + "start": { + "line": 244, + "column": 22 + }, + "end": { + "line": 244, + "column": 118 + } + } + } + ], + "range": [ + 8058, + 8165 + ], + "loc": { + "start": { + "line": 244, + "column": 12 + }, + "end": { + "line": 244, + "column": 119 + } + } + }, + "range": [ + 8052, + 8166 + ], + "loc": { + "start": { + "line": 244, + "column": 6 + }, + "end": { + "line": 244, + "column": 120 + } + } + } + ], + "range": [ + 8044, + 8172 + ], + "loc": { + "start": { + "line": 243, + "column": 11 + }, + "end": { + "line": 245, + "column": 5 + } + } + }, + "range": [ + 7942, + 8172 + ], + "loc": { + "start": { + "line": 241, + "column": 4 + }, + "end": { + "line": 245, + "column": 5 + } + } + } + ], + "range": [ + 7936, + 8176 + ], + "loc": { + "start": { + "line": 240, + "column": 45 + }, + "end": { + "line": 246, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7900, + 8176 + ], + "loc": { + "start": { + "line": 240, + "column": 9 + }, + "end": { + "line": 246, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 7893, + 8176 + ], + "loc": { + "start": { + "line": 240, + "column": 2 + }, + "end": { + "line": 246, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.destroy(\"product\", \"1\", () => {\n * console.log(\"Destroyed!\");\n * });\n ", + "range": [ + 7271, + 7890 + ], + "loc": { + "start": { + "line": 221, + "column": 2 + }, + "end": { + "line": 239, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Find a resource or entire collection of resources.\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(s) to find.\n * @param {string} [id] - The id of the resource to find. If omitted all\n * resources of the type will be returned.\n * @return {Object|Object[]} - Either the resource or an array of resources.\n ", + "range": [ + 8180, + 8690 + ], + "loc": { + "start": { + "line": 248, + "column": 2 + }, + "end": { + "line": 259, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "find", + "range": [ + 8693, + 8697 + ], + "loc": { + "start": { + "line": 260, + "column": 2 + }, + "end": { + "line": 260, + "column": 6 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 8698, + 8702 + ], + "loc": { + "start": { + "line": 260, + "column": 7 + }, + "end": { + "line": 260, + "column": 11 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 8704, + 8706 + ], + "loc": { + "start": { + "line": 260, + "column": 13 + }, + "end": { + "line": 260, + "column": 15 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "type", + "range": [ + 8718, + 8722 + ], + "loc": { + "start": { + "line": 261, + "column": 8 + }, + "end": { + "line": 261, + "column": 12 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "definition", + "range": [ + 8736, + 8746 + ], + "loc": { + "start": { + "line": 262, + "column": 10 + }, + "end": { + "line": 262, + "column": 20 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 8749, + 8753 + ], + "loc": { + "start": { + "line": 262, + "column": 23 + }, + "end": { + "line": 262, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 8754, + 8760 + ], + "loc": { + "start": { + "line": 262, + "column": 28 + }, + "end": { + "line": 262, + "column": 34 + } + } + }, + "range": [ + 8749, + 8760 + ], + "loc": { + "start": { + "line": 262, + "column": 23 + }, + "end": { + "line": 262, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 8761, + 8765 + ], + "loc": { + "start": { + "line": 262, + "column": 35 + }, + "end": { + "line": 262, + "column": 39 + } + } + }, + "range": [ + 8749, + 8766 + ], + "loc": { + "start": { + "line": 262, + "column": 23 + }, + "end": { + "line": 262, + "column": 40 + } + } + }, + "range": [ + 8736, + 8766 + ], + "loc": { + "start": { + "line": 262, + "column": 10 + }, + "end": { + "line": 262, + "column": 40 + } + } + } + ], + "kind": "let", + "range": [ + 8732, + 8767 + ], + "loc": { + "start": { + "line": 262, + "column": 6 + }, + "end": { + "line": 262, + "column": 41 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "definition", + "range": [ + 8778, + 8788 + ], + "loc": { + "start": { + "line": 263, + "column": 10 + }, + "end": { + "line": 263, + "column": 20 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 8805, + 8809 + ], + "loc": { + "start": { + "line": 264, + "column": 13 + }, + "end": { + "line": 264, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 8810, + 8815 + ], + "loc": { + "start": { + "line": 264, + "column": 18 + }, + "end": { + "line": 264, + "column": 23 + } + } + }, + "range": [ + 8805, + 8815 + ], + "loc": { + "start": { + "line": 264, + "column": 13 + }, + "end": { + "line": 264, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 8816, + 8820 + ], + "loc": { + "start": { + "line": 264, + "column": 24 + }, + "end": { + "line": 264, + "column": 28 + } + } + }, + "range": [ + 8805, + 8821 + ], + "loc": { + "start": { + "line": 264, + "column": 13 + }, + "end": { + "line": 264, + "column": 29 + } + } + }, + "prefix": true, + "range": [ + 8804, + 8821 + ], + "loc": { + "start": { + "line": 264, + "column": 12 + }, + "end": { + "line": 264, + "column": 29 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "collection", + "range": [ + 8839, + 8849 + ], + "loc": { + "start": { + "line": 265, + "column": 14 + }, + "end": { + "line": 265, + "column": 24 + } + } + }, + "init": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 8852, + 8854 + ], + "loc": { + "start": { + "line": 265, + "column": 27 + }, + "end": { + "line": 265, + "column": 29 + } + } + }, + "range": [ + 8839, + 8854 + ], + "loc": { + "start": { + "line": 265, + "column": 14 + }, + "end": { + "line": 265, + "column": 29 + } + } + } + ], + "kind": "let", + "range": [ + 8835, + 8855 + ], + "loc": { + "start": { + "line": 265, + "column": 10 + }, + "end": { + "line": 265, + "column": 30 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "definition", + "range": [ + 8866, + 8876 + ], + "loc": { + "start": { + "line": 266, + "column": 10 + }, + "end": { + "line": 266, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_names", + "range": [ + 8877, + 8883 + ], + "loc": { + "start": { + "line": 266, + "column": 21 + }, + "end": { + "line": 266, + "column": 27 + } + } + }, + "range": [ + 8866, + 8883 + ], + "loc": { + "start": { + "line": 266, + "column": 10 + }, + "end": { + "line": 266, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 8884, + 8891 + ], + "loc": { + "start": { + "line": 266, + "column": 28 + }, + "end": { + "line": 266, + "column": 35 + } + } + }, + "range": [ + 8866, + 8891 + ], + "loc": { + "start": { + "line": 266, + "column": 10 + }, + "end": { + "line": 266, + "column": 35 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "t", + "range": [ + 8892, + 8893 + ], + "loc": { + "start": { + "line": 266, + "column": 36 + }, + "end": { + "line": 266, + "column": 37 + } + } + } + ], + "body": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 8897, + 8901 + ], + "loc": { + "start": { + "line": 266, + "column": 41 + }, + "end": { + "line": 266, + "column": 45 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 8902, + 8907 + ], + "loc": { + "start": { + "line": 266, + "column": 46 + }, + "end": { + "line": 266, + "column": 51 + } + } + }, + "range": [ + 8897, + 8907 + ], + "loc": { + "start": { + "line": 266, + "column": 41 + }, + "end": { + "line": 266, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "t", + "range": [ + 8908, + 8909 + ], + "loc": { + "start": { + "line": 266, + "column": 52 + }, + "end": { + "line": 266, + "column": 53 + } + } + }, + "range": [ + 8897, + 8910 + ], + "loc": { + "start": { + "line": 266, + "column": 41 + }, + "end": { + "line": 266, + "column": 54 + } + } + }, + "right": { + "type": "Identifier", + "name": "collection", + "range": [ + 8913, + 8923 + ], + "loc": { + "start": { + "line": 266, + "column": 57 + }, + "end": { + "line": 266, + "column": 67 + } + } + }, + "range": [ + 8897, + 8923 + ], + "loc": { + "start": { + "line": 266, + "column": 41 + }, + "end": { + "line": 266, + "column": 67 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 8892, + 8923 + ], + "loc": { + "start": { + "line": 266, + "column": 36 + }, + "end": { + "line": 266, + "column": 67 + } + } + } + ], + "range": [ + 8866, + 8924 + ], + "loc": { + "start": { + "line": 266, + "column": 10 + }, + "end": { + "line": 266, + "column": 68 + } + } + }, + "range": [ + 8866, + 8925 + ], + "loc": { + "start": { + "line": 266, + "column": 10 + }, + "end": { + "line": 266, + "column": 69 + } + } + } + ], + "range": [ + 8823, + 8935 + ], + "loc": { + "start": { + "line": 264, + "column": 31 + }, + "end": { + "line": 267, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 8800, + 8935 + ], + "loc": { + "start": { + "line": 264, + "column": 8 + }, + "end": { + "line": 267, + "column": 9 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 8948, + 8950 + ], + "loc": { + "start": { + "line": 268, + "column": 12 + }, + "end": { + "line": 268, + "column": 14 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 8969, + 8973 + ], + "loc": { + "start": { + "line": 269, + "column": 15 + }, + "end": { + "line": 269, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 8974, + 8979 + ], + "loc": { + "start": { + "line": 269, + "column": 20 + }, + "end": { + "line": 269, + "column": 25 + } + } + }, + "range": [ + 8969, + 8979 + ], + "loc": { + "start": { + "line": 269, + "column": 15 + }, + "end": { + "line": 269, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 8980, + 8984 + ], + "loc": { + "start": { + "line": 269, + "column": 26 + }, + "end": { + "line": 269, + "column": 30 + } + } + }, + "range": [ + 8969, + 8985 + ], + "loc": { + "start": { + "line": 269, + "column": 15 + }, + "end": { + "line": 269, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 8986, + 8988 + ], + "loc": { + "start": { + "line": 269, + "column": 32 + }, + "end": { + "line": 269, + "column": 34 + } + } + }, + "range": [ + 8969, + 8989 + ], + "loc": { + "start": { + "line": 269, + "column": 15 + }, + "end": { + "line": 269, + "column": 35 + } + } + }, + "prefix": true, + "range": [ + 8968, + 8989 + ], + "loc": { + "start": { + "line": 269, + "column": 14 + }, + "end": { + "line": 269, + "column": 35 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 9005, + 9009 + ], + "loc": { + "start": { + "line": 270, + "column": 12 + }, + "end": { + "line": 270, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 9010, + 9015 + ], + "loc": { + "start": { + "line": 270, + "column": 17 + }, + "end": { + "line": 270, + "column": 22 + } + } + }, + "range": [ + 9005, + 9015 + ], + "loc": { + "start": { + "line": 270, + "column": 12 + }, + "end": { + "line": 270, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 9016, + 9020 + ], + "loc": { + "start": { + "line": 270, + "column": 23 + }, + "end": { + "line": 270, + "column": 27 + } + } + }, + "range": [ + 9005, + 9021 + ], + "loc": { + "start": { + "line": 270, + "column": 12 + }, + "end": { + "line": 270, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 9022, + 9024 + ], + "loc": { + "start": { + "line": 270, + "column": 29 + }, + "end": { + "line": 270, + "column": 31 + } + } + }, + "range": [ + 9005, + 9025 + ], + "loc": { + "start": { + "line": 270, + "column": 12 + }, + "end": { + "line": 270, + "column": 32 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 9044, + 9055 + ], + "loc": { + "start": { + "line": 271, + "column": 14 + }, + "end": { + "line": 271, + "column": 25 + } + } + }, + "value": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 9057, + 9059 + ], + "loc": { + "start": { + "line": 271, + "column": 27 + }, + "end": { + "line": 271, + "column": 29 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 9044, + 9059 + ], + "loc": { + "start": { + "line": 271, + "column": 14 + }, + "end": { + "line": 271, + "column": 29 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 9075, + 9079 + ], + "loc": { + "start": { + "line": 272, + "column": 14 + }, + "end": { + "line": 272, + "column": 18 + } + } + }, + "value": { + "type": "Identifier", + "name": "type", + "range": [ + 9081, + 9085 + ], + "loc": { + "start": { + "line": 272, + "column": 20 + }, + "end": { + "line": 272, + "column": 24 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 9075, + 9085 + ], + "loc": { + "start": { + "line": 272, + "column": 14 + }, + "end": { + "line": 272, + "column": 24 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 9101, + 9103 + ], + "loc": { + "start": { + "line": 273, + "column": 14 + }, + "end": { + "line": 273, + "column": 16 + } + } + }, + "value": { + "type": "Identifier", + "name": "id", + "range": [ + 9105, + 9107 + ], + "loc": { + "start": { + "line": 273, + "column": 18 + }, + "end": { + "line": 273, + "column": 20 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 9101, + 9107 + ], + "loc": { + "start": { + "line": 273, + "column": 14 + }, + "end": { + "line": 273, + "column": 20 + } + } + } + ], + "range": [ + 9028, + 9121 + ], + "loc": { + "start": { + "line": 270, + "column": 35 + }, + "end": { + "line": 274, + "column": 13 + } + } + }, + "range": [ + 9005, + 9121 + ], + "loc": { + "start": { + "line": 270, + "column": 12 + }, + "end": { + "line": 274, + "column": 13 + } + } + }, + "range": [ + 9005, + 9122 + ], + "loc": { + "start": { + "line": 270, + "column": 12 + }, + "end": { + "line": 274, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 9135, + 9141 + ], + "loc": { + "start": { + "line": 275, + "column": 12 + }, + "end": { + "line": 275, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 9142, + 9146 + ], + "loc": { + "start": { + "line": 275, + "column": 19 + }, + "end": { + "line": 275, + "column": 23 + } + } + }, + "range": [ + 9135, + 9146 + ], + "loc": { + "start": { + "line": 275, + "column": 12 + }, + "end": { + "line": 275, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "definition", + "range": [ + 9147, + 9157 + ], + "loc": { + "start": { + "line": 275, + "column": 24 + }, + "end": { + "line": 275, + "column": 34 + } + } + } + ], + "range": [ + 9135, + 9158 + ], + "loc": { + "start": { + "line": 275, + "column": 12 + }, + "end": { + "line": 275, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 9159, + 9166 + ], + "loc": { + "start": { + "line": 275, + "column": 36 + }, + "end": { + "line": 275, + "column": 43 + } + } + }, + "range": [ + 9135, + 9166 + ], + "loc": { + "start": { + "line": 275, + "column": 12 + }, + "end": { + "line": 275, + "column": 43 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "key", + "range": [ + 9167, + 9170 + ], + "loc": { + "start": { + "line": 275, + "column": 44 + }, + "end": { + "line": 275, + "column": 47 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "key", + "range": [ + 9194, + 9197 + ], + "loc": { + "start": { + "line": 276, + "column": 18 + }, + "end": { + "line": 276, + "column": 21 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 9198, + 9199 + ], + "loc": { + "start": { + "line": 276, + "column": 22 + }, + "end": { + "line": 276, + "column": 23 + } + } + }, + "range": [ + 9194, + 9200 + ], + "loc": { + "start": { + "line": 276, + "column": 18 + }, + "end": { + "line": 276, + "column": 24 + } + } + }, + "right": { + "type": "Literal", + "value": "_", + "raw": "\"_\"", + "range": [ + 9205, + 9208 + ], + "loc": { + "start": { + "line": 276, + "column": 29 + }, + "end": { + "line": 276, + "column": 32 + } + } + }, + "range": [ + 9194, + 9208 + ], + "loc": { + "start": { + "line": 276, + "column": 18 + }, + "end": { + "line": 276, + "column": 32 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 9228, + 9232 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 9233, + 9238 + ], + "loc": { + "start": { + "line": 277, + "column": 21 + }, + "end": { + "line": 277, + "column": 26 + } + } + }, + "range": [ + 9228, + 9238 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 9239, + 9243 + ], + "loc": { + "start": { + "line": 277, + "column": 27 + }, + "end": { + "line": 277, + "column": 31 + } + } + }, + "range": [ + 9228, + 9244 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 9245, + 9247 + ], + "loc": { + "start": { + "line": 277, + "column": 33 + }, + "end": { + "line": 277, + "column": 35 + } + } + }, + "range": [ + 9228, + 9248 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 9249, + 9252 + ], + "loc": { + "start": { + "line": 277, + "column": 37 + }, + "end": { + "line": 277, + "column": 40 + } + } + }, + "range": [ + 9228, + 9253 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 41 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "definition", + "range": [ + 9256, + 9266 + ], + "loc": { + "start": { + "line": 277, + "column": 44 + }, + "end": { + "line": 277, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "name": "key", + "range": [ + 9267, + 9270 + ], + "loc": { + "start": { + "line": 277, + "column": 55 + }, + "end": { + "line": 277, + "column": 58 + } + } + }, + "range": [ + 9256, + 9271 + ], + "loc": { + "start": { + "line": 277, + "column": 44 + }, + "end": { + "line": 277, + "column": 59 + } + } + }, + "property": { + "type": "Identifier", + "name": "default", + "range": [ + 9272, + 9279 + ], + "loc": { + "start": { + "line": 277, + "column": 60 + }, + "end": { + "line": 277, + "column": 67 + } + } + }, + "range": [ + 9256, + 9279 + ], + "loc": { + "start": { + "line": 277, + "column": 44 + }, + "end": { + "line": 277, + "column": 67 + } + } + }, + "range": [ + 9228, + 9279 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 67 + } + } + }, + "range": [ + 9228, + 9280 + ], + "loc": { + "start": { + "line": 277, + "column": 16 + }, + "end": { + "line": 277, + "column": 68 + } + } + } + ], + "range": [ + 9210, + 9296 + ], + "loc": { + "start": { + "line": 276, + "column": 34 + }, + "end": { + "line": 278, + "column": 15 + } + } + }, + "alternate": null, + "range": [ + 9190, + 9296 + ], + "loc": { + "start": { + "line": 276, + "column": 14 + }, + "end": { + "line": 278, + "column": 15 + } + } + } + ], + "range": [ + 9174, + 9310 + ], + "loc": { + "start": { + "line": 275, + "column": 51 + }, + "end": { + "line": 279, + "column": 13 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 9167, + 9310 + ], + "loc": { + "start": { + "line": 275, + "column": 44 + }, + "end": { + "line": 279, + "column": 13 + } + } + } + ], + "range": [ + 9135, + 9311 + ], + "loc": { + "start": { + "line": 275, + "column": 12 + }, + "end": { + "line": 279, + "column": 14 + } + } + }, + "range": [ + 9135, + 9312 + ], + "loc": { + "start": { + "line": 275, + "column": 12 + }, + "end": { + "line": 279, + "column": 15 + } + } + } + ], + "range": [ + 8991, + 9324 + ], + "loc": { + "start": { + "line": 269, + "column": 37 + }, + "end": { + "line": 280, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 8964, + 9324 + ], + "loc": { + "start": { + "line": 269, + "column": 10 + }, + "end": { + "line": 280, + "column": 11 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 9342, + 9346 + ], + "loc": { + "start": { + "line": 281, + "column": 17 + }, + "end": { + "line": 281, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 9347, + 9352 + ], + "loc": { + "start": { + "line": 281, + "column": 22 + }, + "end": { + "line": 281, + "column": 27 + } + } + }, + "range": [ + 9342, + 9352 + ], + "loc": { + "start": { + "line": 281, + "column": 17 + }, + "end": { + "line": 281, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 9353, + 9357 + ], + "loc": { + "start": { + "line": 281, + "column": 28 + }, + "end": { + "line": 281, + "column": 32 + } + } + }, + "range": [ + 9342, + 9358 + ], + "loc": { + "start": { + "line": 281, + "column": 17 + }, + "end": { + "line": 281, + "column": 33 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 9359, + 9361 + ], + "loc": { + "start": { + "line": 281, + "column": 34 + }, + "end": { + "line": 281, + "column": 36 + } + } + }, + "range": [ + 9342, + 9362 + ], + "loc": { + "start": { + "line": 281, + "column": 17 + }, + "end": { + "line": 281, + "column": 37 + } + } + }, + "range": [ + 9335, + 9363 + ], + "loc": { + "start": { + "line": 281, + "column": 10 + }, + "end": { + "line": 281, + "column": 38 + } + } + } + ], + "range": [ + 8952, + 9373 + ], + "loc": { + "start": { + "line": 268, + "column": 16 + }, + "end": { + "line": 282, + "column": 9 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 9398, + 9404 + ], + "loc": { + "start": { + "line": 283, + "column": 17 + }, + "end": { + "line": 283, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 9405, + 9409 + ], + "loc": { + "start": { + "line": 283, + "column": 24 + }, + "end": { + "line": 283, + "column": 28 + } + } + }, + "range": [ + 9398, + 9409 + ], + "loc": { + "start": { + "line": 283, + "column": 17 + }, + "end": { + "line": 283, + "column": 28 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 9410, + 9414 + ], + "loc": { + "start": { + "line": 283, + "column": 29 + }, + "end": { + "line": 283, + "column": 33 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 9415, + 9420 + ], + "loc": { + "start": { + "line": 283, + "column": 34 + }, + "end": { + "line": 283, + "column": 39 + } + } + }, + "range": [ + 9410, + 9420 + ], + "loc": { + "start": { + "line": 283, + "column": 29 + }, + "end": { + "line": 283, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 9421, + 9425 + ], + "loc": { + "start": { + "line": 283, + "column": 40 + }, + "end": { + "line": 283, + "column": 44 + } + } + }, + "range": [ + 9410, + 9426 + ], + "loc": { + "start": { + "line": 283, + "column": 29 + }, + "end": { + "line": 283, + "column": 45 + } + } + } + ], + "range": [ + 9398, + 9427 + ], + "loc": { + "start": { + "line": 283, + "column": 17 + }, + "end": { + "line": 283, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "map", + "range": [ + 9428, + 9431 + ], + "loc": { + "start": { + "line": 283, + "column": 47 + }, + "end": { + "line": 283, + "column": 50 + } + } + }, + "range": [ + 9398, + 9431 + ], + "loc": { + "start": { + "line": 283, + "column": 17 + }, + "end": { + "line": 283, + "column": 50 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 9432, + 9433 + ], + "loc": { + "start": { + "line": 283, + "column": 51 + }, + "end": { + "line": 283, + "column": 52 + } + } + } + ], + "body": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 9437, + 9441 + ], + "loc": { + "start": { + "line": 283, + "column": 56 + }, + "end": { + "line": 283, + "column": 60 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 9442, + 9447 + ], + "loc": { + "start": { + "line": 283, + "column": 61 + }, + "end": { + "line": 283, + "column": 66 + } + } + }, + "range": [ + 9437, + 9447 + ], + "loc": { + "start": { + "line": 283, + "column": 56 + }, + "end": { + "line": 283, + "column": 66 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 9448, + 9452 + ], + "loc": { + "start": { + "line": 283, + "column": 67 + }, + "end": { + "line": 283, + "column": 71 + } + } + }, + "range": [ + 9437, + 9453 + ], + "loc": { + "start": { + "line": 283, + "column": 56 + }, + "end": { + "line": 283, + "column": 72 + } + } + }, + "property": { + "type": "Identifier", + "name": "x", + "range": [ + 9454, + 9455 + ], + "loc": { + "start": { + "line": 283, + "column": 73 + }, + "end": { + "line": 283, + "column": 74 + } + } + }, + "range": [ + 9437, + 9456 + ], + "loc": { + "start": { + "line": 283, + "column": 56 + }, + "end": { + "line": 283, + "column": 75 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 9432, + 9456 + ], + "loc": { + "start": { + "line": 283, + "column": 51 + }, + "end": { + "line": 283, + "column": 75 + } + } + } + ], + "range": [ + 9398, + 9457 + ], + "loc": { + "start": { + "line": 283, + "column": 17 + }, + "end": { + "line": 283, + "column": 76 + } + } + }, + "range": [ + 9391, + 9458 + ], + "loc": { + "start": { + "line": 283, + "column": 10 + }, + "end": { + "line": 283, + "column": 77 + } + } + } + ], + "range": [ + 9379, + 9468 + ], + "loc": { + "start": { + "line": 282, + "column": 15 + }, + "end": { + "line": 284, + "column": 9 + } + } + }, + "range": [ + 8944, + 9468 + ], + "loc": { + "start": { + "line": 268, + "column": 8 + }, + "end": { + "line": 284, + "column": 9 + } + } + } + ], + "range": [ + 8790, + 9476 + ], + "loc": { + "start": { + "line": 263, + "column": 22 + }, + "end": { + "line": 285, + "column": 7 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "TypeError", + "range": [ + 9502, + 9511 + ], + "loc": { + "start": { + "line": 286, + "column": 18 + }, + "end": { + "line": 286, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 9512, + 9529 + ], + "loc": { + "start": { + "line": 286, + "column": 28 + }, + "end": { + "line": 286, + "column": 45 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 9533, + 9536 + ], + "loc": { + "start": { + "line": 286, + "column": 49 + }, + "end": { + "line": 286, + "column": 52 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 9529, + 9533 + ], + "loc": { + "start": { + "line": 286, + "column": 45 + }, + "end": { + "line": 286, + "column": 49 + } + } + } + ], + "range": [ + 9512, + 9536 + ], + "loc": { + "start": { + "line": 286, + "column": 28 + }, + "end": { + "line": 286, + "column": 52 + } + } + } + ], + "range": [ + 9498, + 9537 + ], + "loc": { + "start": { + "line": 286, + "column": 14 + }, + "end": { + "line": 286, + "column": 53 + } + } + }, + "range": [ + 9492, + 9538 + ], + "loc": { + "start": { + "line": 286, + "column": 8 + }, + "end": { + "line": 286, + "column": 54 + } + } + } + ], + "range": [ + 9482, + 9546 + ], + "loc": { + "start": { + "line": 285, + "column": 13 + }, + "end": { + "line": 287, + "column": 7 + } + } + }, + "range": [ + 8774, + 9546 + ], + "loc": { + "start": { + "line": 263, + "column": 6 + }, + "end": { + "line": 287, + "column": 7 + } + } + } + ], + "range": [ + 8724, + 9552 + ], + "loc": { + "start": { + "line": 261, + "column": 14 + }, + "end": { + "line": 288, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "TypeError", + "range": [ + 9576, + 9585 + ], + "loc": { + "start": { + "line": 289, + "column": 16 + }, + "end": { + "line": 289, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "You must provide a type", + "cooked": "You must provide a type" + }, + "tail": true, + "range": [ + 9586, + 9611 + ], + "loc": { + "start": { + "line": 289, + "column": 26 + }, + "end": { + "line": 289, + "column": 51 + } + } + } + ], + "expressions": [], + "range": [ + 9586, + 9611 + ], + "loc": { + "start": { + "line": 289, + "column": 26 + }, + "end": { + "line": 289, + "column": 51 + } + } + } + ], + "range": [ + 9572, + 9612 + ], + "loc": { + "start": { + "line": 289, + "column": 12 + }, + "end": { + "line": 289, + "column": 52 + } + } + }, + "range": [ + 9566, + 9613 + ], + "loc": { + "start": { + "line": 289, + "column": 6 + }, + "end": { + "line": 289, + "column": 53 + } + } + } + ], + "range": [ + 9558, + 9619 + ], + "loc": { + "start": { + "line": 288, + "column": 11 + }, + "end": { + "line": 290, + "column": 5 + } + } + }, + "range": [ + 8714, + 9619 + ], + "loc": { + "start": { + "line": 261, + "column": 4 + }, + "end": { + "line": 290, + "column": 5 + } + } + } + ], + "range": [ + 8708, + 9623 + ], + "loc": { + "start": { + "line": 260, + "column": 17 + }, + "end": { + "line": 291, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 8697, + 9623 + ], + "loc": { + "start": { + "line": 260, + "column": 6 + }, + "end": { + "line": 291, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 8693, + 9623 + ], + "loc": { + "start": { + "line": 260, + "column": 2 + }, + "end": { + "line": 291, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Find a resource or entire collection of resources.\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(s) to find.\n * @param {string} [id] - The id of the resource to find. If omitted all\n * resources of the type will be returned.\n * @return {Object|Object[]} - Either the resource or an array of resources.\n ", + "range": [ + 8180, + 8690 + ], + "loc": { + "start": { + "line": 248, + "column": 2 + }, + "end": { + "line": 259, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Attempts to load the resource(s) through the adapter and adds it/them to\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] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)\n * @param {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.load(\"product\", \"1\", (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 9627, + 10373 + ], + "loc": { + "start": { + "line": 293, + "column": 2 + }, + "end": { + "line": 312, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "load", + "range": [ + 10376, + 10380 + ], + "loc": { + "start": { + "line": 313, + "column": 2 + }, + "end": { + "line": 313, + "column": 6 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 10381, + 10385 + ], + "loc": { + "start": { + "line": 313, + "column": 7 + }, + "end": { + "line": 313, + "column": 11 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 10387, + 10389 + ], + "loc": { + "start": { + "line": 313, + "column": 13 + }, + "end": { + "line": 313, + "column": 15 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 10391, + 10398 + ], + "loc": { + "start": { + "line": 313, + "column": 17 + }, + "end": { + "line": 313, + "column": 24 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 10400, + 10407 + ], + "loc": { + "start": { + "line": 313, + "column": 26 + }, + "end": { + "line": 313, + "column": 33 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 10409, + 10414 + ], + "loc": { + "start": { + "line": 313, + "column": 35 + }, + "end": { + "line": 313, + "column": 40 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 10416, + 10423 + ], + "loc": { + "start": { + "line": 313, + "column": 42 + }, + "end": { + "line": 313, + "column": 49 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 10435, + 10439 + ], + "loc": { + "start": { + "line": 314, + "column": 8 + }, + "end": { + "line": 314, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 10440, + 10448 + ], + "loc": { + "start": { + "line": 314, + "column": 13 + }, + "end": { + "line": 314, + "column": 21 + } + } + }, + "range": [ + 10435, + 10448 + ], + "loc": { + "start": { + "line": 314, + "column": 8 + }, + "end": { + "line": 314, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 10458, + 10462 + ], + "loc": { + "start": { + "line": 315, + "column": 6 + }, + "end": { + "line": 315, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 10463, + 10471 + ], + "loc": { + "start": { + "line": 315, + "column": 11 + }, + "end": { + "line": 315, + "column": 19 + } + } + }, + "range": [ + 10458, + 10471 + ], + "loc": { + "start": { + "line": 315, + "column": 6 + }, + "end": { + "line": 315, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "load", + "range": [ + 10472, + 10476 + ], + "loc": { + "start": { + "line": 315, + "column": 20 + }, + "end": { + "line": 315, + "column": 24 + } + } + }, + "range": [ + 10458, + 10476 + ], + "loc": { + "start": { + "line": 315, + "column": 6 + }, + "end": { + "line": 315, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 10477, + 10481 + ], + "loc": { + "start": { + "line": 315, + "column": 25 + }, + "end": { + "line": 315, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 10483, + 10487 + ], + "loc": { + "start": { + "line": 315, + "column": 31 + }, + "end": { + "line": 315, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 10489, + 10491 + ], + "loc": { + "start": { + "line": 315, + "column": 37 + }, + "end": { + "line": 315, + "column": 39 + } + } + }, + { + "type": "Identifier", + "name": "options", + "range": [ + 10493, + 10500 + ], + "loc": { + "start": { + "line": 315, + "column": 41 + }, + "end": { + "line": 315, + "column": 48 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 10502, + 10509 + ], + "loc": { + "start": { + "line": 315, + "column": 50 + }, + "end": { + "line": 315, + "column": 57 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 10511, + 10516 + ], + "loc": { + "start": { + "line": 315, + "column": 59 + }, + "end": { + "line": 315, + "column": 64 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 10518, + 10525 + ], + "loc": { + "start": { + "line": 315, + "column": 66 + }, + "end": { + "line": 315, + "column": 73 + } + } + } + ], + "range": [ + 10458, + 10526 + ], + "loc": { + "start": { + "line": 315, + "column": 6 + }, + "end": { + "line": 315, + "column": 74 + } + } + }, + "range": [ + 10458, + 10527 + ], + "loc": { + "start": { + "line": 315, + "column": 6 + }, + "end": { + "line": 315, + "column": 75 + } + } + } + ], + "range": [ + 10450, + 10533 + ], + "loc": { + "start": { + "line": 314, + "column": 23 + }, + "end": { + "line": 316, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 10557, + 10562 + ], + "loc": { + "start": { + "line": 317, + "column": 16 + }, + "end": { + "line": 317, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`", + "raw": "\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\"", + "range": [ + 10563, + 10659 + ], + "loc": { + "start": { + "line": 317, + "column": 22 + }, + "end": { + "line": 317, + "column": 118 + } + } + } + ], + "range": [ + 10553, + 10660 + ], + "loc": { + "start": { + "line": 317, + "column": 12 + }, + "end": { + "line": 317, + "column": 119 + } + } + }, + "range": [ + 10547, + 10661 + ], + "loc": { + "start": { + "line": 317, + "column": 6 + }, + "end": { + "line": 317, + "column": 120 + } + } + } + ], + "range": [ + 10539, + 10667 + ], + "loc": { + "start": { + "line": 316, + "column": 11 + }, + "end": { + "line": 318, + "column": 5 + } + } + }, + "range": [ + 10431, + 10667 + ], + "loc": { + "start": { + "line": 314, + "column": 4 + }, + "end": { + "line": 318, + "column": 5 + } + } + } + ], + "range": [ + 10425, + 10671 + ], + "loc": { + "start": { + "line": 313, + "column": 51 + }, + "end": { + "line": 319, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 10380, + 10671 + ], + "loc": { + "start": { + "line": 313, + "column": 6 + }, + "end": { + "line": 319, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 10376, + 10671 + ], + "loc": { + "start": { + "line": 313, + "column": 2 + }, + "end": { + "line": 319, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Attempts to load the resource(s) through the adapter and adds it/them to\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] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)\n * @param {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.load(\"product\", \"1\", (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 9627, + 10373 + ], + "loc": { + "start": { + "line": 293, + "column": 2 + }, + "end": { + "line": 312, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Unregister an event listener that was registered with on().\n *\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 * @return {undefined} - Nothing.\n ", + "range": [ + 10675, + 11078 + ], + "loc": { + "start": { + "line": 321, + "column": 2 + }, + "end": { + "line": 330, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "off", + "range": [ + 11081, + 11084 + ], + "loc": { + "start": { + "line": 331, + "column": 2 + }, + "end": { + "line": 331, + "column": 5 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 11085, + 11090 + ], + "loc": { + "start": { + "line": 331, + "column": 6 + }, + "end": { + "line": 331, + "column": 11 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 11092, + 11096 + ], + "loc": { + "start": { + "line": 331, + "column": 13 + }, + "end": { + "line": 331, + "column": 17 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 11098, + 11100 + ], + "loc": { + "start": { + "line": 331, + "column": 19 + }, + "end": { + "line": 331, + "column": 21 + } + } + }, + { + "type": "Identifier", + "name": "callback", + "range": [ + 11102, + 11110 + ], + "loc": { + "start": { + "line": 331, + "column": 23 + }, + "end": { + "line": 331, + "column": 31 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11122, + 11126 + ], + "loc": { + "start": { + "line": 332, + "column": 8 + }, + "end": { + "line": 332, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 11127, + 11145 + ], + "loc": { + "start": { + "line": 332, + "column": 13 + }, + "end": { + "line": 332, + "column": 31 + } + } + }, + "range": [ + 11122, + 11145 + ], + "loc": { + "start": { + "line": 332, + "column": 8 + }, + "end": { + "line": 332, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11146, + 11151 + ], + "loc": { + "start": { + "line": 332, + "column": 32 + }, + "end": { + "line": 332, + "column": 37 + } + } + }, + "range": [ + 11122, + 11152 + ], + "loc": { + "start": { + "line": 332, + "column": 8 + }, + "end": { + "line": 332, + "column": 38 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11156, + 11160 + ], + "loc": { + "start": { + "line": 332, + "column": 42 + }, + "end": { + "line": 332, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 11161, + 11181 + ], + "loc": { + "start": { + "line": 332, + "column": 47 + }, + "end": { + "line": 332, + "column": 67 + } + } + }, + "range": [ + 11156, + 11181 + ], + "loc": { + "start": { + "line": 332, + "column": 42 + }, + "end": { + "line": 332, + "column": 67 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11182, + 11187 + ], + "loc": { + "start": { + "line": 332, + "column": 68 + }, + "end": { + "line": 332, + "column": 73 + } + } + }, + "range": [ + 11156, + 11188 + ], + "loc": { + "start": { + "line": 332, + "column": 42 + }, + "end": { + "line": 332, + "column": 74 + } + } + }, + "range": [ + 11122, + 11188 + ], + "loc": { + "start": { + "line": 332, + "column": 8 + }, + "end": { + "line": 332, + "column": 74 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11202, + 11206 + ], + "loc": { + "start": { + "line": 333, + "column": 10 + }, + "end": { + "line": 333, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 11207, + 11213 + ], + "loc": { + "start": { + "line": 333, + "column": 15 + }, + "end": { + "line": 333, + "column": 21 + } + } + }, + "range": [ + 11202, + 11213 + ], + "loc": { + "start": { + "line": 333, + "column": 10 + }, + "end": { + "line": 333, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11214, + 11218 + ], + "loc": { + "start": { + "line": 333, + "column": 22 + }, + "end": { + "line": 333, + "column": 26 + } + } + }, + "range": [ + 11202, + 11219 + ], + "loc": { + "start": { + "line": 333, + "column": 10 + }, + "end": { + "line": 333, + "column": 27 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "id", + "range": [ + 11235, + 11237 + ], + "loc": { + "start": { + "line": 334, + "column": 12 + }, + "end": { + "line": 334, + "column": 14 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 11242, + 11244 + ], + "loc": { + "start": { + "line": 334, + "column": 19 + }, + "end": { + "line": 334, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 11246, + 11254 + ], + "loc": { + "start": { + "line": 334, + "column": 23 + }, + "end": { + "line": 334, + "column": 31 + } + } + }, + "range": [ + 11241, + 11254 + ], + "loc": { + "start": { + "line": 334, + "column": 18 + }, + "end": { + "line": 334, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 11255, + 11259 + ], + "loc": { + "start": { + "line": 334, + "column": 32 + }, + "end": { + "line": 334, + "column": 36 + } + } + }, + "range": [ + 11241, + 11259 + ], + "loc": { + "start": { + "line": 334, + "column": 18 + }, + "end": { + "line": 334, + "column": 36 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "id", + "range": [ + 11260, + 11262 + ], + "loc": { + "start": { + "line": 334, + "column": 37 + }, + "end": { + "line": 334, + "column": 39 + } + } + } + ], + "range": [ + 11241, + 11263 + ], + "loc": { + "start": { + "line": 334, + "column": 18 + }, + "end": { + "line": 334, + "column": 40 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 11268, + 11287 + ], + "loc": { + "start": { + "line": 334, + "column": 45 + }, + "end": { + "line": 334, + "column": 64 + } + } + }, + "range": [ + 11241, + 11287 + ], + "loc": { + "start": { + "line": 334, + "column": 18 + }, + "end": { + "line": 334, + "column": 64 + } + } + }, + "range": [ + 11235, + 11287 + ], + "loc": { + "start": { + "line": 334, + "column": 12 + }, + "end": { + "line": 334, + "column": 64 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11301, + 11305 + ], + "loc": { + "start": { + "line": 335, + "column": 10 + }, + "end": { + "line": 335, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "off", + "range": [ + 11306, + 11309 + ], + "loc": { + "start": { + "line": 335, + "column": 15 + }, + "end": { + "line": 335, + "column": 18 + } + } + }, + "range": [ + 11301, + 11309 + ], + "loc": { + "start": { + "line": 335, + "column": 10 + }, + "end": { + "line": 335, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 11310, + 11314 + ], + "loc": { + "start": { + "line": 335, + "column": 19 + }, + "end": { + "line": 335, + "column": 23 + } + } + }, + "range": [ + 11301, + 11314 + ], + "loc": { + "start": { + "line": 335, + "column": 10 + }, + "end": { + "line": 335, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 11315, + 11319 + ], + "loc": { + "start": { + "line": 335, + "column": 24 + }, + "end": { + "line": 335, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "event", + "range": [ + 11321, + 11326 + ], + "loc": { + "start": { + "line": 335, + "column": 30 + }, + "end": { + "line": 335, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 11328, + 11332 + ], + "loc": { + "start": { + "line": 335, + "column": 37 + }, + "end": { + "line": 335, + "column": 41 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 11334, + 11338 + ], + "loc": { + "start": { + "line": 335, + "column": 43 + }, + "end": { + "line": 335, + "column": 47 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 11340, + 11342 + ], + "loc": { + "start": { + "line": 335, + "column": 49 + }, + "end": { + "line": 335, + "column": 51 + } + } + }, + { + "type": "Identifier", + "name": "callback", + "range": [ + 11344, + 11352 + ], + "loc": { + "start": { + "line": 335, + "column": 53 + }, + "end": { + "line": 335, + "column": 61 + } + } + } + ], + "range": [ + 11301, + 11353 + ], + "loc": { + "start": { + "line": 335, + "column": 10 + }, + "end": { + "line": 335, + "column": 62 + } + } + }, + "range": [ + 11301, + 11354 + ], + "loc": { + "start": { + "line": 335, + "column": 10 + }, + "end": { + "line": 335, + "column": 63 + } + } + } + ], + "range": [ + 11289, + 11364 + ], + "loc": { + "start": { + "line": 334, + "column": 66 + }, + "end": { + "line": 336, + "column": 9 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11502, + 11506 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 338, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 11507, + 11513 + ], + "loc": { + "start": { + "line": 338, + "column": 15 + }, + "end": { + "line": 338, + "column": 21 + } + } + }, + "range": [ + 11502, + 11513 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 338, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11514, + 11518 + ], + "loc": { + "start": { + "line": 338, + "column": 22 + }, + "end": { + "line": 338, + "column": 26 + } + } + }, + "range": [ + 11502, + 11519 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 338, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "_names", + "range": [ + 11520, + 11526 + ], + "loc": { + "start": { + "line": 338, + "column": 28 + }, + "end": { + "line": 338, + "column": 34 + } + } + }, + "range": [ + 11502, + 11526 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 338, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 11527, + 11534 + ], + "loc": { + "start": { + "line": 338, + "column": 35 + }, + "end": { + "line": 338, + "column": 42 + } + } + }, + "range": [ + 11502, + 11534 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 338, + "column": 42 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 11535, + 11539 + ], + "loc": { + "start": { + "line": 338, + "column": 43 + }, + "end": { + "line": 338, + "column": 47 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 11561, + 11563 + ], + "loc": { + "start": { + "line": 339, + "column": 16 + }, + "end": { + "line": 339, + "column": 18 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11585, + 11589 + ], + "loc": { + "start": { + "line": 340, + "column": 18 + }, + "end": { + "line": 340, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 11590, + 11608 + ], + "loc": { + "start": { + "line": 340, + "column": 23 + }, + "end": { + "line": 340, + "column": 41 + } + } + }, + "range": [ + 11585, + 11608 + ], + "loc": { + "start": { + "line": 340, + "column": 18 + }, + "end": { + "line": 340, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11609, + 11614 + ], + "loc": { + "start": { + "line": 340, + "column": 42 + }, + "end": { + "line": 340, + "column": 47 + } + } + }, + "range": [ + 11585, + 11615 + ], + "loc": { + "start": { + "line": 340, + "column": 18 + }, + "end": { + "line": 340, + "column": 48 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11616, + 11620 + ], + "loc": { + "start": { + "line": 340, + "column": 49 + }, + "end": { + "line": 340, + "column": 53 + } + } + }, + "range": [ + 11585, + 11621 + ], + "loc": { + "start": { + "line": 340, + "column": 18 + }, + "end": { + "line": 340, + "column": 54 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11625, + 11629 + ], + "loc": { + "start": { + "line": 340, + "column": 58 + }, + "end": { + "line": 340, + "column": 62 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 11630, + 11648 + ], + "loc": { + "start": { + "line": 340, + "column": 63 + }, + "end": { + "line": 340, + "column": 81 + } + } + }, + "range": [ + 11625, + 11648 + ], + "loc": { + "start": { + "line": 340, + "column": 58 + }, + "end": { + "line": 340, + "column": 81 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11649, + 11654 + ], + "loc": { + "start": { + "line": 340, + "column": 82 + }, + "end": { + "line": 340, + "column": 87 + } + } + }, + "range": [ + 11625, + 11655 + ], + "loc": { + "start": { + "line": 340, + "column": 58 + }, + "end": { + "line": 340, + "column": 88 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11656, + 11660 + ], + "loc": { + "start": { + "line": 340, + "column": 89 + }, + "end": { + "line": 340, + "column": 93 + } + } + }, + "range": [ + 11625, + 11661 + ], + "loc": { + "start": { + "line": 340, + "column": 58 + }, + "end": { + "line": 340, + "column": 94 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 11662, + 11664 + ], + "loc": { + "start": { + "line": 340, + "column": 95 + }, + "end": { + "line": 340, + "column": 97 + } + } + }, + "range": [ + 11625, + 11665 + ], + "loc": { + "start": { + "line": 340, + "column": 58 + }, + "end": { + "line": 340, + "column": 98 + } + } + }, + "range": [ + 11585, + 11665 + ], + "loc": { + "start": { + "line": 340, + "column": 18 + }, + "end": { + "line": 340, + "column": 98 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11685, + 11689 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 341, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 11690, + 11708 + ], + "loc": { + "start": { + "line": 341, + "column": 21 + }, + "end": { + "line": 341, + "column": 39 + } + } + }, + "range": [ + 11685, + 11708 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 341, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11709, + 11714 + ], + "loc": { + "start": { + "line": 341, + "column": 40 + }, + "end": { + "line": 341, + "column": 45 + } + } + }, + "range": [ + 11685, + 11715 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 341, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11716, + 11720 + ], + "loc": { + "start": { + "line": 341, + "column": 47 + }, + "end": { + "line": 341, + "column": 51 + } + } + }, + "range": [ + 11685, + 11721 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 341, + "column": 52 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 11722, + 11724 + ], + "loc": { + "start": { + "line": 341, + "column": 53 + }, + "end": { + "line": 341, + "column": 55 + } + } + }, + "range": [ + 11685, + 11725 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 341, + "column": 56 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11728, + 11732 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 341, + "column": 63 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 11733, + 11751 + ], + "loc": { + "start": { + "line": 341, + "column": 64 + }, + "end": { + "line": 341, + "column": 82 + } + } + }, + "range": [ + 11728, + 11751 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 341, + "column": 82 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11752, + 11757 + ], + "loc": { + "start": { + "line": 341, + "column": 83 + }, + "end": { + "line": 341, + "column": 88 + } + } + }, + "range": [ + 11728, + 11758 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 341, + "column": 89 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11759, + 11763 + ], + "loc": { + "start": { + "line": 341, + "column": 90 + }, + "end": { + "line": 341, + "column": 94 + } + } + }, + "range": [ + 11728, + 11764 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 341, + "column": 95 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 11765, + 11767 + ], + "loc": { + "start": { + "line": 341, + "column": 96 + }, + "end": { + "line": 341, + "column": 98 + } + } + }, + "range": [ + 11728, + 11768 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 341, + "column": 99 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 11769, + 11775 + ], + "loc": { + "start": { + "line": 341, + "column": 100 + }, + "end": { + "line": 341, + "column": 106 + } + } + }, + "range": [ + 11728, + 11775 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 341, + "column": 106 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 11776, + 11777 + ], + "loc": { + "start": { + "line": 341, + "column": 107 + }, + "end": { + "line": 341, + "column": 108 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 11808, + 11809 + ], + "loc": { + "start": { + "line": 342, + "column": 25 + }, + "end": { + "line": 342, + "column": 26 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 11810, + 11811 + ], + "loc": { + "start": { + "line": 342, + "column": 27 + }, + "end": { + "line": 342, + "column": 28 + } + } + }, + "range": [ + 11808, + 11812 + ], + "loc": { + "start": { + "line": 342, + "column": 25 + }, + "end": { + "line": 342, + "column": 29 + } + } + }, + "right": { + "type": "Identifier", + "name": "callback", + "range": [ + 11817, + 11825 + ], + "loc": { + "start": { + "line": 342, + "column": 34 + }, + "end": { + "line": 342, + "column": 42 + } + } + }, + "range": [ + 11808, + 11825 + ], + "loc": { + "start": { + "line": 342, + "column": 25 + }, + "end": { + "line": 342, + "column": 42 + } + } + }, + "range": [ + 11801, + 11826 + ], + "loc": { + "start": { + "line": 342, + "column": 18 + }, + "end": { + "line": 342, + "column": 43 + } + } + } + ], + "range": [ + 11781, + 11844 + ], + "loc": { + "start": { + "line": 341, + "column": 112 + }, + "end": { + "line": 343, + "column": 17 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 11776, + 11844 + ], + "loc": { + "start": { + "line": 341, + "column": 107 + }, + "end": { + "line": 343, + "column": 17 + } + } + } + ], + "range": [ + 11728, + 11845 + ], + "loc": { + "start": { + "line": 341, + "column": 59 + }, + "end": { + "line": 343, + "column": 18 + } + } + }, + "range": [ + 11685, + 11845 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 343, + "column": 18 + } + } + }, + "range": [ + 11685, + 11846 + ], + "loc": { + "start": { + "line": 341, + "column": 16 + }, + "end": { + "line": 343, + "column": 19 + } + } + } + ], + "range": [ + 11667, + 11862 + ], + "loc": { + "start": { + "line": 340, + "column": 100 + }, + "end": { + "line": 344, + "column": 15 + } + } + }, + "alternate": null, + "range": [ + 11581, + 11862 + ], + "loc": { + "start": { + "line": 340, + "column": 14 + }, + "end": { + "line": 344, + "column": 15 + } + } + } + ], + "range": [ + 11565, + 11876 + ], + "loc": { + "start": { + "line": 339, + "column": 20 + }, + "end": { + "line": 345, + "column": 13 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11886, + 11890 + ], + "loc": { + "start": { + "line": 345, + "column": 23 + }, + "end": { + "line": 345, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 11891, + 11911 + ], + "loc": { + "start": { + "line": 345, + "column": 28 + }, + "end": { + "line": 345, + "column": 48 + } + } + }, + "range": [ + 11886, + 11911 + ], + "loc": { + "start": { + "line": 345, + "column": 23 + }, + "end": { + "line": 345, + "column": 48 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11912, + 11917 + ], + "loc": { + "start": { + "line": 345, + "column": 49 + }, + "end": { + "line": 345, + "column": 54 + } + } + }, + "range": [ + 11886, + 11918 + ], + "loc": { + "start": { + "line": 345, + "column": 23 + }, + "end": { + "line": 345, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11919, + 11923 + ], + "loc": { + "start": { + "line": 345, + "column": 56 + }, + "end": { + "line": 345, + "column": 60 + } + } + }, + "range": [ + 11886, + 11924 + ], + "loc": { + "start": { + "line": 345, + "column": 23 + }, + "end": { + "line": 345, + "column": 61 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11942, + 11946 + ], + "loc": { + "start": { + "line": 346, + "column": 14 + }, + "end": { + "line": 346, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 11947, + 11967 + ], + "loc": { + "start": { + "line": 346, + "column": 19 + }, + "end": { + "line": 346, + "column": 39 + } + } + }, + "range": [ + 11942, + 11967 + ], + "loc": { + "start": { + "line": 346, + "column": 14 + }, + "end": { + "line": 346, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 11968, + 11973 + ], + "loc": { + "start": { + "line": 346, + "column": 40 + }, + "end": { + "line": 346, + "column": 45 + } + } + }, + "range": [ + 11942, + 11974 + ], + "loc": { + "start": { + "line": 346, + "column": 14 + }, + "end": { + "line": 346, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 11975, + 11979 + ], + "loc": { + "start": { + "line": 346, + "column": 47 + }, + "end": { + "line": 346, + "column": 51 + } + } + }, + "range": [ + 11942, + 11980 + ], + "loc": { + "start": { + "line": 346, + "column": 14 + }, + "end": { + "line": 346, + "column": 52 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 11983, + 11987 + ], + "loc": { + "start": { + "line": 346, + "column": 55 + }, + "end": { + "line": 346, + "column": 59 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 11988, + 12008 + ], + "loc": { + "start": { + "line": 346, + "column": 60 + }, + "end": { + "line": 346, + "column": 80 + } + } + }, + "range": [ + 11983, + 12008 + ], + "loc": { + "start": { + "line": 346, + "column": 55 + }, + "end": { + "line": 346, + "column": 80 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 12009, + 12014 + ], + "loc": { + "start": { + "line": 346, + "column": 81 + }, + "end": { + "line": 346, + "column": 86 + } + } + }, + "range": [ + 11983, + 12015 + ], + "loc": { + "start": { + "line": 346, + "column": 55 + }, + "end": { + "line": 346, + "column": 87 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 12016, + 12020 + ], + "loc": { + "start": { + "line": 346, + "column": 88 + }, + "end": { + "line": 346, + "column": 92 + } + } + }, + "range": [ + 11983, + 12021 + ], + "loc": { + "start": { + "line": 346, + "column": 55 + }, + "end": { + "line": 346, + "column": 93 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 12022, + 12028 + ], + "loc": { + "start": { + "line": 346, + "column": 94 + }, + "end": { + "line": 346, + "column": 100 + } + } + }, + "range": [ + 11983, + 12028 + ], + "loc": { + "start": { + "line": 346, + "column": 55 + }, + "end": { + "line": 346, + "column": 100 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 12029, + 12030 + ], + "loc": { + "start": { + "line": 346, + "column": 101 + }, + "end": { + "line": 346, + "column": 102 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 12059, + 12060 + ], + "loc": { + "start": { + "line": 347, + "column": 23 + }, + "end": { + "line": 347, + "column": 24 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 12061, + 12062 + ], + "loc": { + "start": { + "line": 347, + "column": 25 + }, + "end": { + "line": 347, + "column": 26 + } + } + }, + "range": [ + 12059, + 12063 + ], + "loc": { + "start": { + "line": 347, + "column": 23 + }, + "end": { + "line": 347, + "column": 27 + } + } + }, + "right": { + "type": "Identifier", + "name": "callback", + "range": [ + 12068, + 12076 + ], + "loc": { + "start": { + "line": 347, + "column": 32 + }, + "end": { + "line": 347, + "column": 40 + } + } + }, + "range": [ + 12059, + 12076 + ], + "loc": { + "start": { + "line": 347, + "column": 23 + }, + "end": { + "line": 347, + "column": 40 + } + } + }, + "range": [ + 12052, + 12077 + ], + "loc": { + "start": { + "line": 347, + "column": 16 + }, + "end": { + "line": 347, + "column": 41 + } + } + } + ], + "range": [ + 12034, + 12093 + ], + "loc": { + "start": { + "line": 346, + "column": 106 + }, + "end": { + "line": 348, + "column": 15 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12029, + 12093 + ], + "loc": { + "start": { + "line": 346, + "column": 101 + }, + "end": { + "line": 348, + "column": 15 + } + } + } + ], + "range": [ + 11983, + 12094 + ], + "loc": { + "start": { + "line": 346, + "column": 55 + }, + "end": { + "line": 348, + "column": 16 + } + } + }, + "range": [ + 11942, + 12094 + ], + "loc": { + "start": { + "line": 346, + "column": 14 + }, + "end": { + "line": 348, + "column": 16 + } + } + }, + "range": [ + 11942, + 12095 + ], + "loc": { + "start": { + "line": 346, + "column": 14 + }, + "end": { + "line": 348, + "column": 17 + } + } + } + ], + "range": [ + 11926, + 12109 + ], + "loc": { + "start": { + "line": 345, + "column": 63 + }, + "end": { + "line": 349, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 11882, + 12109 + ], + "loc": { + "start": { + "line": 345, + "column": 19 + }, + "end": { + "line": 349, + "column": 13 + } + } + }, + "range": [ + 11557, + 12109 + ], + "loc": { + "start": { + "line": 339, + "column": 12 + }, + "end": { + "line": 349, + "column": 13 + } + } + } + ], + "range": [ + 11543, + 12121 + ], + "loc": { + "start": { + "line": 338, + "column": 51 + }, + "end": { + "line": 350, + "column": 11 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 11535, + 12121 + ], + "loc": { + "start": { + "line": 338, + "column": 43 + }, + "end": { + "line": 350, + "column": 11 + } + } + } + ], + "range": [ + 11502, + 12122 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 350, + "column": 12 + } + } + }, + "range": [ + 11502, + 12123 + ], + "loc": { + "start": { + "line": 338, + "column": 10 + }, + "end": { + "line": 350, + "column": 13 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.", + "range": [ + 11382, + 11491 + ], + "loc": { + "start": { + "line": 337, + "column": 10 + }, + "end": { + "line": 337, + "column": 119 + } + } + } + ] + } + ], + "range": [ + 11370, + 12133 + ], + "loc": { + "start": { + "line": 336, + "column": 15 + }, + "end": { + "line": 351, + "column": 9 + } + } + }, + "range": [ + 11231, + 12133 + ], + "loc": { + "start": { + "line": 334, + "column": 8 + }, + "end": { + "line": 351, + "column": 9 + } + } + } + ], + "range": [ + 11221, + 12141 + ], + "loc": { + "start": { + "line": 333, + "column": 29 + }, + "end": { + "line": 352, + "column": 7 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 12167, + 12172 + ], + "loc": { + "start": { + "line": 353, + "column": 18 + }, + "end": { + "line": 353, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 12173, + 12190 + ], + "loc": { + "start": { + "line": 353, + "column": 24 + }, + "end": { + "line": 353, + "column": 41 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 12194, + 12197 + ], + "loc": { + "start": { + "line": 353, + "column": 45 + }, + "end": { + "line": 353, + "column": 48 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 12190, + 12194 + ], + "loc": { + "start": { + "line": 353, + "column": 41 + }, + "end": { + "line": 353, + "column": 45 + } + } + } + ], + "range": [ + 12173, + 12197 + ], + "loc": { + "start": { + "line": 353, + "column": 24 + }, + "end": { + "line": 353, + "column": 48 + } + } + } + ], + "range": [ + 12163, + 12198 + ], + "loc": { + "start": { + "line": 353, + "column": 14 + }, + "end": { + "line": 353, + "column": 49 + } + } + }, + "range": [ + 12157, + 12199 + ], + "loc": { + "start": { + "line": 353, + "column": 8 + }, + "end": { + "line": 353, + "column": 50 + } + } + } + ], + "range": [ + 12147, + 12207 + ], + "loc": { + "start": { + "line": 352, + "column": 13 + }, + "end": { + "line": 354, + "column": 7 + } + } + }, + "range": [ + 11198, + 12207 + ], + "loc": { + "start": { + "line": 333, + "column": 6 + }, + "end": { + "line": 354, + "column": 7 + } + } + } + ], + "range": [ + 11190, + 12213 + ], + "loc": { + "start": { + "line": 332, + "column": 76 + }, + "end": { + "line": 355, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 12237, + 12242 + ], + "loc": { + "start": { + "line": 356, + "column": 16 + }, + "end": { + "line": 356, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown event '", + "cooked": "Unknown event '" + }, + "tail": false, + "range": [ + 12243, + 12261 + ], + "loc": { + "start": { + "line": 356, + "column": 22 + }, + "end": { + "line": 356, + "column": 40 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 12266, + 12269 + ], + "loc": { + "start": { + "line": 356, + "column": 45 + }, + "end": { + "line": 356, + "column": 48 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 12261, + 12266 + ], + "loc": { + "start": { + "line": 356, + "column": 40 + }, + "end": { + "line": 356, + "column": 45 + } + } + } + ], + "range": [ + 12243, + 12269 + ], + "loc": { + "start": { + "line": 356, + "column": 22 + }, + "end": { + "line": 356, + "column": 48 + } + } + } + ], + "range": [ + 12233, + 12270 + ], + "loc": { + "start": { + "line": 356, + "column": 12 + }, + "end": { + "line": 356, + "column": 49 + } + } + }, + "range": [ + 12227, + 12271 + ], + "loc": { + "start": { + "line": 356, + "column": 6 + }, + "end": { + "line": 356, + "column": 50 + } + } + } + ], + "range": [ + 12219, + 12277 + ], + "loc": { + "start": { + "line": 355, + "column": 11 + }, + "end": { + "line": 357, + "column": 5 + } + } + }, + "range": [ + 11118, + 12277 + ], + "loc": { + "start": { + "line": 332, + "column": 4 + }, + "end": { + "line": 357, + "column": 5 + } + } + } + ], + "range": [ + 11112, + 12281 + ], + "loc": { + "start": { + "line": 331, + "column": 33 + }, + "end": { + "line": 358, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 11084, + 12281 + ], + "loc": { + "start": { + "line": 331, + "column": 5 + }, + "end": { + "line": 358, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 11081, + 12281 + ], + "loc": { + "start": { + "line": 331, + "column": 2 + }, + "end": { + "line": 358, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Unregister an event listener that was registered with on().\n *\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 * @return {undefined} - Nothing.\n ", + "range": [ + 10675, + 11078 + ], + "loc": { + "start": { + "line": 321, + "column": 2 + }, + "end": { + "line": 330, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Register an event listener: \"added\", \"updated\" or \"removed\".\n *\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 * @return {undefined} - Nothing.\n ", + "range": [ + 12285, + 12725 + ], + "loc": { + "start": { + "line": 360, + "column": 2 + }, + "end": { + "line": 370, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "on", + "range": [ + 12728, + 12730 + ], + "loc": { + "start": { + "line": 371, + "column": 2 + }, + "end": { + "line": 371, + "column": 4 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 12731, + 12736 + ], + "loc": { + "start": { + "line": 371, + "column": 5 + }, + "end": { + "line": 371, + "column": 10 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 12738, + 12742 + ], + "loc": { + "start": { + "line": 371, + "column": 12 + }, + "end": { + "line": 371, + "column": 16 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 12744, + 12746 + ], + "loc": { + "start": { + "line": 371, + "column": 18 + }, + "end": { + "line": 371, + "column": 20 + } + } + }, + { + "type": "Identifier", + "name": "callback", + "range": [ + 12748, + 12756 + ], + "loc": { + "start": { + "line": 371, + "column": 22 + }, + "end": { + "line": 371, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 12758, + 12765 + ], + "loc": { + "start": { + "line": 371, + "column": 32 + }, + "end": { + "line": 371, + "column": 39 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 12777, + 12781 + ], + "loc": { + "start": { + "line": 372, + "column": 8 + }, + "end": { + "line": 372, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 12782, + 12800 + ], + "loc": { + "start": { + "line": 372, + "column": 13 + }, + "end": { + "line": 372, + "column": 31 + } + } + }, + "range": [ + 12777, + 12800 + ], + "loc": { + "start": { + "line": 372, + "column": 8 + }, + "end": { + "line": 372, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 12801, + 12806 + ], + "loc": { + "start": { + "line": 372, + "column": 32 + }, + "end": { + "line": 372, + "column": 37 + } + } + }, + "range": [ + 12777, + 12807 + ], + "loc": { + "start": { + "line": 372, + "column": 8 + }, + "end": { + "line": 372, + "column": 38 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 12811, + 12815 + ], + "loc": { + "start": { + "line": 372, + "column": 42 + }, + "end": { + "line": 372, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 12816, + 12836 + ], + "loc": { + "start": { + "line": 372, + "column": 47 + }, + "end": { + "line": 372, + "column": 67 + } + } + }, + "range": [ + 12811, + 12836 + ], + "loc": { + "start": { + "line": 372, + "column": 42 + }, + "end": { + "line": 372, + "column": 67 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 12837, + 12842 + ], + "loc": { + "start": { + "line": 372, + "column": 68 + }, + "end": { + "line": 372, + "column": 73 + } + } + }, + "range": [ + 12811, + 12843 + ], + "loc": { + "start": { + "line": 372, + "column": 42 + }, + "end": { + "line": 372, + "column": 74 + } + } + }, + "range": [ + 12777, + 12843 + ], + "loc": { + "start": { + "line": 372, + "column": 8 + }, + "end": { + "line": 372, + "column": 74 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 12857, + 12861 + ], + "loc": { + "start": { + "line": 373, + "column": 10 + }, + "end": { + "line": 373, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 12862, + 12868 + ], + "loc": { + "start": { + "line": 373, + "column": 15 + }, + "end": { + "line": 373, + "column": 21 + } + } + }, + "range": [ + 12857, + 12868 + ], + "loc": { + "start": { + "line": 373, + "column": 10 + }, + "end": { + "line": 373, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 12869, + 12873 + ], + "loc": { + "start": { + "line": 373, + "column": 22 + }, + "end": { + "line": 373, + "column": 26 + } + } + }, + "range": [ + 12857, + 12874 + ], + "loc": { + "start": { + "line": 373, + "column": 10 + }, + "end": { + "line": 373, + "column": 27 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "id", + "range": [ + 12890, + 12892 + ], + "loc": { + "start": { + "line": 374, + "column": 12 + }, + "end": { + "line": 374, + "column": 14 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 12897, + 12899 + ], + "loc": { + "start": { + "line": 374, + "column": 19 + }, + "end": { + "line": 374, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "toString", + "range": [ + 12901, + 12909 + ], + "loc": { + "start": { + "line": 374, + "column": 23 + }, + "end": { + "line": 374, + "column": 31 + } + } + }, + "range": [ + 12896, + 12909 + ], + "loc": { + "start": { + "line": 374, + "column": 18 + }, + "end": { + "line": 374, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 12910, + 12914 + ], + "loc": { + "start": { + "line": 374, + "column": 32 + }, + "end": { + "line": 374, + "column": 36 + } + } + }, + "range": [ + 12896, + 12914 + ], + "loc": { + "start": { + "line": 374, + "column": 18 + }, + "end": { + "line": 374, + "column": 36 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "id", + "range": [ + 12915, + 12917 + ], + "loc": { + "start": { + "line": 374, + "column": 37 + }, + "end": { + "line": 374, + "column": 39 + } + } + } + ], + "range": [ + 12896, + 12918 + ], + "loc": { + "start": { + "line": 374, + "column": 18 + }, + "end": { + "line": 374, + "column": 40 + } + } + }, + "right": { + "type": "Literal", + "value": "[object Function]", + "raw": "'[object Function]'", + "range": [ + 12923, + 12942 + ], + "loc": { + "start": { + "line": 374, + "column": 45 + }, + "end": { + "line": 374, + "column": 64 + } + } + }, + "range": [ + 12896, + 12942 + ], + "loc": { + "start": { + "line": 374, + "column": 18 + }, + "end": { + "line": 374, + "column": 64 + } + } + }, + "range": [ + 12890, + 12942 + ], + "loc": { + "start": { + "line": 374, + "column": 12 + }, + "end": { + "line": 374, + "column": 64 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 12956, + 12960 + ], + "loc": { + "start": { + "line": 375, + "column": 10 + }, + "end": { + "line": 375, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "on", + "range": [ + 12961, + 12963 + ], + "loc": { + "start": { + "line": 375, + "column": 15 + }, + "end": { + "line": 375, + "column": 17 + } + } + }, + "range": [ + 12956, + 12963 + ], + "loc": { + "start": { + "line": 375, + "column": 10 + }, + "end": { + "line": 375, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 12964, + 12968 + ], + "loc": { + "start": { + "line": 375, + "column": 18 + }, + "end": { + "line": 375, + "column": 22 + } + } + }, + "range": [ + 12956, + 12968 + ], + "loc": { + "start": { + "line": 375, + "column": 10 + }, + "end": { + "line": 375, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 12969, + 12973 + ], + "loc": { + "start": { + "line": 375, + "column": 23 + }, + "end": { + "line": 375, + "column": 27 + } + } + }, + { + "type": "Identifier", + "name": "event", + "range": [ + 12975, + 12980 + ], + "loc": { + "start": { + "line": 375, + "column": 29 + }, + "end": { + "line": 375, + "column": 34 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 12982, + 12986 + ], + "loc": { + "start": { + "line": 375, + "column": 36 + }, + "end": { + "line": 375, + "column": 40 + } + } + }, + { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 12988, + 12992 + ], + "loc": { + "start": { + "line": 375, + "column": 42 + }, + "end": { + "line": 375, + "column": 46 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 12994, + 12996 + ], + "loc": { + "start": { + "line": 375, + "column": 48 + }, + "end": { + "line": 375, + "column": 50 + } + } + }, + { + "type": "Identifier", + "name": "callback", + "range": [ + 12998, + 13006 + ], + "loc": { + "start": { + "line": 375, + "column": 52 + }, + "end": { + "line": 375, + "column": 60 + } + } + } + ], + "range": [ + 12956, + 13007 + ], + "loc": { + "start": { + "line": 375, + "column": 10 + }, + "end": { + "line": 375, + "column": 61 + } + } + }, + "range": [ + 12956, + 13008 + ], + "loc": { + "start": { + "line": 375, + "column": 10 + }, + "end": { + "line": 375, + "column": 62 + } + } + } + ], + "range": [ + 12944, + 13018 + ], + "loc": { + "start": { + "line": 374, + "column": 66 + }, + "end": { + "line": 376, + "column": 9 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13156, + 13160 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 378, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 13161, + 13167 + ], + "loc": { + "start": { + "line": 378, + "column": 15 + }, + "end": { + "line": 378, + "column": 21 + } + } + }, + "range": [ + 13156, + 13167 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 378, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13168, + 13172 + ], + "loc": { + "start": { + "line": 378, + "column": 22 + }, + "end": { + "line": 378, + "column": 26 + } + } + }, + "range": [ + 13156, + 13173 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 378, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "_names", + "range": [ + 13174, + 13180 + ], + "loc": { + "start": { + "line": 378, + "column": 28 + }, + "end": { + "line": 378, + "column": 34 + } + } + }, + "range": [ + 13156, + 13180 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 378, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 13181, + 13188 + ], + "loc": { + "start": { + "line": 378, + "column": 35 + }, + "end": { + "line": 378, + "column": 42 + } + } + }, + "range": [ + 13156, + 13188 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 378, + "column": 42 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 13189, + 13193 + ], + "loc": { + "start": { + "line": 378, + "column": 43 + }, + "end": { + "line": 378, + "column": 47 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 13215, + 13217 + ], + "loc": { + "start": { + "line": 379, + "column": 16 + }, + "end": { + "line": 379, + "column": 18 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13235, + 13239 + ], + "loc": { + "start": { + "line": 380, + "column": 14 + }, + "end": { + "line": 380, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 13240, + 13258 + ], + "loc": { + "start": { + "line": 380, + "column": 19 + }, + "end": { + "line": 380, + "column": 37 + } + } + }, + "range": [ + 13235, + 13258 + ], + "loc": { + "start": { + "line": 380, + "column": 14 + }, + "end": { + "line": 380, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13259, + 13264 + ], + "loc": { + "start": { + "line": 380, + "column": 38 + }, + "end": { + "line": 380, + "column": 43 + } + } + }, + "range": [ + 13235, + 13265 + ], + "loc": { + "start": { + "line": 380, + "column": 14 + }, + "end": { + "line": 380, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13266, + 13270 + ], + "loc": { + "start": { + "line": 380, + "column": 45 + }, + "end": { + "line": 380, + "column": 49 + } + } + }, + "range": [ + 13235, + 13271 + ], + "loc": { + "start": { + "line": 380, + "column": 14 + }, + "end": { + "line": 380, + "column": 50 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13274, + 13278 + ], + "loc": { + "start": { + "line": 380, + "column": 53 + }, + "end": { + "line": 380, + "column": 57 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 13279, + 13297 + ], + "loc": { + "start": { + "line": 380, + "column": 58 + }, + "end": { + "line": 380, + "column": 76 + } + } + }, + "range": [ + 13274, + 13297 + ], + "loc": { + "start": { + "line": 380, + "column": 53 + }, + "end": { + "line": 380, + "column": 76 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13298, + 13303 + ], + "loc": { + "start": { + "line": 380, + "column": 77 + }, + "end": { + "line": 380, + "column": 82 + } + } + }, + "range": [ + 13274, + 13304 + ], + "loc": { + "start": { + "line": 380, + "column": 53 + }, + "end": { + "line": 380, + "column": 83 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13305, + 13309 + ], + "loc": { + "start": { + "line": 380, + "column": 84 + }, + "end": { + "line": 380, + "column": 88 + } + } + }, + "range": [ + 13274, + 13310 + ], + "loc": { + "start": { + "line": 380, + "column": 53 + }, + "end": { + "line": 380, + "column": 89 + } + } + }, + "right": { + "type": "ObjectExpression", + "properties": [], + "range": [ + 13314, + 13316 + ], + "loc": { + "start": { + "line": 380, + "column": 93 + }, + "end": { + "line": 380, + "column": 95 + } + } + }, + "range": [ + 13274, + 13316 + ], + "loc": { + "start": { + "line": 380, + "column": 53 + }, + "end": { + "line": 380, + "column": 95 + } + } + }, + "range": [ + 13235, + 13316 + ], + "loc": { + "start": { + "line": 380, + "column": 14 + }, + "end": { + "line": 380, + "column": 95 + } + } + }, + "range": [ + 13235, + 13317 + ], + "loc": { + "start": { + "line": 380, + "column": 14 + }, + "end": { + "line": 380, + "column": 96 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13332, + 13336 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 13337, + 13355 + ], + "loc": { + "start": { + "line": 381, + "column": 19 + }, + "end": { + "line": 381, + "column": 37 + } + } + }, + "range": [ + 13332, + 13355 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13356, + 13361 + ], + "loc": { + "start": { + "line": 381, + "column": 38 + }, + "end": { + "line": 381, + "column": 43 + } + } + }, + "range": [ + 13332, + 13362 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13363, + 13367 + ], + "loc": { + "start": { + "line": 381, + "column": 45 + }, + "end": { + "line": 381, + "column": 49 + } + } + }, + "range": [ + 13332, + 13368 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 13369, + 13371 + ], + "loc": { + "start": { + "line": 381, + "column": 51 + }, + "end": { + "line": 381, + "column": 53 + } + } + }, + "range": [ + 13332, + 13372 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 54 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13375, + 13379 + ], + "loc": { + "start": { + "line": 381, + "column": 57 + }, + "end": { + "line": 381, + "column": 61 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 13380, + 13398 + ], + "loc": { + "start": { + "line": 381, + "column": 62 + }, + "end": { + "line": 381, + "column": 80 + } + } + }, + "range": [ + 13375, + 13398 + ], + "loc": { + "start": { + "line": 381, + "column": 57 + }, + "end": { + "line": 381, + "column": 80 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13399, + 13404 + ], + "loc": { + "start": { + "line": 381, + "column": 81 + }, + "end": { + "line": 381, + "column": 86 + } + } + }, + "range": [ + 13375, + 13405 + ], + "loc": { + "start": { + "line": 381, + "column": 57 + }, + "end": { + "line": 381, + "column": 87 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13406, + 13410 + ], + "loc": { + "start": { + "line": 381, + "column": 88 + }, + "end": { + "line": 381, + "column": 92 + } + } + }, + "range": [ + 13375, + 13411 + ], + "loc": { + "start": { + "line": 381, + "column": 57 + }, + "end": { + "line": 381, + "column": 93 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 13412, + 13414 + ], + "loc": { + "start": { + "line": 381, + "column": 94 + }, + "end": { + "line": 381, + "column": 96 + } + } + }, + "range": [ + 13375, + 13415 + ], + "loc": { + "start": { + "line": 381, + "column": 57 + }, + "end": { + "line": 381, + "column": 97 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 13419, + 13421 + ], + "loc": { + "start": { + "line": 381, + "column": 101 + }, + "end": { + "line": 381, + "column": 103 + } + } + }, + "range": [ + 13375, + 13421 + ], + "loc": { + "start": { + "line": 381, + "column": 57 + }, + "end": { + "line": 381, + "column": 103 + } + } + }, + "range": [ + 13332, + 13421 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 103 + } + } + }, + "range": [ + 13332, + 13422 + ], + "loc": { + "start": { + "line": 381, + "column": 14 + }, + "end": { + "line": 381, + "column": 104 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13442, + 13446 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 13447, + 13465 + ], + "loc": { + "start": { + "line": 382, + "column": 24 + }, + "end": { + "line": 382, + "column": 42 + } + } + }, + "range": [ + 13442, + 13465 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 42 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13466, + 13471 + ], + "loc": { + "start": { + "line": 382, + "column": 43 + }, + "end": { + "line": 382, + "column": 48 + } + } + }, + "range": [ + 13442, + 13472 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13473, + 13477 + ], + "loc": { + "start": { + "line": 382, + "column": 50 + }, + "end": { + "line": 382, + "column": 54 + } + } + }, + "range": [ + 13442, + 13478 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 13479, + 13481 + ], + "loc": { + "start": { + "line": 382, + "column": 56 + }, + "end": { + "line": 382, + "column": 58 + } + } + }, + "range": [ + 13442, + 13482 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 59 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 13483, + 13487 + ], + "loc": { + "start": { + "line": 382, + "column": 60 + }, + "end": { + "line": 382, + "column": 64 + } + } + }, + "range": [ + 13442, + 13487 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 64 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 13488, + 13489 + ], + "loc": { + "start": { + "line": 382, + "column": 65 + }, + "end": { + "line": 382, + "column": 66 + } + } + } + ], + "body": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 13493, + 13494 + ], + "loc": { + "start": { + "line": 382, + "column": 70 + }, + "end": { + "line": 382, + "column": 71 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 13495, + 13496 + ], + "loc": { + "start": { + "line": 382, + "column": 72 + }, + "end": { + "line": 382, + "column": 73 + } + } + }, + "range": [ + 13493, + 13497 + ], + "loc": { + "start": { + "line": 382, + "column": 70 + }, + "end": { + "line": 382, + "column": 74 + } + } + }, + "right": { + "type": "Identifier", + "name": "callback", + "range": [ + 13502, + 13510 + ], + "loc": { + "start": { + "line": 382, + "column": 79 + }, + "end": { + "line": 382, + "column": 87 + } + } + }, + "range": [ + 13493, + 13510 + ], + "loc": { + "start": { + "line": 382, + "column": 70 + }, + "end": { + "line": 382, + "column": 87 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 13488, + 13510 + ], + "loc": { + "start": { + "line": 382, + "column": 65 + }, + "end": { + "line": 382, + "column": 87 + } + } + } + ], + "range": [ + 13442, + 13511 + ], + "loc": { + "start": { + "line": 382, + "column": 19 + }, + "end": { + "line": 382, + "column": 88 + } + } + }, + "prefix": true, + "range": [ + 13441, + 13511 + ], + "loc": { + "start": { + "line": 382, + "column": 18 + }, + "end": { + "line": 382, + "column": 88 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13531, + 13535 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 13536, + 13554 + ], + "loc": { + "start": { + "line": 383, + "column": 21 + }, + "end": { + "line": 383, + "column": 39 + } + } + }, + "range": [ + 13531, + 13554 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13555, + 13560 + ], + "loc": { + "start": { + "line": 383, + "column": 40 + }, + "end": { + "line": 383, + "column": 45 + } + } + }, + "range": [ + 13531, + 13561 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13562, + 13566 + ], + "loc": { + "start": { + "line": 383, + "column": 47 + }, + "end": { + "line": 383, + "column": 51 + } + } + }, + "range": [ + 13531, + 13567 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 52 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 13568, + 13570 + ], + "loc": { + "start": { + "line": 383, + "column": 53 + }, + "end": { + "line": 383, + "column": 55 + } + } + }, + "range": [ + 13531, + 13571 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 56 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 13572, + 13576 + ], + "loc": { + "start": { + "line": 383, + "column": 57 + }, + "end": { + "line": 383, + "column": 61 + } + } + }, + "range": [ + 13531, + 13576 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 61 + } + } + }, + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Identifier", + "name": "callback", + "range": [ + 13579, + 13587 + ], + "loc": { + "start": { + "line": 383, + "column": 64 + }, + "end": { + "line": 383, + "column": 72 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 13589, + 13596 + ], + "loc": { + "start": { + "line": 383, + "column": 74 + }, + "end": { + "line": 383, + "column": 81 + } + } + } + ], + "range": [ + 13577, + 13598 + ], + "loc": { + "start": { + "line": 383, + "column": 62 + }, + "end": { + "line": 383, + "column": 83 + } + } + } + ], + "range": [ + 13531, + 13599 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 84 + } + } + }, + "range": [ + 13531, + 13600 + ], + "loc": { + "start": { + "line": 383, + "column": 16 + }, + "end": { + "line": 383, + "column": 85 + } + } + } + ], + "range": [ + 13513, + 13616 + ], + "loc": { + "start": { + "line": 382, + "column": 90 + }, + "end": { + "line": 384, + "column": 15 + } + } + }, + "alternate": null, + "range": [ + 13437, + 13616 + ], + "loc": { + "start": { + "line": 382, + "column": 14 + }, + "end": { + "line": 384, + "column": 15 + } + } + } + ], + "range": [ + 13219, + 13630 + ], + "loc": { + "start": { + "line": 379, + "column": 20 + }, + "end": { + "line": 385, + "column": 13 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13652, + 13656 + ], + "loc": { + "start": { + "line": 386, + "column": 14 + }, + "end": { + "line": 386, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 13657, + 13677 + ], + "loc": { + "start": { + "line": 386, + "column": 19 + }, + "end": { + "line": 386, + "column": 39 + } + } + }, + "range": [ + 13652, + 13677 + ], + "loc": { + "start": { + "line": 386, + "column": 14 + }, + "end": { + "line": 386, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13678, + 13683 + ], + "loc": { + "start": { + "line": 386, + "column": 40 + }, + "end": { + "line": 386, + "column": 45 + } + } + }, + "range": [ + 13652, + 13684 + ], + "loc": { + "start": { + "line": 386, + "column": 14 + }, + "end": { + "line": 386, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13685, + 13689 + ], + "loc": { + "start": { + "line": 386, + "column": 47 + }, + "end": { + "line": 386, + "column": 51 + } + } + }, + "range": [ + 13652, + 13690 + ], + "loc": { + "start": { + "line": 386, + "column": 14 + }, + "end": { + "line": 386, + "column": 52 + } + } + }, + "right": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13693, + 13697 + ], + "loc": { + "start": { + "line": 386, + "column": 55 + }, + "end": { + "line": 386, + "column": 59 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 13698, + 13718 + ], + "loc": { + "start": { + "line": 386, + "column": 60 + }, + "end": { + "line": 386, + "column": 80 + } + } + }, + "range": [ + 13693, + 13718 + ], + "loc": { + "start": { + "line": 386, + "column": 55 + }, + "end": { + "line": 386, + "column": 80 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13719, + 13724 + ], + "loc": { + "start": { + "line": 386, + "column": 81 + }, + "end": { + "line": 386, + "column": 86 + } + } + }, + "range": [ + 13693, + 13725 + ], + "loc": { + "start": { + "line": 386, + "column": 55 + }, + "end": { + "line": 386, + "column": 87 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13726, + 13730 + ], + "loc": { + "start": { + "line": 386, + "column": 88 + }, + "end": { + "line": 386, + "column": 92 + } + } + }, + "range": [ + 13693, + 13731 + ], + "loc": { + "start": { + "line": 386, + "column": 55 + }, + "end": { + "line": 386, + "column": 93 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [], + "range": [ + 13735, + 13737 + ], + "loc": { + "start": { + "line": 386, + "column": 97 + }, + "end": { + "line": 386, + "column": 99 + } + } + }, + "range": [ + 13693, + 13737 + ], + "loc": { + "start": { + "line": 386, + "column": 55 + }, + "end": { + "line": 386, + "column": 99 + } + } + }, + "range": [ + 13652, + 13737 + ], + "loc": { + "start": { + "line": 386, + "column": 14 + }, + "end": { + "line": 386, + "column": 99 + } + } + }, + "range": [ + 13652, + 13738 + ], + "loc": { + "start": { + "line": 386, + "column": 14 + }, + "end": { + "line": 386, + "column": 100 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13758, + 13762 + ], + "loc": { + "start": { + "line": 387, + "column": 19 + }, + "end": { + "line": 387, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 13763, + 13783 + ], + "loc": { + "start": { + "line": 387, + "column": 24 + }, + "end": { + "line": 387, + "column": 44 + } + } + }, + "range": [ + 13758, + 13783 + ], + "loc": { + "start": { + "line": 387, + "column": 19 + }, + "end": { + "line": 387, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13784, + 13789 + ], + "loc": { + "start": { + "line": 387, + "column": 45 + }, + "end": { + "line": 387, + "column": 50 + } + } + }, + "range": [ + 13758, + 13790 + ], + "loc": { + "start": { + "line": 387, + "column": 19 + }, + "end": { + "line": 387, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13791, + 13795 + ], + "loc": { + "start": { + "line": 387, + "column": 52 + }, + "end": { + "line": 387, + "column": 56 + } + } + }, + "range": [ + 13758, + 13796 + ], + "loc": { + "start": { + "line": 387, + "column": 19 + }, + "end": { + "line": 387, + "column": 57 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 13797, + 13801 + ], + "loc": { + "start": { + "line": 387, + "column": 58 + }, + "end": { + "line": 387, + "column": 62 + } + } + }, + "range": [ + 13758, + 13801 + ], + "loc": { + "start": { + "line": 387, + "column": 19 + }, + "end": { + "line": 387, + "column": 62 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 13802, + 13803 + ], + "loc": { + "start": { + "line": 387, + "column": 63 + }, + "end": { + "line": 387, + "column": 64 + } + } + } + ], + "body": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 13807, + 13808 + ], + "loc": { + "start": { + "line": 387, + "column": 68 + }, + "end": { + "line": 387, + "column": 69 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 13809, + 13810 + ], + "loc": { + "start": { + "line": 387, + "column": 70 + }, + "end": { + "line": 387, + "column": 71 + } + } + }, + "range": [ + 13807, + 13811 + ], + "loc": { + "start": { + "line": 387, + "column": 68 + }, + "end": { + "line": 387, + "column": 72 + } + } + }, + "right": { + "type": "Identifier", + "name": "callback", + "range": [ + 13816, + 13824 + ], + "loc": { + "start": { + "line": 387, + "column": 77 + }, + "end": { + "line": 387, + "column": 85 + } + } + }, + "range": [ + 13807, + 13824 + ], + "loc": { + "start": { + "line": 387, + "column": 68 + }, + "end": { + "line": 387, + "column": 85 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 13802, + 13824 + ], + "loc": { + "start": { + "line": 387, + "column": 63 + }, + "end": { + "line": 387, + "column": 85 + } + } + } + ], + "range": [ + 13758, + 13825 + ], + "loc": { + "start": { + "line": 387, + "column": 19 + }, + "end": { + "line": 387, + "column": 86 + } + } + }, + "prefix": true, + "range": [ + 13757, + 13825 + ], + "loc": { + "start": { + "line": 387, + "column": 18 + }, + "end": { + "line": 387, + "column": 86 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 13845, + 13849 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 13850, + 13870 + ], + "loc": { + "start": { + "line": 388, + "column": 21 + }, + "end": { + "line": 388, + "column": 41 + } + } + }, + "range": [ + 13845, + 13870 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "event", + "range": [ + 13871, + 13876 + ], + "loc": { + "start": { + "line": 388, + "column": 42 + }, + "end": { + "line": 388, + "column": 47 + } + } + }, + "range": [ + 13845, + 13877 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 48 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 13878, + 13882 + ], + "loc": { + "start": { + "line": 388, + "column": 49 + }, + "end": { + "line": 388, + "column": 53 + } + } + }, + "range": [ + 13845, + 13883 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 13884, + 13888 + ], + "loc": { + "start": { + "line": 388, + "column": 55 + }, + "end": { + "line": 388, + "column": 59 + } + } + }, + "range": [ + 13845, + 13888 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 59 + } + } + }, + "arguments": [ + { + "type": "ArrayExpression", + "elements": [ + { + "type": "Identifier", + "name": "callback", + "range": [ + 13891, + 13899 + ], + "loc": { + "start": { + "line": 388, + "column": 62 + }, + "end": { + "line": 388, + "column": 70 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 13901, + 13908 + ], + "loc": { + "start": { + "line": 388, + "column": 72 + }, + "end": { + "line": 388, + "column": 79 + } + } + } + ], + "range": [ + 13889, + 13910 + ], + "loc": { + "start": { + "line": 388, + "column": 60 + }, + "end": { + "line": 388, + "column": 81 + } + } + } + ], + "range": [ + 13845, + 13911 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 82 + } + } + }, + "range": [ + 13845, + 13912 + ], + "loc": { + "start": { + "line": 388, + "column": 16 + }, + "end": { + "line": 388, + "column": 83 + } + } + } + ], + "range": [ + 13827, + 13928 + ], + "loc": { + "start": { + "line": 387, + "column": 88 + }, + "end": { + "line": 389, + "column": 15 + } + } + }, + "alternate": null, + "range": [ + 13753, + 13928 + ], + "loc": { + "start": { + "line": 387, + "column": 14 + }, + "end": { + "line": 389, + "column": 15 + } + } + } + ], + "range": [ + 13636, + 13942 + ], + "loc": { + "start": { + "line": 385, + "column": 19 + }, + "end": { + "line": 390, + "column": 13 + } + } + }, + "range": [ + 13211, + 13942 + ], + "loc": { + "start": { + "line": 379, + "column": 12 + }, + "end": { + "line": 390, + "column": 13 + } + } + } + ], + "range": [ + 13197, + 13954 + ], + "loc": { + "start": { + "line": 378, + "column": 51 + }, + "end": { + "line": 391, + "column": 11 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 13189, + 13954 + ], + "loc": { + "start": { + "line": 378, + "column": 43 + }, + "end": { + "line": 391, + "column": 11 + } + } + } + ], + "range": [ + 13156, + 13955 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 391, + "column": 12 + } + } + }, + "range": [ + 13156, + 13956 + ], + "loc": { + "start": { + "line": 378, + "column": 10 + }, + "end": { + "line": 391, + "column": 13 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.", + "range": [ + 13036, + 13145 + ], + "loc": { + "start": { + "line": 377, + "column": 10 + }, + "end": { + "line": 377, + "column": 119 + } + } + } + ] + } + ], + "range": [ + 13024, + 13966 + ], + "loc": { + "start": { + "line": 376, + "column": 15 + }, + "end": { + "line": 392, + "column": 9 + } + } + }, + "range": [ + 12886, + 13966 + ], + "loc": { + "start": { + "line": 374, + "column": 8 + }, + "end": { + "line": 392, + "column": 9 + } + } + } + ], + "range": [ + 12876, + 13974 + ], + "loc": { + "start": { + "line": 373, + "column": 29 + }, + "end": { + "line": 393, + "column": 7 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 14000, + 14005 + ], + "loc": { + "start": { + "line": 394, + "column": 18 + }, + "end": { + "line": 394, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 14006, + 14023 + ], + "loc": { + "start": { + "line": 394, + "column": 24 + }, + "end": { + "line": 394, + "column": 41 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 14027, + 14030 + ], + "loc": { + "start": { + "line": 394, + "column": 45 + }, + "end": { + "line": 394, + "column": 48 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 14023, + 14027 + ], + "loc": { + "start": { + "line": 394, + "column": 41 + }, + "end": { + "line": 394, + "column": 45 + } + } + } + ], + "range": [ + 14006, + 14030 + ], + "loc": { + "start": { + "line": 394, + "column": 24 + }, + "end": { + "line": 394, + "column": 48 + } + } + } + ], + "range": [ + 13996, + 14031 + ], + "loc": { + "start": { + "line": 394, + "column": 14 + }, + "end": { + "line": 394, + "column": 49 + } + } + }, + "range": [ + 13990, + 14032 + ], + "loc": { + "start": { + "line": 394, + "column": 8 + }, + "end": { + "line": 394, + "column": 50 + } + } + } + ], + "range": [ + 13980, + 14040 + ], + "loc": { + "start": { + "line": 393, + "column": 13 + }, + "end": { + "line": 395, + "column": 7 + } + } + }, + "range": [ + 12853, + 14040 + ], + "loc": { + "start": { + "line": 373, + "column": 6 + }, + "end": { + "line": 395, + "column": 7 + } + } + } + ], + "range": [ + 12845, + 14046 + ], + "loc": { + "start": { + "line": 372, + "column": 76 + }, + "end": { + "line": 396, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 14070, + 14075 + ], + "loc": { + "start": { + "line": 397, + "column": 16 + }, + "end": { + "line": 397, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown event '", + "cooked": "Unknown event '" + }, + "tail": false, + "range": [ + 14076, + 14094 + ], + "loc": { + "start": { + "line": 397, + "column": 22 + }, + "end": { + "line": 397, + "column": 40 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 14099, + 14102 + ], + "loc": { + "start": { + "line": 397, + "column": 45 + }, + "end": { + "line": 397, + "column": 48 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "event", + "range": [ + 14094, + 14099 + ], + "loc": { + "start": { + "line": 397, + "column": 40 + }, + "end": { + "line": 397, + "column": 45 + } + } + } + ], + "range": [ + 14076, + 14102 + ], + "loc": { + "start": { + "line": 397, + "column": 22 + }, + "end": { + "line": 397, + "column": 48 + } + } + } + ], + "range": [ + 14066, + 14103 + ], + "loc": { + "start": { + "line": 397, + "column": 12 + }, + "end": { + "line": 397, + "column": 49 + } + } + }, + "range": [ + 14060, + 14104 + ], + "loc": { + "start": { + "line": 397, + "column": 6 + }, + "end": { + "line": 397, + "column": 50 + } + } + } + ], + "range": [ + 14052, + 14110 + ], + "loc": { + "start": { + "line": 396, + "column": 11 + }, + "end": { + "line": 398, + "column": 5 + } + } + }, + "range": [ + 12773, + 14110 + ], + "loc": { + "start": { + "line": 372, + "column": 4 + }, + "end": { + "line": 398, + "column": 5 + } + } + } + ], + "range": [ + 12767, + 14114 + ], + "loc": { + "start": { + "line": 371, + "column": 41 + }, + "end": { + "line": 399, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 12730, + 14114 + ], + "loc": { + "start": { + "line": 371, + "column": 4 + }, + "end": { + "line": 399, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 12728, + 14114 + ], + "loc": { + "start": { + "line": 371, + "column": 2 + }, + "end": { + "line": 399, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Register an event listener: \"added\", \"updated\" or \"removed\".\n *\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 * @return {undefined} - Nothing.\n ", + "range": [ + 12285, + 12725 + ], + "loc": { + "start": { + "line": 360, + "column": 2 + }, + "end": { + "line": 370, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 14118, + 14452 + ], + "loc": { + "start": { + "line": 401, + "column": 2 + }, + "end": { + "line": 409, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "push", + "range": [ + 14455, + 14459 + ], + "loc": { + "start": { + "line": 410, + "column": 2 + }, + "end": { + "line": 410, + "column": 6 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "root", + "range": [ + 14460, + 14464 + ], + "loc": { + "start": { + "line": 410, + "column": 7 + }, + "end": { + "line": 410, + "column": 11 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "root", + "range": [ + 14476, + 14480 + ], + "loc": { + "start": { + "line": 411, + "column": 8 + }, + "end": { + "line": 411, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 14481, + 14485 + ], + "loc": { + "start": { + "line": 411, + "column": 13 + }, + "end": { + "line": 411, + "column": 17 + } + } + }, + "range": [ + 14476, + 14485 + ], + "loc": { + "start": { + "line": 411, + "column": 8 + }, + "end": { + "line": 411, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "constructor", + "range": [ + 14486, + 14497 + ], + "loc": { + "start": { + "line": 411, + "column": 18 + }, + "end": { + "line": 411, + "column": 29 + } + } + }, + "range": [ + 14476, + 14497 + ], + "loc": { + "start": { + "line": 411, + "column": 8 + }, + "end": { + "line": 411, + "column": 29 + } + } + }, + "right": { + "type": "Identifier", + "name": "Array", + "range": [ + 14502, + 14507 + ], + "loc": { + "start": { + "line": 411, + "column": 34 + }, + "end": { + "line": 411, + "column": 39 + } + } + }, + "range": [ + 14476, + 14507 + ], + "loc": { + "start": { + "line": 411, + "column": 8 + }, + "end": { + "line": 411, + "column": 39 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "root", + "range": [ + 14517, + 14521 + ], + "loc": { + "start": { + "line": 412, + "column": 6 + }, + "end": { + "line": 412, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 14522, + 14526 + ], + "loc": { + "start": { + "line": 412, + "column": 11 + }, + "end": { + "line": 412, + "column": 15 + } + } + }, + "range": [ + 14517, + 14526 + ], + "loc": { + "start": { + "line": 412, + "column": 6 + }, + "end": { + "line": 412, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 14527, + 14534 + ], + "loc": { + "start": { + "line": 412, + "column": 16 + }, + "end": { + "line": 412, + "column": 23 + } + } + }, + "range": [ + 14517, + 14534 + ], + "loc": { + "start": { + "line": 412, + "column": 6 + }, + "end": { + "line": 412, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 14535, + 14536 + ], + "loc": { + "start": { + "line": 412, + "column": 24 + }, + "end": { + "line": 412, + "column": 25 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 14540, + 14544 + ], + "loc": { + "start": { + "line": 412, + "column": 29 + }, + "end": { + "line": 412, + "column": 33 + } + } + }, + "property": { + "type": "Identifier", + "name": "add", + "range": [ + 14545, + 14548 + ], + "loc": { + "start": { + "line": 412, + "column": 34 + }, + "end": { + "line": 412, + "column": 37 + } + } + }, + "range": [ + 14540, + 14548 + ], + "loc": { + "start": { + "line": 412, + "column": 29 + }, + "end": { + "line": 412, + "column": 37 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 14549, + 14550 + ], + "loc": { + "start": { + "line": 412, + "column": 38 + }, + "end": { + "line": 412, + "column": 39 + } + } + } + ], + "range": [ + 14540, + 14551 + ], + "loc": { + "start": { + "line": 412, + "column": 29 + }, + "end": { + "line": 412, + "column": 40 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 14535, + 14551 + ], + "loc": { + "start": { + "line": 412, + "column": 24 + }, + "end": { + "line": 412, + "column": 40 + } + } + } + ], + "range": [ + 14517, + 14552 + ], + "loc": { + "start": { + "line": 412, + "column": 6 + }, + "end": { + "line": 412, + "column": 41 + } + } + }, + "range": [ + 14517, + 14553 + ], + "loc": { + "start": { + "line": 412, + "column": 6 + }, + "end": { + "line": 412, + "column": 42 + } + } + } + ], + "range": [ + 14509, + 14559 + ], + "loc": { + "start": { + "line": 411, + "column": 41 + }, + "end": { + "line": 413, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 14573, + 14577 + ], + "loc": { + "start": { + "line": 414, + "column": 6 + }, + "end": { + "line": 414, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "add", + "range": [ + 14578, + 14581 + ], + "loc": { + "start": { + "line": 414, + "column": 11 + }, + "end": { + "line": 414, + "column": 14 + } + } + }, + "range": [ + 14573, + 14581 + ], + "loc": { + "start": { + "line": 414, + "column": 6 + }, + "end": { + "line": 414, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "root", + "range": [ + 14582, + 14586 + ], + "loc": { + "start": { + "line": 414, + "column": 15 + }, + "end": { + "line": 414, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "data", + "range": [ + 14587, + 14591 + ], + "loc": { + "start": { + "line": 414, + "column": 20 + }, + "end": { + "line": 414, + "column": 24 + } + } + }, + "range": [ + 14582, + 14591 + ], + "loc": { + "start": { + "line": 414, + "column": 15 + }, + "end": { + "line": 414, + "column": 24 + } + } + } + ], + "range": [ + 14573, + 14592 + ], + "loc": { + "start": { + "line": 414, + "column": 6 + }, + "end": { + "line": 414, + "column": 25 + } + } + }, + "range": [ + 14573, + 14593 + ], + "loc": { + "start": { + "line": 414, + "column": 6 + }, + "end": { + "line": 414, + "column": 26 + } + } + } + ], + "range": [ + 14565, + 14599 + ], + "loc": { + "start": { + "line": 413, + "column": 11 + }, + "end": { + "line": 415, + "column": 5 + } + } + }, + "range": [ + 14472, + 14599 + ], + "loc": { + "start": { + "line": 411, + "column": 4 + }, + "end": { + "line": 415, + "column": 5 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "root", + "range": [ + 14608, + 14612 + ], + "loc": { + "start": { + "line": 416, + "column": 8 + }, + "end": { + "line": 416, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "included", + "range": [ + 14613, + 14621 + ], + "loc": { + "start": { + "line": 416, + "column": 13 + }, + "end": { + "line": 416, + "column": 21 + } + } + }, + "range": [ + 14608, + 14621 + ], + "loc": { + "start": { + "line": 416, + "column": 8 + }, + "end": { + "line": 416, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "root", + "range": [ + 14631, + 14635 + ], + "loc": { + "start": { + "line": 417, + "column": 6 + }, + "end": { + "line": 417, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "included", + "range": [ + 14636, + 14644 + ], + "loc": { + "start": { + "line": 417, + "column": 11 + }, + "end": { + "line": 417, + "column": 19 + } + } + }, + "range": [ + 14631, + 14644 + ], + "loc": { + "start": { + "line": 417, + "column": 6 + }, + "end": { + "line": 417, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 14645, + 14652 + ], + "loc": { + "start": { + "line": 417, + "column": 20 + }, + "end": { + "line": 417, + "column": 27 + } + } + }, + "range": [ + 14631, + 14652 + ], + "loc": { + "start": { + "line": 417, + "column": 6 + }, + "end": { + "line": 417, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 14653, + 14654 + ], + "loc": { + "start": { + "line": 417, + "column": 28 + }, + "end": { + "line": 417, + "column": 29 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 14658, + 14662 + ], + "loc": { + "start": { + "line": 417, + "column": 33 + }, + "end": { + "line": 417, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "add", + "range": [ + 14663, + 14666 + ], + "loc": { + "start": { + "line": 417, + "column": 38 + }, + "end": { + "line": 417, + "column": 41 + } + } + }, + "range": [ + 14658, + 14666 + ], + "loc": { + "start": { + "line": 417, + "column": 33 + }, + "end": { + "line": 417, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 14667, + 14668 + ], + "loc": { + "start": { + "line": 417, + "column": 42 + }, + "end": { + "line": 417, + "column": 43 + } + } + } + ], + "range": [ + 14658, + 14669 + ], + "loc": { + "start": { + "line": 417, + "column": 33 + }, + "end": { + "line": 417, + "column": 44 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 14653, + 14669 + ], + "loc": { + "start": { + "line": 417, + "column": 28 + }, + "end": { + "line": 417, + "column": 44 + } + } + } + ], + "range": [ + 14631, + 14670 + ], + "loc": { + "start": { + "line": 417, + "column": 6 + }, + "end": { + "line": 417, + "column": 45 + } + } + }, + "range": [ + 14631, + 14671 + ], + "loc": { + "start": { + "line": 417, + "column": 6 + }, + "end": { + "line": 417, + "column": 46 + } + } + } + ], + "range": [ + 14623, + 14677 + ], + "loc": { + "start": { + "line": 416, + "column": 23 + }, + "end": { + "line": 418, + "column": 5 + } + } + }, + "alternate": null, + "range": [ + 14604, + 14677 + ], + "loc": { + "start": { + "line": 416, + "column": 4 + }, + "end": { + "line": 418, + "column": 5 + } + } + } + ], + "range": [ + 14466, + 14681 + ], + "loc": { + "start": { + "line": 410, + "column": 13 + }, + "end": { + "line": 419, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 14459, + 14681 + ], + "loc": { + "start": { + "line": 410, + "column": 6 + }, + "end": { + "line": 419, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 14455, + 14681 + ], + "loc": { + "start": { + "line": 410, + "column": 2 + }, + "end": { + "line": 419, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 14118, + 14452 + ], + "loc": { + "start": { + "line": 401, + "column": 2 + }, + "end": { + "line": 409, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 14685, + 15027 + ], + "loc": { + "start": { + "line": 421, + "column": 2 + }, + "end": { + "line": 429, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "remove", + "range": [ + 15030, + 15036 + ], + "loc": { + "start": { + "line": 430, + "column": 2 + }, + "end": { + "line": 430, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 15037, + 15041 + ], + "loc": { + "start": { + "line": 430, + "column": 9 + }, + "end": { + "line": 430, + "column": 13 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 15043, + 15045 + ], + "loc": { + "start": { + "line": 430, + "column": 15 + }, + "end": { + "line": 430, + "column": 17 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "type", + "range": [ + 15057, + 15061 + ], + "loc": { + "start": { + "line": 431, + "column": 8 + }, + "end": { + "line": 431, + "column": 12 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15075, + 15079 + ], + "loc": { + "start": { + "line": 432, + "column": 10 + }, + "end": { + "line": 432, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 15080, + 15086 + ], + "loc": { + "start": { + "line": 432, + "column": 15 + }, + "end": { + "line": 432, + "column": 21 + } + } + }, + "range": [ + 15075, + 15086 + ], + "loc": { + "start": { + "line": 432, + "column": 10 + }, + "end": { + "line": 432, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15087, + 15091 + ], + "loc": { + "start": { + "line": 432, + "column": 22 + }, + "end": { + "line": 432, + "column": 26 + } + } + }, + "range": [ + 15075, + 15092 + ], + "loc": { + "start": { + "line": 432, + "column": 10 + }, + "end": { + "line": 432, + "column": 27 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "id", + "range": [ + 15108, + 15110 + ], + "loc": { + "start": { + "line": 433, + "column": 12 + }, + "end": { + "line": 433, + "column": 14 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "resource", + "range": [ + 15128, + 15136 + ], + "loc": { + "start": { + "line": 434, + "column": 14 + }, + "end": { + "line": 434, + "column": 22 + } + } + }, + "init": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15139, + 15143 + ], + "loc": { + "start": { + "line": 434, + "column": 25 + }, + "end": { + "line": 434, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 15144, + 15149 + ], + "loc": { + "start": { + "line": 434, + "column": 30 + }, + "end": { + "line": 434, + "column": 35 + } + } + }, + "range": [ + 15139, + 15149 + ], + "loc": { + "start": { + "line": 434, + "column": 25 + }, + "end": { + "line": 434, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15150, + 15154 + ], + "loc": { + "start": { + "line": 434, + "column": 36 + }, + "end": { + "line": 434, + "column": 40 + } + } + }, + "range": [ + 15139, + 15155 + ], + "loc": { + "start": { + "line": 434, + "column": 25 + }, + "end": { + "line": 434, + "column": 41 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15159, + 15163 + ], + "loc": { + "start": { + "line": 434, + "column": 45 + }, + "end": { + "line": 434, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 15164, + 15169 + ], + "loc": { + "start": { + "line": 434, + "column": 50 + }, + "end": { + "line": 434, + "column": 55 + } + } + }, + "range": [ + 15159, + 15169 + ], + "loc": { + "start": { + "line": 434, + "column": 45 + }, + "end": { + "line": 434, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15170, + 15174 + ], + "loc": { + "start": { + "line": 434, + "column": 56 + }, + "end": { + "line": 434, + "column": 60 + } + } + }, + "range": [ + 15159, + 15175 + ], + "loc": { + "start": { + "line": 434, + "column": 45 + }, + "end": { + "line": 434, + "column": 61 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 15176, + 15178 + ], + "loc": { + "start": { + "line": 434, + "column": 62 + }, + "end": { + "line": 434, + "column": 64 + } + } + }, + "range": [ + 15159, + 15179 + ], + "loc": { + "start": { + "line": 434, + "column": 45 + }, + "end": { + "line": 434, + "column": 65 + } + } + }, + "range": [ + 15139, + 15179 + ], + "loc": { + "start": { + "line": 434, + "column": 25 + }, + "end": { + "line": 434, + "column": 65 + } + } + }, + "range": [ + 15128, + 15179 + ], + "loc": { + "start": { + "line": 434, + "column": 14 + }, + "end": { + "line": 434, + "column": 65 + } + } + } + ], + "kind": "let", + "range": [ + 15124, + 15180 + ], + "loc": { + "start": { + "line": 434, + "column": 10 + }, + "end": { + "line": 434, + "column": 66 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "resource", + "range": [ + 15195, + 15203 + ], + "loc": { + "start": { + "line": 435, + "column": 14 + }, + "end": { + "line": 435, + "column": 22 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15219, + 15223 + ], + "loc": { + "start": { + "line": 436, + "column": 12 + }, + "end": { + "line": 436, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_remove", + "range": [ + 15224, + 15231 + ], + "loc": { + "start": { + "line": 436, + "column": 17 + }, + "end": { + "line": 436, + "column": 24 + } + } + }, + "range": [ + 15219, + 15231 + ], + "loc": { + "start": { + "line": 436, + "column": 12 + }, + "end": { + "line": 436, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 15232, + 15240 + ], + "loc": { + "start": { + "line": 436, + "column": 25 + }, + "end": { + "line": 436, + "column": 33 + } + } + } + ], + "range": [ + 15219, + 15241 + ], + "loc": { + "start": { + "line": 436, + "column": 12 + }, + "end": { + "line": 436, + "column": 34 + } + } + }, + "range": [ + 15219, + 15242 + ], + "loc": { + "start": { + "line": 436, + "column": 12 + }, + "end": { + "line": 436, + "column": 35 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15259, + 15263 + ], + "loc": { + "start": { + "line": 437, + "column": 16 + }, + "end": { + "line": 437, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 15264, + 15282 + ], + "loc": { + "start": { + "line": 437, + "column": 21 + }, + "end": { + "line": 437, + "column": 39 + } + } + }, + "range": [ + 15259, + 15282 + ], + "loc": { + "start": { + "line": 437, + "column": 16 + }, + "end": { + "line": 437, + "column": 39 + } + } + }, + "property": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 15283, + 15292 + ], + "loc": { + "start": { + "line": 437, + "column": 40 + }, + "end": { + "line": 437, + "column": 49 + } + } + }, + "range": [ + 15259, + 15293 + ], + "loc": { + "start": { + "line": 437, + "column": 16 + }, + "end": { + "line": 437, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15294, + 15298 + ], + "loc": { + "start": { + "line": 437, + "column": 51 + }, + "end": { + "line": 437, + "column": 55 + } + } + }, + "range": [ + 15259, + 15299 + ], + "loc": { + "start": { + "line": 437, + "column": 16 + }, + "end": { + "line": 437, + "column": 56 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15303, + 15307 + ], + "loc": { + "start": { + "line": 437, + "column": 60 + }, + "end": { + "line": 437, + "column": 64 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 15308, + 15326 + ], + "loc": { + "start": { + "line": 437, + "column": 65 + }, + "end": { + "line": 437, + "column": 83 + } + } + }, + "range": [ + 15303, + 15326 + ], + "loc": { + "start": { + "line": 437, + "column": 60 + }, + "end": { + "line": 437, + "column": 83 + } + } + }, + "property": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 15327, + 15336 + ], + "loc": { + "start": { + "line": 437, + "column": 84 + }, + "end": { + "line": 437, + "column": 93 + } + } + }, + "range": [ + 15303, + 15337 + ], + "loc": { + "start": { + "line": 437, + "column": 60 + }, + "end": { + "line": 437, + "column": 94 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15338, + 15342 + ], + "loc": { + "start": { + "line": 437, + "column": 95 + }, + "end": { + "line": 437, + "column": 99 + } + } + }, + "range": [ + 15303, + 15343 + ], + "loc": { + "start": { + "line": 437, + "column": 60 + }, + "end": { + "line": 437, + "column": 100 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 15344, + 15346 + ], + "loc": { + "start": { + "line": 437, + "column": 101 + }, + "end": { + "line": 437, + "column": 103 + } + } + }, + "range": [ + 15303, + 15347 + ], + "loc": { + "start": { + "line": 437, + "column": 60 + }, + "end": { + "line": 437, + "column": 104 + } + } + }, + "range": [ + 15259, + 15347 + ], + "loc": { + "start": { + "line": 437, + "column": 16 + }, + "end": { + "line": 437, + "column": 104 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15366, + 15370 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "_resourceListeners", + "range": [ + 15371, + 15389 + ], + "loc": { + "start": { + "line": 438, + "column": 20 + }, + "end": { + "line": 438, + "column": 38 + } + } + }, + "range": [ + 15366, + 15389 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 38 + } + } + }, + "property": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 15390, + 15399 + ], + "loc": { + "start": { + "line": 438, + "column": 39 + }, + "end": { + "line": 438, + "column": 48 + } + } + }, + "range": [ + 15366, + 15400 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15401, + 15405 + ], + "loc": { + "start": { + "line": 438, + "column": 50 + }, + "end": { + "line": 438, + "column": 54 + } + } + }, + "range": [ + 15366, + 15406 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 15407, + 15409 + ], + "loc": { + "start": { + "line": 438, + "column": 56 + }, + "end": { + "line": 438, + "column": 58 + } + } + }, + "range": [ + 15366, + 15410 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 59 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 15411, + 15418 + ], + "loc": { + "start": { + "line": 438, + "column": 60 + }, + "end": { + "line": 438, + "column": 67 + } + } + }, + "range": [ + 15366, + 15418 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 67 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 15419, + 15420 + ], + "loc": { + "start": { + "line": 438, + "column": 68 + }, + "end": { + "line": 438, + "column": 69 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 15424, + 15425 + ], + "loc": { + "start": { + "line": 438, + "column": 73 + }, + "end": { + "line": 438, + "column": 74 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 15426, + 15427 + ], + "loc": { + "start": { + "line": 438, + "column": 75 + }, + "end": { + "line": 438, + "column": 76 + } + } + }, + "range": [ + 15424, + 15428 + ], + "loc": { + "start": { + "line": 438, + "column": 73 + }, + "end": { + "line": 438, + "column": 77 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 15429, + 15433 + ], + "loc": { + "start": { + "line": 438, + "column": 78 + }, + "end": { + "line": 438, + "column": 82 + } + } + }, + "range": [ + 15424, + 15433 + ], + "loc": { + "start": { + "line": 438, + "column": 73 + }, + "end": { + "line": 438, + "column": 82 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 15434, + 15435 + ], + "loc": { + "start": { + "line": 438, + "column": 83 + }, + "end": { + "line": 438, + "column": 84 + } + } + }, + "property": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 15436, + 15437 + ], + "loc": { + "start": { + "line": 438, + "column": 85 + }, + "end": { + "line": 438, + "column": 86 + } + } + }, + "range": [ + 15434, + 15438 + ], + "loc": { + "start": { + "line": 438, + "column": 83 + }, + "end": { + "line": 438, + "column": 87 + } + } + }, + { + "type": "Identifier", + "name": "resource", + "range": [ + 15440, + 15448 + ], + "loc": { + "start": { + "line": 438, + "column": 89 + }, + "end": { + "line": 438, + "column": 97 + } + } + } + ], + "range": [ + 15424, + 15449 + ], + "loc": { + "start": { + "line": 438, + "column": 73 + }, + "end": { + "line": 438, + "column": 98 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 15419, + 15449 + ], + "loc": { + "start": { + "line": 438, + "column": 68 + }, + "end": { + "line": 438, + "column": 98 + } + } + } + ], + "range": [ + 15366, + 15450 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 99 + } + } + }, + "range": [ + 15366, + 15451 + ], + "loc": { + "start": { + "line": 438, + "column": 15 + }, + "end": { + "line": 438, + "column": 100 + } + } + } + ], + "range": [ + 15349, + 15465 + ], + "loc": { + "start": { + "line": 437, + "column": 106 + }, + "end": { + "line": 439, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 15255, + 15465 + ], + "loc": { + "start": { + "line": 437, + "column": 12 + }, + "end": { + "line": 439, + "column": 13 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15482, + 15486 + ], + "loc": { + "start": { + "line": 440, + "column": 16 + }, + "end": { + "line": 440, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 15487, + 15507 + ], + "loc": { + "start": { + "line": 440, + "column": 21 + }, + "end": { + "line": 440, + "column": 41 + } + } + }, + "range": [ + 15482, + 15507 + ], + "loc": { + "start": { + "line": 440, + "column": 16 + }, + "end": { + "line": 440, + "column": 41 + } + } + }, + "property": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 15508, + 15517 + ], + "loc": { + "start": { + "line": 440, + "column": 42 + }, + "end": { + "line": 440, + "column": 51 + } + } + }, + "range": [ + 15482, + 15518 + ], + "loc": { + "start": { + "line": 440, + "column": 16 + }, + "end": { + "line": 440, + "column": 52 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15519, + 15523 + ], + "loc": { + "start": { + "line": 440, + "column": 53 + }, + "end": { + "line": 440, + "column": 57 + } + } + }, + "range": [ + 15482, + 15524 + ], + "loc": { + "start": { + "line": 440, + "column": 16 + }, + "end": { + "line": 440, + "column": 58 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15542, + 15546 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_collectionListeners", + "range": [ + 15547, + 15567 + ], + "loc": { + "start": { + "line": 441, + "column": 19 + }, + "end": { + "line": 441, + "column": 39 + } + } + }, + "range": [ + 15542, + 15567 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 39 + } + } + }, + "property": { + "type": "Literal", + "value": "removed", + "raw": "\"removed\"", + "range": [ + 15568, + 15577 + ], + "loc": { + "start": { + "line": 441, + "column": 40 + }, + "end": { + "line": 441, + "column": 49 + } + } + }, + "range": [ + 15542, + 15578 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15579, + 15583 + ], + "loc": { + "start": { + "line": 441, + "column": 51 + }, + "end": { + "line": 441, + "column": 55 + } + } + }, + "range": [ + 15542, + 15584 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 56 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 15585, + 15592 + ], + "loc": { + "start": { + "line": 441, + "column": 57 + }, + "end": { + "line": 441, + "column": 64 + } + } + }, + "range": [ + 15542, + 15592 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 64 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 15593, + 15594 + ], + "loc": { + "start": { + "line": 441, + "column": 65 + }, + "end": { + "line": 441, + "column": 66 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 15598, + 15599 + ], + "loc": { + "start": { + "line": 441, + "column": 70 + }, + "end": { + "line": 441, + "column": 71 + } + } + }, + "property": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 15600, + 15601 + ], + "loc": { + "start": { + "line": 441, + "column": 72 + }, + "end": { + "line": 441, + "column": 73 + } + } + }, + "range": [ + 15598, + 15602 + ], + "loc": { + "start": { + "line": 441, + "column": 70 + }, + "end": { + "line": 441, + "column": 74 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 15603, + 15607 + ], + "loc": { + "start": { + "line": 441, + "column": 75 + }, + "end": { + "line": 441, + "column": 79 + } + } + }, + "range": [ + 15598, + 15607 + ], + "loc": { + "start": { + "line": 441, + "column": 70 + }, + "end": { + "line": 441, + "column": 79 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "x", + "range": [ + 15608, + 15609 + ], + "loc": { + "start": { + "line": 441, + "column": 80 + }, + "end": { + "line": 441, + "column": 81 + } + } + }, + "property": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 15610, + 15611 + ], + "loc": { + "start": { + "line": 441, + "column": 82 + }, + "end": { + "line": 441, + "column": 83 + } + } + }, + "range": [ + 15608, + 15612 + ], + "loc": { + "start": { + "line": 441, + "column": 80 + }, + "end": { + "line": 441, + "column": 84 + } + } + }, + { + "type": "Identifier", + "name": "resource", + "range": [ + 15614, + 15622 + ], + "loc": { + "start": { + "line": 441, + "column": 86 + }, + "end": { + "line": 441, + "column": 94 + } + } + } + ], + "range": [ + 15598, + 15623 + ], + "loc": { + "start": { + "line": 441, + "column": 70 + }, + "end": { + "line": 441, + "column": 95 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 15593, + 15623 + ], + "loc": { + "start": { + "line": 441, + "column": 65 + }, + "end": { + "line": 441, + "column": 95 + } + } + } + ], + "range": [ + 15542, + 15624 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 96 + } + } + }, + "range": [ + 15542, + 15625 + ], + "loc": { + "start": { + "line": 441, + "column": 14 + }, + "end": { + "line": 441, + "column": 97 + } + } + } + ], + "range": [ + 15526, + 15639 + ], + "loc": { + "start": { + "line": 440, + "column": 60 + }, + "end": { + "line": 442, + "column": 13 + } + } + }, + "alternate": null, + "range": [ + 15478, + 15639 + ], + "loc": { + "start": { + "line": 440, + "column": 12 + }, + "end": { + "line": 442, + "column": 13 + } + } + } + ], + "range": [ + 15205, + 15651 + ], + "loc": { + "start": { + "line": 435, + "column": 24 + }, + "end": { + "line": 443, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 15191, + 15651 + ], + "loc": { + "start": { + "line": 435, + "column": 10 + }, + "end": { + "line": 443, + "column": 11 + } + } + } + ], + "range": [ + 15112, + 15661 + ], + "loc": { + "start": { + "line": 433, + "column": 16 + }, + "end": { + "line": 444, + "column": 9 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Object", + "range": [ + 15679, + 15685 + ], + "loc": { + "start": { + "line": 445, + "column": 10 + }, + "end": { + "line": 445, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "keys", + "range": [ + 15686, + 15690 + ], + "loc": { + "start": { + "line": 445, + "column": 17 + }, + "end": { + "line": 445, + "column": 21 + } + } + }, + "range": [ + 15679, + 15690 + ], + "loc": { + "start": { + "line": 445, + "column": 10 + }, + "end": { + "line": 445, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15691, + 15695 + ], + "loc": { + "start": { + "line": 445, + "column": 22 + }, + "end": { + "line": 445, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 15696, + 15701 + ], + "loc": { + "start": { + "line": 445, + "column": 27 + }, + "end": { + "line": 445, + "column": 32 + } + } + }, + "range": [ + 15691, + 15701 + ], + "loc": { + "start": { + "line": 445, + "column": 22 + }, + "end": { + "line": 445, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 15702, + 15706 + ], + "loc": { + "start": { + "line": 445, + "column": 33 + }, + "end": { + "line": 445, + "column": 37 + } + } + }, + "range": [ + 15691, + 15707 + ], + "loc": { + "start": { + "line": 445, + "column": 22 + }, + "end": { + "line": 445, + "column": 38 + } + } + } + ], + "range": [ + 15679, + 15708 + ], + "loc": { + "start": { + "line": 445, + "column": 10 + }, + "end": { + "line": 445, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 15709, + 15716 + ], + "loc": { + "start": { + "line": 445, + "column": 40 + }, + "end": { + "line": 445, + "column": 47 + } + } + }, + "range": [ + 15679, + 15716 + ], + "loc": { + "start": { + "line": 445, + "column": 10 + }, + "end": { + "line": 445, + "column": 47 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "id", + "range": [ + 15717, + 15719 + ], + "loc": { + "start": { + "line": 445, + "column": 48 + }, + "end": { + "line": 445, + "column": 50 + } + } + } + ], + "body": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 15723, + 15727 + ], + "loc": { + "start": { + "line": 445, + "column": 54 + }, + "end": { + "line": 445, + "column": 58 + } + } + }, + "property": { + "type": "Identifier", + "name": "remove", + "range": [ + 15728, + 15734 + ], + "loc": { + "start": { + "line": 445, + "column": 59 + }, + "end": { + "line": 445, + "column": 65 + } + } + }, + "range": [ + 15723, + 15734 + ], + "loc": { + "start": { + "line": 445, + "column": 54 + }, + "end": { + "line": 445, + "column": 65 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 15735, + 15739 + ], + "loc": { + "start": { + "line": 445, + "column": 66 + }, + "end": { + "line": 445, + "column": 70 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 15741, + 15743 + ], + "loc": { + "start": { + "line": 445, + "column": 72 + }, + "end": { + "line": 445, + "column": 74 + } + } + } + ], + "range": [ + 15723, + 15744 + ], + "loc": { + "start": { + "line": 445, + "column": 54 + }, + "end": { + "line": 445, + "column": 75 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 15717, + 15744 + ], + "loc": { + "start": { + "line": 445, + "column": 48 + }, + "end": { + "line": 445, + "column": 75 + } + } + } + ], + "range": [ + 15679, + 15745 + ], + "loc": { + "start": { + "line": 445, + "column": 10 + }, + "end": { + "line": 445, + "column": 76 + } + } + }, + "range": [ + 15679, + 15746 + ], + "loc": { + "start": { + "line": 445, + "column": 10 + }, + "end": { + "line": 445, + "column": 77 + } + } + } + ], + "range": [ + 15667, + 15756 + ], + "loc": { + "start": { + "line": 444, + "column": 15 + }, + "end": { + "line": 446, + "column": 9 + } + } + }, + "range": [ + 15104, + 15756 + ], + "loc": { + "start": { + "line": 433, + "column": 8 + }, + "end": { + "line": 446, + "column": 9 + } + } + } + ], + "range": [ + 15094, + 15764 + ], + "loc": { + "start": { + "line": 432, + "column": 29 + }, + "end": { + "line": 447, + "column": 7 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "TypeError", + "range": [ + 15790, + 15799 + ], + "loc": { + "start": { + "line": 448, + "column": 18 + }, + "end": { + "line": 448, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "Unknown type '", + "cooked": "Unknown type '" + }, + "tail": false, + "range": [ + 15800, + 15817 + ], + "loc": { + "start": { + "line": 448, + "column": 28 + }, + "end": { + "line": 448, + "column": 45 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "'", + "cooked": "'" + }, + "tail": true, + "range": [ + 15821, + 15824 + ], + "loc": { + "start": { + "line": 448, + "column": 49 + }, + "end": { + "line": 448, + "column": 52 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 15817, + 15821 + ], + "loc": { + "start": { + "line": 448, + "column": 45 + }, + "end": { + "line": 448, + "column": 49 + } + } + } + ], + "range": [ + 15800, + 15824 + ], + "loc": { + "start": { + "line": 448, + "column": 28 + }, + "end": { + "line": 448, + "column": 52 + } + } + } + ], + "range": [ + 15786, + 15825 + ], + "loc": { + "start": { + "line": 448, + "column": 14 + }, + "end": { + "line": 448, + "column": 53 + } + } + }, + "range": [ + 15780, + 15826 + ], + "loc": { + "start": { + "line": 448, + "column": 8 + }, + "end": { + "line": 448, + "column": 54 + } + } + } + ], + "range": [ + 15770, + 15834 + ], + "loc": { + "start": { + "line": 447, + "column": 13 + }, + "end": { + "line": 449, + "column": 7 + } + } + }, + "range": [ + 15071, + 15834 + ], + "loc": { + "start": { + "line": 432, + "column": 6 + }, + "end": { + "line": 449, + "column": 7 + } + } + } + ], + "range": [ + 15063, + 15840 + ], + "loc": { + "start": { + "line": 431, + "column": 14 + }, + "end": { + "line": 450, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "TypeError", + "range": [ + 15864, + 15873 + ], + "loc": { + "start": { + "line": 451, + "column": 16 + }, + "end": { + "line": 451, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "You must provide a type to remove", + "cooked": "You must provide a type to remove" + }, + "tail": true, + "range": [ + 15874, + 15909 + ], + "loc": { + "start": { + "line": 451, + "column": 26 + }, + "end": { + "line": 451, + "column": 61 + } + } + } + ], + "expressions": [], + "range": [ + 15874, + 15909 + ], + "loc": { + "start": { + "line": 451, + "column": 26 + }, + "end": { + "line": 451, + "column": 61 + } + } + } + ], + "range": [ + 15860, + 15910 + ], + "loc": { + "start": { + "line": 451, + "column": 12 + }, + "end": { + "line": 451, + "column": 62 + } + } + }, + "range": [ + 15854, + 15911 + ], + "loc": { + "start": { + "line": 451, + "column": 6 + }, + "end": { + "line": 451, + "column": 63 + } + } + } + ], + "range": [ + 15846, + 15917 + ], + "loc": { + "start": { + "line": 450, + "column": 11 + }, + "end": { + "line": 452, + "column": 5 + } + } + }, + "range": [ + 15053, + 15917 + ], + "loc": { + "start": { + "line": 431, + "column": 4 + }, + "end": { + "line": 452, + "column": 5 + } + } + } + ], + "range": [ + 15047, + 15921 + ], + "loc": { + "start": { + "line": 430, + "column": 19 + }, + "end": { + "line": 453, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 15036, + 15921 + ], + "loc": { + "start": { + "line": 430, + "column": 8 + }, + "end": { + "line": 453, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 15030, + 15921 + ], + "loc": { + "start": { + "line": 430, + "column": 2 + }, + "end": { + "line": 453, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 14685, + 15027 + ], + "loc": { + "start": { + "line": 421, + "column": 2 + }, + "end": { + "line": 429, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.update(\"product\", \"1\", { title: \"foo\" }, (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 15925, + 16634 + ], + "loc": { + "start": { + "line": 455, + "column": 2 + }, + "end": { + "line": 474, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "update", + "range": [ + 16637, + 16643 + ], + "loc": { + "start": { + "line": 475, + "column": 2 + }, + "end": { + "line": 475, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "type", + "range": [ + 16644, + 16648 + ], + "loc": { + "start": { + "line": 475, + "column": 9 + }, + "end": { + "line": 475, + "column": 13 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 16650, + 16652 + ], + "loc": { + "start": { + "line": 475, + "column": 15 + }, + "end": { + "line": 475, + "column": 17 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 16654, + 16661 + ], + "loc": { + "start": { + "line": 475, + "column": 19 + }, + "end": { + "line": 475, + "column": 26 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 16663, + 16670 + ], + "loc": { + "start": { + "line": 475, + "column": 28 + }, + "end": { + "line": 475, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 16672, + 16677 + ], + "loc": { + "start": { + "line": 475, + "column": 37 + }, + "end": { + "line": 475, + "column": 42 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 16679, + 16686 + ], + "loc": { + "start": { + "line": 475, + "column": 44 + }, + "end": { + "line": 475, + "column": 51 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 16698, + 16702 + ], + "loc": { + "start": { + "line": 476, + "column": 8 + }, + "end": { + "line": 476, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 16703, + 16711 + ], + "loc": { + "start": { + "line": 476, + "column": 13 + }, + "end": { + "line": 476, + "column": 21 + } + } + }, + "range": [ + 16698, + 16711 + ], + "loc": { + "start": { + "line": 476, + "column": 8 + }, + "end": { + "line": 476, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 16721, + 16725 + ], + "loc": { + "start": { + "line": 477, + "column": 6 + }, + "end": { + "line": 477, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "_adapter", + "range": [ + 16726, + 16734 + ], + "loc": { + "start": { + "line": 477, + "column": 11 + }, + "end": { + "line": 477, + "column": 19 + } + } + }, + "range": [ + 16721, + 16734 + ], + "loc": { + "start": { + "line": 477, + "column": 6 + }, + "end": { + "line": 477, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "update", + "range": [ + 16735, + 16741 + ], + "loc": { + "start": { + "line": 477, + "column": 20 + }, + "end": { + "line": 477, + "column": 26 + } + } + }, + "range": [ + 16721, + 16741 + ], + "loc": { + "start": { + "line": 477, + "column": 6 + }, + "end": { + "line": 477, + "column": 26 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 16742, + 16746 + ], + "loc": { + "start": { + "line": 477, + "column": 27 + }, + "end": { + "line": 477, + "column": 31 + } + } + }, + { + "type": "Identifier", + "name": "type", + "range": [ + 16748, + 16752 + ], + "loc": { + "start": { + "line": 477, + "column": 33 + }, + "end": { + "line": 477, + "column": 37 + } + } + }, + { + "type": "Identifier", + "name": "id", + "range": [ + 16754, + 16756 + ], + "loc": { + "start": { + "line": 477, + "column": 39 + }, + "end": { + "line": 477, + "column": 41 + } + } + }, + { + "type": "Identifier", + "name": "partial", + "range": [ + 16758, + 16765 + ], + "loc": { + "start": { + "line": 477, + "column": 43 + }, + "end": { + "line": 477, + "column": 50 + } + } + }, + { + "type": "Identifier", + "name": "success", + "range": [ + 16767, + 16774 + ], + "loc": { + "start": { + "line": 477, + "column": 52 + }, + "end": { + "line": 477, + "column": 59 + } + } + }, + { + "type": "Identifier", + "name": "error", + "range": [ + 16776, + 16781 + ], + "loc": { + "start": { + "line": 477, + "column": 61 + }, + "end": { + "line": 477, + "column": 66 + } + } + }, + { + "type": "Identifier", + "name": "context", + "range": [ + 16783, + 16790 + ], + "loc": { + "start": { + "line": 477, + "column": 68 + }, + "end": { + "line": 477, + "column": 75 + } + } + } + ], + "range": [ + 16721, + 16791 + ], + "loc": { + "start": { + "line": 477, + "column": 6 + }, + "end": { + "line": 477, + "column": 76 + } + } + }, + "range": [ + 16721, + 16792 + ], + "loc": { + "start": { + "line": 477, + "column": 6 + }, + "end": { + "line": 477, + "column": 77 + } + } + } + ], + "range": [ + 16713, + 16798 + ], + "loc": { + "start": { + "line": 476, + "column": 23 + }, + "end": { + "line": 478, + "column": 5 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 16822, + 16827 + ], + "loc": { + "start": { + "line": 479, + "column": 16 + }, + "end": { + "line": 479, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`", + "raw": "\"Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`\"", + "range": [ + 16828, + 16924 + ], + "loc": { + "start": { + "line": 479, + "column": 22 + }, + "end": { + "line": 479, + "column": 118 + } + } + } + ], + "range": [ + 16818, + 16925 + ], + "loc": { + "start": { + "line": 479, + "column": 12 + }, + "end": { + "line": 479, + "column": 119 + } + } + }, + "range": [ + 16812, + 16926 + ], + "loc": { + "start": { + "line": 479, + "column": 6 + }, + "end": { + "line": 479, + "column": 120 + } + } + } + ], + "range": [ + 16804, + 16932 + ], + "loc": { + "start": { + "line": 478, + "column": 11 + }, + "end": { + "line": 480, + "column": 5 + } + } + }, + "range": [ + 16694, + 16932 + ], + "loc": { + "start": { + "line": 476, + "column": 4 + }, + "end": { + "line": 480, + "column": 5 + } + } + } + ], + "range": [ + 16688, + 16936 + ], + "loc": { + "start": { + "line": 475, + "column": 53 + }, + "end": { + "line": 481, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16643, + 16936 + ], + "loc": { + "start": { + "line": 475, + "column": 8 + }, + "end": { + "line": 481, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 16637, + 16936 + ], + "loc": { + "start": { + "line": 475, + "column": 2 + }, + "end": { + "line": 481, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.update(\"product\", \"1\", { title: \"foo\" }, (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 15925, + 16634 + ], + "loc": { + "start": { + "line": 455, + "column": 2 + }, + "end": { + "line": 474, + "column": 5 + } + } + } + ], + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_addField", + "range": [ + 16940, + 16949 + ], + "loc": { + "start": { + "line": 483, + "column": 2 + }, + "end": { + "line": 483, + "column": 11 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "object", + "range": [ + 16950, + 16956 + ], + "loc": { + "start": { + "line": 483, + "column": 12 + }, + "end": { + "line": 483, + "column": 18 + } + } + }, + { + "type": "Identifier", + "name": "resource", + "range": [ + 16958, + 16966 + ], + "loc": { + "start": { + "line": 483, + "column": 20 + }, + "end": { + "line": 483, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "definition", + "range": [ + 16968, + 16978 + ], + "loc": { + "start": { + "line": 483, + "column": 30 + }, + "end": { + "line": 483, + "column": 40 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 16980, + 16989 + ], + "loc": { + "start": { + "line": 483, + "column": 42 + }, + "end": { + "line": 483, + "column": 51 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "field", + "range": [ + 17001, + 17006 + ], + "loc": { + "start": { + "line": 484, + "column": 8 + }, + "end": { + "line": 484, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "definition", + "range": [ + 17009, + 17019 + ], + "loc": { + "start": { + "line": 484, + "column": 16 + }, + "end": { + "line": 484, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17020, + 17029 + ], + "loc": { + "start": { + "line": 484, + "column": 27 + }, + "end": { + "line": 484, + "column": 36 + } + } + }, + "range": [ + 17009, + 17030 + ], + "loc": { + "start": { + "line": 484, + "column": 16 + }, + "end": { + "line": 484, + "column": 37 + } + } + }, + "range": [ + 17001, + 17030 + ], + "loc": { + "start": { + "line": 484, + "column": 8 + }, + "end": { + "line": 484, + "column": 37 + } + } + } + ], + "kind": "var", + "range": [ + 16997, + 17031 + ], + "loc": { + "start": { + "line": 484, + "column": 4 + }, + "end": { + "line": 484, + "column": 38 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "newValue", + "range": [ + 17040, + 17048 + ], + "loc": { + "start": { + "line": 485, + "column": 8 + }, + "end": { + "line": 485, + "column": 16 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "field", + "range": [ + 17051, + 17056 + ], + "loc": { + "start": { + "line": 485, + "column": 19 + }, + "end": { + "line": 485, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "deserialize", + "range": [ + 17057, + 17068 + ], + "loc": { + "start": { + "line": 485, + "column": 25 + }, + "end": { + "line": 485, + "column": 36 + } + } + }, + "range": [ + 17051, + 17068 + ], + "loc": { + "start": { + "line": 485, + "column": 19 + }, + "end": { + "line": 485, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "call", + "range": [ + 17069, + 17073 + ], + "loc": { + "start": { + "line": 485, + "column": 37 + }, + "end": { + "line": 485, + "column": 41 + } + } + }, + "range": [ + 17051, + 17073 + ], + "loc": { + "start": { + "line": 485, + "column": 19 + }, + "end": { + "line": 485, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 17074, + 17078 + ], + "loc": { + "start": { + "line": 485, + "column": 42 + }, + "end": { + "line": 485, + "column": 46 + } + } + }, + { + "type": "Identifier", + "name": "object", + "range": [ + 17080, + 17086 + ], + "loc": { + "start": { + "line": 485, + "column": 48 + }, + "end": { + "line": 485, + "column": 54 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17088, + 17097 + ], + "loc": { + "start": { + "line": 485, + "column": 56 + }, + "end": { + "line": 485, + "column": 65 + } + } + } + ], + "range": [ + 17051, + 17098 + ], + "loc": { + "start": { + "line": 485, + "column": 19 + }, + "end": { + "line": 485, + "column": 66 + } + } + }, + "range": [ + 17040, + 17098 + ], + "loc": { + "start": { + "line": 485, + "column": 8 + }, + "end": { + "line": 485, + "column": 66 + } + } + } + ], + "kind": "var", + "range": [ + 17036, + 17099 + ], + "loc": { + "start": { + "line": 485, + "column": 4 + }, + "end": { + "line": 485, + "column": 67 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "UnaryExpression", + "operator": "typeof", + "argument": { + "type": "Identifier", + "name": "newValue", + "range": [ + 17115, + 17123 + ], + "loc": { + "start": { + "line": 486, + "column": 15 + }, + "end": { + "line": 486, + "column": 23 + } + } + }, + "prefix": true, + "range": [ + 17108, + 17123 + ], + "loc": { + "start": { + "line": 486, + "column": 8 + }, + "end": { + "line": 486, + "column": 23 + } + } + }, + "right": { + "type": "Literal", + "value": "undefined", + "raw": "\"undefined\"", + "range": [ + 17128, + 17139 + ], + "loc": { + "start": { + "line": 486, + "column": 28 + }, + "end": { + "line": 486, + "column": 39 + } + } + }, + "range": [ + 17108, + 17139 + ], + "loc": { + "start": { + "line": 486, + "column": 8 + }, + "end": { + "line": 486, + "column": 39 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "field", + "range": [ + 17153, + 17158 + ], + "loc": { + "start": { + "line": 487, + "column": 10 + }, + "end": { + "line": 487, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 17159, + 17163 + ], + "loc": { + "start": { + "line": 487, + "column": 16 + }, + "end": { + "line": 487, + "column": 20 + } + } + }, + "range": [ + 17153, + 17163 + ], + "loc": { + "start": { + "line": 487, + "column": 10 + }, + "end": { + "line": 487, + "column": 20 + } + } + }, + "right": { + "type": "Literal", + "value": "has-one", + "raw": "\"has-one\"", + "range": [ + 17168, + 17177 + ], + "loc": { + "start": { + "line": 487, + "column": 25 + }, + "end": { + "line": 487, + "column": 34 + } + } + }, + "range": [ + 17153, + 17177 + ], + "loc": { + "start": { + "line": 487, + "column": 10 + }, + "end": { + "line": 487, + "column": 34 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 17193, + 17201 + ], + "loc": { + "start": { + "line": 488, + "column": 12 + }, + "end": { + "line": 488, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17202, + 17211 + ], + "loc": { + "start": { + "line": 488, + "column": 21 + }, + "end": { + "line": 488, + "column": 30 + } + } + }, + "range": [ + 17193, + 17212 + ], + "loc": { + "start": { + "line": 488, + "column": 12 + }, + "end": { + "line": 488, + "column": 31 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 17226, + 17230 + ], + "loc": { + "start": { + "line": 489, + "column": 10 + }, + "end": { + "line": 489, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_removeInverseRelationship", + "range": [ + 17231, + 17257 + ], + "loc": { + "start": { + "line": 489, + "column": 15 + }, + "end": { + "line": 489, + "column": 41 + } + } + }, + "range": [ + 17226, + 17257 + ], + "loc": { + "start": { + "line": 489, + "column": 10 + }, + "end": { + "line": 489, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 17258, + 17266 + ], + "loc": { + "start": { + "line": 489, + "column": 42 + }, + "end": { + "line": 489, + "column": 50 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17268, + 17277 + ], + "loc": { + "start": { + "line": 489, + "column": 52 + }, + "end": { + "line": 489, + "column": 61 + } + } + }, + { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 17279, + 17287 + ], + "loc": { + "start": { + "line": 489, + "column": 63 + }, + "end": { + "line": 489, + "column": 71 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17288, + 17297 + ], + "loc": { + "start": { + "line": 489, + "column": 72 + }, + "end": { + "line": 489, + "column": 81 + } + } + }, + "range": [ + 17279, + 17298 + ], + "loc": { + "start": { + "line": 489, + "column": 63 + }, + "end": { + "line": 489, + "column": 82 + } + } + }, + { + "type": "Identifier", + "name": "field", + "range": [ + 17300, + 17305 + ], + "loc": { + "start": { + "line": 489, + "column": 84 + }, + "end": { + "line": 489, + "column": 89 + } + } + } + ], + "range": [ + 17226, + 17306 + ], + "loc": { + "start": { + "line": 489, + "column": 10 + }, + "end": { + "line": 489, + "column": 90 + } + } + }, + "range": [ + 17226, + 17307 + ], + "loc": { + "start": { + "line": 489, + "column": 10 + }, + "end": { + "line": 489, + "column": 91 + } + } + } + ], + "range": [ + 17214, + 17317 + ], + "loc": { + "start": { + "line": 488, + "column": 33 + }, + "end": { + "line": 490, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 17189, + 17317 + ], + "loc": { + "start": { + "line": 488, + "column": 8 + }, + "end": { + "line": 490, + "column": 9 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "newValue", + "range": [ + 17330, + 17338 + ], + "loc": { + "start": { + "line": 491, + "column": 12 + }, + "end": { + "line": 491, + "column": 20 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 17352, + 17356 + ], + "loc": { + "start": { + "line": 492, + "column": 10 + }, + "end": { + "line": 492, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_addInverseRelationship", + "range": [ + 17357, + 17380 + ], + "loc": { + "start": { + "line": 492, + "column": 15 + }, + "end": { + "line": 492, + "column": 38 + } + } + }, + "range": [ + 17352, + 17380 + ], + "loc": { + "start": { + "line": 492, + "column": 10 + }, + "end": { + "line": 492, + "column": 38 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 17381, + 17389 + ], + "loc": { + "start": { + "line": 492, + "column": 39 + }, + "end": { + "line": 492, + "column": 47 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17391, + 17400 + ], + "loc": { + "start": { + "line": 492, + "column": 49 + }, + "end": { + "line": 492, + "column": 58 + } + } + }, + { + "type": "Identifier", + "name": "newValue", + "range": [ + 17402, + 17410 + ], + "loc": { + "start": { + "line": 492, + "column": 60 + }, + "end": { + "line": 492, + "column": 68 + } + } + }, + { + "type": "Identifier", + "name": "field", + "range": [ + 17412, + 17417 + ], + "loc": { + "start": { + "line": 492, + "column": 70 + }, + "end": { + "line": 492, + "column": 75 + } + } + } + ], + "range": [ + 17352, + 17418 + ], + "loc": { + "start": { + "line": 492, + "column": 10 + }, + "end": { + "line": 492, + "column": 76 + } + } + }, + "range": [ + 17352, + 17419 + ], + "loc": { + "start": { + "line": 492, + "column": 10 + }, + "end": { + "line": 492, + "column": 77 + } + } + } + ], + "range": [ + 17340, + 17429 + ], + "loc": { + "start": { + "line": 491, + "column": 22 + }, + "end": { + "line": 493, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 17326, + 17429 + ], + "loc": { + "start": { + "line": 491, + "column": 8 + }, + "end": { + "line": 493, + "column": 9 + } + } + } + ], + "range": [ + 17179, + 17437 + ], + "loc": { + "start": { + "line": 487, + "column": 36 + }, + "end": { + "line": 494, + "column": 7 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "field", + "range": [ + 17447, + 17452 + ], + "loc": { + "start": { + "line": 494, + "column": 17 + }, + "end": { + "line": 494, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 17453, + 17457 + ], + "loc": { + "start": { + "line": 494, + "column": 23 + }, + "end": { + "line": 494, + "column": 27 + } + } + }, + "range": [ + 17447, + 17457 + ], + "loc": { + "start": { + "line": 494, + "column": 17 + }, + "end": { + "line": 494, + "column": 27 + } + } + }, + "right": { + "type": "Literal", + "value": "has-many", + "raw": "\"has-many\"", + "range": [ + 17462, + 17472 + ], + "loc": { + "start": { + "line": 494, + "column": 32 + }, + "end": { + "line": 494, + "column": 42 + } + } + }, + "range": [ + 17447, + 17472 + ], + "loc": { + "start": { + "line": 494, + "column": 17 + }, + "end": { + "line": 494, + "column": 42 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 17484, + 17492 + ], + "loc": { + "start": { + "line": 495, + "column": 8 + }, + "end": { + "line": 495, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17493, + 17502 + ], + "loc": { + "start": { + "line": 495, + "column": 17 + }, + "end": { + "line": 495, + "column": 26 + } + } + }, + "range": [ + 17484, + 17503 + ], + "loc": { + "start": { + "line": 495, + "column": 8 + }, + "end": { + "line": 495, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 17504, + 17511 + ], + "loc": { + "start": { + "line": 495, + "column": 28 + }, + "end": { + "line": 495, + "column": 35 + } + } + }, + "range": [ + 17484, + 17511 + ], + "loc": { + "start": { + "line": 495, + "column": 8 + }, + "end": { + "line": 495, + "column": 35 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 17512, + 17513 + ], + "loc": { + "start": { + "line": 495, + "column": 36 + }, + "end": { + "line": 495, + "column": 37 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 17533, + 17541 + ], + "loc": { + "start": { + "line": 496, + "column": 14 + }, + "end": { + "line": 496, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17542, + 17551 + ], + "loc": { + "start": { + "line": 496, + "column": 23 + }, + "end": { + "line": 496, + "column": 32 + } + } + }, + "range": [ + 17533, + 17552 + ], + "loc": { + "start": { + "line": 496, + "column": 14 + }, + "end": { + "line": 496, + "column": 33 + } + } + }, + "property": { + "type": "Identifier", + "name": "indexOf", + "range": [ + 17553, + 17560 + ], + "loc": { + "start": { + "line": 496, + "column": 34 + }, + "end": { + "line": 496, + "column": 41 + } + } + }, + "range": [ + 17533, + 17560 + ], + "loc": { + "start": { + "line": 496, + "column": 14 + }, + "end": { + "line": 496, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 17561, + 17562 + ], + "loc": { + "start": { + "line": 496, + "column": 42 + }, + "end": { + "line": 496, + "column": 43 + } + } + } + ], + "range": [ + 17533, + 17563 + ], + "loc": { + "start": { + "line": 496, + "column": 14 + }, + "end": { + "line": 496, + "column": 44 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 17569, + 17570 + ], + "loc": { + "start": { + "line": 496, + "column": 50 + }, + "end": { + "line": 496, + "column": 51 + } + } + }, + "prefix": true, + "range": [ + 17568, + 17570 + ], + "loc": { + "start": { + "line": 496, + "column": 49 + }, + "end": { + "line": 496, + "column": 51 + } + } + }, + "range": [ + 17533, + 17570 + ], + "loc": { + "start": { + "line": 496, + "column": 14 + }, + "end": { + "line": 496, + "column": 51 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 17586, + 17590 + ], + "loc": { + "start": { + "line": 497, + "column": 12 + }, + "end": { + "line": 497, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "_removeInverseRelationship", + "range": [ + 17591, + 17617 + ], + "loc": { + "start": { + "line": 497, + "column": 17 + }, + "end": { + "line": 497, + "column": 43 + } + } + }, + "range": [ + 17586, + 17617 + ], + "loc": { + "start": { + "line": 497, + "column": 12 + }, + "end": { + "line": 497, + "column": 43 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 17618, + 17626 + ], + "loc": { + "start": { + "line": 497, + "column": 44 + }, + "end": { + "line": 497, + "column": 52 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17628, + 17637 + ], + "loc": { + "start": { + "line": 497, + "column": 54 + }, + "end": { + "line": 497, + "column": 63 + } + } + }, + { + "type": "Identifier", + "name": "r", + "range": [ + 17639, + 17640 + ], + "loc": { + "start": { + "line": 497, + "column": 65 + }, + "end": { + "line": 497, + "column": 66 + } + } + }, + { + "type": "Identifier", + "name": "field", + "range": [ + 17642, + 17647 + ], + "loc": { + "start": { + "line": 497, + "column": 68 + }, + "end": { + "line": 497, + "column": 73 + } + } + } + ], + "range": [ + 17586, + 17648 + ], + "loc": { + "start": { + "line": 497, + "column": 12 + }, + "end": { + "line": 497, + "column": 74 + } + } + }, + "range": [ + 17586, + 17649 + ], + "loc": { + "start": { + "line": 497, + "column": 12 + }, + "end": { + "line": 497, + "column": 75 + } + } + } + ], + "range": [ + 17572, + 17661 + ], + "loc": { + "start": { + "line": 496, + "column": 53 + }, + "end": { + "line": 498, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 17529, + 17661 + ], + "loc": { + "start": { + "line": 496, + "column": 10 + }, + "end": { + "line": 498, + "column": 11 + } + } + } + ], + "range": [ + 17517, + 17671 + ], + "loc": { + "start": { + "line": 495, + "column": 41 + }, + "end": { + "line": 499, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17512, + 17671 + ], + "loc": { + "start": { + "line": 495, + "column": 36 + }, + "end": { + "line": 499, + "column": 9 + } + } + } + ], + "range": [ + 17484, + 17672 + ], + "loc": { + "start": { + "line": 495, + "column": 8 + }, + "end": { + "line": 499, + "column": 10 + } + } + }, + "range": [ + 17484, + 17673 + ], + "loc": { + "start": { + "line": 495, + "column": 8 + }, + "end": { + "line": 499, + "column": 11 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "newValue", + "range": [ + 17682, + 17690 + ], + "loc": { + "start": { + "line": 500, + "column": 8 + }, + "end": { + "line": 500, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 17691, + 17698 + ], + "loc": { + "start": { + "line": 500, + "column": 17 + }, + "end": { + "line": 500, + "column": 24 + } + } + }, + "range": [ + 17682, + 17698 + ], + "loc": { + "start": { + "line": 500, + "column": 8 + }, + "end": { + "line": 500, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 17699, + 17700 + ], + "loc": { + "start": { + "line": 500, + "column": 25 + }, + "end": { + "line": 500, + "column": 26 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 17716, + 17720 + ], + "loc": { + "start": { + "line": 501, + "column": 10 + }, + "end": { + "line": 501, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "_addInverseRelationship", + "range": [ + 17721, + 17744 + ], + "loc": { + "start": { + "line": 501, + "column": 15 + }, + "end": { + "line": 501, + "column": 38 + } + } + }, + "range": [ + 17716, + 17744 + ], + "loc": { + "start": { + "line": 501, + "column": 10 + }, + "end": { + "line": 501, + "column": 38 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 17745, + 17753 + ], + "loc": { + "start": { + "line": 501, + "column": 39 + }, + "end": { + "line": 501, + "column": 47 + } + } + }, + { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17755, + 17764 + ], + "loc": { + "start": { + "line": 501, + "column": 49 + }, + "end": { + "line": 501, + "column": 58 + } + } + }, + { + "type": "Identifier", + "name": "r", + "range": [ + 17766, + 17767 + ], + "loc": { + "start": { + "line": 501, + "column": 60 + }, + "end": { + "line": 501, + "column": 61 + } + } + }, + { + "type": "Identifier", + "name": "field", + "range": [ + 17769, + 17774 + ], + "loc": { + "start": { + "line": 501, + "column": 63 + }, + "end": { + "line": 501, + "column": 68 + } + } + } + ], + "range": [ + 17716, + 17775 + ], + "loc": { + "start": { + "line": 501, + "column": 10 + }, + "end": { + "line": 501, + "column": 69 + } + } + }, + "range": [ + 17716, + 17776 + ], + "loc": { + "start": { + "line": 501, + "column": 10 + }, + "end": { + "line": 501, + "column": 70 + } + } + } + ], + "range": [ + 17704, + 17786 + ], + "loc": { + "start": { + "line": 500, + "column": 30 + }, + "end": { + "line": 502, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17699, + 17786 + ], + "loc": { + "start": { + "line": 500, + "column": 25 + }, + "end": { + "line": 502, + "column": 9 + } + } + } + ], + "range": [ + 17682, + 17787 + ], + "loc": { + "start": { + "line": 500, + "column": 8 + }, + "end": { + "line": 502, + "column": 10 + } + } + }, + "range": [ + 17682, + 17788 + ], + "loc": { + "start": { + "line": 500, + "column": 8 + }, + "end": { + "line": 502, + "column": 11 + } + } + } + ], + "range": [ + 17474, + 17796 + ], + "loc": { + "start": { + "line": 494, + "column": 44 + }, + "end": { + "line": 503, + "column": 7 + } + } + }, + "alternate": null, + "range": [ + 17443, + 17796 + ], + "loc": { + "start": { + "line": 494, + "column": 13 + }, + "end": { + "line": 503, + "column": 7 + } + } + }, + "range": [ + 17149, + 17796 + ], + "loc": { + "start": { + "line": 487, + "column": 6 + }, + "end": { + "line": 503, + "column": 7 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 17803, + 17811 + ], + "loc": { + "start": { + "line": 504, + "column": 6 + }, + "end": { + "line": 504, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 17812, + 17821 + ], + "loc": { + "start": { + "line": 504, + "column": 15 + }, + "end": { + "line": 504, + "column": 24 + } + } + }, + "range": [ + 17803, + 17822 + ], + "loc": { + "start": { + "line": 504, + "column": 6 + }, + "end": { + "line": 504, + "column": 25 + } + } + }, + "right": { + "type": "Identifier", + "name": "newValue", + "range": [ + 17825, + 17833 + ], + "loc": { + "start": { + "line": 504, + "column": 28 + }, + "end": { + "line": 504, + "column": 36 + } + } + }, + "range": [ + 17803, + 17833 + ], + "loc": { + "start": { + "line": 504, + "column": 6 + }, + "end": { + "line": 504, + "column": 36 + } + } + }, + "range": [ + 17803, + 17834 + ], + "loc": { + "start": { + "line": 504, + "column": 6 + }, + "end": { + "line": 504, + "column": 37 + } + } + } + ], + "range": [ + 17141, + 17840 + ], + "loc": { + "start": { + "line": 486, + "column": 41 + }, + "end": { + "line": 505, + "column": 5 + } + } + }, + "alternate": null, + "range": [ + 17104, + 17840 + ], + "loc": { + "start": { + "line": 486, + "column": 4 + }, + "end": { + "line": 505, + "column": 5 + } + } + } + ], + "range": [ + 16991, + 17844 + ], + "loc": { + "start": { + "line": 483, + "column": 53 + }, + "end": { + "line": 506, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 16949, + 17844 + ], + "loc": { + "start": { + "line": 483, + "column": 11 + }, + "end": { + "line": 506, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 16940, + 17844 + ], + "loc": { + "start": { + "line": 483, + "column": 2 + }, + "end": { + "line": 506, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_addInverseRelationship", + "range": [ + 17848, + 17871 + ], + "loc": { + "start": { + "line": 508, + "column": 2 + }, + "end": { + "line": 508, + "column": 25 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 17872, + 17886 + ], + "loc": { + "start": { + "line": 508, + "column": 26 + }, + "end": { + "line": 508, + "column": 40 + } + } + }, + { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 17888, + 17903 + ], + "loc": { + "start": { + "line": 508, + "column": 42 + }, + "end": { + "line": 508, + "column": 57 + } + } + }, + { + "type": "Identifier", + "name": "targetResource", + "range": [ + 17905, + 17919 + ], + "loc": { + "start": { + "line": 508, + "column": 59 + }, + "end": { + "line": 508, + "column": 73 + } + } + }, + { + "type": "Identifier", + "name": "sourceField", + "range": [ + 17921, + 17932 + ], + "loc": { + "start": { + "line": 508, + "column": 75 + }, + "end": { + "line": 508, + "column": 86 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 17944, + 17960 + ], + "loc": { + "start": { + "line": 509, + "column": 8 + }, + "end": { + "line": 509, + "column": 24 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 17963, + 17967 + ], + "loc": { + "start": { + "line": 509, + "column": 27 + }, + "end": { + "line": 509, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 17968, + 17974 + ], + "loc": { + "start": { + "line": 509, + "column": 32 + }, + "end": { + "line": 509, + "column": 38 + } + } + }, + "range": [ + 17963, + 17974 + ], + "loc": { + "start": { + "line": 509, + "column": 27 + }, + "end": { + "line": 509, + "column": 38 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 17975, + 17989 + ], + "loc": { + "start": { + "line": 509, + "column": 39 + }, + "end": { + "line": 509, + "column": 53 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 17990, + 17994 + ], + "loc": { + "start": { + "line": 509, + "column": 54 + }, + "end": { + "line": 509, + "column": 58 + } + } + }, + "range": [ + 17975, + 17994 + ], + "loc": { + "start": { + "line": 509, + "column": 39 + }, + "end": { + "line": 509, + "column": 58 + } + } + }, + "range": [ + 17963, + 17995 + ], + "loc": { + "start": { + "line": 509, + "column": 27 + }, + "end": { + "line": 509, + "column": 59 + } + } + }, + "range": [ + 17944, + 17995 + ], + "loc": { + "start": { + "line": 509, + "column": 8 + }, + "end": { + "line": 509, + "column": 59 + } + } + } + ], + "kind": "var", + "range": [ + 17940, + 17996 + ], + "loc": { + "start": { + "line": 509, + "column": 4 + }, + "end": { + "line": 509, + "column": 60 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "sourceDefinition", + "range": [ + 18005, + 18021 + ], + "loc": { + "start": { + "line": 510, + "column": 8 + }, + "end": { + "line": 510, + "column": 24 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 18024, + 18028 + ], + "loc": { + "start": { + "line": 510, + "column": 27 + }, + "end": { + "line": 510, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 18029, + 18035 + ], + "loc": { + "start": { + "line": 510, + "column": 32 + }, + "end": { + "line": 510, + "column": 38 + } + } + }, + "range": [ + 18024, + 18035 + ], + "loc": { + "start": { + "line": 510, + "column": 27 + }, + "end": { + "line": 510, + "column": 38 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18036, + 18050 + ], + "loc": { + "start": { + "line": 510, + "column": 39 + }, + "end": { + "line": 510, + "column": 53 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 18051, + 18055 + ], + "loc": { + "start": { + "line": 510, + "column": 54 + }, + "end": { + "line": 510, + "column": 58 + } + } + }, + "range": [ + 18036, + 18055 + ], + "loc": { + "start": { + "line": 510, + "column": 39 + }, + "end": { + "line": 510, + "column": 58 + } + } + }, + "range": [ + 18024, + 18056 + ], + "loc": { + "start": { + "line": 510, + "column": 27 + }, + "end": { + "line": 510, + "column": 59 + } + } + }, + "range": [ + 18005, + 18056 + ], + "loc": { + "start": { + "line": 510, + "column": 8 + }, + "end": { + "line": 510, + "column": 59 + } + } + } + ], + "kind": "var", + "range": [ + 18001, + 18057 + ], + "loc": { + "start": { + "line": 510, + "column": 4 + }, + "end": { + "line": 510, + "column": 60 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 18066, + 18082 + ], + "loc": { + "start": { + "line": 511, + "column": 8 + }, + "end": { + "line": 511, + "column": 24 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18096, + 18111 + ], + "loc": { + "start": { + "line": 512, + "column": 10 + }, + "end": { + "line": 512, + "column": 25 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ArrayExpression", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceField", + "range": [ + 18116, + 18127 + ], + "loc": { + "start": { + "line": 512, + "column": 30 + }, + "end": { + "line": 512, + "column": 41 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 18128, + 18135 + ], + "loc": { + "start": { + "line": 512, + "column": 42 + }, + "end": { + "line": 512, + "column": 49 + } + } + }, + "range": [ + 18116, + 18135 + ], + "loc": { + "start": { + "line": 512, + "column": 30 + }, + "end": { + "line": 512, + "column": 49 + } + } + } + ], + "range": [ + 18114, + 18137 + ], + "loc": { + "start": { + "line": 512, + "column": 28 + }, + "end": { + "line": 512, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "concat", + "range": [ + 18138, + 18144 + ], + "loc": { + "start": { + "line": 512, + "column": 52 + }, + "end": { + "line": 512, + "column": 58 + } + } + }, + "range": [ + 18114, + 18144 + ], + "loc": { + "start": { + "line": 512, + "column": 28 + }, + "end": { + "line": 512, + "column": 58 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceDefinition", + "range": [ + 18145, + 18161 + ], + "loc": { + "start": { + "line": 512, + "column": 59 + }, + "end": { + "line": 512, + "column": 75 + } + } + }, + "property": { + "type": "Identifier", + "name": "_names", + "range": [ + 18162, + 18168 + ], + "loc": { + "start": { + "line": 512, + "column": 76 + }, + "end": { + "line": 512, + "column": 82 + } + } + }, + "range": [ + 18145, + 18168 + ], + "loc": { + "start": { + "line": 512, + "column": 59 + }, + "end": { + "line": 512, + "column": 82 + } + } + } + ], + "range": [ + 18114, + 18169 + ], + "loc": { + "start": { + "line": 512, + "column": 28 + }, + "end": { + "line": 512, + "column": 83 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 18170, + 18174 + ], + "loc": { + "start": { + "line": 512, + "column": 84 + }, + "end": { + "line": 512, + "column": 88 + } + } + }, + "range": [ + 18114, + 18174 + ], + "loc": { + "start": { + "line": 512, + "column": 28 + }, + "end": { + "line": 512, + "column": 88 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "x", + "range": [ + 18175, + 18176 + ], + "loc": { + "start": { + "line": 512, + "column": 89 + }, + "end": { + "line": 512, + "column": 90 + } + } + } + ], + "body": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 18180, + 18196 + ], + "loc": { + "start": { + "line": 512, + "column": 94 + }, + "end": { + "line": 512, + "column": 110 + } + } + }, + "property": { + "type": "Identifier", + "name": "x", + "range": [ + 18197, + 18198 + ], + "loc": { + "start": { + "line": 512, + "column": 111 + }, + "end": { + "line": 512, + "column": 112 + } + } + }, + "range": [ + 18180, + 18199 + ], + "loc": { + "start": { + "line": 512, + "column": 94 + }, + "end": { + "line": 512, + "column": 113 + } + } + }, + "generator": false, + "expression": true, + "range": [ + 18175, + 18199 + ], + "loc": { + "start": { + "line": 512, + "column": 89 + }, + "end": { + "line": 512, + "column": 113 + } + } + } + ], + "range": [ + 18114, + 18200 + ], + "loc": { + "start": { + "line": 512, + "column": 28 + }, + "end": { + "line": 512, + "column": 114 + } + } + }, + "range": [ + 18096, + 18200 + ], + "loc": { + "start": { + "line": 512, + "column": 10 + }, + "end": { + "line": 512, + "column": 114 + } + } + } + ], + "kind": "let", + "range": [ + 18092, + 18201 + ], + "loc": { + "start": { + "line": 512, + "column": 6 + }, + "end": { + "line": 512, + "column": 115 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "targetField", + "range": [ + 18212, + 18223 + ], + "loc": { + "start": { + "line": 513, + "column": 10 + }, + "end": { + "line": 513, + "column": 21 + } + } + }, + "init": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 18226, + 18242 + ], + "loc": { + "start": { + "line": 513, + "column": 24 + }, + "end": { + "line": 513, + "column": 40 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 18246, + 18262 + ], + "loc": { + "start": { + "line": 513, + "column": 44 + }, + "end": { + "line": 513, + "column": 60 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18263, + 18278 + ], + "loc": { + "start": { + "line": 513, + "column": 61 + }, + "end": { + "line": 513, + "column": 76 + } + } + }, + "range": [ + 18246, + 18279 + ], + "loc": { + "start": { + "line": 513, + "column": 44 + }, + "end": { + "line": 513, + "column": 77 + } + } + }, + "range": [ + 18226, + 18279 + ], + "loc": { + "start": { + "line": 513, + "column": 24 + }, + "end": { + "line": 513, + "column": 77 + } + } + }, + "range": [ + 18212, + 18279 + ], + "loc": { + "start": { + "line": 513, + "column": 10 + }, + "end": { + "line": 513, + "column": 77 + } + } + } + ], + "kind": "let", + "range": [ + 18208, + 18280 + ], + "loc": { + "start": { + "line": 513, + "column": 6 + }, + "end": { + "line": 513, + "column": 78 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18287, + 18301 + ], + "loc": { + "start": { + "line": 514, + "column": 6 + }, + "end": { + "line": 514, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 18302, + 18313 + ], + "loc": { + "start": { + "line": 514, + "column": 21 + }, + "end": { + "line": 514, + "column": 32 + } + } + }, + "range": [ + 18287, + 18313 + ], + "loc": { + "start": { + "line": 514, + "column": 6 + }, + "end": { + "line": 514, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 18314, + 18318 + ], + "loc": { + "start": { + "line": 514, + "column": 33 + }, + "end": { + "line": 514, + "column": 37 + } + } + }, + "range": [ + 18287, + 18318 + ], + "loc": { + "start": { + "line": 514, + "column": 6 + }, + "end": { + "line": 514, + "column": 37 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 18321, + 18325 + ], + "loc": { + "start": { + "line": 514, + "column": 40 + }, + "end": { + "line": 514, + "column": 44 + } + } + }, + "value": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18327, + 18341 + ], + "loc": { + "start": { + "line": 514, + "column": 46 + }, + "end": { + "line": 514, + "column": 60 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 18342, + 18346 + ], + "loc": { + "start": { + "line": 514, + "column": 61 + }, + "end": { + "line": 514, + "column": 65 + } + } + }, + "range": [ + 18327, + 18346 + ], + "loc": { + "start": { + "line": 514, + "column": 46 + }, + "end": { + "line": 514, + "column": 65 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18321, + 18346 + ], + "loc": { + "start": { + "line": 514, + "column": 40 + }, + "end": { + "line": 514, + "column": 65 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 18348, + 18350 + ], + "loc": { + "start": { + "line": 514, + "column": 67 + }, + "end": { + "line": 514, + "column": 69 + } + } + }, + "value": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18352, + 18366 + ], + "loc": { + "start": { + "line": 514, + "column": 71 + }, + "end": { + "line": 514, + "column": 85 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 18367, + 18369 + ], + "loc": { + "start": { + "line": 514, + "column": 86 + }, + "end": { + "line": 514, + "column": 88 + } + } + }, + "range": [ + 18352, + 18369 + ], + "loc": { + "start": { + "line": 514, + "column": 71 + }, + "end": { + "line": 514, + "column": 88 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18348, + 18369 + ], + "loc": { + "start": { + "line": 514, + "column": 67 + }, + "end": { + "line": 514, + "column": 88 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 18371, + 18380 + ], + "loc": { + "start": { + "line": 514, + "column": 90 + }, + "end": { + "line": 514, + "column": 99 + } + } + }, + "value": { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 18382, + 18397 + ], + "loc": { + "start": { + "line": 514, + "column": 101 + }, + "end": { + "line": 514, + "column": 116 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18371, + 18397 + ], + "loc": { + "start": { + "line": 514, + "column": 90 + }, + "end": { + "line": 514, + "column": 116 + } + } + } + ], + "range": [ + 18319, + 18399 + ], + "loc": { + "start": { + "line": 514, + "column": 38 + }, + "end": { + "line": 514, + "column": 118 + } + } + } + ], + "range": [ + 18287, + 18400 + ], + "loc": { + "start": { + "line": 514, + "column": 6 + }, + "end": { + "line": 514, + "column": 119 + } + } + }, + "range": [ + 18287, + 18401 + ], + "loc": { + "start": { + "line": 514, + "column": 6 + }, + "end": { + "line": 514, + "column": 120 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "targetField", + "range": [ + 18412, + 18423 + ], + "loc": { + "start": { + "line": 515, + "column": 10 + }, + "end": { + "line": 515, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetField", + "range": [ + 18439, + 18450 + ], + "loc": { + "start": { + "line": 516, + "column": 12 + }, + "end": { + "line": 516, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 18451, + 18455 + ], + "loc": { + "start": { + "line": 516, + "column": 24 + }, + "end": { + "line": 516, + "column": 28 + } + } + }, + "range": [ + 18439, + 18455 + ], + "loc": { + "start": { + "line": 516, + "column": 12 + }, + "end": { + "line": 516, + "column": 28 + } + } + }, + "right": { + "type": "Literal", + "value": "has-one", + "raw": "\"has-one\"", + "range": [ + 18460, + 18469 + ], + "loc": { + "start": { + "line": 516, + "column": 33 + }, + "end": { + "line": 516, + "column": 42 + } + } + }, + "range": [ + 18439, + 18469 + ], + "loc": { + "start": { + "line": 516, + "column": 12 + }, + "end": { + "line": 516, + "column": 42 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18483, + 18497 + ], + "loc": { + "start": { + "line": 517, + "column": 10 + }, + "end": { + "line": 517, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 18498, + 18509 + ], + "loc": { + "start": { + "line": 517, + "column": 25 + }, + "end": { + "line": 517, + "column": 36 + } + } + }, + "range": [ + 18483, + 18509 + ], + "loc": { + "start": { + "line": 517, + "column": 10 + }, + "end": { + "line": 517, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 18510, + 18514 + ], + "loc": { + "start": { + "line": 517, + "column": 37 + }, + "end": { + "line": 517, + "column": 41 + } + } + }, + "range": [ + 18483, + 18514 + ], + "loc": { + "start": { + "line": 517, + "column": 10 + }, + "end": { + "line": 517, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 18517, + 18521 + ], + "loc": { + "start": { + "line": 517, + "column": 44 + }, + "end": { + "line": 517, + "column": 48 + } + } + }, + "value": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18523, + 18537 + ], + "loc": { + "start": { + "line": 517, + "column": 50 + }, + "end": { + "line": 517, + "column": 64 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 18538, + 18542 + ], + "loc": { + "start": { + "line": 517, + "column": 65 + }, + "end": { + "line": 517, + "column": 69 + } + } + }, + "range": [ + 18523, + 18542 + ], + "loc": { + "start": { + "line": 517, + "column": 50 + }, + "end": { + "line": 517, + "column": 69 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18517, + 18542 + ], + "loc": { + "start": { + "line": 517, + "column": 44 + }, + "end": { + "line": 517, + "column": 69 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 18544, + 18546 + ], + "loc": { + "start": { + "line": 517, + "column": 71 + }, + "end": { + "line": 517, + "column": 73 + } + } + }, + "value": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18548, + 18562 + ], + "loc": { + "start": { + "line": 517, + "column": 75 + }, + "end": { + "line": 517, + "column": 89 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 18563, + 18565 + ], + "loc": { + "start": { + "line": 517, + "column": 90 + }, + "end": { + "line": 517, + "column": 92 + } + } + }, + "range": [ + 18548, + 18565 + ], + "loc": { + "start": { + "line": 517, + "column": 75 + }, + "end": { + "line": 517, + "column": 92 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18544, + 18565 + ], + "loc": { + "start": { + "line": 517, + "column": 71 + }, + "end": { + "line": 517, + "column": 92 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 18567, + 18576 + ], + "loc": { + "start": { + "line": 517, + "column": 94 + }, + "end": { + "line": 517, + "column": 103 + } + } + }, + "value": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18578, + 18593 + ], + "loc": { + "start": { + "line": 517, + "column": 105 + }, + "end": { + "line": 517, + "column": 120 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18567, + 18593 + ], + "loc": { + "start": { + "line": 517, + "column": 94 + }, + "end": { + "line": 517, + "column": 120 + } + } + } + ], + "range": [ + 18515, + 18595 + ], + "loc": { + "start": { + "line": 517, + "column": 42 + }, + "end": { + "line": 517, + "column": 122 + } + } + } + ], + "range": [ + 18483, + 18596 + ], + "loc": { + "start": { + "line": 517, + "column": 10 + }, + "end": { + "line": 517, + "column": 123 + } + } + }, + "range": [ + 18483, + 18597 + ], + "loc": { + "start": { + "line": 517, + "column": 10 + }, + "end": { + "line": 517, + "column": 124 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18608, + 18622 + ], + "loc": { + "start": { + "line": 518, + "column": 10 + }, + "end": { + "line": 518, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18623, + 18638 + ], + "loc": { + "start": { + "line": 518, + "column": 25 + }, + "end": { + "line": 518, + "column": 40 + } + } + }, + "range": [ + 18608, + 18639 + ], + "loc": { + "start": { + "line": 518, + "column": 10 + }, + "end": { + "line": 518, + "column": 41 + } + } + }, + "right": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18642, + 18656 + ], + "loc": { + "start": { + "line": 518, + "column": 44 + }, + "end": { + "line": 518, + "column": 58 + } + } + }, + "range": [ + 18608, + 18656 + ], + "loc": { + "start": { + "line": 518, + "column": 10 + }, + "end": { + "line": 518, + "column": 58 + } + } + }, + "range": [ + 18608, + 18657 + ], + "loc": { + "start": { + "line": 518, + "column": 10 + }, + "end": { + "line": 518, + "column": 59 + } + } + } + ], + "range": [ + 18471, + 18667 + ], + "loc": { + "start": { + "line": 516, + "column": 44 + }, + "end": { + "line": 519, + "column": 9 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetField", + "range": [ + 18677, + 18688 + ], + "loc": { + "start": { + "line": 519, + "column": 19 + }, + "end": { + "line": 519, + "column": 30 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 18689, + 18693 + ], + "loc": { + "start": { + "line": 519, + "column": 31 + }, + "end": { + "line": 519, + "column": 35 + } + } + }, + "range": [ + 18677, + 18693 + ], + "loc": { + "start": { + "line": 519, + "column": 19 + }, + "end": { + "line": 519, + "column": 35 + } + } + }, + "right": { + "type": "Literal", + "value": "has-many", + "raw": "\"has-many\"", + "range": [ + 18698, + 18708 + ], + "loc": { + "start": { + "line": 519, + "column": 40 + }, + "end": { + "line": 519, + "column": 50 + } + } + }, + "range": [ + 18677, + 18708 + ], + "loc": { + "start": { + "line": 519, + "column": 19 + }, + "end": { + "line": 519, + "column": 50 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18722, + 18736 + ], + "loc": { + "start": { + "line": 520, + "column": 10 + }, + "end": { + "line": 520, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 18737, + 18748 + ], + "loc": { + "start": { + "line": 520, + "column": 25 + }, + "end": { + "line": 520, + "column": 36 + } + } + }, + "range": [ + 18722, + 18748 + ], + "loc": { + "start": { + "line": 520, + "column": 10 + }, + "end": { + "line": 520, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 18749, + 18753 + ], + "loc": { + "start": { + "line": 520, + "column": 37 + }, + "end": { + "line": 520, + "column": 41 + } + } + }, + "range": [ + 18722, + 18753 + ], + "loc": { + "start": { + "line": 520, + "column": 10 + }, + "end": { + "line": 520, + "column": 41 + } + } + }, + "arguments": [ + { + "type": "ObjectExpression", + "properties": [ + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "type", + "range": [ + 18756, + 18760 + ], + "loc": { + "start": { + "line": 520, + "column": 44 + }, + "end": { + "line": 520, + "column": 48 + } + } + }, + "value": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18762, + 18776 + ], + "loc": { + "start": { + "line": 520, + "column": 50 + }, + "end": { + "line": 520, + "column": 64 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 18777, + 18781 + ], + "loc": { + "start": { + "line": 520, + "column": 65 + }, + "end": { + "line": 520, + "column": 69 + } + } + }, + "range": [ + 18762, + 18781 + ], + "loc": { + "start": { + "line": 520, + "column": 50 + }, + "end": { + "line": 520, + "column": 69 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18756, + 18781 + ], + "loc": { + "start": { + "line": 520, + "column": 44 + }, + "end": { + "line": 520, + "column": 69 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "id", + "range": [ + 18783, + 18785 + ], + "loc": { + "start": { + "line": 520, + "column": 71 + }, + "end": { + "line": 520, + "column": 73 + } + } + }, + "value": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18787, + 18801 + ], + "loc": { + "start": { + "line": 520, + "column": 75 + }, + "end": { + "line": 520, + "column": 89 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 18802, + 18804 + ], + "loc": { + "start": { + "line": 520, + "column": 90 + }, + "end": { + "line": 520, + "column": 92 + } + } + }, + "range": [ + 18787, + 18804 + ], + "loc": { + "start": { + "line": 520, + "column": 75 + }, + "end": { + "line": 520, + "column": 92 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18783, + 18804 + ], + "loc": { + "start": { + "line": 520, + "column": 71 + }, + "end": { + "line": 520, + "column": 92 + } + } + }, + { + "type": "Property", + "key": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 18806, + 18815 + ], + "loc": { + "start": { + "line": 520, + "column": 94 + }, + "end": { + "line": 520, + "column": 103 + } + } + }, + "value": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18817, + 18832 + ], + "loc": { + "start": { + "line": 520, + "column": 105 + }, + "end": { + "line": 520, + "column": 120 + } + } + }, + "kind": "init", + "method": false, + "shorthand": false, + "computed": false, + "range": [ + 18806, + 18832 + ], + "loc": { + "start": { + "line": 520, + "column": 94 + }, + "end": { + "line": 520, + "column": 120 + } + } + } + ], + "range": [ + 18754, + 18834 + ], + "loc": { + "start": { + "line": 520, + "column": 42 + }, + "end": { + "line": 520, + "column": 122 + } + } + } + ], + "range": [ + 18722, + 18835 + ], + "loc": { + "start": { + "line": 520, + "column": 10 + }, + "end": { + "line": 520, + "column": 123 + } + } + }, + "range": [ + 18722, + 18836 + ], + "loc": { + "start": { + "line": 520, + "column": 10 + }, + "end": { + "line": 520, + "column": 124 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18851, + 18865 + ], + "loc": { + "start": { + "line": 521, + "column": 14 + }, + "end": { + "line": 521, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18866, + 18881 + ], + "loc": { + "start": { + "line": 521, + "column": 29 + }, + "end": { + "line": 521, + "column": 44 + } + } + }, + "range": [ + 18851, + 18882 + ], + "loc": { + "start": { + "line": 521, + "column": 14 + }, + "end": { + "line": 521, + "column": 45 + } + } + }, + "property": { + "type": "Identifier", + "name": "indexOf", + "range": [ + 18883, + 18890 + ], + "loc": { + "start": { + "line": 521, + "column": 46 + }, + "end": { + "line": 521, + "column": 53 + } + } + }, + "range": [ + 18851, + 18890 + ], + "loc": { + "start": { + "line": 521, + "column": 14 + }, + "end": { + "line": 521, + "column": 53 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18891, + 18905 + ], + "loc": { + "start": { + "line": 521, + "column": 54 + }, + "end": { + "line": 521, + "column": 68 + } + } + } + ], + "range": [ + 18851, + 18906 + ], + "loc": { + "start": { + "line": 521, + "column": 14 + }, + "end": { + "line": 521, + "column": 69 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 18912, + 18913 + ], + "loc": { + "start": { + "line": 521, + "column": 75 + }, + "end": { + "line": 521, + "column": 76 + } + } + }, + "prefix": true, + "range": [ + 18911, + 18913 + ], + "loc": { + "start": { + "line": 521, + "column": 74 + }, + "end": { + "line": 521, + "column": 76 + } + } + }, + "range": [ + 18851, + 18913 + ], + "loc": { + "start": { + "line": 521, + "column": 14 + }, + "end": { + "line": 521, + "column": 76 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 18929, + 18943 + ], + "loc": { + "start": { + "line": 522, + "column": 12 + }, + "end": { + "line": 522, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 18944, + 18959 + ], + "loc": { + "start": { + "line": 522, + "column": 27 + }, + "end": { + "line": 522, + "column": 42 + } + } + }, + "range": [ + 18929, + 18960 + ], + "loc": { + "start": { + "line": 522, + "column": 12 + }, + "end": { + "line": 522, + "column": 43 + } + } + }, + "property": { + "type": "Identifier", + "name": "push", + "range": [ + 18961, + 18965 + ], + "loc": { + "start": { + "line": 522, + "column": 44 + }, + "end": { + "line": 522, + "column": 48 + } + } + }, + "range": [ + 18929, + 18965 + ], + "loc": { + "start": { + "line": 522, + "column": 12 + }, + "end": { + "line": 522, + "column": 48 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 18966, + 18980 + ], + "loc": { + "start": { + "line": 522, + "column": 49 + }, + "end": { + "line": 522, + "column": 63 + } + } + } + ], + "range": [ + 18929, + 18981 + ], + "loc": { + "start": { + "line": 522, + "column": 12 + }, + "end": { + "line": 522, + "column": 64 + } + } + }, + "range": [ + 18929, + 18982 + ], + "loc": { + "start": { + "line": 522, + "column": 12 + }, + "end": { + "line": 522, + "column": 65 + } + } + } + ], + "range": [ + 18915, + 18994 + ], + "loc": { + "start": { + "line": 521, + "column": 78 + }, + "end": { + "line": 523, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 18847, + 18994 + ], + "loc": { + "start": { + "line": 521, + "column": 10 + }, + "end": { + "line": 523, + "column": 11 + } + } + } + ], + "range": [ + 18710, + 19004 + ], + "loc": { + "start": { + "line": 519, + "column": 52 + }, + "end": { + "line": 524, + "column": 9 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetField", + "range": [ + 19014, + 19025 + ], + "loc": { + "start": { + "line": 524, + "column": 19 + }, + "end": { + "line": 524, + "column": 30 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 19026, + 19030 + ], + "loc": { + "start": { + "line": 524, + "column": 31 + }, + "end": { + "line": 524, + "column": 35 + } + } + }, + "range": [ + 19014, + 19030 + ], + "loc": { + "start": { + "line": 524, + "column": 19 + }, + "end": { + "line": 524, + "column": 35 + } + } + }, + "right": { + "type": "Literal", + "value": "attr", + "raw": "\"attr\"", + "range": [ + 19035, + 19041 + ], + "loc": { + "start": { + "line": 524, + "column": 40 + }, + "end": { + "line": 524, + "column": 46 + } + } + }, + "range": [ + 19014, + 19041 + ], + "loc": { + "start": { + "line": 524, + "column": 19 + }, + "end": { + "line": 524, + "column": 46 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 19065, + 19070 + ], + "loc": { + "start": { + "line": 525, + "column": 20 + }, + "end": { + "line": 525, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "The the inverse relationship for '", + "cooked": "The the inverse relationship for '" + }, + "tail": false, + "range": [ + 19071, + 19108 + ], + "loc": { + "start": { + "line": 525, + "column": 26 + }, + "end": { + "line": 525, + "column": 63 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "' is an attribute ('", + "cooked": "' is an attribute ('" + }, + "tail": false, + "range": [ + 19123, + 19146 + ], + "loc": { + "start": { + "line": 525, + "column": 78 + }, + "end": { + "line": 525, + "column": 101 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "')", + "cooked": "')" + }, + "tail": true, + "range": [ + 19161, + 19165 + ], + "loc": { + "start": { + "line": 525, + "column": 116 + }, + "end": { + "line": 525, + "column": 120 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 19108, + 19123 + ], + "loc": { + "start": { + "line": 525, + "column": 63 + }, + "end": { + "line": 525, + "column": 78 + } + } + }, + { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 19146, + 19161 + ], + "loc": { + "start": { + "line": 525, + "column": 101 + }, + "end": { + "line": 525, + "column": 116 + } + } + } + ], + "range": [ + 19071, + 19165 + ], + "loc": { + "start": { + "line": 525, + "column": 26 + }, + "end": { + "line": 525, + "column": 120 + } + } + } + ], + "range": [ + 19061, + 19166 + ], + "loc": { + "start": { + "line": 525, + "column": 16 + }, + "end": { + "line": 525, + "column": 121 + } + } + }, + "range": [ + 19055, + 19167 + ], + "loc": { + "start": { + "line": 525, + "column": 10 + }, + "end": { + "line": 525, + "column": 122 + } + } + } + ], + "range": [ + 19043, + 19177 + ], + "loc": { + "start": { + "line": 524, + "column": 48 + }, + "end": { + "line": 526, + "column": 9 + } + } + }, + "alternate": null, + "range": [ + 19010, + 19177 + ], + "loc": { + "start": { + "line": 524, + "column": 15 + }, + "end": { + "line": 526, + "column": 9 + } + } + }, + "range": [ + 18673, + 19177 + ], + "loc": { + "start": { + "line": 519, + "column": 15 + }, + "end": { + "line": 526, + "column": 9 + } + } + }, + "range": [ + 18435, + 19177 + ], + "loc": { + "start": { + "line": 516, + "column": 8 + }, + "end": { + "line": 526, + "column": 9 + } + } + } + ], + "range": [ + 18425, + 19185 + ], + "loc": { + "start": { + "line": 515, + "column": 23 + }, + "end": { + "line": 527, + "column": 7 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceField", + "range": [ + 19195, + 19206 + ], + "loc": { + "start": { + "line": 527, + "column": 17 + }, + "end": { + "line": 527, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 19207, + 19214 + ], + "loc": { + "start": { + "line": 527, + "column": 29 + }, + "end": { + "line": 527, + "column": 36 + } + } + }, + "range": [ + 19195, + 19214 + ], + "loc": { + "start": { + "line": 527, + "column": 17 + }, + "end": { + "line": 527, + "column": 36 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 19236, + 19241 + ], + "loc": { + "start": { + "line": 528, + "column": 18 + }, + "end": { + "line": 528, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "The the inverse relationship for '", + "cooked": "The the inverse relationship for '" + }, + "tail": false, + "range": [ + 19242, + 19279 + ], + "loc": { + "start": { + "line": 528, + "column": 24 + }, + "end": { + "line": 528, + "column": 61 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "' is missing ('", + "cooked": "' is missing ('" + }, + "tail": false, + "range": [ + 19294, + 19312 + ], + "loc": { + "start": { + "line": 528, + "column": 76 + }, + "end": { + "line": 528, + "column": 94 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "')", + "cooked": "')" + }, + "tail": true, + "range": [ + 19331, + 19335 + ], + "loc": { + "start": { + "line": 528, + "column": 113 + }, + "end": { + "line": 528, + "column": 117 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 19279, + 19294 + ], + "loc": { + "start": { + "line": 528, + "column": 61 + }, + "end": { + "line": 528, + "column": 76 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceField", + "range": [ + 19312, + 19323 + ], + "loc": { + "start": { + "line": 528, + "column": 94 + }, + "end": { + "line": 528, + "column": 105 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 19324, + 19331 + ], + "loc": { + "start": { + "line": 528, + "column": 106 + }, + "end": { + "line": 528, + "column": 113 + } + } + }, + "range": [ + 19312, + 19331 + ], + "loc": { + "start": { + "line": 528, + "column": 94 + }, + "end": { + "line": 528, + "column": 113 + } + } + } + ], + "range": [ + 19242, + 19335 + ], + "loc": { + "start": { + "line": 528, + "column": 24 + }, + "end": { + "line": 528, + "column": 117 + } + } + } + ], + "range": [ + 19232, + 19336 + ], + "loc": { + "start": { + "line": 528, + "column": 14 + }, + "end": { + "line": 528, + "column": 118 + } + } + }, + "range": [ + 19226, + 19337 + ], + "loc": { + "start": { + "line": 528, + "column": 8 + }, + "end": { + "line": 528, + "column": 119 + } + } + } + ], + "range": [ + 19216, + 19345 + ], + "loc": { + "start": { + "line": 527, + "column": 38 + }, + "end": { + "line": 529, + "column": 7 + } + } + }, + "alternate": null, + "range": [ + 19191, + 19345 + ], + "loc": { + "start": { + "line": 527, + "column": 13 + }, + "end": { + "line": 529, + "column": 7 + } + } + }, + "range": [ + 18408, + 19345 + ], + "loc": { + "start": { + "line": 515, + "column": 6 + }, + "end": { + "line": 529, + "column": 7 + } + } + } + ], + "range": [ + 18084, + 19351 + ], + "loc": { + "start": { + "line": 511, + "column": 26 + }, + "end": { + "line": 530, + "column": 5 + } + } + }, + "alternate": null, + "range": [ + 18062, + 19351 + ], + "loc": { + "start": { + "line": 511, + "column": 4 + }, + "end": { + "line": 530, + "column": 5 + } + } + } + ], + "range": [ + 17934, + 19355 + ], + "loc": { + "start": { + "line": 508, + "column": 88 + }, + "end": { + "line": 531, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 17871, + 19355 + ], + "loc": { + "start": { + "line": 508, + "column": 25 + }, + "end": { + "line": 531, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 17848, + 19355 + ], + "loc": { + "start": { + "line": 508, + "column": 2 + }, + "end": { + "line": 531, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_remove", + "range": [ + 19359, + 19366 + ], + "loc": { + "start": { + "line": 533, + "column": 2 + }, + "end": { + "line": 533, + "column": 9 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 19367, + 19375 + ], + "loc": { + "start": { + "line": 533, + "column": 10 + }, + "end": { + "line": 533, + "column": 18 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 19383, + 19391 + ], + "loc": { + "start": { + "line": 534, + "column": 4 + }, + "end": { + "line": 534, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 19392, + 19403 + ], + "loc": { + "start": { + "line": 534, + "column": 13 + }, + "end": { + "line": 534, + "column": 24 + } + } + }, + "range": [ + 19383, + 19403 + ], + "loc": { + "start": { + "line": 534, + "column": 4 + }, + "end": { + "line": 534, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "forEach", + "range": [ + 19404, + 19411 + ], + "loc": { + "start": { + "line": 534, + "column": 25 + }, + "end": { + "line": 534, + "column": 32 + } + } + }, + "range": [ + 19383, + 19411 + ], + "loc": { + "start": { + "line": 534, + "column": 4 + }, + "end": { + "line": 534, + "column": 32 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "dependent", + "range": [ + 19412, + 19421 + ], + "loc": { + "start": { + "line": 534, + "column": 33 + }, + "end": { + "line": 534, + "column": 42 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "dependentResource", + "range": [ + 19437, + 19454 + ], + "loc": { + "start": { + "line": 535, + "column": 10 + }, + "end": { + "line": 535, + "column": 27 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 19457, + 19461 + ], + "loc": { + "start": { + "line": 535, + "column": 30 + }, + "end": { + "line": 535, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 19462, + 19467 + ], + "loc": { + "start": { + "line": 535, + "column": 35 + }, + "end": { + "line": 535, + "column": 40 + } + } + }, + "range": [ + 19457, + 19467 + ], + "loc": { + "start": { + "line": 535, + "column": 30 + }, + "end": { + "line": 535, + "column": 40 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19468, + 19477 + ], + "loc": { + "start": { + "line": 535, + "column": 41 + }, + "end": { + "line": 535, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 19478, + 19482 + ], + "loc": { + "start": { + "line": 535, + "column": 51 + }, + "end": { + "line": 535, + "column": 55 + } + } + }, + "range": [ + 19468, + 19482 + ], + "loc": { + "start": { + "line": 535, + "column": 41 + }, + "end": { + "line": 535, + "column": 55 + } + } + }, + "range": [ + 19457, + 19483 + ], + "loc": { + "start": { + "line": 535, + "column": 30 + }, + "end": { + "line": 535, + "column": 56 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19484, + 19493 + ], + "loc": { + "start": { + "line": 535, + "column": 57 + }, + "end": { + "line": 535, + "column": 66 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 19494, + 19496 + ], + "loc": { + "start": { + "line": 535, + "column": 67 + }, + "end": { + "line": 535, + "column": 69 + } + } + }, + "range": [ + 19484, + 19496 + ], + "loc": { + "start": { + "line": 535, + "column": 57 + }, + "end": { + "line": 535, + "column": 69 + } + } + }, + "range": [ + 19457, + 19497 + ], + "loc": { + "start": { + "line": 535, + "column": 30 + }, + "end": { + "line": 535, + "column": 70 + } + } + }, + "range": [ + 19437, + 19497 + ], + "loc": { + "start": { + "line": 535, + "column": 10 + }, + "end": { + "line": 535, + "column": 70 + } + } + } + ], + "kind": "let", + "range": [ + 19433, + 19498 + ], + "loc": { + "start": { + "line": 535, + "column": 6 + }, + "end": { + "line": 535, + "column": 71 + } + } + }, + { + "type": "SwitchStatement", + "discriminant": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 19513, + 19517 + ], + "loc": { + "start": { + "line": 536, + "column": 14 + }, + "end": { + "line": 536, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 19518, + 19524 + ], + "loc": { + "start": { + "line": 536, + "column": 19 + }, + "end": { + "line": 536, + "column": 25 + } + } + }, + "range": [ + 19513, + 19524 + ], + "loc": { + "start": { + "line": 536, + "column": 14 + }, + "end": { + "line": 536, + "column": 25 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19525, + 19534 + ], + "loc": { + "start": { + "line": 536, + "column": 26 + }, + "end": { + "line": 536, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 19535, + 19539 + ], + "loc": { + "start": { + "line": 536, + "column": 36 + }, + "end": { + "line": 536, + "column": 40 + } + } + }, + "range": [ + 19525, + 19539 + ], + "loc": { + "start": { + "line": 536, + "column": 26 + }, + "end": { + "line": 536, + "column": 40 + } + } + }, + "range": [ + 19513, + 19540 + ], + "loc": { + "start": { + "line": 536, + "column": 14 + }, + "end": { + "line": 536, + "column": 41 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19541, + 19550 + ], + "loc": { + "start": { + "line": 536, + "column": 42 + }, + "end": { + "line": 536, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 19551, + 19560 + ], + "loc": { + "start": { + "line": 536, + "column": 52 + }, + "end": { + "line": 536, + "column": 61 + } + } + }, + "range": [ + 19541, + 19560 + ], + "loc": { + "start": { + "line": 536, + "column": 42 + }, + "end": { + "line": 536, + "column": 61 + } + } + }, + "range": [ + 19513, + 19561 + ], + "loc": { + "start": { + "line": 536, + "column": 14 + }, + "end": { + "line": 536, + "column": 62 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 19562, + 19566 + ], + "loc": { + "start": { + "line": 536, + "column": 63 + }, + "end": { + "line": 536, + "column": 67 + } + } + }, + "range": [ + 19513, + 19566 + ], + "loc": { + "start": { + "line": 536, + "column": 14 + }, + "end": { + "line": 536, + "column": 67 + } + } + }, + "cases": [ + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": "has-one", + "raw": "\"has-one\"", + "range": [ + 19583, + 19592 + ], + "loc": { + "start": { + "line": 537, + "column": 13 + }, + "end": { + "line": 537, + "column": 22 + } + } + }, + "consequent": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "dependentResource", + "range": [ + 19606, + 19623 + ], + "loc": { + "start": { + "line": 538, + "column": 10 + }, + "end": { + "line": 538, + "column": 27 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19624, + 19633 + ], + "loc": { + "start": { + "line": 538, + "column": 28 + }, + "end": { + "line": 538, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 19634, + 19643 + ], + "loc": { + "start": { + "line": 538, + "column": 38 + }, + "end": { + "line": 538, + "column": 47 + } + } + }, + "range": [ + 19624, + 19643 + ], + "loc": { + "start": { + "line": 538, + "column": 28 + }, + "end": { + "line": 538, + "column": 47 + } + } + }, + "range": [ + 19606, + 19644 + ], + "loc": { + "start": { + "line": 538, + "column": 10 + }, + "end": { + "line": 538, + "column": 48 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 19647, + 19651 + ], + "loc": { + "start": { + "line": 538, + "column": 51 + }, + "end": { + "line": 538, + "column": 55 + } + } + }, + "range": [ + 19606, + 19651 + ], + "loc": { + "start": { + "line": 538, + "column": 10 + }, + "end": { + "line": 538, + "column": 55 + } + } + }, + "range": [ + 19606, + 19652 + ], + "loc": { + "start": { + "line": 538, + "column": 10 + }, + "end": { + "line": 538, + "column": 56 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 19663, + 19669 + ], + "loc": { + "start": { + "line": 539, + "column": 10 + }, + "end": { + "line": 539, + "column": 16 + } + } + } + ], + "range": [ + 19594, + 19679 + ], + "loc": { + "start": { + "line": 537, + "column": 24 + }, + "end": { + "line": 540, + "column": 9 + } + } + } + ], + "range": [ + 19578, + 19679 + ], + "loc": { + "start": { + "line": 537, + "column": 8 + }, + "end": { + "line": 540, + "column": 9 + } + } + }, + { + "type": "SwitchCase", + "test": { + "type": "Literal", + "value": "has-many", + "raw": "\"has-many\"", + "range": [ + 19693, + 19703 + ], + "loc": { + "start": { + "line": 541, + "column": 13 + }, + "end": { + "line": 541, + "column": 23 + } + } + }, + "consequent": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "index", + "range": [ + 19721, + 19726 + ], + "loc": { + "start": { + "line": 542, + "column": 14 + }, + "end": { + "line": 542, + "column": 19 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "dependentResource", + "range": [ + 19729, + 19746 + ], + "loc": { + "start": { + "line": 542, + "column": 22 + }, + "end": { + "line": 542, + "column": 39 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19747, + 19756 + ], + "loc": { + "start": { + "line": 542, + "column": 40 + }, + "end": { + "line": 542, + "column": 49 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 19757, + 19766 + ], + "loc": { + "start": { + "line": 542, + "column": 50 + }, + "end": { + "line": 542, + "column": 59 + } + } + }, + "range": [ + 19747, + 19766 + ], + "loc": { + "start": { + "line": 542, + "column": 40 + }, + "end": { + "line": 542, + "column": 59 + } + } + }, + "range": [ + 19729, + 19767 + ], + "loc": { + "start": { + "line": 542, + "column": 22 + }, + "end": { + "line": 542, + "column": 60 + } + } + }, + "property": { + "type": "Identifier", + "name": "indexOf", + "range": [ + 19768, + 19775 + ], + "loc": { + "start": { + "line": 542, + "column": 61 + }, + "end": { + "line": 542, + "column": 68 + } + } + }, + "range": [ + 19729, + 19775 + ], + "loc": { + "start": { + "line": 542, + "column": 22 + }, + "end": { + "line": 542, + "column": 68 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "resource", + "range": [ + 19776, + 19784 + ], + "loc": { + "start": { + "line": 542, + "column": 69 + }, + "end": { + "line": 542, + "column": 77 + } + } + } + ], + "range": [ + 19729, + 19785 + ], + "loc": { + "start": { + "line": 542, + "column": 22 + }, + "end": { + "line": 542, + "column": 78 + } + } + }, + "range": [ + 19721, + 19785 + ], + "loc": { + "start": { + "line": 542, + "column": 14 + }, + "end": { + "line": 542, + "column": 78 + } + } + } + ], + "kind": "let", + "range": [ + 19717, + 19786 + ], + "loc": { + "start": { + "line": 542, + "column": 10 + }, + "end": { + "line": 542, + "column": 79 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "Identifier", + "name": "index", + "range": [ + 19801, + 19806 + ], + "loc": { + "start": { + "line": 543, + "column": 14 + }, + "end": { + "line": 543, + "column": 19 + } + } + }, + "right": { + "type": "UnaryExpression", + "operator": "-", + "argument": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 19812, + 19813 + ], + "loc": { + "start": { + "line": 543, + "column": 25 + }, + "end": { + "line": 543, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 19811, + 19813 + ], + "loc": { + "start": { + "line": 543, + "column": 24 + }, + "end": { + "line": 543, + "column": 26 + } + } + }, + "range": [ + 19801, + 19813 + ], + "loc": { + "start": { + "line": 543, + "column": 14 + }, + "end": { + "line": 543, + "column": 26 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "dependentResource", + "range": [ + 19829, + 19846 + ], + "loc": { + "start": { + "line": 544, + "column": 12 + }, + "end": { + "line": 544, + "column": 29 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependent", + "range": [ + 19847, + 19856 + ], + "loc": { + "start": { + "line": 544, + "column": 30 + }, + "end": { + "line": 544, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 19857, + 19866 + ], + "loc": { + "start": { + "line": 544, + "column": 40 + }, + "end": { + "line": 544, + "column": 49 + } + } + }, + "range": [ + 19847, + 19866 + ], + "loc": { + "start": { + "line": 544, + "column": 30 + }, + "end": { + "line": 544, + "column": 49 + } + } + }, + "range": [ + 19829, + 19867 + ], + "loc": { + "start": { + "line": 544, + "column": 12 + }, + "end": { + "line": 544, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "splice", + "range": [ + 19868, + 19874 + ], + "loc": { + "start": { + "line": 544, + "column": 51 + }, + "end": { + "line": 544, + "column": 57 + } + } + }, + "range": [ + 19829, + 19874 + ], + "loc": { + "start": { + "line": 544, + "column": 12 + }, + "end": { + "line": 544, + "column": 57 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "index", + "range": [ + 19875, + 19880 + ], + "loc": { + "start": { + "line": 544, + "column": 58 + }, + "end": { + "line": 544, + "column": 63 + } + } + }, + { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 19882, + 19883 + ], + "loc": { + "start": { + "line": 544, + "column": 65 + }, + "end": { + "line": 544, + "column": 66 + } + } + } + ], + "range": [ + 19829, + 19884 + ], + "loc": { + "start": { + "line": 544, + "column": 12 + }, + "end": { + "line": 544, + "column": 67 + } + } + }, + "range": [ + 19829, + 19885 + ], + "loc": { + "start": { + "line": 544, + "column": 12 + }, + "end": { + "line": 544, + "column": 68 + } + } + } + ], + "range": [ + 19815, + 19897 + ], + "loc": { + "start": { + "line": 543, + "column": 28 + }, + "end": { + "line": 545, + "column": 11 + } + } + }, + "alternate": null, + "range": [ + 19797, + 19897 + ], + "loc": { + "start": { + "line": 543, + "column": 10 + }, + "end": { + "line": 545, + "column": 11 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 19908, + 19914 + ], + "loc": { + "start": { + "line": 546, + "column": 10 + }, + "end": { + "line": 546, + "column": 16 + } + } + } + ], + "range": [ + 19705, + 19924 + ], + "loc": { + "start": { + "line": 541, + "column": 25 + }, + "end": { + "line": 547, + "column": 9 + } + } + } + ], + "range": [ + 19688, + 19924 + ], + "loc": { + "start": { + "line": 541, + "column": 8 + }, + "end": { + "line": 547, + "column": 9 + } + } + }, + { + "type": "SwitchCase", + "test": null, + "consequent": [ + { + "type": "BlockStatement", + "body": [ + { + "type": "BreakStatement", + "label": null, + "range": [ + 19954, + 19960 + ], + "loc": { + "start": { + "line": 549, + "column": 10 + }, + "end": { + "line": 549, + "column": 16 + } + } + } + ], + "range": [ + 19942, + 19970 + ], + "loc": { + "start": { + "line": 548, + "column": 17 + }, + "end": { + "line": 550, + "column": 9 + } + } + } + ], + "range": [ + 19933, + 19970 + ], + "loc": { + "start": { + "line": 548, + "column": 8 + }, + "end": { + "line": 550, + "column": 9 + } + } + } + ], + "range": [ + 19505, + 19978 + ], + "loc": { + "start": { + "line": 536, + "column": 6 + }, + "end": { + "line": 551, + "column": 7 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " TODO: This only needs to be run once for each dependent.", + "range": [ + 19985, + 20044 + ], + "loc": { + "start": { + "line": 552, + "column": 6 + }, + "end": { + "line": 552, + "column": 65 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependentResource", + "range": [ + 20051, + 20068 + ], + "loc": { + "start": { + "line": 553, + "column": 6 + }, + "end": { + "line": 553, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 20069, + 20080 + ], + "loc": { + "start": { + "line": 553, + "column": 24 + }, + "end": { + "line": 553, + "column": 35 + } + } + }, + "range": [ + 20051, + 20080 + ], + "loc": { + "start": { + "line": 553, + "column": 6 + }, + "end": { + "line": 553, + "column": 35 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "dependentResource", + "range": [ + 20083, + 20100 + ], + "loc": { + "start": { + "line": 553, + "column": 38 + }, + "end": { + "line": 553, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 20101, + 20112 + ], + "loc": { + "start": { + "line": 553, + "column": 56 + }, + "end": { + "line": 553, + "column": 67 + } + } + }, + "range": [ + 20083, + 20112 + ], + "loc": { + "start": { + "line": 553, + "column": 38 + }, + "end": { + "line": 553, + "column": 67 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 20113, + 20119 + ], + "loc": { + "start": { + "line": 553, + "column": 68 + }, + "end": { + "line": 553, + "column": 74 + } + } + }, + "range": [ + 20083, + 20119 + ], + "loc": { + "start": { + "line": 553, + "column": 38 + }, + "end": { + "line": 553, + "column": 74 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "d", + "range": [ + 20120, + 20121 + ], + "loc": { + "start": { + "line": 553, + "column": 75 + }, + "end": { + "line": 553, + "column": 76 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 20144, + 20145 + ], + "loc": { + "start": { + "line": 554, + "column": 17 + }, + "end": { + "line": 554, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20146, + 20150 + ], + "loc": { + "start": { + "line": 554, + "column": 19 + }, + "end": { + "line": 554, + "column": 23 + } + } + }, + "range": [ + 20144, + 20150 + ], + "loc": { + "start": { + "line": 554, + "column": 17 + }, + "end": { + "line": 554, + "column": 23 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 20155, + 20163 + ], + "loc": { + "start": { + "line": 554, + "column": 28 + }, + "end": { + "line": 554, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20164, + 20168 + ], + "loc": { + "start": { + "line": 554, + "column": 37 + }, + "end": { + "line": 554, + "column": 41 + } + } + }, + "range": [ + 20155, + 20168 + ], + "loc": { + "start": { + "line": 554, + "column": 28 + }, + "end": { + "line": 554, + "column": 41 + } + } + }, + "range": [ + 20144, + 20168 + ], + "loc": { + "start": { + "line": 554, + "column": 17 + }, + "end": { + "line": 554, + "column": 41 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "d", + "range": [ + 20172, + 20173 + ], + "loc": { + "start": { + "line": 554, + "column": 45 + }, + "end": { + "line": 554, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20174, + 20176 + ], + "loc": { + "start": { + "line": 554, + "column": 47 + }, + "end": { + "line": 554, + "column": 49 + } + } + }, + "range": [ + 20172, + 20176 + ], + "loc": { + "start": { + "line": 554, + "column": 45 + }, + "end": { + "line": 554, + "column": 49 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 20181, + 20189 + ], + "loc": { + "start": { + "line": 554, + "column": 54 + }, + "end": { + "line": 554, + "column": 62 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20190, + 20192 + ], + "loc": { + "start": { + "line": 554, + "column": 63 + }, + "end": { + "line": 554, + "column": 65 + } + } + }, + "range": [ + 20181, + 20192 + ], + "loc": { + "start": { + "line": 554, + "column": 54 + }, + "end": { + "line": 554, + "column": 65 + } + } + }, + "range": [ + 20172, + 20192 + ], + "loc": { + "start": { + "line": 554, + "column": 45 + }, + "end": { + "line": 554, + "column": 65 + } + } + }, + "range": [ + 20144, + 20192 + ], + "loc": { + "start": { + "line": 554, + "column": 17 + }, + "end": { + "line": 554, + "column": 65 + } + } + }, + "prefix": true, + "range": [ + 20142, + 20193 + ], + "loc": { + "start": { + "line": 554, + "column": 15 + }, + "end": { + "line": 554, + "column": 66 + } + } + }, + "range": [ + 20135, + 20194 + ], + "loc": { + "start": { + "line": 554, + "column": 8 + }, + "end": { + "line": 554, + "column": 67 + } + } + } + ], + "range": [ + 20125, + 20202 + ], + "loc": { + "start": { + "line": 553, + "column": 80 + }, + "end": { + "line": 555, + "column": 7 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 20120, + 20202 + ], + "loc": { + "start": { + "line": 553, + "column": 75 + }, + "end": { + "line": 555, + "column": 7 + } + } + } + ], + "range": [ + 20083, + 20203 + ], + "loc": { + "start": { + "line": 553, + "column": 38 + }, + "end": { + "line": 555, + "column": 8 + } + } + }, + "range": [ + 20051, + 20203 + ], + "loc": { + "start": { + "line": 553, + "column": 6 + }, + "end": { + "line": 555, + "column": 8 + } + } + }, + "range": [ + 20051, + 20204 + ], + "loc": { + "start": { + "line": 553, + "column": 6 + }, + "end": { + "line": 555, + "column": 9 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " TODO: This only needs to be run once for each dependent.", + "range": [ + 19985, + 20044 + ], + "loc": { + "start": { + "line": 552, + "column": 6 + }, + "end": { + "line": 552, + "column": 65 + } + } + } + ] + } + ], + "range": [ + 19425, + 20210 + ], + "loc": { + "start": { + "line": 534, + "column": 46 + }, + "end": { + "line": 556, + "column": 5 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 19412, + 20210 + ], + "loc": { + "start": { + "line": 534, + "column": 33 + }, + "end": { + "line": 556, + "column": 5 + } + } + } + ], + "range": [ + 19383, + 20211 + ], + "loc": { + "start": { + "line": 534, + "column": 4 + }, + "end": { + "line": 556, + "column": 6 + } + } + }, + "range": [ + 19383, + 20212 + ], + "loc": { + "start": { + "line": 534, + "column": 4 + }, + "end": { + "line": 556, + "column": 7 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "UnaryExpression", + "operator": "delete", + "argument": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 20224, + 20228 + ], + "loc": { + "start": { + "line": 557, + "column": 11 + }, + "end": { + "line": 557, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "_data", + "range": [ + 20229, + 20234 + ], + "loc": { + "start": { + "line": 557, + "column": 16 + }, + "end": { + "line": 557, + "column": 21 + } + } + }, + "range": [ + 20224, + 20234 + ], + "loc": { + "start": { + "line": 557, + "column": 11 + }, + "end": { + "line": 557, + "column": 21 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 20235, + 20243 + ], + "loc": { + "start": { + "line": 557, + "column": 22 + }, + "end": { + "line": 557, + "column": 30 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20244, + 20248 + ], + "loc": { + "start": { + "line": 557, + "column": 31 + }, + "end": { + "line": 557, + "column": 35 + } + } + }, + "range": [ + 20235, + 20248 + ], + "loc": { + "start": { + "line": 557, + "column": 22 + }, + "end": { + "line": 557, + "column": 35 + } + } + }, + "range": [ + 20224, + 20249 + ], + "loc": { + "start": { + "line": 557, + "column": 11 + }, + "end": { + "line": 557, + "column": 36 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "resource", + "range": [ + 20250, + 20258 + ], + "loc": { + "start": { + "line": 557, + "column": 37 + }, + "end": { + "line": 557, + "column": 45 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20259, + 20261 + ], + "loc": { + "start": { + "line": 557, + "column": 46 + }, + "end": { + "line": 557, + "column": 48 + } + } + }, + "range": [ + 20250, + 20261 + ], + "loc": { + "start": { + "line": 557, + "column": 37 + }, + "end": { + "line": 557, + "column": 48 + } + } + }, + "range": [ + 20224, + 20262 + ], + "loc": { + "start": { + "line": 557, + "column": 11 + }, + "end": { + "line": 557, + "column": 49 + } + } + }, + "prefix": true, + "range": [ + 20217, + 20262 + ], + "loc": { + "start": { + "line": 557, + "column": 4 + }, + "end": { + "line": 557, + "column": 49 + } + } + }, + "range": [ + 20217, + 20263 + ], + "loc": { + "start": { + "line": 557, + "column": 4 + }, + "end": { + "line": 557, + "column": 50 + } + } + } + ], + "range": [ + 19377, + 20267 + ], + "loc": { + "start": { + "line": 533, + "column": 20 + }, + "end": { + "line": 558, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 19366, + 20267 + ], + "loc": { + "start": { + "line": 533, + "column": 9 + }, + "end": { + "line": 558, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 19359, + 20267 + ], + "loc": { + "start": { + "line": 533, + "column": 2 + }, + "end": { + "line": 558, + "column": 3 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_removeInverseRelationship", + "range": [ + 20271, + 20297 + ], + "loc": { + "start": { + "line": 560, + "column": 2 + }, + "end": { + "line": 560, + "column": 28 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 20298, + 20312 + ], + "loc": { + "start": { + "line": 560, + "column": 29 + }, + "end": { + "line": 560, + "column": 43 + } + } + }, + { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 20314, + 20329 + ], + "loc": { + "start": { + "line": 560, + "column": 45 + }, + "end": { + "line": 560, + "column": 60 + } + } + }, + { + "type": "Identifier", + "name": "targetResource", + "range": [ + 20331, + 20345 + ], + "loc": { + "start": { + "line": 560, + "column": 62 + }, + "end": { + "line": 560, + "column": 76 + } + } + }, + { + "type": "Identifier", + "name": "sourceField", + "range": [ + 20347, + 20358 + ], + "loc": { + "start": { + "line": 560, + "column": 78 + }, + "end": { + "line": 560, + "column": 89 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 20370, + 20386 + ], + "loc": { + "start": { + "line": 561, + "column": 8 + }, + "end": { + "line": 561, + "column": 24 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 20389, + 20393 + ], + "loc": { + "start": { + "line": 561, + "column": 27 + }, + "end": { + "line": 561, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "_types", + "range": [ + 20394, + 20400 + ], + "loc": { + "start": { + "line": 561, + "column": 32 + }, + "end": { + "line": 561, + "column": 38 + } + } + }, + "range": [ + 20389, + 20400 + ], + "loc": { + "start": { + "line": 561, + "column": 27 + }, + "end": { + "line": 561, + "column": 38 + } + } + }, + "property": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 20401, + 20415 + ], + "loc": { + "start": { + "line": 561, + "column": 39 + }, + "end": { + "line": 561, + "column": 53 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20416, + 20420 + ], + "loc": { + "start": { + "line": 561, + "column": 54 + }, + "end": { + "line": 561, + "column": 58 + } + } + }, + "range": [ + 20401, + 20420 + ], + "loc": { + "start": { + "line": 561, + "column": 39 + }, + "end": { + "line": 561, + "column": 58 + } + } + }, + "range": [ + 20389, + 20421 + ], + "loc": { + "start": { + "line": 561, + "column": 27 + }, + "end": { + "line": 561, + "column": 59 + } + } + }, + "range": [ + 20370, + 20421 + ], + "loc": { + "start": { + "line": 561, + "column": 8 + }, + "end": { + "line": 561, + "column": 59 + } + } + } + ], + "kind": "var", + "range": [ + 20366, + 20422 + ], + "loc": { + "start": { + "line": 561, + "column": 4 + }, + "end": { + "line": 561, + "column": 60 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 20431, + 20446 + ], + "loc": { + "start": { + "line": 562, + "column": 8 + }, + "end": { + "line": 562, + "column": 23 + } + } + }, + "init": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceField", + "range": [ + 20449, + 20460 + ], + "loc": { + "start": { + "line": 562, + "column": 26 + }, + "end": { + "line": 562, + "column": 37 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 20461, + 20468 + ], + "loc": { + "start": { + "line": 562, + "column": 38 + }, + "end": { + "line": 562, + "column": 45 + } + } + }, + "range": [ + 20449, + 20468 + ], + "loc": { + "start": { + "line": 562, + "column": 26 + }, + "end": { + "line": 562, + "column": 45 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 20472, + 20486 + ], + "loc": { + "start": { + "line": 562, + "column": 49 + }, + "end": { + "line": 562, + "column": 63 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20487, + 20491 + ], + "loc": { + "start": { + "line": 562, + "column": 64 + }, + "end": { + "line": 562, + "column": 68 + } + } + }, + "range": [ + 20472, + 20491 + ], + "loc": { + "start": { + "line": 562, + "column": 49 + }, + "end": { + "line": 562, + "column": 68 + } + } + }, + "range": [ + 20449, + 20491 + ], + "loc": { + "start": { + "line": 562, + "column": 26 + }, + "end": { + "line": 562, + "column": 68 + } + } + }, + "range": [ + 20431, + 20491 + ], + "loc": { + "start": { + "line": 562, + "column": 8 + }, + "end": { + "line": 562, + "column": 68 + } + } + } + ], + "kind": "var", + "range": [ + 20427, + 20492 + ], + "loc": { + "start": { + "line": 562, + "column": 4 + }, + "end": { + "line": 562, + "column": 69 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "targetField", + "range": [ + 20501, + 20512 + ], + "loc": { + "start": { + "line": 563, + "column": 8 + }, + "end": { + "line": 563, + "column": 19 + } + } + }, + "init": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 20515, + 20531 + ], + "loc": { + "start": { + "line": 563, + "column": 22 + }, + "end": { + "line": 563, + "column": 38 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetDefinition", + "range": [ + 20535, + 20551 + ], + "loc": { + "start": { + "line": 563, + "column": 42 + }, + "end": { + "line": 563, + "column": 58 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 20552, + 20567 + ], + "loc": { + "start": { + "line": 563, + "column": 59 + }, + "end": { + "line": 563, + "column": 74 + } + } + }, + "range": [ + 20535, + 20568 + ], + "loc": { + "start": { + "line": 563, + "column": 42 + }, + "end": { + "line": 563, + "column": 75 + } + } + }, + "range": [ + 20515, + 20568 + ], + "loc": { + "start": { + "line": 563, + "column": 22 + }, + "end": { + "line": 563, + "column": 75 + } + } + }, + "range": [ + 20501, + 20568 + ], + "loc": { + "start": { + "line": 563, + "column": 8 + }, + "end": { + "line": 563, + "column": 75 + } + } + } + ], + "kind": "var", + "range": [ + 20497, + 20569 + ], + "loc": { + "start": { + "line": 563, + "column": 4 + }, + "end": { + "line": 563, + "column": 76 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 20574, + 20588 + ], + "loc": { + "start": { + "line": 564, + "column": 4 + }, + "end": { + "line": 564, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 20589, + 20600 + ], + "loc": { + "start": { + "line": 564, + "column": 19 + }, + "end": { + "line": 564, + "column": 30 + } + } + }, + "range": [ + 20574, + 20600 + ], + "loc": { + "start": { + "line": 564, + "column": 4 + }, + "end": { + "line": 564, + "column": 30 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 20603, + 20617 + ], + "loc": { + "start": { + "line": 564, + "column": 33 + }, + "end": { + "line": 564, + "column": 47 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 20618, + 20629 + ], + "loc": { + "start": { + "line": 564, + "column": 48 + }, + "end": { + "line": 564, + "column": 59 + } + } + }, + "range": [ + 20603, + 20629 + ], + "loc": { + "start": { + "line": 564, + "column": 33 + }, + "end": { + "line": 564, + "column": 59 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 20630, + 20636 + ], + "loc": { + "start": { + "line": 564, + "column": 60 + }, + "end": { + "line": 564, + "column": 66 + } + } + }, + "range": [ + 20603, + 20636 + ], + "loc": { + "start": { + "line": 564, + "column": 33 + }, + "end": { + "line": 564, + "column": 66 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 20637, + 20638 + ], + "loc": { + "start": { + "line": 564, + "column": 67 + }, + "end": { + "line": 564, + "column": 68 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 20659, + 20660 + ], + "loc": { + "start": { + "line": 565, + "column": 15 + }, + "end": { + "line": 565, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20661, + 20665 + ], + "loc": { + "start": { + "line": 565, + "column": 17 + }, + "end": { + "line": 565, + "column": 21 + } + } + }, + "range": [ + 20659, + 20665 + ], + "loc": { + "start": { + "line": 565, + "column": 15 + }, + "end": { + "line": 565, + "column": 21 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 20670, + 20684 + ], + "loc": { + "start": { + "line": 565, + "column": 26 + }, + "end": { + "line": 565, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20685, + 20689 + ], + "loc": { + "start": { + "line": 565, + "column": 41 + }, + "end": { + "line": 565, + "column": 45 + } + } + }, + "range": [ + 20670, + 20689 + ], + "loc": { + "start": { + "line": 565, + "column": 26 + }, + "end": { + "line": 565, + "column": 45 + } + } + }, + "range": [ + 20659, + 20689 + ], + "loc": { + "start": { + "line": 565, + "column": 15 + }, + "end": { + "line": 565, + "column": 45 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 20693, + 20694 + ], + "loc": { + "start": { + "line": 565, + "column": 49 + }, + "end": { + "line": 565, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20695, + 20697 + ], + "loc": { + "start": { + "line": 565, + "column": 51 + }, + "end": { + "line": 565, + "column": 53 + } + } + }, + "range": [ + 20693, + 20697 + ], + "loc": { + "start": { + "line": 565, + "column": 49 + }, + "end": { + "line": 565, + "column": 53 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 20702, + 20716 + ], + "loc": { + "start": { + "line": 565, + "column": 58 + }, + "end": { + "line": 565, + "column": 72 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20717, + 20719 + ], + "loc": { + "start": { + "line": 565, + "column": 73 + }, + "end": { + "line": 565, + "column": 75 + } + } + }, + "range": [ + 20702, + 20719 + ], + "loc": { + "start": { + "line": 565, + "column": 58 + }, + "end": { + "line": 565, + "column": 75 + } + } + }, + "range": [ + 20693, + 20719 + ], + "loc": { + "start": { + "line": 565, + "column": 49 + }, + "end": { + "line": 565, + "column": 75 + } + } + }, + "range": [ + 20659, + 20719 + ], + "loc": { + "start": { + "line": 565, + "column": 15 + }, + "end": { + "line": 565, + "column": 75 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 20723, + 20724 + ], + "loc": { + "start": { + "line": 565, + "column": 79 + }, + "end": { + "line": 565, + "column": 80 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 20725, + 20734 + ], + "loc": { + "start": { + "line": 565, + "column": 81 + }, + "end": { + "line": 565, + "column": 90 + } + } + }, + "range": [ + 20723, + 20734 + ], + "loc": { + "start": { + "line": 565, + "column": 79 + }, + "end": { + "line": 565, + "column": 90 + } + } + }, + "right": { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 20739, + 20754 + ], + "loc": { + "start": { + "line": 565, + "column": 95 + }, + "end": { + "line": 565, + "column": 110 + } + } + }, + "range": [ + 20723, + 20754 + ], + "loc": { + "start": { + "line": 565, + "column": 79 + }, + "end": { + "line": 565, + "column": 110 + } + } + }, + "range": [ + 20659, + 20754 + ], + "loc": { + "start": { + "line": 565, + "column": 15 + }, + "end": { + "line": 565, + "column": 110 + } + } + }, + "prefix": true, + "range": [ + 20657, + 20755 + ], + "loc": { + "start": { + "line": 565, + "column": 13 + }, + "end": { + "line": 565, + "column": 111 + } + } + }, + "range": [ + 20650, + 20756 + ], + "loc": { + "start": { + "line": 565, + "column": 6 + }, + "end": { + "line": 565, + "column": 112 + } + } + } + ], + "range": [ + 20642, + 20762 + ], + "loc": { + "start": { + "line": 564, + "column": 72 + }, + "end": { + "line": 566, + "column": 5 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 20637, + 20762 + ], + "loc": { + "start": { + "line": 564, + "column": 67 + }, + "end": { + "line": 566, + "column": 5 + } + } + } + ], + "range": [ + 20603, + 20763 + ], + "loc": { + "start": { + "line": 564, + "column": 33 + }, + "end": { + "line": 566, + "column": 6 + } + } + }, + "range": [ + 20574, + 20763 + ], + "loc": { + "start": { + "line": 564, + "column": 4 + }, + "end": { + "line": 566, + "column": 6 + } + } + }, + "range": [ + 20574, + 20764 + ], + "loc": { + "start": { + "line": 564, + "column": 4 + }, + "end": { + "line": 566, + "column": 7 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "Identifier", + "name": "targetField", + "range": [ + 20773, + 20784 + ], + "loc": { + "start": { + "line": 567, + "column": 8 + }, + "end": { + "line": 567, + "column": 19 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetField", + "range": [ + 20798, + 20809 + ], + "loc": { + "start": { + "line": 568, + "column": 10 + }, + "end": { + "line": 568, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20810, + 20814 + ], + "loc": { + "start": { + "line": 568, + "column": 22 + }, + "end": { + "line": 568, + "column": 26 + } + } + }, + "range": [ + 20798, + 20814 + ], + "loc": { + "start": { + "line": 568, + "column": 10 + }, + "end": { + "line": 568, + "column": 26 + } + } + }, + "right": { + "type": "Literal", + "value": "has-one", + "raw": "\"has-one\"", + "range": [ + 20819, + 20828 + ], + "loc": { + "start": { + "line": 568, + "column": 31 + }, + "end": { + "line": 568, + "column": 40 + } + } + }, + "range": [ + 20798, + 20828 + ], + "loc": { + "start": { + "line": 568, + "column": 10 + }, + "end": { + "line": 568, + "column": 40 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 20840, + 20854 + ], + "loc": { + "start": { + "line": 569, + "column": 8 + }, + "end": { + "line": 569, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 20855, + 20866 + ], + "loc": { + "start": { + "line": 569, + "column": 23 + }, + "end": { + "line": 569, + "column": 34 + } + } + }, + "range": [ + 20840, + 20866 + ], + "loc": { + "start": { + "line": 569, + "column": 8 + }, + "end": { + "line": 569, + "column": 34 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 20869, + 20883 + ], + "loc": { + "start": { + "line": 569, + "column": 37 + }, + "end": { + "line": 569, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 20884, + 20895 + ], + "loc": { + "start": { + "line": 569, + "column": 52 + }, + "end": { + "line": 569, + "column": 63 + } + } + }, + "range": [ + 20869, + 20895 + ], + "loc": { + "start": { + "line": 569, + "column": 37 + }, + "end": { + "line": 569, + "column": 63 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 20896, + 20902 + ], + "loc": { + "start": { + "line": 569, + "column": 64 + }, + "end": { + "line": 569, + "column": 70 + } + } + }, + "range": [ + 20869, + 20902 + ], + "loc": { + "start": { + "line": 569, + "column": 37 + }, + "end": { + "line": 569, + "column": 70 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 20903, + 20904 + ], + "loc": { + "start": { + "line": 569, + "column": 71 + }, + "end": { + "line": 569, + "column": 72 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 20929, + 20930 + ], + "loc": { + "start": { + "line": 570, + "column": 19 + }, + "end": { + "line": 570, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20931, + 20935 + ], + "loc": { + "start": { + "line": 570, + "column": 21 + }, + "end": { + "line": 570, + "column": 25 + } + } + }, + "range": [ + 20929, + 20935 + ], + "loc": { + "start": { + "line": 570, + "column": 19 + }, + "end": { + "line": 570, + "column": 25 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 20940, + 20954 + ], + "loc": { + "start": { + "line": 570, + "column": 30 + }, + "end": { + "line": 570, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 20955, + 20959 + ], + "loc": { + "start": { + "line": 570, + "column": 45 + }, + "end": { + "line": 570, + "column": 49 + } + } + }, + "range": [ + 20940, + 20959 + ], + "loc": { + "start": { + "line": 570, + "column": 30 + }, + "end": { + "line": 570, + "column": 49 + } + } + }, + "range": [ + 20929, + 20959 + ], + "loc": { + "start": { + "line": 570, + "column": 19 + }, + "end": { + "line": 570, + "column": 49 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 20963, + 20964 + ], + "loc": { + "start": { + "line": 570, + "column": 53 + }, + "end": { + "line": 570, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20965, + 20967 + ], + "loc": { + "start": { + "line": 570, + "column": 55 + }, + "end": { + "line": 570, + "column": 57 + } + } + }, + "range": [ + 20963, + 20967 + ], + "loc": { + "start": { + "line": 570, + "column": 53 + }, + "end": { + "line": 570, + "column": 57 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 20972, + 20986 + ], + "loc": { + "start": { + "line": 570, + "column": 62 + }, + "end": { + "line": 570, + "column": 76 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 20987, + 20989 + ], + "loc": { + "start": { + "line": 570, + "column": 77 + }, + "end": { + "line": 570, + "column": 79 + } + } + }, + "range": [ + 20972, + 20989 + ], + "loc": { + "start": { + "line": 570, + "column": 62 + }, + "end": { + "line": 570, + "column": 79 + } + } + }, + "range": [ + 20963, + 20989 + ], + "loc": { + "start": { + "line": 570, + "column": 53 + }, + "end": { + "line": 570, + "column": 79 + } + } + }, + "range": [ + 20929, + 20989 + ], + "loc": { + "start": { + "line": 570, + "column": 19 + }, + "end": { + "line": 570, + "column": 79 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 20993, + 20994 + ], + "loc": { + "start": { + "line": 570, + "column": 83 + }, + "end": { + "line": 570, + "column": 84 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 20995, + 21004 + ], + "loc": { + "start": { + "line": 570, + "column": 85 + }, + "end": { + "line": 570, + "column": 94 + } + } + }, + "range": [ + 20993, + 21004 + ], + "loc": { + "start": { + "line": 570, + "column": 83 + }, + "end": { + "line": 570, + "column": 94 + } + } + }, + "right": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 21009, + 21024 + ], + "loc": { + "start": { + "line": 570, + "column": 99 + }, + "end": { + "line": 570, + "column": 114 + } + } + }, + "range": [ + 20993, + 21024 + ], + "loc": { + "start": { + "line": 570, + "column": 83 + }, + "end": { + "line": 570, + "column": 114 + } + } + }, + "range": [ + 20929, + 21024 + ], + "loc": { + "start": { + "line": 570, + "column": 19 + }, + "end": { + "line": 570, + "column": 114 + } + } + }, + "prefix": true, + "range": [ + 20927, + 21025 + ], + "loc": { + "start": { + "line": 570, + "column": 17 + }, + "end": { + "line": 570, + "column": 115 + } + } + }, + "range": [ + 20920, + 21026 + ], + "loc": { + "start": { + "line": 570, + "column": 10 + }, + "end": { + "line": 570, + "column": 116 + } + } + } + ], + "range": [ + 20908, + 21036 + ], + "loc": { + "start": { + "line": 569, + "column": 76 + }, + "end": { + "line": 571, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 20903, + 21036 + ], + "loc": { + "start": { + "line": 569, + "column": 71 + }, + "end": { + "line": 571, + "column": 9 + } + } + } + ], + "range": [ + 20869, + 21037 + ], + "loc": { + "start": { + "line": 569, + "column": 37 + }, + "end": { + "line": 571, + "column": 10 + } + } + }, + "range": [ + 20840, + 21037 + ], + "loc": { + "start": { + "line": 569, + "column": 8 + }, + "end": { + "line": 571, + "column": 10 + } + } + }, + "range": [ + 20840, + 21038 + ], + "loc": { + "start": { + "line": 569, + "column": 8 + }, + "end": { + "line": 571, + "column": 11 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 21047, + 21061 + ], + "loc": { + "start": { + "line": 572, + "column": 8 + }, + "end": { + "line": 572, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 21062, + 21077 + ], + "loc": { + "start": { + "line": 572, + "column": 23 + }, + "end": { + "line": 572, + "column": 38 + } + } + }, + "range": [ + 21047, + 21078 + ], + "loc": { + "start": { + "line": 572, + "column": 8 + }, + "end": { + "line": 572, + "column": 39 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 21081, + 21085 + ], + "loc": { + "start": { + "line": 572, + "column": 42 + }, + "end": { + "line": 572, + "column": 46 + } + } + }, + "range": [ + 21047, + 21085 + ], + "loc": { + "start": { + "line": 572, + "column": 8 + }, + "end": { + "line": 572, + "column": 46 + } + } + }, + "range": [ + 21047, + 21086 + ], + "loc": { + "start": { + "line": 572, + "column": 8 + }, + "end": { + "line": 572, + "column": 47 + } + } + } + ], + "range": [ + 20830, + 21094 + ], + "loc": { + "start": { + "line": 568, + "column": 42 + }, + "end": { + "line": 573, + "column": 7 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetField", + "range": [ + 21104, + 21115 + ], + "loc": { + "start": { + "line": 573, + "column": 17 + }, + "end": { + "line": 573, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 21116, + 21120 + ], + "loc": { + "start": { + "line": 573, + "column": 29 + }, + "end": { + "line": 573, + "column": 33 + } + } + }, + "range": [ + 21104, + 21120 + ], + "loc": { + "start": { + "line": 573, + "column": 17 + }, + "end": { + "line": 573, + "column": 33 + } + } + }, + "right": { + "type": "Literal", + "value": "has-many", + "raw": "\"has-many\"", + "range": [ + 21125, + 21135 + ], + "loc": { + "start": { + "line": 573, + "column": 38 + }, + "end": { + "line": 573, + "column": 48 + } + } + }, + "range": [ + 21104, + 21135 + ], + "loc": { + "start": { + "line": 573, + "column": 17 + }, + "end": { + "line": 573, + "column": 48 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 21147, + 21161 + ], + "loc": { + "start": { + "line": 574, + "column": 8 + }, + "end": { + "line": 574, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 21162, + 21173 + ], + "loc": { + "start": { + "line": 574, + "column": 23 + }, + "end": { + "line": 574, + "column": 34 + } + } + }, + "range": [ + 21147, + 21173 + ], + "loc": { + "start": { + "line": 574, + "column": 8 + }, + "end": { + "line": 574, + "column": 34 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 21176, + 21190 + ], + "loc": { + "start": { + "line": 574, + "column": 37 + }, + "end": { + "line": 574, + "column": 51 + } + } + }, + "property": { + "type": "Identifier", + "name": "_dependents", + "range": [ + 21191, + 21202 + ], + "loc": { + "start": { + "line": 574, + "column": 52 + }, + "end": { + "line": 574, + "column": 63 + } + } + }, + "range": [ + 21176, + 21202 + ], + "loc": { + "start": { + "line": 574, + "column": 37 + }, + "end": { + "line": 574, + "column": 63 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 21203, + 21209 + ], + "loc": { + "start": { + "line": 574, + "column": 64 + }, + "end": { + "line": 574, + "column": 70 + } + } + }, + "range": [ + 21176, + 21209 + ], + "loc": { + "start": { + "line": 574, + "column": 37 + }, + "end": { + "line": 574, + "column": 70 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 21210, + 21211 + ], + "loc": { + "start": { + "line": 574, + "column": 71 + }, + "end": { + "line": 574, + "column": 72 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 21236, + 21237 + ], + "loc": { + "start": { + "line": 575, + "column": 19 + }, + "end": { + "line": 575, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 21238, + 21242 + ], + "loc": { + "start": { + "line": 575, + "column": 21 + }, + "end": { + "line": 575, + "column": 25 + } + } + }, + "range": [ + 21236, + 21242 + ], + "loc": { + "start": { + "line": 575, + "column": 19 + }, + "end": { + "line": 575, + "column": 25 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 21247, + 21261 + ], + "loc": { + "start": { + "line": 575, + "column": 30 + }, + "end": { + "line": 575, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 21262, + 21266 + ], + "loc": { + "start": { + "line": 575, + "column": 45 + }, + "end": { + "line": 575, + "column": 49 + } + } + }, + "range": [ + 21247, + 21266 + ], + "loc": { + "start": { + "line": 575, + "column": 30 + }, + "end": { + "line": 575, + "column": 49 + } + } + }, + "range": [ + 21236, + 21266 + ], + "loc": { + "start": { + "line": 575, + "column": 19 + }, + "end": { + "line": 575, + "column": 49 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 21270, + 21271 + ], + "loc": { + "start": { + "line": 575, + "column": 53 + }, + "end": { + "line": 575, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 21272, + 21274 + ], + "loc": { + "start": { + "line": 575, + "column": 55 + }, + "end": { + "line": 575, + "column": 57 + } + } + }, + "range": [ + 21270, + 21274 + ], + "loc": { + "start": { + "line": 575, + "column": 53 + }, + "end": { + "line": 575, + "column": 57 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 21279, + 21293 + ], + "loc": { + "start": { + "line": 575, + "column": 62 + }, + "end": { + "line": 575, + "column": 76 + } + } + }, + "property": { + "type": "Identifier", + "name": "id", + "range": [ + 21294, + 21296 + ], + "loc": { + "start": { + "line": 575, + "column": 77 + }, + "end": { + "line": 575, + "column": 79 + } + } + }, + "range": [ + 21279, + 21296 + ], + "loc": { + "start": { + "line": 575, + "column": 62 + }, + "end": { + "line": 575, + "column": 79 + } + } + }, + "range": [ + 21270, + 21296 + ], + "loc": { + "start": { + "line": 575, + "column": 53 + }, + "end": { + "line": 575, + "column": 79 + } + } + }, + "range": [ + 21236, + 21296 + ], + "loc": { + "start": { + "line": 575, + "column": 19 + }, + "end": { + "line": 575, + "column": 79 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "r", + "range": [ + 21300, + 21301 + ], + "loc": { + "start": { + "line": 575, + "column": 83 + }, + "end": { + "line": 575, + "column": 84 + } + } + }, + "property": { + "type": "Identifier", + "name": "fieldName", + "range": [ + 21302, + 21311 + ], + "loc": { + "start": { + "line": 575, + "column": 85 + }, + "end": { + "line": 575, + "column": 94 + } + } + }, + "range": [ + 21300, + 21311 + ], + "loc": { + "start": { + "line": 575, + "column": 83 + }, + "end": { + "line": 575, + "column": 94 + } + } + }, + "right": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 21316, + 21331 + ], + "loc": { + "start": { + "line": 575, + "column": 99 + }, + "end": { + "line": 575, + "column": 114 + } + } + }, + "range": [ + 21300, + 21331 + ], + "loc": { + "start": { + "line": 575, + "column": 83 + }, + "end": { + "line": 575, + "column": 114 + } + } + }, + "range": [ + 21236, + 21331 + ], + "loc": { + "start": { + "line": 575, + "column": 19 + }, + "end": { + "line": 575, + "column": 114 + } + } + }, + "prefix": true, + "range": [ + 21234, + 21332 + ], + "loc": { + "start": { + "line": 575, + "column": 17 + }, + "end": { + "line": 575, + "column": 115 + } + } + }, + "range": [ + 21227, + 21333 + ], + "loc": { + "start": { + "line": 575, + "column": 10 + }, + "end": { + "line": 575, + "column": 116 + } + } + } + ], + "range": [ + 21215, + 21343 + ], + "loc": { + "start": { + "line": 574, + "column": 76 + }, + "end": { + "line": 576, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 21210, + 21343 + ], + "loc": { + "start": { + "line": 574, + "column": 71 + }, + "end": { + "line": 576, + "column": 9 + } + } + } + ], + "range": [ + 21176, + 21344 + ], + "loc": { + "start": { + "line": 574, + "column": 37 + }, + "end": { + "line": 576, + "column": 10 + } + } + }, + "range": [ + 21147, + 21344 + ], + "loc": { + "start": { + "line": 574, + "column": 8 + }, + "end": { + "line": 576, + "column": 10 + } + } + }, + "range": [ + 21147, + 21345 + ], + "loc": { + "start": { + "line": 574, + "column": 8 + }, + "end": { + "line": 576, + "column": 11 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 21354, + 21368 + ], + "loc": { + "start": { + "line": 577, + "column": 8 + }, + "end": { + "line": 577, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 21369, + 21384 + ], + "loc": { + "start": { + "line": 577, + "column": 23 + }, + "end": { + "line": 577, + "column": 38 + } + } + }, + "range": [ + 21354, + 21385 + ], + "loc": { + "start": { + "line": 577, + "column": 8 + }, + "end": { + "line": 577, + "column": 39 + } + } + }, + "right": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": true, + "object": { + "type": "Identifier", + "name": "targetResource", + "range": [ + 21388, + 21402 + ], + "loc": { + "start": { + "line": 577, + "column": 42 + }, + "end": { + "line": 577, + "column": 56 + } + } + }, + "property": { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 21403, + 21418 + ], + "loc": { + "start": { + "line": 577, + "column": 57 + }, + "end": { + "line": 577, + "column": 72 + } + } + }, + "range": [ + 21388, + 21419 + ], + "loc": { + "start": { + "line": 577, + "column": 42 + }, + "end": { + "line": 577, + "column": 73 + } + } + }, + "property": { + "type": "Identifier", + "name": "filter", + "range": [ + 21420, + 21426 + ], + "loc": { + "start": { + "line": 577, + "column": 74 + }, + "end": { + "line": 577, + "column": 80 + } + } + }, + "range": [ + 21388, + 21426 + ], + "loc": { + "start": { + "line": 577, + "column": 42 + }, + "end": { + "line": 577, + "column": 80 + } + } + }, + "arguments": [ + { + "type": "ArrowFunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "r", + "range": [ + 21427, + 21428 + ], + "loc": { + "start": { + "line": 577, + "column": 81 + }, + "end": { + "line": 577, + "column": 82 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "Identifier", + "name": "r", + "range": [ + 21451, + 21452 + ], + "loc": { + "start": { + "line": 578, + "column": 17 + }, + "end": { + "line": 578, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "sourceResource", + "range": [ + 21457, + 21471 + ], + "loc": { + "start": { + "line": 578, + "column": 23 + }, + "end": { + "line": 578, + "column": 37 + } + } + }, + "range": [ + 21451, + 21471 + ], + "loc": { + "start": { + "line": 578, + "column": 17 + }, + "end": { + "line": 578, + "column": 37 + } + } + }, + "range": [ + 21444, + 21472 + ], + "loc": { + "start": { + "line": 578, + "column": 10 + }, + "end": { + "line": 578, + "column": 38 + } + } + } + ], + "range": [ + 21432, + 21482 + ], + "loc": { + "start": { + "line": 577, + "column": 86 + }, + "end": { + "line": 579, + "column": 9 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 21427, + 21482 + ], + "loc": { + "start": { + "line": 577, + "column": 81 + }, + "end": { + "line": 579, + "column": 9 + } + } + } + ], + "range": [ + 21388, + 21483 + ], + "loc": { + "start": { + "line": 577, + "column": 42 + }, + "end": { + "line": 579, + "column": 10 + } + } + }, + "range": [ + 21354, + 21483 + ], + "loc": { + "start": { + "line": 577, + "column": 8 + }, + "end": { + "line": 579, + "column": 10 + } + } + }, + "range": [ + 21354, + 21484 + ], + "loc": { + "start": { + "line": 577, + "column": 8 + }, + "end": { + "line": 579, + "column": 11 + } + } + } + ], + "range": [ + 21137, + 21492 + ], + "loc": { + "start": { + "line": 573, + "column": 50 + }, + "end": { + "line": 580, + "column": 7 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "targetField", + "range": [ + 21502, + 21513 + ], + "loc": { + "start": { + "line": 580, + "column": 17 + }, + "end": { + "line": 580, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "type", + "range": [ + 21514, + 21518 + ], + "loc": { + "start": { + "line": 580, + "column": 29 + }, + "end": { + "line": 580, + "column": 33 + } + } + }, + "range": [ + 21502, + 21518 + ], + "loc": { + "start": { + "line": 580, + "column": 17 + }, + "end": { + "line": 580, + "column": 33 + } + } + }, + "right": { + "type": "Literal", + "value": "attr", + "raw": "\"attr\"", + "range": [ + 21523, + 21529 + ], + "loc": { + "start": { + "line": 580, + "column": 38 + }, + "end": { + "line": 580, + "column": 44 + } + } + }, + "range": [ + 21502, + 21529 + ], + "loc": { + "start": { + "line": 580, + "column": 17 + }, + "end": { + "line": 580, + "column": 44 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 21551, + 21556 + ], + "loc": { + "start": { + "line": 581, + "column": 18 + }, + "end": { + "line": 581, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "The the inverse relationship for '", + "cooked": "The the inverse relationship for '" + }, + "tail": false, + "range": [ + 21557, + 21594 + ], + "loc": { + "start": { + "line": 581, + "column": 24 + }, + "end": { + "line": 581, + "column": 61 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "' is an attribute ('", + "cooked": "' is an attribute ('" + }, + "tail": false, + "range": [ + 21609, + 21632 + ], + "loc": { + "start": { + "line": 581, + "column": 76 + }, + "end": { + "line": 581, + "column": 99 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "')", + "cooked": "')" + }, + "tail": true, + "range": [ + 21647, + 21651 + ], + "loc": { + "start": { + "line": 581, + "column": 114 + }, + "end": { + "line": 581, + "column": 118 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 21594, + 21609 + ], + "loc": { + "start": { + "line": 581, + "column": 61 + }, + "end": { + "line": 581, + "column": 76 + } + } + }, + { + "type": "Identifier", + "name": "targetFieldName", + "range": [ + 21632, + 21647 + ], + "loc": { + "start": { + "line": 581, + "column": 99 + }, + "end": { + "line": 581, + "column": 114 + } + } + } + ], + "range": [ + 21557, + 21651 + ], + "loc": { + "start": { + "line": 581, + "column": 24 + }, + "end": { + "line": 581, + "column": 118 + } + } + } + ], + "range": [ + 21547, + 21652 + ], + "loc": { + "start": { + "line": 581, + "column": 14 + }, + "end": { + "line": 581, + "column": 119 + } + } + }, + "range": [ + 21541, + 21653 + ], + "loc": { + "start": { + "line": 581, + "column": 8 + }, + "end": { + "line": 581, + "column": 120 + } + } + } + ], + "range": [ + 21531, + 21661 + ], + "loc": { + "start": { + "line": 580, + "column": 46 + }, + "end": { + "line": 582, + "column": 7 + } + } + }, + "alternate": null, + "range": [ + 21498, + 21661 + ], + "loc": { + "start": { + "line": 580, + "column": 13 + }, + "end": { + "line": 582, + "column": 7 + } + } + }, + "range": [ + 21100, + 21661 + ], + "loc": { + "start": { + "line": 573, + "column": 13 + }, + "end": { + "line": 582, + "column": 7 + } + } + }, + "range": [ + 20794, + 21661 + ], + "loc": { + "start": { + "line": 568, + "column": 6 + }, + "end": { + "line": 582, + "column": 7 + } + } + } + ], + "range": [ + 20786, + 21667 + ], + "loc": { + "start": { + "line": 567, + "column": 21 + }, + "end": { + "line": 583, + "column": 5 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceField", + "range": [ + 21677, + 21688 + ], + "loc": { + "start": { + "line": 583, + "column": 15 + }, + "end": { + "line": 583, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 21689, + 21696 + ], + "loc": { + "start": { + "line": 583, + "column": 27 + }, + "end": { + "line": 583, + "column": 34 + } + } + }, + "range": [ + 21677, + 21696 + ], + "loc": { + "start": { + "line": 583, + "column": 15 + }, + "end": { + "line": 583, + "column": 34 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ThrowStatement", + "argument": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Error", + "range": [ + 21716, + 21721 + ], + "loc": { + "start": { + "line": 584, + "column": 16 + }, + "end": { + "line": 584, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "The the inverse relationship for '", + "cooked": "The the inverse relationship for '" + }, + "tail": false, + "range": [ + 21722, + 21759 + ], + "loc": { + "start": { + "line": 584, + "column": 22 + }, + "end": { + "line": 584, + "column": 59 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "' is missing ('", + "cooked": "' is missing ('" + }, + "tail": false, + "range": [ + 21774, + 21792 + ], + "loc": { + "start": { + "line": 584, + "column": 74 + }, + "end": { + "line": 584, + "column": 92 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": "')", + "cooked": "')" + }, + "tail": true, + "range": [ + 21811, + 21815 + ], + "loc": { + "start": { + "line": 584, + "column": 111 + }, + "end": { + "line": 584, + "column": 115 + } + } + } + ], + "expressions": [ + { + "type": "Identifier", + "name": "sourceFieldName", + "range": [ + 21759, + 21774 + ], + "loc": { + "start": { + "line": 584, + "column": 59 + }, + "end": { + "line": 584, + "column": 74 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "sourceField", + "range": [ + 21792, + 21803 + ], + "loc": { + "start": { + "line": 584, + "column": 92 + }, + "end": { + "line": 584, + "column": 103 + } + } + }, + "property": { + "type": "Identifier", + "name": "inverse", + "range": [ + 21804, + 21811 + ], + "loc": { + "start": { + "line": 584, + "column": 104 + }, + "end": { + "line": 584, + "column": 111 + } + } + }, + "range": [ + 21792, + 21811 + ], + "loc": { + "start": { + "line": 584, + "column": 92 + }, + "end": { + "line": 584, + "column": 111 + } + } + } + ], + "range": [ + 21722, + 21815 + ], + "loc": { + "start": { + "line": 584, + "column": 22 + }, + "end": { + "line": 584, + "column": 115 + } + } + } + ], + "range": [ + 21712, + 21816 + ], + "loc": { + "start": { + "line": 584, + "column": 12 + }, + "end": { + "line": 584, + "column": 116 + } + } + }, + "range": [ + 21706, + 21817 + ], + "loc": { + "start": { + "line": 584, + "column": 6 + }, + "end": { + "line": 584, + "column": 117 + } + } + } + ], + "range": [ + 21698, + 21823 + ], + "loc": { + "start": { + "line": 583, + "column": 36 + }, + "end": { + "line": 585, + "column": 5 + } + } + }, + "alternate": null, + "range": [ + 21673, + 21823 + ], + "loc": { + "start": { + "line": 583, + "column": 11 + }, + "end": { + "line": 585, + "column": 5 + } + } + }, + "range": [ + 20769, + 21823 + ], + "loc": { + "start": { + "line": 567, + "column": 4 + }, + "end": { + "line": 585, + "column": 5 + } + } + } + ], + "range": [ + 20360, + 21827 + ], + "loc": { + "start": { + "line": 560, + "column": 91 + }, + "end": { + "line": 586, + "column": 3 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 20297, + 21827 + ], + "loc": { + "start": { + "line": 560, + "column": 28 + }, + "end": { + "line": 586, + "column": 3 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 20271, + 21827 + ], + "loc": { + "start": { + "line": 560, + "column": 2 + }, + "end": { + "line": 586, + "column": 3 + } + }, + "static": false + } + ], + "range": [ + 101, + 21830 + ], + "loc": { + "start": { + "line": 4, + "column": 27 + }, + "end": { + "line": 588, + "column": 1 + } + } + }, + "range": [ + 89, + 21830 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 588, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "range": [ + 74, + 21830 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 588, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Store", + "range": [ + 21832, + 21837 + ], + "loc": { + "start": { + "line": 590, + "column": 0 + }, + "end": { + "line": 590, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "AjaxAdapter", + "range": [ + 21838, + 21849 + ], + "loc": { + "start": { + "line": 590, + "column": 6 + }, + "end": { + "line": 590, + "column": 17 + } + } + }, + "range": [ + 21832, + 21849 + ], + "loc": { + "start": { + "line": 590, + "column": 0 + }, + "end": { + "line": 590, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "AjaxAdapter", + "range": [ + 21852, + 21863 + ], + "loc": { + "start": { + "line": 590, + "column": 20 + }, + "end": { + "line": 590, + "column": 31 + } + } + }, + "range": [ + 21832, + 21863 + ], + "loc": { + "start": { + "line": 590, + "column": 0 + }, + "end": { + "line": 590, + "column": 31 + } + } + }, + "range": [ + 21832, + 21864 + ], + "loc": { + "start": { + "line": 590, + "column": 0 + }, + "end": { + "line": 590, + "column": 32 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 21864 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 590, + "column": 32 + } + }, + "comments": [ + { + "type": "Block", + "value": "*\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 ", + "range": [ + 106, + 428 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 ", + "range": [ + 897, + 1234 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 40, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 ", + "range": [ + 1888, + 2226 + ], + "loc": { + "start": { + "line": 62, + "column": 2 + }, + "end": { + "line": 70, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 - Resource Object to add. See:\n http://jsonapi.org/format/#document-resource-objects\n * @return {undefined} - Nothing.\n ", + "range": [ + 3188, + 3480 + ], + "loc": { + "start": { + "line": 103, + "column": 2 + }, + "end": { + "line": 111, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 ", + "range": [ + 4528, + 4974 + ], + "loc": { + "start": { + "line": 137, + "column": 2 + }, + "end": { + "line": 145, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.create(\"product\", { title: \"A Book\" }, (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 5608, + 6269 + ], + "loc": { + "start": { + "line": 170, + "column": 2 + }, + "end": { + "line": 188, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 6567, + 6794 + ], + "loc": { + "start": { + "line": 197, + "column": 2 + }, + "end": { + "line": 204, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.destroy(\"product\", \"1\", () => {\n * console.log(\"Destroyed!\");\n * });\n ", + "range": [ + 7271, + 7890 + ], + "loc": { + "start": { + "line": 221, + "column": 2 + }, + "end": { + "line": 239, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\n * Find a resource or entire collection of resources.\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(s) to find.\n * @param {string} [id] - The id of the resource to find. If omitted all\n * resources of the type will be returned.\n * @return {Object|Object[]} - Either the resource or an array of resources.\n ", + "range": [ + 8180, + 8690 + ], + "loc": { + "start": { + "line": 248, + "column": 2 + }, + "end": { + "line": 259, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\n * Attempts to load the resource(s) through the adapter and adds it/them to\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] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)\n * @param {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.load(\"product\", \"1\", (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 9627, + 10373 + ], + "loc": { + "start": { + "line": 293, + "column": 2 + }, + "end": { + "line": 312, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\n * Unregister an event listener that was registered with on().\n *\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 * @return {undefined} - Nothing.\n ", + "range": [ + 10675, + 11078 + ], + "loc": { + "start": { + "line": 321, + "column": 2 + }, + "end": { + "line": 330, + "column": 5 + } + } + }, + { + "type": "Line", + "value": " TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.", + "range": [ + 11382, + 11491 + ], + "loc": { + "start": { + "line": 337, + "column": 10 + }, + "end": { + "line": 337, + "column": 119 + } + } + }, + { + "type": "Block", + "value": "*\n * Register an event listener: \"added\", \"updated\" or \"removed\".\n *\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 * @return {undefined} - Nothing.\n ", + "range": [ + 12285, + 12725 + ], + "loc": { + "start": { + "line": 360, + "column": 2 + }, + "end": { + "line": 370, + "column": 5 + } + } + }, + { + "type": "Line", + "value": " TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.", + "range": [ + 13036, + 13145 + ], + "loc": { + "start": { + "line": 377, + "column": 10 + }, + "end": { + "line": 377, + "column": 119 + } + } + }, + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 14118, + 14452 + ], + "loc": { + "start": { + "line": 401, + "column": 2 + }, + "end": { + "line": 409, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 * @return {undefined} - Nothing.\n ", + "range": [ + 14685, + 15027 + ], + "loc": { + "start": { + "line": 421, + "column": 2 + }, + "end": { + "line": 429, + "column": 5 + } + } + }, + { + "type": "Block", + "value": "*\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.update(\"product\", \"1\", { title: \"foo\" }, (product) => {\n * console.log(product.title);\n * });\n ", + "range": [ + 15925, + 16634 + ], + "loc": { + "start": { + "line": 455, + "column": 2 + }, + "end": { + "line": 474, + "column": 5 + } + } + }, + { + "type": "Line", + "value": " TODO: This only needs to be run once for each dependent.", + "range": [ + 19985, + 20044 + ], + "loc": { + "start": { + "line": 552, + "column": 6 + }, + "end": { + "line": 552, + "column": 65 + } + } + } + ] +} \ No newline at end of file diff --git a/docs/v0.5.1/badge.svg b/docs/v0.5.1/badge.svg new file mode 100644 index 0000000..569d82f --- /dev/null +++ b/docs/v0.5.1/badge.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + document + document + 65% + 65% + + diff --git a/docs/v0.5.1/class/src/ajax-adapter.js~AjaxAdapter.html b/docs/v0.5.1/class/src/ajax-adapter.js~AjaxAdapter.html new file mode 100644 index 0000000..a72de2d --- /dev/null +++ b/docs/v0.5.1/class/src/ajax-adapter.js~AjaxAdapter.html @@ -0,0 +1,668 @@ + + + + + + AjaxAdapter | API Document + + + + + + + + +
+ Home + Identifier + Source + + Repository + +
+ + + +
+
import AjaxAdapter from 'json-api-store/src/ajax-adapter.js'
+ public + class + + + + | source +
+ +
+

AjaxAdapter

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Constructor Summary

+ + + + + + + + + +
Public Constructor
+ public + + + + + +
+

+ constructor(options: *) +

+
+
+ + + +
+
+ + +
+
+ +

Method Summary

+ + + + + + + + + + + + + + + + + + + + + + + + +
Public Methods
+ public + + + + + +
+

+ create(store: *, type: *, partial: *, success: *, error: *, context: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ destroy(store: *, type: *, id: *, success: *, error: *, context: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ load(store: *, type: *, id: *, options: *, success: *, error: *, context: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ update(store: *, type: *, id: *, partial: *, success: *, error: *, context: *) +

+
+
+ + + +
+
+ + +
+
+ + + + + +

Public Constructors

+ +
+

+ public + + + + + constructor(options: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
options*
+
+
+ + + + + + + + + + + + + + + +
+
+ +

Public Methods

+ +
+

+ public + + + + + create(store: *, type: *, partial: *, success: *, error: *, context: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
store*
type*
partial*
success*
error*
context*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + destroy(store: *, type: *, id: *, success: *, error: *, context: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
store*
type*
id*
success*
error*
context*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + load(store: *, type: *, id: *, options: *, success: *, error: *, context: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
store*
type*
id*
options*
success*
error*
context*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + update(store: *, type: *, id: *, partial: *, success: *, error: *, context: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
store*
type*
id*
partial*
success*
error*
context*
+
+
+ + + + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + diff --git a/docs/v0.5.1/class/src/store.js~Store.html b/docs/v0.5.1/class/src/store.js~Store.html new file mode 100644 index 0000000..20fc4cd --- /dev/null +++ b/docs/v0.5.1/class/src/store.js~Store.html @@ -0,0 +1,1945 @@ + + + + + + Store | API Document + + + + + + + + +
+ Home + Identifier + Source + + Repository + +
+ + + +
+
import Store from 'json-api-store/src/store.js'
+ public + class + + + + | source +
+ +
+

Store

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + +

Static Method Summary

+ + + + + + + + + + + + + + + + + + + +
Static Public Methods
+ public + static + + + + +
+

+ attr(name: string, options: Object): Object +

+
+
+ + +

Creates a field definition for an attribute.

+
+
+ + since 0.1.0 +
+ public + static + + + + +
+

+ hasMany(name: string, options: Object): Object +

+
+
+ + +

Creates a field definition for an has-many relationship.

+
+
+ + since 0.1.0 +
+ public + static + + + + +
+

+ hasOne(name: string, options: Object): Object +

+
+
+ + +

Creates a field definition for an has-one relationship.

+
+
+ + since 0.1.0 +
+
+

Constructor Summary

+ + + + + + + + + +
Public Constructor
+ public + + + + + +
+

+ constructor(adapter: *) +

+
+
+ + + +
+
+ + +
+
+ +

Method Summary

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Public Methods
+ public + + + + + +
+

+ add(object: Object): undefined +

+
+
+ + +

Add an individual resource to the store.

+
+
+ + since 0.1.0 +
+ public + + + + + +
+

+ convert(type: string, id: string, partial: object): object +

+
+
+ + +

Converts the given partial into a JSON API compliant representation.

+
+
+ + since 0.5.0 +
+ public + + + + + +
+

+ create(type: string, partial: Object, success: function, error: function, context: Object): undefined +

+
+
+ + +

Attempts to create the resource through the adapter and adds it to the +

+
+
+ + since 0.5.0 +
+ public + + + + + +
+

+ define(names: string | string[], definition: Object): undefined +

+
+
+ + +

Defines a type of resource.

+
+
+ + since 0.2.0 +
+ public + + + + + +
+

+ destroy(type: string, id: string, success: function, error: function, context: Object): undefined +

+
+
+ + +

Attempts to delete the resource through the adapter and removes it from +

+
+
+ + since 0.5.0 +
+ public + + + + + +
+

+ find(type: string, id: string): Object | Object[] +

+
+
+ + +

Find a resource or entire collection of resources.

+
+
+ + since 0.1.0 +
+ public + + + + + +
+

+ load(type: string, id: string, options: Object, success: function, error: function, context: Object): undefined +

+
+
+ + +

Attempts to load the resource(s) through the adapter and adds it/them to +

+
+
+ + since 0.5.0 +
+ public + + + + + +
+

+ off(event: string, type: string, id: string, callback: function): undefined +

+
+
+ + +

Unregister an event listener that was registered with on().

+
+
+ + since 0.4.0 +
+ public + + + + + +
+

+ on(event: string, type: string, id: string, callback: function, context: Object): undefined +

+
+
+ + +

Register an event listener: "added", "updated" or "removed".

+
+
+ + since 0.4.0 +
+ public + + + + + +
+

+ push(root: Object): undefined +

+
+
+ + +

Add a JSON API response to the store.

+
+
+ + since 0.1.0 +
+ public + + + + + +
+

+ remove(type: string, id: string): undefined +

+
+
+ + +

Remove a resource or collection of resources from the store.

+
+
+ + since 0.1.0 +
+ public + + + + + +
+

+ update(type: string, id: string, partial: Object, success: function, error: function, context: Object): undefined +

+
+
+ + +

Attempts to update the resource through the adapter and updates it in the +

+
+
+ + since 0.5.0 +
+
+ + + + +

Static Public Methods

+ +
+

+ public + static + + + + attr(name: string, options: Object): Object + + + since 0.1.0 + source + +

+ + + + +

Creates a field definition for an attribute.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
namestring
  • optional

Name of the property to map this field from.

+
optionsObject
  • optional

An options object.

+
options.defaultstring
  • optional

Default value for this field.

+
+
+
+ +
+

Return:

+ + + + + +
Object

Field definition.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + static + + + + hasMany(name: string, options: Object): Object + + + since 0.1.0 + source + +

+ + + + +

Creates a field definition for an has-many relationship.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
namestring
  • optional

Name of the property to map this field from.

+
optionsObject
  • optional

An options object.

+
options.inversestring
  • optional

Name of the inverse relationship.

+
+
+
+ +
+

Return:

+ + + + + +
Object

Field definition.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + static + + + + hasOne(name: string, options: Object): Object + + + since 0.1.0 + source + +

+ + + + +

Creates a field definition for an has-one relationship.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
namestring
  • optional

Name of the property to map this field from.

+
optionsObject
  • optional

An options object.

+
options.inversestring
  • optional

Name of the inverse relationship.

+
+
+
+ +
+

Return:

+ + + + + +
Object

Field definition.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

Public Constructors

+ +
+

+ public + + + + + constructor(adapter: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
adapter*
+
+
+ + + + + + + + + + + + + + + +
+
+ +

Public Methods

+ +
+

+ public + + + + + add(object: Object): undefined + + + since 0.1.0 + source + +

+ + + + +

Add an individual resource to the store. This is used internally by the +push() method.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
objectObject
  • nullable: false

Resource Object to add. See: + http://jsonapi.org/format/#document-resource-objects

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + convert(type: string, id: string, partial: object): object + + + since 0.5.0 + source + +

+ + + + +

Converts the given partial into a JSON API compliant representation.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • optional
  • +
  • nullable: false

The type of the resource. This can be omitted if the partial includes a type property.

+
idstring
  • optional
  • +
  • nullable: false

The id of the resource. This can be omitted if the partial includes an id property.

+
partialobject
  • nullable: false

The data to convert.

+
+
+
+ +
+

Return:

+ + + + + +
object

JSON API version of the object.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + create(type: string, partial: Object, success: function, error: function, context: Object): undefined + + + since 0.5.0 + source + +

+ + + + +

Attempts to create the resource through the adapter and adds it to the +store if successful.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • nullable: false

Type of resource.

+
partialObject
  • nullable: false

Data to create the resource with.

+
successfunction
  • optional

Callback on success.

+
errorfunction
  • optional

Callback on error.

+
contextObject
  • optional

Context for the callbacks.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + +
+

Example:

+ +
+ +
let adapter = new Store.AjaxAdapter();
+let store = new Store(adpater);
+store.create("product", { title: "A Book" }, (product) => {
+  console.log(product.title);
+});
+
+
+ + + + + +
+
+

+ public + + + + + define(names: string | string[], definition: Object): undefined + + + since 0.2.0 + source + +

+ + + + +

Defines a type of resource.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
namesstring | string[]
  • nullable: false

Name(s) of the resource.

+
definitionObject
  • nullable: false

The resource's definition.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + destroy(type: string, id: string, success: function, error: function, context: Object): undefined + + + since 0.5.0 + source + +

+ + + + +

Attempts to delete the resource through the adapter and removes it from +the store if successful.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • nullable: false

Type of resource.

+
idstring
  • nullable: false

ID of resource.

+
successfunction
  • optional

Callback on success.

+
errorfunction
  • optional

Callback on error.

+
contextObject
  • optional

Context for the callbacks.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + +
+

Example:

+ +
+ +
let adapter = new Store.AjaxAdapter();
+let store = new Store(adpater);
+store.destroy("product", "1", () => {
+  console.log("Destroyed!");
+});
+
+
+ + + + + +
+
+

+ public + + + + + find(type: string, id: string): Object | Object[] + + + since 0.1.0 + source + +

+ + + + +

Find a resource or entire collection of resources.

+

NOTE: If the resource hasn't been loaded via an add() or push() call it +will be automatically created when find is called.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • nullable: false

Type of the resource(s) to find.

+
idstring
  • optional

The id of the resource to find. If omitted all + resources of the type will be returned.

+
+
+
+ +
+

Return:

+ + + + + +
Object | Object[]

Either the resource or an array of resources.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + load(type: string, id: string, options: Object, success: function, error: function, context: Object): undefined + + + since 0.5.0 + source + +

+ + + + +

Attempts to load the resource(s) through the adapter and adds it/them to +the store if successful.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • nullable: false

Type of resource.

+
idstring
  • optional
  • +
  • nullable: false

ID of resource.

+
optionsObject
  • optional

NOT YET IMPLEMENTED (this will include sorting, filtering and pagination options)

+
successfunction
  • optional

Callback on success.

+
errorfunction
  • optional

Callback on error.

+
contextObject
  • optional

Context for the callbacks.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + +
+

Example:

+ +
+ +
let adapter = new Store.AjaxAdapter();
+let store = new Store(adpater);
+store.load("product", "1", (product) => {
+  console.log(product.title);
+});
+
+
+ + + + + +
+
+

+ public + + + + + off(event: string, type: string, id: string, callback: function): undefined + + + since 0.4.0 + source + +

+ + + + +

Unregister an event listener that was registered with on().

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
eventstring

Name of the event.

+
typestring

Name of resource to originally passed to on().

+
idstring
  • optional

ID of the resource to originally passed to on().

+
callbackfunction

Function originally passed to on().

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + on(event: string, type: string, id: string, callback: function, context: Object): undefined + + + since 0.4.0 + source + +

+ + + + +

Register an event listener: "added", "updated" or "removed".

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
eventstring

Name of the event.

+
typestring

Name of resource to watch.

+
idstring
  • optional

ID of the resource to watch.

+
callbackfunction

Function to call when the event occurs.

+
contextObject
  • optional

Context in which to call the callback.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + push(root: Object): undefined + + + since 0.1.0 + source + +

+ + + + +

Add a JSON API response to the store. This method can be used to handle a +successful GET or POST response from the server.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
rootObject

Top Level Object to push. See: + http://jsonapi.org/format/#document-top-level

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + remove(type: string, id: string): undefined + + + since 0.1.0 + source + +

+ + + + +

Remove a resource or collection of resources from the store.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • nullable: false

Type of the resource(s) to remove.

+
idstring
  • optional

The id of the resource to remove. If omitted all + resources of the type will be removed.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + update(type: string, id: string, partial: Object, success: function, error: function, context: Object): undefined + + + since 0.5.0 + source + +

+ + + + +

Attempts to update the resource through the adapter and updates it in the +store if successful.

+
+ + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
typestring
  • nullable: false

Type of resource.

+
idstring
  • nullable: false

ID of resource.

+
partialObject
  • nullable: false

Data to update the resource with.

+
successfunction
  • optional

Callback on success.

+
errorfunction
  • optional

Callback on error.

+
contextObject
  • optional

Context for the callbacks.

+
+
+
+ +
+

Return:

+ + + + + +
undefined

Nothing.

+
+
+
+
+ + + + + + + +
+

Example:

+ +
+ +
let adapter = new Store.AjaxAdapter();
+let store = new Store(adpater);
+store.update("product", "1", { title: "foo" }, (product) => {
+  console.log(product.title);
+});
+
+
+ + + + + +
+
+
+ + + + + + + + + + + + diff --git a/docs/v0.5.1/coverage.json b/docs/v0.5.1/coverage.json new file mode 100644 index 0000000..a444957 --- /dev/null +++ b/docs/v0.5.1/coverage.json @@ -0,0 +1,15 @@ +{ + "coverage": "65.21%", + "expectCount": 23, + "actualCount": 15, + "files": { + "src/ajax-adapter.js": { + "expectCount": 6, + "actualCount": 0 + }, + "src/store.js": { + "expectCount": 17, + "actualCount": 15 + } + } +} \ No newline at end of file diff --git a/docs/v0.5.1/css/prettify-tomorrow.css b/docs/v0.5.1/css/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/docs/v0.5.1/css/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/docs/v0.5.1/css/style.css b/docs/v0.5.1/css/style.css new file mode 100644 index 0000000..26eb9ac --- /dev/null +++ b/docs/v0.5.1/css/style.css @@ -0,0 +1,818 @@ +@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,700); + +* { + margin: 0; + padding: 0; + text-decoration: none; +} + +html +{ + font-family: 'Roboto', sans-serif; + overflow: auto; + font-size: 14px; + /*color: #4d4e53;*/ + color: rgba(0, 0, 0, .68); + background-color: #fff; +} + +a { + /*color: #0095dd;*/ + /*color:rgb(37, 138, 175);*/ + color: #039BE5; +} + +code a:hover { + text-decoration: underline; +} + +ul, ol { + padding-left: 20px; +} + +ul li { + list-style: disc; + margin: 4px 0; +} + +ol li { + margin: 4px 0; +} + +h1 { + margin-bottom: 10px; + font-size: 34px; + font-weight: 300; + border-bottom: solid 1px #ddd; +} + +h2 { + margin-top: 24px; + margin-bottom: 10px; + font-size: 20px; + border-bottom: solid 1px #ddd; + font-weight: 300; +} + +h3 { + position: relative; + font-size: 16px; + margin-bottom: 12px; + background-color: #E2E2E2; + padding: 4px; + font-weight: 300; +} + +del { + text-decoration: line-through; +} + +p { + margin-bottom: 15px; + line-height: 19px; +} + +p > code { + background-color: #f5f5f5; + border-radius: 3px; +} + +pre > code { + display: block; +} + +pre.prettyprint, pre > code { + padding: 4px; + margin: 1em 0; + background-color: #f5f5f5; + border-radius: 3px; +} + +pre.prettyprint > code { + margin: 0; +} + +p > code, +li > code { + padding: 0 4px; + border-radius: 3px; +} + +.import-path pre.prettyprint, +.import-path pre.prettyprint code { + margin: 0; + padding: 0; + border: none; + background: white; +} + +.layout-container { + /*display: flex;*/ + /*flex-direction: row;*/ + /*justify-content: flex-start;*/ + /*align-items: stretch;*/ +} + +.layout-container > header { + height: 40px; + line-height: 40px; + font-size: 16px; + padding: 0 10px; + margin: 0; + position: fixed; + width: 100%; + z-index: 1; + background-color: white; + top: 0; + border-bottom: solid 1px #E02130; +} +.layout-container > header > a{ + margin: 0 5px; +} + +.layout-container > header > a.repo-url-github { + font-size: 0; + display: inline-block; + width: 20px; + height: 38px; + background: url("../image/github.png") no-repeat center; + background-size: 20px; + vertical-align: top; +} + +.navigation { + position: fixed; + top: 0; + left: 0; + box-sizing: border-box; + width: 200px; + height: 100%; + padding-top: 40px; + padding-left: 15px; + padding-bottom: 20px; + overflow-x: scroll; + box-shadow: rgba(255, 255, 255, 1) -1px 0 0 inset; + border-right: 1px solid rgba(0, 0, 0, 0.1); +} + +.navigation h1 { + border: none; + font-size: 18px; +} + +.navigation h2 { + margin: 15px 0 4px; + font-size: 16px; + border: none; +} + +.navigation h2 a { + color: inherit; +} + +.navigation ul { + padding: 0; +} + +.navigation li { + list-style: none; + margin: 4px 0; +} + +h1 .version, +h1 .url a { + font-size: 14px; + color: #aaa; +} + +.content { + margin-top: 40px; + margin-left: 200px; + padding: 10px 50px 10px 20px; +} + +.header-notice { + font-size: 14px; + color: #aaa; + margin: 0; +} + +.expression-extends .prettyprint { + margin-left: 10px; + background: white; +} + +.extends-chain { + border-bottom: 1px solid#ddd; + padding-bottom: 10px; + margin-bottom: 10px; +} + +.extends-chain span:nth-of-type(1) { + padding-left: 10px; +} + +.extends-chain > div { + margin: 5px 0; +} + +.description table { + font-size: 14px; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +.description thead { + background: #999; + color: white; +} + +.description table td, +.description table th { + border: solid 1px #ddd; + padding: 4px; + font-weight: normal; +} + +.flat-list ul { + padding-left: 0; +} + +.flat-list li { + display: inline; + list-style: none; +} + +table.summary { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +table.summary thead { + background: #999; + color: white; +} + +table.summary td { + border: solid 1px #ddd; + padding: 4px 10px; +} + +table.summary tbody td:nth-child(1) { + text-align: right; + white-space: nowrap; + min-width: 64px; + vertical-align: top; +} + +table.summary tbody td:nth-child(2) { + width: 100%; + border-right: none; +} + +table.summary tbody td:nth-child(3) { + white-space: nowrap; + border-left: none; + vertical-align: top; +} + +table.summary td > div:nth-of-type(2) { + padding-top: 4px; + padding-left: 15px; +} + +table.summary td p { + margin-bottom: 0; +} + +.inherited-summary thead td { + padding-left: 2px; +} + +.inherited-summary thead a { + color: white; +} + +.inherited-summary .summary tbody { + display: none; +} + +.inherited-summary .summary .toggle { + padding: 0 4px; + font-size: 12px; + cursor: pointer; +} +.inherited-summary .summary .toggle.closed:before { + content: "â–¶"; +} +.inherited-summary .summary .toggle.opened:before { + content: "â–¼"; +} + +.member, .method { + margin-bottom: 24px; +} + +table.params { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +table.params thead { + background: #eee; + color: #aaa; +} + +table.params td { + padding: 4px; + border: solid 1px #ddd; +} + +table.params td p { + margin: 0; +} + +.content .detail > * { + margin: 15px 0; +} + +.content .detail > h3 { + color: black; +} + +.content .detail > div { + margin-left: 10px; +} + +.content .detail > .import-path { + margin-top: -8px; +} + +.content .detail + .detail { + margin-top: 30px; +} + +.content .detail .throw td:first-child { + padding-right: 10px; +} + +.content .detail h4 + :not(pre) { + padding-left: 0; + margin-left: 10px; +} + +.content .detail h4 + ul li { + list-style: none; +} + +.return-param * { + display: inline; +} + +.argument-params { + margin-bottom: 20px; +} + +.return-type { + padding-right: 10px; + font-weight: normal; +} + +.return-desc { + margin-left: 10px; + margin-top: 4px; +} + +.return-desc p { + margin: 0; +} + +.deprecated, .experimental, .instance-docs { + border-left: solid 5px orange; + padding-left: 4px; + margin: 4px 0; +} + +tr.listen p, +tr.throw p, +tr.emit p{ + margin-bottom: 10px; +} + +.version, .since { + color: #aaa; +} + +h3 .right-info { + position: absolute; + right: 4px; + font-size: 14px; +} + +.version + .since:before { + content: '| '; +} + +.see { + margin-top: 10px; +} + +.see h4 { + margin: 4px 0; +} + +.content .detail h4 + .example-doc { + margin: 6px 0; +} + +.example-caption { + position: relative; + bottom: -1px; + display: inline-block; + padding: 4px; + font-style: italic; + background-color: #f5f5f5; + font-weight: bold; + border-radius: 3px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +.example-caption + pre.source-code { + margin-top: 0; + border-top-left-radius: 0; +} + +footer, .file-footer { + text-align: right; + font-style: italic; + font-weight: 100; + font-size: 13px; + margin-right: 50px; + margin-left: 220px; + border-top: 1px solid #ddd; + padding-top: 30px; + margin-top: 20px; + padding-bottom: 10px; +} + +pre.source-code { + background: #f5f5f5; + padding: 4px; +} + +pre.raw-source-code > code { + padding: 0; + margin: 0; +} + +pre.source-code.line-number { + padding: 0; +} + +pre.source-code ol { + background: #eee; + padding-left: 40px; +} + +pre.source-code li { + background: white; + padding-left: 4px; + list-style: decimal; + margin: 0; +} + +pre.source-code.line-number li.active { + background: rgb(255, 255, 150); +} + +table.files-summary { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; + text-align: right; +} + +table.files-summary tbody tr:hover { + background: #eee; +} + +table.files-summary td:first-child, +table.files-summary td:nth-of-type(2) { + text-align: left; +} + +table.files-summary[data-use-coverage="false"] td.coverage { + display: none; +} + +table.files-summary thead { + background: #999; + color: white; +} + +table.files-summary td { + border: solid 1px #ddd; + padding: 4px 10px; + vertical-align: top; +} + +table.files-summary td.identifiers > span { + display: block; + margin-top: 4px; +} +table.files-summary td.identifiers > span:first-child { + margin-top: 0; +} + +table.files-summary .coverage-count { + font-size: 12px; + color: #aaa; + display: inline-block; + min-width: 40px; +} + +.total-coverage-count { + position: relative; + bottom: 2px; + font-size: 12px; + color: #666; + font-weight: 500; + padding-left: 5px; +} + +table.test-summary thead { + background: #999; + color: white; +} + +table.test-summary thead .test-description { + width: 50%; +} + +table.test-summary { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +table.test-summary thead .test-count { + width: 3em; +} + +table.test-summary tbody tr:hover { + background-color: #eee; +} + +table.test-summary td { + border: solid 1px #ddd; + padding: 4px 10px; + vertical-align: top; +} + +table.test-summary td p { + margin: 0; +} + +table.test-summary tr.test-describe .toggle { + display: inline-block; + float: left; + margin-right: 4px; + cursor: pointer; +} + +table.test-summary tr.test-describe .toggle.opened:before { + content: 'â–¼'; +} + +table.test-summary tr.test-describe .toggle.closed:before { + content: 'â–¶'; +} + +table.test-summary .test-target > span { + display: block; + margin-top: 4px; +} +table.test-summary .test-target > span:first-child { + margin-top: 0; +} + +.inner-link-active { + background: rgb(255, 255, 150); +} + +/* search box */ +.search-box { + position: absolute; + top: 10px; + right: 50px; + padding-right: 8px; + padding-bottom: 10px; + line-height: normal; + font-size: 12px; +} + +.search-box img { + width: 20px; + vertical-align: top; +} + +.search-input { + display: inline; + visibility: hidden; + width: 0; + padding: 2px; + height: 1.5em; + outline: none; + background: transparent; + border: 1px #0af; + border-style: none none solid none; + vertical-align: bottom; +} + +.search-input-edge { + display: none; + width: 1px; + height: 5px; + background-color: #0af; + vertical-align: bottom; +} + +.search-result { + position: absolute; + display: none; + height: 600px; + width: 100%; + padding: 0; + margin-top: 5px; + margin-left: 24px; + background: white; + box-shadow: 1px 1px 4px rgb(0,0,0); + white-space: nowrap; + overflow-y: scroll; +} + +.search-result-import-path { + color: #aaa; + font-size: 12px; +} + +.search-result li { + list-style: none; + padding: 2px 4px; +} + +.search-result li a { + display: block; +} + +.search-result li.selected { + background: #ddd; +} + +.search-result li.search-separator { + background: rgb(37, 138, 175); + color: white; +} + +.search-box.active .search-input { + visibility: visible; + transition: width 0.2s ease-out; + width: 300px; +} + +.search-box.active .search-input-edge { + display: inline-block; +} + +/* coverage badge */ +.esdoc-coverage { + display: inline-block; + height: 20px; + vertical-align: top; +} + +h1 .esdoc-coverage { + position: relative; + top: -4px; +} + +.esdoc-coverage-wrap { + color: white; + font-size: 12px; + font-weight: 500; +} + +.esdoc-coverage-label { + padding: 3px 4px 3px 6px; + background: linear-gradient(to bottom, #5e5e5e 0%,#4c4c4c 100%); + border-radius: 4px 0 0 4px; + display: inline-block; + height: 20px; + box-sizing: border-box; + line-height: 14px; +} + +.esdoc-coverage-ratio { + padding: 3px 6px 3px 4px; + border-radius: 0 4px 4px 0; + display: inline-block; + height: 20px; + box-sizing: border-box; + line-height: 14px; +} + +.esdoc-coverage-low { + background: linear-gradient(to bottom, #db654f 0%,#c9533d 100%); +} + +.esdoc-coverage-middle { + background: linear-gradient(to bottom, #dab226 0%,#c9a179 100%); +} + +.esdoc-coverage-high { + background: linear-gradient(to bottom, #4fc921 0%,#3eb810 100%); +} + +/* github markdown */ +.github-markdown { + font-size: 16px; +} + +.github-markdown h1, +.github-markdown h2, +.github-markdown h3, +.github-markdown h4, +.github-markdown h5 { + margin-top: 1em; + margin-bottom: 16px; + font-weight: bold; + padding: 0; +} + +.github-markdown h1:nth-of-type(1) { + margin-top: 0; +} + +.github-markdown h1 { + font-size: 2em; + padding-bottom: 0.3em; +} + +.github-markdown h2 { + font-size: 1.75em; + padding-bottom: 0.3em; +} + +.github-markdown h3 { + font-size: 1.5em; + background-color: transparent; +} + +.github-markdown h4 { + font-size: 1.25em; +} + +.github-markdown h5 { + font-size: 1em; +} + +.github-markdown ul, .github-markdown ol { + padding-left: 2em; +} + +.github-markdown pre > code { + font-size: 0.85em; +} + +.github-markdown table { + margin-bottom: 1em; + border-collapse: collapse; + border-spacing: 0; +} + +.github-markdown table tr { + background-color: #fff; + border-top: 1px solid #ccc; +} + +.github-markdown table th, +.github-markdown table td { + padding: 6px 13px; + border: 1px solid #ddd; +} + +.github-markdown table tr:nth-child(2n) { + background-color: #f8f8f8; +} diff --git a/docs/v0.5.1/dump.json b/docs/v0.5.1/dump.json new file mode 100644 index 0000000..c75ee80 --- /dev/null +++ b/docs/v0.5.1/dump.json @@ -0,0 +1,2073 @@ +[ + { + "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": "export default class AjaxAdapter {\n\n constructor(options) {\n this._base = (options && options.base) || \"\";\n };\n\n create(store, type, partial, success, error, context) {\n\n if (error && {}.toString.call(error) !== '[object Function]') {\n\n this.create(store, type, partial, success, null, error);\n\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n\n request.open('POST', `${this._base}/${type}`, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n let response = JSON.parse(request.responseText);\n try {\n store.push(response);\n if (success) {\n success.call(context, store.find(response.data.type, response.data.id));\n }\n } catch (e) {\n if (error) {\n error.call(context, e);\n }\n }\n } else {\n if (error) {\n error.call(context);\n }\n }\n };\n\n request.send({\n data: JSON.stringify(store.convert(type, partial))\n });\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n destroy(store, type, id, success, error, context) {\n\n if (error && {}.toString.call(error) !== '[object Function]') {\n\n this.destroy(store, type, id, success, null, error);\n\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n\n request.open('DELETE', `${this._base}/${type}/${id}`, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n try {\n store.remove(type, id);\n if (success) {\n success.call(context);\n }\n } catch (e) {\n error.call(context, e);\n }\n } else if (error) {\n error.call(context);\n }\n };\n\n request.send();\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n load(store, type, id, options, success, error, context) {\n\n if (id && {}.toString.call(id) === '[object Function]') {\n this.load(store, type, null, null, id, options, success);\n } else if (id && typeof id === \"object\") {\n this.load(store, type, null, id, options, success, error);\n } else if (options && {}.toString.call(options) === '[object Function]') {\n this.load(store, type, id, {}, options, success, error);\n } else if (error && {}.toString.call(error) !== '[object Function]') {\n this.load(store, type, id, options, success, null, error);\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n let url;\n\n options = options || {};\n url = id ? `${this._base}/${type}/${id}` : `${this._base}/${type}`;\n\n if (options) {\n\n let params = [];\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 request.open('GET', url, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n try {\n store.push(JSON.parse(request.responseText));\n if (success) {\n success.call(context, id ? store.find(type, id) : store.find(type));\n }\n } catch (e) {\n error.call({}, e);\n }\n } else if (error) {\n error.call(context);\n }\n };\n\n request.send();\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n update(store, type, id, partial, success, error, context) {\n\n if (error && {}.toString.call(error) !== '[object Function]') {\n\n this.update(store, type, id, partial, success, null, error);\n\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n let data = store.convert(type, id, partial);\n\n request.open('PATCH', `${this._base}/${type}/${id}`, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n try {\n store.add(data);\n if (success) {\n success.call(context, store.find(data.type, data.id));\n }\n } catch (e) {\n if (error) {\n error.call(context, e);\n }\n }\n } else if (error) {\n error.call(context);\n }\n };\n\n request.send({\n data: JSON.stringify(data)\n });\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\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": 1, + "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": 3, + "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": 4, + "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": 7, + "undocument": true, + "params": [ + { + "name": "store", + "types": [ + "*" + ] + }, + { + "name": "type", + "types": [ + "*" + ] + }, + { + "name": "partial", + "types": [ + "*" + ] + }, + { + "name": "success", + "types": [ + "*" + ] + }, + { + "name": "error", + "types": [ + "*" + ] + }, + { + "name": "context", + "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": 49, + "undocument": true, + "params": [ + { + "name": "store", + "types": [ + "*" + ] + }, + { + "name": "type", + "types": [ + "*" + ] + }, + { + "name": "id", + "types": [ + "*" + ] + }, + { + "name": "success", + "types": [ + "*" + ] + }, + { + "name": "error", + "types": [ + "*" + ] + }, + { + "name": "context", + "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": 84, + "undocument": true, + "params": [ + { + "name": "store", + "types": [ + "*" + ] + }, + { + "name": "type", + "types": [ + "*" + ] + }, + { + "name": "id", + "types": [ + "*" + ] + }, + { + "name": "options", + "types": [ + "*" + ] + }, + { + "name": "success", + "types": [ + "*" + ] + }, + { + "name": "error", + "types": [ + "*" + ] + }, + { + "name": "context", + "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": 148, + "undocument": true, + "params": [ + { + "name": "store", + "types": [ + "*" + ] + }, + { + "name": "type", + "types": [ + "*" + ] + }, + { + "name": "id", + "types": [ + "*" + ] + }, + { + "name": "partial", + "types": [ + "*" + ] + }, + { + "name": "success", + "types": [ + "*" + ] + }, + { + "name": "error", + "types": [ + "*" + ] + }, + { + "name": "context", + "types": [ + "*" + ] + } + ], + "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 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 };\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 };\n }\n }\n\n constructor(adapter) {\n this._adapter = adapter;\n this._collectionListeners = { \"added\": {}, \"updated\": {}, \"removed\": {} };\n this._data = {};\n this._resourceListeners = { \"added\": {}, \"updated\": {}, \"removed\": {} };\n this._types = {};\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 - Resource Object to add. See:\n http://jsonapi.org/format/#document-resource-objects\n * @return {undefined} - Nothing.\n */\n add(object) {\n if (object) {\n if (object.type && object.id) {\n let event = 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 if (this._resourceListeners[event][object.type] && this._resourceListeners[event][object.type][object.id]) {\n this._resourceListeners[event][object.type][object.id].forEach(x => x[0].call(x[1], resource));\n }\n if (this._collectionListeners[event][object.type]) {\n this._collectionListeners[event][object.type].forEach(x => x[0].call(x[1], 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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.create(\"product\", { title: \"A Book\" }, (product) => {\n * console.log(product.title);\n * });\n */\n create(type, partial, success, error, context) {\n if (this._adapter) {\n this._adapter.create(this, type, partial, success, error, context);\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 * @return {undefined} - Nothing.\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.destroy(\"product\", \"1\", () => {\n * console.log(\"Destroyed!\");\n * });\n */\n destroy(type, id, success, error, context) {\n if (this._adapter) {\n this._adapter.destroy(this, type, id, success, error, context);\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 * Find a resource or entire collection of resources.\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(s) to find.\n * @param {string} [id] - The id of the resource to find. If omitted all\n * resources of the type will be returned.\n * @return {Object|Object[]} - Either the resource or an array of resources.\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 return Object.keys(this._data[type]).map(x => this._data[type][x]);\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 * Attempts to load the resource(s) through the adapter and adds it/them to\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] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)\n * @param {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.load(\"product\", \"1\", (product) => {\n * console.log(product.title);\n * });\n */\n load(type, id, options, success, error, context) {\n if (this._adapter) {\n this._adapter.load(this, type, id, options, success, error, context);\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 * @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 * @return {undefined} - Nothing.\n */\n off(event, type, id, callback) {\n if (this._resourceListeners[event] && this._collectionListeners[event]) {\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 {\n // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.\n this._types[type]._names.forEach(type => {\n if (id) {\n if (this._resourceListeners[event][type] && this._resourceListeners[event][type][id]) {\n this._resourceListeners[event][type][id] = this._resourceListeners[event][type][id].filter(x => {\n return x[0] !== callback;\n });\n }\n } else if (this._collectionListeners[event][type]) {\n this._collectionListeners[event][type] = this._collectionListeners[event][type].filter(x => {\n return x[0] !== callback;\n });\n }\n });\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 * @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 * @return {undefined} - Nothing.\n */\n on(event, type, id, callback, context) {\n if (this._resourceListeners[event] && this._collectionListeners[event]) {\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 {\n // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.\n this._types[type]._names.forEach(type => {\n if (id) {\n this._resourceListeners[event][type] = this._resourceListeners[event][type] || {};\n this._resourceListeners[event][type][id] = this._resourceListeners[event][type][id] || [];\n if (!this._resourceListeners[event][type][id].find(x => x[0] === callback)) {\n this._resourceListeners[event][type][id].push([ callback, context ]);\n }\n } else {\n this._collectionListeners[event][type] = this._collectionListeners[event][type] || [];\n if (!this._collectionListeners[event][type].find(x => x[0] === callback)) {\n this._collectionListeners[event][type].push([ callback, context ]);\n }\n }\n });\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 * @return {undefined} - Nothing.\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 * @return {undefined} - Nothing.\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 if (this._resourceListeners[\"removed\"][type] && this._resourceListeners[\"removed\"][type][id]) {\n this._resourceListeners[\"removed\"][type][id].forEach(x => x[0].call(x[1], resource));\n }\n if (this._collectionListeners[\"removed\"][type]) {\n this._collectionListeners[\"removed\"][type].forEach(x => x[0].call(x[1], resource));\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.update(\"product\", \"1\", { title: \"foo\" }, (product) => {\n * console.log(product.title);\n * });\n */\n update(type, id, partial, success, error, context) {\n if (this._adapter) {\n this._adapter.update(this, type, id, partial, success, error, context);\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.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": 4, + "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": 15, + "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": 41, + "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": 71, + "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": 95, + "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": 96, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "kind": "member", + "static": false, + "variation": null, + "name": "_collectionListeners", + "memberof": "src/store.js~Store", + "longname": "src/store.js~Store#_collectionListeners", + "access": null, + "description": null, + "lineNumber": 97, + "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": 98, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "kind": "member", + "static": false, + "variation": null, + "name": "_resourceListeners", + "memberof": "src/store.js~Store", + "longname": "src/store.js~Store#_resourceListeners", + "access": null, + "description": null, + "lineNumber": 99, + "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": 100, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "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": 112, + "since": "0.1.0", + "params": [ + { + "nullable": false, + "types": [ + "Object" + ], + "spread": false, + "optional": false, + "name": "object", + "description": "Resource Object to add. See:\n http://jsonapi.org/format/#document-resource-objects" + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 146, + "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\" }, (product) => {\n console.log(product.title);\n});" + ], + "lineNumber": 189, + "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": [ + "function" + ], + "spread": false, + "optional": true, + "name": "success", + "description": "Callback on success." + }, + { + "nullable": null, + "types": [ + "function" + ], + "spread": false, + "optional": true, + "name": "error", + "description": "Callback on error." + }, + { + "nullable": null, + "types": [ + "Object" + ], + "spread": false, + "optional": true, + "name": "context", + "description": "Context for the callbacks." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 205, + "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." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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\", () => {\n console.log(\"Destroyed!\");\n});" + ], + "lineNumber": 240, + "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": [ + "function" + ], + "spread": false, + "optional": true, + "name": "success", + "description": "Callback on success." + }, + { + "nullable": null, + "types": [ + "function" + ], + "spread": false, + "optional": true, + "name": "error", + "description": "Callback on error." + }, + { + "nullable": null, + "types": [ + "Object" + ], + "spread": false, + "optional": true, + "name": "context", + "description": "Context for the callbacks." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "generator": false + }, + { + "kind": "method", + "static": false, + "variation": null, + "name": "find", + "memberof": "src/store.js~Store", + "longname": "src/store.js~Store#find", + "access": null, + "description": "Find a resource or entire collection of resources.\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": 260, + "since": "0.1.0", + "params": [ + { + "nullable": false, + "types": [ + "string" + ], + "spread": false, + "optional": false, + "name": "type", + "description": "Type of the resource(s) to find." + }, + { + "nullable": null, + "types": [ + "string" + ], + "spread": false, + "optional": true, + "name": "id", + "description": "The id of the resource to find. If omitted all\n resources of the type will be returned." + } + ], + "return": { + "nullable": null, + "types": [ + "Object", + "Object[]" + ], + "spread": false, + "description": "Either the resource or 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 resource(s) through the adapter and adds it/them to\nthe store if successful.", + "examples": [ + "let adapter = new Store.AjaxAdapter();\nlet store = new Store(adpater);\nstore.load(\"product\", \"1\", (product) => {\n console.log(product.title);\n});" + ], + "lineNumber": 313, + "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": true, + "name": "id", + "description": "ID of resource." + }, + { + "nullable": null, + "types": [ + "Object" + ], + "spread": false, + "optional": true, + "name": "options", + "description": "**NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)" + }, + { + "nullable": null, + "types": [ + "function" + ], + "spread": false, + "optional": true, + "name": "success", + "description": "Callback on success." + }, + { + "nullable": null, + "types": [ + "function" + ], + "spread": false, + "optional": true, + "name": "error", + "description": "Callback on error." + }, + { + "nullable": null, + "types": [ + "Object" + ], + "spread": false, + "optional": true, + "name": "context", + "description": "Context for the callbacks." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 331, + "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()." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 371, + "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." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 410, + "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" + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 430, + "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." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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\" }, (product) => {\n console.log(product.title);\n});" + ], + "lineNumber": 475, + "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": [ + "function" + ], + "spread": false, + "optional": true, + "name": "success", + "description": "Callback on success." + }, + { + "nullable": null, + "types": [ + "function" + ], + "spread": false, + "optional": true, + "name": "error", + "description": "Callback on error." + }, + { + "nullable": null, + "types": [ + "Object" + ], + "spread": false, + "optional": true, + "name": "context", + "description": "Context for the callbacks." + } + ], + "return": { + "nullable": null, + "types": [ + "undefined" + ], + "spread": false, + "description": "Nothing." + }, + "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": 483, + "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": 508, + "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": 533, + "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": 560, + "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 + } +] \ No newline at end of file diff --git a/docs/v0.5.1/file/src/ajax-adapter.js.html b/docs/v0.5.1/file/src/ajax-adapter.js.html new file mode 100644 index 0000000..f4bf6b3 --- /dev/null +++ b/docs/v0.5.1/file/src/ajax-adapter.js.html @@ -0,0 +1,254 @@ + + + + + + src/ajax-adapter.js | API Document + + + + + + + + +
+ Home + Identifier + Source + + Repository + +
+ + + +

src/ajax-adapter.js

+
export default class AjaxAdapter {
+
+  constructor(options) {
+    this._base = (options && options.base) || "";
+  };
+
+  create(store, type, partial, success, error, context) {
+
+    if (error && {}.toString.call(error) !== '[object Function]') {
+
+      this.create(store, type, partial, success, null, error);
+
+    } else if (store._types[type]) {
+
+      let request = new XMLHttpRequest();
+
+      request.open('POST', `${this._base}/${type}`, true);
+
+      request.onload = function () {
+        if (request.status >= 200 && request.status < 300) {
+          let response = JSON.parse(request.responseText);
+          try {
+            store.push(response);
+            if (success) {
+              success.call(context, store.find(response.data.type, response.data.id));
+            }
+          } catch (e) {
+            if (error) {
+              error.call(context, e);
+            }
+          }
+        } else {
+          if (error) {
+            error.call(context);
+          }
+        }
+      };
+
+      request.send({
+        data: JSON.stringify(store.convert(type, partial))
+      });
+
+    } else {
+      throw new Error(`Unknown type '${type}'`);
+    }
+
+  }
+
+  destroy(store, type, id, success, error, context) {
+
+    if (error && {}.toString.call(error) !== '[object Function]') {
+
+      this.destroy(store, type, id, success, null, error);
+
+    } else if (store._types[type]) {
+
+      let request = new XMLHttpRequest();
+
+      request.open('DELETE', `${this._base}/${type}/${id}`, true);
+
+      request.onload = function () {
+        if (request.status >= 200 && request.status < 300) {
+          try {
+            store.remove(type, id);
+            if (success) {
+              success.call(context);
+            }
+          } catch (e) {
+            error.call(context, e);
+          }
+        } else if (error) {
+          error.call(context);
+        }
+      };
+
+      request.send();
+
+    } else {
+      throw new Error(`Unknown type '${type}'`);
+    }
+
+  }
+
+  load(store, type, id, options, success, error, context) {
+
+    if (id && {}.toString.call(id) === '[object Function]') {
+      this.load(store, type, null, null, id, options, success);
+    } else if (id && typeof id === "object") {
+      this.load(store, type, null, id, options, success, error);
+    } else if (options && {}.toString.call(options) === '[object Function]') {
+      this.load(store, type, id, {}, options, success, error);
+    } else if (error && {}.toString.call(error) !== '[object Function]') {
+      this.load(store, type, id, options, success, null, error);
+    } else if (store._types[type]) {
+
+      let request = new XMLHttpRequest();
+      let url;
+
+      options = options || {};
+      url = id ? `${this._base}/${type}/${id}` : `${this._base}/${type}`;
+
+      if (options) {
+
+        let params = [];
+
+        if (options.fields) {
+          Object.keys(options.fields).forEach(field => {
+            options[`fields[${field}]`] = options.fields[field];
+          });
+          delete options.fields;
+        }
+
+        params = Object.keys(options).map(key => {
+          return key + "=" + encodeURIComponent(options[key]);
+        }).sort();
+
+        if (params.length) {
+          url = `${url}?${params.join("&")}`;
+        }
+
+      }
+
+      request.open('GET', url, true);
+
+      request.onload = function () {
+        if (request.status >= 200 && request.status < 300) {
+          try {
+            store.push(JSON.parse(request.responseText));
+            if (success) {
+              success.call(context, id ? store.find(type, id) : store.find(type));
+            }
+          } catch (e) {
+            error.call({}, e);
+          }
+        } else if (error) {
+          error.call(context);
+        }
+      };
+
+      request.send();
+
+    } else {
+      throw new Error(`Unknown type '${type}'`);
+    }
+
+  }
+
+  update(store, type, id, partial, success, error, context) {
+
+    if (error && {}.toString.call(error) !== '[object Function]') {
+
+      this.update(store, type, id, partial, success, null, error);
+
+    } else if (store._types[type]) {
+
+      let request = new XMLHttpRequest();
+      let data = store.convert(type, id, partial);
+
+      request.open('PATCH', `${this._base}/${type}/${id}`, true);
+
+      request.onload = function () {
+        if (request.status >= 200 && request.status < 300) {
+          try {
+            store.add(data);
+            if (success) {
+              success.call(context, store.find(data.type, data.id));
+            }
+          } catch (e) {
+            if (error) {
+              error.call(context, e);
+            }
+          }
+        } else if (error) {
+          error.call(context);
+        }
+      };
+
+      request.send({
+        data: JSON.stringify(data)
+      });
+
+    } else {
+      throw new Error(`Unknown type '${type}'`);
+    }
+
+  }
+
+}
+
+
+ + + + + + + + + + + + diff --git a/docs/v0.5.1/file/src/store.js.html b/docs/v0.5.1/file/src/store.js.html new file mode 100644 index 0000000..d589678 --- /dev/null +++ b/docs/v0.5.1/file/src/store.js.html @@ -0,0 +1,656 @@ + + + + + + src/store.js | API Document + + + + + + + + +
+ Home + Identifier + Source + + Repository + +
+ + + +

src/store.js

+
import "array.prototype.find";
+import AjaxAdapter from "./ajax-adapter";
+
+export default class Store {
+
+  /**
+   * Creates a field definition for an attribute.
+   *
+   * @since 0.1.0
+   * @param {string} [name] - Name of the property to map this field from.
+   * @param {Object} [options] - An options object.
+   * @param {string} [options.default] - Default value for this field.
+   * @return {Object} - Field definition.
+   */
+  static attr(name, options) {
+    if (name && typeof name === 'object') {
+      return Store.attr(null, name);
+    } else {
+      return {
+        type: "attr",
+        default: options && options.default,
+        deserialize: function (data, key) {
+          return data.attributes && data.attributes[name || key];
+        },
+        serialize: function (resource, data, key) {
+          data.attributes[name || key] = resource[key];
+        }
+      };
+    }
+  }
+
+  /**
+   * Creates a field definition for an has-one relationship.
+   *
+   * @since 0.1.0
+   * @param {string} [name] - Name of the property to map this field from.
+   * @param {Object} [options] - An options object.
+   * @param {string} [options.inverse] - Name of the inverse relationship.
+   * @return {Object} - Field definition.
+   */
+  static hasOne(name, options) {
+    if (name && typeof name === 'object') {
+      return Store.hasOne(null, name);
+    } else {
+      return {
+        type: "has-one",
+        inverse: options && options.inverse,
+        deserialize: function (data, key) {
+          name = name || key;
+          if (data.relationships && data.relationships[name]) {
+            if (data.relationships[name].data === null) {
+              return null;
+            } else if (data.relationships[name].data) {
+              return this.find(data.relationships[name].data.type, data.relationships[name].data.id);
+            }
+          }
+        }
+      };
+    }
+  }
+
+  /**
+   * Creates a field definition for an has-many relationship.
+   *
+   * @since 0.1.0
+   * @param {string} [name] - Name of the property to map this field from.
+   * @param {Object} [options] - An options object.
+   * @param {string} [options.inverse] - Name of the inverse relationship.
+   * @return {Object} - Field definition.
+   */
+  static hasMany(name, options) {
+    if (name && typeof name === 'object') {
+      return Store.hasMany(null, name);
+    } else {
+      return {
+        type: "has-many",
+        default: [],
+        inverse: options && options.inverse,
+        deserialize: function (data, key) {
+          name = name || key;
+          if (data.relationships && data.relationships[name]) {
+            if (data.relationships[name].data === null) {
+              return [];
+            } else if (data.relationships[name].data) {
+              return data.relationships[name].data.map((c) => {
+                return this.find(c.type, c.id);
+              });
+            }
+          }
+        }
+      };
+    }
+  }
+
+  constructor(adapter) {
+    this._adapter = adapter;
+    this._collectionListeners = { "added": {}, "updated": {}, "removed": {} };
+    this._data = {};
+    this._resourceListeners = { "added": {}, "updated": {}, "removed": {} };
+    this._types = {};
+  }
+
+  /**
+   * Add an individual resource to the store. This is used internally by the
+   * `push()` method.
+   *
+   * @since 0.1.0
+   * @param {!Object} object - Resource Object to add. See:
+            http://jsonapi.org/format/#document-resource-objects
+   * @return {undefined} - Nothing.
+   */
+  add(object) {
+    if (object) {
+      if (object.type && object.id) {
+        let event = this._data[object.type] && this._data[object.type][object.id] ? "updated" : "added";
+        let resource = this.find(object.type, object.id);
+        let definition = this._types[object.type];
+        Object.keys(definition).forEach(fieldName => {
+          if (fieldName[0] !== "_") {
+            this._addField(object, resource, definition, fieldName);
+          }
+        });
+        if (this._resourceListeners[event][object.type] && this._resourceListeners[event][object.type][object.id]) {
+           this._resourceListeners[event][object.type][object.id].forEach(x => x[0].call(x[1], resource));
+        }
+        if (this._collectionListeners[event][object.type]) {
+          this._collectionListeners[event][object.type].forEach(x => x[0].call(x[1], resource));
+        }
+      } else {
+        throw new TypeError(`The data must have a type and id`);
+      }
+    } else {
+      throw new TypeError(`You must provide data to add`);
+    }
+  }
+
+  /**
+   * Converts the given partial into a JSON API compliant representation.
+   *
+   * @since 0.5.0
+   * @param {!string} [type] - The type of the resource. This can be omitted if the partial includes a type property.
+   * @param {!string} [id] - The id of the resource. This can be omitted if the partial includes an id property.
+   * @param {!object} partial - The data to convert.
+   * @return {object} - JSON API version of the object.
+   */
+  convert(type, id, partial) {
+    if (type && typeof type === "object") {
+      return this.convert(type.type, type.id, type);
+    } else if (id && typeof id === "object") {
+      return this.convert(type, id.id, id);
+    } else {
+      let data = {
+        type: type,
+        attributes: {},
+        relationships: {}
+      };
+      if (id) {
+        data.id = id;
+      }
+      let definition = this._types[data.type];
+      Object.keys(definition).forEach(fieldName => {
+        if (fieldName[0] !== "_") {
+          definition[fieldName].serialize(partial, data, fieldName);
+        }
+      });
+      return data;
+    }
+  }
+
+  /**
+   * Attempts to create the resource through the adapter and adds it to  the
+   * store if successful.
+   *
+   * @since 0.5.0
+   * @param {!string} type - Type of resource.
+   * @param {!Object} partial - Data to create the resource with.
+   * @param {function} [success] - Callback on success.
+   * @param {function} [error] - Callback on error.
+   * @param {Object} [context] - Context for the callbacks.
+   * @return {undefined} - Nothing.
+   *
+   * @example
+   * let adapter = new Store.AjaxAdapter();
+   * let store = new Store(adpater);
+   * store.create("product", { title: "A Book" }, (product) => {
+   *   console.log(product.title);
+   * });
+   */
+  create(type, partial, success, error, context) {
+    if (this._adapter) {
+      this._adapter.create(this, type, partial, success, error, context);
+    } else {
+      throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`");
+    }
+  }
+
+  /**
+   * Defines a type of resource.
+   *
+   * @since 0.2.0
+   * @param {!string|string[]} names - Name(s) of the resource.
+   * @param {!Object} definition - The resource's definition.
+   * @return {undefined} - Nothing.
+   */
+  define(names, definition) {
+    names = (names.constructor === Array) ? names : [ names ];
+    if (definition) {
+      definition._names = names;
+      names.forEach(name => {
+        if (!this._types[name]) {
+          this._types[name] = definition;
+        } else {
+          throw new Error(`The type '${name}' has already been defined.`);
+        }
+      });
+    } else {
+      throw new Error(`You must provide a definition for the type '${names[0]}'.`);
+    }
+  }
+
+  /**
+   * Attempts to delete the resource through the adapter and removes it from
+   * the store if successful.
+   *
+   * @since 0.5.0
+   * @param {!string} type - Type of resource.
+   * @param {!string} id - ID of resource.
+   * @param {function} [success] - Callback on success.
+   * @param {function} [error] - Callback on error.
+   * @param {Object} [context] - Context for the callbacks.
+   * @return {undefined} - Nothing.
+   *
+   * @example
+   * let adapter = new Store.AjaxAdapter();
+   * let store = new Store(adpater);
+   * store.destroy("product", "1", () => {
+   *   console.log("Destroyed!");
+   * });
+   */
+  destroy(type, id, success, error, context) {
+    if (this._adapter) {
+      this._adapter.destroy(this, type, id, success, error, context);
+    } else {
+      throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`");
+    }
+  }
+
+  /**
+   * Find a resource or entire collection of resources.
+   *
+   * NOTE: If the resource hasn't been loaded via an add() or push() call it
+   * will be automatically created when find is called.
+   *
+   * @since 0.1.0
+   * @param {!string} type - Type of the resource(s) to find.
+   * @param {string} [id] - The id of the resource to find. If omitted all
+   *                        resources of the type will be returned.
+   * @return {Object|Object[]} - Either the resource or an array of resources.
+   */
+  find(type, id) {
+    if (type) {
+      let definition = this._types[type];
+      if (definition) {
+        if (!this._data[type]) {
+          let collection = {};
+          definition._names.forEach(t => this._data[t] = collection);
+        }
+        if (id) {
+          if (!this._data[type][id]) {
+            this._data[type][id] = {
+              _dependents: [],
+              type: type,
+              id: id
+            };
+            Object.keys(definition).forEach(key => {
+              if (key[0] !== "_") {
+                this._data[type][id][key] = definition[key].default;
+              }
+            });
+          }
+          return this._data[type][id];
+        } else {
+          return Object.keys(this._data[type]).map(x => this._data[type][x]);
+        }
+      } else {
+        throw new TypeError(`Unknown type '${type}'`);
+      }
+    } else {
+      throw new TypeError(`You must provide a type`);
+    }
+  }
+
+  /**
+   * Attempts to load the resource(s) through the adapter and adds it/them to
+   * the store if successful.
+   *
+   * @since 0.5.0
+   * @param {!string} type - Type of resource.
+   * @param {!string} [id] - ID of resource.
+   * @param {Object} [options] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)
+   * @param {function} [success] - Callback on success.
+   * @param {function} [error] - Callback on error.
+   * @param {Object} [context] - Context for the callbacks.
+   * @return {undefined} - Nothing.
+   *
+   * @example
+   * let adapter = new Store.AjaxAdapter();
+   * let store = new Store(adpater);
+   * store.load("product", "1", (product) => {
+   *   console.log(product.title);
+   * });
+   */
+  load(type, id, options, success, error, context) {
+    if (this._adapter) {
+      this._adapter.load(this, type, id, options, success, error, context);
+    } else {
+      throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`");
+    }
+  }
+
+  /**
+   * Unregister an event listener that was registered with on().
+   *
+   * @since 0.4.0
+   * @param {string} event - Name of the event.
+   * @param {string} type - Name of resource to originally passed to on().
+   * @param {string} [id] - ID of the resource to originally passed to on().
+   * @param {function} callback - Function originally passed to on().
+   * @return {undefined} - Nothing.
+   */
+  off(event, type, id, callback) {
+    if (this._resourceListeners[event] && this._collectionListeners[event]) {
+      if (this._types[type]) {
+        if (id && ({}).toString.call(id) === '[object Function]') {
+          this.off.call(this, event, type, null, id, callback);
+        } else {
+          // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.
+          this._types[type]._names.forEach(type => {
+            if (id) {
+              if (this._resourceListeners[event][type] && this._resourceListeners[event][type][id]) {
+                this._resourceListeners[event][type][id] = this._resourceListeners[event][type][id].filter(x => {
+                  return x[0] !== callback;
+                });
+              }
+            } else if (this._collectionListeners[event][type]) {
+              this._collectionListeners[event][type] = this._collectionListeners[event][type].filter(x => {
+                return x[0] !== callback;
+              });
+            }
+          });
+        }
+      } else {
+        throw new Error(`Unknown type '${type}'`);
+      }
+    } else {
+      throw new Error(`Unknown event '${event}'`);
+    }
+  }
+
+  /**
+   * Register an event listener: "added", "updated" or "removed".
+   *
+   * @since 0.4.0
+   * @param {string} event - Name of the event.
+   * @param {string} type - Name of resource to watch.
+   * @param {string} [id] - ID of the resource to watch.
+   * @param {function} callback - Function to call when the event occurs.
+   * @param {Object} [context] - Context in which to call the callback.
+   * @return {undefined} - Nothing.
+   */
+  on(event, type, id, callback, context) {
+    if (this._resourceListeners[event] && this._collectionListeners[event]) {
+      if (this._types[type]) {
+        if (id && ({}).toString.call(id) === '[object Function]') {
+          this.on.call(this, event, type, null, id, callback);
+        } else {
+          // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.
+          this._types[type]._names.forEach(type => {
+            if (id) {
+              this._resourceListeners[event][type] = this._resourceListeners[event][type] || {};
+              this._resourceListeners[event][type][id] = this._resourceListeners[event][type][id] || [];
+              if (!this._resourceListeners[event][type][id].find(x => x[0] === callback)) {
+                this._resourceListeners[event][type][id].push([ callback, context ]);
+              }
+            } else {
+              this._collectionListeners[event][type] = this._collectionListeners[event][type] || [];
+              if (!this._collectionListeners[event][type].find(x => x[0] === callback)) {
+                this._collectionListeners[event][type].push([ callback, context ]);
+              }
+            }
+          });
+        }
+      } else {
+        throw new Error(`Unknown type '${type}'`);
+      }
+    } else {
+      throw new Error(`Unknown event '${event}'`);
+    }
+  }
+
+  /**
+   * Add a JSON API response to the store. This method can be used to handle a
+   * successful GET or POST response from the server.
+   *
+   * @since 0.1.0
+   * @param {Object} root - Top Level Object to push. See:
+                            http://jsonapi.org/format/#document-top-level
+   * @return {undefined} - Nothing.
+   */
+  push(root) {
+    if (root.data.constructor === Array) {
+      root.data.forEach(x => this.add(x));
+    } else {
+      this.add(root.data);
+    }
+    if (root.included) {
+      root.included.forEach(x => this.add(x));
+    }
+  }
+
+  /**
+   * Remove a resource or collection of resources from the store.
+   *
+   * @since 0.1.0
+   * @param {!string} type - Type of the resource(s) to remove.
+   * @param {string} [id] - The id of the resource to remove. If omitted all
+   *                        resources of the type will be removed.
+   * @return {undefined} - Nothing.
+   */
+  remove(type, id) {
+    if (type) {
+      if (this._types[type]) {
+        if (id) {
+          let resource = this._data[type] && this._data[type][id];
+          if (resource) {
+            this._remove(resource);
+            if (this._resourceListeners["removed"][type] && this._resourceListeners["removed"][type][id]) {
+               this._resourceListeners["removed"][type][id].forEach(x => x[0].call(x[1], resource));
+            }
+            if (this._collectionListeners["removed"][type]) {
+              this._collectionListeners["removed"][type].forEach(x => x[0].call(x[1], resource));
+            }
+          }
+        } else {
+          Object.keys(this._data[type]).forEach(id => this.remove(type, id));
+        }
+      } else {
+        throw new TypeError(`Unknown type '${type}'`);
+      }
+    } else {
+      throw new TypeError(`You must provide a type to remove`);
+    }
+  }
+
+  /**
+   * Attempts to update the resource through the adapter and updates it in  the
+   * store if successful.
+   *
+   * @since 0.5.0
+   * @param {!string} type - Type of resource.
+   * @param {!string} id - ID of resource.
+   * @param {!Object} partial - Data to update the resource with.
+   * @param {function} [success] - Callback on success.
+   * @param {function} [error] - Callback on error.
+   * @param {Object} [context] - Context for the callbacks.
+   * @return {undefined} - Nothing.
+   *
+   * @example
+   * let adapter = new Store.AjaxAdapter();
+   * let store = new Store(adpater);
+   * store.update("product", "1", { title: "foo" }, (product) => {
+   *   console.log(product.title);
+   * });
+   */
+  update(type, id, partial, success, error, context) {
+    if (this._adapter) {
+      this._adapter.update(this, type, id, partial, success, error, context);
+    } else {
+      throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`");
+    }
+  }
+
+  _addField(object, resource, definition, fieldName) {
+    var field = definition[fieldName];
+    var newValue = field.deserialize.call(this, object, fieldName);
+    if (typeof newValue !== "undefined") {
+      if (field.type === "has-one") {
+        if (resource[fieldName]) {
+          this._removeInverseRelationship(resource, fieldName, resource[fieldName], field);
+        }
+        if (newValue) {
+          this._addInverseRelationship(resource, fieldName, newValue, field);
+        }
+      } else if (field.type === "has-many") {
+        resource[fieldName].forEach(r => {
+          if (resource[fieldName].indexOf(r) !== -1) {
+            this._removeInverseRelationship(resource, fieldName, r, field);
+          }
+        });
+        newValue.forEach(r => {
+          this._addInverseRelationship(resource, fieldName, r, field);
+        });
+      }
+      resource[fieldName] = newValue;
+    }
+  }
+
+  _addInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) {
+    var targetDefinition = this._types[targetResource.type];
+    var sourceDefinition = this._types[sourceResource.type];
+    if (targetDefinition) {
+      let targetFieldName = [ sourceField.inverse ].concat(sourceDefinition._names).find(x => targetDefinition[x]);
+      let targetField = targetDefinition && targetDefinition[targetFieldName];
+      targetResource._dependents.push({ type: sourceResource.type, id: sourceResource.id, fieldName: sourceFieldName });
+      if (targetField) {
+        if (targetField.type === "has-one") {
+          sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName });
+          targetResource[targetFieldName] = sourceResource;
+        } else if (targetField.type === "has-many") {
+          sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName });
+          if (targetResource[targetFieldName].indexOf(sourceResource) === -1) {
+            targetResource[targetFieldName].push(sourceResource);
+          }
+        } else if (targetField.type === "attr") {
+          throw new Error(`The the inverse relationship for '${sourceFieldName}' is an attribute ('${targetFieldName}')`);
+        }
+      } else if (sourceField.inverse) {
+        throw new Error(`The the inverse relationship for '${sourceFieldName}' is missing ('${sourceField.inverse}')`);
+      }
+    }
+  }
+
+  _remove(resource) {
+    resource._dependents.forEach(dependent => {
+      let dependentResource = this._data[dependent.type][dependent.id];
+      switch (this._types[dependent.type][dependent.fieldName].type) {
+        case "has-one": {
+          dependentResource[dependent.fieldName] = null;
+          break;
+        }
+        case "has-many": {
+          let index = dependentResource[dependent.fieldName].indexOf(resource);
+          if (index !== -1) {
+            dependentResource[dependent.fieldName].splice(index, 1);
+          }
+          break;
+        }
+        default: {
+          break;
+        }
+      }
+      // TODO: This only needs to be run once for each dependent.
+      dependentResource._dependents = dependentResource._dependents.filter(d => {
+        return !(d.type === resource.type && d.id === resource.id);
+      });
+    });
+    delete this._data[resource.type][resource.id];
+  }
+
+  _removeInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) {
+    var targetDefinition = this._types[targetResource.type];
+    var targetFieldName = sourceField.inverse || sourceResource.type;
+    var targetField = targetDefinition && targetDefinition[targetFieldName];
+    targetResource._dependents = targetResource._dependents.filter(r => {
+      return !(r.type === sourceResource.type && r.id === sourceResource.id && r.fieldName === sourceFieldName);
+    });
+    if (targetField) {
+      if (targetField.type === "has-one") {
+        sourceResource._dependents = sourceResource._dependents.filter(r => {
+          return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName);
+        });
+        targetResource[targetFieldName] = null;
+      } else if (targetField.type === "has-many") {
+        sourceResource._dependents = sourceResource._dependents.filter(r => {
+          return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName);
+        });
+        targetResource[targetFieldName] = targetResource[targetFieldName].filter(r => {
+          return r !== sourceResource;
+        });
+      } else if (targetField.type === "attr") {
+        throw new Error(`The the inverse relationship for '${sourceFieldName}' is an attribute ('${targetFieldName}')`);
+      }
+    } else if (sourceField.inverse) {
+      throw new Error(`The the inverse relationship for '${sourceFieldName}' is missing ('${sourceField.inverse}')`);
+    }
+  }
+
+}
+
+Store.AjaxAdapter = AjaxAdapter;
+
+
+ + + + + + + + + + + + diff --git a/docs/v0.5.1/identifiers.html b/docs/v0.5.1/identifiers.html new file mode 100644 index 0000000..dcd2eed --- /dev/null +++ b/docs/v0.5.1/identifiers.html @@ -0,0 +1,126 @@ + + + + + + Index | API Document + + + + + + + + +
+ Home + Identifier + Source + + Repository + +
+ + + +

Identifier

+

Class Summary

+ + + + + + + + + + + + + + +
Static Public Class Summary
+ public + + + + + +
+

+ AjaxAdapter +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ Store +

+
+
+ + + +
+
+ + +
+
+ + + + +
+ + + + + + + + + + + + diff --git a/docs/v0.5.1/image/badge.svg b/docs/v0.5.1/image/badge.svg new file mode 100644 index 0000000..324db4c --- /dev/null +++ b/docs/v0.5.1/image/badge.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + document + document + @ratio@ + @ratio@ + + diff --git a/docs/v0.5.1/image/github.png b/docs/v0.5.1/image/github.png new file mode 100644 index 0000000000000000000000000000000000000000..ea6ff545a246caa64074ba809bbc86fcb8589071 GIT binary patch literal 4268 zcmeAS@N?(olHy`uVBq!ia0y~yV5k6L4mJh`2Fnz)OAHJQk|nMYCBgY=CFO}lsSJ)O z`AMk?p1FzXsX?iUDV2pMQ*9U+m{l@EB1$5BeXNr6bM+EIYV;~{3m8Da#=fE;F*!T6 zL?J0PJu}Z%>HY5gN(z}Nwo2iqz6QPp&Z!xh9#uuD!Bu`C$yM3OmMKd1b_zBXRu#Dg zxv3?I3Kh9IdBs*0wn|`gt@4VkK*IV;3ScEA*|tg$M@9GsC^+XAr7D=}8S5q+7#b>= znduptn3|ax>L?f)7#ist80j0B=^C0?nVMM{nJYknlAVH0QA(Oskc%7CuA-DQTcwPW zk^(Dz{qpj1y>er{{GxPyLrY6bkQqisxCgqow*eWSOjjhNnfE$}v3=O8_{9OHt!~%UoJp+)JAb!m)@b$&7G&dKny0|1L z72#g21{a4^7NqJ2r55Lx7A2}6#Z40`Tsp!z zltV&xG&#&-oVK7NaS>zC6t`)YIXL_}k9Az?X8cr@J z4p(R_U}}ol`}hBw(!Aes=Pb+L7k|4|J->LL>E^WJnbrG`|9bn^_WJgHE}@}QHwNvP zq|xHFCFkBEQ@Obdjwazhn~j zr!%JWZ)KHpUU=PU_wg+=v=?k%=+E>`j{Ao64ZDh-mN?ej3F^8J4PSh|(9T%Z$XcUx zoFZ^EM&sdfk$Sk(u@Pfw+-*V@)eae4v_fk!`m~6s?F`$x=YE;JKV|2&3Cfoi`Le!PwTGE!N6i0Po~qu| znSt{f`xu@yS29Z!SU)gizjgA{XBFuM%#1(dH?s5WxNmfBm0$4bv(w)QpXhG(*`kuL zqxoY*!oxJxEjO7qCME>wJM2*YFoSb#e&o|5k6#^Iy40Fa)^3ZMSp(yDHJfEKnF=1v{O#3jOlU{vOcUt$6p(x{9ek zT26~6?P`_oyzuODYvVZuZrOilEAGrncI0=k%vhjrw4Il`R=DYF>g8R`QL~b3cYgWJ z$QG;3oWCgb^n2dPzvJGC=DlZIa=WdWTe|v!8blTt7YTy6H@QFn&z5T|`Zn?y9_wKlA`jY;xr+DLvQs{8Q>VsMhBmvd-*W<-#4Dr@t`I+;`^t$MSBbQ}uf` zoYaUjW0NyE_%q;VRJ5pndwSr+oklx$D?3Ntn|$#0?hA7-e0Q~+VXad8IPm9Pw@cTH zFC0Fcxz=@mnvDMW%?p;NzhG8(eDC_RFD0@0I`gJf<;2f>*ZfW>%>C=`z?$?qWLEd) znK~P6xNN0&g+#H`3BGRn)-mDdKg)o1H)3<-R zJHGO6J;$>`;da1;%ghEgr{_3C#kbs)Q@$^h8M=={VeQ+BEu1Sd<}{UhJ&&2cvQth> zA?DON1)+&))?b2OGwu)g&nr;Co@jdbvx4`mi66N>J8So`)E=9`ysoXz?V=6GwR=S; zq!m|Z|7F-0x=`Sn{;&UwHb$9W6HcgkRoi<`>(a|<*;}`SdVH2i41X^Er+96n23JAR z#>t}6TSC14E$eAe%{esHYi4oP<)d|bj^{3T`pCpVV%guOcFDUNIBRv|L#0gw+Ad%((?Nu5c;x-Z|$-BdfweCf86@|Hu-=PZ7B_HM$?Ycn<$L{ExSkV@aV zW9iK)iQ<#v3-lL@nfiCtI#%a{7EZ}aXL`3_%8#Vex<%2Y3J;8y9tn@in|OPb54S;V^7hEQ zd9B-4U17T8rTFlzL_%%e&dPaug75rVmqZH|7`L|AZ@f`+nz7Ynb|&M$6Q4fmvTtR` z{^5Cb^PZaSW6KVoWLYDqx_sl)r_m;Nx}>LRh;F;`>67mA43$-^H;$d_>O8xJVf!a( z-eogf{q(k7V2WA!#cbQQ7dG6vOCPR_iCko{)beoAXPviGF8y8MlG(I2@`aPg+WvOJz=9Je{`Sb?DVq49=j!_2LHAQ zb+-Ll7{sRYBcR)8El+66?*5#~-cwhLY8zTfx}5RqT|fPH^J3A>7IJ1rnLn0xNq(Gg zwO{9w@RO>=)xUolnLkiHHFc)S#szCho;#nIq4?+7;zf761@vCqoNp<9d18(*!{f2 zyz0WYrYzlH^N@SlAJZjPn-__$_`#B~mx(Q!|I`N0Vo`CEtkXK*`L{CuKWp*4>yW^+ zztJz8Bp%*jYPs#YZ2tDyAM(;|)p&xLk1gMO{cc^micH0tHphP~xzP*>=NtYVwb1rV z>^FUOg>U9WkH7=oA1bas@8WdN^_g*zX-DN*-3`AY_cgvz``6R7?u_z^EstG~bzV6g z&=go|y*F`txG~c-rq5ivKijIDxb5t>wsw+0{e7AKzzc?I)%EdhaaCS%^Gu7vo!9&d ze|+clkp;;;6Xdr}ei*&sV&&HV#uF2b-kJV7oj>8j`>elzl_EW7YQ{hLX(=}E`oX7i{d^{xlb;>UDPHP9_ znv_H0NgPIzkG-1jac%byKKAU}qXz9`dXJRK=P^3J(^7uurgqPW$!x~Nyj7F@Zn&)f zJdtzzzG(+E-mSj&g6~Ln=1p@Rql4|)Qj1x`(?sv6%ZnH9c)e8HN3%3G_qeFU{)ZDP z?1SPZ(lfih{5rkFeu5+GmhNx78AdZ6b<16kKL2~O_L(g=CcNZbXYlX6-jk@;_wSao zZ;)>*TG>~79eTd)w?g_{O?j^1rxGnTh&6qeH(dc0T^-{#a($ET+F_+-J$m+%M7?_*m%5 z9G)$xB^u*##Gf!Rl^)vP5eEZbPyiaXAW1j7feKu$7+$Z)1eb$1%-*cxr z{ZC_QyDKGpV6jTn9`%oVdt23}oldNqd$W2`!0Ag%+;?0~S(u_z+xem1w`X(xE_wTU zrTyW0+-mxpR`TCobz(nH|9=;ra;v82Cc-PfPy-_vj0c#Nxd(@*~Y zm{poru}0vATO89iHgmU>JI#WJW7W5ruWIk~ zWnYbNKk4@LyI3K9A@#z1my`#mI38}Ay(`G=^FEbqf98*UF$sSxC;k;`tvT^z;evg4 zEN{tQT%h&z)PgYKxqm)Q^PK-8-855+$277m>yz&y4dYyEmFOLojAAGB9~jy7f zL~ullakwP}Y`v*w{r>N_W4qZs@0dR*mJEnhkBwIldT}sEq$j%jzF}Yc(q(f(8VWKu z+c_TMmD%91tUtv3#q48U;SUc5ZZBC~yOBv}LZw;TY_9(3vQnzuho3bb62YD*+f2qAt}xC2J#S{J_)I&t;ucLK6Tg Cd!TIq literal 0 HcmV?d00001 diff --git a/docs/v0.5.1/image/search.png b/docs/v0.5.1/image/search.png new file mode 100644 index 0000000000000000000000000000000000000000..f5d84b697dad0c856a822c2df0a0da46ee3e9be3 GIT binary patch literal 12704 zcmeAS@N?(olHy`uVBq!ia0y~yV6iFfq_LO)7d$|)7e=epeR2r zGbfdS!9uV#^nU*B5D~l1{GcUb_6ia1?OjLLhXzOQl$Kh1jLmcM(zjk>OJCm5Qh8!! z-nmkm{r1aktNg1Q&Ds7iI^1OD_pnjqWlO5Q`R%|K&){~gRh}NzFOKjls=Z|meYm?U zNj>;T%-3J1E$>@Cw|*XX+r>6MbL%Y0(2i-V*UdezGIjEDu_^O>yDn|M;>~Kl|?= zncLa!e3toe*^Gs0HPiIkIYJc|kE`4IDcW=PUC??hx|U-Po6VjZY5Lm}|cKNNdtR>{g$mHsm}ncJ~ff|9l^ zKH&bs#YNdqOgHK3N-ygr0rQNe9NFt;W}|9!qNVll=|n>%|4TwScPlOXA0Kb&*(APK zcTwO{>*MPS_MhAsVIO>x@sE7c<~Ih?>B37knBSQFhQs@y)j>X1uA*EkQLW3h8ec!} z@h=S#v+@i0^v9uAqa*O#&G%Bj&i4Ono3+7P`-`&w1w)hQx55hS!WpIJm+Y2jXWPHw zvpL1K`^UMr`?9l3{uF-hz1y98+-yVMv2BNb+*rR+_fKvRlXXH>*R+MFK9n8etWcJ< zjbXg3%KJM1LF9#7LAN$8Ui#{1;{|24gZ3xv&Rp90@WQHpi~g<5TM@rP{K|dntQJY@ zWh%8=wc39*YSnA?|N3;5MD9}hs}ehP-$XrD%iZty&R4xry*@rs_-dWbKb`Vt&!0^;(i=o}#>-7!{$%fmH=N(j^8A(ED^bF=Im>rzweCk22@`%*wz+KA zkA)mYeV`@B6r;(n-Y zSjPPI-(+C}E2{^&IzFl=j33RlDhzY|!c{W+!r9n5w)=dGJXe=pGdm?3esle*^_rYD zr*;^{UUhF5J!>L*{;7sp`HsDZx)-bLYgX!e;dt-&KG(9lJh|_pUE2R2vVI+w5xqjV z_N~Cz{ZhBuKKRu8C@j-16JEZk@Yk?b_ULtQOje%wmQU(kALQ&NfOv zH>Yst&Yk9tE7Y8?tYcijDX=>G!+(~X$~-2Qo#`87-FCiTbmy?Z;qs6F4?cVL%=Y#5 z_4x&x^`^P9#VJ-;yd^fcYwQjt-be*0M;l?mJBxBTcSh?ui_x#JJ1zz1<159AW6 zWp~6y?ksxxdtKO}Lnj&+ENmE3A#<#tO?O`YoC}$%0c1to&yd?*5fp68_xrMOtETq5Qd(&cU|)i>`O% zD(~9+`oi14wX2?ftT9^9*?58L-l0}*^|Z9KbFIeDlqT;En;g6)!SUI5z71DON=mM* ziQN3GKdL~GU9#Ym!wnYwxBq^>-!GkF+u@Vf7JTVYh1{lnZ#Vp2zB+8}FJ8Odhfgr( zn$2(Az!CRrlB#!_;^b-xr}D)=^SIA3am@EAugv-S>Z)|(B5ezmH8Xis&Np0bGB15~ zWzC{Ri++EYa_GL(3pI6r{_`D28Cu>eJX8FaaeZB^|MlzFPcLBqf1;s^ZH>sDNs}hc z@tmxt>*V%bU>nodI0FfVO?#DZ$k~^?2)KG}ZFDq`S?dMo0}Z)N(>vF_E>|qFcW^5Y z<@mGwm`h5Hyu**Wo^|iI8eRo3_c)wzkY`&XXw$Q+PBhqi-V@thcK3K6tiJR3@RVs! zC9c+*HoS^dm6Vvm_?XpS?&l#bmHx#G&$_3j@3C#JIz2&t;>(khW&9IEr?>y$n62o? z&3T5W`K`}!k;%Ue6+SXaU7x-o@XZv9;F`w$PCwEt6ozd#?q**~7_X?=33-=+IW@npf$2*L3r6Ft0MUd3mT$#`07AMGvuy zvEK|Ea@N1PvNHI7viNno`&nB();>5p*ZTYCiic<2I_~mDom5_TMY7?=+r!T%K=Ul_7OwDd_{dw&>OJ^H!S?3k}_;a;{t-w*b`L^iOif20$pP!ri|9(kz zN4z=nEf)VU)1RzT2a+>5ZthyCY_(lNApY^AZ_@?#8Vc;Kci%Z@^K-GCI?LsmvvzIS zw5Q6^@!(~Sf7QPfpV%)YwolhJ2v}57qgSK$(_s9?6<=$s#f0( zw)*&U(!-NByH7B%9`#F?k!bePn<3;a6nv~fEx?qg!tP_lyagRTTK^_Vt>!$E!FFM< zZ1>5N+mnhuZJsgbPUaRvmiOAsGv%&NldFt*Q`Z05a9PEjntZor+n)268EVDmr%&8E z=jfI0dH#khvD*?)B(X4;%f2I6`N&GSMWqb$*+0BG#H_2U%Wjr)qktvFqSnGL_uHGBtd^FR zn|^&3xnjtgTFduTJXu=MYEt3`9qIn^hjr#X+b%zQBKg7R!!*5Et@XY!vu#w2&o}&- zb9kHVZLyB?)4IC4?ru1;{*1D0jrgK>L05Ed^W;pQeKO_Kio!rm_WS;-^=juiq?zY& z%+t9ybN1}tY%K4MrwRX(le&F*hWxkaJ&Pam-ng~!$UUDu%qdpStnYEkp9p$2KeXwz zu*8RhKc78&_AJG6C8(!!Y~N8EbZw#v?I z*^^ctT~F%dUd?OsdB1jn z!G^fKJUfIQO#EH8-dUli-qTF#|Fmn@uCZTR7rQ%r{p~yMVR3PF%5ihPu(-T0`|kaH zyUULP{ddo6FJ6h}|F=nW-L06J6?5j#|G(p9Qu~<)7Tee_me#7pD1PYND%hy+y39_x zx{m3gbhZ}1P`A+J1OIJIz-@s{l$ z>x?+1$t^#{6BU&H+&^A2Eh|P~m10#Z+a%?UKUE6ucb#3&`GD<`h~5d!*u4|)-t9lO z;fl*CgHO9YJvi8$dfxtjO>^guzXy8CkJK6D+}N<(tw*Ae^^eWjeyh7{n8hEhUhX&d zmt$@1-mA?1c|~c}k$t+W_F>NM~#k(%2Hz^AanQXk>di=n$pf{8F!yfwVXl{`B zY9!kk*m?Dd?lVa=EIK%&`K7jc!NK40f9pbi^~cOmO=DayF?$-T+>}kJ=4+O)>lWxgujW|rbJ>Na zgPrY$umAm@(R5v8js(Y#?~4{KGCOieRxRP!*PmVwY+D;8W;z|+Kf!3ilm}C%OnK5H zXZy>NrT^E~YbkZI|E47=eLU~{D*F7{wu(Jb5fK`T@02U4$=v7vCX=y*DM9DRiqBn# z+xd-8f9@_x{i-6mWU`uXRLg>$UNd=_A9UPEoXxs%wbTdY@*Srd3Up$)pRW^pFVF#%(%JpY}TJoEyWM*{!Kh6r)a3N zQAUUBnw$u8CzsqKmA~wcjXqoAd~7S3J|C@{^5Ub-xmdQA>XO{6_lC~Q!Xs`1oteqcCLP<>vR~z} zL(IX$zZlB1_eCvEoO@8`S7c3-lH~U4>NP){YLxbU+@|(?ske`Jj8IOP_vJplBgvT`aPYA4X5m8BISa2E^>D3w;=~ZO z*Epr)hg;1O(S=909oZ39bL6QVb2FEm7)OA0P5+xj^J|+YKTrO-dYmWb#`}=K@!m2reQ(xKlvL^);>0UvH9BA-DT_bO*aaim+1IWFgab+LcbzS<=fop2aK;88#sLU z^!fAtwu!5Ca!(Yp)`du`Jt{ob;1=(7#`}%+=8p84hYm0tY<}#$wefiE{OKEnxZ;Z%leOzMr{KQMaPuK_h!J>8@BAd3v zU6o3dxH$QH=cn^dY+HVYCB@%rXbri%goF7n3xBvpsHW|QIhk2mmn;??XDDi9{J8eV zjn+jm+D_5Z1!oP!t{ir-KX~}XOtXX4>$Yv%Hgn&m$&4R$S)N(?Udzm8p0#5m<7wA} z(c5xvUiEmn{&I?l)L|>%ijJeTY+HUt+-lgu`dv4*Q%YioMumiF@YK7FbG~mlbs`V4 z>`j58(HC5LUPkC~$p!tKZ6et`{lK3vVY#G_eT=#Lu3Zz`lWbR`8ZTlqW8E{`MLX6P z=bfEpn%{C>_TiR@8eO~al)baIE$9%|UhswE-WTKg-kq-J5D+DKY04=*{WCP9?d(ay)NqHp)1A<&OX0&tEGxvifM!UhXU8x zYdG~ktcX?#61F!>y7;U(H}{a+eD=iP{s#}$-kLgw$gTCeb2@X)iWLvIs}@a6{%H4c z=a0DV&RMrw#Qbs&TvV)O@2b*{pXz%_gf(X!y8PSVLN$NB)BM`TI@dP$gWOk`4~DKg z`Tc;AqJ>(-=5U@R$+G`rEX>cZ=9;9teed46P1AKUr^&28`TdgGlH3R<-LoAA6Xs2v zSlFs&78MnxQ87#Ak+N9szU$Y_YD!wShA!ooHp`hJ_PXHylFGwvyzW~bDDu@y3f%YR z`4OG{=9bCU-WwV}y^VO5B&TxtO5WSeaGsTU(#Hj{$IBLLS4MPup1Rd07S(gC@ul0# zSw?#WfB*z znE8B|%PDdBVyna|R*gKN;163Yloe!VB{>A&<~SjHE%Y?cd8_HOas`ZSHve5NTYG+S z>Mchhc}WH4lmonMOT2GCb92m_(x}OK_>M+<>WtG3U^CBrU7`2n($d_kOq~6n0`MET zcNGtREJs?!E#+g$HM5c$B)6dTfRj$~v>-o8Pw!057#bq`zvmN;^#LVaS^~n@&alI8U|5hX= zaBxrk`XR*9R9!vYi{r1u?##rwvBD;Jb2&YnG6Z8Ed_cg6PXL(V$) zj2qtgU3K+~p8eq-^TQPj-9KDgAAi3=J8H4gz)Ya+zGrwoT%UyTiFNSpGld7T24zj+MW#;&j80sG4`Vx}Hr9GQI~nd zC8d4emX)wC&C2HH^Le0Y2r3s}1nm)eJYzvwec8!Lszv(!^&RnrUH)GN9 z3>|US{HLd;zE_@FA3fQWV^8I*4+7o4c``n4+`^d2{Vw{Hkf}jI;0G2Sx8>V17_N3R z_CB1qX_JxZY1Xfg9xb=#>Bv8N{N0pieww##HCTsjoD#?Oi&L)2fA)i?PoF=pUoEa< z|2D~?rhCTe%PCX0nJws)mfrA1c+an81^*ALRjTIl0OeY7K7A6~seO&n?Y%;IV?@MeZiArMSpn7QH zqR`T8R^hm1pE`D@ZQim#GT>Ek=|=f2^K(|$H#|^W8~(f`rgDGb|G(e;H~0S8a7%fg z$o#C$@yTzpAD<|(VP;vsa^=hNf|}iChYhNZ>G;nMmU(pXg?DFVXKlOMM-yiW35AM? zzfe3$-Y>(jp%n;zTqJ*<6w+lr>^7cP8IVsf}#6lgo|VD0>%H9gkW zHF=v3CxIIhrpOJ6J-c@83S&9w_I-8n(j)WF%&`o}LEp^T)aMzb378&t9XR%-rwW z)9Cnq=>qN|4#%q8B-fwiB5qf#3Pa~@tNQxt?!T+2X3a5b5Dk37YHKavE$Mgq!z-I3 zm#jraMJMmkn*a1wl0sUWcw^*Z?sw`LOCBy@44pn@%9D&E?mqL46zqiJGevfDcuh6@ zr`i1HnHqC5SDd?h`>g~AX016km7mVvQE5)ydA{L?N6pi^lkcXiusn8mUx}>WIA=7nSZcdrtM3eqMZjM}CanwYQH#j&HktY||b^=SN)kR)wyvYt~+P zYrDn6e*toFOq&HS%e7rvXeA*K-{F76+)9AgMbS`qqwNRrcN=Fm?r36vyxVZn*BNO- z7dCWpadE9`EW8kye%36aMc21R(e7eSu*$N~wSQO4)Q{evswMC;;^8A*mX9fC+a9m_ z%d+kkf5x#4YqKLK_bd4ATYuB<$jQhfCp8j6wtKXt-OD*J&7)1d>`~K=ugP!OyqypC ze%gPv?{Zkpp}l1rh2J$6-q@6S`r6~{Wo!2>h`lIzqGMn6gE*Fx`!*&YKX?53hsOP{ zZZ=ClEf*0JGkbGqXYq8okZ;NdxsG)g+<(W}th2Z7)|Slq_ctaVU*EX%w8EX1Sxn5F z-1j~{KEAuFtLv7c#(kfKcKiMI3P*f*{BrNh>O%(CnK%BP-_c#VLqhFV@&zYxSO0GH znnM#eJm8$SXV0F!i`{yodJgQnqh8aus?%gowL;Z<u7I^sI}!xmotUT`@6NpQqG$-CSd-p6 z*l5t|GF}J$7n=I|`vc=9@ybuD3f!lfx~V#QhjOf-&BKI;hgySEMEGYOOy_y-GOcZ5 z=_Rv;AMLwRTgqnSolp2-xHm(}B~DGCo_k-ht{mIy%OCD*RIyoKxXR%EcqhM7V6uTc z^8#m{xL0r9)NI+bspxluJny~6b+37P_SiAi*B(wVZff$o$ldi*@X+nZOeY+1Q&+qOvA11t~A#^uQ_15s4}C#|7TvHgQ(JD>-JUK9U0;s z#kMY8v?$5^-}h|Q*qID*96U<}cH9nJpHi~wx(?3?-?&iki=Vq9r=R}n^MOTuSCDo= za?Q@uGkP`n9$n_RxU!u=?!fcLZ{NNl23pxH-m)z}JI{8v0;p*h7IsYpG18jIV)(6T z$qUH`(f+Lb-%j5?SJ!#0qMtG52a}-ERUSJ&XO7t)D#iZKcMdBPQ$CpfG}z(6_QV|l zJd^!piY@yj+wOn*Xvz5h`7fp^Q!Nr37CmncbPmr3)V)?_b|tvbDyfH*{j7 zgT#UttWMQQQcf>_|GmmH-2rnoXatT@WxdR{wCcFODQ>D%<}_6RKF2-Z*eGVSi|eMdg*Udywgdi8%~CQ^E4q>*N=MR8^k*!(EU0{>d=0Wfgiq zpD*xUIpy%$xiv@rKi#ptmht}i$B*jy?w_A$U;poJ`uy5$j5QXuTIwtzYWYbIn$#ye zmF1c-=MU4I+UiegA9#!s)R|`-E0vojd*GYcw(A@B_M~rlYW-ivXo1rQmfbcJ0|Np+ zn5?U+;W@j|xH3vZ!lKLPLu$k>&eetgrR}Vp6SsQ1trFbRVf!+oz~Nq_)G1c>m`|GB zoSe)8`@Sb;U440Zx%S1swo*cygN=e`Klm!qytMDxNcf^(5Ox^n8QJnn_&OcLmCNL&4EKBCFc+H2-rMi`TjK}^?vV-p8A{H&)bEC%1S+q%h_D@-t^%5dd3D3 z+x|T&;-WeAy!*6mR~=fBbhRu~KXv22eQ~>XWN*B6svw2s@`v4qNwq6=760z%7S0Mc zF*B>%y=>XD<~Y6w*S9b8o2#YtBYejUN#XvzKepC4UCzlVU)*gi7IU33f5q+{Ze47< zc3i&TFt6oUN+?!YRD*{EqyB#V;z~yZm^*dw$_t zOJ83TTmIC=x_^;)uW0%AR^KmcME2a9aG<1Jhv)eD-jtfj)!#oGm$F?5;PY~8zxl^> z#=8sisyZ)vFL>el{OH-ei9)ukS=ajqoY2zQtWd-MSuS2aOs2;5@eS^U)jYA+do66= zomkzh#Wu(3qO?QjYwJTwRf&Ro?lE{C4w<(5uq)*Z{ zzw9cfE)u`*zEVz*?IQQ=2eCbzJ+J)EoH;Y6TlUh^z26@3|0$Ztm{RnKCyh7k{)&Su zUd!wM6SyGWHShb8+j>49nR9rot|(r(Zfat(Cn7xj z`mJ`c(s<3Pd%KT>U0nR&Xvf@5n>IcC`SWLd^NXpECIqn@fGi`hs1!<)e{-wpee|qZ zv+Ba5qpPjhM77F;zw9aR?p>7b%KYu#SLe19$~iB-O;h0TQWRS%u>bX+71!5VDdglc z{}xNQ-}LU)wG{cEMcnPPp9XxnlVV&Ixvf)6va>{H*8n*|U2& z51C6URq%GrYe?A1_TT@&wC72o&H?WvbJ_#n?bi5iaO7?5pZX0ucUGSN_4V~r)^iJg zf>M3fk!hmbd;uT!^iQ29Rp4(RKJ%LB;Wl3B)-xZtI38*IDX_HLEaxDa{}E z^4^brD(rNvE%y0`N}=cVHQ(OcoNVzw`A%{6wB(=PIhjRl-zy(vySVs4rM&u@gX(M= zRriE*cfAPwu%}<}+5=^f{7JLOFB%p1juY%eKGb|!2}&hDC0N#IS+HGTXlDzrw#dGwQ6;jc;8@a&HODv}wO){1dmtfq zk^8}50g;vmw#*Sh-A&JJ&jw~+P^l8xvqJBY-))Hl3s_n89hPSa+H%D;I38G4n|ffy zbdjH@di?ty^09qR--+>{rAAKr8+M;UW4OYB(ifcH@UeS22LDiNFg zd(Zr0N@n1Fv-N;h`q4ni57D47xO-r(nNdUew}0&K9+%$En0?ahr)HIi&1B`)8{{hVK!82=u472{84^F}?`ME{uA73a)6oB0A zSTV6QE8#)AfUTb7(u2Z<20JvXBnw|XI-hdDi|y6x*XMob+x;~*$ZMO*7L_LAl5est zUrbc=Z`Sj3bDz(hb)4tCX0grr3O2uaHa{&k?U{T`T1bfb&WSG?6^fieKd< zQ;zZIOKz)JGnFSHuu(O`K|V5b&QdqavtKkSrm?Y{^_s&N8N%SM@ArpCZe?R*$BVrt z#m~;{arsy<#Vl}H#hj}=30J2#{+pG)x{_qF z==GkpolAG0Wcc%y^~}ZB2W0l>NH z4rz6l&zj%=^J!h|ZnixYb0y~~`l*~rkVsf2&hvidm9BNUQE6$<^aGAD)F!u0=h|#z zF2ZAQ+4%g~6DN*~iHYrN54?T1_9B14fqnL$tR)qg=NlaGIlsrlVVOF&^OwsOX%)|Y zPV8V#YM2@4aKw6zSmZs8l*;M}Pxs!8cCr8Z`tC`8BL}uc#s_@#t@NY5E1j-hp>M_& z7jO1sE|1Cq23LK?NmFE)4*pK6to+%#w?Ly}ug{0cJSqnnT=h9OG1-}@tEZRgvv9@f z3;$7J_B3+1=sjse1K;sId#VFV&nF!h+0!uRK-SxYhDFQo_e<=Vu_5Q?rk71qnwH;> zcUduqv1?utJ7ZjUc=*Z%OCG%ZE-EN>fWg&&@8mq;77?4TbxIDw5({3u{3^0*YdqsF zo_$+=*7tXu31Hh`bMa}!#>ITSITyCxHMj~Cm3Ay4c5*U5CJON)G6+by9Sh1z2={eg( zoo1dTrx;xIL)jkBpFeS8;e^x9N1u1PPhh++@!(R>y@1{~>;C@u`1t3WOI3&Uy;Yg} zBodZA@7U(zcWYzi=V#m^dt6pLGE6z(&ZbfIZgMYUcW#gt>-pNeNF_;+nT%a=r$oMK zGsNCnyQ#V9dcW8|XSOc}4i}4$iwo?&e7sM#+SP0EgPn&py%m|~fy7&{#b3R8b*q=B zh)wv96vdPS)@&M8D+_O5y!g>4pL5Q%OQ%`vPc{^>S){5~vM;o*Ub1LWlG3?1Q#Q|h zsCr)UyaID0D1i#TwLctbo1~r|{6VJh#N-nW20Q^@gr3XZyu0$*vu9Up&o6lJHMRNv z$p%J{c-f_{S+iz+uI*n26;e@a4tD`7u=@tnY)|e%MPIv@mwX<+zuY zmHp#gwrI}IFC2ZB;!bh=S7&ZBJaF;$Kfc3zcmF?f;!XI5?YsZ$%WT;(h5w&FTTgPs z%zMlAoWr-V-n<+1MpB`yNM!ex`9(+bQw~J1X;jVM!PoTNAvE;rzKFh*>1JZacl_CS zQWVbIjqbQxygF>Hmh_q2GauNJ+xJgoJS@Rcxa|A0mBGu!ju(f!?P2}_%9Uw`8|wf6 z+tw+pe(l+_XZPC7OGRh2+Es3mSdw8;`|HbFY4f~48uxCB?5W`SSZ*(Taqjt z9Uc8XVt?J=g)Vno4tlq!$~m*~q%7!vaktCoy%e*rgvh22S+|t^k+HFRvoA3J{^N1* zwKLoPNsPB81TJQ0W>#)nupoiU<$YE3o5^`O)z#H6XPIUTiCJ%)+m!Cja)HlCpt(_4 z-LK@@_3QTWAt5G4wzhw}4f%}I%#C*ceSUtve&qJNyVfV0mOW5CEzz&eoMv=kZ}IbU zyAB;X#FkQ3-=urm#aN+izfIAT6Y)0x|9n=T^WeFSjry98GDZmo%-mu+Kb*?SzUeDg zna@aKYk9}C?fv748&8E87$5d-wVmh9#*>op{oP%4gWS|yKR-V+mnUKz^Rr|bj^&E$ z#q5x77S>fOtHkOanIBu6fZun`DdtPo)@n#%hEdH>lXcA__o=UkGrp~4(~ouYN4xt^YcIHckBP0I`RDF R7X}6f22WQ%mvv4FO#nljU3&lk literal 0 HcmV?d00001 diff --git a/docs/v0.5.1/index.html b/docs/v0.5.1/index.html new file mode 100644 index 0000000..81c9475 --- /dev/null +++ b/docs/v0.5.1/index.html @@ -0,0 +1,159 @@ + + + + + + API Document + + + + + + + + +
+ Home + Identifier + Source + + Repository + +
+ + + +

JSON API Store Build Status NPM Version

+

A lightweight JavaScript library that acts as a data store and uses the +JSON API specification. You can use it in the browser to +easily communicate with a JSON API compliant server.

+

Usage

+

Browser

+

At the moment the primary use can for JSON API Store is in the browser:

+

+// Create a new store instance.
+var adapter = new Store.AjaxAdapter({ base: "http://example.com/api/v1" });
+var store = new Store(adapter);
+
+// Define the "categories" type.
+store.define([ "categories", "category" ], {
+  title: Store.attr(),
+  products: Store.hasMany()
+});
+
+// Define the "products" type.
+store.define([ "products", "product" ], {
+  title: Store.attr(),
+  category: Store.hasOne()
+});
+
+// Load all the products.
+store.load("products", { include: [ "category" ] }, function (products) {
+
+  products.length; // 1
+  products[0].id; // "1"
+  products[0].title; // "Example Book"
+  products[0].category.id; // "1"
+  products[0].category.title; // "Books"
+
+  products[0] === store.find("products", "1"); // true
+  products[0].category === store.find("categories", "1"); // true
+
+});
+
+

Node

+

You can also use JSON API Store in a Node.js environment (adapters that work in +a Node.js are in the works):

+

NOTE: Without an adapter the create, load, update and destroy +methods cannot be used.

+

+var Store = require("json-api-store");
+
+var store = new Store();
+
+store.define([ "categories", "category" ], {
+  title: Store.attr(),
+  products: Store.hasMany()
+});
+
+store.define([ "products", "product" ], {
+  title: Store.attr(),
+  category: Store.hasOne()
+});
+
+store.add({
+  type: "products",
+  id: "1",
+  attributes: {
+    title: "Example Product"
+  },
+  relationships: {
+    category: {
+      data: {
+        type: "categories",
+        id: "1"
+      }
+    }
+  }
+});
+
+store.add({
+  type: "categories",
+  id: "1",
+  attributes: {
+    title: "Example Category"
+  }
+});
+
+store.find("products", "1").category.title; // "Example Category"
+
+

Installing

+

NPM

+
npm i json-api-store
+

Bower

+
bower i json-api-store
+

Download

+

To use directly in the browser you can grab the store.prod.js file.

+

Documentation

+

Documentation is available on the website:

+

http://particlesystem.com/json-api-store/

+
+
+ + + + + + + + + + + + diff --git a/docs/v0.5.1/package.json b/docs/v0.5.1/package.json new file mode 100644 index 0000000..d045fc8 --- /dev/null +++ b/docs/v0.5.1/package.json @@ -0,0 +1,33 @@ +{ + "name": "json-api-store", + "version": "0.5.0", + "description": "A lightweight library for using JSON API in the browser.", + "repository": "haydn/json-api-store", + "main": "dist/store.js", + "scripts": { + "build": "./scripts/build", + "docs": "./node_modules/.bin/esdoc -c esdoc.json", + "release": "./scripts/release", + "test": "./scripts/test" + }, + "author": "Haydn Ewers", + "license": "MIT", + "devDependencies": { + "babel": "^5.8.21", + "babelify": "^6.2.0", + "browserify": "^11.0.1", + "chokidar-cli": "^1.0.1", + "esdoc": "^0.2.2", + "eslint": "^1.3.1", + "exorcist": "^0.4.0", + "faucet": "0.0.1", + "sinon": "^1.16.1", + "tape-catch": "^1.0.4", + "tape-run": "^1.1.0", + "tape": "^4.2.0", + "uglifyify": "^3.0.1" + }, + "dependencies": { + "array.prototype.find": "^1.0.0" + } +} diff --git a/docs/v0.5.1/script/inherited-summary.js b/docs/v0.5.1/script/inherited-summary.js new file mode 100644 index 0000000..0a35b6d --- /dev/null +++ b/docs/v0.5.1/script/inherited-summary.js @@ -0,0 +1,28 @@ +(function(){ + function toggle(ev) { + var button = ev.target; + var parent = ev.target.parentElement; + while(parent) { + if (parent.tagName === 'TABLE' && parent.classList.contains('summary')) break; + parent = parent.parentElement; + } + + if (!parent) return; + + var tbody = parent.querySelector('tbody'); + if (button.classList.contains('opened')) { + button.classList.remove('opened'); + button.classList.add('closed'); + tbody.style.display = 'none'; + } else { + button.classList.remove('closed'); + button.classList.add('opened'); + tbody.style.display = 'block'; + } + } + + var buttons = document.querySelectorAll('.inherited-summary thead .toggle'); + for (var i = 0; i < buttons.length; i++) { + buttons[i].addEventListener('click', toggle); + } +})(); diff --git a/docs/v0.5.1/script/inner-link.js b/docs/v0.5.1/script/inner-link.js new file mode 100644 index 0000000..7762cb2 --- /dev/null +++ b/docs/v0.5.1/script/inner-link.js @@ -0,0 +1,18 @@ +// inner link(#foo) can not correctly scroll, because page has fixed header, +// so, I manually scroll. +(function(){ + function adjust() { + window.scrollBy(0, -55); + var el = document.querySelector('.inner-link-active'); + if (el) el.classList.remove('inner-link-active'); + + var el = document.querySelector(location.hash); + if (el) el.classList.add('inner-link-active'); + } + + window.addEventListener('hashchange', adjust); + + if (location.hash) { + setTimeout(adjust, 0); + } +})(); diff --git a/docs/v0.5.1/script/patch-for-local.js b/docs/v0.5.1/script/patch-for-local.js new file mode 100644 index 0000000..5756d13 --- /dev/null +++ b/docs/v0.5.1/script/patch-for-local.js @@ -0,0 +1,8 @@ +(function(){ + if (location.protocol === 'file:') { + var elms = document.querySelectorAll('a[href="./"]'); + for (var i = 0; i < elms.length; i++) { + elms[i].href = './index.html'; + } + } +})(); diff --git a/docs/v0.5.1/script/prettify/Apache-License-2.0.txt b/docs/v0.5.1/script/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/docs/v0.5.1/script/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/v0.5.1/script/prettify/prettify.js b/docs/v0.5.1/script/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/docs/v0.5.1/script/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p' + pair[2] + ''); + } + } + + var innerHTML = ''; + for (kind in html) { + var list = html[kind]; + if (!list.length) continue; + innerHTML += '
  • ' + kind + '
  • \n' + list.join('\n'); + } + result.innerHTML = innerHTML; + if (innerHTML) result.style.display = 'block'; + selectedIndex = -1; + }); + + // down, up and enter key are pressed, select search result. + input.addEventListener('keydown', function(ev){ + if (ev.keyCode === 40) { + // arrow down + var current = result.children[selectedIndex]; + var selected = result.children[selectedIndex + 1]; + if (selected && selected.classList.contains('search-separator')) { + var selected = result.children[selectedIndex + 2]; + selectedIndex++; + } + + if (selected) { + if (current) current.classList.remove('selected'); + selectedIndex++; + selected.classList.add('selected'); + } + } else if (ev.keyCode === 38) { + // arrow up + var current = result.children[selectedIndex]; + var selected = result.children[selectedIndex - 1]; + if (selected && selected.classList.contains('search-separator')) { + var selected = result.children[selectedIndex - 2]; + selectedIndex--; + } + + if (selected) { + if (current) current.classList.remove('selected'); + selectedIndex--; + selected.classList.add('selected'); + } + } else if (ev.keyCode === 13) { + // enter + var current = result.children[selectedIndex]; + if (current) { + var link = current.querySelector('a'); + if (link) location.href = link.href; + } + } else { + return; + } + + ev.preventDefault(); + }); + + // select search result when search result is mouse over. + result.addEventListener('mousemove', function(ev){ + var current = result.children[selectedIndex]; + if (current) current.classList.remove('selected'); + + var li = ev.target; + while (li) { + if (li.nodeName === 'LI') break; + li = li.parentElement; + } + + if (li) { + selectedIndex = Array.prototype.indexOf.call(result.children, li); + li.classList.add('selected'); + } + }); + + // clear search result when body is clicked. + document.body.addEventListener('click', function(ev){ + selectedIndex = -1; + result.style.display = 'none'; + result.innerHTML = ''; + }); + +})(); diff --git a/docs/v0.5.1/script/search_index.js b/docs/v0.5.1/script/search_index.js new file mode 100644 index 0000000..35ad434 --- /dev/null +++ b/docs/v0.5.1/script/search_index.js @@ -0,0 +1,476 @@ +window.esdocSearchIndex = [ + [ + "json-api-store/src/ajax-adapter.js~ajaxadapter", + "class/src/ajax-adapter.js~AjaxAdapter.html", + "AjaxAdapter json-api-store/src/ajax-adapter.js", + "class" + ], + [ + "json-api-store/src/store.js~store", + "class/src/store.js~Store.html", + "Store json-api-store/src/store.js", + "class" + ], + [ + "builtinexternal/ecmascriptexternal.js~array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~arraybuffer", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~ArrayBuffer", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~boolean", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Boolean", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~dataview", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~DataView", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~date", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Date", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~error", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Error", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~evalerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~EvalError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~float32array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Float32Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~float64array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Float64Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~function", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Function", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~generator", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Generator", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~generatorfunction", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~GeneratorFunction", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~infinity", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Infinity", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~int16array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Int16Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~int32array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Int32Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~int8array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Int8Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~internalerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~InternalError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~json", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~JSON", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~map", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Map", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~nan", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~NaN", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~number", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Number", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~object", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Object", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~promise", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Promise", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~proxy", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Proxy", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~rangeerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~RangeError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~referenceerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~ReferenceError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~reflect", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Reflect", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~regexp", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~RegExp", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~set", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Set", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~string", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~String", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~symbol", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Symbol", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~syntaxerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~SyntaxError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~typeerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~TypeError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~urierror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~URIError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint16array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint16Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint32array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint32Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint8array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint8Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint8clampedarray", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint8ClampedArray", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~weakmap", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~WeakMap", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~weakset", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~WeakSet", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~boolean", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~boolean", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~function", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~function", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~null", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~null", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~number", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~number", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~object", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~object", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~string", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~string", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~undefined", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~undefined", + "external" + ], + [ + "builtinexternal/webapiexternal.js~canvasrenderingcontext2d", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~CanvasRenderingContext2D", + "external" + ], + [ + "builtinexternal/webapiexternal.js~documentfragment", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~DocumentFragment", + "external" + ], + [ + "builtinexternal/webapiexternal.js~element", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~Element", + "external" + ], + [ + "builtinexternal/webapiexternal.js~event", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~Event", + "external" + ], + [ + "builtinexternal/webapiexternal.js~node", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~Node", + "external" + ], + [ + "builtinexternal/webapiexternal.js~nodelist", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~NodeList", + "external" + ], + [ + "builtinexternal/webapiexternal.js~xmlhttprequest", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest", + "external" + ], + [ + "src/ajax-adapter.js", + "file/src/ajax-adapter.js.html", + "src/ajax-adapter.js", + "file" + ], + [ + "src/ajax-adapter.js~ajaxadapter#constructor", + "class/src/ajax-adapter.js~AjaxAdapter.html#instance-constructor-constructor", + "src/ajax-adapter.js~AjaxAdapter#constructor", + "method" + ], + [ + "src/ajax-adapter.js~ajaxadapter#create", + "class/src/ajax-adapter.js~AjaxAdapter.html#instance-method-create", + "src/ajax-adapter.js~AjaxAdapter#create", + "method" + ], + [ + "src/ajax-adapter.js~ajaxadapter#destroy", + "class/src/ajax-adapter.js~AjaxAdapter.html#instance-method-destroy", + "src/ajax-adapter.js~AjaxAdapter#destroy", + "method" + ], + [ + "src/ajax-adapter.js~ajaxadapter#load", + "class/src/ajax-adapter.js~AjaxAdapter.html#instance-method-load", + "src/ajax-adapter.js~AjaxAdapter#load", + "method" + ], + [ + "src/ajax-adapter.js~ajaxadapter#update", + "class/src/ajax-adapter.js~AjaxAdapter.html#instance-method-update", + "src/ajax-adapter.js~AjaxAdapter#update", + "method" + ], + [ + "src/store.js", + "file/src/store.js.html", + "src/store.js", + "file" + ], + [ + "src/store.js~store#add", + "class/src/store.js~Store.html#instance-method-add", + "src/store.js~Store#add", + "method" + ], + [ + "src/store.js~store#constructor", + "class/src/store.js~Store.html#instance-constructor-constructor", + "src/store.js~Store#constructor", + "method" + ], + [ + "src/store.js~store#convert", + "class/src/store.js~Store.html#instance-method-convert", + "src/store.js~Store#convert", + "method" + ], + [ + "src/store.js~store#create", + "class/src/store.js~Store.html#instance-method-create", + "src/store.js~Store#create", + "method" + ], + [ + "src/store.js~store#define", + "class/src/store.js~Store.html#instance-method-define", + "src/store.js~Store#define", + "method" + ], + [ + "src/store.js~store#destroy", + "class/src/store.js~Store.html#instance-method-destroy", + "src/store.js~Store#destroy", + "method" + ], + [ + "src/store.js~store#find", + "class/src/store.js~Store.html#instance-method-find", + "src/store.js~Store#find", + "method" + ], + [ + "src/store.js~store#load", + "class/src/store.js~Store.html#instance-method-load", + "src/store.js~Store#load", + "method" + ], + [ + "src/store.js~store#off", + "class/src/store.js~Store.html#instance-method-off", + "src/store.js~Store#off", + "method" + ], + [ + "src/store.js~store#on", + "class/src/store.js~Store.html#instance-method-on", + "src/store.js~Store#on", + "method" + ], + [ + "src/store.js~store#push", + "class/src/store.js~Store.html#instance-method-push", + "src/store.js~Store#push", + "method" + ], + [ + "src/store.js~store#remove", + "class/src/store.js~Store.html#instance-method-remove", + "src/store.js~Store#remove", + "method" + ], + [ + "src/store.js~store#update", + "class/src/store.js~Store.html#instance-method-update", + "src/store.js~Store#update", + "method" + ], + [ + "src/store.js~store.attr", + "class/src/store.js~Store.html#static-method-attr", + "src/store.js~Store.attr", + "method" + ], + [ + "src/store.js~store.hasmany", + "class/src/store.js~Store.html#static-method-hasMany", + "src/store.js~Store.hasMany", + "method" + ], + [ + "src/store.js~store.hasone", + "class/src/store.js~Store.html#static-method-hasOne", + "src/store.js~Store.hasOne", + "method" + ] +] \ No newline at end of file diff --git a/docs/v0.5.1/script/test-summary.js b/docs/v0.5.1/script/test-summary.js new file mode 100644 index 0000000..2f32cb0 --- /dev/null +++ b/docs/v0.5.1/script/test-summary.js @@ -0,0 +1,54 @@ +(function(){ + function toggle(ev) { + var button = ev.target; + var parent = ev.target.parentElement; + while(parent) { + if (parent.tagName === 'TR' && parent.classList.contains('test-describe')) break; + parent = parent.parentElement; + } + + if (!parent) return; + + var direction; + if (button.classList.contains('opened')) { + button.classList.remove('opened'); + button.classList.add('closed'); + direction = 'closed'; + } else { + button.classList.remove('closed'); + button.classList.add('opened'); + direction = 'opened'; + } + + var targetDepth = parseInt(parent.dataset.testDepth, 10) + 1; + var nextElement = parent.nextElementSibling; + while (nextElement) { + var depth = parseInt(nextElement.dataset.testDepth, 10); + if (depth >= targetDepth) { + if (direction === 'opened') { + if (depth === targetDepth) nextElement.style.display = ''; + } else if (direction === 'closed') { + nextElement.style.display = 'none'; + var innerButton = nextElement.querySelector('.toggle'); + if (innerButton && innerButton.classList.contains('opened')) { + innerButton.classList.remove('opened'); + innerButton.classList.add('closed'); + } + } + } else { + break; + } + nextElement = nextElement.nextElementSibling; + } + } + + var buttons = document.querySelectorAll('.test-summary tr.test-describe .toggle'); + for (var i = 0; i < buttons.length; i++) { + buttons[i].addEventListener('click', toggle); + } + + var topDescribes = document.querySelectorAll('.test-summary tr[data-test-depth="0"]'); + for (var i = 0; i < topDescribes.length; i++) { + topDescribes[i].style.display = ''; + } +})(); diff --git a/docs/v0.5.1/source.html b/docs/v0.5.1/source.html new file mode 100644 index 0000000..8a93f60 --- /dev/null +++ b/docs/v0.5.1/source.html @@ -0,0 +1,97 @@ + + + + + + Source | API Document + + + + + + + + +
    + Home + Identifier + Source + + Repository + +
    + + + +

    Source 15/23

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FileIdentifierDocumentSizeLinesUpdated
    src/ajax-adapter.jsAjaxAdapter0 %0/64812 byte1882015-09-03 07:37:25 (UTC)
    src/store.jsStore88 %15/1721865 byte5902015-09-03 07:37:25 (UTC)
    +
    + + + + + + + + + + + + diff --git a/index.html b/index.html index fc58022..a920fb2 100644 --- a/index.html +++ b/index.html @@ -184,14 +184,14 @@
    npm i json-api-store
    diff --git a/releases/v0.5.1/ajax-adapter.js b/releases/v0.5.1/ajax-adapter.js new file mode 100644 index 0000000..67ff286 --- /dev/null +++ b/releases/v0.5.1/ajax-adapter.js @@ -0,0 +1,209 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var AjaxAdapter = (function () { + function AjaxAdapter(options) { + _classCallCheck(this, AjaxAdapter); + + this._base = options && options.base || ""; + } + + _createClass(AjaxAdapter, [{ + key: 'create', + value: function create(store, type, partial, success, error, context) { + var _this = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.create(store, type, partial, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + + request.open('POST', _this._base + '/' + type, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + var response = JSON.parse(request.responseText); + try { + store.push(response); + if (success) { + success.call(context, store.find(response.data.type, response.data.id)); + } + } catch (e) { + if (error) { + error.call(context, e); + } + } + } else { + if (error) { + error.call(context); + } + } + }; + + request.send({ + data: JSON.stringify(store.convert(type, partial)) + }); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'destroy', + value: function destroy(store, type, id, success, error, context) { + var _this2 = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.destroy(store, type, id, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + + request.open('DELETE', _this2._base + '/' + type + '/' + id, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.remove(type, id); + if (success) { + success.call(context); + } + } catch (e) { + error.call(context, e); + } + } else if (error) { + error.call(context); + } + }; + + request.send(); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'load', + value: function load(store, type, id, options, success, error, context) { + var _this3 = this; + + if (id && ({}).toString.call(id) === '[object Function]') { + this.load(store, type, null, null, id, options, success); + } else if (id && typeof id === "object") { + this.load(store, type, null, id, options, success, error); + } else if (options && ({}).toString.call(options) === '[object Function]') { + this.load(store, type, id, {}, options, success, error); + } else if (error && ({}).toString.call(error) !== '[object Function]') { + this.load(store, type, id, options, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + var url = undefined; + + options = options || {}; + url = id ? _this3._base + '/' + type + '/' + id : _this3._base + '/' + type; + + if (options) { + + var params = []; + + if (options.fields) { + Object.keys(options.fields).forEach(function (field) { + options['fields[' + field + ']'] = options.fields[field]; + }); + delete options.fields; + } + + params = Object.keys(options).map(function (key) { + return key + "=" + encodeURIComponent(options[key]); + }).sort(); + + if (params.length) { + url = url + '?' + params.join("&"); + } + } + + request.open('GET', url, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.push(JSON.parse(request.responseText)); + if (success) { + success.call(context, id ? store.find(type, id) : store.find(type)); + } + } catch (e) { + error.call({}, e); + } + } else if (error) { + error.call(context); + } + }; + + request.send(); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'update', + value: function update(store, type, id, partial, success, error, context) { + var _this4 = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.update(store, type, id, partial, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + var data = store.convert(type, id, partial); + + request.open('PATCH', _this4._base + '/' + type + '/' + id, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.add(data); + if (success) { + success.call(context, store.find(data.type, data.id)); + } + } catch (e) { + if (error) { + error.call(context, e); + } + } + } else if (error) { + error.call(context); + } + }; + + request.send({ + data: JSON.stringify(data) + }); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }]); + + return AjaxAdapter; +})(); + +exports['default'] = AjaxAdapter; +module.exports = exports['default']; diff --git a/releases/v0.5.1/store.dev.js b/releases/v0.5.1/store.dev.js new file mode 100644 index 0000000..97537da --- /dev/null +++ b/releases/v0.5.1/store.dev.js @@ -0,0 +1,968 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Store = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o +// For all details and docs: https://github.com/paulmillr/array.prototype.find +// Fixes and tests supplied by Duncan Hall +(function(globals){ + if (Array.prototype.find) return; + + var find = function(predicate) { + var list = Object(this); + var length = list.length < 0 ? 0 : list.length >>> 0; // ES.ToUint32; + if (length === 0) return undefined; + if (typeof predicate !== 'function' || Object.prototype.toString.call(predicate) !== '[object Function]') { + throw new TypeError('Array#find: predicate must be a function'); + } + var thisArg = arguments[1]; + for (var i = 0, value; i < length; i++) { + value = list[i]; + if (predicate.call(thisArg, value, i, list)) return value; + } + return undefined; + }; + + if (Object.defineProperty) { + try { + Object.defineProperty(Array.prototype, 'find', { + value: find, configurable: true, enumerable: false, writable: true + }); + } catch(e) {} + } + + if (!Array.prototype.find) { + Array.prototype.find = find; + } +})(this); + +},{}],2:[function(require,module,exports){ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +var AjaxAdapter = (function () { + function AjaxAdapter(options) { + _classCallCheck(this, AjaxAdapter); + + this._base = options && options.base || ""; + } + + _createClass(AjaxAdapter, [{ + key: 'create', + value: function create(store, type, partial, success, error, context) { + var _this = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.create(store, type, partial, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + + request.open('POST', _this._base + '/' + type, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + var response = JSON.parse(request.responseText); + try { + store.push(response); + if (success) { + success.call(context, store.find(response.data.type, response.data.id)); + } + } catch (e) { + if (error) { + error.call(context, e); + } + } + } else { + if (error) { + error.call(context); + } + } + }; + + request.send({ + data: JSON.stringify(store.convert(type, partial)) + }); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'destroy', + value: function destroy(store, type, id, success, error, context) { + var _this2 = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.destroy(store, type, id, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + + request.open('DELETE', _this2._base + '/' + type + '/' + id, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.remove(type, id); + if (success) { + success.call(context); + } + } catch (e) { + error.call(context, e); + } + } else if (error) { + error.call(context); + } + }; + + request.send(); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'load', + value: function load(store, type, id, options, success, error, context) { + var _this3 = this; + + if (id && ({}).toString.call(id) === '[object Function]') { + this.load(store, type, null, null, id, options, success); + } else if (id && typeof id === "object") { + this.load(store, type, null, id, options, success, error); + } else if (options && ({}).toString.call(options) === '[object Function]') { + this.load(store, type, id, {}, options, success, error); + } else if (error && ({}).toString.call(error) !== '[object Function]') { + this.load(store, type, id, options, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + var url = undefined; + + options = options || {}; + url = id ? _this3._base + '/' + type + '/' + id : _this3._base + '/' + type; + + if (options) { + + var params = []; + + if (options.fields) { + Object.keys(options.fields).forEach(function (field) { + options['fields[' + field + ']'] = options.fields[field]; + }); + delete options.fields; + } + + params = Object.keys(options).map(function (key) { + return key + "=" + encodeURIComponent(options[key]); + }).sort(); + + if (params.length) { + url = url + '?' + params.join("&"); + } + } + + request.open('GET', url, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.push(JSON.parse(request.responseText)); + if (success) { + success.call(context, id ? store.find(type, id) : store.find(type)); + } + } catch (e) { + error.call({}, e); + } + } else if (error) { + error.call(context); + } + }; + + request.send(); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }, { + key: 'update', + value: function update(store, type, id, partial, success, error, context) { + var _this4 = this; + + if (error && ({}).toString.call(error) !== '[object Function]') { + + this.update(store, type, id, partial, success, null, error); + } else if (store._types[type]) { + (function () { + + var request = new XMLHttpRequest(); + var data = store.convert(type, id, partial); + + request.open('PATCH', _this4._base + '/' + type + '/' + id, true); + + request.onload = function () { + if (request.status >= 200 && request.status < 300) { + try { + store.add(data); + if (success) { + success.call(context, store.find(data.type, data.id)); + } + } catch (e) { + if (error) { + error.call(context, e); + } + } + } else if (error) { + error.call(context); + } + }; + + request.send({ + data: JSON.stringify(data) + }); + })(); + } else { + throw new Error('Unknown type \'' + type + '\''); + } + } + }]); + + return AjaxAdapter; +})(); + +exports['default'] = AjaxAdapter; +module.exports = exports['default']; + +},{}],3:[function(require,module,exports){ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +require("array.prototype.find"); + +var _ajaxAdapter = require("./ajax-adapter"); + +var _ajaxAdapter2 = _interopRequireDefault(_ajaxAdapter); + +var Store = (function () { + _createClass(Store, null, [{ + key: "attr", + + /** + * Creates a field definition for an attribute. + * + * @since 0.1.0 + * @param {string} [name] - Name of the property to map this field from. + * @param {Object} [options] - An options object. + * @param {string} [options.default] - Default value for this field. + * @return {Object} - Field definition. + */ + value: function attr(name, options) { + if (name && typeof name === 'object') { + return Store.attr(null, name); + } else { + return { + type: "attr", + "default": options && options["default"], + deserialize: function deserialize(data, key) { + return data.attributes && data.attributes[name || key]; + }, + serialize: function serialize(resource, data, key) { + data.attributes[name || key] = resource[key]; + } + }; + } + } + + /** + * Creates a field definition for an has-one relationship. + * + * @since 0.1.0 + * @param {string} [name] - Name of the property to map this field from. + * @param {Object} [options] - An options object. + * @param {string} [options.inverse] - Name of the inverse relationship. + * @return {Object} - Field definition. + */ + }, { + key: "hasOne", + value: function hasOne(name, options) { + if (name && typeof name === 'object') { + return Store.hasOne(null, name); + } else { + return { + type: "has-one", + inverse: options && options.inverse, + deserialize: function deserialize(data, key) { + name = name || key; + if (data.relationships && data.relationships[name]) { + if (data.relationships[name].data === null) { + return null; + } else if (data.relationships[name].data) { + return this.find(data.relationships[name].data.type, data.relationships[name].data.id); + } + } + } + }; + } + } + + /** + * Creates a field definition for an has-many relationship. + * + * @since 0.1.0 + * @param {string} [name] - Name of the property to map this field from. + * @param {Object} [options] - An options object. + * @param {string} [options.inverse] - Name of the inverse relationship. + * @return {Object} - Field definition. + */ + }, { + key: "hasMany", + value: function hasMany(name, options) { + if (name && typeof name === 'object') { + return Store.hasMany(null, name); + } else { + return { + type: "has-many", + "default": [], + inverse: options && options.inverse, + deserialize: function deserialize(data, key) { + var _this = this; + + name = name || key; + if (data.relationships && data.relationships[name]) { + if (data.relationships[name].data === null) { + return []; + } else if (data.relationships[name].data) { + return data.relationships[name].data.map(function (c) { + return _this.find(c.type, c.id); + }); + } + } + } + }; + } + } + }]); + + function Store(adapter) { + _classCallCheck(this, Store); + + this._adapter = adapter; + this._collectionListeners = { "added": {}, "updated": {}, "removed": {} }; + this._data = {}; + this._resourceListeners = { "added": {}, "updated": {}, "removed": {} }; + this._types = {}; + } + + /** + * Add an individual resource to the store. This is used internally by the + * `push()` method. + * + * @since 0.1.0 + * @param {!Object} object - Resource Object to add. See: + http://jsonapi.org/format/#document-resource-objects + * @return {undefined} - Nothing. + */ + + _createClass(Store, [{ + key: "add", + value: function add(object) { + var _this2 = this; + + if (object) { + if (object.type && object.id) { + (function () { + var event = _this2._data[object.type] && _this2._data[object.type][object.id] ? "updated" : "added"; + var resource = _this2.find(object.type, object.id); + var definition = _this2._types[object.type]; + Object.keys(definition).forEach(function (fieldName) { + if (fieldName[0] !== "_") { + _this2._addField(object, resource, definition, fieldName); + } + }); + if (_this2._resourceListeners[event][object.type] && _this2._resourceListeners[event][object.type][object.id]) { + _this2._resourceListeners[event][object.type][object.id].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + if (_this2._collectionListeners[event][object.type]) { + _this2._collectionListeners[event][object.type].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + })(); + } else { + throw new TypeError("The data must have a type and id"); + } + } else { + throw new TypeError("You must provide data to add"); + } + } + + /** + * Converts the given partial into a JSON API compliant representation. + * + * @since 0.5.0 + * @param {!string} [type] - The type of the resource. This can be omitted if the partial includes a type property. + * @param {!string} [id] - The id of the resource. This can be omitted if the partial includes an id property. + * @param {!object} partial - The data to convert. + * @return {object} - JSON API version of the object. + */ + }, { + key: "convert", + value: function convert(type, id, partial) { + var _this3 = this; + + if (type && typeof type === "object") { + return this.convert(type.type, type.id, type); + } else if (id && typeof id === "object") { + return this.convert(type, id.id, id); + } else { + var _ret2 = (function () { + var data = { + type: type, + attributes: {}, + relationships: {} + }; + if (id) { + data.id = id; + } + var definition = _this3._types[data.type]; + Object.keys(definition).forEach(function (fieldName) { + if (fieldName[0] !== "_") { + definition[fieldName].serialize(partial, data, fieldName); + } + }); + return { + v: data + }; + })(); + + if (typeof _ret2 === "object") return _ret2.v; + } + } + + /** + * Attempts to create the resource through the adapter and adds it to the + * store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!Object} partial - Data to create the resource with. + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.create("product", { title: "A Book" }, (product) => { + * console.log(product.title); + * }); + */ + }, { + key: "create", + value: function create(type, partial, success, error, context) { + if (this._adapter) { + this._adapter.create(this, type, partial, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + + /** + * Defines a type of resource. + * + * @since 0.2.0 + * @param {!string|string[]} names - Name(s) of the resource. + * @param {!Object} definition - The resource's definition. + * @return {undefined} - Nothing. + */ + }, { + key: "define", + value: function define(names, definition) { + var _this4 = this; + + names = names.constructor === Array ? names : [names]; + if (definition) { + definition._names = names; + names.forEach(function (name) { + if (!_this4._types[name]) { + _this4._types[name] = definition; + } else { + throw new Error("The type '" + name + "' has already been defined."); + } + }); + } else { + throw new Error("You must provide a definition for the type '" + names[0] + "'."); + } + } + + /** + * Attempts to delete the resource through the adapter and removes it from + * the store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!string} id - ID of resource. + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.destroy("product", "1", () => { + * console.log("Destroyed!"); + * }); + */ + }, { + key: "destroy", + value: function destroy(type, id, success, error, context) { + if (this._adapter) { + this._adapter.destroy(this, type, id, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + + /** + * Find a resource or entire collection of resources. + * + * NOTE: If the resource hasn't been loaded via an add() or push() call it + * will be automatically created when find is called. + * + * @since 0.1.0 + * @param {!string} type - Type of the resource(s) to find. + * @param {string} [id] - The id of the resource to find. If omitted all + * resources of the type will be returned. + * @return {Object|Object[]} - Either the resource or an array of resources. + */ + }, { + key: "find", + value: function find(type, id) { + var _this5 = this; + + if (type) { + var _ret3 = (function () { + var definition = _this5._types[type]; + if (definition) { + if (!_this5._data[type]) { + (function () { + var collection = {}; + definition._names.forEach(function (t) { + return _this5._data[t] = collection; + }); + })(); + } + if (id) { + if (!_this5._data[type][id]) { + _this5._data[type][id] = { + _dependents: [], + type: type, + id: id + }; + Object.keys(definition).forEach(function (key) { + if (key[0] !== "_") { + _this5._data[type][id][key] = definition[key]["default"]; + } + }); + } + return { + v: _this5._data[type][id] + }; + } else { + return { + v: Object.keys(_this5._data[type]).map(function (x) { + return _this5._data[type][x]; + }) + }; + } + } else { + throw new TypeError("Unknown type '" + type + "'"); + } + })(); + + if (typeof _ret3 === "object") return _ret3.v; + } else { + throw new TypeError("You must provide a type"); + } + } + + /** + * Attempts to load the resource(s) through the adapter and adds it/them to + * the store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!string} [id] - ID of resource. + * @param {Object} [options] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options) + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.load("product", "1", (product) => { + * console.log(product.title); + * }); + */ + }, { + key: "load", + value: function load(type, id, options, success, error, context) { + if (this._adapter) { + this._adapter.load(this, type, id, options, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + + /** + * Unregister an event listener that was registered with on(). + * + * @since 0.4.0 + * @param {string} event - Name of the event. + * @param {string} type - Name of resource to originally passed to on(). + * @param {string} [id] - ID of the resource to originally passed to on(). + * @param {function} callback - Function originally passed to on(). + * @return {undefined} - Nothing. + */ + }, { + key: "off", + value: function off(event, type, id, callback) { + var _this6 = this; + + if (this._resourceListeners[event] && this._collectionListeners[event]) { + if (this._types[type]) { + if (id && ({}).toString.call(id) === '[object Function]') { + this.off.call(this, event, type, null, id, callback); + } else { + // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists. + this._types[type]._names.forEach(function (type) { + if (id) { + if (_this6._resourceListeners[event][type] && _this6._resourceListeners[event][type][id]) { + _this6._resourceListeners[event][type][id] = _this6._resourceListeners[event][type][id].filter(function (x) { + return x[0] !== callback; + }); + } + } else if (_this6._collectionListeners[event][type]) { + _this6._collectionListeners[event][type] = _this6._collectionListeners[event][type].filter(function (x) { + return x[0] !== callback; + }); + } + }); + } + } else { + throw new Error("Unknown type '" + type + "'"); + } + } else { + throw new Error("Unknown event '" + event + "'"); + } + } + + /** + * Register an event listener: "added", "updated" or "removed". + * + * @since 0.4.0 + * @param {string} event - Name of the event. + * @param {string} type - Name of resource to watch. + * @param {string} [id] - ID of the resource to watch. + * @param {function} callback - Function to call when the event occurs. + * @param {Object} [context] - Context in which to call the callback. + * @return {undefined} - Nothing. + */ + }, { + key: "on", + value: function on(event, type, id, callback, context) { + var _this7 = this; + + if (this._resourceListeners[event] && this._collectionListeners[event]) { + if (this._types[type]) { + if (id && ({}).toString.call(id) === '[object Function]') { + this.on.call(this, event, type, null, id, callback); + } else { + // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists. + this._types[type]._names.forEach(function (type) { + if (id) { + _this7._resourceListeners[event][type] = _this7._resourceListeners[event][type] || {}; + _this7._resourceListeners[event][type][id] = _this7._resourceListeners[event][type][id] || []; + if (!_this7._resourceListeners[event][type][id].find(function (x) { + return x[0] === callback; + })) { + _this7._resourceListeners[event][type][id].push([callback, context]); + } + } else { + _this7._collectionListeners[event][type] = _this7._collectionListeners[event][type] || []; + if (!_this7._collectionListeners[event][type].find(function (x) { + return x[0] === callback; + })) { + _this7._collectionListeners[event][type].push([callback, context]); + } + } + }); + } + } else { + throw new Error("Unknown type '" + type + "'"); + } + } else { + throw new Error("Unknown event '" + event + "'"); + } + } + + /** + * Add a JSON API response to the store. This method can be used to handle a + * successful GET or POST response from the server. + * + * @since 0.1.0 + * @param {Object} root - Top Level Object to push. See: + http://jsonapi.org/format/#document-top-level + * @return {undefined} - Nothing. + */ + }, { + key: "push", + value: function push(root) { + var _this8 = this; + + if (root.data.constructor === Array) { + root.data.forEach(function (x) { + return _this8.add(x); + }); + } else { + this.add(root.data); + } + if (root.included) { + root.included.forEach(function (x) { + return _this8.add(x); + }); + } + } + + /** + * Remove a resource or collection of resources from the store. + * + * @since 0.1.0 + * @param {!string} type - Type of the resource(s) to remove. + * @param {string} [id] - The id of the resource to remove. If omitted all + * resources of the type will be removed. + * @return {undefined} - Nothing. + */ + }, { + key: "remove", + value: function remove(type, id) { + var _this9 = this; + + if (type) { + if (this._types[type]) { + if (id) { + (function () { + var resource = _this9._data[type] && _this9._data[type][id]; + if (resource) { + _this9._remove(resource); + if (_this9._resourceListeners["removed"][type] && _this9._resourceListeners["removed"][type][id]) { + _this9._resourceListeners["removed"][type][id].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + if (_this9._collectionListeners["removed"][type]) { + _this9._collectionListeners["removed"][type].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + } + })(); + } else { + Object.keys(this._data[type]).forEach(function (id) { + return _this9.remove(type, id); + }); + } + } else { + throw new TypeError("Unknown type '" + type + "'"); + } + } else { + throw new TypeError("You must provide a type to remove"); + } + } + + /** + * Attempts to update the resource through the adapter and updates it in the + * store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!string} id - ID of resource. + * @param {!Object} partial - Data to update the resource with. + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.update("product", "1", { title: "foo" }, (product) => { + * console.log(product.title); + * }); + */ + }, { + key: "update", + value: function update(type, id, partial, success, error, context) { + if (this._adapter) { + this._adapter.update(this, type, id, partial, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + }, { + key: "_addField", + value: function _addField(object, resource, definition, fieldName) { + var _this10 = this; + + var field = definition[fieldName]; + var newValue = field.deserialize.call(this, object, fieldName); + if (typeof newValue !== "undefined") { + if (field.type === "has-one") { + if (resource[fieldName]) { + this._removeInverseRelationship(resource, fieldName, resource[fieldName], field); + } + if (newValue) { + this._addInverseRelationship(resource, fieldName, newValue, field); + } + } else if (field.type === "has-many") { + resource[fieldName].forEach(function (r) { + if (resource[fieldName].indexOf(r) !== -1) { + _this10._removeInverseRelationship(resource, fieldName, r, field); + } + }); + newValue.forEach(function (r) { + _this10._addInverseRelationship(resource, fieldName, r, field); + }); + } + resource[fieldName] = newValue; + } + } + }, { + key: "_addInverseRelationship", + value: function _addInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) { + var targetDefinition = this._types[targetResource.type]; + var sourceDefinition = this._types[sourceResource.type]; + if (targetDefinition) { + var targetFieldName = [sourceField.inverse].concat(sourceDefinition._names).find(function (x) { + return targetDefinition[x]; + }); + var targetField = targetDefinition && targetDefinition[targetFieldName]; + targetResource._dependents.push({ type: sourceResource.type, id: sourceResource.id, fieldName: sourceFieldName }); + if (targetField) { + if (targetField.type === "has-one") { + sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName }); + targetResource[targetFieldName] = sourceResource; + } else if (targetField.type === "has-many") { + sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName }); + if (targetResource[targetFieldName].indexOf(sourceResource) === -1) { + targetResource[targetFieldName].push(sourceResource); + } + } else if (targetField.type === "attr") { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is an attribute ('" + targetFieldName + "')"); + } + } else if (sourceField.inverse) { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is missing ('" + sourceField.inverse + "')"); + } + } + } + }, { + key: "_remove", + value: function _remove(resource) { + var _this11 = this; + + resource._dependents.forEach(function (dependent) { + var dependentResource = _this11._data[dependent.type][dependent.id]; + switch (_this11._types[dependent.type][dependent.fieldName].type) { + case "has-one": + { + dependentResource[dependent.fieldName] = null; + break; + } + case "has-many": + { + var index = dependentResource[dependent.fieldName].indexOf(resource); + if (index !== -1) { + dependentResource[dependent.fieldName].splice(index, 1); + } + break; + } + default: + { + break; + } + } + // TODO: This only needs to be run once for each dependent. + dependentResource._dependents = dependentResource._dependents.filter(function (d) { + return !(d.type === resource.type && d.id === resource.id); + }); + }); + delete this._data[resource.type][resource.id]; + } + }, { + key: "_removeInverseRelationship", + value: function _removeInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) { + var targetDefinition = this._types[targetResource.type]; + var targetFieldName = sourceField.inverse || sourceResource.type; + var targetField = targetDefinition && targetDefinition[targetFieldName]; + targetResource._dependents = targetResource._dependents.filter(function (r) { + return !(r.type === sourceResource.type && r.id === sourceResource.id && r.fieldName === sourceFieldName); + }); + if (targetField) { + if (targetField.type === "has-one") { + sourceResource._dependents = sourceResource._dependents.filter(function (r) { + return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName); + }); + targetResource[targetFieldName] = null; + } else if (targetField.type === "has-many") { + sourceResource._dependents = sourceResource._dependents.filter(function (r) { + return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName); + }); + targetResource[targetFieldName] = targetResource[targetFieldName].filter(function (r) { + return r !== sourceResource; + }); + } else if (targetField.type === "attr") { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is an attribute ('" + targetFieldName + "')"); + } + } else if (sourceField.inverse) { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is missing ('" + sourceField.inverse + "')"); + } + } + }]); + + return Store; +})(); + +exports["default"] = Store; + +Store.AjaxAdapter = _ajaxAdapter2["default"]; +module.exports = exports["default"]; + +},{"./ajax-adapter":2,"array.prototype.find":1}]},{},[3])(3) +}); +//# sourceMappingURL=store.dev.js.map diff --git a/releases/v0.5.1/store.dev.js.map b/releases/v0.5.1/store.dev.js.map new file mode 100644 index 0000000..de6c4be --- /dev/null +++ b/releases/v0.5.1/store.dev.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "sources": [ + "../node_modules/browserify/node_modules/browser-pack/_prelude.js", + "../node_modules/array.prototype.find/index.js", + "../src/ajax-adapter.js", + "../src/store.js" + ], + "names": [], + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ICjCqB,WAAW;AAEnB,WAFQ,WAAW,CAElB,OAAO,EAAE;0BAFF,WAAW;;AAG5B,QAAI,CAAC,KAAK,GAAG,AAAC,OAAO,IAAI,OAAO,CAAC,IAAI,IAAK,EAAE,CAAC;GAC9C;;eAJkB,WAAW;;WAMxB,gBAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;;;AAEpD,UAAI,KAAK,IAAI,CAAA,GAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,mBAAmB,EAAE;;AAE5D,YAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;OAEzD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;;;AAE7B,cAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;;AAEnC,iBAAO,CAAC,IAAI,CAAC,MAAM,EAAK,MAAK,KAAK,SAAI,IAAI,EAAI,IAAI,CAAC,CAAC;;AAEpD,iBAAO,CAAC,MAAM,GAAG,YAAY;AAC3B,gBAAI,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;AACjD,kBAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;AAChD,kBAAI;AACF,qBAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACrB,oBAAI,OAAO,EAAE;AACX,yBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;iBACzE;eACF,CAAC,OAAO,CAAC,EAAE;AACV,oBAAI,KAAK,EAAE;AACT,uBAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;iBACxB;eACF;aACF,MAAM;AACL,kBAAI,KAAK,EAAE;AACT,qBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;eACrB;aACF;WACF,CAAC;;AAEF,iBAAO,CAAC,IAAI,CAAC;AACX,gBAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;WACnD,CAAC,CAAC;;OAEJ,MAAM;AACL,cAAM,IAAI,KAAK,qBAAkB,IAAI,QAAI,CAAC;OAC3C;KAEF;;;WAEM,iBAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;;;AAEhD,UAAI,KAAK,IAAI,CAAA,GAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,mBAAmB,EAAE;;AAE5D,YAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;OAErD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;;;AAE7B,cAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;;AAEnC,iBAAO,CAAC,IAAI,CAAC,QAAQ,EAAK,OAAK,KAAK,SAAI,IAAI,SAAI,EAAE,EAAI,IAAI,CAAC,CAAC;;AAE5D,iBAAO,CAAC,MAAM,GAAG,YAAY;AAC3B,gBAAI,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;AACjD,kBAAI;AACF,qBAAK,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AACvB,oBAAI,OAAO,EAAE;AACX,yBAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;iBACvB;eACF,CAAC,OAAO,CAAC,EAAE;AACV,qBAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;eACxB;aACF,MAAM,IAAI,KAAK,EAAE;AAChB,mBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACrB;WACF,CAAC;;AAEF,iBAAO,CAAC,IAAI,EAAE,CAAC;;OAEhB,MAAM;AACL,cAAM,IAAI,KAAK,qBAAkB,IAAI,QAAI,CAAC;OAC3C;KAEF;;;WAEG,cAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;;;AAEtD,UAAI,EAAE,IAAI,CAAA,GAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,mBAAmB,EAAE;AACtD,YAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;OAC1D,MAAM,IAAI,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;AACvC,YAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;OAC3D,MAAM,IAAI,OAAO,IAAI,CAAA,GAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,mBAAmB,EAAE;AACvE,YAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;OACzD,MAAM,IAAI,KAAK,IAAI,CAAA,GAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,mBAAmB,EAAE;AACnE,YAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;OAC3D,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;;;AAE7B,cAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;AACnC,cAAI,GAAG,YAAA,CAAC;;AAER,iBAAO,GAAG,OAAO,IAAI,EAAE,CAAC;AACxB,aAAG,GAAG,EAAE,GAAM,OAAK,KAAK,SAAI,IAAI,SAAI,EAAE,GAAQ,OAAK,KAAK,SAAI,IAAI,AAAE,CAAC;;AAEnE,cAAI,OAAO,EAAE;;AAEX,gBAAI,MAAM,GAAG,EAAE,CAAC;;AAEhB,gBAAI,OAAO,CAAC,MAAM,EAAE;AAClB,oBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAA,KAAK,EAAI;AAC3C,uBAAO,aAAW,KAAK,OAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;eACrD,CAAC,CAAC;AACH,qBAAO,OAAO,CAAC,MAAM,CAAC;aACvB;;AAED,kBAAM,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,UAAA,GAAG,EAAI;AACvC,qBAAO,GAAG,GAAG,GAAG,GAAG,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;aACrD,CAAC,CAAC,IAAI,EAAE,CAAC;;AAEV,gBAAI,MAAM,CAAC,MAAM,EAAE;AACjB,iBAAG,GAAM,GAAG,SAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,AAAE,CAAC;aACpC;WAEF;;AAED,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;;AAE/B,iBAAO,CAAC,MAAM,GAAG,YAAY;AAC3B,gBAAI,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;AACjD,kBAAI;AACF,qBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC;AAC7C,oBAAI,OAAO,EAAE;AACX,yBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;iBACrE;eACF,CAAC,OAAO,CAAC,EAAE;AACV,qBAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;eACnB;aACF,MAAM,IAAI,KAAK,EAAE;AAChB,mBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACrB;WACF,CAAC;;AAEF,iBAAO,CAAC,IAAI,EAAE,CAAC;;OAEhB,MAAM;AACL,cAAM,IAAI,KAAK,qBAAkB,IAAI,QAAI,CAAC;OAC3C;KAEF;;;WAEK,gBAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;;;AAExD,UAAI,KAAK,IAAI,CAAA,GAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,mBAAmB,EAAE;;AAE5D,YAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;OAE7D,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;;;AAE7B,cAAI,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;AACnC,cAAI,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;;AAE5C,iBAAO,CAAC,IAAI,CAAC,OAAO,EAAK,OAAK,KAAK,SAAI,IAAI,SAAI,EAAE,EAAI,IAAI,CAAC,CAAC;;AAE3D,iBAAO,CAAC,MAAM,GAAG,YAAY;AAC3B,gBAAI,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE;AACjD,kBAAI;AACF,qBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAChB,oBAAI,OAAO,EAAE;AACX,yBAAO,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;iBACvD;eACF,CAAC,OAAO,CAAC,EAAE;AACV,oBAAI,KAAK,EAAE;AACT,uBAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;iBACxB;eACF;aACF,MAAM,IAAI,KAAK,EAAE;AAChB,mBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aACrB;WACF,CAAC;;AAEF,iBAAO,CAAC,IAAI,CAAC;AACX,gBAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;WAC3B,CAAC,CAAC;;OAEJ,MAAM;AACL,cAAM,IAAI,KAAK,qBAAkB,IAAI,QAAI,CAAC;OAC3C;KAEF;;;SAzLkB,WAAW;;;qBAAX,WAAW;;;;;;;;;;;;;;;;QCAzB,sBAAsB;;2BACL,gBAAgB;;;;IAEnB,KAAK;eAAL,KAAK;;;;;;;;;;;;WAWb,cAAC,IAAI,EAAE,OAAO,EAAE;AACzB,UAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AACpC,eAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;OAC/B,MAAM;AACL,eAAO;AACL,cAAI,EAAE,MAAM;AACZ,qBAAS,OAAO,IAAI,OAAO,WAAQ;AACnC,qBAAW,EAAE,qBAAU,IAAI,EAAE,GAAG,EAAE;AAChC,mBAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;WACxD;AACD,mBAAS,EAAE,mBAAU,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE;AACxC,gBAAI,CAAC,UAAU,CAAC,IAAI,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;WAC9C;SACF,CAAC;OACH;KACF;;;;;;;;;;;;;WAWY,gBAAC,IAAI,EAAE,OAAO,EAAE;AAC3B,UAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AACpC,eAAO,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;OACjC,MAAM;AACL,eAAO;AACL,cAAI,EAAE,SAAS;AACf,iBAAO,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO;AACnC,qBAAW,EAAE,qBAAU,IAAI,EAAE,GAAG,EAAE;AAChC,gBAAI,GAAG,IAAI,IAAI,GAAG,CAAC;AACnB,gBAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;AAClD,kBAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;AAC1C,uBAAO,IAAI,CAAC;eACb,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;AACxC,uBAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;eACxF;aACF;WACF;SACF,CAAC;OACH;KACF;;;;;;;;;;;;;WAWa,iBAAC,IAAI,EAAE,OAAO,EAAE;AAC5B,UAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AACpC,eAAO,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;OAClC,MAAM;AACL,eAAO;AACL,cAAI,EAAE,UAAU;AAChB,qBAAS,EAAE;AACX,iBAAO,EAAE,OAAO,IAAI,OAAO,CAAC,OAAO;AACnC,qBAAW,EAAE,qBAAU,IAAI,EAAE,GAAG,EAAE;;;AAChC,gBAAI,GAAG,IAAI,IAAI,GAAG,CAAC;AACnB,gBAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;AAClD,kBAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,EAAE;AAC1C,uBAAO,EAAE,CAAC;eACX,MAAM,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE;AACxC,uBAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,EAAK;AAC9C,yBAAO,MAAK,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;iBAChC,CAAC,CAAC;eACJ;aACF;WACF;SACF,CAAC;OACH;KACF;;;AAEU,WA3FQ,KAAK,CA2FZ,OAAO,EAAE;0BA3FF,KAAK;;AA4FtB,QAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;AACxB,QAAI,CAAC,oBAAoB,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAC1E,QAAI,CAAC,KAAK,GAAG,EAAE,CAAC;AAChB,QAAI,CAAC,kBAAkB,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AACxE,QAAI,CAAC,MAAM,GAAG,EAAE,CAAC;GAClB;;;;;;;;;;;;eAjGkB,KAAK;;WA4GrB,aAAC,MAAM,EAAE;;;AACV,UAAI,MAAM,EAAE;AACV,YAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,EAAE,EAAE;;AAC5B,gBAAI,KAAK,GAAG,OAAK,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,OAAK,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,SAAS,GAAG,OAAO,CAAC;AAChG,gBAAI,QAAQ,GAAG,OAAK,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC;AACjD,gBAAI,UAAU,GAAG,OAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1C,kBAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAA,SAAS,EAAI;AAC3C,kBAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACxB,uBAAK,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;eACzD;aACF,CAAC,CAAC;AACH,gBAAI,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;AACxG,qBAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC;uBAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;eAAA,CAAC,CAAC;aACjG;AACD,gBAAI,OAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;AACjD,qBAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC;uBAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;eAAA,CAAC,CAAC;aACvF;;SACF,MAAM;AACL,gBAAM,IAAI,SAAS,oCAAoC,CAAC;SACzD;OACF,MAAM;AACL,cAAM,IAAI,SAAS,gCAAgC,CAAC;OACrD;KACF;;;;;;;;;;;;;WAWM,iBAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE;;;AACzB,UAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;AACpC,eAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;OAC/C,MAAM,IAAI,EAAE,IAAI,OAAO,EAAE,KAAK,QAAQ,EAAE;AACvC,eAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;OACtC,MAAM;;AACL,cAAI,IAAI,GAAG;AACT,gBAAI,EAAE,IAAI;AACV,sBAAU,EAAE,EAAE;AACd,yBAAa,EAAE,EAAE;WAClB,CAAC;AACF,cAAI,EAAE,EAAE;AACN,gBAAI,CAAC,EAAE,GAAG,EAAE,CAAC;WACd;AACD,cAAI,UAAU,GAAG,OAAK,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,gBAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAA,SAAS,EAAI;AAC3C,gBAAI,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AACxB,wBAAU,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;aAC3D;WACF,CAAC,CAAC;AACH;eAAO,IAAI;YAAC;;;;OACb;KACF;;;;;;;;;;;;;;;;;;;;;;;WAqBK,gBAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;AAC7C,UAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;OACpE,MAAM;AACL,cAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;OACnH;KACF;;;;;;;;;;;;WAUK,gBAAC,KAAK,EAAE,UAAU,EAAE;;;AACxB,WAAK,GAAG,AAAC,KAAK,CAAC,WAAW,KAAK,KAAK,GAAI,KAAK,GAAG,CAAE,KAAK,CAAE,CAAC;AAC1D,UAAI,UAAU,EAAE;AACd,kBAAU,CAAC,MAAM,GAAG,KAAK,CAAC;AAC1B,aAAK,CAAC,OAAO,CAAC,UAAA,IAAI,EAAI;AACpB,cAAI,CAAC,OAAK,MAAM,CAAC,IAAI,CAAC,EAAE;AACtB,mBAAK,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC;WAChC,MAAM;AACL,kBAAM,IAAI,KAAK,gBAAc,IAAI,iCAA8B,CAAC;WACjE;SACF,CAAC,CAAC;OACJ,MAAM;AACL,cAAM,IAAI,KAAK,kDAAgD,KAAK,CAAC,CAAC,CAAC,QAAK,CAAC;OAC9E;KACF;;;;;;;;;;;;;;;;;;;;;;;WAqBM,iBAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;AACzC,UAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;OAChE,MAAM;AACL,cAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;OACnH;KACF;;;;;;;;;;;;;;;;WAcG,cAAC,IAAI,EAAE,EAAE,EAAE;;;AACb,UAAI,IAAI,EAAE;;AACR,cAAI,UAAU,GAAG,OAAK,MAAM,CAAC,IAAI,CAAC,CAAC;AACnC,cAAI,UAAU,EAAE;AACd,gBAAI,CAAC,OAAK,KAAK,CAAC,IAAI,CAAC,EAAE;;AACrB,oBAAI,UAAU,GAAG,EAAE,CAAC;AACpB,0BAAU,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,CAAC;yBAAI,OAAK,KAAK,CAAC,CAAC,CAAC,GAAG,UAAU;iBAAA,CAAC,CAAC;;aAC5D;AACD,gBAAI,EAAE,EAAE;AACN,kBAAI,CAAC,OAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE;AACzB,uBAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG;AACrB,6BAAW,EAAE,EAAE;AACf,sBAAI,EAAE,IAAI;AACV,oBAAE,EAAE,EAAE;iBACP,CAAC;AACF,sBAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG,EAAI;AACrC,sBAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;AAClB,2BAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,WAAQ,CAAC;mBACrD;iBACF,CAAC,CAAC;eACJ;AACD;mBAAO,OAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBAAC;aAC7B,MAAM;AACL;mBAAO,MAAM,CAAC,IAAI,CAAC,OAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,UAAA,CAAC;yBAAI,OAAK,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBAAA,CAAC;gBAAC;aACpE;WACF,MAAM;AACL,kBAAM,IAAI,SAAS,oBAAkB,IAAI,OAAI,CAAC;WAC/C;;;;OACF,MAAM;AACL,cAAM,IAAI,SAAS,2BAA2B,CAAC;OAChD;KACF;;;;;;;;;;;;;;;;;;;;;;;;WAsBG,cAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;AAC/C,UAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;OACtE,MAAM;AACL,cAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;OACnH;KACF;;;;;;;;;;;;;;WAYE,aAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE;;;AAC7B,UAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE;AACtE,YAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;AACrB,cAAI,EAAE,IAAI,CAAC,GAAE,CAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,mBAAmB,EAAE;AACxD,gBAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;WACtD,MAAM;;AAEL,gBAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,IAAI,EAAI;AACvC,kBAAI,EAAE,EAAE;AACN,oBAAI,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE;AACpF,yBAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AAC9F,2BAAO,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;mBAC1B,CAAC,CAAC;iBACJ;eACF,MAAM,IAAI,OAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;AACjD,uBAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,OAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AAC1F,yBAAO,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;iBAC1B,CAAC,CAAC;eACJ;aACF,CAAC,CAAC;WACJ;SACF,MAAM;AACL,gBAAM,IAAI,KAAK,oBAAkB,IAAI,OAAI,CAAC;SAC3C;OACF,MAAM;AACL,cAAM,IAAI,KAAK,qBAAmB,KAAK,OAAI,CAAC;OAC7C;KACF;;;;;;;;;;;;;;;WAaC,YAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE;;;AACrC,UAAI,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE;AACtE,YAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;AACrB,cAAI,EAAE,IAAI,CAAC,GAAE,CAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,mBAAmB,EAAE;AACxD,gBAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC;WACrD,MAAM;;AAEL,gBAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,UAAA,IAAI,EAAI;AACvC,kBAAI,EAAE,EAAE;AACN,uBAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAClF,uBAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;AAC1F,oBAAI,CAAC,OAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC;yBAAI,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ;iBAAA,CAAC,EAAE;AAC1E,yBAAK,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAE,QAAQ,EAAE,OAAO,CAAE,CAAC,CAAC;iBACtE;eACF,MAAM;AACL,uBAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,OAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AACtF,oBAAI,CAAC,OAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC;yBAAI,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ;iBAAA,CAAC,EAAE;AACxE,yBAAK,oBAAoB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAE,QAAQ,EAAE,OAAO,CAAE,CAAC,CAAC;iBACpE;eACF;aACF,CAAC,CAAC;WACJ;SACF,MAAM;AACL,gBAAM,IAAI,KAAK,oBAAkB,IAAI,OAAI,CAAC;SAC3C;OACF,MAAM;AACL,cAAM,IAAI,KAAK,qBAAmB,KAAK,OAAI,CAAC;OAC7C;KACF;;;;;;;;;;;;;WAWG,cAAC,IAAI,EAAE;;;AACT,UAAI,IAAI,CAAC,IAAI,CAAC,WAAW,KAAK,KAAK,EAAE;AACnC,YAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAA,CAAC;iBAAI,OAAK,GAAG,CAAC,CAAC,CAAC;SAAA,CAAC,CAAC;OACrC,MAAM;AACL,YAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;OACrB;AACD,UAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,CAAC;iBAAI,OAAK,GAAG,CAAC,CAAC,CAAC;SAAA,CAAC,CAAC;OACzC;KACF;;;;;;;;;;;;;WAWK,gBAAC,IAAI,EAAE,EAAE,EAAE;;;AACf,UAAI,IAAI,EAAE;AACR,YAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;AACrB,cAAI,EAAE,EAAE;;AACN,kBAAI,QAAQ,GAAG,OAAK,KAAK,CAAC,IAAI,CAAC,IAAI,OAAK,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;AACxD,kBAAI,QAAQ,EAAE;AACZ,uBAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AACvB,oBAAI,OAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,IAAI,OAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE;AAC3F,yBAAK,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC;2BAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;mBAAA,CAAC,CAAC;iBACvF;AACD,oBAAI,OAAK,oBAAoB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,EAAE;AAC9C,yBAAK,oBAAoB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC;2BAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;mBAAA,CAAC,CAAC;iBACpF;eACF;;WACF,MAAM;AACL,kBAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,UAAA,EAAE;qBAAI,OAAK,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;aAAA,CAAC,CAAC;WACpE;SACF,MAAM;AACL,gBAAM,IAAI,SAAS,oBAAkB,IAAI,OAAI,CAAC;SAC/C;OACF,MAAM;AACL,cAAM,IAAI,SAAS,qCAAqC,CAAC;OAC1D;KACF;;;;;;;;;;;;;;;;;;;;;;;;WAsBK,gBAAC,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;AACjD,UAAI,IAAI,CAAC,QAAQ,EAAE;AACjB,YAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;OACxE,MAAM;AACL,cAAM,IAAI,KAAK,CAAC,gGAAgG,CAAC,CAAC;OACnH;KACF;;;WAEQ,mBAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE;;;AACjD,UAAI,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAClC,UAAI,QAAQ,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;AAC/D,UAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;AACnC,YAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;AAC5B,cAAI,QAAQ,CAAC,SAAS,CAAC,EAAE;AACvB,gBAAI,CAAC,0BAA0B,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;WAClF;AACD,cAAI,QAAQ,EAAE;AACZ,gBAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;WACpE;SACF,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE;AACpC,kBAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAA,CAAC,EAAI;AAC/B,gBAAI,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE;AACzC,sBAAK,0BAA0B,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;aAChE;WACF,CAAC,CAAC;AACH,kBAAQ,CAAC,OAAO,CAAC,UAAA,CAAC,EAAI;AACpB,oBAAK,uBAAuB,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;WAC7D,CAAC,CAAC;SACJ;AACD,gBAAQ,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;OAChC;KACF;;;WAEsB,iCAAC,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE;AACpF,UAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACxD,UAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACxD,UAAI,gBAAgB,EAAE;AACpB,YAAI,eAAe,GAAG,CAAE,WAAW,CAAC,OAAO,CAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAA,CAAC;iBAAI,gBAAgB,CAAC,CAAC,CAAC;SAAA,CAAC,CAAC;AAC7G,YAAI,WAAW,GAAG,gBAAgB,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACxE,sBAAc,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AAClH,YAAI,WAAW,EAAE;AACf,cAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE;AAClC,0BAAc,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AAClH,0BAAc,CAAC,eAAe,CAAC,GAAG,cAAc,CAAC;WAClD,MAAM,IAAI,WAAW,CAAC,IAAI,KAAK,UAAU,EAAE;AAC1C,0BAAc,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,IAAI,EAAE,EAAE,EAAE,cAAc,CAAC,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AAClH,gBAAI,cAAc,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE;AAClE,4BAAc,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;aACtD;WACF,MAAM,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,EAAE;AACtC,kBAAM,IAAI,KAAK,wCAAsC,eAAe,4BAAuB,eAAe,QAAK,CAAC;WACjH;SACF,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE;AAC9B,gBAAM,IAAI,KAAK,wCAAsC,eAAe,uBAAkB,WAAW,CAAC,OAAO,QAAK,CAAC;SAChH;OACF;KACF;;;WAEM,iBAAC,QAAQ,EAAE;;;AAChB,cAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,UAAA,SAAS,EAAI;AACxC,YAAI,iBAAiB,GAAG,QAAK,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AACjE,gBAAQ,QAAK,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI;AAC3D,eAAK,SAAS;AAAE;AACd,+BAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC;AAC9C,oBAAM;aACP;AAAA,AACD,eAAK,UAAU;AAAE;AACf,kBAAI,KAAK,GAAG,iBAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACrE,kBAAI,KAAK,KAAK,CAAC,CAAC,EAAE;AAChB,iCAAiB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;eACzD;AACD,oBAAM;aACP;AAAA,AACD;AAAS;AACP,oBAAM;aACP;AAAA,SACF;;AAED,yBAAiB,CAAC,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AACxE,iBAAO,EAAE,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,CAAA,AAAC,CAAC;SAC5D,CAAC,CAAC;OACJ,CAAC,CAAC;AACH,aAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;KAC/C;;;WAEyB,oCAAC,cAAc,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE;AACvF,UAAI,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;AACxD,UAAI,eAAe,GAAG,WAAW,CAAC,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC;AACjE,UAAI,WAAW,GAAG,gBAAgB,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;AACxE,oBAAc,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AAClE,eAAO,EAAE,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC,SAAS,KAAK,eAAe,CAAA,AAAC,CAAC;OAC3G,CAAC,CAAC;AACH,UAAI,WAAW,EAAE;AACf,YAAI,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE;AAClC,wBAAc,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AAClE,mBAAO,EAAE,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC,SAAS,KAAK,eAAe,CAAA,AAAC,CAAC;WAC3G,CAAC,CAAC;AACH,wBAAc,CAAC,eAAe,CAAC,GAAG,IAAI,CAAC;SACxC,MAAM,IAAI,WAAW,CAAC,IAAI,KAAK,UAAU,EAAE;AAC1C,wBAAc,CAAC,WAAW,GAAG,cAAc,CAAC,WAAW,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AAClE,mBAAO,EAAE,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC,SAAS,KAAK,eAAe,CAAA,AAAC,CAAC;WAC3G,CAAC,CAAC;AACH,wBAAc,CAAC,eAAe,CAAC,GAAG,cAAc,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,EAAI;AAC5E,mBAAO,CAAC,KAAK,cAAc,CAAC;WAC7B,CAAC,CAAC;SACJ,MAAM,IAAI,WAAW,CAAC,IAAI,KAAK,MAAM,EAAE;AACtC,gBAAM,IAAI,KAAK,wCAAsC,eAAe,4BAAuB,eAAe,QAAK,CAAC;SACjH;OACF,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE;AAC9B,cAAM,IAAI,KAAK,wCAAsC,eAAe,uBAAkB,WAAW,CAAC,OAAO,QAAK,CAAC;OAChH;KACF;;;SAtkBkB,KAAK;;;qBAAL,KAAK;;AA0kB1B,KAAK,CAAC,WAAW,2BAAc,CAAC", + "file": "generated.js", + "sourceRoot": "", + "sourcesContent": [ + "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o\n// For all details and docs: https://github.com/paulmillr/array.prototype.find\n// Fixes and tests supplied by Duncan Hall \n(function(globals){\n if (Array.prototype.find) return;\n\n var find = function(predicate) {\n var list = Object(this);\n var length = list.length < 0 ? 0 : list.length >>> 0; // ES.ToUint32;\n if (length === 0) return undefined;\n if (typeof predicate !== 'function' || Object.prototype.toString.call(predicate) !== '[object Function]') {\n throw new TypeError('Array#find: predicate must be a function');\n }\n var thisArg = arguments[1];\n for (var i = 0, value; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) return value;\n }\n return undefined;\n };\n\n if (Object.defineProperty) {\n try {\n Object.defineProperty(Array.prototype, 'find', {\n value: find, configurable: true, enumerable: false, writable: true\n });\n } catch(e) {}\n }\n\n if (!Array.prototype.find) {\n Array.prototype.find = find;\n }\n})(this);\n", + "export default class AjaxAdapter {\n\n constructor(options) {\n this._base = (options && options.base) || \"\";\n };\n\n create(store, type, partial, success, error, context) {\n\n if (error && {}.toString.call(error) !== '[object Function]') {\n\n this.create(store, type, partial, success, null, error);\n\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n\n request.open('POST', `${this._base}/${type}`, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n let response = JSON.parse(request.responseText);\n try {\n store.push(response);\n if (success) {\n success.call(context, store.find(response.data.type, response.data.id));\n }\n } catch (e) {\n if (error) {\n error.call(context, e);\n }\n }\n } else {\n if (error) {\n error.call(context);\n }\n }\n };\n\n request.send({\n data: JSON.stringify(store.convert(type, partial))\n });\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n destroy(store, type, id, success, error, context) {\n\n if (error && {}.toString.call(error) !== '[object Function]') {\n\n this.destroy(store, type, id, success, null, error);\n\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n\n request.open('DELETE', `${this._base}/${type}/${id}`, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n try {\n store.remove(type, id);\n if (success) {\n success.call(context);\n }\n } catch (e) {\n error.call(context, e);\n }\n } else if (error) {\n error.call(context);\n }\n };\n\n request.send();\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n load(store, type, id, options, success, error, context) {\n\n if (id && {}.toString.call(id) === '[object Function]') {\n this.load(store, type, null, null, id, options, success);\n } else if (id && typeof id === \"object\") {\n this.load(store, type, null, id, options, success, error);\n } else if (options && {}.toString.call(options) === '[object Function]') {\n this.load(store, type, id, {}, options, success, error);\n } else if (error && {}.toString.call(error) !== '[object Function]') {\n this.load(store, type, id, options, success, null, error);\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n let url;\n\n options = options || {};\n url = id ? `${this._base}/${type}/${id}` : `${this._base}/${type}`;\n\n if (options) {\n\n let params = [];\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 request.open('GET', url, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n try {\n store.push(JSON.parse(request.responseText));\n if (success) {\n success.call(context, id ? store.find(type, id) : store.find(type));\n }\n } catch (e) {\n error.call({}, e);\n }\n } else if (error) {\n error.call(context);\n }\n };\n\n request.send();\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n update(store, type, id, partial, success, error, context) {\n\n if (error && {}.toString.call(error) !== '[object Function]') {\n\n this.update(store, type, id, partial, success, null, error);\n\n } else if (store._types[type]) {\n\n let request = new XMLHttpRequest();\n let data = store.convert(type, id, partial);\n\n request.open('PATCH', `${this._base}/${type}/${id}`, true);\n\n request.onload = function () {\n if (request.status >= 200 && request.status < 300) {\n try {\n store.add(data);\n if (success) {\n success.call(context, store.find(data.type, data.id));\n }\n } catch (e) {\n if (error) {\n error.call(context, e);\n }\n }\n } else if (error) {\n error.call(context);\n }\n };\n\n request.send({\n data: JSON.stringify(data)\n });\n\n } else {\n throw new Error(`Unknown type '${type}'`);\n }\n\n }\n\n}\n", + "import \"array.prototype.find\";\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 };\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 };\n }\n }\n\n constructor(adapter) {\n this._adapter = adapter;\n this._collectionListeners = { \"added\": {}, \"updated\": {}, \"removed\": {} };\n this._data = {};\n this._resourceListeners = { \"added\": {}, \"updated\": {}, \"removed\": {} };\n this._types = {};\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 - Resource Object to add. See:\n http://jsonapi.org/format/#document-resource-objects\n * @return {undefined} - Nothing.\n */\n add(object) {\n if (object) {\n if (object.type && object.id) {\n let event = 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 if (this._resourceListeners[event][object.type] && this._resourceListeners[event][object.type][object.id]) {\n this._resourceListeners[event][object.type][object.id].forEach(x => x[0].call(x[1], resource));\n }\n if (this._collectionListeners[event][object.type]) {\n this._collectionListeners[event][object.type].forEach(x => x[0].call(x[1], 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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.create(\"product\", { title: \"A Book\" }, (product) => {\n * console.log(product.title);\n * });\n */\n create(type, partial, success, error, context) {\n if (this._adapter) {\n this._adapter.create(this, type, partial, success, error, context);\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 * @return {undefined} - Nothing.\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.destroy(\"product\", \"1\", () => {\n * console.log(\"Destroyed!\");\n * });\n */\n destroy(type, id, success, error, context) {\n if (this._adapter) {\n this._adapter.destroy(this, type, id, success, error, context);\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 * Find a resource or entire collection of resources.\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(s) to find.\n * @param {string} [id] - The id of the resource to find. If omitted all\n * resources of the type will be returned.\n * @return {Object|Object[]} - Either the resource or an array of resources.\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 return Object.keys(this._data[type]).map(x => this._data[type][x]);\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 * Attempts to load the resource(s) through the adapter and adds it/them to\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] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options)\n * @param {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.load(\"product\", \"1\", (product) => {\n * console.log(product.title);\n * });\n */\n load(type, id, options, success, error, context) {\n if (this._adapter) {\n this._adapter.load(this, type, id, options, success, error, context);\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 * @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 * @return {undefined} - Nothing.\n */\n off(event, type, id, callback) {\n if (this._resourceListeners[event] && this._collectionListeners[event]) {\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 {\n // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.\n this._types[type]._names.forEach(type => {\n if (id) {\n if (this._resourceListeners[event][type] && this._resourceListeners[event][type][id]) {\n this._resourceListeners[event][type][id] = this._resourceListeners[event][type][id].filter(x => {\n return x[0] !== callback;\n });\n }\n } else if (this._collectionListeners[event][type]) {\n this._collectionListeners[event][type] = this._collectionListeners[event][type].filter(x => {\n return x[0] !== callback;\n });\n }\n });\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 * @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 * @return {undefined} - Nothing.\n */\n on(event, type, id, callback, context) {\n if (this._resourceListeners[event] && this._collectionListeners[event]) {\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 {\n // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists.\n this._types[type]._names.forEach(type => {\n if (id) {\n this._resourceListeners[event][type] = this._resourceListeners[event][type] || {};\n this._resourceListeners[event][type][id] = this._resourceListeners[event][type][id] || [];\n if (!this._resourceListeners[event][type][id].find(x => x[0] === callback)) {\n this._resourceListeners[event][type][id].push([ callback, context ]);\n }\n } else {\n this._collectionListeners[event][type] = this._collectionListeners[event][type] || [];\n if (!this._collectionListeners[event][type].find(x => x[0] === callback)) {\n this._collectionListeners[event][type].push([ callback, context ]);\n }\n }\n });\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 * @return {undefined} - Nothing.\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 * @return {undefined} - Nothing.\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 if (this._resourceListeners[\"removed\"][type] && this._resourceListeners[\"removed\"][type][id]) {\n this._resourceListeners[\"removed\"][type][id].forEach(x => x[0].call(x[1], resource));\n }\n if (this._collectionListeners[\"removed\"][type]) {\n this._collectionListeners[\"removed\"][type].forEach(x => x[0].call(x[1], resource));\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 {function} [success] - Callback on success.\n * @param {function} [error] - Callback on error.\n * @param {Object} [context] - Context for the callbacks.\n * @return {undefined} - Nothing.\n *\n * @example\n * let adapter = new Store.AjaxAdapter();\n * let store = new Store(adpater);\n * store.update(\"product\", \"1\", { title: \"foo\" }, (product) => {\n * console.log(product.title);\n * });\n */\n update(type, id, partial, success, error, context) {\n if (this._adapter) {\n this._adapter.update(this, type, id, partial, success, error, context);\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.AjaxAdapter = AjaxAdapter;\n" + ] +} \ No newline at end of file diff --git a/releases/v0.5.1/store.js b/releases/v0.5.1/store.js new file mode 100644 index 0000000..ac21d33 --- /dev/null +++ b/releases/v0.5.1/store.js @@ -0,0 +1,717 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +require("array.prototype.find"); + +var _ajaxAdapter = require("./ajax-adapter"); + +var _ajaxAdapter2 = _interopRequireDefault(_ajaxAdapter); + +var Store = (function () { + _createClass(Store, null, [{ + key: "attr", + + /** + * Creates a field definition for an attribute. + * + * @since 0.1.0 + * @param {string} [name] - Name of the property to map this field from. + * @param {Object} [options] - An options object. + * @param {string} [options.default] - Default value for this field. + * @return {Object} - Field definition. + */ + value: function attr(name, options) { + if (name && typeof name === 'object') { + return Store.attr(null, name); + } else { + return { + type: "attr", + "default": options && options["default"], + deserialize: function deserialize(data, key) { + return data.attributes && data.attributes[name || key]; + }, + serialize: function serialize(resource, data, key) { + data.attributes[name || key] = resource[key]; + } + }; + } + } + + /** + * Creates a field definition for an has-one relationship. + * + * @since 0.1.0 + * @param {string} [name] - Name of the property to map this field from. + * @param {Object} [options] - An options object. + * @param {string} [options.inverse] - Name of the inverse relationship. + * @return {Object} - Field definition. + */ + }, { + key: "hasOne", + value: function hasOne(name, options) { + if (name && typeof name === 'object') { + return Store.hasOne(null, name); + } else { + return { + type: "has-one", + inverse: options && options.inverse, + deserialize: function deserialize(data, key) { + name = name || key; + if (data.relationships && data.relationships[name]) { + if (data.relationships[name].data === null) { + return null; + } else if (data.relationships[name].data) { + return this.find(data.relationships[name].data.type, data.relationships[name].data.id); + } + } + } + }; + } + } + + /** + * Creates a field definition for an has-many relationship. + * + * @since 0.1.0 + * @param {string} [name] - Name of the property to map this field from. + * @param {Object} [options] - An options object. + * @param {string} [options.inverse] - Name of the inverse relationship. + * @return {Object} - Field definition. + */ + }, { + key: "hasMany", + value: function hasMany(name, options) { + if (name && typeof name === 'object') { + return Store.hasMany(null, name); + } else { + return { + type: "has-many", + "default": [], + inverse: options && options.inverse, + deserialize: function deserialize(data, key) { + var _this = this; + + name = name || key; + if (data.relationships && data.relationships[name]) { + if (data.relationships[name].data === null) { + return []; + } else if (data.relationships[name].data) { + return data.relationships[name].data.map(function (c) { + return _this.find(c.type, c.id); + }); + } + } + } + }; + } + } + }]); + + function Store(adapter) { + _classCallCheck(this, Store); + + this._adapter = adapter; + this._collectionListeners = { "added": {}, "updated": {}, "removed": {} }; + this._data = {}; + this._resourceListeners = { "added": {}, "updated": {}, "removed": {} }; + this._types = {}; + } + + /** + * Add an individual resource to the store. This is used internally by the + * `push()` method. + * + * @since 0.1.0 + * @param {!Object} object - Resource Object to add. See: + http://jsonapi.org/format/#document-resource-objects + * @return {undefined} - Nothing. + */ + + _createClass(Store, [{ + key: "add", + value: function add(object) { + var _this2 = this; + + if (object) { + if (object.type && object.id) { + (function () { + var event = _this2._data[object.type] && _this2._data[object.type][object.id] ? "updated" : "added"; + var resource = _this2.find(object.type, object.id); + var definition = _this2._types[object.type]; + Object.keys(definition).forEach(function (fieldName) { + if (fieldName[0] !== "_") { + _this2._addField(object, resource, definition, fieldName); + } + }); + if (_this2._resourceListeners[event][object.type] && _this2._resourceListeners[event][object.type][object.id]) { + _this2._resourceListeners[event][object.type][object.id].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + if (_this2._collectionListeners[event][object.type]) { + _this2._collectionListeners[event][object.type].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + })(); + } else { + throw new TypeError("The data must have a type and id"); + } + } else { + throw new TypeError("You must provide data to add"); + } + } + + /** + * Converts the given partial into a JSON API compliant representation. + * + * @since 0.5.0 + * @param {!string} [type] - The type of the resource. This can be omitted if the partial includes a type property. + * @param {!string} [id] - The id of the resource. This can be omitted if the partial includes an id property. + * @param {!object} partial - The data to convert. + * @return {object} - JSON API version of the object. + */ + }, { + key: "convert", + value: function convert(type, id, partial) { + var _this3 = this; + + if (type && typeof type === "object") { + return this.convert(type.type, type.id, type); + } else if (id && typeof id === "object") { + return this.convert(type, id.id, id); + } else { + var _ret2 = (function () { + var data = { + type: type, + attributes: {}, + relationships: {} + }; + if (id) { + data.id = id; + } + var definition = _this3._types[data.type]; + Object.keys(definition).forEach(function (fieldName) { + if (fieldName[0] !== "_") { + definition[fieldName].serialize(partial, data, fieldName); + } + }); + return { + v: data + }; + })(); + + if (typeof _ret2 === "object") return _ret2.v; + } + } + + /** + * Attempts to create the resource through the adapter and adds it to the + * store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!Object} partial - Data to create the resource with. + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.create("product", { title: "A Book" }, (product) => { + * console.log(product.title); + * }); + */ + }, { + key: "create", + value: function create(type, partial, success, error, context) { + if (this._adapter) { + this._adapter.create(this, type, partial, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + + /** + * Defines a type of resource. + * + * @since 0.2.0 + * @param {!string|string[]} names - Name(s) of the resource. + * @param {!Object} definition - The resource's definition. + * @return {undefined} - Nothing. + */ + }, { + key: "define", + value: function define(names, definition) { + var _this4 = this; + + names = names.constructor === Array ? names : [names]; + if (definition) { + definition._names = names; + names.forEach(function (name) { + if (!_this4._types[name]) { + _this4._types[name] = definition; + } else { + throw new Error("The type '" + name + "' has already been defined."); + } + }); + } else { + throw new Error("You must provide a definition for the type '" + names[0] + "'."); + } + } + + /** + * Attempts to delete the resource through the adapter and removes it from + * the store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!string} id - ID of resource. + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.destroy("product", "1", () => { + * console.log("Destroyed!"); + * }); + */ + }, { + key: "destroy", + value: function destroy(type, id, success, error, context) { + if (this._adapter) { + this._adapter.destroy(this, type, id, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + + /** + * Find a resource or entire collection of resources. + * + * NOTE: If the resource hasn't been loaded via an add() or push() call it + * will be automatically created when find is called. + * + * @since 0.1.0 + * @param {!string} type - Type of the resource(s) to find. + * @param {string} [id] - The id of the resource to find. If omitted all + * resources of the type will be returned. + * @return {Object|Object[]} - Either the resource or an array of resources. + */ + }, { + key: "find", + value: function find(type, id) { + var _this5 = this; + + if (type) { + var _ret3 = (function () { + var definition = _this5._types[type]; + if (definition) { + if (!_this5._data[type]) { + (function () { + var collection = {}; + definition._names.forEach(function (t) { + return _this5._data[t] = collection; + }); + })(); + } + if (id) { + if (!_this5._data[type][id]) { + _this5._data[type][id] = { + _dependents: [], + type: type, + id: id + }; + Object.keys(definition).forEach(function (key) { + if (key[0] !== "_") { + _this5._data[type][id][key] = definition[key]["default"]; + } + }); + } + return { + v: _this5._data[type][id] + }; + } else { + return { + v: Object.keys(_this5._data[type]).map(function (x) { + return _this5._data[type][x]; + }) + }; + } + } else { + throw new TypeError("Unknown type '" + type + "'"); + } + })(); + + if (typeof _ret3 === "object") return _ret3.v; + } else { + throw new TypeError("You must provide a type"); + } + } + + /** + * Attempts to load the resource(s) through the adapter and adds it/them to + * the store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!string} [id] - ID of resource. + * @param {Object} [options] - **NOT YET IMPLEMENTED** (this will include sorting, filtering and pagination options) + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.load("product", "1", (product) => { + * console.log(product.title); + * }); + */ + }, { + key: "load", + value: function load(type, id, options, success, error, context) { + if (this._adapter) { + this._adapter.load(this, type, id, options, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + + /** + * Unregister an event listener that was registered with on(). + * + * @since 0.4.0 + * @param {string} event - Name of the event. + * @param {string} type - Name of resource to originally passed to on(). + * @param {string} [id] - ID of the resource to originally passed to on(). + * @param {function} callback - Function originally passed to on(). + * @return {undefined} - Nothing. + */ + }, { + key: "off", + value: function off(event, type, id, callback) { + var _this6 = this; + + if (this._resourceListeners[event] && this._collectionListeners[event]) { + if (this._types[type]) { + if (id && ({}).toString.call(id) === '[object Function]') { + this.off.call(this, event, type, null, id, callback); + } else { + // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists. + this._types[type]._names.forEach(function (type) { + if (id) { + if (_this6._resourceListeners[event][type] && _this6._resourceListeners[event][type][id]) { + _this6._resourceListeners[event][type][id] = _this6._resourceListeners[event][type][id].filter(function (x) { + return x[0] !== callback; + }); + } + } else if (_this6._collectionListeners[event][type]) { + _this6._collectionListeners[event][type] = _this6._collectionListeners[event][type].filter(function (x) { + return x[0] !== callback; + }); + } + }); + } + } else { + throw new Error("Unknown type '" + type + "'"); + } + } else { + throw new Error("Unknown event '" + event + "'"); + } + } + + /** + * Register an event listener: "added", "updated" or "removed". + * + * @since 0.4.0 + * @param {string} event - Name of the event. + * @param {string} type - Name of resource to watch. + * @param {string} [id] - ID of the resource to watch. + * @param {function} callback - Function to call when the event occurs. + * @param {Object} [context] - Context in which to call the callback. + * @return {undefined} - Nothing. + */ + }, { + key: "on", + value: function on(event, type, id, callback, context) { + var _this7 = this; + + if (this._resourceListeners[event] && this._collectionListeners[event]) { + if (this._types[type]) { + if (id && ({}).toString.call(id) === '[object Function]') { + this.on.call(this, event, type, null, id, callback); + } else { + // TODO: Performance-wise, this can be made way better. There shouldn't be a need to maintain separate lists. + this._types[type]._names.forEach(function (type) { + if (id) { + _this7._resourceListeners[event][type] = _this7._resourceListeners[event][type] || {}; + _this7._resourceListeners[event][type][id] = _this7._resourceListeners[event][type][id] || []; + if (!_this7._resourceListeners[event][type][id].find(function (x) { + return x[0] === callback; + })) { + _this7._resourceListeners[event][type][id].push([callback, context]); + } + } else { + _this7._collectionListeners[event][type] = _this7._collectionListeners[event][type] || []; + if (!_this7._collectionListeners[event][type].find(function (x) { + return x[0] === callback; + })) { + _this7._collectionListeners[event][type].push([callback, context]); + } + } + }); + } + } else { + throw new Error("Unknown type '" + type + "'"); + } + } else { + throw new Error("Unknown event '" + event + "'"); + } + } + + /** + * Add a JSON API response to the store. This method can be used to handle a + * successful GET or POST response from the server. + * + * @since 0.1.0 + * @param {Object} root - Top Level Object to push. See: + http://jsonapi.org/format/#document-top-level + * @return {undefined} - Nothing. + */ + }, { + key: "push", + value: function push(root) { + var _this8 = this; + + if (root.data.constructor === Array) { + root.data.forEach(function (x) { + return _this8.add(x); + }); + } else { + this.add(root.data); + } + if (root.included) { + root.included.forEach(function (x) { + return _this8.add(x); + }); + } + } + + /** + * Remove a resource or collection of resources from the store. + * + * @since 0.1.0 + * @param {!string} type - Type of the resource(s) to remove. + * @param {string} [id] - The id of the resource to remove. If omitted all + * resources of the type will be removed. + * @return {undefined} - Nothing. + */ + }, { + key: "remove", + value: function remove(type, id) { + var _this9 = this; + + if (type) { + if (this._types[type]) { + if (id) { + (function () { + var resource = _this9._data[type] && _this9._data[type][id]; + if (resource) { + _this9._remove(resource); + if (_this9._resourceListeners["removed"][type] && _this9._resourceListeners["removed"][type][id]) { + _this9._resourceListeners["removed"][type][id].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + if (_this9._collectionListeners["removed"][type]) { + _this9._collectionListeners["removed"][type].forEach(function (x) { + return x[0].call(x[1], resource); + }); + } + } + })(); + } else { + Object.keys(this._data[type]).forEach(function (id) { + return _this9.remove(type, id); + }); + } + } else { + throw new TypeError("Unknown type '" + type + "'"); + } + } else { + throw new TypeError("You must provide a type to remove"); + } + } + + /** + * Attempts to update the resource through the adapter and updates it in the + * store if successful. + * + * @since 0.5.0 + * @param {!string} type - Type of resource. + * @param {!string} id - ID of resource. + * @param {!Object} partial - Data to update the resource with. + * @param {function} [success] - Callback on success. + * @param {function} [error] - Callback on error. + * @param {Object} [context] - Context for the callbacks. + * @return {undefined} - Nothing. + * + * @example + * let adapter = new Store.AjaxAdapter(); + * let store = new Store(adpater); + * store.update("product", "1", { title: "foo" }, (product) => { + * console.log(product.title); + * }); + */ + }, { + key: "update", + value: function update(type, id, partial, success, error, context) { + if (this._adapter) { + this._adapter.update(this, type, id, partial, success, error, context); + } else { + throw new Error("Adapter missing. Specify an adapter when creating the store: `var store = new Store(adapter);`"); + } + } + }, { + key: "_addField", + value: function _addField(object, resource, definition, fieldName) { + var _this10 = this; + + var field = definition[fieldName]; + var newValue = field.deserialize.call(this, object, fieldName); + if (typeof newValue !== "undefined") { + if (field.type === "has-one") { + if (resource[fieldName]) { + this._removeInverseRelationship(resource, fieldName, resource[fieldName], field); + } + if (newValue) { + this._addInverseRelationship(resource, fieldName, newValue, field); + } + } else if (field.type === "has-many") { + resource[fieldName].forEach(function (r) { + if (resource[fieldName].indexOf(r) !== -1) { + _this10._removeInverseRelationship(resource, fieldName, r, field); + } + }); + newValue.forEach(function (r) { + _this10._addInverseRelationship(resource, fieldName, r, field); + }); + } + resource[fieldName] = newValue; + } + } + }, { + key: "_addInverseRelationship", + value: function _addInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) { + var targetDefinition = this._types[targetResource.type]; + var sourceDefinition = this._types[sourceResource.type]; + if (targetDefinition) { + var targetFieldName = [sourceField.inverse].concat(sourceDefinition._names).find(function (x) { + return targetDefinition[x]; + }); + var targetField = targetDefinition && targetDefinition[targetFieldName]; + targetResource._dependents.push({ type: sourceResource.type, id: sourceResource.id, fieldName: sourceFieldName }); + if (targetField) { + if (targetField.type === "has-one") { + sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName }); + targetResource[targetFieldName] = sourceResource; + } else if (targetField.type === "has-many") { + sourceResource._dependents.push({ type: targetResource.type, id: targetResource.id, fieldName: targetFieldName }); + if (targetResource[targetFieldName].indexOf(sourceResource) === -1) { + targetResource[targetFieldName].push(sourceResource); + } + } else if (targetField.type === "attr") { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is an attribute ('" + targetFieldName + "')"); + } + } else if (sourceField.inverse) { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is missing ('" + sourceField.inverse + "')"); + } + } + } + }, { + key: "_remove", + value: function _remove(resource) { + var _this11 = this; + + resource._dependents.forEach(function (dependent) { + var dependentResource = _this11._data[dependent.type][dependent.id]; + switch (_this11._types[dependent.type][dependent.fieldName].type) { + case "has-one": + { + dependentResource[dependent.fieldName] = null; + break; + } + case "has-many": + { + var index = dependentResource[dependent.fieldName].indexOf(resource); + if (index !== -1) { + dependentResource[dependent.fieldName].splice(index, 1); + } + break; + } + default: + { + break; + } + } + // TODO: This only needs to be run once for each dependent. + dependentResource._dependents = dependentResource._dependents.filter(function (d) { + return !(d.type === resource.type && d.id === resource.id); + }); + }); + delete this._data[resource.type][resource.id]; + } + }, { + key: "_removeInverseRelationship", + value: function _removeInverseRelationship(sourceResource, sourceFieldName, targetResource, sourceField) { + var targetDefinition = this._types[targetResource.type]; + var targetFieldName = sourceField.inverse || sourceResource.type; + var targetField = targetDefinition && targetDefinition[targetFieldName]; + targetResource._dependents = targetResource._dependents.filter(function (r) { + return !(r.type === sourceResource.type && r.id === sourceResource.id && r.fieldName === sourceFieldName); + }); + if (targetField) { + if (targetField.type === "has-one") { + sourceResource._dependents = sourceResource._dependents.filter(function (r) { + return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName); + }); + targetResource[targetFieldName] = null; + } else if (targetField.type === "has-many") { + sourceResource._dependents = sourceResource._dependents.filter(function (r) { + return !(r.type === targetResource.type && r.id === targetResource.id && r.fieldName === targetFieldName); + }); + targetResource[targetFieldName] = targetResource[targetFieldName].filter(function (r) { + return r !== sourceResource; + }); + } else if (targetField.type === "attr") { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is an attribute ('" + targetFieldName + "')"); + } + } else if (sourceField.inverse) { + throw new Error("The the inverse relationship for '" + sourceFieldName + "' is missing ('" + sourceField.inverse + "')"); + } + } + }]); + + return Store; +})(); + +exports["default"] = Store; + +Store.AjaxAdapter = _ajaxAdapter2["default"]; +module.exports = exports["default"]; diff --git a/releases/v0.5.1/store.prod.js b/releases/v0.5.1/store.prod.js new file mode 100644 index 0000000..3669dfa --- /dev/null +++ b/releases/v0.5.1/store.prod.js @@ -0,0 +1,43 @@ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Store = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o +// For all details and docs: https://github.com/paulmillr/array.prototype.find +// Fixes and tests supplied by Duncan Hall +(function(globals){ + if (Array.prototype.find) return; + + var find = function(predicate) { + var list = Object(this); + var length = list.length < 0 ? 0 : list.length >>> 0; // ES.ToUint32; + if (length === 0) return undefined; + if (typeof predicate !== 'function' || Object.prototype.toString.call(predicate) !== '[object Function]') { + throw new TypeError('Array#find: predicate must be a function'); + } + var thisArg = arguments[1]; + for (var i = 0, value; i < length; i++) { + value = list[i]; + if (predicate.call(thisArg, value, i, list)) return value; + } + return undefined; + }; + + if (Object.defineProperty) { + try { + Object.defineProperty(Array.prototype, 'find', { + value: find, configurable: true, enumerable: false, writable: true + }); + } catch(e) {} + } + + if (!Array.prototype.find) { + Array.prototype.find = find; + } +})(this); + +},{}],2:[function(require,module,exports){ +"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var n=0;n=200&&i.status<300){var t=JSON.parse(i.responseText);try{e.push(t),a&&a.call(o,e.find(t.data.type,t.data.id))}catch(n){l&&l.call(o,n)}}else l&&l.call(o)},i.send({data:JSON.stringify(e.convert(t,n))})}()}}},{key:"destroy",value:function(e,t,n,a,l,o){var s=this;if(l&&"[object Function]"!=={}.toString.call(l))this.destroy(e,t,n,a,null,l);else{if(!e._types[t])throw new Error("Unknown type '"+t+"'");!function(){var i=new XMLHttpRequest;i.open("DELETE",s._base+"/"+t+"/"+n,!0),i.onload=function(){if(i.status>=200&&i.status<300)try{e.remove(t,n),a&&a.call(o)}catch(s){l.call(o,s)}else l&&l.call(o)},i.send()}()}}},{key:"load",value:function(e,t,n,a,l,o,s){var i=this;if(n&&"[object Function]"==={}.toString.call(n))this.load(e,t,null,null,n,a,l);else if(n&&"object"==typeof n)this.load(e,t,null,n,a,l,o);else if(a&&"[object Function]"==={}.toString.call(a))this.load(e,t,n,{},a,l,o);else if(o&&"[object Function]"!=={}.toString.call(o))this.load(e,t,n,a,l,null,o);else{if(!e._types[t])throw new Error("Unknown type '"+t+"'");!function(){var r=new XMLHttpRequest,c=void 0;if(a=a||{},c=n?i._base+"/"+t+"/"+n:i._base+"/"+t,a){var u=[];a.fields&&(Object.keys(a.fields).forEach(function(e){a["fields["+e+"]"]=a.fields[e]}),delete a.fields),u=Object.keys(a).map(function(e){return e+"="+encodeURIComponent(a[e])}).sort(),u.length&&(c=c+"?"+u.join("&"))}r.open("GET",c,!0),r.onload=function(){if(r.status>=200&&r.status<300)try{e.push(JSON.parse(r.responseText)),l&&l.call(s,n?e.find(t,n):e.find(t))}catch(a){o.call({},a)}else o&&o.call(s)},r.send()}()}}},{key:"update",value:function(e,t,n,a,l,o,s){var i=this;if(o&&"[object Function]"!=={}.toString.call(o))this.update(e,t,n,a,l,null,o);else{if(!e._types[t])throw new Error("Unknown type '"+t+"'");!function(){var r=new XMLHttpRequest,c=e.convert(t,n,a);r.open("PATCH",i._base+"/"+t+"/"+n,!0),r.onload=function(){if(r.status>=200&&r.status<300)try{e.add(c),l&&l.call(s,e.find(c.type,c.id))}catch(t){o&&o.call(s,t)}else o&&o.call(s)},r.send({data:JSON.stringify(c)})}()}}}]),e}();exports["default"]=AjaxAdapter,module.exports=exports["default"]; + +},{}],3:[function(require,module,exports){ +"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{"default":e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r