diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index ad84ef7..03af3ea 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1,27 +1,43 @@
-# Contributing
+# Contributing to js-data core
-[Read the Contributing Guide](http://js-data.io/docs/contributing).
+[Read the general Contributing Guide](http://js-data.io/docs/contributing).
-## Support
+## Project structure
-[Find out how to Get Support](http://js-data.io/docs/support).
+* `dist/` - Contains final build files for distribution (js-data-http)
+* `doc/` - Output folder for JSDocs
+* `fetch/` - Contains js-data-fetch package files
+ * `dist/` - Contains final build files for distribution (js-data-fetch)
+* `node/` - Contains js-data-http-node package files
+ * `dist/` - Contains final build files for distribution (js-data-http-node)
+* `scripts/ - Various build scripts
+* `src/` - Project source code
+* `test/` - Project tests
-## Community
+## Clone, build & test
-[Explore the Community](http://js-data.io/docs/community).
+1. `clone git@github.com:js-data/js-data-http.git`
+1. `cd js-data-http`
+1. `npm install`
+1. `npm test` - Build and test
-### Have write access?
-
-To cut a release:
+## To cut a release
1. Checkout master
1. Bump version in `package.json` appropriately
-1. Run `npm run release`
1. Update `CHANGELOG.md` appropriately
-1. Commit and push changes, including the `dist/` folder
+1. Run `npm run release`
+1. Commit and push changes
+1. Checkout `release`, merge `master` into `release`
+1. Run `npm run release` again
+1. Commit and push changes
1. Make a GitHub release
+ - tag from `release` branch
- set tag name to version
- set release name to version
- set release body to changelog entry for the version
- - attach the files in the `dist/` folder
+ - upload the files in the `dist/` folder
1. `npm publish .`
+1. checkout `master`
+
+See also [Community & Support](http://js-data.io/docs/community).
diff --git a/.gitignore b/.gitignore
index 33745c3..d810ef2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+dist/*.js
+dist/*.map
bower_components/
.idea/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c07f8e..bf89495 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,11 +1,12 @@
##### 3.0.0-beta.3 - 28 April 2016
###### Breaking changes
-- js-data-http.js no longer exports a default module, you must now do:
+- js-data-http/js-data-fetch/js-data-http-node no longer export a default module, instead you must do:
- `import {HttpAdapter} from 'js-data-http'
- `var HttpAdapter = require('js-data-http').HttpAdapter
- `var adapter = new window.JSDataHttp.HttpAdapter()`
- `define(['js-data-http'], function (JSDataHttp) { var adapter = new window.JSDataHttp.HttpAdapter(); })
+- Removed `dist/` files from the `master` branch to a `release` branch to cut down on noise
###### Backwards compatible changes
- Added `typings` field to `package.json`
diff --git a/README.md b/README.md
index f877c90..2864a5a 100644
--- a/README.md
+++ b/README.md
@@ -4,33 +4,33 @@
[![Slack Status][sl_b]][sl_l]
[![npm version][npm_b]][npm_l]
-[![Circle CI][circle_b]][circle_l]
[![npm downloads][dn_b]][dn_l]
+[![Circle CI][circle_b]][circle_l]
[![Coverage Status][cov_b]][cov_l]
-[![Codacy][cod_b]][cod_l]
This repo contains HTTP adapters for [js-data](http://www.js-data.io/):
-- js-data-http - HTTP (XHR, includes [axios][axios]) adapter for js-data in the
-browser. Capable of using `window.fetch` instead of axios.
-- js-data-fetch - Same as js-data-http but doesn't include axios and will use
+- js-data-http - HTTP (XHR, includes [`axios`][axios]) adapter for JSData in the
+browser. Capable of using `window.fetch` instead of axios. __Only works in the browser__.
+- js-data-fetch - Same as `js-data-http` but _does not_ include `axios` and will use
`window.fetch` if available and if you don't provide your own http library.
-- js-data-http-node - Same as js-data-http but runs on Node.js. Depends on axios
-and will use axios unless you provide a different http library.
+- js-data-http-node - Same as `js-data-http` but runs on Node.js. Depends on `axios`
+and will use `axios` unless you provide a different http library.
Tested on IE9, Chrome 46, Firefox 41 & Safari 7.1 using
-To get started, visit the main website at __[http://js-data.io](http://www.js-data.io/v3.0/docs/js-data-http)__.
+To get started, visit the main website at __[http://js-data.io](http://www.js-data.io)__.
## Links
-* [Quick start](http://www.js-data.io/v3.0/docs/js-data-http)
-* [Guides and Tutorials](http://www.js-data.io/v3.0/docs/home)
-* [API Reference Docs](http://api.js-data.io/js-data-http)
-* [Community](http://js-data.io/docs/community)
-* [Support](http://js-data.io/docs/support)
-* [Contributing](http://js-data.io/docs/contributing)
+* [Quick start](http://www.js-data.io/v3.0/docs/home#quick-start) - Get started in 5 minutes
+* [Guides and Tutorials](http://www.js-data.io/v3.0/docs/home) - Learn how to use JSData
+* [HttpAdapter Guide](http://www.js-data.io/v3.0/docs/js-data-http) - Learn how to use the HttpAdapter
+* [API Reference Docs](http://api.js-data.io) - Explore components, methods, options, etc.
+* [Community & Support](http://js-data.io/docs/community) - Find solutions and chat with the community
+* [General Contributing Guide](http://js-data.io/docs/contributing) - Give back and move the project forward
+ * [Contributing to js-data-http](https://github.com/js-data/js-data-http/blob/master/.github/CONTRIBUTING.md)
## License
@@ -44,14 +44,11 @@ Copyright (c) 2014-2016 js-data-http project authors
[sl_b]: http://slack.js-data.io/badge.svg
[sl_l]: http://slack.js-data.io
-[so]: http://stackoverflow.com/questions/tagged/jsdata
[npm_b]: https://img.shields.io/npm/v/js-data-http.svg?style=flat
[npm_l]: https://www.npmjs.org/package/js-data-http
-[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-http/master.svg?style=flat
-[circle_l]: https://circleci.com/gh/js-data/js-data-http/tree/master
[dn_b]: https://img.shields.io/npm/dm/js-data-http.svg?style=flat
[dn_l]: https://www.npmjs.org/package/js-data-http
+[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-http/master.svg?style=flat
+[circle_l]: https://circleci.com/gh/js-data/js-data-http/tree/master
[cov_b]: https://img.shields.io/codecov/c/github/js-data/js-data-http/3.0.svg?style=flat
[cov_l]: https://codecov.io/github/js-data/js-data-http
-[cod_b]: https://img.shields.io/codacy/3931bbd8d838463297f70640aa78251b.svg
-[cod_l]: https://www.codacy.com/app/jasondobry/js-data-http/dashboard
\ No newline at end of file
diff --git a/dist/js-data-http.js b/dist/js-data-http.js
deleted file mode 100644
index 4b8835f..0000000
--- a/dist/js-data-http.js
+++ /dev/null
@@ -1,4170 +0,0 @@
-/*!
-* js-data-http
-* @version 3.0.0-beta.2 - Homepage
-* @copyright (c) 2014-2016 js-data-http project authors
-* @license MIT
-*
-* @overview HTTP (XHR) adapter for js-data in the browser.
-*/
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("js-data"));
- else if(typeof define === 'function' && define.amd)
- define(["js-data"], factory);
- else if(typeof exports === 'object')
- exports["HttpAdapter"] = factory(require("js-data"));
- else
- root["HttpAdapter"] = factory(root["JSData"]);
-})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- var _jsData = __webpack_require__(1);
-
- var _jsDataAdapter = __webpack_require__(2);
-
- var _jsDataAdapter2 = _interopRequireDefault(_jsDataAdapter);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /* global fetch:true Headers:true Request:true */
- var axios = __webpack_require__(3);
-
-
- var hasFetch = false;
-
- try {
- hasFetch = window && window.fetch;
- } catch (e) {}
-
- var noop = function noop() {
- var self = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var opts = args[args.length - 1];
- self.dbg.apply(self, [opts.op].concat(args));
- return _jsData.utils.resolve();
- };
-
- var noop2 = function noop2() {
- var self = this;
-
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- var opts = args[args.length - 2];
- self.dbg.apply(self, [opts.op].concat(args));
- return _jsData.utils.resolve();
- };
-
- function isValidString(value) {
- return value != null && value !== '';
- }
- function join(items, separator) {
- separator || (separator = '');
- return items.filter(isValidString).join(separator);
- }
- function makePath() {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
-
- var result = join(args, '/');
- return result.replace(/([^:\/]|^)\/{2,}/g, '$1/');
- }
-
- function encode(val) {
- return encodeURIComponent(val).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
- }
-
- function buildUrl(url, params) {
- if (!params) {
- return url;
- }
-
- var parts = [];
-
- _jsData.utils.forOwn(params, function (val, key) {
- if (val === null || typeof val === 'undefined') {
- return;
- }
- if (!_jsData.utils.isArray(val)) {
- val = [val];
- }
-
- val.forEach(function (v) {
- if (window.toString.call(v) === '[object Date]') {
- v = v.toISOString();
- } else if (_jsData.utils.isObject(v)) {
- v = _jsData.utils.toJson(v);
- }
- parts.push(encode(key) + '=' + encode(v));
- });
- });
-
- if (parts.length > 0) {
- url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
- }
-
- return url;
- }
-
- var __super__ = _jsDataAdapter2.default.prototype;
-
- var DEFAULTS = {
- // Default and user-defined settings
- /**
- * @name HttpAdapter#basePath
- * @type {string}
- */
- basePath: '',
-
- /**
- * @name HttpAdapter#forceTrailingSlash
- * @type {boolean}
- * @default false
- */
- forceTrailingSlash: false,
-
- /**
- * @name HttpAdapter#http
- * @type {Function}
- */
- http: axios,
-
- /**
- * @name HttpAdapter#httpConfig
- * @type {Object}
- */
- httpConfig: {},
-
- /**
- * @name HttpAdapter#suffix
- * @type {string}
- */
- suffix: '',
-
- /**
- * @name HttpAdapter#useFetch
- * @type {boolean}
- * @default false
- */
- useFetch: false
- };
-
- /**
- * HttpAdapter class.
- *
- * @class HttpAdapter
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.basePath=''] TODO
- * @param {boolean} [opts.debug=false] TODO
- * @param {boolean} [opts.forceTrailingSlash=false] TODO
- * @param {Object} [opts.http=axios] TODO
- * @param {Object} [opts.httpConfig={}] TODO
- * @param {string} [opts.suffix=''] TODO
- * @param {boolean} [opts.useFetch=false] TODO
- */
- function HttpAdapter(opts) {
- var self = this;
- opts || (opts = {});
- _jsData.utils.fillIn(opts, DEFAULTS);
- _jsDataAdapter2.default.call(self, opts);
- }
-
- // Setup prototype inheritance from Adapter
- HttpAdapter.prototype = Object.create(_jsDataAdapter2.default.prototype, {
- constructor: {
- value: HttpAdapter,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
-
- Object.defineProperty(HttpAdapter, '__super__', {
- configurable: true,
- value: _jsDataAdapter2.default
- });
-
- _jsData.utils.addHiddenPropsToTarget(HttpAdapter.prototype, {
- /**
- * @name HttpAdapter#afterDEL
- * @method
- * @param {string} url
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterDEL: noop2,
-
- /**
- * @name HttpAdapter#afterGET
- * @method
- * @param {string} url
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterGET: noop2,
-
- /**
- * @name HttpAdapter#afterHTTP
- * @method
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterHTTP: noop2,
-
- /**
- * @name HttpAdapter#afterPOST
- * @method
- * @param {string} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterPOST: noop2,
-
- /**
- * @name HttpAdapter#afterPUT
- * @method
- * @param {string} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterPUT: noop2,
-
- /**
- * @name HttpAdapter#beforeDEL
- * @method
- * @param {Object} url
- * @param {Object} config
- * @param {Object} opts
- */
- beforeDEL: noop,
-
- /**
- * @name HttpAdapter#beforeGET
- * @method
- * @param {Object} url
- * @param {Object} config
- * @param {Object} opts
- */
- beforeGET: noop,
-
- /**
- * @name HttpAdapter#beforeHTTP
- * @method
- * @param {Object} config
- * @param {Object} opts
- */
- beforeHTTP: noop,
-
- /**
- * @name HttpAdapter#beforePOST
- * @method
- * @param {Object} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- */
- beforePOST: noop,
-
- /**
- * @name HttpAdapter#beforePUT
- * @method
- * @param {Object} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- */
- beforePUT: noop,
-
- _count: function _count(mapper, query, opts) {
- var self = this;
- return self.GET(self.getPath('count', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _create: function _create(mapper, props, opts) {
- var self = this;
- return self.POST(self.getPath('create', mapper, props, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _createMany: function _createMany(mapper, props, opts) {
- var self = this;
- return self.POST(self.getPath('createMany', mapper, null, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _destroy: function _destroy(mapper, id, opts) {
- var self = this;
- return self.DEL(self.getPath('destroy', mapper, id, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _destroyAll: function _destroyAll(mapper, query, opts) {
- var self = this;
- return self.DEL(self.getPath('destroyAll', mapper, null, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _end: function _end(mapper, opts, response) {
- return [this.deserialize(mapper, response, opts), response];
- },
- _find: function _find(mapper, id, opts) {
- var self = this;
- return self.GET(self.getPath('find', mapper, id, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _findAll: function _findAll(mapper, query, opts) {
- var self = this;
- return self.GET(self.getPath('findAll', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _sum: function _sum(mapper, field, query, opts) {
- var self = this;
- return self.GET(self.getPath('sum', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _update: function _update(mapper, id, props, opts) {
- var self = this;
- return self.PUT(self.getPath('update', mapper, id, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _updateAll: function _updateAll(mapper, props, query, opts) {
- var self = this;
- return self.PUT(self.getPath('updateAll', mapper, null, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _updateMany: function _updateMany(mapper, records, opts) {
- var self = this;
- return self.PUT(self.getPath('updateMany', mapper, null, opts), self.serialize(mapper, records, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
-
-
- /**
- * Retrieve the number of records that match the selection `query`.
- *
- * @name HttpAdapter#count
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- count: function count(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params.count = true;
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.count.call(self, mapper, query, opts);
- },
-
-
- /**
- * Create a new the record from the provided `props`.
- *
- * @name HttpAdapter#create
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props Properties to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- create: function create(mapper, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.create.call(self, mapper, props, opts);
- },
-
-
- /**
- * Create multiple new records in batch.
- *
- * @name HttpAdapter#createMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Array} props Array of property objects to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- createMany: function createMany(mapper, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.createMany.call(self, mapper, props, opts);
- },
-
-
- /**
- * Make an Http request to `url` according to the configuration in `config`.
- *
- * @name HttpAdapter#DEL
- * @method
- * @param {string} url Url for the request.
- * @param {Object} [config] Http configuration that will be passed to
- * {@link HttpAdapter#HTTP}.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- DEL: function DEL(url, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.method = config.method || 'delete';
-
- // beforeDEL lifecycle hook
- op = opts.op = 'beforeDEL';
- return _jsData.utils.resolve(self[op](url, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'DEL';
- self.dbg(op, url, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterDEL lifecycle hook
- op = opts.op = 'afterDEL';
- return _jsData.utils.resolve(self[op](url, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Transform the server response object into the payload that will be returned
- * to JSData.
- *
- * @name HttpAdapter#deserialize
- * @method
- * @param {Object} mapper The mapper used for the operation.
- * @param {Object} response Response object from {@link HttpAdapter#HTTP}.
- * @param {Object} opts Configuration options.
- * @return {(Object|Array)} Deserialized data.
- */
- deserialize: function deserialize(mapper, response, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.deserialize)) {
- return opts.deserialize(mapper, response, opts);
- }
- if (_jsData.utils.isFunction(mapper.deserialize)) {
- return mapper.deserialize(mapper, response, opts);
- }
- if (response && response.hasOwnProperty('data')) {
- return response.data;
- }
- return response;
- },
-
-
- /**
- * Destroy the record with the given primary key.
- *
- * @name HttpAdapter#destroy
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to destroy.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- destroy: function destroy(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.destroy.call(self, mapper, id, opts);
- },
-
-
- /**
- * Destroy the records that match the selection `query`.
- *
- * @name HttpAdapter#destroyAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- destroyAll: function destroyAll(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.destroyAll.call(self, mapper, query, opts);
- },
-
-
- /**
- * Log an error.
- *
- * @name HttpAdapter#error
- * @method
- * @param {...*} [args] Arguments to log.
- */
- error: function error() {
- if (console) {
- var _console;
-
- (_console = console)[typeof console.error === 'function' ? 'error' : 'log'].apply(_console, arguments);
- }
- },
-
-
- /**
- * Make an Http request using `window.fetch`.
- *
- * @name HttpAdapter#fetch
- * @method
- * @param {Object} config Request configuration.
- * @param {Object} config.data Payload for the request.
- * @param {string} config.method Http method for the request.
- * @param {Object} config.headers Headers for the request.
- * @param {Object} config.params Querystring for the request.
- * @param {string} config.url Url for the request.
- * @param {Object} [opts] Configuration options.
- */
- fetch: function (_fetch) {
- function fetch(_x, _x2) {
- return _fetch.apply(this, arguments);
- }
-
- fetch.toString = function () {
- return _fetch.toString();
- };
-
- return fetch;
- }(function (config, opts) {
- var requestConfig = {
- method: config.method,
- // turn the plain headers object into the Fetch Headers object
- headers: new Headers(config.headers)
- };
-
- if (config.data) {
- requestConfig.body = _jsData.utils.toJson(config.data);
- }
-
- return fetch(new Request(buildUrl(config.url, config.params), requestConfig)).then(function (response) {
- response.config = {
- method: config.method,
- url: config.url
- };
- return response.json().then(function (data) {
- response.data = data;
- return response;
- });
- });
- }),
-
-
- /**
- * Retrieve the record with the given primary key.
- *
- * @name HttpAdapter#find
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to retrieve.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- find: function find(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.find.call(self, mapper, id, opts);
- },
-
-
- /**
- * Retrieve the records that match the selection `query`.
- *
- * @name HttpAdapter#findAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- findAll: function findAll(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.findAll.call(self, mapper, query, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#GET
- * @method
- * @param {string} url The url for the request.
- * @param {Object} config Request configuration options.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- GET: function GET(url, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.method = config.method || 'get';
-
- // beforeGET lifecycle hook
- op = opts.op = 'beforeGET';
- return _jsData.utils.resolve(self[op](url, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'GET';
- self.dbg(op, url, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterGET lifecycle hook
- op = opts.op = 'afterGET';
- return _jsData.utils.resolve(self[op](url, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * @name HttpAdapter#getEndpoint
- * @method
- * @param {Object} mapper TODO
- * @param {*} id TODO
- * @param {boolean} opts TODO
- * @return {string} Full path.
- */
- getEndpoint: function getEndpoint(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = _jsData.utils.isUndefined(opts.params) ? {} : opts.params;
- var relationList = mapper.relationList || [];
- var endpoint = _jsData.utils.isUndefined(opts.endpoint) ? _jsData.utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint : opts.endpoint;
-
- relationList.forEach(function (def) {
- if (def.type !== 'belongsTo' || !def.parent) {
- return;
- }
- var item = void 0;
- var parentKey = def.foreignKey;
- var parentDef = def.getRelation();
- var parentId = opts.params[parentKey];
-
- if (parentId === false || !parentKey || !parentDef) {
- if (parentId === false) {
- delete opts.params[parentKey];
- }
- return false;
- } else {
- delete opts.params[parentKey];
-
- if (_jsData.utils.isObject(id)) {
- item = id;
- }
-
- if (item) {
- parentId = parentId || def.getForeignKey(item) || (def.getLocalField(item) ? _jsData.utils.get(def.getLocalField(item), parentDef.idAttribute) : null);
- }
-
- if (parentId) {
- var _ret = function () {
- delete opts.endpoint;
- var _opts = {};
- _jsData.utils.forOwn(opts, function (value, key) {
- _opts[key] = value;
- });
- _jsData.utils._(_opts, parentDef);
- endpoint = makePath(self.getEndpoint(parentDef, parentId, _opts), parentId, endpoint);
- return {
- v: false
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- }
- });
-
- return endpoint;
- },
-
-
- /**
- * @name HttpAdapter#getPath
- * @method
- * @param {string} method TODO
- * @param {Object} mapper TODO
- * @param {(string|number)?} id TODO
- * @param {Object} opts Configuration options.
- */
- getPath: function getPath(method, mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- var args = [_jsData.utils.isUndefined(opts.basePath) ? _jsData.utils.isUndefined(mapper.basePath) ? self.basePath : mapper.basePath : opts.basePath, self.getEndpoint(mapper, _jsData.utils.isString(id) || _jsData.utils.isNumber(id) || method === 'create' ? id : null, opts)];
- if (method === 'find' || method === 'update' || method === 'destroy') {
- args.push(id);
- }
- return makePath.apply(_jsData.utils, args);
- },
- getParams: function getParams(opts) {
- opts || (opts = {});
- if (_jsData.utils.isUndefined(opts.params)) {
- return {};
- }
- return _jsData.utils.copy(opts.params);
- },
- getSuffix: function getSuffix(mapper, opts) {
- opts || (opts = {});
- if (_jsData.utils.isUndefined(opts.suffix)) {
- if (_jsData.utils.isUndefined(mapper.suffix)) {
- return this.suffix;
- }
- return mapper.suffix;
- }
- return opts.suffix;
- },
-
-
- /**
- * Make an Http request.
- *
- * @name HttpAdapter#HTTP
- * @method
- * @param {Object} config Request configuration options.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- HTTP: function HTTP(config, opts) {
- var self = this;
- var start = new Date();
- opts || (opts = {});
- var payload = config.data;
- var cache = config.cache;
- var timeout = config.timeout;
- config = _jsData.utils.copy(config, null, null, null, ['data', 'cache', 'timeout']);
- config = _jsData.utils.deepMixIn(config, self.httpConfig);
- config.data = payload;
- config.cache = cache;
- config.timeout = timeout;
- if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
- config.url += '/';
- }
- config.method = config.method.toUpperCase();
- var suffix = config.suffix || opts.suffix || self.suffix;
- if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
- config.url += suffix;
- }
-
- function logResponse(data) {
- var str = start.toUTCString() + ' - ' + config.method.toUpperCase() + ' ' + config.url + ' - ' + data.status + ' ' + (new Date().getTime() - start.getTime()) + 'ms';
- if (data.status >= 200 && data.status < 300) {
- if (self.log) {
- self.dbg('debug', str, data);
- }
- return data;
- } else {
- if (self.error) {
- self.error('\'FAILED: ' + str, data);
- }
- return _jsData.utils.reject(data);
- }
- }
-
- if (!self.http) {
- throw new Error('You have not configured this adapter with an http library!');
- }
-
- return _jsData.utils.resolve(self.beforeHTTP(config, opts)).then(function (_config) {
- config = _config || config;
- if (hasFetch && (self.useFetch || opts.useFetch || !self.http)) {
- return self.fetch(config, opts).then(logResponse, logResponse);
- }
- return self.http(config).then(logResponse, logResponse).catch(function (err) {
- return self.responseError(err, config, opts);
- });
- }).then(function (response) {
- return _jsData.utils.resolve(self.afterHTTP(config, opts, response)).then(function (_response) {
- return _response || response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#POST
- * @method
- * @param {*} url TODO
- * @param {Object} data TODO
- * @param {Object} config TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- POST: function POST(url, data, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.data = data || config.data;
- config.method = config.method || 'post';
-
- // beforePOST lifecycle hook
- op = opts.op = 'beforePOST';
- return _jsData.utils.resolve(self[op](url, data, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'POST';
- self.dbg(op, url, data, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterPOST lifecycle hook
- op = opts.op = 'afterPOST';
- return _jsData.utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#PUT
- * @method
- * @param {*} url TODO
- * @param {Object} data TODO
- * @param {Object} config TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- PUT: function PUT(url, data, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.data = data || config.data;
- config.method = config.method || 'put';
-
- // beforePUT lifecycle hook
- op = opts.op = 'beforePUT';
- return _jsData.utils.resolve(self[op](url, data, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'PUT';
- self.dbg(op, url, data, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterPUT lifecycle hook
- op = opts.op = 'afterPUT';
- return _jsData.utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#queryTransform
- * @method
- * @param {Object} mapper TODO
- * @param {*} params TODO
- * @param {*} opts TODO
- * @return {*} Transformed params.
- */
- queryTransform: function queryTransform(mapper, params, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.queryTransform)) {
- return opts.queryTransform(mapper, params, opts);
- }
- if (_jsData.utils.isFunction(mapper.queryTransform)) {
- return mapper.queryTransform(mapper, params, opts);
- }
- return params;
- },
-
-
- /**
- * Error handler invoked when the promise returned by {@link HttpAdapter#http}
- * is rejected. Default implementation is to just return the error wrapped in
- * a rejected Promise, aka rethrow the error. {@link HttpAdapter#http} is
- * called by {@link HttpAdapter#HTTP}.
- *
- * @name HttpAdapter#responseError
- * @method
- * @param {*} err The error that {@link HttpAdapter#http} rejected with.
- * @param {Object} config The `config` argument that was passed to {@link HttpAdapter#HTTP}.
- * @param {*} opts The `opts` argument that was passed to {@link HttpAdapter#HTTP}.
- * @return {Promise}
- */
- responseError: function responseError(err, config, opts) {
- return _jsData.utils.reject(err);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#serialize
- * @method
- * @param {Object} mapper TODO
- * @param {Object} data TODO
- * @param {*} opts TODO
- * @return {*} Serialized data.
- */
- serialize: function serialize(mapper, data, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.serialize)) {
- return opts.serialize(mapper, data, opts);
- }
- if (_jsData.utils.isFunction(mapper.serialize)) {
- return mapper.serialize(mapper, data, opts);
- }
- return data;
- },
-
-
- /**
- * Retrieve the sum of the field of the records that match the selection query.
- *
- * @name HttpAdapter#sum
- * @method
- * @param {Object} mapper The mapper.
- * @param {string} field The field to sum.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- sum: function sum(mapper, field, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- if (!_jsData.utils.utils.isString(field)) {
- throw new Error('field must be a string!');
- }
- opts.params = self.getParams(opts);
- opts.params.sum = field;
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.sum.call(self, mapper, field, query, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#update
- * @method
- * @param {Object} mapper TODO
- * @param {*} id TODO
- * @param {*} props TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- update: function update(mapper, id, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.update.call(self, mapper, id, props, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#updateAll
- * @method
- * @param {Object} mapper TODO
- * @param {Object} props TODO
- * @param {Object} query TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- updateAll: function updateAll(mapper, props, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.updateAll.call(self, mapper, props, query, opts);
- },
-
-
- /**
- * Update multiple records in batch.
- *
- * {@link HttpAdapter#beforeUpdateMany} will be called before calling
- * {@link HttpAdapter#PUT}.
- * {@link HttpAdapter#afterUpdateMany} will be called after calling
- * {@link HttpAdapter#PUT}.
- *
- * @name HttpAdapter#updateMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Array} records Array of property objects to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- updateMany: function updateMany(mapper, records, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.updateMany.call(self, mapper, records, opts);
- }
- });
-
- /**
- * Add an Http actions to a mapper.
- *
- * @name HttpAdapter.addAction
- * @method
- * @param {string} name Name of the new action.
- * @param {Object} [opts] Action configuration
- * @param {string} [opts.adapter]
- * @param {string} [opts.pathname]
- * @param {Function} [opts.request]
- * @param {Function} [opts.response]
- * @param {Function} [opts.responseError]
- * @return {Function} Decoration function, which should be passed the mapper to
- * decorate when invoked.
- */
- HttpAdapter.addAction = function (name, opts) {
- if (!name || !_jsData.utils.isString(name)) {
- throw new TypeError('action(name[, opts]): Expected: string, Found: ' + (typeof name === 'undefined' ? 'undefined' : _typeof(name)));
- }
- return function (mapper) {
- if (mapper[name]) {
- throw new Error('action(name[, opts]): ' + name + ' already exists on target!');
- }
- opts.request = opts.request || function (config) {
- return config;
- };
- opts.response = opts.response || function (response) {
- return response;
- };
- opts.responseError = opts.responseError || function (err) {
- return _jsData.utils.reject(err);
- };
- mapper[name] = function (id, _opts) {
- var self = this;
- if (_jsData.utils.isObject(id)) {
- _opts = id;
- }
- _opts = _opts || {};
- var adapter = self.getAdapter(opts.adapter || self.defaultAdapter || 'http');
- var config = {};
- _jsData.utils.fillIn(config, opts);
- if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {
- _opts.endpoint = config.endpoint;
- }
- if (typeof _opts.getEndpoint === 'function') {
- config.url = _opts.getEndpoint(self, _opts);
- } else {
- var _args = [_opts.basePath || self.basePath || adapter.basePath, adapter.getEndpoint(self, _jsData.utils.isSorN(id) ? id : null, _opts)];
- if (_jsData.utils.isSorN(id)) {
- _args.push(id);
- }
- _args.push(opts.pathname || name);
- config.url = makePath.apply(null, _args);
- }
- config.method = config.method || 'GET';
- config.mapper = self.name;
- _jsData.utils.deepMixIn(config)(_opts);
- return _jsData.utils.resolve(config).then(_opts.request || opts.request).then(function (config) {
- return adapter.HTTP(config);
- }).then(function (data) {
- if (data && data.config) {
- data.config.mapper = self.name;
- }
- return data;
- }).then(_opts.response || opts.response, _opts.responseError || opts.responseError);
- };
- return mapper;
- };
- };
-
- /**
- * Add multiple Http actions to a mapper. See {@link HttpAdapter.addAction} for
- * action configuration options.
- *
- * @name HttpAdapter.addActions
- * @method
- * @param {Object.} opts Object where the key is an action name
- * and the value is the configuration for the action.
- * @return {Function} Decoration function, which should be passed the mapper to
- * decorate when invoked.
- */
- HttpAdapter.addActions = function (opts) {
- opts || (opts = {});
- return function (mapper) {
- _jsData.utils.forOwn(mapper, function (value, key) {
- HttpAdapter.addAction(key, value)(mapper);
- });
- return mapper;
- };
- };
-
- /**
- * Alternative to ES6 class syntax for extending `HttpAdapter`.
- *
- * __ES6__:
- * ```javascript
- * class MyHttpAdapter extends HttpAdapter {
- * deserialize (Model, data, opts) {
- * const data = super.deserialize(Model, data, opts)
- * data.foo = 'bar'
- * return data
- * }
- * }
- * ```
- *
- * __ES5__:
- * ```javascript
- * var instanceProps = {
- * // override deserialize
- * deserialize: function (Model, data, opts) {
- * var Ctor = this.constructor
- * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize
- * // call the super deserialize
- * var data = superDeserialize(Model, data, opts)
- * data.foo = 'bar'
- * return data
- * },
- * say: function () { return 'hi' }
- * }
- * var classProps = {
- * yell: function () { return 'HI' }
- * }
- *
- * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps)
- * var adapter = new MyHttpAdapter()
- * adapter.say() // "hi"
- * MyHttpAdapter.yell() // "HI"
- * ```
- *
- * @name HttpAdapter.extend
- * @method
- * @param {Object} [instanceProps] Properties that will be added to the
- * prototype of the subclass.
- * @param {Object} [classProps] Properties that will be added as static
- * properties to the subclass itself.
- * @return {Object} Subclass of `HttpAdapter`.
- */
- HttpAdapter.extend = _jsData.utils.extend;
-
- /**
- * Details of the current version of the `js-data-http` module.
- *
- * @name HttpAdapter.version
- * @type {Object}
- * @property {string} version.full The full semver value.
- * @property {number} version.major The major version number.
- * @property {number} version.minor The minor version number.
- * @property {number} version.patch The patch version number.
- * @property {(string|boolean)} version.alpha The alpha version value,
- * otherwise `false` if the current version is not alpha.
- * @property {(string|boolean)} version.beta The beta version value,
- * otherwise `false` if the current version is not beta.
- */
- HttpAdapter.version = {
- beta: 2,
- full: '3.0.0-beta.2',
- major: 3,
- minor: 0,
- patch: 0
-};
-
- /**
- * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http`
- * that works on Node.js is registered in NPM as `js-data-http-node`. The build
- * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower
- * as `js-data-fetch`.
- *
- * __Script tag__:
- * ```javascript
- * window.HttpAdapter
- * ```
- * __CommonJS__:
- * ```javascript
- * var HttpAdapter = require('js-data-http')
- * ```
- * __ES6 Modules__:
- * ```javascript
- * import HttpAdapter from 'js-data-http'
- * ```
- * __AMD__:
- * ```javascript
- * define('myApp', ['js-data-http'], function (HttpAdapter) { ... })
- * ```
- *
- * @module js-data-http
- */
-
- module.exports = HttpAdapter;
-
-/***/ },
-/* 1 */
-/***/ function(module, exports) {
-
- module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- (function (global, factory) {
- true ? factory(__webpack_require__(1)) :
- typeof define === 'function' && define.amd ? define('js-data-adapter', ['js-data'], factory) :
- (factory(global.JSData));
- }(this, function (jsData) { 'use strict';
-
- var babelHelpers = {};
- babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
-
- babelHelpers.defineProperty = function (obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
- };
-
- babelHelpers.slicedToArray = function () {
- function sliceIterator(arr, i) {
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
-
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
-
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"]) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
-
- return _arr;
- }
-
- return function (arr, i) {
- if (Array.isArray(arr)) {
- return arr;
- } else if (Symbol.iterator in Object(arr)) {
- return sliceIterator(arr, i);
- } else {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }
- };
- }();
-
- babelHelpers;
-
- var noop = function noop() {
- var self = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var opts = args[args.length - 1];
- self.dbg.apply(self, [opts.op].concat(args));
- return jsData.utils.resolve();
- };
-
- var noop2 = function noop2() {
- var self = this;
-
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- var opts = args[args.length - 2];
- self.dbg.apply(self, [opts.op].concat(args));
- return jsData.utils.resolve();
- };
-
- var unique = function unique(array) {
- var seen = {};
- var final = [];
- array.forEach(function (item) {
- if (item in seen) {
- return;
- }
- final.push(item);
- seen[item] = 0;
- });
- return final;
- };
-
- var withoutRelations = function withoutRelations(mapper, props) {
- return jsData.utils.omit(props, mapper.relationFields || []);
- };
-
- var DEFAULTS = {
- /**
- * Whether to log debugging information.
- *
- * @name Adapter#debug
- * @type {boolean}
- * @default false
- */
- debug: false,
-
- /**
- * Whether to return a more detailed response object.
- *
- * @name Adapter#raw
- * @type {boolean}
- * @default false
- */
- raw: false
- };
-
- /**
- * Abstract class meant to be extended by adapters.
- *
- * @class Adapter
- * @abstract
- * @param {Object} [opts] Configuration opts.
- * @param {boolean} [opts.debug=false] Whether to log debugging information.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed response
- * object.
- */
- function Adapter(opts) {
- var self = this;
- opts || (opts = {});
- jsData.utils.fillIn(opts, DEFAULTS);
- jsData.utils.fillIn(self, opts);
- }
-
- Adapter.reserved = ['orderBy', 'sort', 'limit', 'offset', 'skip', 'where'];
-
- /**
- * Response object used when `raw` is `true`. May contain other fields in
- * addition to `data`.
- *
- * @typedef {Object} Response
- * @property {Object} data Response data.
- * @property {string} op The operation for which the response was created.
- */
- function Response(data, meta, op) {
- var self = this;
- meta || (meta = {});
- self.data = data;
- jsData.utils.fillIn(self, meta);
- self.op = op;
- }
-
- Adapter.Response = Response;
-
- /**
- * Alternative to ES6 class syntax for extending `Adapter`.
- *
- * @name Adapter.extend
- * @method
- * @param {Object} [instanceProps] Properties that will be added to the
- * prototype of the subclass.
- * @param {Object} [classProps] Properties that will be added as static
- * properties to the subclass itself.
- * @return {Object} Subclass of `Adapter`.
- */
- Adapter.extend = jsData.utils.extend;
-
- jsData.utils.addHiddenPropsToTarget(Adapter.prototype, {
- /**
- * Lifecycle method method called by count.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes count to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the count.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
- *
- * @name Adapter#afterCount
- * @method
- * @param {Object} mapper The `mapper` argument passed to count.
- * @param {Object} props The `props` argument passed to count.
- * @param {Object} opts The `opts` argument passed to count.
- * @property {string} opts.op `afterCount`
- * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCount: noop2,
-
- /**
- * Lifecycle method method called by create.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes create to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created record.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
- *
- * @name Adapter#afterCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to create.
- * @param {Object} props The `props` argument passed to create.
- * @param {Object} opts The `opts` argument passed to create.
- * @property {string} opts.op `afterCreate`
- * @param {Object|Response} response Created record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCreate: noop2,
-
- /**
- * Lifecycle method method called by createMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created records.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
- *
- * @name Adapter#afterCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to createMany.
- * @param {Object[]} props The `props` argument passed to createMany.
- * @param {Object} opts The `opts` argument passed to createMany.
- * @property {string} opts.op `afterCreateMany`
- * @param {Object[]|Response} response Created records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCreateMany: noop2,
-
- /**
- * Lifecycle method method called by destroy.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
- *
- * @name Adapter#afterDestroy
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroy.
- * @param {(string|number)} id The `id` argument passed to destroy.
- * @param {Object} opts The `opts` argument passed to destroy.
- * @property {string} opts.op `afterDestroy`
- * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.
- */
- afterDestroy: noop2,
-
- /**
- * Lifecycle method method called by destroyAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
- *
- * @name Adapter#afterDestroyAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroyAll.
- * @param {Object} query The `query` argument passed to destroyAll.
- * @param {Object} opts The `opts` argument passed to destroyAll.
- * @property {string} opts.op `afterDestroyAll`
- * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.
- */
- afterDestroyAll: noop2,
-
- /**
- * Lifecycle method method called by find.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes find to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found record, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
- *
- * @name Adapter#afterFind
- * @method
- * @param {Object} mapper The `mapper` argument passed to find.
- * @param {(string|number)} id The `id` argument passed to find.
- * @param {Object} opts The `opts` argument passed to find.
- * @property {string} opts.op `afterFind`
- * @param {Object|Response} response The found record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterFind: noop2,
-
- /**
- * Lifecycle method method called by findAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
- *
- * @name Adapter#afterFindAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to findAll.
- * @param {Object} query The `query` argument passed to findAll.
- * @param {Object} opts The `opts` argument passed to findAll.
- * @property {string} opts.op `afterFindAll`
- * @param {Object[]|Response} response The found records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterFindAll: noop2,
-
- /**
- * Lifecycle method method called by sum.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes sum to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the sum.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
- *
- * @name Adapter#afterSum
- * @method
- * @param {Object} mapper The `mapper` argument passed to sum.
- * @param {Object} props The `props` argument passed to sum.
- * @param {Object} opts The `opts` argument passed to sum.
- * @property {string} opts.op `afterSum`
- * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.
- */
- afterSum: noop2,
-
- /**
- * Lifecycle method method called by update.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes update to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated record.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
- *
- * @name Adapter#afterUpdate
- * @method
- * @param {Object} mapper The `mapper` argument passed to update.
- * @param {(string|number)} id The `id` argument passed to update.
- * @param {Object} props The `props` argument passed to update.
- * @param {Object} opts The `opts` argument passed to update.
- * @property {string} opts.op `afterUpdate`
- * @param {Object|Response} response The updated record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdate: noop2,
-
- /**
- * Lifecycle method method called by updateAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
- *
- * @name Adapter#afterUpdateAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateAll.
- * @param {Object} props The `props` argument passed to updateAll.
- * @param {Object} query The `query` argument passed to updateAll.
- * @param {Object} opts The `opts` argument passed to updateAll.
- * @property {string} opts.op `afterUpdateAll`
- * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdateAll: noop2,
-
- /**
- * Lifecycle method method called by updateMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
- *
- * @name Adapter#afterUpdateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateMany.
- * @param {Object[]} records The `records` argument passed to updateMany.
- * @param {Object} opts The `opts` argument passed to updateMany.
- * @property {string} opts.op `afterUpdateMany`
- * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdateMany: noop2,
-
- /**
- * Lifecycle method method called by count.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes count to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
- *
- * @name Adapter#beforeCount
- * @method
- * @param {Object} mapper The `mapper` argument passed to count.
- * @param {Object} query The `query` argument passed to count.
- * @param {Object} opts The `opts` argument passed to count.
- * @property {string} opts.op `beforeCount`
- */
- beforeCount: noop,
-
- /**
- * Lifecycle method method called by create.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes create to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
- *
- * @name Adapter#beforeCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to create.
- * @param {Object} props The `props` argument passed to create.
- * @param {Object} opts The `opts` argument passed to create.
- * @property {string} opts.op `beforeCreate`
- */
- beforeCreate: noop,
-
- /**
- * Lifecycle method method called by createMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
- *
- * @name Adapter#beforeCreateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to createMany.
- * @param {Object[]} props The `props` argument passed to createMany.
- * @param {Object} opts The `opts` argument passed to createMany.
- * @property {string} opts.op `beforeCreateMany`
- */
- beforeCreateMany: noop,
-
- /**
- * Lifecycle method method called by destroy.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
- *
- * @name Adapter#beforeDestroy
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroy.
- * @param {(string|number)} id The `id` argument passed to destroy.
- * @param {Object} opts The `opts` argument passed to destroy.
- * @property {string} opts.op `beforeDestroy`
- */
- beforeDestroy: noop,
-
- /**
- * Lifecycle method method called by destroyAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
- *
- * @name Adapter#beforeDestroyAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroyAll.
- * @param {Object} query The `query` argument passed to destroyAll.
- * @param {Object} opts The `opts` argument passed to destroyAll.
- * @property {string} opts.op `beforeDestroyAll`
- */
- beforeDestroyAll: noop,
-
- /**
- * Lifecycle method method called by find.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes find to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
- *
- * @name Adapter#beforeFind
- * @method
- * @param {Object} mapper The `mapper` argument passed to find.
- * @param {(string|number)} id The `id` argument passed to find.
- * @param {Object} opts The `opts` argument passed to find.
- * @property {string} opts.op `beforeFind`
- */
- beforeFind: noop,
-
- /**
- * Lifecycle method method called by findAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
- *
- * @name Adapter#beforeFindAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to findAll.
- * @param {Object} query The `query` argument passed to findAll.
- * @param {Object} opts The `opts` argument passed to findAll.
- * @property {string} opts.op `beforeFindAll`
- */
- beforeFindAll: noop,
-
- /**
- * Lifecycle method method called by sum.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes sum to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
- *
- * @name Adapter#beforeSum
- * @method
- * @param {Object} mapper The `mapper` argument passed to sum.
- * @param {Object} query The `query` argument passed to sum.
- * @param {Object} opts The `opts` argument passed to sum.
- * @property {string} opts.op `beforeSum`
- */
- beforeSum: noop,
-
- /**
- * Lifecycle method method called by update.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes update to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
- *
- * @name Adapter#beforeUpdate
- * @method
- * @param {Object} mapper The `mapper` argument passed to update.
- * @param {(string|number)} id The `id` argument passed to update.
- * @param {Object} props The `props` argument passed to update.
- * @param {Object} opts The `opts` argument passed to update.
- * @property {string} opts.op `beforeUpdate`
- */
- beforeUpdate: noop,
-
- /**
- * Lifecycle method method called by updateAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
- *
- * @name Adapter#beforeUpdateAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateAll.
- * @param {Object} props The `props` argument passed to updateAll.
- * @param {Object} query The `query` argument passed to updateAll.
- * @param {Object} opts The `opts` argument passed to updateAll.
- * @property {string} opts.op `beforeUpdateAll`
- */
- beforeUpdateAll: noop,
-
- /**
- * Lifecycle method method called by updateMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
- *
- * @name Adapter#beforeUpdateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateMany.
- * @param {Object[]} props The `props` argument passed to updateMany.
- * @param {Object} opts The `opts` argument passed to updateMany.
- * @property {string} opts.op `beforeUpdateMany`
- */
- beforeUpdateMany: noop,
-
- /**
- * Shortcut for `#log('debug'[, arg1[, arg2[, argn]]])`.
- *
- * @name Adapter#dbg
- * @method
- */
- dbg: function dbg() {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
-
- this.log.apply(this, ['debug'].concat(args));
- },
-
-
- /**
- * Retrieve the number of records that match the selection query. Called by
- * `Mapper#count`.
- *
- * @name Adapter#count
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- count: function count(mapper, query, opts) {
- var self = this;
- var op = void 0;
- query || (query = {});
- opts || (opts = {});
-
- // beforeCount lifecycle hook
- op = opts.op = 'beforeCount';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- // Allow for re-assignment from lifecycle hook
- op = opts.op = 'count';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._count(mapper, query, opts));
- }).then(function (results) {
- var _results = babelHelpers.slicedToArray(results, 2);
-
- var data = _results[0];
- var result = _results[1];
-
- result || (result = {});
- var response = new Response(data, result, op);
- response = self.respond(response, opts);
-
- // afterCount lifecycle hook
- op = opts.op = 'afterCount';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Create a new record. Called by `Mapper#create`.
- *
- * @name Adapter#create
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The record to be created.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- create: function create(mapper, props, opts) {
- var self = this;
- var op = void 0;
- props || (props = {});
- opts || (opts = {});
-
- // beforeCreate lifecycle hook
- op = opts.op = 'beforeCreate';
- return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- props = withoutRelations(mapper, props);
- op = opts.op = 'create';
- self.dbg(op, mapper, props, opts);
- return jsData.utils.resolve(self._create(mapper, props, opts));
- }).then(function (results) {
- var _results2 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results2[0];
- var result = _results2[1];
-
- result || (result = {});
- var response = new Response(data, result, 'create');
- response.created = data ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterCreate lifecycle hook
- op = opts.op = 'afterCreate';
- return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Create multiple records in a single batch. Called by `Mapper#createMany`.
- *
- * @name Adapter#createMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The records to be created.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- createMany: function createMany(mapper, props, opts) {
- var self = this;
- var op = void 0;
- props || (props = {});
- opts || (opts = {});
-
- // beforeCreateMany lifecycle hook
- op = opts.op = 'beforeCreateMany';
- return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- props = props.map(function (record) {
- return withoutRelations(mapper, record);
- });
- op = opts.op = 'createMany';
- self.dbg(op, mapper, props, opts);
- return jsData.utils.resolve(self._createMany(mapper, props, opts));
- }).then(function (results) {
- var _results3 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results3[0];
- var result = _results3[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'createMany');
- response.created = data.length;
- response = self.respond(response, opts);
-
- // afterCreateMany lifecycle hook
- op = opts.op = 'afterCreateMany';
- return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Destroy the record with the given primary key. Called by
- * `Mapper#destroy`.
- *
- * @name Adapter#destroy
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to destroy.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- destroy: function destroy(mapper, id, opts) {
- var self = this;
- var op = void 0;
- opts || (opts = {});
-
- // beforeDestroy lifecycle hook
- op = opts.op = 'beforeDestroy';
- return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {
- op = opts.op = 'destroy';
- self.dbg(op, mapper, id, opts);
- return jsData.utils.resolve(self._destroy(mapper, id, opts));
- }).then(function (results) {
- var _results4 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results4[0];
- var result = _results4[1];
-
- result || (result = {});
- var response = new Response(data, result, 'destroy');
- response = self.respond(response, opts);
-
- // afterDestroy lifecycle hook
- op = opts.op = 'afterDestroy';
- return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Destroy the records that match the selection query. Called by
- * `Mapper#destroyAll`.
- *
- * @name Adapter#destroyAll
- * @method
- * @param {Object} mapper the mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- destroyAll: function destroyAll(mapper, query, opts) {
- var self = this;
- var op = void 0;
- query || (query = {});
- opts || (opts = {});
-
- // beforeDestroyAll lifecycle hook
- op = opts.op = 'beforeDestroyAll';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- op = opts.op = 'destroyAll';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._destroyAll(mapper, query, opts));
- }).then(function (results) {
- var _results5 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results5[0];
- var result = _results5[1];
-
- result || (result = {});
- var response = new Response(data, result, 'destroyAll');
- response = self.respond(response, opts);
-
- // afterDestroyAll lifecycle hook
- op = opts.op = 'afterDestroyAll';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Return the foreignKey from the given record for the provided relationship.
- *
- * There may be reasons why you may want to override this method, like when
- * the id of the parent doesn't exactly match up to the key on the child.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyForeignKey
- * @method
- * @return {*}
- */
- makeHasManyForeignKey: function makeHasManyForeignKey(mapper, def, record) {
- return def.getForeignKey(record);
- },
-
-
- /**
- * Return the localKeys from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyLocalKeys
- * @method
- * @return {*}
- */
- makeHasManyLocalKeys: function makeHasManyLocalKeys(mapper, def, record) {
- var localKeys = [];
- var itemKeys = jsData.utils.get(record, def.localKeys) || [];
- itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);
- localKeys = localKeys.concat(itemKeys);
- return unique(localKeys).filter(function (x) {
- return x;
- });
- },
-
-
- /**
- * Return the foreignKeys from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyForeignKeys
- * @method
- * @return {*}
- */
- makeHasManyForeignKeys: function makeHasManyForeignKeys(mapper, def, record) {
- return jsData.utils.get(record, mapper.idAttribute);
- },
-
-
- /**
- * Load a hasMany relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadHasMany
- * @method
- * @return {Promise}
- */
- loadHasMany: function loadHasMany(mapper, def, records, __opts) {
- var self = this;
- var singular = false;
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- singular = true;
- records = [records];
- }
- var IDs = records.map(function (record) {
- return self.makeHasManyForeignKey(mapper, def, record);
- });
- var query = {
- where: {}
- };
- var criteria = query.where[def.foreignKey] = {};
- if (singular) {
- // more efficient query when we only have one record
- criteria['=='] = IDs[0];
- } else {
- criteria['in'] = IDs.filter(function (id) {
- return id;
- });
- }
- return self.findAll(def.getRelation(), query, __opts).then(function (relatedItems) {
- records.forEach(function (record) {
- var attached = [];
- // avoid unneccesary iteration when we only have one record
- if (singular) {
- attached = relatedItems;
- } else {
- relatedItems.forEach(function (relatedItem) {
- if (jsData.utils.get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {
- attached.push(relatedItem);
- }
- });
- }
- def.setLocalField(record, attached);
- });
- });
- },
- loadHasManyLocalKeys: function loadHasManyLocalKeys(mapper, def, records, __opts) {
- var self = this;
- var record = void 0;
- var relatedMapper = def.getRelation();
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- record = records;
- }
-
- if (record) {
- return self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {
- 'in': self.makeHasManyLocalKeys(mapper, def, record)
- })
- }, __opts).then(function (relatedItems) {
- def.setLocalField(record, relatedItems);
- });
- } else {
- var _ret = function () {
- var localKeys = [];
- records.forEach(function (record) {
- localKeys = localKeys.concat(self.self.makeHasManyLocalKeys(mapper, def, record));
- });
- return {
- v: self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {
- 'in': unique(localKeys).filter(function (x) {
- return x;
- })
- })
- }, __opts).then(function (relatedItems) {
- records.forEach(function (item) {
- var attached = [];
- var itemKeys = jsData.utils.get(item, def.localKeys) || [];
- itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);
- relatedItems.forEach(function (relatedItem) {
- if (itemKeys && itemKeys.indexOf(relatedItem[relatedMapper.idAttribute]) !== -1) {
- attached.push(relatedItem);
- }
- });
- def.setLocalField(item, attached);
- });
- return relatedItems;
- })
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === "object") return _ret.v;
- }
- },
- loadHasManyForeignKeys: function loadHasManyForeignKeys(mapper, def, records, __opts) {
- var self = this;
- var relatedMapper = def.getRelation();
- var idAttribute = mapper.idAttribute;
- var record = void 0;
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- record = records;
- }
-
- if (record) {
- return self.findAll(def.getRelation(), {
- where: babelHelpers.defineProperty({}, def.foreignKeys, {
- 'contains': self.makeHasManyForeignKeys(mapper, def, record)
- })
- }, __opts).then(function (relatedItems) {
- def.setLocalField(record, relatedItems);
- });
- } else {
- return self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, def.foreignKeys, {
- 'isectNotEmpty': records.map(function (record) {
- return self.makeHasManyForeignKeys(mapper, def, record);
- })
- })
- }, __opts).then(function (relatedItems) {
- var foreignKeysField = def.foreignKeys;
- records.forEach(function (record) {
- var _relatedItems = [];
- var id = jsData.utils.get(record, idAttribute);
- relatedItems.forEach(function (relatedItem) {
- var foreignKeys = jsData.utils.get(relatedItems, foreignKeysField) || [];
- if (foreignKeys.indexOf(id) !== -1) {
- _relatedItems.push(relatedItem);
- }
- });
- def.setLocalField(record, _relatedItems);
- });
- });
- }
- },
-
-
- /**
- * Load a hasOne relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadHasOne
- * @method
- * @return {Promise}
- */
- loadHasOne: function loadHasOne(mapper, def, records, __opts) {
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- records = [records];
- }
- return this.loadHasMany(mapper, def, records, __opts).then(function () {
- records.forEach(function (record) {
- var relatedData = def.getLocalField(record);
- if (jsData.utils.isArray(relatedData) && relatedData.length) {
- def.setLocalField(record, relatedData[0]);
- }
- });
- });
- },
-
-
- /**
- * Return the foreignKey from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeBelongsToForeignKey
- * @method
- * @return {*}
- */
- makeBelongsToForeignKey: function makeBelongsToForeignKey(mapper, def, record) {
- return def.getForeignKey(record);
- },
-
-
- /**
- * Load a belongsTo relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadBelongsTo
- * @method
- * @return {Promise}
- */
- loadBelongsTo: function loadBelongsTo(mapper, def, records, __opts) {
- var self = this;
- var relationDef = def.getRelation();
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- var _ret2 = function () {
- var record = records;
- return {
- v: self.find(relationDef, self.makeBelongsToForeignKey(mapper, def, record), __opts).then(function (relatedItem) {
- def.setLocalField(record, relatedItem);
- })
- };
- }();
-
- if ((typeof _ret2 === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret2)) === "object") return _ret2.v;
- } else {
- var keys = records.map(function (record) {
- return self.makeBelongsToForeignKey(mapper, def, record);
- }).filter(function (key) {
- return key;
- });
- return self.findAll(relationDef, {
- where: babelHelpers.defineProperty({}, relationDef.idAttribute, {
- 'in': keys
- })
- }, __opts).then(function (relatedItems) {
- records.forEach(function (record) {
- relatedItems.forEach(function (relatedItem) {
- if (relatedItem[relationDef.idAttribute] === record[def.foreignKey]) {
- def.setLocalField(record, relatedItem);
- }
- });
- });
- });
- }
- },
-
-
- /**
- * Retrieve the record with the given primary key. Called by `Mapper#find`.
- *
- * @name Adapter#find
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to retrieve.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @param {string[]} [opts.with=[]] Relations to eager load.
- * @return {Promise}
- */
- find: function find(mapper, id, opts) {
- var self = this;
- var record = void 0,
- op = void 0;
- opts || (opts = {});
- opts.with || (opts.with = []);
-
- // beforeFind lifecycle hook
- op = opts.op = 'beforeFind';
- return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {
- op = opts.op = 'find';
- self.dbg(op, mapper, id, opts);
- return jsData.utils.resolve(self._find(mapper, id, opts));
- }).then(function (results) {
- var _results6 = babelHelpers.slicedToArray(results, 1);
-
- var _record = _results6[0];
-
- if (!_record) {
- return;
- }
- record = _record;
- var tasks = [];
-
- jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {
- var task = void 0;
- if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {
- if (def.type === 'hasOne') {
- task = self.loadHasOne(mapper, def, record, __opts);
- } else {
- task = self.loadHasMany(mapper, def, record, __opts);
- }
- } else if (def.type === 'hasMany' && def.localKeys) {
- task = self.loadHasManyLocalKeys(mapper, def, record, __opts);
- } else if (def.type === 'hasMany' && def.foreignKeys) {
- task = self.loadHasManyForeignKeys(mapper, def, record, __opts);
- } else if (def.type === 'belongsTo') {
- task = self.loadBelongsTo(mapper, def, record, __opts);
- }
- if (task) {
- tasks.push(task);
- }
- });
-
- return Promise.all(tasks);
- }).then(function () {
- var response = new Response(record, {}, 'find');
- response.found = record ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterFind lifecycle hook
- op = opts.op = 'afterFind';
- return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Retrieve the records that match the selection query.
- *
- * @name Adapter#findAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @param {string[]} [opts.with=[]] Relations to eager load.
- * @return {Promise}
- */
- findAll: function findAll(mapper, query, opts) {
- var self = this;
- opts || (opts = {});
- opts.with || (opts.with = []);
-
- var records = [];
- var op = void 0;
- var activeWith = opts._activeWith;
-
- if (jsData.utils.isObject(activeWith)) {
- var activeQuery = activeWith.query || {};
- if (activeWith.replace) {
- query = activeQuery;
- } else {
- jsData.utils.deepFillIn(query, activeQuery);
- }
- }
-
- // beforeFindAll lifecycle hook
- op = opts.op = 'beforeFindAll';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- op = opts.op = 'findAll';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._findAll(mapper, query, opts));
- }).then(function (results) {
- var _results7 = babelHelpers.slicedToArray(results, 1);
-
- var _records = _results7[0];
-
- _records || (_records = []);
- records = _records;
- var tasks = [];
- jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {
- var task = void 0;
- if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {
- if (def.type === 'hasMany') {
- task = self.loadHasMany(mapper, def, records, __opts);
- } else {
- task = self.loadHasOne(mapper, def, records, __opts);
- }
- } else if (def.type === 'hasMany' && def.localKeys) {
- task = self.loadHasManyLocalKeys(mapper, def, records, __opts);
- } else if (def.type === 'hasMany' && def.foreignKeys) {
- task = self.loadHasManyForeignKeys(mapper, def, records, __opts);
- } else if (def.type === 'belongsTo') {
- task = self.loadBelongsTo(mapper, def, records, __opts);
- }
- if (task) {
- tasks.push(task);
- }
- });
- return Promise.all(tasks);
- }).then(function () {
- var response = new Response(records, {}, 'findAll');
- response.found = records.length;
- response = self.respond(response, opts);
-
- // afterFindAll lifecycle hook
- op = opts.op = 'afterFindAll';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Resolve the value of the specified option based on the given options and
- * this adapter's settings. Override with care.
- *
- * @name Adapter#getOpt
- * @method
- * @param {string} opt The name of the option.
- * @param {Object} [opts] Configuration options.
- * @return {*} The value of the specified option.
- */
- getOpt: function getOpt(opt, opts) {
- opts || (opts = {});
- return jsData.utils.isUndefined(opts[opt]) ? jsData.utils.plainCopy(this[opt]) : jsData.utils.plainCopy(opts[opt]);
- },
-
-
- /**
- * Logging utility method. Override this method if you want to send log
- * messages to something other than the console.
- *
- * @name Adapter#log
- * @method
- * @param {string} level Log level.
- * @param {...*} values Values to log.
- */
- log: function log(level) {
- for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
- args[_key4 - 1] = arguments[_key4];
- }
-
- if (level && !args.length) {
- args.push(level);
- level = 'debug';
- }
- if (level === 'debug' && !this.debug) {
- return;
- }
- var prefix = level.toUpperCase() + ': (Adapter)';
- if (console[level]) {
- var _console;
-
- (_console = console)[level].apply(_console, [prefix].concat(args));
- } else {
- var _console2;
-
- (_console2 = console).log.apply(_console2, [prefix].concat(args));
- }
- },
-
-
- /**
- * Retrieve sum of the specified field of the records that match the selection
- * query. Called by `Mapper#sum`.
- *
- * @name Adapter#sum
- * @method
- * @param {Object} mapper The mapper.
- * @param {string} field By to sum.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- sum: function sum(mapper, field, query, opts) {
- var self = this;
- var op = void 0;
- if (!jsData.utils.isString(field)) {
- throw new Error('field must be a string!');
- }
- query || (query = {});
- opts || (opts = {});
-
- // beforeSum lifecycle hook
- op = opts.op = 'beforeSum';
- return jsData.utils.resolve(self[op](mapper, field, query, opts)).then(function () {
- // Allow for re-assignment from lifecycle hook
- op = opts.op = 'sum';
- self.dbg(op, mapper, field, query, opts);
- return jsData.utils.resolve(self._sum(mapper, field, query, opts));
- }).then(function (results) {
- var _results8 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results8[0];
- var result = _results8[1];
-
- result || (result = {});
- var response = new Response(data, result, op);
- response = self.respond(response, opts);
-
- // afterSum lifecycle hook
- op = opts.op = 'afterSum';
- return jsData.utils.resolve(self[op](mapper, field, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * @name Adapter#respond
- * @method
- * @param {Object} response Response object.
- * @param {Object} opts Configuration options.
- * return {Object} If `opts.raw == true` then return `response`, else return
- * `response.data`.
- */
- respond: function respond(response, opts) {
- return this.getOpt('raw', opts) ? response : response.data;
- },
-
-
- /**
- * Apply the given update to the record with the specified primary key. Called
- * by `Mapper#update`.
- *
- * @name Adapter#update
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id The primary key of the record to be updated.
- * @param {Object} props The update to apply to the record.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- update: function update(mapper, id, props, opts) {
- var self = this;
- props || (props = {});
- opts || (opts = {});
- var op = void 0;
-
- // beforeUpdate lifecycle hook
- op = opts.op = 'beforeUpdate';
- return jsData.utils.resolve(self[op](mapper, id, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- op = opts.op = 'update';
- self.dbg(op, mapper, id, props, opts);
- return jsData.utils.resolve(self._update(mapper, id, props, opts));
- }).then(function (results) {
- var _results9 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results9[0];
- var result = _results9[1];
-
- result || (result = {});
- var response = new Response(data, result, 'update');
- response.updated = data ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterUpdate lifecycle hook
- op = opts.op = 'afterUpdate';
- return jsData.utils.resolve(self[op](mapper, id, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Apply the given update to all records that match the selection query.
- * Called by `Mapper#updateAll`.
- *
- * @name Adapter#updateAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The update to apply to the selected records.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- updateAll: function updateAll(mapper, props, query, opts) {
- var self = this;
- props || (props = {});
- query || (query = {});
- opts || (opts = {});
- var op = void 0;
-
- // beforeUpdateAll lifecycle hook
- op = opts.op = 'beforeUpdateAll';
- return jsData.utils.resolve(self[op](mapper, props, query, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- op = opts.op = 'updateAll';
- self.dbg(op, mapper, props, query, opts);
- return jsData.utils.resolve(self._updateAll(mapper, props, query, opts));
- }).then(function (results) {
- var _results10 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results10[0];
- var result = _results10[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'updateAll');
- response.updated = data.length;
- response = self.respond(response, opts);
-
- // afterUpdateAll lifecycle hook
- op = opts.op = 'afterUpdateAll';
- return jsData.utils.resolve(self[op](mapper, props, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Update the given records in a single batch. Called by `Mapper#updateMany`.
- *
- * @name Adapter#updateMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object[]} records The records to update.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- updateMany: function updateMany(mapper, records, opts) {
- var self = this;
- records || (records = []);
- opts || (opts = {});
- var op = void 0;
- var idAttribute = mapper.idAttribute;
-
- records = records.filter(function (record) {
- return jsData.utils.get(record, idAttribute);
- });
-
- // beforeUpdateMany lifecycle hook
- op = opts.op = 'beforeUpdateMany';
- return jsData.utils.resolve(self[op](mapper, records, opts)).then(function (_records) {
- // Allow for re-assignment from lifecycle hook
- records = jsData.utils.isUndefined(_records) ? records : _records;
- records = records.map(function (record) {
- return withoutRelations(mapper, record);
- });
- op = opts.op = 'updateMany';
- self.dbg(op, mapper, records, opts);
- return jsData.utils.resolve(self._updateMany(mapper, records, opts));
- }).then(function (results) {
- var _results11 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results11[0];
- var result = _results11[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'updateMany');
- response.updated = data.length;
- response = self.respond(response, opts);
-
- // afterUpdateMany lifecycle hook
- op = opts.op = 'afterUpdateMany';
- return jsData.utils.resolve(self[op](mapper, records, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- }
- });
-
- module.exports = Adapter;
-
- }));
- //# sourceMappingURL=js-data-adapter.js.map
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- module.exports = __webpack_require__(4);
-
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var defaults = __webpack_require__(5);
- var utils = __webpack_require__(6);
- var dispatchRequest = __webpack_require__(7);
- var InterceptorManager = __webpack_require__(16);
- var isAbsoluteURL = __webpack_require__(17);
- var combineURLs = __webpack_require__(18);
- var bind = __webpack_require__(19);
- var transformData = __webpack_require__(12);
-
- function Axios(defaultConfig) {
- this.defaults = utils.merge({}, defaultConfig);
- this.interceptors = {
- request: new InterceptorManager(),
- response: new InterceptorManager()
- };
- }
-
- Axios.prototype.request = function request(config) {
- /*eslint no-param-reassign:0*/
- // Allow for axios('example/url'[, config]) a la fetch API
- if (typeof config === 'string') {
- config = utils.merge({
- url: arguments[0]
- }, arguments[1]);
- }
-
- config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
-
- // Support baseURL config
- if (config.baseURL && !isAbsoluteURL(config.url)) {
- config.url = combineURLs(config.baseURL, config.url);
- }
-
- // Don't allow overriding defaults.withCredentials
- config.withCredentials = config.withCredentials || this.defaults.withCredentials;
-
- // Transform request data
- config.data = transformData(
- config.data,
- config.headers,
- config.transformRequest
- );
-
- // Flatten headers
- config.headers = utils.merge(
- config.headers.common || {},
- config.headers[config.method] || {},
- config.headers || {}
- );
-
- utils.forEach(
- ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
- function cleanHeaderConfig(method) {
- delete config.headers[method];
- }
- );
-
- // Hook up interceptors middleware
- var chain = [dispatchRequest, undefined];
- var promise = Promise.resolve(config);
-
- this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
- chain.unshift(interceptor.fulfilled, interceptor.rejected);
- });
-
- this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
- chain.push(interceptor.fulfilled, interceptor.rejected);
- });
-
- while (chain.length) {
- promise = promise.then(chain.shift(), chain.shift());
- }
-
- return promise;
- };
-
- var defaultInstance = new Axios(defaults);
- var axios = module.exports = bind(Axios.prototype.request, defaultInstance);
-
- axios.create = function create(defaultConfig) {
- return new Axios(defaultConfig);
- };
-
- // Expose defaults
- axios.defaults = defaultInstance.defaults;
-
- // Expose all/spread
- axios.all = function all(promises) {
- return Promise.all(promises);
- };
- axios.spread = __webpack_require__(20);
-
- // Expose interceptors
- axios.interceptors = defaultInstance.interceptors;
-
- // Provide aliases for supported request methods
- utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
- /*eslint func-names:0*/
- Axios.prototype[method] = function(url, config) {
- return this.request(utils.merge(config || {}, {
- method: method,
- url: url
- }));
- };
- axios[method] = bind(Axios.prototype[method], defaultInstance);
- });
-
- utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
- /*eslint func-names:0*/
- Axios.prototype[method] = function(url, data, config) {
- return this.request(utils.merge(config || {}, {
- method: method,
- url: url,
- data: data
- }));
- };
- axios[method] = bind(Axios.prototype[method], defaultInstance);
- });
-
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- var PROTECTION_PREFIX = /^\)\]\}',?\n/;
- var DEFAULT_CONTENT_TYPE = {
- 'Content-Type': 'application/x-www-form-urlencoded'
- };
-
- module.exports = {
- transformRequest: [function transformResponseJSON(data, headers) {
- if (utils.isFormData(data)) {
- return data;
- }
- if (utils.isArrayBuffer(data)) {
- return data;
- }
- if (utils.isArrayBufferView(data)) {
- return data.buffer;
- }
- if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {
- // Set application/json if no Content-Type has been specified
- if (!utils.isUndefined(headers)) {
- utils.forEach(headers, function processContentTypeHeader(val, key) {
- if (key.toLowerCase() === 'content-type') {
- headers['Content-Type'] = val;
- }
- });
-
- if (utils.isUndefined(headers['Content-Type'])) {
- headers['Content-Type'] = 'application/json;charset=utf-8';
- }
- }
- return JSON.stringify(data);
- }
- return data;
- }],
-
- transformResponse: [function transformResponseJSON(data) {
- /*eslint no-param-reassign:0*/
- if (typeof data === 'string') {
- data = data.replace(PROTECTION_PREFIX, '');
- try {
- data = JSON.parse(data);
- } catch (e) { /* Ignore */ }
- }
- return data;
- }],
-
- headers: {
- common: {
- 'Accept': 'application/json, text/plain, */*'
- },
- patch: utils.merge(DEFAULT_CONTENT_TYPE),
- post: utils.merge(DEFAULT_CONTENT_TYPE),
- put: utils.merge(DEFAULT_CONTENT_TYPE)
- },
-
- timeout: 0,
-
- xsrfCookieName: 'XSRF-TOKEN',
- xsrfHeaderName: 'X-XSRF-TOKEN'
- };
-
-
-/***/ },
-/* 6 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /*global toString:true*/
-
- // utils is a library of generic helper functions non-specific to axios
-
- var toString = Object.prototype.toString;
-
- /**
- * Determine if a value is an Array
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is an Array, otherwise false
- */
- function isArray(val) {
- return toString.call(val) === '[object Array]';
- }
-
- /**
- * Determine if a value is an ArrayBuffer
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is an ArrayBuffer, otherwise false
- */
- function isArrayBuffer(val) {
- return toString.call(val) === '[object ArrayBuffer]';
- }
-
- /**
- * Determine if a value is a FormData
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is an FormData, otherwise false
- */
- function isFormData(val) {
- return toString.call(val) === '[object FormData]';
- }
-
- /**
- * Determine if a value is a view on an ArrayBuffer
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
- */
- function isArrayBufferView(val) {
- var result;
- if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
- result = ArrayBuffer.isView(val);
- } else {
- result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
- }
- return result;
- }
-
- /**
- * Determine if a value is a String
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is a String, otherwise false
- */
- function isString(val) {
- return typeof val === 'string';
- }
-
- /**
- * Determine if a value is a Number
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is a Number, otherwise false
- */
- function isNumber(val) {
- return typeof val === 'number';
- }
-
- /**
- * Determine if a value is undefined
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if the value is undefined, otherwise false
- */
- function isUndefined(val) {
- return typeof val === 'undefined';
- }
-
- /**
- * Determine if a value is an Object
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is an Object, otherwise false
- */
- function isObject(val) {
- return val !== null && typeof val === 'object';
- }
-
- /**
- * Determine if a value is a Date
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is a Date, otherwise false
- */
- function isDate(val) {
- return toString.call(val) === '[object Date]';
- }
-
- /**
- * Determine if a value is a File
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is a File, otherwise false
- */
- function isFile(val) {
- return toString.call(val) === '[object File]';
- }
-
- /**
- * Determine if a value is a Blob
- *
- * @param {Object} val The value to test
- * @returns {boolean} True if value is a Blob, otherwise false
- */
- function isBlob(val) {
- return toString.call(val) === '[object Blob]';
- }
-
- /**
- * Trim excess whitespace off the beginning and end of a string
- *
- * @param {String} str The String to trim
- * @returns {String} The String freed of excess whitespace
- */
- function trim(str) {
- return str.replace(/^\s*/, '').replace(/\s*$/, '');
- }
-
- /**
- * Determine if we're running in a standard browser environment
- *
- * This allows axios to run in a web worker, and react-native.
- * Both environments support XMLHttpRequest, but not fully standard globals.
- *
- * web workers:
- * typeof window -> undefined
- * typeof document -> undefined
- *
- * react-native:
- * typeof document.createElement -> undefined
- */
- function isStandardBrowserEnv() {
- return (
- typeof window !== 'undefined' &&
- typeof document !== 'undefined' &&
- typeof document.createElement === 'function'
- );
- }
-
- /**
- * Iterate over an Array or an Object invoking a function for each item.
- *
- * If `obj` is an Array callback will be called passing
- * the value, index, and complete array for each item.
- *
- * If 'obj' is an Object callback will be called passing
- * the value, key, and complete object for each property.
- *
- * @param {Object|Array} obj The object to iterate
- * @param {Function} fn The callback to invoke for each item
- */
- function forEach(obj, fn) {
- // Don't bother if no value provided
- if (obj === null || typeof obj === 'undefined') {
- return;
- }
-
- // Force an array if not already something iterable
- if (typeof obj !== 'object' && !isArray(obj)) {
- /*eslint no-param-reassign:0*/
- obj = [obj];
- }
-
- if (isArray(obj)) {
- // Iterate over array values
- for (var i = 0, l = obj.length; i < l; i++) {
- fn.call(null, obj[i], i, obj);
- }
- } else {
- // Iterate over object keys
- for (var key in obj) {
- if (obj.hasOwnProperty(key)) {
- fn.call(null, obj[key], key, obj);
- }
- }
- }
- }
-
- /**
- * Accepts varargs expecting each argument to be an object, then
- * immutably merges the properties of each object and returns result.
- *
- * When multiple objects contain the same key the later object in
- * the arguments list will take precedence.
- *
- * Example:
- *
- * ```js
- * var result = merge({foo: 123}, {foo: 456});
- * console.log(result.foo); // outputs 456
- * ```
- *
- * @param {Object} obj1 Object to merge
- * @returns {Object} Result of all merge properties
- */
- function merge(/* obj1, obj2, obj3, ... */) {
- var result = {};
- function assignValue(val, key) {
- if (typeof result[key] === 'object' && typeof val === 'object') {
- result[key] = merge(result[key], val);
- } else {
- result[key] = val;
- }
- }
-
- for (var i = 0, l = arguments.length; i < l; i++) {
- forEach(arguments[i], assignValue);
- }
- return result;
- }
-
- module.exports = {
- isArray: isArray,
- isArrayBuffer: isArrayBuffer,
- isFormData: isFormData,
- isArrayBufferView: isArrayBufferView,
- isString: isString,
- isNumber: isNumber,
- isObject: isObject,
- isUndefined: isUndefined,
- isDate: isDate,
- isFile: isFile,
- isBlob: isBlob,
- isStandardBrowserEnv: isStandardBrowserEnv,
- forEach: forEach,
- merge: merge,
- trim: trim
- };
-
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* WEBPACK VAR INJECTION */(function(process) {'use strict';
-
- /**
- * Dispatch a request to the server using whichever adapter
- * is supported by the current environment.
- *
- * @param {object} config The config that is to be used for the request
- * @returns {Promise} The Promise to be fulfilled
- */
- module.exports = function dispatchRequest(config) {
- return new Promise(function executor(resolve, reject) {
- try {
- var adapter;
-
- if (typeof config.adapter === 'function') {
- // For custom adapter support
- adapter = config.adapter;
- } else if (typeof XMLHttpRequest !== 'undefined') {
- // For browsers use XHR adapter
- adapter = __webpack_require__(9);
- } else if (typeof process !== 'undefined') {
- // For node use HTTP adapter
- adapter = __webpack_require__(9);
- }
-
- if (typeof adapter === 'function') {
- adapter(resolve, reject, config);
- }
- } catch (e) {
- reject(e);
- }
- });
- };
-
-
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(8)))
-
-/***/ },
-/* 8 */
-/***/ function(module, exports) {
-
- // shim for using process in browser
-
- var process = module.exports = {};
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
-
- function cleanUpNextTick() {
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
-
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = setTimeout(cleanUpNextTick);
- draining = true;
-
- var len = queue.length;
- while(len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- clearTimeout(timeout);
- }
-
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- setTimeout(drainQueue, 0);
- }
- };
-
- // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
-
- function noop() {}
-
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
-
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
-
- process.cwd = function () { return '/' };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function() { return 0; };
-
-
-/***/ },
-/* 9 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
- var buildURL = __webpack_require__(10);
- var parseHeaders = __webpack_require__(11);
- var transformData = __webpack_require__(12);
- var isURLSameOrigin = __webpack_require__(13);
- var btoa = window.btoa || __webpack_require__(14);
-
- module.exports = function xhrAdapter(resolve, reject, config) {
- var requestData = config.data;
- var requestHeaders = config.headers;
-
- if (utils.isFormData(requestData)) {
- delete requestHeaders['Content-Type']; // Let the browser set it
- }
-
- var request = new XMLHttpRequest();
-
- // For IE 8/9 CORS support
- // Only supports POST and GET calls and doesn't returns the response headers.
- if (window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {
- request = new window.XDomainRequest();
- }
-
- // HTTP basic authentication
- if (config.auth) {
- var username = config.auth.username || '';
- var password = config.auth.password || '';
- requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
- }
-
- request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
-
- // Set the request timeout in MS
- request.timeout = config.timeout;
-
- // Listen for ready state
- request.onload = function handleLoad() {
- if (!request) {
- return;
- }
- // Prepare the response
- var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
- var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;
- var response = {
- data: transformData(
- responseData,
- responseHeaders,
- config.transformResponse
- ),
- // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
- status: request.status === 1223 ? 204 : request.status,
- statusText: request.status === 1223 ? 'No Content' : request.statusText,
- headers: responseHeaders,
- config: config
- };
-
- // Resolve or reject the Promise based on the status
- ((response.status >= 200 && response.status < 300) ||
- (!('status' in request) && response.responseText) ?
- resolve :
- reject)(response);
-
- // Clean up request
- request = null;
- };
-
- // Handle low level network errors
- request.onerror = function handleError() {
- // Real errors are hidden from us by the browser
- // onerror should only fire if it's a network error
- reject(new Error('Network Error'));
-
- // Clean up request
- request = null;
- };
-
- // Add xsrf header
- // This is only done if running in a standard browser environment.
- // Specifically not if we're in a web worker, or react-native.
- if (utils.isStandardBrowserEnv()) {
- var cookies = __webpack_require__(15);
-
- // Add xsrf header
- var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?
- cookies.read(config.xsrfCookieName) :
- undefined;
-
- if (xsrfValue) {
- requestHeaders[config.xsrfHeaderName] = xsrfValue;
- }
- }
-
- // Add headers to the request
- if ('setRequestHeader' in request) {
- utils.forEach(requestHeaders, function setRequestHeader(val, key) {
- if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
- // Remove Content-Type if data is undefined
- delete requestHeaders[key];
- } else {
- // Otherwise add header to the request
- request.setRequestHeader(key, val);
- }
- });
- }
-
- // Add withCredentials to request if needed
- if (config.withCredentials) {
- request.withCredentials = true;
- }
-
- // Add responseType to request if needed
- if (config.responseType) {
- try {
- request.responseType = config.responseType;
- } catch (e) {
- if (request.responseType !== 'json') {
- throw e;
- }
- }
- }
-
- if (utils.isArrayBuffer(requestData)) {
- requestData = new DataView(requestData);
- }
-
- // Send the request
- request.send(requestData);
- };
-
-
-/***/ },
-/* 10 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- function encode(val) {
- return encodeURIComponent(val).
- replace(/%40/gi, '@').
- replace(/%3A/gi, ':').
- replace(/%24/g, '$').
- replace(/%2C/gi, ',').
- replace(/%20/g, '+').
- replace(/%5B/gi, '[').
- replace(/%5D/gi, ']');
- }
-
- /**
- * Build a URL by appending params to the end
- *
- * @param {string} url The base of the url (e.g., http://www.google.com)
- * @param {object} [params] The params to be appended
- * @returns {string} The formatted url
- */
- module.exports = function buildURL(url, params, paramsSerializer) {
- /*eslint no-param-reassign:0*/
- if (!params) {
- return url;
- }
-
- var serializedParams;
- if (paramsSerializer) {
- serializedParams = paramsSerializer(params);
- } else {
- var parts = [];
-
- utils.forEach(params, function serialize(val, key) {
- if (val === null || typeof val === 'undefined') {
- return;
- }
-
- if (utils.isArray(val)) {
- key = key + '[]';
- }
-
- if (!utils.isArray(val)) {
- val = [val];
- }
-
- utils.forEach(val, function parseValue(v) {
- if (utils.isDate(v)) {
- v = v.toISOString();
- } else if (utils.isObject(v)) {
- v = JSON.stringify(v);
- }
- parts.push(encode(key) + '=' + encode(v));
- });
- });
-
- serializedParams = parts.join('&');
- }
-
- if (serializedParams) {
- url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
- }
-
- return url;
- };
-
-
-
-/***/ },
-/* 11 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- /**
- * Parse headers into an object
- *
- * ```
- * Date: Wed, 27 Aug 2014 08:58:49 GMT
- * Content-Type: application/json
- * Connection: keep-alive
- * Transfer-Encoding: chunked
- * ```
- *
- * @param {String} headers Headers needing to be parsed
- * @returns {Object} Headers parsed into an object
- */
- module.exports = function parseHeaders(headers) {
- var parsed = {};
- var key;
- var val;
- var i;
-
- if (!headers) { return parsed; }
-
- utils.forEach(headers.split('\n'), function parser(line) {
- i = line.indexOf(':');
- key = utils.trim(line.substr(0, i)).toLowerCase();
- val = utils.trim(line.substr(i + 1));
-
- if (key) {
- parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
- }
- });
-
- return parsed;
- };
-
-
-/***/ },
-/* 12 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- /**
- * Transform the data for a request or a response
- *
- * @param {Object|String} data The data to be transformed
- * @param {Array} headers The headers for the request or response
- * @param {Array|Function} fns A single function or Array of functions
- * @returns {*} The resulting transformed data
- */
- module.exports = function transformData(data, headers, fns) {
- /*eslint no-param-reassign:0*/
- utils.forEach(fns, function transform(fn) {
- data = fn(data, headers);
- });
-
- return data;
- };
-
-
-/***/ },
-/* 13 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- module.exports = (
- utils.isStandardBrowserEnv() ?
-
- // Standard browser envs have full support of the APIs needed to test
- // whether the request URL is of the same origin as current location.
- (function standardBrowserEnv() {
- var msie = /(msie|trident)/i.test(navigator.userAgent);
- var urlParsingNode = document.createElement('a');
- var originURL;
-
- /**
- * Parse a URL to discover it's components
- *
- * @param {String} url The URL to be parsed
- * @returns {Object}
- */
- function resolveURL(url) {
- var href = url;
-
- if (msie) {
- // IE needs attribute set twice to normalize properties
- urlParsingNode.setAttribute('href', href);
- href = urlParsingNode.href;
- }
-
- urlParsingNode.setAttribute('href', href);
-
- // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
- return {
- href: urlParsingNode.href,
- protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
- host: urlParsingNode.host,
- search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
- hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
- hostname: urlParsingNode.hostname,
- port: urlParsingNode.port,
- pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
- urlParsingNode.pathname :
- '/' + urlParsingNode.pathname
- };
- }
-
- originURL = resolveURL(window.location.href);
-
- /**
- * Determine if a URL shares the same origin as the current location
- *
- * @param {String} requestURL The URL to test
- * @returns {boolean} True if URL shares the same origin, otherwise false
- */
- return function isURLSameOrigin(requestURL) {
- var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
- return (parsed.protocol === originURL.protocol &&
- parsed.host === originURL.host);
- };
- })() :
-
- // Non standard browser envs (web workers, react-native) lack needed support.
- (function nonStandardBrowserEnv() {
- return function isURLSameOrigin() {
- return true;
- };
- })()
- );
-
-
-/***/ },
-/* 14 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
-
- var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
-
- function InvalidCharacterError(message) {
- this.message = message;
- }
- InvalidCharacterError.prototype = new Error;
- InvalidCharacterError.prototype.code = 5;
- InvalidCharacterError.prototype.name = 'InvalidCharacterError';
-
- function btoa(input) {
- var str = String(input);
- var output = '';
- for (
- // initialize result and counter
- var block, charCode, idx = 0, map = chars;
- // if the next str index does not exist:
- // change the mapping table to "="
- // check if d has no fractional digits
- str.charAt(idx | 0) || (map = '=', idx % 1);
- // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
- output += map.charAt(63 & block >> 8 - idx % 1 * 8)
- ) {
- charCode = str.charCodeAt(idx += 3 / 4);
- if (charCode > 0xFF) {
- throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');
- }
- block = block << 8 | charCode;
- }
- return output;
- }
-
- module.exports = btoa;
-
-
-/***/ },
-/* 15 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- module.exports = (
- utils.isStandardBrowserEnv() ?
-
- // Standard browser envs support document.cookie
- (function standardBrowserEnv() {
- return {
- write: function write(name, value, expires, path, domain, secure) {
- var cookie = [];
- cookie.push(name + '=' + encodeURIComponent(value));
-
- if (utils.isNumber(expires)) {
- cookie.push('expires=' + new Date(expires).toGMTString());
- }
-
- if (utils.isString(path)) {
- cookie.push('path=' + path);
- }
-
- if (utils.isString(domain)) {
- cookie.push('domain=' + domain);
- }
-
- if (secure === true) {
- cookie.push('secure');
- }
-
- document.cookie = cookie.join('; ');
- },
-
- read: function read(name) {
- var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
- return (match ? decodeURIComponent(match[3]) : null);
- },
-
- remove: function remove(name) {
- this.write(name, '', Date.now() - 86400000);
- }
- };
- })() :
-
- // Non standard browser env (web workers, react-native) lack needed support.
- (function nonStandardBrowserEnv() {
- return {
- write: function write() {},
- read: function read() { return null; },
- remove: function remove() {}
- };
- })()
- );
-
-
-/***/ },
-/* 16 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var utils = __webpack_require__(6);
-
- function InterceptorManager() {
- this.handlers = [];
- }
-
- /**
- * Add a new interceptor to the stack
- *
- * @param {Function} fulfilled The function to handle `then` for a `Promise`
- * @param {Function} rejected The function to handle `reject` for a `Promise`
- *
- * @return {Number} An ID used to remove interceptor later
- */
- InterceptorManager.prototype.use = function use(fulfilled, rejected) {
- this.handlers.push({
- fulfilled: fulfilled,
- rejected: rejected
- });
- return this.handlers.length - 1;
- };
-
- /**
- * Remove an interceptor from the stack
- *
- * @param {Number} id The ID that was returned by `use`
- */
- InterceptorManager.prototype.eject = function eject(id) {
- if (this.handlers[id]) {
- this.handlers[id] = null;
- }
- };
-
- /**
- * Iterate over all the registered interceptors
- *
- * This method is particularly useful for skipping over any
- * interceptors that may have become `null` calling `eject`.
- *
- * @param {Function} fn The function to call for each interceptor
- */
- InterceptorManager.prototype.forEach = function forEach(fn) {
- utils.forEach(this.handlers, function forEachHandler(h) {
- if (h !== null) {
- fn(h);
- }
- });
- };
-
- module.exports = InterceptorManager;
-
-
-/***/ },
-/* 17 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Determines whether the specified URL is absolute
- *
- * @param {string} url The URL to test
- * @returns {boolean} True if the specified URL is absolute, otherwise false
- */
- module.exports = function isAbsoluteURL(url) {
- // A URL is considered absolute if it begins with "://" or "//" (protocol-relative URL).
- // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
- // by any combination of letters, digits, plus, period, or hyphen.
- return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
- };
-
-
-/***/ },
-/* 18 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Creates a new URL by combining the specified URLs
- *
- * @param {string} baseURL The base URL
- * @param {string} relativeURL The relative URL
- * @returns {string} The combined URL
- */
- module.exports = function combineURLs(baseURL, relativeURL) {
- return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
- };
-
-
-/***/ },
-/* 19 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- module.exports = function bind(fn, thisArg) {
- return function wrap() {
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
- return fn.apply(thisArg, args);
- };
- };
-
-
-/***/ },
-/* 20 */
-/***/ function(module, exports) {
-
- 'use strict';
-
- /**
- * Syntactic sugar for invoking a function and expanding an array for arguments.
- *
- * Common use case would be to use `Function.prototype.apply`.
- *
- * ```js
- * function f(x, y, z) {}
- * var args = [1, 2, 3];
- * f.apply(null, args);
- * ```
- *
- * With `spread` this example can be re-written.
- *
- * ```js
- * spread(function(x, y, z) {})([1, 2, 3]);
- * ```
- *
- * @param {Function} callback
- * @returns {Function}
- */
- module.exports = function spread(callback) {
- return function wrap(arr) {
- return callback.apply(null, arr);
- };
- };
-
-
-/***/ }
-/******/ ])
-});
-;
-//# sourceMappingURL=js-data-http.js.map
\ No newline at end of file
diff --git a/dist/js-data-http.js.map b/dist/js-data-http.js.map
deleted file mode 100644
index 50a602c..0000000
--- a/dist/js-data-http.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 878550722cb11aefdcf8","webpack:///./src/index.js","webpack:///external {\"amd\":\"js-data\",\"commonjs\":\"js-data\",\"commonjs2\":\"js-data\",\"root\":\"JSData\"}","webpack:///./~/js-data-adapter/dist/js-data-adapter.js","webpack:///./~/axios/index.js","webpack:///./~/axios/lib/axios.js","webpack:///./~/axios/lib/defaults.js","webpack:///./~/axios/lib/utils.js","webpack:///./~/axios/lib/core/dispatchRequest.js","webpack:///./~/process/browser.js","webpack:///./~/axios/lib/adapters/xhr.js","webpack:///./~/axios/lib/helpers/buildURL.js","webpack:///./~/axios/lib/helpers/parseHeaders.js","webpack:///./~/axios/lib/helpers/transformData.js","webpack:///./~/axios/lib/helpers/isURLSameOrigin.js","webpack:///./~/axios/lib/helpers/btoa.js","webpack:///./~/axios/lib/helpers/cookies.js","webpack:///./~/axios/lib/core/InterceptorManager.js","webpack:///./~/axios/lib/helpers/isAbsoluteURL.js","webpack:///./~/axios/lib/helpers/combineURLs.js","webpack:///./~/axios/lib/helpers/bind.js","webpack:///./~/axios/lib/helpers/spread.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;ACpCA;;AACA;;;;;;;AAFA,KAAM,QAAQ,oBAAQ,CAAR,CAAR;;;AAIN,K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ACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa,OAAO;AACpB,cAAa,QAAQ;AACrB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,iBAAgB,OAAO;AACvB,iBAAgB,OAAO;AACvB;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa,OAAO;AACpB;AACA,cAAa,OAAO;AACpB;AACA,eAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,oBAAoB,eAAe;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,6BAA6B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,8BAA8B,eAAe;AAC9E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,mBAAmB,0BAA0B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,mBAAmB,0BAA0B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,+BAA+B,eAAe;AAC7E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,gCAAgC,eAAe;AAChF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,oBAAoB,eAAe;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,iCAAiC,eAAe;AAC/E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,kCAAkC,eAAe;AAClF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,kCAAkC,eAAe;AAClF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE,eAAe;AACvF;AACA;;AAEA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA,UAAS;AACT,QAAO;AACP;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA,oDAAmD;AACnD;AACA;AACA,kBAAiB;AACjB,gBAAe;AACf,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB;AACA,gBAAe;AACf;AACA,cAAa;AACb;AACA,UAAS;;AAET;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA,UAAS;AACT,QAAO;AACP;AACA,gDAA+C;AAC/C;AACA;AACA,cAAa;AACb,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,YAAW;AACX,UAAS;AACT;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,UAAS;;AAET;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,cAAa;AACb,YAAW;AACX,UAAS;AACT;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,gBAAe,SAAS;AACxB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA,UAAS;;AAET;AACA,QAAO;AACP,+CAA8C;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,gBAAe,SAAS;AACxB,iBAAgB;AAChB;AACA;AACA;AACA,yBAAwB;AACxB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA,QAAO;AACP,gDAA+C;AAC/C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,iBAAgB,EAAE;AAClB;AACA;AACA,yBAAwB;AACxB;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,KAAK;AACpB;AACA;AACA,6FAA4F,eAAe;AAC3G;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAO;AACP;;AAEA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA,2BAA0B;AAC1B,2BAA0B;AAC1B,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAwB;AACxB;AACA;;AAEA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP;AACA,IAAG;;AAEH;;AAEA,EAAC;AACD,4C;;;;;;AC3lDA,yC;;;;;;ACAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,iCAAgC;AAChC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA,kDAAiD,gBAAgB;;AAEjE;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,gCAA+B;AAC/B,wCAAuC;AACvC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA,IAAG;;AAEH;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA,MAAK;AACL;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA,iDAAgD;AAChD;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,EAAC;;;;;;;ACvHD;;AAEA;;AAEA,iCAAgC;AAChC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;;AAET;AACA,uDAAsD;AACtD;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA,QAAO,YAAY;AACnB;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA,IAAG;;AAEH;;AAEA;AACA;AACA;;;;;;;AC9DA;;AAEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,aAAa;AACxB,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAmC,OAAO;AAC1C;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,SAAS,GAAG,SAAS;AAC5C,4BAA2B;AAC3B;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;;AAEA,wCAAuC,OAAO;AAC9C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnPA;;AAEA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,QAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA,IAAG;AACH;;;;;;;;;AChCA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,wBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,4BAA2B;AAC3B;AACA;AACA;AACA,6BAA4B,UAAU;;;;;;;AC1FtC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,2CAA0C;AAC1C;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;ACjIA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;AACH;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP,MAAK;;AAEL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;;;;;;;ACjEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA,kBAAiB,eAAe;;AAEhC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACpCA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,cAAc;AACzB,YAAW,MAAM;AACjB,YAAW,eAAe;AAC1B,cAAa,EAAE;AACf;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;;;;;;ACnBA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB;AAChB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,eAAc,OAAO;AACrB,iBAAgB,QAAQ;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;;;;;;ACnEA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACnCA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,yCAAwC;AACxC,QAAO;;AAEP;AACA,2DAA0D,wBAAwB;AAClF;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA,iCAAgC;AAChC,8BAA6B,aAAa,EAAE;AAC5C;AACA;AACA,IAAG;AACH;;;;;;;ACpDA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,SAAS;AACpB,YAAW,SAAS;AACpB;AACA,aAAY,OAAO;AACnB;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW,SAAS;AACpB;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;;AAEA;;;;;;;ACnDA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACbA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB,YAAW,OAAO;AAClB,cAAa,OAAO;AACpB;AACA;AACA;AACA;;;;;;;ACXA;;AAEA;AACA;AACA;AACA,oBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;AACA;;;;;;;ACVA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAA+B;AAC/B;AACA;AACA,YAAW,SAAS;AACpB,cAAa;AACb;AACA;AACA;AACA;AACA;AACA","file":"./dist/js-data-http.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"js-data\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"js-data\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"HttpAdapter\"] = factory(require(\"js-data\"));\n\telse\n\t\troot[\"HttpAdapter\"] = factory(root[\"JSData\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 878550722cb11aefdcf8\n **/","/* global fetch:true Headers:true Request:true */\nconst axios = require('axios')\nimport {utils} from 'js-data'\nimport Adapter from 'js-data-adapter'\n\nlet hasFetch = false\n\ntry {\n hasFetch = window && window.fetch\n} catch (e) {}\n\nconst noop = function (...args) {\n const self = this\n const opts = args[args.length - 1]\n self.dbg(opts.op, ...args)\n return utils.resolve()\n}\n\nconst noop2 = function (...args) {\n const self = this\n const opts = args[args.length - 2]\n self.dbg(opts.op, ...args)\n return utils.resolve()\n}\n\nfunction isValidString (value) {\n return (value != null && value !== '')\n}\nfunction join (items, separator) {\n separator || (separator = '')\n return items.filter(isValidString).join(separator)\n}\nfunction makePath (...args) {\n let result = join(args, '/')\n return result.replace(/([^:\\/]|^)\\/{2,}/g, '$1/')\n}\n\nfunction encode (val) {\n return encodeURIComponent(val)\n .replace(/%40/gi, '@')\n .replace(/%3A/gi, ':')\n .replace(/%24/g, '$')\n .replace(/%2C/gi, ',')\n .replace(/%20/g, '+')\n .replace(/%5B/gi, '[')\n .replace(/%5D/gi, ']')\n}\n\nfunction buildUrl (url, params) {\n if (!params) {\n return url\n }\n\n const parts = []\n\n utils.forOwn(params, function (val, key) {\n if (val === null || typeof val === 'undefined') {\n return\n }\n if (!utils.isArray(val)) {\n val = [val]\n }\n\n val.forEach(function (v) {\n if (window.toString.call(v) === '[object Date]') {\n v = v.toISOString()\n } else if (utils.isObject(v)) {\n v = utils.toJson(v)\n }\n parts.push(`${encode(key)}=${encode(v)}`)\n })\n })\n\n if (parts.length > 0) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&')\n }\n\n return url\n}\n\nconst __super__ = Adapter.prototype\n\nconst DEFAULTS = {\n // Default and user-defined settings\n /**\n * @name HttpAdapter#basePath\n * @type {string}\n */\n basePath: '',\n\n /**\n * @name HttpAdapter#forceTrailingSlash\n * @type {boolean}\n * @default false\n */\n forceTrailingSlash: false,\n\n /**\n * @name HttpAdapter#http\n * @type {Function}\n */\n http: axios,\n\n /**\n * @name HttpAdapter#httpConfig\n * @type {Object}\n */\n httpConfig: {},\n\n /**\n * @name HttpAdapter#suffix\n * @type {string}\n */\n suffix: '',\n\n /**\n * @name HttpAdapter#useFetch\n * @type {boolean}\n * @default false\n */\n useFetch: false\n}\n\n/**\n * HttpAdapter class.\n *\n * @class HttpAdapter\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.basePath=''] TODO\n * @param {boolean} [opts.debug=false] TODO\n * @param {boolean} [opts.forceTrailingSlash=false] TODO\n * @param {Object} [opts.http=axios] TODO\n * @param {Object} [opts.httpConfig={}] TODO\n * @param {string} [opts.suffix=''] TODO\n * @param {boolean} [opts.useFetch=false] TODO\n */\nfunction HttpAdapter (opts) {\n const self = this\n opts || (opts = {})\n utils.fillIn(opts, DEFAULTS)\n Adapter.call(self, opts)\n}\n\n// Setup prototype inheritance from Adapter\nHttpAdapter.prototype = Object.create(Adapter.prototype, {\n constructor: {\n value: HttpAdapter,\n enumerable: false,\n writable: true,\n configurable: true\n }\n})\n\nObject.defineProperty(HttpAdapter, '__super__', {\n configurable: true,\n value: Adapter\n})\n\nutils.addHiddenPropsToTarget(HttpAdapter.prototype, {\n /**\n * @name HttpAdapter#afterDEL\n * @method\n * @param {string} url\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterDEL: noop2,\n\n /**\n * @name HttpAdapter#afterGET\n * @method\n * @param {string} url\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterGET: noop2,\n\n /**\n * @name HttpAdapter#afterHTTP\n * @method\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterHTTP: noop2,\n\n /**\n * @name HttpAdapter#afterPOST\n * @method\n * @param {string} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterPOST: noop2,\n\n /**\n * @name HttpAdapter#afterPUT\n * @method\n * @param {string} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterPUT: noop2,\n\n /**\n * @name HttpAdapter#beforeDEL\n * @method\n * @param {Object} url\n * @param {Object} config\n * @param {Object} opts\n */\n beforeDEL: noop,\n\n /**\n * @name HttpAdapter#beforeGET\n * @method\n * @param {Object} url\n * @param {Object} config\n * @param {Object} opts\n */\n beforeGET: noop,\n\n /**\n * @name HttpAdapter#beforeHTTP\n * @method\n * @param {Object} config\n * @param {Object} opts\n */\n beforeHTTP: noop,\n\n /**\n * @name HttpAdapter#beforePOST\n * @method\n * @param {Object} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n */\n beforePOST: noop,\n\n /**\n * @name HttpAdapter#beforePUT\n * @method\n * @param {Object} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n */\n beforePUT: noop,\n\n _count (mapper, query, opts) {\n const self = this\n return self.GET(\n self.getPath('count', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _create (mapper, props, opts) {\n const self = this\n return self.POST(\n self.getPath('create', mapper, props, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _createMany (mapper, props, opts) {\n const self = this\n return self.POST(\n self.getPath('createMany', mapper, null, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _destroy (mapper, id, opts) {\n const self = this\n return self.DEL(\n self.getPath('destroy', mapper, id, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _destroyAll (mapper, query, opts) {\n const self = this\n return self.DEL(\n self.getPath('destroyAll', mapper, null, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _end (mapper, opts, response) {\n return [this.deserialize(mapper, response, opts), response]\n },\n\n _find (mapper, id, opts) {\n const self = this\n return self.GET(\n self.getPath('find', mapper, id, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _findAll (mapper, query, opts) {\n const self = this\n return self.GET(\n self.getPath('findAll', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _sum (mapper, field, query, opts) {\n const self = this\n return self.GET(\n self.getPath('sum', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _update (mapper, id, props, opts) {\n const self = this\n return self.PUT(\n self.getPath('update', mapper, id, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _updateAll (mapper, props, query, opts) {\n const self = this\n return self.PUT(\n self.getPath('updateAll', mapper, null, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _updateMany (mapper, records, opts) {\n const self = this\n return self.PUT(\n self.getPath('updateMany', mapper, null, opts),\n self.serialize(mapper, records, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n /**\n * Retrieve the number of records that match the selection `query`.\n *\n * @name HttpAdapter#count\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n count (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params.count = true\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.count.call(self, mapper, query, opts)\n },\n\n /**\n * Create a new the record from the provided `props`.\n *\n * @name HttpAdapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props Properties to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n create (mapper, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.create.call(self, mapper, props, opts)\n },\n\n /**\n * Create multiple new records in batch.\n *\n * @name HttpAdapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Array} props Array of property objects to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n createMany (mapper, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.createMany.call(self, mapper, props, opts)\n },\n\n /**\n * Make an Http request to `url` according to the configuration in `config`.\n *\n * @name HttpAdapter#DEL\n * @method\n * @param {string} url Url for the request.\n * @param {Object} [config] Http configuration that will be passed to\n * {@link HttpAdapter#HTTP}.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n DEL (url, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.method = config.method || 'delete'\n\n // beforeDEL lifecycle hook\n op = opts.op = 'beforeDEL'\n return utils.resolve(self[op](url, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'DEL'\n self.dbg(op, url, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterDEL lifecycle hook\n op = opts.op = 'afterDEL'\n return utils.resolve(self[op](url, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * Transform the server response object into the payload that will be returned\n * to JSData.\n *\n * @name HttpAdapter#deserialize\n * @method\n * @param {Object} mapper The mapper used for the operation.\n * @param {Object} response Response object from {@link HttpAdapter#HTTP}.\n * @param {Object} opts Configuration options.\n * @return {(Object|Array)} Deserialized data.\n */\n deserialize (mapper, response, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.deserialize)) {\n return opts.deserialize(mapper, response, opts)\n }\n if (utils.isFunction(mapper.deserialize)) {\n return mapper.deserialize(mapper, response, opts)\n }\n if (response && response.hasOwnProperty('data')) {\n return response.data\n }\n return response\n },\n\n /**\n * Destroy the record with the given primary key.\n *\n * @name HttpAdapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.destroy.call(self, mapper, id, opts)\n },\n\n /**\n * Destroy the records that match the selection `query`.\n *\n * @name HttpAdapter#destroyAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n destroyAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.destroyAll.call(self, mapper, query, opts)\n },\n\n /**\n * Log an error.\n *\n * @name HttpAdapter#error\n * @method\n * @param {...*} [args] Arguments to log.\n */\n error (...args) {\n if (console) {\n console[typeof console.error === 'function' ? 'error' : 'log'](...args)\n }\n },\n\n /**\n * Make an Http request using `window.fetch`.\n *\n * @name HttpAdapter#fetch\n * @method\n * @param {Object} config Request configuration.\n * @param {Object} config.data Payload for the request.\n * @param {string} config.method Http method for the request.\n * @param {Object} config.headers Headers for the request.\n * @param {Object} config.params Querystring for the request.\n * @param {string} config.url Url for the request.\n * @param {Object} [opts] Configuration options.\n */\n fetch (config, opts) {\n const requestConfig = {\n method: config.method,\n // turn the plain headers object into the Fetch Headers object\n headers: new Headers(config.headers)\n }\n\n if (config.data) {\n requestConfig.body = utils.toJson(config.data)\n }\n\n return fetch(new Request(buildUrl(config.url, config.params), requestConfig)).then(function (response) {\n response.config = {\n method: config.method,\n url: config.url\n }\n return response.json().then(function (data) {\n response.data = data\n return response\n })\n })\n },\n\n /**\n * Retrieve the record with the given primary key.\n *\n * @name HttpAdapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.find.call(self, mapper, id, opts)\n },\n\n /**\n * Retrieve the records that match the selection `query`.\n *\n * @name HttpAdapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n findAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.findAll.call(self, mapper, query, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#GET\n * @method\n * @param {string} url The url for the request.\n * @param {Object} config Request configuration options.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n GET (url, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.method = config.method || 'get'\n\n // beforeGET lifecycle hook\n op = opts.op = 'beforeGET'\n return utils.resolve(self[op](url, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'GET'\n self.dbg(op, url, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterGET lifecycle hook\n op = opts.op = 'afterGET'\n return utils.resolve(self[op](url, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * @name HttpAdapter#getEndpoint\n * @method\n * @param {Object} mapper TODO\n * @param {*} id TODO\n * @param {boolean} opts TODO\n * @return {string} Full path.\n */\n getEndpoint (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = utils.isUndefined(opts.params) ? {} : opts.params\n const relationList = mapper.relationList || []\n let endpoint = utils.isUndefined(opts.endpoint) ? (utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint) : opts.endpoint\n\n relationList.forEach(function (def) {\n if (def.type !== 'belongsTo' || !def.parent) {\n return\n }\n let item\n const parentKey = def.foreignKey\n const parentDef = def.getRelation()\n let parentId = opts.params[parentKey]\n\n if (parentId === false || !parentKey || !parentDef) {\n if (parentId === false) {\n delete opts.params[parentKey]\n }\n return false\n } else {\n delete opts.params[parentKey]\n\n if (utils.isObject(id)) {\n item = id\n }\n\n if (item) {\n parentId = parentId || def.getForeignKey(item) || (def.getLocalField(item) ? utils.get(def.getLocalField(item), parentDef.idAttribute) : null)\n }\n\n if (parentId) {\n delete opts.endpoint\n const _opts = {}\n utils.forOwn(opts, function (value, key) {\n _opts[key] = value\n })\n utils._(_opts, parentDef)\n endpoint = makePath(self.getEndpoint(parentDef, parentId, _opts), parentId, endpoint)\n return false\n }\n }\n })\n\n return endpoint\n },\n\n /**\n * @name HttpAdapter#getPath\n * @method\n * @param {string} method TODO\n * @param {Object} mapper TODO\n * @param {(string|number)?} id TODO\n * @param {Object} opts Configuration options.\n */\n getPath (method, mapper, id, opts) {\n const self = this\n opts || (opts = {})\n const args = [\n utils.isUndefined(opts.basePath) ? (utils.isUndefined(mapper.basePath) ? self.basePath : mapper.basePath) : opts.basePath,\n self.getEndpoint(mapper, (utils.isString(id) || utils.isNumber(id) || method === 'create') ? id : null, opts)\n ]\n if (method === 'find' || method === 'update' || method === 'destroy') {\n args.push(id)\n }\n return makePath.apply(utils, args)\n },\n\n getParams (opts) {\n opts || (opts = {})\n if (utils.isUndefined(opts.params)) {\n return {}\n }\n return utils.copy(opts.params)\n },\n\n getSuffix (mapper, opts) {\n opts || (opts = {})\n if (utils.isUndefined(opts.suffix)) {\n if (utils.isUndefined(mapper.suffix)) {\n return this.suffix\n }\n return mapper.suffix\n }\n return opts.suffix\n },\n\n /**\n * Make an Http request.\n *\n * @name HttpAdapter#HTTP\n * @method\n * @param {Object} config Request configuration options.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n HTTP (config, opts) {\n const self = this\n const start = new Date()\n opts || (opts = {})\n const payload = config.data\n const cache = config.cache\n const timeout = config.timeout\n config = utils.copy(config, null, null, null, ['data', 'cache', 'timeout'])\n config = utils.deepMixIn(config, self.httpConfig)\n config.data = payload\n config.cache = cache\n config.timeout = timeout\n if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {\n config.url += '/'\n }\n config.method = config.method.toUpperCase()\n const suffix = config.suffix || opts.suffix || self.suffix\n if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {\n config.url += suffix\n }\n\n function logResponse (data) {\n const str = `${start.toUTCString()} - ${config.method.toUpperCase()} ${config.url} - ${data.status} ${(new Date().getTime() - start.getTime())}ms`\n if (data.status >= 200 && data.status < 300) {\n if (self.log) {\n self.dbg('debug', str, data)\n }\n return data\n } else {\n if (self.error) {\n self.error(`'FAILED: ${str}`, data)\n }\n return utils.reject(data)\n }\n }\n\n if (!self.http) {\n throw new Error('You have not configured this adapter with an http library!')\n }\n\n return utils.resolve(self.beforeHTTP(config, opts)).then(function (_config) {\n config = _config || config\n if (hasFetch && (self.useFetch || opts.useFetch || !self.http)) {\n return self.fetch(config, opts).then(logResponse, logResponse)\n }\n return self.http(config).then(logResponse, logResponse).catch(function (err) {\n return self.responseError(err, config, opts)\n })\n }).then(function (response) {\n return utils.resolve(self.afterHTTP(config, opts, response)).then(function (_response) {\n return _response || response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#POST\n * @method\n * @param {*} url TODO\n * @param {Object} data TODO\n * @param {Object} config TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n POST (url, data, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.data = data || config.data\n config.method = config.method || 'post'\n\n // beforePOST lifecycle hook\n op = opts.op = 'beforePOST'\n return utils.resolve(self[op](url, data, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'POST'\n self.dbg(op, url, data, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterPOST lifecycle hook\n op = opts.op = 'afterPOST'\n return utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#PUT\n * @method\n * @param {*} url TODO\n * @param {Object} data TODO\n * @param {Object} config TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n PUT (url, data, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.data = data || config.data\n config.method = config.method || 'put'\n\n // beforePUT lifecycle hook\n op = opts.op = 'beforePUT'\n return utils.resolve(self[op](url, data, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'PUT'\n self.dbg(op, url, data, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterPUT lifecycle hook\n op = opts.op = 'afterPUT'\n return utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#queryTransform\n * @method\n * @param {Object} mapper TODO\n * @param {*} params TODO\n * @param {*} opts TODO\n * @return {*} Transformed params.\n */\n queryTransform (mapper, params, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.queryTransform)) {\n return opts.queryTransform(mapper, params, opts)\n }\n if (utils.isFunction(mapper.queryTransform)) {\n return mapper.queryTransform(mapper, params, opts)\n }\n return params\n },\n\n /**\n * Error handler invoked when the promise returned by {@link HttpAdapter#http}\n * is rejected. Default implementation is to just return the error wrapped in\n * a rejected Promise, aka rethrow the error. {@link HttpAdapter#http} is\n * called by {@link HttpAdapter#HTTP}.\n *\n * @name HttpAdapter#responseError\n * @method\n * @param {*} err The error that {@link HttpAdapter#http} rejected with.\n * @param {Object} config The `config` argument that was passed to {@link HttpAdapter#HTTP}.\n * @param {*} opts The `opts` argument that was passed to {@link HttpAdapter#HTTP}.\n * @return {Promise}\n */\n responseError (err, config, opts) {\n return utils.reject(err)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#serialize\n * @method\n * @param {Object} mapper TODO\n * @param {Object} data TODO\n * @param {*} opts TODO\n * @return {*} Serialized data.\n */\n serialize (mapper, data, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.serialize)) {\n return opts.serialize(mapper, data, opts)\n }\n if (utils.isFunction(mapper.serialize)) {\n return mapper.serialize(mapper, data, opts)\n }\n return data\n },\n\n /**\n * Retrieve the sum of the field of the records that match the selection query.\n *\n * @name HttpAdapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field The field to sum.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n sum (mapper, field, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n if (!utils.utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts.params = self.getParams(opts)\n opts.params.sum = field\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.sum.call(self, mapper, field, query, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#update\n * @method\n * @param {Object} mapper TODO\n * @param {*} id TODO\n * @param {*} props TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n update (mapper, id, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.update.call(self, mapper, id, props, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#updateAll\n * @method\n * @param {Object} mapper TODO\n * @param {Object} props TODO\n * @param {Object} query TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n updateAll (mapper, props, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.updateAll.call(self, mapper, props, query, opts)\n },\n\n /**\n * Update multiple records in batch.\n *\n * {@link HttpAdapter#beforeUpdateMany} will be called before calling\n * {@link HttpAdapter#PUT}.\n * {@link HttpAdapter#afterUpdateMany} will be called after calling\n * {@link HttpAdapter#PUT}.\n *\n * @name HttpAdapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Array} records Array of property objects to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n updateMany (mapper, records, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.updateMany.call(self, mapper, records, opts)\n }\n})\n\n/**\n * Add an Http actions to a mapper.\n *\n * @name HttpAdapter.addAction\n * @method\n * @param {string} name Name of the new action.\n * @param {Object} [opts] Action configuration\n * @param {string} [opts.adapter]\n * @param {string} [opts.pathname]\n * @param {Function} [opts.request]\n * @param {Function} [opts.response]\n * @param {Function} [opts.responseError]\n * @return {Function} Decoration function, which should be passed the mapper to\n * decorate when invoked.\n */\nHttpAdapter.addAction = function (name, opts) {\n if (!name || !utils.isString(name)) {\n throw new TypeError('action(name[, opts]): Expected: string, Found: ' + typeof name)\n }\n return function (mapper) {\n if (mapper[name]) {\n throw new Error('action(name[, opts]): ' + name + ' already exists on target!')\n }\n opts.request = opts.request || function (config) { return config }\n opts.response = opts.response || function (response) { return response }\n opts.responseError = opts.responseError || function (err) { return utils.reject(err) }\n mapper[name] = function (id, _opts) {\n const self = this\n if (utils.isObject(id)) {\n _opts = id\n }\n _opts = _opts || {}\n let adapter = self.getAdapter(opts.adapter || self.defaultAdapter || 'http')\n let config = {}\n utils.fillIn(config, opts)\n if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {\n _opts.endpoint = config.endpoint\n }\n if (typeof _opts.getEndpoint === 'function') {\n config.url = _opts.getEndpoint(self, _opts)\n } else {\n let args = [\n _opts.basePath || self.basePath || adapter.basePath,\n adapter.getEndpoint(self, utils.isSorN(id) ? id : null, _opts)\n ]\n if (utils.isSorN(id)) {\n args.push(id)\n }\n args.push(opts.pathname || name)\n config.url = makePath.apply(null, args)\n }\n config.method = config.method || 'GET'\n config.mapper = self.name\n utils.deepMixIn(config)(_opts)\n return utils.resolve(config)\n .then(_opts.request || opts.request)\n .then(function (config) { return adapter.HTTP(config) })\n .then(function (data) {\n if (data && data.config) {\n data.config.mapper = self.name\n }\n return data\n })\n .then(_opts.response || opts.response, _opts.responseError || opts.responseError)\n }\n return mapper\n }\n}\n\n/**\n * Add multiple Http actions to a mapper. See {@link HttpAdapter.addAction} for\n * action configuration options.\n *\n * @name HttpAdapter.addActions\n * @method\n * @param {Object.} opts Object where the key is an action name\n * and the value is the configuration for the action.\n * @return {Function} Decoration function, which should be passed the mapper to\n * decorate when invoked.\n */\nHttpAdapter.addActions = function (opts) {\n opts || (opts = {})\n return function (mapper) {\n utils.forOwn(mapper, function (value, key) {\n HttpAdapter.addAction(key, value)(mapper)\n })\n return mapper\n }\n}\n\n/**\n * Alternative to ES6 class syntax for extending `HttpAdapter`.\n *\n * __ES6__:\n * ```javascript\n * class MyHttpAdapter extends HttpAdapter {\n * deserialize (Model, data, opts) {\n * const data = super.deserialize(Model, data, opts)\n * data.foo = 'bar'\n * return data\n * }\n * }\n * ```\n *\n * __ES5__:\n * ```javascript\n * var instanceProps = {\n * // override deserialize\n * deserialize: function (Model, data, opts) {\n * var Ctor = this.constructor\n * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize\n * // call the super deserialize\n * var data = superDeserialize(Model, data, opts)\n * data.foo = 'bar'\n * return data\n * },\n * say: function () { return 'hi' }\n * }\n * var classProps = {\n * yell: function () { return 'HI' }\n * }\n *\n * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps)\n * var adapter = new MyHttpAdapter()\n * adapter.say() // \"hi\"\n * MyHttpAdapter.yell() // \"HI\"\n * ```\n *\n * @name HttpAdapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Object} Subclass of `HttpAdapter`.\n */\nHttpAdapter.extend = utils.extend\n\n/**\n * Details of the current version of the `js-data-http` module.\n *\n * @name HttpAdapter.version\n * @type {Object}\n * @property {string} version.full The full semver value.\n * @property {number} version.major The major version number.\n * @property {number} version.minor The minor version number.\n * @property {number} version.patch The patch version number.\n * @property {(string|boolean)} version.alpha The alpha version value,\n * otherwise `false` if the current version is not alpha.\n * @property {(string|boolean)} version.beta The beta version value,\n * otherwise `false` if the current version is not beta.\n */\nHttpAdapter.version = '<%= version %>'\n\n/**\n * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http`\n * that works on Node.js is registered in NPM as `js-data-http-node`. The build\n * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower\n * as `js-data-fetch`.\n *\n * __Script tag__:\n * ```javascript\n * window.HttpAdapter\n * ```\n * __CommonJS__:\n * ```javascript\n * var HttpAdapter = require('js-data-http')\n * ```\n * __ES6 Modules__:\n * ```javascript\n * import HttpAdapter from 'js-data-http'\n * ```\n * __AMD__:\n * ```javascript\n * define('myApp', ['js-data-http'], function (HttpAdapter) { ... })\n * ```\n *\n * @module js-data-http\n */\n\nmodule.exports = HttpAdapter\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external {\"amd\":\"js-data\",\"commonjs\":\"js-data\",\"commonjs2\":\"js-data\",\"root\":\"JSData\"}\n ** module id = 1\n ** module chunks = 0\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('js-data')) :\n typeof define === 'function' && define.amd ? define('js-data-adapter', ['js-data'], factory) :\n (factory(global.JSData));\n}(this, function (jsData) { 'use strict';\n\n var babelHelpers = {};\n babelHelpers.typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n\n babelHelpers.defineProperty = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n };\n\n babelHelpers.slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n }();\n\n babelHelpers;\n\n var noop = function noop() {\n var self = this;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var opts = args[args.length - 1];\n self.dbg.apply(self, [opts.op].concat(args));\n return jsData.utils.resolve();\n };\n\n var noop2 = function noop2() {\n var self = this;\n\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var opts = args[args.length - 2];\n self.dbg.apply(self, [opts.op].concat(args));\n return jsData.utils.resolve();\n };\n\n var unique = function unique(array) {\n var seen = {};\n var final = [];\n array.forEach(function (item) {\n if (item in seen) {\n return;\n }\n final.push(item);\n seen[item] = 0;\n });\n return final;\n };\n\n var withoutRelations = function withoutRelations(mapper, props) {\n return jsData.utils.omit(props, mapper.relationFields || []);\n };\n\n var DEFAULTS = {\n /**\n * Whether to log debugging information.\n *\n * @name Adapter#debug\n * @type {boolean}\n * @default false\n */\n debug: false,\n\n /**\n * Whether to return a more detailed response object.\n *\n * @name Adapter#raw\n * @type {boolean}\n * @default false\n */\n raw: false\n };\n\n /**\n * Abstract class meant to be extended by adapters.\n *\n * @class Adapter\n * @abstract\n * @param {Object} [opts] Configuration opts.\n * @param {boolean} [opts.debug=false] Whether to log debugging information.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed response\n * object.\n */\n function Adapter(opts) {\n var self = this;\n opts || (opts = {});\n jsData.utils.fillIn(opts, DEFAULTS);\n jsData.utils.fillIn(self, opts);\n }\n\n Adapter.reserved = ['orderBy', 'sort', 'limit', 'offset', 'skip', 'where'];\n\n /**\n * Response object used when `raw` is `true`. May contain other fields in\n * addition to `data`.\n *\n * @typedef {Object} Response\n * @property {Object} data Response data.\n * @property {string} op The operation for which the response was created.\n */\n function Response(data, meta, op) {\n var self = this;\n meta || (meta = {});\n self.data = data;\n jsData.utils.fillIn(self, meta);\n self.op = op;\n }\n\n Adapter.Response = Response;\n\n /**\n * Alternative to ES6 class syntax for extending `Adapter`.\n *\n * @name Adapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Object} Subclass of `Adapter`.\n */\n Adapter.extend = jsData.utils.extend;\n\n jsData.utils.addHiddenPropsToTarget(Adapter.prototype, {\n /**\n * Lifecycle method method called by count.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes count to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the count.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.\n *\n * @name Adapter#afterCount\n * @method\n * @param {Object} mapper The `mapper` argument passed to count.\n * @param {Object} props The `props` argument passed to count.\n * @param {Object} opts The `opts` argument passed to count.\n * @property {string} opts.op `afterCount`\n * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCount: noop2,\n\n /**\n * Lifecycle method method called by create.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes create to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created record.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.\n *\n * @name Adapter#afterCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to create.\n * @param {Object} props The `props` argument passed to create.\n * @param {Object} opts The `opts` argument passed to create.\n * @property {string} opts.op `afterCreate`\n * @param {Object|Response} response Created record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCreate: noop2,\n\n /**\n * Lifecycle method method called by createMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created records.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.\n *\n * @name Adapter#afterCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to createMany.\n * @param {Object[]} props The `props` argument passed to createMany.\n * @param {Object} opts The `opts` argument passed to createMany.\n * @property {string} opts.op `afterCreateMany`\n * @param {Object[]|Response} response Created records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCreateMany: noop2,\n\n /**\n * Lifecycle method method called by destroy.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.\n *\n * @name Adapter#afterDestroy\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroy.\n * @param {(string|number)} id The `id` argument passed to destroy.\n * @param {Object} opts The `opts` argument passed to destroy.\n * @property {string} opts.op `afterDestroy`\n * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.\n */\n afterDestroy: noop2,\n\n /**\n * Lifecycle method method called by destroyAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.\n *\n * @name Adapter#afterDestroyAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroyAll.\n * @param {Object} query The `query` argument passed to destroyAll.\n * @param {Object} opts The `opts` argument passed to destroyAll.\n * @property {string} opts.op `afterDestroyAll`\n * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.\n */\n afterDestroyAll: noop2,\n\n /**\n * Lifecycle method method called by find.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes find to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found record, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.\n *\n * @name Adapter#afterFind\n * @method\n * @param {Object} mapper The `mapper` argument passed to find.\n * @param {(string|number)} id The `id` argument passed to find.\n * @param {Object} opts The `opts` argument passed to find.\n * @property {string} opts.op `afterFind`\n * @param {Object|Response} response The found record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterFind: noop2,\n\n /**\n * Lifecycle method method called by findAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.\n *\n * @name Adapter#afterFindAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to findAll.\n * @param {Object} query The `query` argument passed to findAll.\n * @param {Object} opts The `opts` argument passed to findAll.\n * @property {string} opts.op `afterFindAll`\n * @param {Object[]|Response} response The found records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterFindAll: noop2,\n\n /**\n * Lifecycle method method called by sum.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes sum to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the sum.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.\n *\n * @name Adapter#afterSum\n * @method\n * @param {Object} mapper The `mapper` argument passed to sum.\n * @param {Object} props The `props` argument passed to sum.\n * @param {Object} opts The `opts` argument passed to sum.\n * @property {string} opts.op `afterSum`\n * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.\n */\n afterSum: noop2,\n\n /**\n * Lifecycle method method called by update.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes update to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated record.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.\n *\n * @name Adapter#afterUpdate\n * @method\n * @param {Object} mapper The `mapper` argument passed to update.\n * @param {(string|number)} id The `id` argument passed to update.\n * @param {Object} props The `props` argument passed to update.\n * @param {Object} opts The `opts` argument passed to update.\n * @property {string} opts.op `afterUpdate`\n * @param {Object|Response} response The updated record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdate: noop2,\n\n /**\n * Lifecycle method method called by updateAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.\n *\n * @name Adapter#afterUpdateAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateAll.\n * @param {Object} props The `props` argument passed to updateAll.\n * @param {Object} query The `query` argument passed to updateAll.\n * @param {Object} opts The `opts` argument passed to updateAll.\n * @property {string} opts.op `afterUpdateAll`\n * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdateAll: noop2,\n\n /**\n * Lifecycle method method called by updateMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.\n *\n * @name Adapter#afterUpdateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateMany.\n * @param {Object[]} records The `records` argument passed to updateMany.\n * @param {Object} opts The `opts` argument passed to updateMany.\n * @property {string} opts.op `afterUpdateMany`\n * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdateMany: noop2,\n\n /**\n * Lifecycle method method called by count.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes count to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.\n *\n * @name Adapter#beforeCount\n * @method\n * @param {Object} mapper The `mapper` argument passed to count.\n * @param {Object} query The `query` argument passed to count.\n * @param {Object} opts The `opts` argument passed to count.\n * @property {string} opts.op `beforeCount`\n */\n beforeCount: noop,\n\n /**\n * Lifecycle method method called by create.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes create to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.\n *\n * @name Adapter#beforeCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to create.\n * @param {Object} props The `props` argument passed to create.\n * @param {Object} opts The `opts` argument passed to create.\n * @property {string} opts.op `beforeCreate`\n */\n beforeCreate: noop,\n\n /**\n * Lifecycle method method called by createMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.\n *\n * @name Adapter#beforeCreateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to createMany.\n * @param {Object[]} props The `props` argument passed to createMany.\n * @param {Object} opts The `opts` argument passed to createMany.\n * @property {string} opts.op `beforeCreateMany`\n */\n beforeCreateMany: noop,\n\n /**\n * Lifecycle method method called by destroy.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.\n *\n * @name Adapter#beforeDestroy\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroy.\n * @param {(string|number)} id The `id` argument passed to destroy.\n * @param {Object} opts The `opts` argument passed to destroy.\n * @property {string} opts.op `beforeDestroy`\n */\n beforeDestroy: noop,\n\n /**\n * Lifecycle method method called by destroyAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.\n *\n * @name Adapter#beforeDestroyAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroyAll.\n * @param {Object} query The `query` argument passed to destroyAll.\n * @param {Object} opts The `opts` argument passed to destroyAll.\n * @property {string} opts.op `beforeDestroyAll`\n */\n beforeDestroyAll: noop,\n\n /**\n * Lifecycle method method called by find.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes find to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.\n *\n * @name Adapter#beforeFind\n * @method\n * @param {Object} mapper The `mapper` argument passed to find.\n * @param {(string|number)} id The `id` argument passed to find.\n * @param {Object} opts The `opts` argument passed to find.\n * @property {string} opts.op `beforeFind`\n */\n beforeFind: noop,\n\n /**\n * Lifecycle method method called by findAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.\n *\n * @name Adapter#beforeFindAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to findAll.\n * @param {Object} query The `query` argument passed to findAll.\n * @param {Object} opts The `opts` argument passed to findAll.\n * @property {string} opts.op `beforeFindAll`\n */\n beforeFindAll: noop,\n\n /**\n * Lifecycle method method called by sum.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes sum to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.\n *\n * @name Adapter#beforeSum\n * @method\n * @param {Object} mapper The `mapper` argument passed to sum.\n * @param {Object} query The `query` argument passed to sum.\n * @param {Object} opts The `opts` argument passed to sum.\n * @property {string} opts.op `beforeSum`\n */\n beforeSum: noop,\n\n /**\n * Lifecycle method method called by update.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes update to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.\n *\n * @name Adapter#beforeUpdate\n * @method\n * @param {Object} mapper The `mapper` argument passed to update.\n * @param {(string|number)} id The `id` argument passed to update.\n * @param {Object} props The `props` argument passed to update.\n * @param {Object} opts The `opts` argument passed to update.\n * @property {string} opts.op `beforeUpdate`\n */\n beforeUpdate: noop,\n\n /**\n * Lifecycle method method called by updateAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.\n *\n * @name Adapter#beforeUpdateAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateAll.\n * @param {Object} props The `props` argument passed to updateAll.\n * @param {Object} query The `query` argument passed to updateAll.\n * @param {Object} opts The `opts` argument passed to updateAll.\n * @property {string} opts.op `beforeUpdateAll`\n */\n beforeUpdateAll: noop,\n\n /**\n * Lifecycle method method called by updateMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.\n *\n * @name Adapter#beforeUpdateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateMany.\n * @param {Object[]} props The `props` argument passed to updateMany.\n * @param {Object} opts The `opts` argument passed to updateMany.\n * @property {string} opts.op `beforeUpdateMany`\n */\n beforeUpdateMany: noop,\n\n /**\n * Shortcut for `#log('debug'[, arg1[, arg2[, argn]]])`.\n *\n * @name Adapter#dbg\n * @method\n */\n dbg: function dbg() {\n for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this.log.apply(this, ['debug'].concat(args));\n },\n\n\n /**\n * Retrieve the number of records that match the selection query. Called by\n * `Mapper#count`.\n *\n * @name Adapter#count\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n count: function count(mapper, query, opts) {\n var self = this;\n var op = void 0;\n query || (query = {});\n opts || (opts = {});\n\n // beforeCount lifecycle hook\n op = opts.op = 'beforeCount';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n // Allow for re-assignment from lifecycle hook\n op = opts.op = 'count';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._count(mapper, query, opts));\n }).then(function (results) {\n var _results = babelHelpers.slicedToArray(results, 2);\n\n var data = _results[0];\n var result = _results[1];\n\n result || (result = {});\n var response = new Response(data, result, op);\n response = self.respond(response, opts);\n\n // afterCount lifecycle hook\n op = opts.op = 'afterCount';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Create a new record. Called by `Mapper#create`.\n *\n * @name Adapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The record to be created.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n create: function create(mapper, props, opts) {\n var self = this;\n var op = void 0;\n props || (props = {});\n opts || (opts = {});\n\n // beforeCreate lifecycle hook\n op = opts.op = 'beforeCreate';\n return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n props = withoutRelations(mapper, props);\n op = opts.op = 'create';\n self.dbg(op, mapper, props, opts);\n return jsData.utils.resolve(self._create(mapper, props, opts));\n }).then(function (results) {\n var _results2 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results2[0];\n var result = _results2[1];\n\n result || (result = {});\n var response = new Response(data, result, 'create');\n response.created = data ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterCreate lifecycle hook\n op = opts.op = 'afterCreate';\n return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Create multiple records in a single batch. Called by `Mapper#createMany`.\n *\n * @name Adapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The records to be created.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n createMany: function createMany(mapper, props, opts) {\n var self = this;\n var op = void 0;\n props || (props = {});\n opts || (opts = {});\n\n // beforeCreateMany lifecycle hook\n op = opts.op = 'beforeCreateMany';\n return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n props = props.map(function (record) {\n return withoutRelations(mapper, record);\n });\n op = opts.op = 'createMany';\n self.dbg(op, mapper, props, opts);\n return jsData.utils.resolve(self._createMany(mapper, props, opts));\n }).then(function (results) {\n var _results3 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results3[0];\n var result = _results3[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'createMany');\n response.created = data.length;\n response = self.respond(response, opts);\n\n // afterCreateMany lifecycle hook\n op = opts.op = 'afterCreateMany';\n return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Destroy the record with the given primary key. Called by\n * `Mapper#destroy`.\n *\n * @name Adapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n destroy: function destroy(mapper, id, opts) {\n var self = this;\n var op = void 0;\n opts || (opts = {});\n\n // beforeDestroy lifecycle hook\n op = opts.op = 'beforeDestroy';\n return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {\n op = opts.op = 'destroy';\n self.dbg(op, mapper, id, opts);\n return jsData.utils.resolve(self._destroy(mapper, id, opts));\n }).then(function (results) {\n var _results4 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results4[0];\n var result = _results4[1];\n\n result || (result = {});\n var response = new Response(data, result, 'destroy');\n response = self.respond(response, opts);\n\n // afterDestroy lifecycle hook\n op = opts.op = 'afterDestroy';\n return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Destroy the records that match the selection query. Called by\n * `Mapper#destroyAll`.\n *\n * @name Adapter#destroyAll\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n destroyAll: function destroyAll(mapper, query, opts) {\n var self = this;\n var op = void 0;\n query || (query = {});\n opts || (opts = {});\n\n // beforeDestroyAll lifecycle hook\n op = opts.op = 'beforeDestroyAll';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n op = opts.op = 'destroyAll';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._destroyAll(mapper, query, opts));\n }).then(function (results) {\n var _results5 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results5[0];\n var result = _results5[1];\n\n result || (result = {});\n var response = new Response(data, result, 'destroyAll');\n response = self.respond(response, opts);\n\n // afterDestroyAll lifecycle hook\n op = opts.op = 'afterDestroyAll';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Return the foreignKey from the given record for the provided relationship.\n *\n * There may be reasons why you may want to override this method, like when\n * the id of the parent doesn't exactly match up to the key on the child.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyForeignKey\n * @method\n * @return {*}\n */\n makeHasManyForeignKey: function makeHasManyForeignKey(mapper, def, record) {\n return def.getForeignKey(record);\n },\n\n\n /**\n * Return the localKeys from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyLocalKeys\n * @method\n * @return {*}\n */\n makeHasManyLocalKeys: function makeHasManyLocalKeys(mapper, def, record) {\n var localKeys = [];\n var itemKeys = jsData.utils.get(record, def.localKeys) || [];\n itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);\n localKeys = localKeys.concat(itemKeys);\n return unique(localKeys).filter(function (x) {\n return x;\n });\n },\n\n\n /**\n * Return the foreignKeys from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyForeignKeys\n * @method\n * @return {*}\n */\n makeHasManyForeignKeys: function makeHasManyForeignKeys(mapper, def, record) {\n return jsData.utils.get(record, mapper.idAttribute);\n },\n\n\n /**\n * Load a hasMany relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadHasMany\n * @method\n * @return {Promise}\n */\n loadHasMany: function loadHasMany(mapper, def, records, __opts) {\n var self = this;\n var singular = false;\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n singular = true;\n records = [records];\n }\n var IDs = records.map(function (record) {\n return self.makeHasManyForeignKey(mapper, def, record);\n });\n var query = {\n where: {}\n };\n var criteria = query.where[def.foreignKey] = {};\n if (singular) {\n // more efficient query when we only have one record\n criteria['=='] = IDs[0];\n } else {\n criteria['in'] = IDs.filter(function (id) {\n return id;\n });\n }\n return self.findAll(def.getRelation(), query, __opts).then(function (relatedItems) {\n records.forEach(function (record) {\n var attached = [];\n // avoid unneccesary iteration when we only have one record\n if (singular) {\n attached = relatedItems;\n } else {\n relatedItems.forEach(function (relatedItem) {\n if (jsData.utils.get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {\n attached.push(relatedItem);\n }\n });\n }\n def.setLocalField(record, attached);\n });\n });\n },\n loadHasManyLocalKeys: function loadHasManyLocalKeys(mapper, def, records, __opts) {\n var self = this;\n var record = void 0;\n var relatedMapper = def.getRelation();\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n record = records;\n }\n\n if (record) {\n return self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {\n 'in': self.makeHasManyLocalKeys(mapper, def, record)\n })\n }, __opts).then(function (relatedItems) {\n def.setLocalField(record, relatedItems);\n });\n } else {\n var _ret = function () {\n var localKeys = [];\n records.forEach(function (record) {\n localKeys = localKeys.concat(self.self.makeHasManyLocalKeys(mapper, def, record));\n });\n return {\n v: self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {\n 'in': unique(localKeys).filter(function (x) {\n return x;\n })\n })\n }, __opts).then(function (relatedItems) {\n records.forEach(function (item) {\n var attached = [];\n var itemKeys = jsData.utils.get(item, def.localKeys) || [];\n itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);\n relatedItems.forEach(function (relatedItem) {\n if (itemKeys && itemKeys.indexOf(relatedItem[relatedMapper.idAttribute]) !== -1) {\n attached.push(relatedItem);\n }\n });\n def.setLocalField(item, attached);\n });\n return relatedItems;\n })\n };\n }();\n\n if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === \"object\") return _ret.v;\n }\n },\n loadHasManyForeignKeys: function loadHasManyForeignKeys(mapper, def, records, __opts) {\n var self = this;\n var relatedMapper = def.getRelation();\n var idAttribute = mapper.idAttribute;\n var record = void 0;\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n record = records;\n }\n\n if (record) {\n return self.findAll(def.getRelation(), {\n where: babelHelpers.defineProperty({}, def.foreignKeys, {\n 'contains': self.makeHasManyForeignKeys(mapper, def, record)\n })\n }, __opts).then(function (relatedItems) {\n def.setLocalField(record, relatedItems);\n });\n } else {\n return self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, def.foreignKeys, {\n 'isectNotEmpty': records.map(function (record) {\n return self.makeHasManyForeignKeys(mapper, def, record);\n })\n })\n }, __opts).then(function (relatedItems) {\n var foreignKeysField = def.foreignKeys;\n records.forEach(function (record) {\n var _relatedItems = [];\n var id = jsData.utils.get(record, idAttribute);\n relatedItems.forEach(function (relatedItem) {\n var foreignKeys = jsData.utils.get(relatedItems, foreignKeysField) || [];\n if (foreignKeys.indexOf(id) !== -1) {\n _relatedItems.push(relatedItem);\n }\n });\n def.setLocalField(record, _relatedItems);\n });\n });\n }\n },\n\n\n /**\n * Load a hasOne relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadHasOne\n * @method\n * @return {Promise}\n */\n loadHasOne: function loadHasOne(mapper, def, records, __opts) {\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n records = [records];\n }\n return this.loadHasMany(mapper, def, records, __opts).then(function () {\n records.forEach(function (record) {\n var relatedData = def.getLocalField(record);\n if (jsData.utils.isArray(relatedData) && relatedData.length) {\n def.setLocalField(record, relatedData[0]);\n }\n });\n });\n },\n\n\n /**\n * Return the foreignKey from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeBelongsToForeignKey\n * @method\n * @return {*}\n */\n makeBelongsToForeignKey: function makeBelongsToForeignKey(mapper, def, record) {\n return def.getForeignKey(record);\n },\n\n\n /**\n * Load a belongsTo relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadBelongsTo\n * @method\n * @return {Promise}\n */\n loadBelongsTo: function loadBelongsTo(mapper, def, records, __opts) {\n var self = this;\n var relationDef = def.getRelation();\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n var _ret2 = function () {\n var record = records;\n return {\n v: self.find(relationDef, self.makeBelongsToForeignKey(mapper, def, record), __opts).then(function (relatedItem) {\n def.setLocalField(record, relatedItem);\n })\n };\n }();\n\n if ((typeof _ret2 === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret2)) === \"object\") return _ret2.v;\n } else {\n var keys = records.map(function (record) {\n return self.makeBelongsToForeignKey(mapper, def, record);\n }).filter(function (key) {\n return key;\n });\n return self.findAll(relationDef, {\n where: babelHelpers.defineProperty({}, relationDef.idAttribute, {\n 'in': keys\n })\n }, __opts).then(function (relatedItems) {\n records.forEach(function (record) {\n relatedItems.forEach(function (relatedItem) {\n if (relatedItem[relationDef.idAttribute] === record[def.foreignKey]) {\n def.setLocalField(record, relatedItem);\n }\n });\n });\n });\n }\n },\n\n\n /**\n * Retrieve the record with the given primary key. Called by `Mapper#find`.\n *\n * @name Adapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n find: function find(mapper, id, opts) {\n var self = this;\n var record = void 0,\n op = void 0;\n opts || (opts = {});\n opts.with || (opts.with = []);\n\n // beforeFind lifecycle hook\n op = opts.op = 'beforeFind';\n return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {\n op = opts.op = 'find';\n self.dbg(op, mapper, id, opts);\n return jsData.utils.resolve(self._find(mapper, id, opts));\n }).then(function (results) {\n var _results6 = babelHelpers.slicedToArray(results, 1);\n\n var _record = _results6[0];\n\n if (!_record) {\n return;\n }\n record = _record;\n var tasks = [];\n\n jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {\n var task = void 0;\n if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {\n if (def.type === 'hasOne') {\n task = self.loadHasOne(mapper, def, record, __opts);\n } else {\n task = self.loadHasMany(mapper, def, record, __opts);\n }\n } else if (def.type === 'hasMany' && def.localKeys) {\n task = self.loadHasManyLocalKeys(mapper, def, record, __opts);\n } else if (def.type === 'hasMany' && def.foreignKeys) {\n task = self.loadHasManyForeignKeys(mapper, def, record, __opts);\n } else if (def.type === 'belongsTo') {\n task = self.loadBelongsTo(mapper, def, record, __opts);\n }\n if (task) {\n tasks.push(task);\n }\n });\n\n return Promise.all(tasks);\n }).then(function () {\n var response = new Response(record, {}, 'find');\n response.found = record ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterFind lifecycle hook\n op = opts.op = 'afterFind';\n return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Retrieve the records that match the selection query.\n *\n * @name Adapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n findAll: function findAll(mapper, query, opts) {\n var self = this;\n opts || (opts = {});\n opts.with || (opts.with = []);\n\n var records = [];\n var op = void 0;\n var activeWith = opts._activeWith;\n\n if (jsData.utils.isObject(activeWith)) {\n var activeQuery = activeWith.query || {};\n if (activeWith.replace) {\n query = activeQuery;\n } else {\n jsData.utils.deepFillIn(query, activeQuery);\n }\n }\n\n // beforeFindAll lifecycle hook\n op = opts.op = 'beforeFindAll';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n op = opts.op = 'findAll';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._findAll(mapper, query, opts));\n }).then(function (results) {\n var _results7 = babelHelpers.slicedToArray(results, 1);\n\n var _records = _results7[0];\n\n _records || (_records = []);\n records = _records;\n var tasks = [];\n jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {\n var task = void 0;\n if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {\n if (def.type === 'hasMany') {\n task = self.loadHasMany(mapper, def, records, __opts);\n } else {\n task = self.loadHasOne(mapper, def, records, __opts);\n }\n } else if (def.type === 'hasMany' && def.localKeys) {\n task = self.loadHasManyLocalKeys(mapper, def, records, __opts);\n } else if (def.type === 'hasMany' && def.foreignKeys) {\n task = self.loadHasManyForeignKeys(mapper, def, records, __opts);\n } else if (def.type === 'belongsTo') {\n task = self.loadBelongsTo(mapper, def, records, __opts);\n }\n if (task) {\n tasks.push(task);\n }\n });\n return Promise.all(tasks);\n }).then(function () {\n var response = new Response(records, {}, 'findAll');\n response.found = records.length;\n response = self.respond(response, opts);\n\n // afterFindAll lifecycle hook\n op = opts.op = 'afterFindAll';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Resolve the value of the specified option based on the given options and\n * this adapter's settings. Override with care.\n *\n * @name Adapter#getOpt\n * @method\n * @param {string} opt The name of the option.\n * @param {Object} [opts] Configuration options.\n * @return {*} The value of the specified option.\n */\n getOpt: function getOpt(opt, opts) {\n opts || (opts = {});\n return jsData.utils.isUndefined(opts[opt]) ? jsData.utils.plainCopy(this[opt]) : jsData.utils.plainCopy(opts[opt]);\n },\n\n\n /**\n * Logging utility method. Override this method if you want to send log\n * messages to something other than the console.\n *\n * @name Adapter#log\n * @method\n * @param {string} level Log level.\n * @param {...*} values Values to log.\n */\n log: function log(level) {\n for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n if (level && !args.length) {\n args.push(level);\n level = 'debug';\n }\n if (level === 'debug' && !this.debug) {\n return;\n }\n var prefix = level.toUpperCase() + ': (Adapter)';\n if (console[level]) {\n var _console;\n\n (_console = console)[level].apply(_console, [prefix].concat(args));\n } else {\n var _console2;\n\n (_console2 = console).log.apply(_console2, [prefix].concat(args));\n }\n },\n\n\n /**\n * Retrieve sum of the specified field of the records that match the selection\n * query. Called by `Mapper#sum`.\n *\n * @name Adapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field By to sum.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n sum: function sum(mapper, field, query, opts) {\n var self = this;\n var op = void 0;\n if (!jsData.utils.isString(field)) {\n throw new Error('field must be a string!');\n }\n query || (query = {});\n opts || (opts = {});\n\n // beforeSum lifecycle hook\n op = opts.op = 'beforeSum';\n return jsData.utils.resolve(self[op](mapper, field, query, opts)).then(function () {\n // Allow for re-assignment from lifecycle hook\n op = opts.op = 'sum';\n self.dbg(op, mapper, field, query, opts);\n return jsData.utils.resolve(self._sum(mapper, field, query, opts));\n }).then(function (results) {\n var _results8 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results8[0];\n var result = _results8[1];\n\n result || (result = {});\n var response = new Response(data, result, op);\n response = self.respond(response, opts);\n\n // afterSum lifecycle hook\n op = opts.op = 'afterSum';\n return jsData.utils.resolve(self[op](mapper, field, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * @name Adapter#respond\n * @method\n * @param {Object} response Response object.\n * @param {Object} opts Configuration options.\n * return {Object} If `opts.raw == true` then return `response`, else return\n * `response.data`.\n */\n respond: function respond(response, opts) {\n return this.getOpt('raw', opts) ? response : response.data;\n },\n\n\n /**\n * Apply the given update to the record with the specified primary key. Called\n * by `Mapper#update`.\n *\n * @name Adapter#update\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id The primary key of the record to be updated.\n * @param {Object} props The update to apply to the record.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n update: function update(mapper, id, props, opts) {\n var self = this;\n props || (props = {});\n opts || (opts = {});\n var op = void 0;\n\n // beforeUpdate lifecycle hook\n op = opts.op = 'beforeUpdate';\n return jsData.utils.resolve(self[op](mapper, id, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n op = opts.op = 'update';\n self.dbg(op, mapper, id, props, opts);\n return jsData.utils.resolve(self._update(mapper, id, props, opts));\n }).then(function (results) {\n var _results9 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results9[0];\n var result = _results9[1];\n\n result || (result = {});\n var response = new Response(data, result, 'update');\n response.updated = data ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterUpdate lifecycle hook\n op = opts.op = 'afterUpdate';\n return jsData.utils.resolve(self[op](mapper, id, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Apply the given update to all records that match the selection query.\n * Called by `Mapper#updateAll`.\n *\n * @name Adapter#updateAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The update to apply to the selected records.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n updateAll: function updateAll(mapper, props, query, opts) {\n var self = this;\n props || (props = {});\n query || (query = {});\n opts || (opts = {});\n var op = void 0;\n\n // beforeUpdateAll lifecycle hook\n op = opts.op = 'beforeUpdateAll';\n return jsData.utils.resolve(self[op](mapper, props, query, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n op = opts.op = 'updateAll';\n self.dbg(op, mapper, props, query, opts);\n return jsData.utils.resolve(self._updateAll(mapper, props, query, opts));\n }).then(function (results) {\n var _results10 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results10[0];\n var result = _results10[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'updateAll');\n response.updated = data.length;\n response = self.respond(response, opts);\n\n // afterUpdateAll lifecycle hook\n op = opts.op = 'afterUpdateAll';\n return jsData.utils.resolve(self[op](mapper, props, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Update the given records in a single batch. Called by `Mapper#updateMany`.\n *\n * @name Adapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object[]} records The records to update.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n updateMany: function updateMany(mapper, records, opts) {\n var self = this;\n records || (records = []);\n opts || (opts = {});\n var op = void 0;\n var idAttribute = mapper.idAttribute;\n\n records = records.filter(function (record) {\n return jsData.utils.get(record, idAttribute);\n });\n\n // beforeUpdateMany lifecycle hook\n op = opts.op = 'beforeUpdateMany';\n return jsData.utils.resolve(self[op](mapper, records, opts)).then(function (_records) {\n // Allow for re-assignment from lifecycle hook\n records = jsData.utils.isUndefined(_records) ? records : _records;\n records = records.map(function (record) {\n return withoutRelations(mapper, record);\n });\n op = opts.op = 'updateMany';\n self.dbg(op, mapper, records, opts);\n return jsData.utils.resolve(self._updateMany(mapper, records, opts));\n }).then(function (results) {\n var _results11 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results11[0];\n var result = _results11[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'updateMany');\n response.updated = data.length;\n response = self.respond(response, opts);\n\n // afterUpdateMany lifecycle hook\n op = opts.op = 'afterUpdateMany';\n return jsData.utils.resolve(self[op](mapper, records, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n }\n });\n\n module.exports = Adapter;\n\n}));\n//# sourceMappingURL=js-data-adapter.js.map\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/js-data-adapter/dist/js-data-adapter.js\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = require('./lib/axios');\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/index.js\n ** module id = 3\n ** module chunks = 0\n **/","'use strict';\n\nvar defaults = require('./defaults');\nvar utils = require('./utils');\nvar dispatchRequest = require('./core/dispatchRequest');\nvar InterceptorManager = require('./core/InterceptorManager');\nvar isAbsoluteURL = require('./helpers/isAbsoluteURL');\nvar combineURLs = require('./helpers/combineURLs');\nvar bind = require('./helpers/bind');\nvar transformData = require('./helpers/transformData');\n\nfunction Axios(defaultConfig) {\n this.defaults = utils.merge({}, defaultConfig);\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = utils.merge({\n url: arguments[0]\n }, arguments[1]);\n }\n\n config = utils.merge(defaults, this.defaults, { method: 'get' }, config);\n\n // Support baseURL config\n if (config.baseURL && !isAbsoluteURL(config.url)) {\n config.url = combineURLs(config.baseURL, config.url);\n }\n\n // Don't allow overriding defaults.withCredentials\n config.withCredentials = config.withCredentials || this.defaults.withCredentials;\n\n // Transform request data\n config.data = transformData(\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers || {}\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n // Hook up interceptors middleware\n var chain = [dispatchRequest, undefined];\n var promise = Promise.resolve(config);\n\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n chain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n chain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n};\n\nvar defaultInstance = new Axios(defaults);\nvar axios = module.exports = bind(Axios.prototype.request, defaultInstance);\n\naxios.create = function create(defaultConfig) {\n return new Axios(defaultConfig);\n};\n\n// Expose defaults\naxios.defaults = defaultInstance.defaults;\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose interceptors\naxios.interceptors = defaultInstance.interceptors;\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url\n }));\n };\n axios[method] = bind(Axios.prototype[method], defaultInstance);\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(utils.merge(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n axios[method] = bind(Axios.prototype[method], defaultInstance);\n});\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/axios.js\n ** module id = 4\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./utils');\n\nvar PROTECTION_PREFIX = /^\\)\\]\\}',?\\n/;\nvar DEFAULT_CONTENT_TYPE = {\n 'Content-Type': 'application/x-www-form-urlencoded'\n};\n\nmodule.exports = {\n transformRequest: [function transformResponseJSON(data, headers) {\n if (utils.isFormData(data)) {\n return data;\n }\n if (utils.isArrayBuffer(data)) {\n return data;\n }\n if (utils.isArrayBufferView(data)) {\n return data.buffer;\n }\n if (utils.isObject(data) && !utils.isFile(data) && !utils.isBlob(data)) {\n // Set application/json if no Content-Type has been specified\n if (!utils.isUndefined(headers)) {\n utils.forEach(headers, function processContentTypeHeader(val, key) {\n if (key.toLowerCase() === 'content-type') {\n headers['Content-Type'] = val;\n }\n });\n\n if (utils.isUndefined(headers['Content-Type'])) {\n headers['Content-Type'] = 'application/json;charset=utf-8';\n }\n }\n return JSON.stringify(data);\n }\n return data;\n }],\n\n transformResponse: [function transformResponseJSON(data) {\n /*eslint no-param-reassign:0*/\n if (typeof data === 'string') {\n data = data.replace(PROTECTION_PREFIX, '');\n try {\n data = JSON.parse(data);\n } catch (e) { /* Ignore */ }\n }\n return data;\n }],\n\n headers: {\n common: {\n 'Accept': 'application/json, text/plain, */*'\n },\n patch: utils.merge(DEFAULT_CONTENT_TYPE),\n post: utils.merge(DEFAULT_CONTENT_TYPE),\n put: utils.merge(DEFAULT_CONTENT_TYPE)\n },\n\n timeout: 0,\n\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN'\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/defaults.js\n ** module id = 5\n ** module chunks = 0\n **/","'use strict';\n\n/*global toString:true*/\n\n// utils is a library of generic helper functions non-specific to axios\n\nvar toString = Object.prototype.toString;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Array, otherwise false\n */\nfunction isArray(val) {\n return toString.call(val) === '[object Array]';\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nfunction isArrayBuffer(val) {\n return toString.call(val) === '[object ArrayBuffer]';\n}\n\n/**\n * Determine if a value is a FormData\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nfunction isFormData(val) {\n return toString.call(val) === '[object FormData]';\n}\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n var result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a String, otherwise false\n */\nfunction isString(val) {\n return typeof val === 'string';\n}\n\n/**\n * Determine if a value is a Number\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Number, otherwise false\n */\nfunction isNumber(val) {\n return typeof val === 'number';\n}\n\n/**\n * Determine if a value is undefined\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nfunction isUndefined(val) {\n return typeof val === 'undefined';\n}\n\n/**\n * Determine if a value is an Object\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is an Object, otherwise false\n */\nfunction isObject(val) {\n return val !== null && typeof val === 'object';\n}\n\n/**\n * Determine if a value is a Date\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Date, otherwise false\n */\nfunction isDate(val) {\n return toString.call(val) === '[object Date]';\n}\n\n/**\n * Determine if a value is a File\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a File, otherwise false\n */\nfunction isFile(val) {\n return toString.call(val) === '[object File]';\n}\n\n/**\n * Determine if a value is a Blob\n *\n * @param {Object} val The value to test\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nfunction isBlob(val) {\n return toString.call(val) === '[object Blob]';\n}\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n * @returns {String} The String freed of excess whitespace\n */\nfunction trim(str) {\n return str.replace(/^\\s*/, '').replace(/\\s*$/, '');\n}\n\n/**\n * Determine if we're running in a standard browser environment\n *\n * This allows axios to run in a web worker, and react-native.\n * Both environments support XMLHttpRequest, but not fully standard globals.\n *\n * web workers:\n * typeof window -> undefined\n * typeof document -> undefined\n *\n * react-native:\n * typeof document.createElement -> undefined\n */\nfunction isStandardBrowserEnv() {\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined' &&\n typeof document.createElement === 'function'\n );\n}\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n */\nfunction forEach(obj, fn) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object' && !isArray(obj)) {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (var i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Iterate over object keys\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n fn.call(null, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n var result = {};\n function assignValue(val, key) {\n if (typeof result[key] === 'object' && typeof val === 'object') {\n result[key] = merge(result[key], val);\n } else {\n result[key] = val;\n }\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n forEach(arguments[i], assignValue);\n }\n return result;\n}\n\nmodule.exports = {\n isArray: isArray,\n isArrayBuffer: isArrayBuffer,\n isFormData: isFormData,\n isArrayBufferView: isArrayBufferView,\n isString: isString,\n isNumber: isNumber,\n isObject: isObject,\n isUndefined: isUndefined,\n isDate: isDate,\n isFile: isFile,\n isBlob: isBlob,\n isStandardBrowserEnv: isStandardBrowserEnv,\n forEach: forEach,\n merge: merge,\n trim: trim\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/utils.js\n ** module id = 6\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Dispatch a request to the server using whichever adapter\n * is supported by the current environment.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n return new Promise(function executor(resolve, reject) {\n try {\n var adapter;\n\n if (typeof config.adapter === 'function') {\n // For custom adapter support\n adapter = config.adapter;\n } else if (typeof XMLHttpRequest !== 'undefined') {\n // For browsers use XHR adapter\n adapter = require('../adapters/xhr');\n } else if (typeof process !== 'undefined') {\n // For node use HTTP adapter\n adapter = require('../adapters/http');\n }\n\n if (typeof adapter === 'function') {\n adapter(resolve, reject, config);\n }\n } catch (e) {\n reject(e);\n }\n });\n};\n\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/dispatchRequest.js\n ** module id = 7\n ** module chunks = 0\n **/","// shim for using process in browser\n\nvar process = module.exports = {};\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = setTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n clearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n setTimeout(drainQueue, 0);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/process/browser.js\n ** module id = 8\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('./../helpers/buildURL');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar transformData = require('./../helpers/transformData');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar btoa = window.btoa || require('./../helpers/btoa');\n\nmodule.exports = function xhrAdapter(resolve, reject, config) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // For IE 8/9 CORS support\n // Only supports POST and GET calls and doesn't returns the response headers.\n if (window.XDomainRequest && !('withCredentials' in request) && !isURLSameOrigin(config.url)) {\n request = new window.XDomainRequest();\n }\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password || '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n // Listen for ready state\n request.onload = function handleLoad() {\n if (!request) {\n return;\n }\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = ['text', ''].indexOf(config.responseType || '') !== -1 ? request.responseText : request.response;\n var response = {\n data: transformData(\n responseData,\n responseHeaders,\n config.transformResponse\n ),\n // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)\n status: request.status === 1223 ? 204 : request.status,\n statusText: request.status === 1223 ? 'No Content' : request.statusText,\n headers: responseHeaders,\n config: config\n };\n\n // Resolve or reject the Promise based on the status\n ((response.status >= 200 && response.status < 300) ||\n (!('status' in request) && response.responseText) ?\n resolve :\n reject)(response);\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(new Error('Network Error'));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n var cookies = require('./../helpers/cookies');\n\n // Add xsrf header\n var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (config.withCredentials) {\n request.withCredentials = true;\n }\n\n // Add responseType to request if needed\n if (config.responseType) {\n try {\n request.responseType = config.responseType;\n } catch (e) {\n if (request.responseType !== 'json') {\n throw e;\n }\n }\n }\n\n if (utils.isArrayBuffer(requestData)) {\n requestData = new DataView(requestData);\n }\n\n // Send the request\n request.send(requestData);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/adapters/xhr.js\n ** module id = 9\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%40/gi, '@').\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n }\n\n if (!utils.isArray(val)) {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/buildURL.js\n ** module id = 10\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n });\n\n return parsed;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/parseHeaders.js\n ** module id = 11\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn(data, headers);\n });\n\n return data;\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/transformData.js\n ** module id = 12\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/isURLSameOrigin.js\n ** module id = 13\n ** module chunks = 0\n **/","'use strict';\n\n// btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js\n\nvar chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nfunction InvalidCharacterError(message) {\n this.message = message;\n}\nInvalidCharacterError.prototype = new Error;\nInvalidCharacterError.prototype.code = 5;\nInvalidCharacterError.prototype.name = 'InvalidCharacterError';\n\nfunction btoa(input) {\n var str = String(input);\n var output = '';\n for (\n // initialize result and counter\n var block, charCode, idx = 0, map = chars;\n // if the next str index does not exist:\n // change the mapping table to \"=\"\n // check if d has no fractional digits\n str.charAt(idx | 0) || (map = '=', idx % 1);\n // \"8 - idx % 1 * 8\" generates the sequence 2, 4, 6, 8\n output += map.charAt(63 & block >> 8 - idx % 1 * 8)\n ) {\n charCode = str.charCodeAt(idx += 3 / 4);\n if (charCode > 0xFF) {\n throw new InvalidCharacterError('INVALID_CHARACTER_ERR: DOM Exception 5');\n }\n block = block << 8 | charCode;\n }\n return output;\n}\n\nmodule.exports = btoa;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/btoa.js\n ** module id = 14\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/cookies.js\n ** module id = 15\n ** module chunks = 0\n **/","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/core/InterceptorManager.js\n ** module id = 16\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/isAbsoluteURL.js\n ** module id = 17\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '');\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/combineURLs.js\n ** module id = 18\n ** module chunks = 0\n **/","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/bind.js\n ** module id = 19\n ** module chunks = 0\n **/","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/axios/lib/helpers/spread.js\n ** module id = 20\n ** module chunks = 0\n **/"],"sourceRoot":""}
\ No newline at end of file
diff --git a/dist/js-data-http.min.js b/dist/js-data-http.min.js
deleted file mode 100644
index da1a509..0000000
--- a/dist/js-data-http.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*!
-* js-data-http
-* @version 3.0.0-beta.2 - Homepage
-* @copyright (c) 2014-2016 js-data-http project authors
-* @license MIT
-*
-* @overview HTTP (XHR) adapter for js-data in the browser.
-*/
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("js-data")):"function"==typeof define&&define.amd?define(["js-data"],t):"object"==typeof exports?exports.HttpAdapter=t(require("js-data")):e.HttpAdapter=t(e.JSData)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return null!=e&&""!==e}function o(e,t){return t||(t=""),e.filter(i).join(t)}function u(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=o(t,"/");return r.replace(/([^:\/]|^)\/{2,}/g,"$1/")}function a(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function s(e,t){if(!t)return e;var n=[];return c.utils.forOwn(t,function(e,t){null!==e&&"undefined"!=typeof e&&(c.utils.isArray(e)||(e=[e]),e.forEach(function(e){"[object Date]"===window.toString.call(e)?e=e.toISOString():c.utils.isObject(e)&&(e=c.utils.toJson(e)),n.push(a(t)+"="+a(e))}))}),n.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+n.join("&")),e}function f(e){var t=this;e||(e={}),c.utils.fillIn(e,b),p.default.call(t,e)}var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},c=n(1),d=n(2),p=r(d),h=n(3),y=!1;try{y=window&&window.fetch}catch(e){}var v=function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var i=n[n.length-1];return e.dbg.apply(e,[i.op].concat(n)),c.utils.resolve()},m=function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var i=n[n.length-2];return e.dbg.apply(e,[i.op].concat(n)),c.utils.resolve()},g=p.default.prototype,b={basePath:"",forceTrailingSlash:!1,http:h,httpConfig:{},suffix:"",useFetch:!1};f.prototype=Object.create(p.default.prototype,{constructor:{value:f,enumerable:!1,writable:!0,configurable:!0}}),Object.defineProperty(f,"__super__",{configurable:!0,value:p.default}),c.utils.addHiddenPropsToTarget(f.prototype,{afterDEL:m,afterGET:m,afterHTTP:m,afterPOST:m,afterPUT:m,beforeDEL:v,beforeGET:v,beforeHTTP:v,beforePOST:v,beforePUT:v,_count:function(e,t,n){var r=this;return r.GET(r.getPath("count",e,n.params,n),n).then(function(t){return r._end(e,n,t)})},_create:function(e,t,n){var r=this;return r.POST(r.getPath("create",e,t,n),r.serialize(e,t,n),n).then(function(t){return r._end(e,n,t)})},_createMany:function(e,t,n){var r=this;return r.POST(r.getPath("createMany",e,null,n),r.serialize(e,t,n),n).then(function(t){return r._end(e,n,t)})},_destroy:function(e,t,n){var r=this;return r.DEL(r.getPath("destroy",e,t,n),n).then(function(t){return r._end(e,n,t)})},_destroyAll:function(e,t,n){var r=this;return r.DEL(r.getPath("destroyAll",e,null,n),n).then(function(t){return r._end(e,n,t)})},_end:function(e,t,n){return[this.deserialize(e,n,t),n]},_find:function(e,t,n){var r=this;return r.GET(r.getPath("find",e,t,n),n).then(function(t){return r._end(e,n,t)})},_findAll:function(e,t,n){var r=this;return r.GET(r.getPath("findAll",e,n.params,n),n).then(function(t){return r._end(e,n,t)})},_sum:function(e,t,n,r){var i=this;return i.GET(i.getPath("sum",e,r.params,r),r).then(function(t){return i._end(e,r,t)})},_update:function(e,t,n,r){var i=this;return i.PUT(i.getPath("update",e,t,r),i.serialize(e,n,r),r).then(function(t){return i._end(e,r,t)})},_updateAll:function(e,t,n,r){var i=this;return i.PUT(i.getPath("updateAll",e,null,r),i.serialize(e,t,r),r).then(function(t){return i._end(e,r,t)})},_updateMany:function(e,t,n){var r=this;return r.PUT(r.getPath("updateMany",e,null,n),r.serialize(e,t,n),n).then(function(t){return r._end(e,n,t)})},count:function(e,t,n){var r=this;return t||(t={}),n||(n={}),n.params=r.getParams(n),n.params.count=!0,n.suffix=r.getSuffix(e,n),c.utils.deepMixIn(n.params,t),n.params=r.queryTransform(e,n.params,n),g.count.call(r,e,t,n)},create:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),g.create.call(r,e,t,n)},createMany:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),g.createMany.call(r,e,t,n)},DEL:function(e,t,n){var r=this,i=void 0;return t||(t={}),n||(n={}),t.url=e||t.url,t.method=t.method||"delete",i=n.op="beforeDEL",c.utils.resolve(r[i](e,t,n)).then(function(o){return t=c.utils.isUndefined(o)?t:o,i=n.op="DEL",r.dbg(i,e,t,n),r.HTTP(t,n)}).then(function(o){return i=n.op="afterDEL",c.utils.resolve(r[i](e,t,n,o)).then(function(e){return c.utils.isUndefined(e)?o:e})})},deserialize:function(e,t,n){return n||(n={}),c.utils.isFunction(n.deserialize)?n.deserialize(e,t,n):c.utils.isFunction(e.deserialize)?e.deserialize(e,t,n):t&&t.hasOwnProperty("data")?t.data:t},destroy:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),g.destroy.call(r,e,t,n)},destroyAll:function(e,t,n){var r=this;return t||(t={}),n||(n={}),n.params=r.getParams(n),c.utils.deepMixIn(n.params,t),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),g.destroyAll.call(r,e,t,n)},error:function(){if(console){var e;(e=console)["function"==typeof console.error?"error":"log"].apply(e,arguments)}},fetch:function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n={method:e.method,headers:new Headers(e.headers)};return e.data&&(n.body=c.utils.toJson(e.data)),fetch(new Request(s(e.url,e.params),n)).then(function(t){return t.config={method:e.method,url:e.url},t.json().then(function(e){return t.data=e,t})})}),find:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),g.find.call(r,e,t,n)},findAll:function(e,t,n){var r=this;return t||(t={}),n||(n={}),n.params=r.getParams(n),n.suffix=r.getSuffix(e,n),c.utils.deepMixIn(n.params,t),n.params=r.queryTransform(e,n.params,n),g.findAll.call(r,e,t,n)},GET:function(e,t,n){var r=this,i=void 0;return t||(t={}),n||(n={}),t.url=e||t.url,t.method=t.method||"get",i=n.op="beforeGET",c.utils.resolve(r[i](e,t,n)).then(function(o){return t=c.utils.isUndefined(o)?t:o,i=n.op="GET",r.dbg(i,e,t,n),r.HTTP(t,n)}).then(function(o){return i=n.op="afterGET",c.utils.resolve(r[i](e,t,n,o)).then(function(e){return c.utils.isUndefined(e)?o:e})})},getEndpoint:function(e,t,n){var r=this;n||(n={}),n.params=c.utils.isUndefined(n.params)?{}:n.params;var i=e.relationList||[],o=c.utils.isUndefined(n.endpoint)?c.utils.isUndefined(e.endpoint)?e.name:e.endpoint:n.endpoint;return i.forEach(function(e){if("belongsTo"===e.type&&e.parent){var i=void 0,a=e.foreignKey,s=e.getRelation(),f=n.params[a];if(f===!1||!a||!s)return f===!1&&delete n.params[a],!1;if(delete n.params[a],c.utils.isObject(t)&&(i=t),i&&(f=f||e.getForeignKey(i)||(e.getLocalField(i)?c.utils.get(e.getLocalField(i),s.idAttribute):null)),f){var d=function(){delete n.endpoint;var e={};return c.utils.forOwn(n,function(t,n){e[n]=t}),c.utils._(e,s),o=u(r.getEndpoint(s,f,e),f,o),{v:!1}}();if("object"===("undefined"==typeof d?"undefined":l(d)))return d.v}}}),o},getPath:function(e,t,n,r){var i=this;r||(r={});var o=[c.utils.isUndefined(r.basePath)?c.utils.isUndefined(t.basePath)?i.basePath:t.basePath:r.basePath,i.getEndpoint(t,c.utils.isString(n)||c.utils.isNumber(n)||"create"===e?n:null,r)];return"find"!==e&&"update"!==e&&"destroy"!==e||o.push(n),u.apply(c.utils,o)},getParams:function(e){return e||(e={}),c.utils.isUndefined(e.params)?{}:c.utils.copy(e.params)},getSuffix:function(e,t){return t||(t={}),c.utils.isUndefined(t.suffix)?c.utils.isUndefined(e.suffix)?this.suffix:e.suffix:t.suffix},HTTP:function(e,t){function n(t){var n=i.toUTCString()+" - "+e.method.toUpperCase()+" "+e.url+" - "+t.status+" "+((new Date).getTime()-i.getTime())+"ms";return t.status>=200&&t.status<300?(r.log&&r.dbg("debug",n,t),t):(r.error&&r.error("'FAILED: "+n,t),c.utils.reject(t))}var r=this,i=new Date;t||(t={});var o=e.data,u=e.cache,a=e.timeout;e=c.utils.copy(e,null,null,null,["data","cache","timeout"]),e=c.utils.deepMixIn(e,r.httpConfig),e.data=o,e.cache=u,e.timeout=a,r.forceTrailingSlash&&"/"!==e.url[e.url.length-1]&&(e.url+="/"),e.method=e.method.toUpperCase();var s=e.suffix||t.suffix||r.suffix;if(s&&e.url.substr(e.url.length-s.length)!==s&&(e.url+=s),!r.http)throw new Error("You have not configured this adapter with an http library!");return c.utils.resolve(r.beforeHTTP(e,t)).then(function(i){return e=i||e,y&&(r.useFetch||t.useFetch||!r.http)?r.fetch(e,t).then(n,n):r.http(e).then(n,n).catch(function(n){return r.responseError(n,e,t)})}).then(function(n){return c.utils.resolve(r.afterHTTP(e,t,n)).then(function(e){return e||n})})},POST:function(e,t,n,r){var i=this,o=void 0;return n||(n={}),r||(r={}),n.url=e||n.url,n.data=t||n.data,n.method=n.method||"post",o=r.op="beforePOST",c.utils.resolve(i[o](e,t,n,r)).then(function(u){return n=c.utils.isUndefined(u)?n:u,o=r.op="POST",i.dbg(o,e,t,n,r),i.HTTP(n,r)}).then(function(u){return o=r.op="afterPOST",c.utils.resolve(i[o](e,t,n,r,u)).then(function(e){return c.utils.isUndefined(e)?u:e})})},PUT:function(e,t,n,r){var i=this,o=void 0;return n||(n={}),r||(r={}),n.url=e||n.url,n.data=t||n.data,n.method=n.method||"put",o=r.op="beforePUT",c.utils.resolve(i[o](e,t,n,r)).then(function(u){return n=c.utils.isUndefined(u)?n:u,o=r.op="PUT",i.dbg(o,e,t,n,r),i.HTTP(n,r)}).then(function(u){return o=r.op="afterPUT",c.utils.resolve(i[o](e,t,n,r,u)).then(function(e){return c.utils.isUndefined(e)?u:e})})},queryTransform:function(e,t,n){return n||(n={}),c.utils.isFunction(n.queryTransform)?n.queryTransform(e,t,n):c.utils.isFunction(e.queryTransform)?e.queryTransform(e,t,n):t},responseError:function(e,t,n){return c.utils.reject(e)},serialize:function(e,t,n){return n||(n={}),c.utils.isFunction(n.serialize)?n.serialize(e,t,n):c.utils.isFunction(e.serialize)?e.serialize(e,t,n):t},sum:function(e,t,n,r){var i=this;if(n||(n={}),r||(r={}),!c.utils.utils.isString(t))throw new Error("field must be a string!");return r.params=i.getParams(r),r.params.sum=t,r.suffix=i.getSuffix(e,r),c.utils.deepMixIn(r.params,n),r.params=i.queryTransform(e,r.params,r),g.sum.call(i,e,t,n,r)},update:function(e,t,n,r){var i=this;return r||(r={}),r.params=i.getParams(r),r.params=i.queryTransform(e,r.params,r),r.suffix=i.getSuffix(e,r),g.update.call(i,e,t,n,r)},updateAll:function(e,t,n,r){var i=this;return n||(n={}),r||(r={}),r.params=i.getParams(r),c.utils.deepMixIn(r.params,n),r.params=i.queryTransform(e,r.params,r),r.suffix=i.getSuffix(e,r),g.updateAll.call(i,e,t,n,r)},updateMany:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),g.updateMany.call(r,e,t,n)}}),f.addAction=function(e,t){if(!e||!c.utils.isString(e))throw new TypeError("action(name[, opts]): Expected: string, Found: "+("undefined"==typeof e?"undefined":l(e)));return function(n){if(n[e])throw new Error("action(name[, opts]): "+e+" already exists on target!");return t.request=t.request||function(e){return e},t.response=t.response||function(e){return e},t.responseError=t.responseError||function(e){return c.utils.reject(e)},n[e]=function(n,r){var i=this;c.utils.isObject(n)&&(r=n),r=r||{};var o=i.getAdapter(t.adapter||i.defaultAdapter||"http"),a={};if(c.utils.fillIn(a,t),!r.hasOwnProperty("endpoint")&&a.endpoint&&(r.endpoint=a.endpoint),"function"==typeof r.getEndpoint)a.url=r.getEndpoint(i,r);else{var s=[r.basePath||i.basePath||o.basePath,o.getEndpoint(i,c.utils.isSorN(n)?n:null,r)];c.utils.isSorN(n)&&s.push(n),s.push(t.pathname||e),a.url=u.apply(null,s)}return a.method=a.method||"GET",a.mapper=i.name,c.utils.deepMixIn(a)(r),c.utils.resolve(a).then(r.request||t.request).then(function(e){return o.HTTP(e)}).then(function(e){return e&&e.config&&(e.config.mapper=i.name),e}).then(r.response||t.response,r.responseError||t.responseError)},n}},f.addActions=function(e){return e||(e={}),function(e){return c.utils.forOwn(e,function(t,n){f.addAction(n,t)(e)}),e}},f.extend=c.utils.extend,f.version={beta:2,full:"3.0.0-beta.2",major:3,minor:0,patch:0},e.exports=f},function(t,n){t.exports=e},function(e,t,n){!function(e,t){t(n(1))}(this,function(t){"use strict";function n(e){var n=this;e||(e={}),t.utils.fillIn(e,f),t.utils.fillIn(n,e)}function r(e,n,r){var i=this;n||(n={}),i.data=e,t.utils.fillIn(i,n),i.op=r}var i={};i.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},i.slicedToArray=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var o=function(){for(var e=this,n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];var o=r[r.length-1];return e.dbg.apply(e,[o.op].concat(r)),t.utils.resolve()},u=function(){for(var e=this,n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];var o=r[r.length-2];return e.dbg.apply(e,[o.op].concat(r)),t.utils.resolve()},a=function(e){var t={},n=[];return e.forEach(function(e){e in t||(n.push(e),t[e]=0)}),n},s=function(e,n){return t.utils.omit(n,e.relationFields||[])},f={debug:!1,raw:!1};n.reserved=["orderBy","sort","limit","offset","skip","where"],n.Response=r,n.extend=t.utils.extend,t.utils.addHiddenPropsToTarget(n.prototype,{afterCount:u,afterCreate:u,afterCreateMany:u,afterDestroy:u,afterDestroyAll:u,afterFind:u,afterFindAll:u,afterSum:u,afterUpdate:u,afterUpdateAll:u,afterUpdateMany:u,beforeCount:o,beforeCreate:o,beforeCreateMany:o,beforeDestroy:o,beforeDestroyAll:o,beforeFind:o,beforeFindAll:o,beforeSum:o,beforeUpdate:o,beforeUpdateAll:o,beforeUpdateMany:o,dbg:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];this.log.apply(this,["debug"].concat(t))},count:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeCount",t.utils.resolve(u[a](e,n,o)).then(function(){return a=o.op="count",u.dbg(a,e,n,o),t.utils.resolve(u._count(e,n,o))}).then(function(s){var f=i.slicedToArray(s,2),l=f[0],c=f[1];c||(c={});var d=new r(l,c,a);return d=u.respond(d,o),a=o.op="afterCount",t.utils.resolve(u[a](e,n,o,d)).then(function(e){return t.utils.isUndefined(e)?d:e})})},create:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeCreate",t.utils.resolve(u[a](e,n,o)).then(function(r){return n=t.utils.isUndefined(r)?n:r,n=s(e,n),a=o.op="create",u.dbg(a,e,n,o),t.utils.resolve(u._create(e,n,o))}).then(function(s){var f=i.slicedToArray(s,2),l=f[0],c=f[1];c||(c={});var d=new r(l,c,"create");return d.created=l?1:0,d=u.respond(d,o),a=o.op="afterCreate",t.utils.resolve(u[a](e,n,o,d)).then(function(e){return t.utils.isUndefined(e)?d:e})})},createMany:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeCreateMany",t.utils.resolve(u[a](e,n,o)).then(function(r){return n=t.utils.isUndefined(r)?n:r,n=n.map(function(t){return s(e,t)}),a=o.op="createMany",u.dbg(a,e,n,o),t.utils.resolve(u._createMany(e,n,o))}).then(function(s){var f=i.slicedToArray(s,2),l=f[0],c=f[1];l||(l=[]),c||(c={});var d=new r(l,c,"createMany");return d.created=l.length,d=u.respond(d,o),a=o.op="afterCreateMany",t.utils.resolve(u[a](e,n,o,d)).then(function(e){return t.utils.isUndefined(e)?d:e})})},destroy:function(e,n,o){var u=this,a=void 0;return o||(o={}),a=o.op="beforeDestroy",t.utils.resolve(u[a](e,n,o)).then(function(){return a=o.op="destroy",u.dbg(a,e,n,o),t.utils.resolve(u._destroy(e,n,o))}).then(function(s){var f=i.slicedToArray(s,2),l=f[0],c=f[1];c||(c={});var d=new r(l,c,"destroy");return d=u.respond(d,o),a=o.op="afterDestroy",t.utils.resolve(u[a](e,n,o,d)).then(function(e){return t.utils.isUndefined(e)?d:e})})},destroyAll:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeDestroyAll",t.utils.resolve(u[a](e,n,o)).then(function(){return a=o.op="destroyAll",u.dbg(a,e,n,o),t.utils.resolve(u._destroyAll(e,n,o))}).then(function(s){var f=i.slicedToArray(s,2),l=f[0],c=f[1];c||(c={});var d=new r(l,c,"destroyAll");return d=u.respond(d,o),a=o.op="afterDestroyAll",t.utils.resolve(u[a](e,n,o,d)).then(function(e){return t.utils.isUndefined(e)?d:e})})},makeHasManyForeignKey:function(e,t,n){return t.getForeignKey(n)},makeHasManyLocalKeys:function(e,n,r){var i=[],o=t.utils.get(r,n.localKeys)||[];return o=t.utils.isArray(o)?o:Object.keys(o),i=i.concat(o),a(i).filter(function(e){return e})},makeHasManyForeignKeys:function(e,n,r){return t.utils.get(r,e.idAttribute)},loadHasMany:function(e,n,r,i){var o=this,u=!1;t.utils.isObject(r)&&!t.utils.isArray(r)&&(u=!0,r=[r]);var a=r.map(function(t){return o.makeHasManyForeignKey(e,n,t)}),s={where:{}},f=s.where[n.foreignKey]={};return u?f["=="]=a[0]:f.in=a.filter(function(e){return e}),o.findAll(n.getRelation(),s,i).then(function(i){r.forEach(function(r){var o=[];u?o=i:i.forEach(function(i){t.utils.get(i,n.foreignKey)===r[e.idAttribute]&&o.push(i)}),n.setLocalField(r,o)})})},loadHasManyLocalKeys:function(e,n,r,o){var u=this,s=void 0,f=n.getRelation();if(t.utils.isObject(r)&&!t.utils.isArray(r)&&(s=r),s)return u.findAll(f,{where:i.defineProperty({},f.idAttribute,{in:u.makeHasManyLocalKeys(e,n,s)})},o).then(function(e){n.setLocalField(s,e)});var l=function(){var s=[];return r.forEach(function(t){s=s.concat(u.self.makeHasManyLocalKeys(e,n,t))}),{v:u.findAll(f,{where:i.defineProperty({},f.idAttribute,{in:a(s).filter(function(e){return e})})},o).then(function(e){return r.forEach(function(r){var i=[],o=t.utils.get(r,n.localKeys)||[];o=t.utils.isArray(o)?o:Object.keys(o),e.forEach(function(e){o&&-1!==o.indexOf(e[f.idAttribute])&&i.push(e)}),n.setLocalField(r,i)}),e})}}();return"object"===("undefined"==typeof l?"undefined":i.typeof(l))?l.v:void 0},loadHasManyForeignKeys:function(e,n,r,o){var u=this,a=n.getRelation(),s=e.idAttribute,f=void 0;return t.utils.isObject(r)&&!t.utils.isArray(r)&&(f=r),f?u.findAll(n.getRelation(),{where:i.defineProperty({},n.foreignKeys,{contains:u.makeHasManyForeignKeys(e,n,f)})},o).then(function(e){n.setLocalField(f,e)}):u.findAll(a,{where:i.defineProperty({},n.foreignKeys,{isectNotEmpty:r.map(function(t){return u.makeHasManyForeignKeys(e,n,t)})})},o).then(function(e){var i=n.foreignKeys;r.forEach(function(r){var o=[],u=t.utils.get(r,s);e.forEach(function(n){var r=t.utils.get(e,i)||[];-1!==r.indexOf(u)&&o.push(n)}),n.setLocalField(r,o)})})},loadHasOne:function(e,n,r,i){return t.utils.isObject(r)&&!t.utils.isArray(r)&&(r=[r]),this.loadHasMany(e,n,r,i).then(function(){r.forEach(function(e){var r=n.getLocalField(e);t.utils.isArray(r)&&r.length&&n.setLocalField(e,r[0])})})},makeBelongsToForeignKey:function(e,t,n){return t.getForeignKey(n)},loadBelongsTo:function(e,n,r,o){var u=this,a=n.getRelation();if(!t.utils.isObject(r)||t.utils.isArray(r)){var s=r.map(function(t){return u.makeBelongsToForeignKey(e,n,t)}).filter(function(e){return e});return u.findAll(a,{where:i.defineProperty({},a.idAttribute,{in:s})},o).then(function(e){r.forEach(function(t){e.forEach(function(e){e[a.idAttribute]===t[n.foreignKey]&&n.setLocalField(t,e)})})})}var f=function(){var t=r;return{v:u.find(a,u.makeBelongsToForeignKey(e,n,t),o).then(function(e){n.setLocalField(t,e)})}}();return"object"===("undefined"==typeof f?"undefined":i.typeof(f))?f.v:void 0},find:function(e,n,o){var u=this,a=void 0,s=void 0;return o||(o={}),o.with||(o.with=[]),s=o.op="beforeFind",t.utils.resolve(u[s](e,n,o)).then(function(){return s=o.op="find",u.dbg(s,e,n,o),t.utils.resolve(u._find(e,n,o))}).then(function(n){var r=i.slicedToArray(n,1),s=r[0];if(s){a=s;var f=[];return t.utils.forEachRelation(e,o,function(t,n){var r=void 0;!t.foreignKey||"hasOne"!==t.type&&"hasMany"!==t.type?"hasMany"===t.type&&t.localKeys?r=u.loadHasManyLocalKeys(e,t,a,n):"hasMany"===t.type&&t.foreignKeys?r=u.loadHasManyForeignKeys(e,t,a,n):"belongsTo"===t.type&&(r=u.loadBelongsTo(e,t,a,n)):r="hasOne"===t.type?u.loadHasOne(e,t,a,n):u.loadHasMany(e,t,a,n),r&&f.push(r)}),Promise.all(f)}}).then(function(){var i=new r(a,{},"find");return i.found=a?1:0,i=u.respond(i,o),s=o.op="afterFind",t.utils.resolve(u[s](e,n,o,i)).then(function(e){return t.utils.isUndefined(e)?i:e})})},findAll:function(e,n,o){var u=this;o||(o={}),o.with||(o.with=[]);var a=[],s=void 0,f=o._activeWith;if(t.utils.isObject(f)){var l=f.query||{};f.replace?n=l:t.utils.deepFillIn(n,l)}return s=o.op="beforeFindAll",t.utils.resolve(u[s](e,n,o)).then(function(){return s=o.op="findAll",u.dbg(s,e,n,o),t.utils.resolve(u._findAll(e,n,o))}).then(function(n){var r=i.slicedToArray(n,1),s=r[0];s||(s=[]),a=s;var f=[];return t.utils.forEachRelation(e,o,function(t,n){var r=void 0;!t.foreignKey||"hasOne"!==t.type&&"hasMany"!==t.type?"hasMany"===t.type&&t.localKeys?r=u.loadHasManyLocalKeys(e,t,a,n):"hasMany"===t.type&&t.foreignKeys?r=u.loadHasManyForeignKeys(e,t,a,n):"belongsTo"===t.type&&(r=u.loadBelongsTo(e,t,a,n)):r="hasMany"===t.type?u.loadHasMany(e,t,a,n):u.loadHasOne(e,t,a,n),r&&f.push(r)}),Promise.all(f)}).then(function(){var i=new r(a,{},"findAll");return i.found=a.length,i=u.respond(i,o),s=o.op="afterFindAll",t.utils.resolve(u[s](e,n,o,i)).then(function(e){return t.utils.isUndefined(e)?i:e})})},getOpt:function(e,n){return n||(n={}),t.utils.isUndefined(n[e])?t.utils.plainCopy(this[e]):t.utils.plainCopy(n[e])},log:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];if(e&&!n.length&&(n.push(e),e="debug"),"debug"!==e||this.debug){var i=e.toUpperCase()+": (Adapter)";if(console[e]){var o;(o=console)[e].apply(o,[i].concat(n))}else{var u;(u=console).log.apply(u,[i].concat(n))}}},sum:function(e,n,o,u){var a=this,s=void 0;if(!t.utils.isString(n))throw new Error("field must be a string!");return o||(o={}),u||(u={}),s=u.op="beforeSum",t.utils.resolve(a[s](e,n,o,u)).then(function(){return s=u.op="sum",a.dbg(s,e,n,o,u),t.utils.resolve(a._sum(e,n,o,u))}).then(function(f){var l=i.slicedToArray(f,2),c=l[0],d=l[1];d||(d={});var p=new r(c,d,s);return p=a.respond(p,u),s=u.op="afterSum",t.utils.resolve(a[s](e,n,o,u,p)).then(function(e){return t.utils.isUndefined(e)?p:e})})},respond:function(e,t){return this.getOpt("raw",t)?e:e.data},update:function(e,n,o,u){var a=this;o||(o={}),u||(u={});var s=void 0;return s=u.op="beforeUpdate",t.utils.resolve(a[s](e,n,o,u)).then(function(r){return o=t.utils.isUndefined(r)?o:r,s=u.op="update",a.dbg(s,e,n,o,u),t.utils.resolve(a._update(e,n,o,u))}).then(function(f){var l=i.slicedToArray(f,2),c=l[0],d=l[1];d||(d={});var p=new r(c,d,"update");return p.updated=c?1:0,p=a.respond(p,u),s=u.op="afterUpdate",t.utils.resolve(a[s](e,n,o,u,p)).then(function(e){return t.utils.isUndefined(e)?p:e})})},updateAll:function(e,n,o,u){var a=this;n||(n={}),o||(o={}),u||(u={});var s=void 0;return s=u.op="beforeUpdateAll",t.utils.resolve(a[s](e,n,o,u)).then(function(r){return n=t.utils.isUndefined(r)?n:r,s=u.op="updateAll",a.dbg(s,e,n,o,u),t.utils.resolve(a._updateAll(e,n,o,u))}).then(function(f){var l=i.slicedToArray(f,2),c=l[0],d=l[1];c||(c=[]),d||(d={});var p=new r(c,d,"updateAll");return p.updated=c.length,p=a.respond(p,u),s=u.op="afterUpdateAll",t.utils.resolve(a[s](e,n,o,u,p)).then(function(e){return t.utils.isUndefined(e)?p:e})})},updateMany:function(e,n,o){var u=this;n||(n=[]),o||(o={});var a=void 0,f=e.idAttribute;return n=n.filter(function(e){return t.utils.get(e,f)}),a=o.op="beforeUpdateMany",t.utils.resolve(u[a](e,n,o)).then(function(r){return n=t.utils.isUndefined(r)?n:r,n=n.map(function(t){return s(e,t)}),a=o.op="updateMany",u.dbg(a,e,n,o),t.utils.resolve(u._updateMany(e,n,o))}).then(function(s){var f=i.slicedToArray(s,2),l=f[0],c=f[1];l||(l=[]),c||(c={});var d=new r(l,c,"updateMany");return d.updated=l.length,d=u.respond(d,o),a=o.op="afterUpdateMany",t.utils.resolve(u[a](e,n,o,d)).then(function(e){return t.utils.isUndefined(e)?d:e})})}}),e.exports=n})},function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";function r(e){this.defaults=o.merge({},e),this.interceptors={request:new a,response:new a}}var i=n(5),o=n(6),u=n(7),a=n(16),s=n(17),f=n(18),l=n(19),c=n(12);r.prototype.request=function(e){"string"==typeof e&&(e=o.merge({url:arguments[0]},arguments[1])),e=o.merge(i,this.defaults,{method:"get"},e),e.baseURL&&!s(e.url)&&(e.url=f(e.baseURL,e.url)),e.withCredentials=e.withCredentials||this.defaults.withCredentials,e.data=c(e.data,e.headers,e.transformRequest),e.headers=o.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),o.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]});var t=[u,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n};var d=new r(i),p=e.exports=l(r.prototype.request,d);p.create=function(e){return new r(e)},p.defaults=d.defaults,p.all=function(e){return Promise.all(e)},p.spread=n(20),p.interceptors=d.interceptors,o.forEach(["delete","get","head"],function(e){r.prototype[e]=function(t,n){return this.request(o.merge(n||{},{method:e,url:t}))},p[e]=l(r.prototype[e],d)}),o.forEach(["post","put","patch"],function(e){r.prototype[e]=function(t,n,r){return this.request(o.merge(r||{},{method:e,url:t,data:n}))},p[e]=l(r.prototype[e],d)})},function(e,t,n){"use strict";var r=n(6),i=/^\)\]\}',?\n/,o={"Content-Type":"application/x-www-form-urlencoded"};e.exports={transformRequest:[function(e,t){return r.isFormData(e)?e:r.isArrayBuffer(e)?e:r.isArrayBufferView(e)?e.buffer:!r.isObject(e)||r.isFile(e)||r.isBlob(e)?e:(r.isUndefined(t)||(r.forEach(t,function(e,n){"content-type"===n.toLowerCase()&&(t["Content-Type"]=e)}),r.isUndefined(t["Content-Type"])&&(t["Content-Type"]="application/json;charset=utf-8")),JSON.stringify(e))}],transformResponse:[function(e){if("string"==typeof e){e=e.replace(i,"");try{e=JSON.parse(e)}catch(e){}}return e}],headers:{common:{Accept:"application/json, text/plain, */*"},patch:r.merge(o),post:r.merge(o),put:r.merge(o)},timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"}},function(e,t){"use strict";function n(e){return"[object Array]"===m.call(e)}function r(e){return"[object ArrayBuffer]"===m.call(e)}function i(e){return"[object FormData]"===m.call(e)}function o(e){var t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer}function u(e){return"string"==typeof e}function a(e){return"number"==typeof e}function s(e){return"undefined"==typeof e}function f(e){return null!==e&&"object"==typeof e}function l(e){return"[object Date]"===m.call(e)}function c(e){return"[object File]"===m.call(e)}function d(e){return"[object Blob]"===m.call(e)}function p(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}function h(){return"undefined"!=typeof window&&"undefined"!=typeof document&&"function"==typeof document.createElement}function y(e,t){if(null!==e&&"undefined"!=typeof e)if("object"==typeof e||n(e)||(e=[e]),n(e))for(var r=0,i=e.length;i>r;r++)t.call(null,e[r],r,e);else for(var o in e)e.hasOwnProperty(o)&&t.call(null,e[o],o,e)}function v(){function e(e,n){"object"==typeof t[n]&&"object"==typeof e?t[n]=v(t[n],e):t[n]=e}for(var t={},n=0,r=arguments.length;r>n;n++)y(arguments[n],e);return t}var m=Object.prototype.toString;e.exports={isArray:n,isArrayBuffer:r,isFormData:i,isArrayBufferView:o,isString:u,isNumber:a,isObject:f,isUndefined:s,isDate:l,isFile:c,isBlob:d,isStandardBrowserEnv:h,forEach:y,merge:v,trim:p}},function(e,t,n){(function(t){"use strict";e.exports=function(e){return new Promise(function(r,i){try{var o;"function"==typeof e.adapter?o=e.adapter:"undefined"!=typeof XMLHttpRequest?o=n(9):"undefined"!=typeof t&&(o=n(9)),"function"==typeof o&&o(r,i,e)}catch(e){i(e)}})}}).call(t,n(8))},function(e,t){function n(){f=!1,u.length?s=u.concat(s):l=-1,s.length&&r()}function r(){if(!f){var e=setTimeout(n);f=!0;for(var t=s.length;t;){for(u=s,s=[];++l1)for(var n=1;n=200&&i.status<300||!("status"in d)&&i.responseText?e:t)(i),d=null}},d.onerror=function(){t(new Error("Network Error")),d=null},r.isStandardBrowserEnv()){var y=n(15),v=f.withCredentials||a(f.url)?y.read(f.xsrfCookieName):void 0;v&&(c[f.xsrfHeaderName]=v)}if("setRequestHeader"in d&&r.forEach(c,function(e,t){"undefined"==typeof l&&"content-type"===t.toLowerCase()?delete c[t]:d.setRequestHeader(t,e)}),f.withCredentials&&(d.withCredentials=!0),f.responseType)try{d.responseType=f.responseType}catch(e){if("json"!==d.responseType)throw e}r.isArrayBuffer(l)&&(l=new DataView(l)),d.send(l)}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var i=n(6);e.exports=function(e,t,n){if(!t)return e;var o;if(n)o=n(t);else{var u=[];i.forEach(t,function(e,t){null!==e&&"undefined"!=typeof e&&(i.isArray(e)&&(t+="[]"),i.isArray(e)||(e=[e]),i.forEach(e,function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),u.push(r(t)+"="+r(e))}))}),o=u.join("&")}return o&&(e+=(-1===e.indexOf("?")?"?":"&")+o),e}},function(e,t,n){"use strict";var r=n(6);e.exports=function(e){var t,n,i,o={};return e?(r.forEach(e.split("\n"),function(e){i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t&&(o[t]=o[t]?o[t]+", "+n:n)}),o):o}},function(e,t,n){"use strict";var r=n(6);e.exports=function(e,t,n){return r.forEach(n,function(n){e=n(e,t)}),e}},function(e,t,n){"use strict";var r=n(6);e.exports=r.isStandardBrowserEnv()?function(){function e(e){var t=e;return n&&(i.setAttribute("href",t),t=i.href),i.setAttribute("href",t),
-{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}var t,n=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");return t=e(window.location.href),function(n){var i=r.isString(n)?e(n):n;return i.protocol===t.protocol&&i.host===t.host}}():function(){return function(){return!0}}()},function(e,t){"use strict";function n(e){this.message=e}function r(e){for(var t,r,o=String(e),u="",a=0,s=i;o.charAt(0|a)||(s="=",a%1);u+=s.charAt(63&t>>8-a%1*8)){if(r=o.charCodeAt(a+=.75),r>255)throw new n("INVALID_CHARACTER_ERR: DOM Exception 5");t=t<<8|r}return u}var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.prototype=new Error,n.prototype.code=5,n.prototype.name="InvalidCharacterError",e.exports=r},function(e,t,n){"use strict";var r=n(6);e.exports=r.isStandardBrowserEnv()?function(){return{write:function(e,t,n,i,o,u){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(o)&&a.push("domain="+o),u===!0&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()},function(e,t,n){"use strict";function r(){this.handlers=[]}var i=n(6);r.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},r.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},r.prototype.forEach=function(e){i.forEach(this.handlers,function(t){null!==t&&e(t)})},e.exports=r},function(e,t){"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},function(e,t){"use strict";e.exports=function(e,t){return e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,"")}},function(e,t){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r
-* @copyright (c) 2014-2016 js-data-http project authors
-* @license MIT
-*
-* @overview HTTP adapter for js-data that uses the fetch API.
-*/
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("js-data"), require("undefined"));
- else if(typeof define === 'function' && define.amd)
- define(["js-data", "undefined"], factory);
- else if(typeof exports === 'object')
- exports["HttpAdapter"] = factory(require("js-data"), require("undefined"));
- else
- root["HttpAdapter"] = factory(root["JSData"], root["undefined"]);
-})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- var _jsData = __webpack_require__(1);
-
- var _jsDataAdapter = __webpack_require__(2);
-
- var _jsDataAdapter2 = _interopRequireDefault(_jsDataAdapter);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /* global fetch:true Headers:true Request:true */
- var axios = __webpack_require__(3);
-
-
- var hasFetch = false;
-
- try {
- hasFetch = window && window.fetch;
- } catch (e) {}
-
- var noop = function noop() {
- var self = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var opts = args[args.length - 1];
- self.dbg.apply(self, [opts.op].concat(args));
- return _jsData.utils.resolve();
- };
-
- var noop2 = function noop2() {
- var self = this;
-
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- var opts = args[args.length - 2];
- self.dbg.apply(self, [opts.op].concat(args));
- return _jsData.utils.resolve();
- };
-
- function isValidString(value) {
- return value != null && value !== '';
- }
- function join(items, separator) {
- separator || (separator = '');
- return items.filter(isValidString).join(separator);
- }
- function makePath() {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
-
- var result = join(args, '/');
- return result.replace(/([^:\/]|^)\/{2,}/g, '$1/');
- }
-
- function encode(val) {
- return encodeURIComponent(val).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
- }
-
- function buildUrl(url, params) {
- if (!params) {
- return url;
- }
-
- var parts = [];
-
- _jsData.utils.forOwn(params, function (val, key) {
- if (val === null || typeof val === 'undefined') {
- return;
- }
- if (!_jsData.utils.isArray(val)) {
- val = [val];
- }
-
- val.forEach(function (v) {
- if (window.toString.call(v) === '[object Date]') {
- v = v.toISOString();
- } else if (_jsData.utils.isObject(v)) {
- v = _jsData.utils.toJson(v);
- }
- parts.push(encode(key) + '=' + encode(v));
- });
- });
-
- if (parts.length > 0) {
- url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
- }
-
- return url;
- }
-
- var __super__ = _jsDataAdapter2.default.prototype;
-
- var DEFAULTS = {
- // Default and user-defined settings
- /**
- * @name HttpAdapter#basePath
- * @type {string}
- */
- basePath: '',
-
- /**
- * @name HttpAdapter#forceTrailingSlash
- * @type {boolean}
- * @default false
- */
- forceTrailingSlash: false,
-
- /**
- * @name HttpAdapter#http
- * @type {Function}
- */
- http: axios,
-
- /**
- * @name HttpAdapter#httpConfig
- * @type {Object}
- */
- httpConfig: {},
-
- /**
- * @name HttpAdapter#suffix
- * @type {string}
- */
- suffix: '',
-
- /**
- * @name HttpAdapter#useFetch
- * @type {boolean}
- * @default false
- */
- useFetch: false
- };
-
- /**
- * HttpAdapter class.
- *
- * @class HttpAdapter
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.basePath=''] TODO
- * @param {boolean} [opts.debug=false] TODO
- * @param {boolean} [opts.forceTrailingSlash=false] TODO
- * @param {Object} [opts.http=axios] TODO
- * @param {Object} [opts.httpConfig={}] TODO
- * @param {string} [opts.suffix=''] TODO
- * @param {boolean} [opts.useFetch=false] TODO
- */
- function HttpAdapter(opts) {
- var self = this;
- opts || (opts = {});
- _jsData.utils.fillIn(opts, DEFAULTS);
- _jsDataAdapter2.default.call(self, opts);
- }
-
- // Setup prototype inheritance from Adapter
- HttpAdapter.prototype = Object.create(_jsDataAdapter2.default.prototype, {
- constructor: {
- value: HttpAdapter,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
-
- Object.defineProperty(HttpAdapter, '__super__', {
- configurable: true,
- value: _jsDataAdapter2.default
- });
-
- _jsData.utils.addHiddenPropsToTarget(HttpAdapter.prototype, {
- /**
- * @name HttpAdapter#afterDEL
- * @method
- * @param {string} url
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterDEL: noop2,
-
- /**
- * @name HttpAdapter#afterGET
- * @method
- * @param {string} url
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterGET: noop2,
-
- /**
- * @name HttpAdapter#afterHTTP
- * @method
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterHTTP: noop2,
-
- /**
- * @name HttpAdapter#afterPOST
- * @method
- * @param {string} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterPOST: noop2,
-
- /**
- * @name HttpAdapter#afterPUT
- * @method
- * @param {string} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterPUT: noop2,
-
- /**
- * @name HttpAdapter#beforeDEL
- * @method
- * @param {Object} url
- * @param {Object} config
- * @param {Object} opts
- */
- beforeDEL: noop,
-
- /**
- * @name HttpAdapter#beforeGET
- * @method
- * @param {Object} url
- * @param {Object} config
- * @param {Object} opts
- */
- beforeGET: noop,
-
- /**
- * @name HttpAdapter#beforeHTTP
- * @method
- * @param {Object} config
- * @param {Object} opts
- */
- beforeHTTP: noop,
-
- /**
- * @name HttpAdapter#beforePOST
- * @method
- * @param {Object} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- */
- beforePOST: noop,
-
- /**
- * @name HttpAdapter#beforePUT
- * @method
- * @param {Object} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- */
- beforePUT: noop,
-
- _count: function _count(mapper, query, opts) {
- var self = this;
- return self.GET(self.getPath('count', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _create: function _create(mapper, props, opts) {
- var self = this;
- return self.POST(self.getPath('create', mapper, props, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _createMany: function _createMany(mapper, props, opts) {
- var self = this;
- return self.POST(self.getPath('createMany', mapper, null, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _destroy: function _destroy(mapper, id, opts) {
- var self = this;
- return self.DEL(self.getPath('destroy', mapper, id, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _destroyAll: function _destroyAll(mapper, query, opts) {
- var self = this;
- return self.DEL(self.getPath('destroyAll', mapper, null, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _end: function _end(mapper, opts, response) {
- return [this.deserialize(mapper, response, opts), response];
- },
- _find: function _find(mapper, id, opts) {
- var self = this;
- return self.GET(self.getPath('find', mapper, id, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _findAll: function _findAll(mapper, query, opts) {
- var self = this;
- return self.GET(self.getPath('findAll', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _sum: function _sum(mapper, field, query, opts) {
- var self = this;
- return self.GET(self.getPath('sum', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _update: function _update(mapper, id, props, opts) {
- var self = this;
- return self.PUT(self.getPath('update', mapper, id, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _updateAll: function _updateAll(mapper, props, query, opts) {
- var self = this;
- return self.PUT(self.getPath('updateAll', mapper, null, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _updateMany: function _updateMany(mapper, records, opts) {
- var self = this;
- return self.PUT(self.getPath('updateMany', mapper, null, opts), self.serialize(mapper, records, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
-
-
- /**
- * Retrieve the number of records that match the selection `query`.
- *
- * @name HttpAdapter#count
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- count: function count(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params.count = true;
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.count.call(self, mapper, query, opts);
- },
-
-
- /**
- * Create a new the record from the provided `props`.
- *
- * @name HttpAdapter#create
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props Properties to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- create: function create(mapper, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.create.call(self, mapper, props, opts);
- },
-
-
- /**
- * Create multiple new records in batch.
- *
- * @name HttpAdapter#createMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Array} props Array of property objects to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- createMany: function createMany(mapper, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.createMany.call(self, mapper, props, opts);
- },
-
-
- /**
- * Make an Http request to `url` according to the configuration in `config`.
- *
- * @name HttpAdapter#DEL
- * @method
- * @param {string} url Url for the request.
- * @param {Object} [config] Http configuration that will be passed to
- * {@link HttpAdapter#HTTP}.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- DEL: function DEL(url, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.method = config.method || 'delete';
-
- // beforeDEL lifecycle hook
- op = opts.op = 'beforeDEL';
- return _jsData.utils.resolve(self[op](url, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'DEL';
- self.dbg(op, url, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterDEL lifecycle hook
- op = opts.op = 'afterDEL';
- return _jsData.utils.resolve(self[op](url, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Transform the server response object into the payload that will be returned
- * to JSData.
- *
- * @name HttpAdapter#deserialize
- * @method
- * @param {Object} mapper The mapper used for the operation.
- * @param {Object} response Response object from {@link HttpAdapter#HTTP}.
- * @param {Object} opts Configuration options.
- * @return {(Object|Array)} Deserialized data.
- */
- deserialize: function deserialize(mapper, response, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.deserialize)) {
- return opts.deserialize(mapper, response, opts);
- }
- if (_jsData.utils.isFunction(mapper.deserialize)) {
- return mapper.deserialize(mapper, response, opts);
- }
- if (response && response.hasOwnProperty('data')) {
- return response.data;
- }
- return response;
- },
-
-
- /**
- * Destroy the record with the given primary key.
- *
- * @name HttpAdapter#destroy
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to destroy.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- destroy: function destroy(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.destroy.call(self, mapper, id, opts);
- },
-
-
- /**
- * Destroy the records that match the selection `query`.
- *
- * @name HttpAdapter#destroyAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- destroyAll: function destroyAll(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.destroyAll.call(self, mapper, query, opts);
- },
-
-
- /**
- * Log an error.
- *
- * @name HttpAdapter#error
- * @method
- * @param {...*} [args] Arguments to log.
- */
- error: function error() {
- if (console) {
- var _console;
-
- (_console = console)[typeof console.error === 'function' ? 'error' : 'log'].apply(_console, arguments);
- }
- },
-
-
- /**
- * Make an Http request using `window.fetch`.
- *
- * @name HttpAdapter#fetch
- * @method
- * @param {Object} config Request configuration.
- * @param {Object} config.data Payload for the request.
- * @param {string} config.method Http method for the request.
- * @param {Object} config.headers Headers for the request.
- * @param {Object} config.params Querystring for the request.
- * @param {string} config.url Url for the request.
- * @param {Object} [opts] Configuration options.
- */
- fetch: function (_fetch) {
- function fetch(_x, _x2) {
- return _fetch.apply(this, arguments);
- }
-
- fetch.toString = function () {
- return _fetch.toString();
- };
-
- return fetch;
- }(function (config, opts) {
- var requestConfig = {
- method: config.method,
- // turn the plain headers object into the Fetch Headers object
- headers: new Headers(config.headers)
- };
-
- if (config.data) {
- requestConfig.body = _jsData.utils.toJson(config.data);
- }
-
- return fetch(new Request(buildUrl(config.url, config.params), requestConfig)).then(function (response) {
- response.config = {
- method: config.method,
- url: config.url
- };
- return response.json().then(function (data) {
- response.data = data;
- return response;
- });
- });
- }),
-
-
- /**
- * Retrieve the record with the given primary key.
- *
- * @name HttpAdapter#find
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to retrieve.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- find: function find(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.find.call(self, mapper, id, opts);
- },
-
-
- /**
- * Retrieve the records that match the selection `query`.
- *
- * @name HttpAdapter#findAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- findAll: function findAll(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.findAll.call(self, mapper, query, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#GET
- * @method
- * @param {string} url The url for the request.
- * @param {Object} config Request configuration options.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- GET: function GET(url, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.method = config.method || 'get';
-
- // beforeGET lifecycle hook
- op = opts.op = 'beforeGET';
- return _jsData.utils.resolve(self[op](url, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'GET';
- self.dbg(op, url, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterGET lifecycle hook
- op = opts.op = 'afterGET';
- return _jsData.utils.resolve(self[op](url, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * @name HttpAdapter#getEndpoint
- * @method
- * @param {Object} mapper TODO
- * @param {*} id TODO
- * @param {boolean} opts TODO
- * @return {string} Full path.
- */
- getEndpoint: function getEndpoint(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = _jsData.utils.isUndefined(opts.params) ? {} : opts.params;
- var relationList = mapper.relationList || [];
- var endpoint = _jsData.utils.isUndefined(opts.endpoint) ? _jsData.utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint : opts.endpoint;
-
- relationList.forEach(function (def) {
- if (def.type !== 'belongsTo' || !def.parent) {
- return;
- }
- var item = void 0;
- var parentKey = def.foreignKey;
- var parentDef = def.getRelation();
- var parentId = opts.params[parentKey];
-
- if (parentId === false || !parentKey || !parentDef) {
- if (parentId === false) {
- delete opts.params[parentKey];
- }
- return false;
- } else {
- delete opts.params[parentKey];
-
- if (_jsData.utils.isObject(id)) {
- item = id;
- }
-
- if (item) {
- parentId = parentId || def.getForeignKey(item) || (def.getLocalField(item) ? _jsData.utils.get(def.getLocalField(item), parentDef.idAttribute) : null);
- }
-
- if (parentId) {
- var _ret = function () {
- delete opts.endpoint;
- var _opts = {};
- _jsData.utils.forOwn(opts, function (value, key) {
- _opts[key] = value;
- });
- _jsData.utils._(_opts, parentDef);
- endpoint = makePath(self.getEndpoint(parentDef, parentId, _opts), parentId, endpoint);
- return {
- v: false
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- }
- });
-
- return endpoint;
- },
-
-
- /**
- * @name HttpAdapter#getPath
- * @method
- * @param {string} method TODO
- * @param {Object} mapper TODO
- * @param {(string|number)?} id TODO
- * @param {Object} opts Configuration options.
- */
- getPath: function getPath(method, mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- var args = [_jsData.utils.isUndefined(opts.basePath) ? _jsData.utils.isUndefined(mapper.basePath) ? self.basePath : mapper.basePath : opts.basePath, self.getEndpoint(mapper, _jsData.utils.isString(id) || _jsData.utils.isNumber(id) || method === 'create' ? id : null, opts)];
- if (method === 'find' || method === 'update' || method === 'destroy') {
- args.push(id);
- }
- return makePath.apply(_jsData.utils, args);
- },
- getParams: function getParams(opts) {
- opts || (opts = {});
- if (_jsData.utils.isUndefined(opts.params)) {
- return {};
- }
- return _jsData.utils.copy(opts.params);
- },
- getSuffix: function getSuffix(mapper, opts) {
- opts || (opts = {});
- if (_jsData.utils.isUndefined(opts.suffix)) {
- if (_jsData.utils.isUndefined(mapper.suffix)) {
- return this.suffix;
- }
- return mapper.suffix;
- }
- return opts.suffix;
- },
-
-
- /**
- * Make an Http request.
- *
- * @name HttpAdapter#HTTP
- * @method
- * @param {Object} config Request configuration options.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- HTTP: function HTTP(config, opts) {
- var self = this;
- var start = new Date();
- opts || (opts = {});
- var payload = config.data;
- var cache = config.cache;
- var timeout = config.timeout;
- config = _jsData.utils.copy(config, null, null, null, ['data', 'cache', 'timeout']);
- config = _jsData.utils.deepMixIn(config, self.httpConfig);
- config.data = payload;
- config.cache = cache;
- config.timeout = timeout;
- if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
- config.url += '/';
- }
- config.method = config.method.toUpperCase();
- var suffix = config.suffix || opts.suffix || self.suffix;
- if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
- config.url += suffix;
- }
-
- function logResponse(data) {
- var str = start.toUTCString() + ' - ' + config.method.toUpperCase() + ' ' + config.url + ' - ' + data.status + ' ' + (new Date().getTime() - start.getTime()) + 'ms';
- if (data.status >= 200 && data.status < 300) {
- if (self.log) {
- self.dbg('debug', str, data);
- }
- return data;
- } else {
- if (self.error) {
- self.error('\'FAILED: ' + str, data);
- }
- return _jsData.utils.reject(data);
- }
- }
-
- if (!self.http) {
- throw new Error('You have not configured this adapter with an http library!');
- }
-
- return _jsData.utils.resolve(self.beforeHTTP(config, opts)).then(function (_config) {
- config = _config || config;
- if (hasFetch && (self.useFetch || opts.useFetch || !self.http)) {
- return self.fetch(config, opts).then(logResponse, logResponse);
- }
- return self.http(config).then(logResponse, logResponse).catch(function (err) {
- return self.responseError(err, config, opts);
- });
- }).then(function (response) {
- return _jsData.utils.resolve(self.afterHTTP(config, opts, response)).then(function (_response) {
- return _response || response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#POST
- * @method
- * @param {*} url TODO
- * @param {Object} data TODO
- * @param {Object} config TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- POST: function POST(url, data, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.data = data || config.data;
- config.method = config.method || 'post';
-
- // beforePOST lifecycle hook
- op = opts.op = 'beforePOST';
- return _jsData.utils.resolve(self[op](url, data, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'POST';
- self.dbg(op, url, data, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterPOST lifecycle hook
- op = opts.op = 'afterPOST';
- return _jsData.utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#PUT
- * @method
- * @param {*} url TODO
- * @param {Object} data TODO
- * @param {Object} config TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- PUT: function PUT(url, data, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.data = data || config.data;
- config.method = config.method || 'put';
-
- // beforePUT lifecycle hook
- op = opts.op = 'beforePUT';
- return _jsData.utils.resolve(self[op](url, data, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'PUT';
- self.dbg(op, url, data, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterPUT lifecycle hook
- op = opts.op = 'afterPUT';
- return _jsData.utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#queryTransform
- * @method
- * @param {Object} mapper TODO
- * @param {*} params TODO
- * @param {*} opts TODO
- * @return {*} Transformed params.
- */
- queryTransform: function queryTransform(mapper, params, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.queryTransform)) {
- return opts.queryTransform(mapper, params, opts);
- }
- if (_jsData.utils.isFunction(mapper.queryTransform)) {
- return mapper.queryTransform(mapper, params, opts);
- }
- return params;
- },
-
-
- /**
- * Error handler invoked when the promise returned by {@link HttpAdapter#http}
- * is rejected. Default implementation is to just return the error wrapped in
- * a rejected Promise, aka rethrow the error. {@link HttpAdapter#http} is
- * called by {@link HttpAdapter#HTTP}.
- *
- * @name HttpAdapter#responseError
- * @method
- * @param {*} err The error that {@link HttpAdapter#http} rejected with.
- * @param {Object} config The `config` argument that was passed to {@link HttpAdapter#HTTP}.
- * @param {*} opts The `opts` argument that was passed to {@link HttpAdapter#HTTP}.
- * @return {Promise}
- */
- responseError: function responseError(err, config, opts) {
- return _jsData.utils.reject(err);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#serialize
- * @method
- * @param {Object} mapper TODO
- * @param {Object} data TODO
- * @param {*} opts TODO
- * @return {*} Serialized data.
- */
- serialize: function serialize(mapper, data, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.serialize)) {
- return opts.serialize(mapper, data, opts);
- }
- if (_jsData.utils.isFunction(mapper.serialize)) {
- return mapper.serialize(mapper, data, opts);
- }
- return data;
- },
-
-
- /**
- * Retrieve the sum of the field of the records that match the selection query.
- *
- * @name HttpAdapter#sum
- * @method
- * @param {Object} mapper The mapper.
- * @param {string} field The field to sum.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- sum: function sum(mapper, field, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- if (!_jsData.utils.utils.isString(field)) {
- throw new Error('field must be a string!');
- }
- opts.params = self.getParams(opts);
- opts.params.sum = field;
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.sum.call(self, mapper, field, query, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#update
- * @method
- * @param {Object} mapper TODO
- * @param {*} id TODO
- * @param {*} props TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- update: function update(mapper, id, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.update.call(self, mapper, id, props, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#updateAll
- * @method
- * @param {Object} mapper TODO
- * @param {Object} props TODO
- * @param {Object} query TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- updateAll: function updateAll(mapper, props, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.updateAll.call(self, mapper, props, query, opts);
- },
-
-
- /**
- * Update multiple records in batch.
- *
- * {@link HttpAdapter#beforeUpdateMany} will be called before calling
- * {@link HttpAdapter#PUT}.
- * {@link HttpAdapter#afterUpdateMany} will be called after calling
- * {@link HttpAdapter#PUT}.
- *
- * @name HttpAdapter#updateMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Array} records Array of property objects to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- updateMany: function updateMany(mapper, records, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.updateMany.call(self, mapper, records, opts);
- }
- });
-
- /**
- * Add an Http actions to a mapper.
- *
- * @name HttpAdapter.addAction
- * @method
- * @param {string} name Name of the new action.
- * @param {Object} [opts] Action configuration
- * @param {string} [opts.adapter]
- * @param {string} [opts.pathname]
- * @param {Function} [opts.request]
- * @param {Function} [opts.response]
- * @param {Function} [opts.responseError]
- * @return {Function} Decoration function, which should be passed the mapper to
- * decorate when invoked.
- */
- HttpAdapter.addAction = function (name, opts) {
- if (!name || !_jsData.utils.isString(name)) {
- throw new TypeError('action(name[, opts]): Expected: string, Found: ' + (typeof name === 'undefined' ? 'undefined' : _typeof(name)));
- }
- return function (mapper) {
- if (mapper[name]) {
- throw new Error('action(name[, opts]): ' + name + ' already exists on target!');
- }
- opts.request = opts.request || function (config) {
- return config;
- };
- opts.response = opts.response || function (response) {
- return response;
- };
- opts.responseError = opts.responseError || function (err) {
- return _jsData.utils.reject(err);
- };
- mapper[name] = function (id, _opts) {
- var self = this;
- if (_jsData.utils.isObject(id)) {
- _opts = id;
- }
- _opts = _opts || {};
- var adapter = self.getAdapter(opts.adapter || self.defaultAdapter || 'http');
- var config = {};
- _jsData.utils.fillIn(config, opts);
- if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {
- _opts.endpoint = config.endpoint;
- }
- if (typeof _opts.getEndpoint === 'function') {
- config.url = _opts.getEndpoint(self, _opts);
- } else {
- var _args = [_opts.basePath || self.basePath || adapter.basePath, adapter.getEndpoint(self, _jsData.utils.isSorN(id) ? id : null, _opts)];
- if (_jsData.utils.isSorN(id)) {
- _args.push(id);
- }
- _args.push(opts.pathname || name);
- config.url = makePath.apply(null, _args);
- }
- config.method = config.method || 'GET';
- config.mapper = self.name;
- _jsData.utils.deepMixIn(config)(_opts);
- return _jsData.utils.resolve(config).then(_opts.request || opts.request).then(function (config) {
- return adapter.HTTP(config);
- }).then(function (data) {
- if (data && data.config) {
- data.config.mapper = self.name;
- }
- return data;
- }).then(_opts.response || opts.response, _opts.responseError || opts.responseError);
- };
- return mapper;
- };
- };
-
- /**
- * Add multiple Http actions to a mapper. See {@link HttpAdapter.addAction} for
- * action configuration options.
- *
- * @name HttpAdapter.addActions
- * @method
- * @param {Object.} opts Object where the key is an action name
- * and the value is the configuration for the action.
- * @return {Function} Decoration function, which should be passed the mapper to
- * decorate when invoked.
- */
- HttpAdapter.addActions = function (opts) {
- opts || (opts = {});
- return function (mapper) {
- _jsData.utils.forOwn(mapper, function (value, key) {
- HttpAdapter.addAction(key, value)(mapper);
- });
- return mapper;
- };
- };
-
- /**
- * Alternative to ES6 class syntax for extending `HttpAdapter`.
- *
- * __ES6__:
- * ```javascript
- * class MyHttpAdapter extends HttpAdapter {
- * deserialize (Model, data, opts) {
- * const data = super.deserialize(Model, data, opts)
- * data.foo = 'bar'
- * return data
- * }
- * }
- * ```
- *
- * __ES5__:
- * ```javascript
- * var instanceProps = {
- * // override deserialize
- * deserialize: function (Model, data, opts) {
- * var Ctor = this.constructor
- * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize
- * // call the super deserialize
- * var data = superDeserialize(Model, data, opts)
- * data.foo = 'bar'
- * return data
- * },
- * say: function () { return 'hi' }
- * }
- * var classProps = {
- * yell: function () { return 'HI' }
- * }
- *
- * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps)
- * var adapter = new MyHttpAdapter()
- * adapter.say() // "hi"
- * MyHttpAdapter.yell() // "HI"
- * ```
- *
- * @name HttpAdapter.extend
- * @method
- * @param {Object} [instanceProps] Properties that will be added to the
- * prototype of the subclass.
- * @param {Object} [classProps] Properties that will be added as static
- * properties to the subclass itself.
- * @return {Object} Subclass of `HttpAdapter`.
- */
- HttpAdapter.extend = _jsData.utils.extend;
-
- /**
- * Details of the current version of the `js-data-http` module.
- *
- * @name HttpAdapter.version
- * @type {Object}
- * @property {string} version.full The full semver value.
- * @property {number} version.major The major version number.
- * @property {number} version.minor The minor version number.
- * @property {number} version.patch The patch version number.
- * @property {(string|boolean)} version.alpha The alpha version value,
- * otherwise `false` if the current version is not alpha.
- * @property {(string|boolean)} version.beta The beta version value,
- * otherwise `false` if the current version is not beta.
- */
- HttpAdapter.version = {
- beta: 2,
- full: '3.0.0-beta.2',
- major: 3,
- minor: 0,
- patch: 0
-};
-
- /**
- * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http`
- * that works on Node.js is registered in NPM as `js-data-http-node`. The build
- * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower
- * as `js-data-fetch`.
- *
- * __Script tag__:
- * ```javascript
- * window.HttpAdapter
- * ```
- * __CommonJS__:
- * ```javascript
- * var HttpAdapter = require('js-data-http')
- * ```
- * __ES6 Modules__:
- * ```javascript
- * import HttpAdapter from 'js-data-http'
- * ```
- * __AMD__:
- * ```javascript
- * define('myApp', ['js-data-http'], function (HttpAdapter) { ... })
- * ```
- *
- * @module js-data-http
- */
-
- module.exports = HttpAdapter;
-
-/***/ },
-/* 1 */
-/***/ function(module, exports) {
-
- module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- (function (global, factory) {
- true ? factory(__webpack_require__(1)) :
- typeof define === 'function' && define.amd ? define('js-data-adapter', ['js-data'], factory) :
- (factory(global.JSData));
- }(this, function (jsData) { 'use strict';
-
- var babelHelpers = {};
- babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
-
- babelHelpers.defineProperty = function (obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
- };
-
- babelHelpers.slicedToArray = function () {
- function sliceIterator(arr, i) {
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
-
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
-
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"]) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
-
- return _arr;
- }
-
- return function (arr, i) {
- if (Array.isArray(arr)) {
- return arr;
- } else if (Symbol.iterator in Object(arr)) {
- return sliceIterator(arr, i);
- } else {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }
- };
- }();
-
- babelHelpers;
-
- var noop = function noop() {
- var self = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var opts = args[args.length - 1];
- self.dbg.apply(self, [opts.op].concat(args));
- return jsData.utils.resolve();
- };
-
- var noop2 = function noop2() {
- var self = this;
-
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- var opts = args[args.length - 2];
- self.dbg.apply(self, [opts.op].concat(args));
- return jsData.utils.resolve();
- };
-
- var unique = function unique(array) {
- var seen = {};
- var final = [];
- array.forEach(function (item) {
- if (item in seen) {
- return;
- }
- final.push(item);
- seen[item] = 0;
- });
- return final;
- };
-
- var withoutRelations = function withoutRelations(mapper, props) {
- return jsData.utils.omit(props, mapper.relationFields || []);
- };
-
- var DEFAULTS = {
- /**
- * Whether to log debugging information.
- *
- * @name Adapter#debug
- * @type {boolean}
- * @default false
- */
- debug: false,
-
- /**
- * Whether to return a more detailed response object.
- *
- * @name Adapter#raw
- * @type {boolean}
- * @default false
- */
- raw: false
- };
-
- /**
- * Abstract class meant to be extended by adapters.
- *
- * @class Adapter
- * @abstract
- * @param {Object} [opts] Configuration opts.
- * @param {boolean} [opts.debug=false] Whether to log debugging information.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed response
- * object.
- */
- function Adapter(opts) {
- var self = this;
- opts || (opts = {});
- jsData.utils.fillIn(opts, DEFAULTS);
- jsData.utils.fillIn(self, opts);
- }
-
- Adapter.reserved = ['orderBy', 'sort', 'limit', 'offset', 'skip', 'where'];
-
- /**
- * Response object used when `raw` is `true`. May contain other fields in
- * addition to `data`.
- *
- * @typedef {Object} Response
- * @property {Object} data Response data.
- * @property {string} op The operation for which the response was created.
- */
- function Response(data, meta, op) {
- var self = this;
- meta || (meta = {});
- self.data = data;
- jsData.utils.fillIn(self, meta);
- self.op = op;
- }
-
- Adapter.Response = Response;
-
- /**
- * Alternative to ES6 class syntax for extending `Adapter`.
- *
- * @name Adapter.extend
- * @method
- * @param {Object} [instanceProps] Properties that will be added to the
- * prototype of the subclass.
- * @param {Object} [classProps] Properties that will be added as static
- * properties to the subclass itself.
- * @return {Object} Subclass of `Adapter`.
- */
- Adapter.extend = jsData.utils.extend;
-
- jsData.utils.addHiddenPropsToTarget(Adapter.prototype, {
- /**
- * Lifecycle method method called by count.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes count to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the count.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
- *
- * @name Adapter#afterCount
- * @method
- * @param {Object} mapper The `mapper` argument passed to count.
- * @param {Object} props The `props` argument passed to count.
- * @param {Object} opts The `opts` argument passed to count.
- * @property {string} opts.op `afterCount`
- * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCount: noop2,
-
- /**
- * Lifecycle method method called by create.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes create to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created record.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
- *
- * @name Adapter#afterCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to create.
- * @param {Object} props The `props` argument passed to create.
- * @param {Object} opts The `opts` argument passed to create.
- * @property {string} opts.op `afterCreate`
- * @param {Object|Response} response Created record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCreate: noop2,
-
- /**
- * Lifecycle method method called by createMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created records.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
- *
- * @name Adapter#afterCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to createMany.
- * @param {Object[]} props The `props` argument passed to createMany.
- * @param {Object} opts The `opts` argument passed to createMany.
- * @property {string} opts.op `afterCreateMany`
- * @param {Object[]|Response} response Created records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCreateMany: noop2,
-
- /**
- * Lifecycle method method called by destroy.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
- *
- * @name Adapter#afterDestroy
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroy.
- * @param {(string|number)} id The `id` argument passed to destroy.
- * @param {Object} opts The `opts` argument passed to destroy.
- * @property {string} opts.op `afterDestroy`
- * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.
- */
- afterDestroy: noop2,
-
- /**
- * Lifecycle method method called by destroyAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
- *
- * @name Adapter#afterDestroyAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroyAll.
- * @param {Object} query The `query` argument passed to destroyAll.
- * @param {Object} opts The `opts` argument passed to destroyAll.
- * @property {string} opts.op `afterDestroyAll`
- * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.
- */
- afterDestroyAll: noop2,
-
- /**
- * Lifecycle method method called by find.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes find to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found record, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
- *
- * @name Adapter#afterFind
- * @method
- * @param {Object} mapper The `mapper` argument passed to find.
- * @param {(string|number)} id The `id` argument passed to find.
- * @param {Object} opts The `opts` argument passed to find.
- * @property {string} opts.op `afterFind`
- * @param {Object|Response} response The found record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterFind: noop2,
-
- /**
- * Lifecycle method method called by findAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
- *
- * @name Adapter#afterFindAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to findAll.
- * @param {Object} query The `query` argument passed to findAll.
- * @param {Object} opts The `opts` argument passed to findAll.
- * @property {string} opts.op `afterFindAll`
- * @param {Object[]|Response} response The found records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterFindAll: noop2,
-
- /**
- * Lifecycle method method called by sum.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes sum to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the sum.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
- *
- * @name Adapter#afterSum
- * @method
- * @param {Object} mapper The `mapper` argument passed to sum.
- * @param {Object} props The `props` argument passed to sum.
- * @param {Object} opts The `opts` argument passed to sum.
- * @property {string} opts.op `afterSum`
- * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.
- */
- afterSum: noop2,
-
- /**
- * Lifecycle method method called by update.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes update to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated record.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
- *
- * @name Adapter#afterUpdate
- * @method
- * @param {Object} mapper The `mapper` argument passed to update.
- * @param {(string|number)} id The `id` argument passed to update.
- * @param {Object} props The `props` argument passed to update.
- * @param {Object} opts The `opts` argument passed to update.
- * @property {string} opts.op `afterUpdate`
- * @param {Object|Response} response The updated record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdate: noop2,
-
- /**
- * Lifecycle method method called by updateAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
- *
- * @name Adapter#afterUpdateAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateAll.
- * @param {Object} props The `props` argument passed to updateAll.
- * @param {Object} query The `query` argument passed to updateAll.
- * @param {Object} opts The `opts` argument passed to updateAll.
- * @property {string} opts.op `afterUpdateAll`
- * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdateAll: noop2,
-
- /**
- * Lifecycle method method called by updateMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
- *
- * @name Adapter#afterUpdateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateMany.
- * @param {Object[]} records The `records` argument passed to updateMany.
- * @param {Object} opts The `opts` argument passed to updateMany.
- * @property {string} opts.op `afterUpdateMany`
- * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdateMany: noop2,
-
- /**
- * Lifecycle method method called by count.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes count to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
- *
- * @name Adapter#beforeCount
- * @method
- * @param {Object} mapper The `mapper` argument passed to count.
- * @param {Object} query The `query` argument passed to count.
- * @param {Object} opts The `opts` argument passed to count.
- * @property {string} opts.op `beforeCount`
- */
- beforeCount: noop,
-
- /**
- * Lifecycle method method called by create.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes create to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
- *
- * @name Adapter#beforeCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to create.
- * @param {Object} props The `props` argument passed to create.
- * @param {Object} opts The `opts` argument passed to create.
- * @property {string} opts.op `beforeCreate`
- */
- beforeCreate: noop,
-
- /**
- * Lifecycle method method called by createMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
- *
- * @name Adapter#beforeCreateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to createMany.
- * @param {Object[]} props The `props` argument passed to createMany.
- * @param {Object} opts The `opts` argument passed to createMany.
- * @property {string} opts.op `beforeCreateMany`
- */
- beforeCreateMany: noop,
-
- /**
- * Lifecycle method method called by destroy.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
- *
- * @name Adapter#beforeDestroy
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroy.
- * @param {(string|number)} id The `id` argument passed to destroy.
- * @param {Object} opts The `opts` argument passed to destroy.
- * @property {string} opts.op `beforeDestroy`
- */
- beforeDestroy: noop,
-
- /**
- * Lifecycle method method called by destroyAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
- *
- * @name Adapter#beforeDestroyAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroyAll.
- * @param {Object} query The `query` argument passed to destroyAll.
- * @param {Object} opts The `opts` argument passed to destroyAll.
- * @property {string} opts.op `beforeDestroyAll`
- */
- beforeDestroyAll: noop,
-
- /**
- * Lifecycle method method called by find.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes find to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
- *
- * @name Adapter#beforeFind
- * @method
- * @param {Object} mapper The `mapper` argument passed to find.
- * @param {(string|number)} id The `id` argument passed to find.
- * @param {Object} opts The `opts` argument passed to find.
- * @property {string} opts.op `beforeFind`
- */
- beforeFind: noop,
-
- /**
- * Lifecycle method method called by findAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
- *
- * @name Adapter#beforeFindAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to findAll.
- * @param {Object} query The `query` argument passed to findAll.
- * @param {Object} opts The `opts` argument passed to findAll.
- * @property {string} opts.op `beforeFindAll`
- */
- beforeFindAll: noop,
-
- /**
- * Lifecycle method method called by sum.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes sum to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
- *
- * @name Adapter#beforeSum
- * @method
- * @param {Object} mapper The `mapper` argument passed to sum.
- * @param {Object} query The `query` argument passed to sum.
- * @param {Object} opts The `opts` argument passed to sum.
- * @property {string} opts.op `beforeSum`
- */
- beforeSum: noop,
-
- /**
- * Lifecycle method method called by update.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes update to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
- *
- * @name Adapter#beforeUpdate
- * @method
- * @param {Object} mapper The `mapper` argument passed to update.
- * @param {(string|number)} id The `id` argument passed to update.
- * @param {Object} props The `props` argument passed to update.
- * @param {Object} opts The `opts` argument passed to update.
- * @property {string} opts.op `beforeUpdate`
- */
- beforeUpdate: noop,
-
- /**
- * Lifecycle method method called by updateAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
- *
- * @name Adapter#beforeUpdateAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateAll.
- * @param {Object} props The `props` argument passed to updateAll.
- * @param {Object} query The `query` argument passed to updateAll.
- * @param {Object} opts The `opts` argument passed to updateAll.
- * @property {string} opts.op `beforeUpdateAll`
- */
- beforeUpdateAll: noop,
-
- /**
- * Lifecycle method method called by updateMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
- *
- * @name Adapter#beforeUpdateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateMany.
- * @param {Object[]} props The `props` argument passed to updateMany.
- * @param {Object} opts The `opts` argument passed to updateMany.
- * @property {string} opts.op `beforeUpdateMany`
- */
- beforeUpdateMany: noop,
-
- /**
- * Shortcut for `#log('debug'[, arg1[, arg2[, argn]]])`.
- *
- * @name Adapter#dbg
- * @method
- */
- dbg: function dbg() {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
-
- this.log.apply(this, ['debug'].concat(args));
- },
-
-
- /**
- * Retrieve the number of records that match the selection query. Called by
- * `Mapper#count`.
- *
- * @name Adapter#count
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- count: function count(mapper, query, opts) {
- var self = this;
- var op = void 0;
- query || (query = {});
- opts || (opts = {});
-
- // beforeCount lifecycle hook
- op = opts.op = 'beforeCount';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- // Allow for re-assignment from lifecycle hook
- op = opts.op = 'count';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._count(mapper, query, opts));
- }).then(function (results) {
- var _results = babelHelpers.slicedToArray(results, 2);
-
- var data = _results[0];
- var result = _results[1];
-
- result || (result = {});
- var response = new Response(data, result, op);
- response = self.respond(response, opts);
-
- // afterCount lifecycle hook
- op = opts.op = 'afterCount';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Create a new record. Called by `Mapper#create`.
- *
- * @name Adapter#create
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The record to be created.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- create: function create(mapper, props, opts) {
- var self = this;
- var op = void 0;
- props || (props = {});
- opts || (opts = {});
-
- // beforeCreate lifecycle hook
- op = opts.op = 'beforeCreate';
- return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- props = withoutRelations(mapper, props);
- op = opts.op = 'create';
- self.dbg(op, mapper, props, opts);
- return jsData.utils.resolve(self._create(mapper, props, opts));
- }).then(function (results) {
- var _results2 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results2[0];
- var result = _results2[1];
-
- result || (result = {});
- var response = new Response(data, result, 'create');
- response.created = data ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterCreate lifecycle hook
- op = opts.op = 'afterCreate';
- return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Create multiple records in a single batch. Called by `Mapper#createMany`.
- *
- * @name Adapter#createMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The records to be created.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- createMany: function createMany(mapper, props, opts) {
- var self = this;
- var op = void 0;
- props || (props = {});
- opts || (opts = {});
-
- // beforeCreateMany lifecycle hook
- op = opts.op = 'beforeCreateMany';
- return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- props = props.map(function (record) {
- return withoutRelations(mapper, record);
- });
- op = opts.op = 'createMany';
- self.dbg(op, mapper, props, opts);
- return jsData.utils.resolve(self._createMany(mapper, props, opts));
- }).then(function (results) {
- var _results3 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results3[0];
- var result = _results3[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'createMany');
- response.created = data.length;
- response = self.respond(response, opts);
-
- // afterCreateMany lifecycle hook
- op = opts.op = 'afterCreateMany';
- return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Destroy the record with the given primary key. Called by
- * `Mapper#destroy`.
- *
- * @name Adapter#destroy
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to destroy.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- destroy: function destroy(mapper, id, opts) {
- var self = this;
- var op = void 0;
- opts || (opts = {});
-
- // beforeDestroy lifecycle hook
- op = opts.op = 'beforeDestroy';
- return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {
- op = opts.op = 'destroy';
- self.dbg(op, mapper, id, opts);
- return jsData.utils.resolve(self._destroy(mapper, id, opts));
- }).then(function (results) {
- var _results4 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results4[0];
- var result = _results4[1];
-
- result || (result = {});
- var response = new Response(data, result, 'destroy');
- response = self.respond(response, opts);
-
- // afterDestroy lifecycle hook
- op = opts.op = 'afterDestroy';
- return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Destroy the records that match the selection query. Called by
- * `Mapper#destroyAll`.
- *
- * @name Adapter#destroyAll
- * @method
- * @param {Object} mapper the mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- destroyAll: function destroyAll(mapper, query, opts) {
- var self = this;
- var op = void 0;
- query || (query = {});
- opts || (opts = {});
-
- // beforeDestroyAll lifecycle hook
- op = opts.op = 'beforeDestroyAll';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- op = opts.op = 'destroyAll';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._destroyAll(mapper, query, opts));
- }).then(function (results) {
- var _results5 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results5[0];
- var result = _results5[1];
-
- result || (result = {});
- var response = new Response(data, result, 'destroyAll');
- response = self.respond(response, opts);
-
- // afterDestroyAll lifecycle hook
- op = opts.op = 'afterDestroyAll';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Return the foreignKey from the given record for the provided relationship.
- *
- * There may be reasons why you may want to override this method, like when
- * the id of the parent doesn't exactly match up to the key on the child.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyForeignKey
- * @method
- * @return {*}
- */
- makeHasManyForeignKey: function makeHasManyForeignKey(mapper, def, record) {
- return def.getForeignKey(record);
- },
-
-
- /**
- * Return the localKeys from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyLocalKeys
- * @method
- * @return {*}
- */
- makeHasManyLocalKeys: function makeHasManyLocalKeys(mapper, def, record) {
- var localKeys = [];
- var itemKeys = jsData.utils.get(record, def.localKeys) || [];
- itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);
- localKeys = localKeys.concat(itemKeys);
- return unique(localKeys).filter(function (x) {
- return x;
- });
- },
-
-
- /**
- * Return the foreignKeys from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyForeignKeys
- * @method
- * @return {*}
- */
- makeHasManyForeignKeys: function makeHasManyForeignKeys(mapper, def, record) {
- return jsData.utils.get(record, mapper.idAttribute);
- },
-
-
- /**
- * Load a hasMany relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadHasMany
- * @method
- * @return {Promise}
- */
- loadHasMany: function loadHasMany(mapper, def, records, __opts) {
- var self = this;
- var singular = false;
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- singular = true;
- records = [records];
- }
- var IDs = records.map(function (record) {
- return self.makeHasManyForeignKey(mapper, def, record);
- });
- var query = {
- where: {}
- };
- var criteria = query.where[def.foreignKey] = {};
- if (singular) {
- // more efficient query when we only have one record
- criteria['=='] = IDs[0];
- } else {
- criteria['in'] = IDs.filter(function (id) {
- return id;
- });
- }
- return self.findAll(def.getRelation(), query, __opts).then(function (relatedItems) {
- records.forEach(function (record) {
- var attached = [];
- // avoid unneccesary iteration when we only have one record
- if (singular) {
- attached = relatedItems;
- } else {
- relatedItems.forEach(function (relatedItem) {
- if (jsData.utils.get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {
- attached.push(relatedItem);
- }
- });
- }
- def.setLocalField(record, attached);
- });
- });
- },
- loadHasManyLocalKeys: function loadHasManyLocalKeys(mapper, def, records, __opts) {
- var self = this;
- var record = void 0;
- var relatedMapper = def.getRelation();
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- record = records;
- }
-
- if (record) {
- return self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {
- 'in': self.makeHasManyLocalKeys(mapper, def, record)
- })
- }, __opts).then(function (relatedItems) {
- def.setLocalField(record, relatedItems);
- });
- } else {
- var _ret = function () {
- var localKeys = [];
- records.forEach(function (record) {
- localKeys = localKeys.concat(self.self.makeHasManyLocalKeys(mapper, def, record));
- });
- return {
- v: self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {
- 'in': unique(localKeys).filter(function (x) {
- return x;
- })
- })
- }, __opts).then(function (relatedItems) {
- records.forEach(function (item) {
- var attached = [];
- var itemKeys = jsData.utils.get(item, def.localKeys) || [];
- itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);
- relatedItems.forEach(function (relatedItem) {
- if (itemKeys && itemKeys.indexOf(relatedItem[relatedMapper.idAttribute]) !== -1) {
- attached.push(relatedItem);
- }
- });
- def.setLocalField(item, attached);
- });
- return relatedItems;
- })
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === "object") return _ret.v;
- }
- },
- loadHasManyForeignKeys: function loadHasManyForeignKeys(mapper, def, records, __opts) {
- var self = this;
- var relatedMapper = def.getRelation();
- var idAttribute = mapper.idAttribute;
- var record = void 0;
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- record = records;
- }
-
- if (record) {
- return self.findAll(def.getRelation(), {
- where: babelHelpers.defineProperty({}, def.foreignKeys, {
- 'contains': self.makeHasManyForeignKeys(mapper, def, record)
- })
- }, __opts).then(function (relatedItems) {
- def.setLocalField(record, relatedItems);
- });
- } else {
- return self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, def.foreignKeys, {
- 'isectNotEmpty': records.map(function (record) {
- return self.makeHasManyForeignKeys(mapper, def, record);
- })
- })
- }, __opts).then(function (relatedItems) {
- var foreignKeysField = def.foreignKeys;
- records.forEach(function (record) {
- var _relatedItems = [];
- var id = jsData.utils.get(record, idAttribute);
- relatedItems.forEach(function (relatedItem) {
- var foreignKeys = jsData.utils.get(relatedItems, foreignKeysField) || [];
- if (foreignKeys.indexOf(id) !== -1) {
- _relatedItems.push(relatedItem);
- }
- });
- def.setLocalField(record, _relatedItems);
- });
- });
- }
- },
-
-
- /**
- * Load a hasOne relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadHasOne
- * @method
- * @return {Promise}
- */
- loadHasOne: function loadHasOne(mapper, def, records, __opts) {
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- records = [records];
- }
- return this.loadHasMany(mapper, def, records, __opts).then(function () {
- records.forEach(function (record) {
- var relatedData = def.getLocalField(record);
- if (jsData.utils.isArray(relatedData) && relatedData.length) {
- def.setLocalField(record, relatedData[0]);
- }
- });
- });
- },
-
-
- /**
- * Return the foreignKey from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeBelongsToForeignKey
- * @method
- * @return {*}
- */
- makeBelongsToForeignKey: function makeBelongsToForeignKey(mapper, def, record) {
- return def.getForeignKey(record);
- },
-
-
- /**
- * Load a belongsTo relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadBelongsTo
- * @method
- * @return {Promise}
- */
- loadBelongsTo: function loadBelongsTo(mapper, def, records, __opts) {
- var self = this;
- var relationDef = def.getRelation();
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- var _ret2 = function () {
- var record = records;
- return {
- v: self.find(relationDef, self.makeBelongsToForeignKey(mapper, def, record), __opts).then(function (relatedItem) {
- def.setLocalField(record, relatedItem);
- })
- };
- }();
-
- if ((typeof _ret2 === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret2)) === "object") return _ret2.v;
- } else {
- var keys = records.map(function (record) {
- return self.makeBelongsToForeignKey(mapper, def, record);
- }).filter(function (key) {
- return key;
- });
- return self.findAll(relationDef, {
- where: babelHelpers.defineProperty({}, relationDef.idAttribute, {
- 'in': keys
- })
- }, __opts).then(function (relatedItems) {
- records.forEach(function (record) {
- relatedItems.forEach(function (relatedItem) {
- if (relatedItem[relationDef.idAttribute] === record[def.foreignKey]) {
- def.setLocalField(record, relatedItem);
- }
- });
- });
- });
- }
- },
-
-
- /**
- * Retrieve the record with the given primary key. Called by `Mapper#find`.
- *
- * @name Adapter#find
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to retrieve.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @param {string[]} [opts.with=[]] Relations to eager load.
- * @return {Promise}
- */
- find: function find(mapper, id, opts) {
- var self = this;
- var record = void 0,
- op = void 0;
- opts || (opts = {});
- opts.with || (opts.with = []);
-
- // beforeFind lifecycle hook
- op = opts.op = 'beforeFind';
- return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {
- op = opts.op = 'find';
- self.dbg(op, mapper, id, opts);
- return jsData.utils.resolve(self._find(mapper, id, opts));
- }).then(function (results) {
- var _results6 = babelHelpers.slicedToArray(results, 1);
-
- var _record = _results6[0];
-
- if (!_record) {
- return;
- }
- record = _record;
- var tasks = [];
-
- jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {
- var task = void 0;
- if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {
- if (def.type === 'hasOne') {
- task = self.loadHasOne(mapper, def, record, __opts);
- } else {
- task = self.loadHasMany(mapper, def, record, __opts);
- }
- } else if (def.type === 'hasMany' && def.localKeys) {
- task = self.loadHasManyLocalKeys(mapper, def, record, __opts);
- } else if (def.type === 'hasMany' && def.foreignKeys) {
- task = self.loadHasManyForeignKeys(mapper, def, record, __opts);
- } else if (def.type === 'belongsTo') {
- task = self.loadBelongsTo(mapper, def, record, __opts);
- }
- if (task) {
- tasks.push(task);
- }
- });
-
- return Promise.all(tasks);
- }).then(function () {
- var response = new Response(record, {}, 'find');
- response.found = record ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterFind lifecycle hook
- op = opts.op = 'afterFind';
- return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Retrieve the records that match the selection query.
- *
- * @name Adapter#findAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @param {string[]} [opts.with=[]] Relations to eager load.
- * @return {Promise}
- */
- findAll: function findAll(mapper, query, opts) {
- var self = this;
- opts || (opts = {});
- opts.with || (opts.with = []);
-
- var records = [];
- var op = void 0;
- var activeWith = opts._activeWith;
-
- if (jsData.utils.isObject(activeWith)) {
- var activeQuery = activeWith.query || {};
- if (activeWith.replace) {
- query = activeQuery;
- } else {
- jsData.utils.deepFillIn(query, activeQuery);
- }
- }
-
- // beforeFindAll lifecycle hook
- op = opts.op = 'beforeFindAll';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- op = opts.op = 'findAll';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._findAll(mapper, query, opts));
- }).then(function (results) {
- var _results7 = babelHelpers.slicedToArray(results, 1);
-
- var _records = _results7[0];
-
- _records || (_records = []);
- records = _records;
- var tasks = [];
- jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {
- var task = void 0;
- if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {
- if (def.type === 'hasMany') {
- task = self.loadHasMany(mapper, def, records, __opts);
- } else {
- task = self.loadHasOne(mapper, def, records, __opts);
- }
- } else if (def.type === 'hasMany' && def.localKeys) {
- task = self.loadHasManyLocalKeys(mapper, def, records, __opts);
- } else if (def.type === 'hasMany' && def.foreignKeys) {
- task = self.loadHasManyForeignKeys(mapper, def, records, __opts);
- } else if (def.type === 'belongsTo') {
- task = self.loadBelongsTo(mapper, def, records, __opts);
- }
- if (task) {
- tasks.push(task);
- }
- });
- return Promise.all(tasks);
- }).then(function () {
- var response = new Response(records, {}, 'findAll');
- response.found = records.length;
- response = self.respond(response, opts);
-
- // afterFindAll lifecycle hook
- op = opts.op = 'afterFindAll';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Resolve the value of the specified option based on the given options and
- * this adapter's settings. Override with care.
- *
- * @name Adapter#getOpt
- * @method
- * @param {string} opt The name of the option.
- * @param {Object} [opts] Configuration options.
- * @return {*} The value of the specified option.
- */
- getOpt: function getOpt(opt, opts) {
- opts || (opts = {});
- return jsData.utils.isUndefined(opts[opt]) ? jsData.utils.plainCopy(this[opt]) : jsData.utils.plainCopy(opts[opt]);
- },
-
-
- /**
- * Logging utility method. Override this method if you want to send log
- * messages to something other than the console.
- *
- * @name Adapter#log
- * @method
- * @param {string} level Log level.
- * @param {...*} values Values to log.
- */
- log: function log(level) {
- for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
- args[_key4 - 1] = arguments[_key4];
- }
-
- if (level && !args.length) {
- args.push(level);
- level = 'debug';
- }
- if (level === 'debug' && !this.debug) {
- return;
- }
- var prefix = level.toUpperCase() + ': (Adapter)';
- if (console[level]) {
- var _console;
-
- (_console = console)[level].apply(_console, [prefix].concat(args));
- } else {
- var _console2;
-
- (_console2 = console).log.apply(_console2, [prefix].concat(args));
- }
- },
-
-
- /**
- * Retrieve sum of the specified field of the records that match the selection
- * query. Called by `Mapper#sum`.
- *
- * @name Adapter#sum
- * @method
- * @param {Object} mapper The mapper.
- * @param {string} field By to sum.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- sum: function sum(mapper, field, query, opts) {
- var self = this;
- var op = void 0;
- if (!jsData.utils.isString(field)) {
- throw new Error('field must be a string!');
- }
- query || (query = {});
- opts || (opts = {});
-
- // beforeSum lifecycle hook
- op = opts.op = 'beforeSum';
- return jsData.utils.resolve(self[op](mapper, field, query, opts)).then(function () {
- // Allow for re-assignment from lifecycle hook
- op = opts.op = 'sum';
- self.dbg(op, mapper, field, query, opts);
- return jsData.utils.resolve(self._sum(mapper, field, query, opts));
- }).then(function (results) {
- var _results8 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results8[0];
- var result = _results8[1];
-
- result || (result = {});
- var response = new Response(data, result, op);
- response = self.respond(response, opts);
-
- // afterSum lifecycle hook
- op = opts.op = 'afterSum';
- return jsData.utils.resolve(self[op](mapper, field, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * @name Adapter#respond
- * @method
- * @param {Object} response Response object.
- * @param {Object} opts Configuration options.
- * return {Object} If `opts.raw == true` then return `response`, else return
- * `response.data`.
- */
- respond: function respond(response, opts) {
- return this.getOpt('raw', opts) ? response : response.data;
- },
-
-
- /**
- * Apply the given update to the record with the specified primary key. Called
- * by `Mapper#update`.
- *
- * @name Adapter#update
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id The primary key of the record to be updated.
- * @param {Object} props The update to apply to the record.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- update: function update(mapper, id, props, opts) {
- var self = this;
- props || (props = {});
- opts || (opts = {});
- var op = void 0;
-
- // beforeUpdate lifecycle hook
- op = opts.op = 'beforeUpdate';
- return jsData.utils.resolve(self[op](mapper, id, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- op = opts.op = 'update';
- self.dbg(op, mapper, id, props, opts);
- return jsData.utils.resolve(self._update(mapper, id, props, opts));
- }).then(function (results) {
- var _results9 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results9[0];
- var result = _results9[1];
-
- result || (result = {});
- var response = new Response(data, result, 'update');
- response.updated = data ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterUpdate lifecycle hook
- op = opts.op = 'afterUpdate';
- return jsData.utils.resolve(self[op](mapper, id, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Apply the given update to all records that match the selection query.
- * Called by `Mapper#updateAll`.
- *
- * @name Adapter#updateAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The update to apply to the selected records.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- updateAll: function updateAll(mapper, props, query, opts) {
- var self = this;
- props || (props = {});
- query || (query = {});
- opts || (opts = {});
- var op = void 0;
-
- // beforeUpdateAll lifecycle hook
- op = opts.op = 'beforeUpdateAll';
- return jsData.utils.resolve(self[op](mapper, props, query, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- op = opts.op = 'updateAll';
- self.dbg(op, mapper, props, query, opts);
- return jsData.utils.resolve(self._updateAll(mapper, props, query, opts));
- }).then(function (results) {
- var _results10 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results10[0];
- var result = _results10[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'updateAll');
- response.updated = data.length;
- response = self.respond(response, opts);
-
- // afterUpdateAll lifecycle hook
- op = opts.op = 'afterUpdateAll';
- return jsData.utils.resolve(self[op](mapper, props, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Update the given records in a single batch. Called by `Mapper#updateMany`.
- *
- * @name Adapter#updateMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object[]} records The records to update.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- updateMany: function updateMany(mapper, records, opts) {
- var self = this;
- records || (records = []);
- opts || (opts = {});
- var op = void 0;
- var idAttribute = mapper.idAttribute;
-
- records = records.filter(function (record) {
- return jsData.utils.get(record, idAttribute);
- });
-
- // beforeUpdateMany lifecycle hook
- op = opts.op = 'beforeUpdateMany';
- return jsData.utils.resolve(self[op](mapper, records, opts)).then(function (_records) {
- // Allow for re-assignment from lifecycle hook
- records = jsData.utils.isUndefined(_records) ? records : _records;
- records = records.map(function (record) {
- return withoutRelations(mapper, record);
- });
- op = opts.op = 'updateMany';
- self.dbg(op, mapper, records, opts);
- return jsData.utils.resolve(self._updateMany(mapper, records, opts));
- }).then(function (results) {
- var _results11 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results11[0];
- var result = _results11[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'updateMany');
- response.updated = data.length;
- response = self.respond(response, opts);
-
- // afterUpdateMany lifecycle hook
- op = opts.op = 'afterUpdateMany';
- return jsData.utils.resolve(self[op](mapper, records, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- }
- });
-
- module.exports = Adapter;
-
- }));
- //# sourceMappingURL=js-data-adapter.js.map
-
-/***/ },
-/* 3 */
-/***/ function(module, exports) {
-
- module.exports = undefined;
-
-/***/ }
-/******/ ])
-});
-;
-//# sourceMappingURL=js-data-fetch.js.map
\ No newline at end of file
diff --git a/fetch/dist/js-data-fetch.js.map b/fetch/dist/js-data-fetch.js.map
deleted file mode 100644
index 6710742..0000000
--- a/fetch/dist/js-data-fetch.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 27f47e9c2e60000cdeca","webpack:///./src/index.js","webpack:///external {\"amd\":\"js-data\",\"commonjs\":\"js-data\",\"commonjs2\":\"js-data\",\"root\":\"JSData\"}","webpack:///./~/js-data-adapter/dist/js-data-adapter.js","webpack:///external \"undefined\""],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;;;;;ACpCA;;AACA;;;;;;;AAFA,KAAM,QAAQ,oBAAQ,CAAR,CAAR;;;AAIN,KAAI,WAAW,KAAX;;AAEJ,KAAI;AACF,cAAW,UAAU,OAAO,KAAP,CADnB;EAAJ,CAEE,OAAO,CAAP,EAAU,EAAV;;AAEF,KAAM,OAAO,SAAP,IAAO,GAAmB;AAC9B,OAAM,OAAO,IAAP,CADwB;;qCAAN;;IAAM;;AAE9B,OAAM,OAAO,KAAK,KAA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QAAQ;AACrB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,iBAAgB,OAAO;AACvB,iBAAgB,OAAO;AACvB;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa,OAAO;AACpB;AACA,cAAa,OAAO;AACpB;AACA,eAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,oBAAoB,eAAe;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,6BAA6B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,8BAA8B,eAAe;AAC9E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,mBAAmB,0BAA0B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,mBAAmB,0BAA0B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,+BAA+B,eAAe;AAC7E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,gCAAgC,eAAe;AAChF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,oBAAoB,eAAe;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,iCAAiC,eAAe;AAC/E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,kCAAkC,eAAe;AAClF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,kCAAkC,eAAe;AAClF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE,eAAe;AACvF;AACA;;AAEA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA,UAAS;AACT,QAAO;AACP;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA,oDAAmD;AACnD;AACA;AACA,kBAAiB;AACjB,gBAAe;AACf,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB;AACA,gBAAe;AACf;AACA,cAAa;AACb;AACA,UAAS;;AAET;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA,UAAS;AACT,QAAO;AACP;AACA,gDAA+C;AAC/C;AACA;AACA,cAAa;AACb,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,YAAW;AACX,UAAS;AACT;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,UAAS;;AAET;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,cAAa;AACb,YAAW;AACX,UAAS;AACT;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,gBAAe,SAAS;AACxB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA,UAAS;;AAET;AACA,QAAO;AACP,+CAA8C;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,gBAAe,SAAS;AACxB,iBAAgB;AAChB;AACA;AACA;AACA,yBAAwB;AACxB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA,QAAO;AACP,gDAA+C;AAC/C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,iBAAgB,EAAE;AAClB;AACA;AACA,yBAAwB;AACxB;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,KAAK;AACpB;AACA;AACA,6FAA4F,eAAe;AAC3G;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAO;AACP;;AAEA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA,2BAA0B;AAC1B,2BAA0B;AAC1B,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAwB;AACxB;AACA;;AAEA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP;AACA,IAAG;;AAEH;;AAEA,EAAC;AACD,4C;;;;;;AC3lDA,4B","file":"./fetch/dist/js-data-fetch.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"js-data\"), require(\"undefined\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"js-data\", \"undefined\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"HttpAdapter\"] = factory(require(\"js-data\"), require(\"undefined\"));\n\telse\n\t\troot[\"HttpAdapter\"] = factory(root[\"JSData\"], root[\"undefined\"]);\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 27f47e9c2e60000cdeca\n **/","/* global fetch:true Headers:true Request:true */\nconst axios = require('axios')\nimport {utils} from 'js-data'\nimport Adapter from 'js-data-adapter'\n\nlet hasFetch = false\n\ntry {\n hasFetch = window && window.fetch\n} catch (e) {}\n\nconst noop = function (...args) {\n const self = this\n const opts = args[args.length - 1]\n self.dbg(opts.op, ...args)\n return utils.resolve()\n}\n\nconst noop2 = function (...args) {\n const self = this\n const opts = args[args.length - 2]\n self.dbg(opts.op, ...args)\n return utils.resolve()\n}\n\nfunction isValidString (value) {\n return (value != null && value !== '')\n}\nfunction join (items, separator) {\n separator || (separator = '')\n return items.filter(isValidString).join(separator)\n}\nfunction makePath (...args) {\n let result = join(args, '/')\n return result.replace(/([^:\\/]|^)\\/{2,}/g, '$1/')\n}\n\nfunction encode (val) {\n return encodeURIComponent(val)\n .replace(/%40/gi, '@')\n .replace(/%3A/gi, ':')\n .replace(/%24/g, '$')\n .replace(/%2C/gi, ',')\n .replace(/%20/g, '+')\n .replace(/%5B/gi, '[')\n .replace(/%5D/gi, ']')\n}\n\nfunction buildUrl (url, params) {\n if (!params) {\n return url\n }\n\n const parts = []\n\n utils.forOwn(params, function (val, key) {\n if (val === null || typeof val === 'undefined') {\n return\n }\n if (!utils.isArray(val)) {\n val = [val]\n }\n\n val.forEach(function (v) {\n if (window.toString.call(v) === '[object Date]') {\n v = v.toISOString()\n } else if (utils.isObject(v)) {\n v = utils.toJson(v)\n }\n parts.push(`${encode(key)}=${encode(v)}`)\n })\n })\n\n if (parts.length > 0) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&')\n }\n\n return url\n}\n\nconst __super__ = Adapter.prototype\n\nconst DEFAULTS = {\n // Default and user-defined settings\n /**\n * @name HttpAdapter#basePath\n * @type {string}\n */\n basePath: '',\n\n /**\n * @name HttpAdapter#forceTrailingSlash\n * @type {boolean}\n * @default false\n */\n forceTrailingSlash: false,\n\n /**\n * @name HttpAdapter#http\n * @type {Function}\n */\n http: axios,\n\n /**\n * @name HttpAdapter#httpConfig\n * @type {Object}\n */\n httpConfig: {},\n\n /**\n * @name HttpAdapter#suffix\n * @type {string}\n */\n suffix: '',\n\n /**\n * @name HttpAdapter#useFetch\n * @type {boolean}\n * @default false\n */\n useFetch: false\n}\n\n/**\n * HttpAdapter class.\n *\n * @class HttpAdapter\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.basePath=''] TODO\n * @param {boolean} [opts.debug=false] TODO\n * @param {boolean} [opts.forceTrailingSlash=false] TODO\n * @param {Object} [opts.http=axios] TODO\n * @param {Object} [opts.httpConfig={}] TODO\n * @param {string} [opts.suffix=''] TODO\n * @param {boolean} [opts.useFetch=false] TODO\n */\nfunction HttpAdapter (opts) {\n const self = this\n opts || (opts = {})\n utils.fillIn(opts, DEFAULTS)\n Adapter.call(self, opts)\n}\n\n// Setup prototype inheritance from Adapter\nHttpAdapter.prototype = Object.create(Adapter.prototype, {\n constructor: {\n value: HttpAdapter,\n enumerable: false,\n writable: true,\n configurable: true\n }\n})\n\nObject.defineProperty(HttpAdapter, '__super__', {\n configurable: true,\n value: Adapter\n})\n\nutils.addHiddenPropsToTarget(HttpAdapter.prototype, {\n /**\n * @name HttpAdapter#afterDEL\n * @method\n * @param {string} url\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterDEL: noop2,\n\n /**\n * @name HttpAdapter#afterGET\n * @method\n * @param {string} url\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterGET: noop2,\n\n /**\n * @name HttpAdapter#afterHTTP\n * @method\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterHTTP: noop2,\n\n /**\n * @name HttpAdapter#afterPOST\n * @method\n * @param {string} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterPOST: noop2,\n\n /**\n * @name HttpAdapter#afterPUT\n * @method\n * @param {string} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterPUT: noop2,\n\n /**\n * @name HttpAdapter#beforeDEL\n * @method\n * @param {Object} url\n * @param {Object} config\n * @param {Object} opts\n */\n beforeDEL: noop,\n\n /**\n * @name HttpAdapter#beforeGET\n * @method\n * @param {Object} url\n * @param {Object} config\n * @param {Object} opts\n */\n beforeGET: noop,\n\n /**\n * @name HttpAdapter#beforeHTTP\n * @method\n * @param {Object} config\n * @param {Object} opts\n */\n beforeHTTP: noop,\n\n /**\n * @name HttpAdapter#beforePOST\n * @method\n * @param {Object} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n */\n beforePOST: noop,\n\n /**\n * @name HttpAdapter#beforePUT\n * @method\n * @param {Object} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n */\n beforePUT: noop,\n\n _count (mapper, query, opts) {\n const self = this\n return self.GET(\n self.getPath('count', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _create (mapper, props, opts) {\n const self = this\n return self.POST(\n self.getPath('create', mapper, props, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _createMany (mapper, props, opts) {\n const self = this\n return self.POST(\n self.getPath('createMany', mapper, null, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _destroy (mapper, id, opts) {\n const self = this\n return self.DEL(\n self.getPath('destroy', mapper, id, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _destroyAll (mapper, query, opts) {\n const self = this\n return self.DEL(\n self.getPath('destroyAll', mapper, null, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _end (mapper, opts, response) {\n return [this.deserialize(mapper, response, opts), response]\n },\n\n _find (mapper, id, opts) {\n const self = this\n return self.GET(\n self.getPath('find', mapper, id, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _findAll (mapper, query, opts) {\n const self = this\n return self.GET(\n self.getPath('findAll', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _sum (mapper, field, query, opts) {\n const self = this\n return self.GET(\n self.getPath('sum', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _update (mapper, id, props, opts) {\n const self = this\n return self.PUT(\n self.getPath('update', mapper, id, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _updateAll (mapper, props, query, opts) {\n const self = this\n return self.PUT(\n self.getPath('updateAll', mapper, null, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _updateMany (mapper, records, opts) {\n const self = this\n return self.PUT(\n self.getPath('updateMany', mapper, null, opts),\n self.serialize(mapper, records, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n /**\n * Retrieve the number of records that match the selection `query`.\n *\n * @name HttpAdapter#count\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n count (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params.count = true\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.count.call(self, mapper, query, opts)\n },\n\n /**\n * Create a new the record from the provided `props`.\n *\n * @name HttpAdapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props Properties to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n create (mapper, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.create.call(self, mapper, props, opts)\n },\n\n /**\n * Create multiple new records in batch.\n *\n * @name HttpAdapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Array} props Array of property objects to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n createMany (mapper, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.createMany.call(self, mapper, props, opts)\n },\n\n /**\n * Make an Http request to `url` according to the configuration in `config`.\n *\n * @name HttpAdapter#DEL\n * @method\n * @param {string} url Url for the request.\n * @param {Object} [config] Http configuration that will be passed to\n * {@link HttpAdapter#HTTP}.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n DEL (url, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.method = config.method || 'delete'\n\n // beforeDEL lifecycle hook\n op = opts.op = 'beforeDEL'\n return utils.resolve(self[op](url, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'DEL'\n self.dbg(op, url, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterDEL lifecycle hook\n op = opts.op = 'afterDEL'\n return utils.resolve(self[op](url, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * Transform the server response object into the payload that will be returned\n * to JSData.\n *\n * @name HttpAdapter#deserialize\n * @method\n * @param {Object} mapper The mapper used for the operation.\n * @param {Object} response Response object from {@link HttpAdapter#HTTP}.\n * @param {Object} opts Configuration options.\n * @return {(Object|Array)} Deserialized data.\n */\n deserialize (mapper, response, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.deserialize)) {\n return opts.deserialize(mapper, response, opts)\n }\n if (utils.isFunction(mapper.deserialize)) {\n return mapper.deserialize(mapper, response, opts)\n }\n if (response && response.hasOwnProperty('data')) {\n return response.data\n }\n return response\n },\n\n /**\n * Destroy the record with the given primary key.\n *\n * @name HttpAdapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.destroy.call(self, mapper, id, opts)\n },\n\n /**\n * Destroy the records that match the selection `query`.\n *\n * @name HttpAdapter#destroyAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n destroyAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.destroyAll.call(self, mapper, query, opts)\n },\n\n /**\n * Log an error.\n *\n * @name HttpAdapter#error\n * @method\n * @param {...*} [args] Arguments to log.\n */\n error (...args) {\n if (console) {\n console[typeof console.error === 'function' ? 'error' : 'log'](...args)\n }\n },\n\n /**\n * Make an Http request using `window.fetch`.\n *\n * @name HttpAdapter#fetch\n * @method\n * @param {Object} config Request configuration.\n * @param {Object} config.data Payload for the request.\n * @param {string} config.method Http method for the request.\n * @param {Object} config.headers Headers for the request.\n * @param {Object} config.params Querystring for the request.\n * @param {string} config.url Url for the request.\n * @param {Object} [opts] Configuration options.\n */\n fetch (config, opts) {\n const requestConfig = {\n method: config.method,\n // turn the plain headers object into the Fetch Headers object\n headers: new Headers(config.headers)\n }\n\n if (config.data) {\n requestConfig.body = utils.toJson(config.data)\n }\n\n return fetch(new Request(buildUrl(config.url, config.params), requestConfig)).then(function (response) {\n response.config = {\n method: config.method,\n url: config.url\n }\n return response.json().then(function (data) {\n response.data = data\n return response\n })\n })\n },\n\n /**\n * Retrieve the record with the given primary key.\n *\n * @name HttpAdapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.find.call(self, mapper, id, opts)\n },\n\n /**\n * Retrieve the records that match the selection `query`.\n *\n * @name HttpAdapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n findAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.findAll.call(self, mapper, query, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#GET\n * @method\n * @param {string} url The url for the request.\n * @param {Object} config Request configuration options.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n GET (url, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.method = config.method || 'get'\n\n // beforeGET lifecycle hook\n op = opts.op = 'beforeGET'\n return utils.resolve(self[op](url, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'GET'\n self.dbg(op, url, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterGET lifecycle hook\n op = opts.op = 'afterGET'\n return utils.resolve(self[op](url, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * @name HttpAdapter#getEndpoint\n * @method\n * @param {Object} mapper TODO\n * @param {*} id TODO\n * @param {boolean} opts TODO\n * @return {string} Full path.\n */\n getEndpoint (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = utils.isUndefined(opts.params) ? {} : opts.params\n const relationList = mapper.relationList || []\n let endpoint = utils.isUndefined(opts.endpoint) ? (utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint) : opts.endpoint\n\n relationList.forEach(function (def) {\n if (def.type !== 'belongsTo' || !def.parent) {\n return\n }\n let item\n const parentKey = def.foreignKey\n const parentDef = def.getRelation()\n let parentId = opts.params[parentKey]\n\n if (parentId === false || !parentKey || !parentDef) {\n if (parentId === false) {\n delete opts.params[parentKey]\n }\n return false\n } else {\n delete opts.params[parentKey]\n\n if (utils.isObject(id)) {\n item = id\n }\n\n if (item) {\n parentId = parentId || def.getForeignKey(item) || (def.getLocalField(item) ? utils.get(def.getLocalField(item), parentDef.idAttribute) : null)\n }\n\n if (parentId) {\n delete opts.endpoint\n const _opts = {}\n utils.forOwn(opts, function (value, key) {\n _opts[key] = value\n })\n utils._(_opts, parentDef)\n endpoint = makePath(self.getEndpoint(parentDef, parentId, _opts), parentId, endpoint)\n return false\n }\n }\n })\n\n return endpoint\n },\n\n /**\n * @name HttpAdapter#getPath\n * @method\n * @param {string} method TODO\n * @param {Object} mapper TODO\n * @param {(string|number)?} id TODO\n * @param {Object} opts Configuration options.\n */\n getPath (method, mapper, id, opts) {\n const self = this\n opts || (opts = {})\n const args = [\n utils.isUndefined(opts.basePath) ? (utils.isUndefined(mapper.basePath) ? self.basePath : mapper.basePath) : opts.basePath,\n self.getEndpoint(mapper, (utils.isString(id) || utils.isNumber(id) || method === 'create') ? id : null, opts)\n ]\n if (method === 'find' || method === 'update' || method === 'destroy') {\n args.push(id)\n }\n return makePath.apply(utils, args)\n },\n\n getParams (opts) {\n opts || (opts = {})\n if (utils.isUndefined(opts.params)) {\n return {}\n }\n return utils.copy(opts.params)\n },\n\n getSuffix (mapper, opts) {\n opts || (opts = {})\n if (utils.isUndefined(opts.suffix)) {\n if (utils.isUndefined(mapper.suffix)) {\n return this.suffix\n }\n return mapper.suffix\n }\n return opts.suffix\n },\n\n /**\n * Make an Http request.\n *\n * @name HttpAdapter#HTTP\n * @method\n * @param {Object} config Request configuration options.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n HTTP (config, opts) {\n const self = this\n const start = new Date()\n opts || (opts = {})\n const payload = config.data\n const cache = config.cache\n const timeout = config.timeout\n config = utils.copy(config, null, null, null, ['data', 'cache', 'timeout'])\n config = utils.deepMixIn(config, self.httpConfig)\n config.data = payload\n config.cache = cache\n config.timeout = timeout\n if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {\n config.url += '/'\n }\n config.method = config.method.toUpperCase()\n const suffix = config.suffix || opts.suffix || self.suffix\n if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {\n config.url += suffix\n }\n\n function logResponse (data) {\n const str = `${start.toUTCString()} - ${config.method.toUpperCase()} ${config.url} - ${data.status} ${(new Date().getTime() - start.getTime())}ms`\n if (data.status >= 200 && data.status < 300) {\n if (self.log) {\n self.dbg('debug', str, data)\n }\n return data\n } else {\n if (self.error) {\n self.error(`'FAILED: ${str}`, data)\n }\n return utils.reject(data)\n }\n }\n\n if (!self.http) {\n throw new Error('You have not configured this adapter with an http library!')\n }\n\n return utils.resolve(self.beforeHTTP(config, opts)).then(function (_config) {\n config = _config || config\n if (hasFetch && (self.useFetch || opts.useFetch || !self.http)) {\n return self.fetch(config, opts).then(logResponse, logResponse)\n }\n return self.http(config).then(logResponse, logResponse).catch(function (err) {\n return self.responseError(err, config, opts)\n })\n }).then(function (response) {\n return utils.resolve(self.afterHTTP(config, opts, response)).then(function (_response) {\n return _response || response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#POST\n * @method\n * @param {*} url TODO\n * @param {Object} data TODO\n * @param {Object} config TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n POST (url, data, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.data = data || config.data\n config.method = config.method || 'post'\n\n // beforePOST lifecycle hook\n op = opts.op = 'beforePOST'\n return utils.resolve(self[op](url, data, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'POST'\n self.dbg(op, url, data, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterPOST lifecycle hook\n op = opts.op = 'afterPOST'\n return utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#PUT\n * @method\n * @param {*} url TODO\n * @param {Object} data TODO\n * @param {Object} config TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n PUT (url, data, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.data = data || config.data\n config.method = config.method || 'put'\n\n // beforePUT lifecycle hook\n op = opts.op = 'beforePUT'\n return utils.resolve(self[op](url, data, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'PUT'\n self.dbg(op, url, data, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterPUT lifecycle hook\n op = opts.op = 'afterPUT'\n return utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#queryTransform\n * @method\n * @param {Object} mapper TODO\n * @param {*} params TODO\n * @param {*} opts TODO\n * @return {*} Transformed params.\n */\n queryTransform (mapper, params, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.queryTransform)) {\n return opts.queryTransform(mapper, params, opts)\n }\n if (utils.isFunction(mapper.queryTransform)) {\n return mapper.queryTransform(mapper, params, opts)\n }\n return params\n },\n\n /**\n * Error handler invoked when the promise returned by {@link HttpAdapter#http}\n * is rejected. Default implementation is to just return the error wrapped in\n * a rejected Promise, aka rethrow the error. {@link HttpAdapter#http} is\n * called by {@link HttpAdapter#HTTP}.\n *\n * @name HttpAdapter#responseError\n * @method\n * @param {*} err The error that {@link HttpAdapter#http} rejected with.\n * @param {Object} config The `config` argument that was passed to {@link HttpAdapter#HTTP}.\n * @param {*} opts The `opts` argument that was passed to {@link HttpAdapter#HTTP}.\n * @return {Promise}\n */\n responseError (err, config, opts) {\n return utils.reject(err)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#serialize\n * @method\n * @param {Object} mapper TODO\n * @param {Object} data TODO\n * @param {*} opts TODO\n * @return {*} Serialized data.\n */\n serialize (mapper, data, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.serialize)) {\n return opts.serialize(mapper, data, opts)\n }\n if (utils.isFunction(mapper.serialize)) {\n return mapper.serialize(mapper, data, opts)\n }\n return data\n },\n\n /**\n * Retrieve the sum of the field of the records that match the selection query.\n *\n * @name HttpAdapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field The field to sum.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n sum (mapper, field, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n if (!utils.utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts.params = self.getParams(opts)\n opts.params.sum = field\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.sum.call(self, mapper, field, query, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#update\n * @method\n * @param {Object} mapper TODO\n * @param {*} id TODO\n * @param {*} props TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n update (mapper, id, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.update.call(self, mapper, id, props, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#updateAll\n * @method\n * @param {Object} mapper TODO\n * @param {Object} props TODO\n * @param {Object} query TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n updateAll (mapper, props, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.updateAll.call(self, mapper, props, query, opts)\n },\n\n /**\n * Update multiple records in batch.\n *\n * {@link HttpAdapter#beforeUpdateMany} will be called before calling\n * {@link HttpAdapter#PUT}.\n * {@link HttpAdapter#afterUpdateMany} will be called after calling\n * {@link HttpAdapter#PUT}.\n *\n * @name HttpAdapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Array} records Array of property objects to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n updateMany (mapper, records, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.updateMany.call(self, mapper, records, opts)\n }\n})\n\n/**\n * Add an Http actions to a mapper.\n *\n * @name HttpAdapter.addAction\n * @method\n * @param {string} name Name of the new action.\n * @param {Object} [opts] Action configuration\n * @param {string} [opts.adapter]\n * @param {string} [opts.pathname]\n * @param {Function} [opts.request]\n * @param {Function} [opts.response]\n * @param {Function} [opts.responseError]\n * @return {Function} Decoration function, which should be passed the mapper to\n * decorate when invoked.\n */\nHttpAdapter.addAction = function (name, opts) {\n if (!name || !utils.isString(name)) {\n throw new TypeError('action(name[, opts]): Expected: string, Found: ' + typeof name)\n }\n return function (mapper) {\n if (mapper[name]) {\n throw new Error('action(name[, opts]): ' + name + ' already exists on target!')\n }\n opts.request = opts.request || function (config) { return config }\n opts.response = opts.response || function (response) { return response }\n opts.responseError = opts.responseError || function (err) { return utils.reject(err) }\n mapper[name] = function (id, _opts) {\n const self = this\n if (utils.isObject(id)) {\n _opts = id\n }\n _opts = _opts || {}\n let adapter = self.getAdapter(opts.adapter || self.defaultAdapter || 'http')\n let config = {}\n utils.fillIn(config, opts)\n if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {\n _opts.endpoint = config.endpoint\n }\n if (typeof _opts.getEndpoint === 'function') {\n config.url = _opts.getEndpoint(self, _opts)\n } else {\n let args = [\n _opts.basePath || self.basePath || adapter.basePath,\n adapter.getEndpoint(self, utils.isSorN(id) ? id : null, _opts)\n ]\n if (utils.isSorN(id)) {\n args.push(id)\n }\n args.push(opts.pathname || name)\n config.url = makePath.apply(null, args)\n }\n config.method = config.method || 'GET'\n config.mapper = self.name\n utils.deepMixIn(config)(_opts)\n return utils.resolve(config)\n .then(_opts.request || opts.request)\n .then(function (config) { return adapter.HTTP(config) })\n .then(function (data) {\n if (data && data.config) {\n data.config.mapper = self.name\n }\n return data\n })\n .then(_opts.response || opts.response, _opts.responseError || opts.responseError)\n }\n return mapper\n }\n}\n\n/**\n * Add multiple Http actions to a mapper. See {@link HttpAdapter.addAction} for\n * action configuration options.\n *\n * @name HttpAdapter.addActions\n * @method\n * @param {Object.} opts Object where the key is an action name\n * and the value is the configuration for the action.\n * @return {Function} Decoration function, which should be passed the mapper to\n * decorate when invoked.\n */\nHttpAdapter.addActions = function (opts) {\n opts || (opts = {})\n return function (mapper) {\n utils.forOwn(mapper, function (value, key) {\n HttpAdapter.addAction(key, value)(mapper)\n })\n return mapper\n }\n}\n\n/**\n * Alternative to ES6 class syntax for extending `HttpAdapter`.\n *\n * __ES6__:\n * ```javascript\n * class MyHttpAdapter extends HttpAdapter {\n * deserialize (Model, data, opts) {\n * const data = super.deserialize(Model, data, opts)\n * data.foo = 'bar'\n * return data\n * }\n * }\n * ```\n *\n * __ES5__:\n * ```javascript\n * var instanceProps = {\n * // override deserialize\n * deserialize: function (Model, data, opts) {\n * var Ctor = this.constructor\n * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize\n * // call the super deserialize\n * var data = superDeserialize(Model, data, opts)\n * data.foo = 'bar'\n * return data\n * },\n * say: function () { return 'hi' }\n * }\n * var classProps = {\n * yell: function () { return 'HI' }\n * }\n *\n * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps)\n * var adapter = new MyHttpAdapter()\n * adapter.say() // \"hi\"\n * MyHttpAdapter.yell() // \"HI\"\n * ```\n *\n * @name HttpAdapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Object} Subclass of `HttpAdapter`.\n */\nHttpAdapter.extend = utils.extend\n\n/**\n * Details of the current version of the `js-data-http` module.\n *\n * @name HttpAdapter.version\n * @type {Object}\n * @property {string} version.full The full semver value.\n * @property {number} version.major The major version number.\n * @property {number} version.minor The minor version number.\n * @property {number} version.patch The patch version number.\n * @property {(string|boolean)} version.alpha The alpha version value,\n * otherwise `false` if the current version is not alpha.\n * @property {(string|boolean)} version.beta The beta version value,\n * otherwise `false` if the current version is not beta.\n */\nHttpAdapter.version = '<%= version %>'\n\n/**\n * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http`\n * that works on Node.js is registered in NPM as `js-data-http-node`. The build\n * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower\n * as `js-data-fetch`.\n *\n * __Script tag__:\n * ```javascript\n * window.HttpAdapter\n * ```\n * __CommonJS__:\n * ```javascript\n * var HttpAdapter = require('js-data-http')\n * ```\n * __ES6 Modules__:\n * ```javascript\n * import HttpAdapter from 'js-data-http'\n * ```\n * __AMD__:\n * ```javascript\n * define('myApp', ['js-data-http'], function (HttpAdapter) { ... })\n * ```\n *\n * @module js-data-http\n */\n\nmodule.exports = HttpAdapter\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external {\"amd\":\"js-data\",\"commonjs\":\"js-data\",\"commonjs2\":\"js-data\",\"root\":\"JSData\"}\n ** module id = 1\n ** module chunks = 0\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('js-data')) :\n typeof define === 'function' && define.amd ? define('js-data-adapter', ['js-data'], factory) :\n (factory(global.JSData));\n}(this, function (jsData) { 'use strict';\n\n var babelHelpers = {};\n babelHelpers.typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n\n babelHelpers.defineProperty = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n };\n\n babelHelpers.slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n }();\n\n babelHelpers;\n\n var noop = function noop() {\n var self = this;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var opts = args[args.length - 1];\n self.dbg.apply(self, [opts.op].concat(args));\n return jsData.utils.resolve();\n };\n\n var noop2 = function noop2() {\n var self = this;\n\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var opts = args[args.length - 2];\n self.dbg.apply(self, [opts.op].concat(args));\n return jsData.utils.resolve();\n };\n\n var unique = function unique(array) {\n var seen = {};\n var final = [];\n array.forEach(function (item) {\n if (item in seen) {\n return;\n }\n final.push(item);\n seen[item] = 0;\n });\n return final;\n };\n\n var withoutRelations = function withoutRelations(mapper, props) {\n return jsData.utils.omit(props, mapper.relationFields || []);\n };\n\n var DEFAULTS = {\n /**\n * Whether to log debugging information.\n *\n * @name Adapter#debug\n * @type {boolean}\n * @default false\n */\n debug: false,\n\n /**\n * Whether to return a more detailed response object.\n *\n * @name Adapter#raw\n * @type {boolean}\n * @default false\n */\n raw: false\n };\n\n /**\n * Abstract class meant to be extended by adapters.\n *\n * @class Adapter\n * @abstract\n * @param {Object} [opts] Configuration opts.\n * @param {boolean} [opts.debug=false] Whether to log debugging information.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed response\n * object.\n */\n function Adapter(opts) {\n var self = this;\n opts || (opts = {});\n jsData.utils.fillIn(opts, DEFAULTS);\n jsData.utils.fillIn(self, opts);\n }\n\n Adapter.reserved = ['orderBy', 'sort', 'limit', 'offset', 'skip', 'where'];\n\n /**\n * Response object used when `raw` is `true`. May contain other fields in\n * addition to `data`.\n *\n * @typedef {Object} Response\n * @property {Object} data Response data.\n * @property {string} op The operation for which the response was created.\n */\n function Response(data, meta, op) {\n var self = this;\n meta || (meta = {});\n self.data = data;\n jsData.utils.fillIn(self, meta);\n self.op = op;\n }\n\n Adapter.Response = Response;\n\n /**\n * Alternative to ES6 class syntax for extending `Adapter`.\n *\n * @name Adapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Object} Subclass of `Adapter`.\n */\n Adapter.extend = jsData.utils.extend;\n\n jsData.utils.addHiddenPropsToTarget(Adapter.prototype, {\n /**\n * Lifecycle method method called by count.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes count to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the count.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.\n *\n * @name Adapter#afterCount\n * @method\n * @param {Object} mapper The `mapper` argument passed to count.\n * @param {Object} props The `props` argument passed to count.\n * @param {Object} opts The `opts` argument passed to count.\n * @property {string} opts.op `afterCount`\n * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCount: noop2,\n\n /**\n * Lifecycle method method called by create.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes create to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created record.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.\n *\n * @name Adapter#afterCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to create.\n * @param {Object} props The `props` argument passed to create.\n * @param {Object} opts The `opts` argument passed to create.\n * @property {string} opts.op `afterCreate`\n * @param {Object|Response} response Created record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCreate: noop2,\n\n /**\n * Lifecycle method method called by createMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created records.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.\n *\n * @name Adapter#afterCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to createMany.\n * @param {Object[]} props The `props` argument passed to createMany.\n * @param {Object} opts The `opts` argument passed to createMany.\n * @property {string} opts.op `afterCreateMany`\n * @param {Object[]|Response} response Created records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCreateMany: noop2,\n\n /**\n * Lifecycle method method called by destroy.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.\n *\n * @name Adapter#afterDestroy\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroy.\n * @param {(string|number)} id The `id` argument passed to destroy.\n * @param {Object} opts The `opts` argument passed to destroy.\n * @property {string} opts.op `afterDestroy`\n * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.\n */\n afterDestroy: noop2,\n\n /**\n * Lifecycle method method called by destroyAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.\n *\n * @name Adapter#afterDestroyAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroyAll.\n * @param {Object} query The `query` argument passed to destroyAll.\n * @param {Object} opts The `opts` argument passed to destroyAll.\n * @property {string} opts.op `afterDestroyAll`\n * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.\n */\n afterDestroyAll: noop2,\n\n /**\n * Lifecycle method method called by find.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes find to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found record, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.\n *\n * @name Adapter#afterFind\n * @method\n * @param {Object} mapper The `mapper` argument passed to find.\n * @param {(string|number)} id The `id` argument passed to find.\n * @param {Object} opts The `opts` argument passed to find.\n * @property {string} opts.op `afterFind`\n * @param {Object|Response} response The found record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterFind: noop2,\n\n /**\n * Lifecycle method method called by findAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.\n *\n * @name Adapter#afterFindAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to findAll.\n * @param {Object} query The `query` argument passed to findAll.\n * @param {Object} opts The `opts` argument passed to findAll.\n * @property {string} opts.op `afterFindAll`\n * @param {Object[]|Response} response The found records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterFindAll: noop2,\n\n /**\n * Lifecycle method method called by sum.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes sum to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the sum.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.\n *\n * @name Adapter#afterSum\n * @method\n * @param {Object} mapper The `mapper` argument passed to sum.\n * @param {Object} props The `props` argument passed to sum.\n * @param {Object} opts The `opts` argument passed to sum.\n * @property {string} opts.op `afterSum`\n * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.\n */\n afterSum: noop2,\n\n /**\n * Lifecycle method method called by update.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes update to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated record.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.\n *\n * @name Adapter#afterUpdate\n * @method\n * @param {Object} mapper The `mapper` argument passed to update.\n * @param {(string|number)} id The `id` argument passed to update.\n * @param {Object} props The `props` argument passed to update.\n * @param {Object} opts The `opts` argument passed to update.\n * @property {string} opts.op `afterUpdate`\n * @param {Object|Response} response The updated record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdate: noop2,\n\n /**\n * Lifecycle method method called by updateAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.\n *\n * @name Adapter#afterUpdateAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateAll.\n * @param {Object} props The `props` argument passed to updateAll.\n * @param {Object} query The `query` argument passed to updateAll.\n * @param {Object} opts The `opts` argument passed to updateAll.\n * @property {string} opts.op `afterUpdateAll`\n * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdateAll: noop2,\n\n /**\n * Lifecycle method method called by updateMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.\n *\n * @name Adapter#afterUpdateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateMany.\n * @param {Object[]} records The `records` argument passed to updateMany.\n * @param {Object} opts The `opts` argument passed to updateMany.\n * @property {string} opts.op `afterUpdateMany`\n * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdateMany: noop2,\n\n /**\n * Lifecycle method method called by count.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes count to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.\n *\n * @name Adapter#beforeCount\n * @method\n * @param {Object} mapper The `mapper` argument passed to count.\n * @param {Object} query The `query` argument passed to count.\n * @param {Object} opts The `opts` argument passed to count.\n * @property {string} opts.op `beforeCount`\n */\n beforeCount: noop,\n\n /**\n * Lifecycle method method called by create.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes create to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.\n *\n * @name Adapter#beforeCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to create.\n * @param {Object} props The `props` argument passed to create.\n * @param {Object} opts The `opts` argument passed to create.\n * @property {string} opts.op `beforeCreate`\n */\n beforeCreate: noop,\n\n /**\n * Lifecycle method method called by createMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.\n *\n * @name Adapter#beforeCreateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to createMany.\n * @param {Object[]} props The `props` argument passed to createMany.\n * @param {Object} opts The `opts` argument passed to createMany.\n * @property {string} opts.op `beforeCreateMany`\n */\n beforeCreateMany: noop,\n\n /**\n * Lifecycle method method called by destroy.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.\n *\n * @name Adapter#beforeDestroy\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroy.\n * @param {(string|number)} id The `id` argument passed to destroy.\n * @param {Object} opts The `opts` argument passed to destroy.\n * @property {string} opts.op `beforeDestroy`\n */\n beforeDestroy: noop,\n\n /**\n * Lifecycle method method called by destroyAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.\n *\n * @name Adapter#beforeDestroyAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroyAll.\n * @param {Object} query The `query` argument passed to destroyAll.\n * @param {Object} opts The `opts` argument passed to destroyAll.\n * @property {string} opts.op `beforeDestroyAll`\n */\n beforeDestroyAll: noop,\n\n /**\n * Lifecycle method method called by find.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes find to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.\n *\n * @name Adapter#beforeFind\n * @method\n * @param {Object} mapper The `mapper` argument passed to find.\n * @param {(string|number)} id The `id` argument passed to find.\n * @param {Object} opts The `opts` argument passed to find.\n * @property {string} opts.op `beforeFind`\n */\n beforeFind: noop,\n\n /**\n * Lifecycle method method called by findAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.\n *\n * @name Adapter#beforeFindAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to findAll.\n * @param {Object} query The `query` argument passed to findAll.\n * @param {Object} opts The `opts` argument passed to findAll.\n * @property {string} opts.op `beforeFindAll`\n */\n beforeFindAll: noop,\n\n /**\n * Lifecycle method method called by sum.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes sum to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.\n *\n * @name Adapter#beforeSum\n * @method\n * @param {Object} mapper The `mapper` argument passed to sum.\n * @param {Object} query The `query` argument passed to sum.\n * @param {Object} opts The `opts` argument passed to sum.\n * @property {string} opts.op `beforeSum`\n */\n beforeSum: noop,\n\n /**\n * Lifecycle method method called by update.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes update to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.\n *\n * @name Adapter#beforeUpdate\n * @method\n * @param {Object} mapper The `mapper` argument passed to update.\n * @param {(string|number)} id The `id` argument passed to update.\n * @param {Object} props The `props` argument passed to update.\n * @param {Object} opts The `opts` argument passed to update.\n * @property {string} opts.op `beforeUpdate`\n */\n beforeUpdate: noop,\n\n /**\n * Lifecycle method method called by updateAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.\n *\n * @name Adapter#beforeUpdateAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateAll.\n * @param {Object} props The `props` argument passed to updateAll.\n * @param {Object} query The `query` argument passed to updateAll.\n * @param {Object} opts The `opts` argument passed to updateAll.\n * @property {string} opts.op `beforeUpdateAll`\n */\n beforeUpdateAll: noop,\n\n /**\n * Lifecycle method method called by updateMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.\n *\n * @name Adapter#beforeUpdateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateMany.\n * @param {Object[]} props The `props` argument passed to updateMany.\n * @param {Object} opts The `opts` argument passed to updateMany.\n * @property {string} opts.op `beforeUpdateMany`\n */\n beforeUpdateMany: noop,\n\n /**\n * Shortcut for `#log('debug'[, arg1[, arg2[, argn]]])`.\n *\n * @name Adapter#dbg\n * @method\n */\n dbg: function dbg() {\n for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this.log.apply(this, ['debug'].concat(args));\n },\n\n\n /**\n * Retrieve the number of records that match the selection query. Called by\n * `Mapper#count`.\n *\n * @name Adapter#count\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n count: function count(mapper, query, opts) {\n var self = this;\n var op = void 0;\n query || (query = {});\n opts || (opts = {});\n\n // beforeCount lifecycle hook\n op = opts.op = 'beforeCount';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n // Allow for re-assignment from lifecycle hook\n op = opts.op = 'count';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._count(mapper, query, opts));\n }).then(function (results) {\n var _results = babelHelpers.slicedToArray(results, 2);\n\n var data = _results[0];\n var result = _results[1];\n\n result || (result = {});\n var response = new Response(data, result, op);\n response = self.respond(response, opts);\n\n // afterCount lifecycle hook\n op = opts.op = 'afterCount';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Create a new record. Called by `Mapper#create`.\n *\n * @name Adapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The record to be created.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n create: function create(mapper, props, opts) {\n var self = this;\n var op = void 0;\n props || (props = {});\n opts || (opts = {});\n\n // beforeCreate lifecycle hook\n op = opts.op = 'beforeCreate';\n return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n props = withoutRelations(mapper, props);\n op = opts.op = 'create';\n self.dbg(op, mapper, props, opts);\n return jsData.utils.resolve(self._create(mapper, props, opts));\n }).then(function (results) {\n var _results2 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results2[0];\n var result = _results2[1];\n\n result || (result = {});\n var response = new Response(data, result, 'create');\n response.created = data ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterCreate lifecycle hook\n op = opts.op = 'afterCreate';\n return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Create multiple records in a single batch. Called by `Mapper#createMany`.\n *\n * @name Adapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The records to be created.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n createMany: function createMany(mapper, props, opts) {\n var self = this;\n var op = void 0;\n props || (props = {});\n opts || (opts = {});\n\n // beforeCreateMany lifecycle hook\n op = opts.op = 'beforeCreateMany';\n return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n props = props.map(function (record) {\n return withoutRelations(mapper, record);\n });\n op = opts.op = 'createMany';\n self.dbg(op, mapper, props, opts);\n return jsData.utils.resolve(self._createMany(mapper, props, opts));\n }).then(function (results) {\n var _results3 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results3[0];\n var result = _results3[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'createMany');\n response.created = data.length;\n response = self.respond(response, opts);\n\n // afterCreateMany lifecycle hook\n op = opts.op = 'afterCreateMany';\n return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Destroy the record with the given primary key. Called by\n * `Mapper#destroy`.\n *\n * @name Adapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n destroy: function destroy(mapper, id, opts) {\n var self = this;\n var op = void 0;\n opts || (opts = {});\n\n // beforeDestroy lifecycle hook\n op = opts.op = 'beforeDestroy';\n return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {\n op = opts.op = 'destroy';\n self.dbg(op, mapper, id, opts);\n return jsData.utils.resolve(self._destroy(mapper, id, opts));\n }).then(function (results) {\n var _results4 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results4[0];\n var result = _results4[1];\n\n result || (result = {});\n var response = new Response(data, result, 'destroy');\n response = self.respond(response, opts);\n\n // afterDestroy lifecycle hook\n op = opts.op = 'afterDestroy';\n return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Destroy the records that match the selection query. Called by\n * `Mapper#destroyAll`.\n *\n * @name Adapter#destroyAll\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n destroyAll: function destroyAll(mapper, query, opts) {\n var self = this;\n var op = void 0;\n query || (query = {});\n opts || (opts = {});\n\n // beforeDestroyAll lifecycle hook\n op = opts.op = 'beforeDestroyAll';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n op = opts.op = 'destroyAll';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._destroyAll(mapper, query, opts));\n }).then(function (results) {\n var _results5 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results5[0];\n var result = _results5[1];\n\n result || (result = {});\n var response = new Response(data, result, 'destroyAll');\n response = self.respond(response, opts);\n\n // afterDestroyAll lifecycle hook\n op = opts.op = 'afterDestroyAll';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Return the foreignKey from the given record for the provided relationship.\n *\n * There may be reasons why you may want to override this method, like when\n * the id of the parent doesn't exactly match up to the key on the child.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyForeignKey\n * @method\n * @return {*}\n */\n makeHasManyForeignKey: function makeHasManyForeignKey(mapper, def, record) {\n return def.getForeignKey(record);\n },\n\n\n /**\n * Return the localKeys from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyLocalKeys\n * @method\n * @return {*}\n */\n makeHasManyLocalKeys: function makeHasManyLocalKeys(mapper, def, record) {\n var localKeys = [];\n var itemKeys = jsData.utils.get(record, def.localKeys) || [];\n itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);\n localKeys = localKeys.concat(itemKeys);\n return unique(localKeys).filter(function (x) {\n return x;\n });\n },\n\n\n /**\n * Return the foreignKeys from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyForeignKeys\n * @method\n * @return {*}\n */\n makeHasManyForeignKeys: function makeHasManyForeignKeys(mapper, def, record) {\n return jsData.utils.get(record, mapper.idAttribute);\n },\n\n\n /**\n * Load a hasMany relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadHasMany\n * @method\n * @return {Promise}\n */\n loadHasMany: function loadHasMany(mapper, def, records, __opts) {\n var self = this;\n var singular = false;\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n singular = true;\n records = [records];\n }\n var IDs = records.map(function (record) {\n return self.makeHasManyForeignKey(mapper, def, record);\n });\n var query = {\n where: {}\n };\n var criteria = query.where[def.foreignKey] = {};\n if (singular) {\n // more efficient query when we only have one record\n criteria['=='] = IDs[0];\n } else {\n criteria['in'] = IDs.filter(function (id) {\n return id;\n });\n }\n return self.findAll(def.getRelation(), query, __opts).then(function (relatedItems) {\n records.forEach(function (record) {\n var attached = [];\n // avoid unneccesary iteration when we only have one record\n if (singular) {\n attached = relatedItems;\n } else {\n relatedItems.forEach(function (relatedItem) {\n if (jsData.utils.get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {\n attached.push(relatedItem);\n }\n });\n }\n def.setLocalField(record, attached);\n });\n });\n },\n loadHasManyLocalKeys: function loadHasManyLocalKeys(mapper, def, records, __opts) {\n var self = this;\n var record = void 0;\n var relatedMapper = def.getRelation();\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n record = records;\n }\n\n if (record) {\n return self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {\n 'in': self.makeHasManyLocalKeys(mapper, def, record)\n })\n }, __opts).then(function (relatedItems) {\n def.setLocalField(record, relatedItems);\n });\n } else {\n var _ret = function () {\n var localKeys = [];\n records.forEach(function (record) {\n localKeys = localKeys.concat(self.self.makeHasManyLocalKeys(mapper, def, record));\n });\n return {\n v: self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {\n 'in': unique(localKeys).filter(function (x) {\n return x;\n })\n })\n }, __opts).then(function (relatedItems) {\n records.forEach(function (item) {\n var attached = [];\n var itemKeys = jsData.utils.get(item, def.localKeys) || [];\n itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);\n relatedItems.forEach(function (relatedItem) {\n if (itemKeys && itemKeys.indexOf(relatedItem[relatedMapper.idAttribute]) !== -1) {\n attached.push(relatedItem);\n }\n });\n def.setLocalField(item, attached);\n });\n return relatedItems;\n })\n };\n }();\n\n if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === \"object\") return _ret.v;\n }\n },\n loadHasManyForeignKeys: function loadHasManyForeignKeys(mapper, def, records, __opts) {\n var self = this;\n var relatedMapper = def.getRelation();\n var idAttribute = mapper.idAttribute;\n var record = void 0;\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n record = records;\n }\n\n if (record) {\n return self.findAll(def.getRelation(), {\n where: babelHelpers.defineProperty({}, def.foreignKeys, {\n 'contains': self.makeHasManyForeignKeys(mapper, def, record)\n })\n }, __opts).then(function (relatedItems) {\n def.setLocalField(record, relatedItems);\n });\n } else {\n return self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, def.foreignKeys, {\n 'isectNotEmpty': records.map(function (record) {\n return self.makeHasManyForeignKeys(mapper, def, record);\n })\n })\n }, __opts).then(function (relatedItems) {\n var foreignKeysField = def.foreignKeys;\n records.forEach(function (record) {\n var _relatedItems = [];\n var id = jsData.utils.get(record, idAttribute);\n relatedItems.forEach(function (relatedItem) {\n var foreignKeys = jsData.utils.get(relatedItems, foreignKeysField) || [];\n if (foreignKeys.indexOf(id) !== -1) {\n _relatedItems.push(relatedItem);\n }\n });\n def.setLocalField(record, _relatedItems);\n });\n });\n }\n },\n\n\n /**\n * Load a hasOne relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadHasOne\n * @method\n * @return {Promise}\n */\n loadHasOne: function loadHasOne(mapper, def, records, __opts) {\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n records = [records];\n }\n return this.loadHasMany(mapper, def, records, __opts).then(function () {\n records.forEach(function (record) {\n var relatedData = def.getLocalField(record);\n if (jsData.utils.isArray(relatedData) && relatedData.length) {\n def.setLocalField(record, relatedData[0]);\n }\n });\n });\n },\n\n\n /**\n * Return the foreignKey from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeBelongsToForeignKey\n * @method\n * @return {*}\n */\n makeBelongsToForeignKey: function makeBelongsToForeignKey(mapper, def, record) {\n return def.getForeignKey(record);\n },\n\n\n /**\n * Load a belongsTo relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadBelongsTo\n * @method\n * @return {Promise}\n */\n loadBelongsTo: function loadBelongsTo(mapper, def, records, __opts) {\n var self = this;\n var relationDef = def.getRelation();\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n var _ret2 = function () {\n var record = records;\n return {\n v: self.find(relationDef, self.makeBelongsToForeignKey(mapper, def, record), __opts).then(function (relatedItem) {\n def.setLocalField(record, relatedItem);\n })\n };\n }();\n\n if ((typeof _ret2 === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret2)) === \"object\") return _ret2.v;\n } else {\n var keys = records.map(function (record) {\n return self.makeBelongsToForeignKey(mapper, def, record);\n }).filter(function (key) {\n return key;\n });\n return self.findAll(relationDef, {\n where: babelHelpers.defineProperty({}, relationDef.idAttribute, {\n 'in': keys\n })\n }, __opts).then(function (relatedItems) {\n records.forEach(function (record) {\n relatedItems.forEach(function (relatedItem) {\n if (relatedItem[relationDef.idAttribute] === record[def.foreignKey]) {\n def.setLocalField(record, relatedItem);\n }\n });\n });\n });\n }\n },\n\n\n /**\n * Retrieve the record with the given primary key. Called by `Mapper#find`.\n *\n * @name Adapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n find: function find(mapper, id, opts) {\n var self = this;\n var record = void 0,\n op = void 0;\n opts || (opts = {});\n opts.with || (opts.with = []);\n\n // beforeFind lifecycle hook\n op = opts.op = 'beforeFind';\n return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {\n op = opts.op = 'find';\n self.dbg(op, mapper, id, opts);\n return jsData.utils.resolve(self._find(mapper, id, opts));\n }).then(function (results) {\n var _results6 = babelHelpers.slicedToArray(results, 1);\n\n var _record = _results6[0];\n\n if (!_record) {\n return;\n }\n record = _record;\n var tasks = [];\n\n jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {\n var task = void 0;\n if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {\n if (def.type === 'hasOne') {\n task = self.loadHasOne(mapper, def, record, __opts);\n } else {\n task = self.loadHasMany(mapper, def, record, __opts);\n }\n } else if (def.type === 'hasMany' && def.localKeys) {\n task = self.loadHasManyLocalKeys(mapper, def, record, __opts);\n } else if (def.type === 'hasMany' && def.foreignKeys) {\n task = self.loadHasManyForeignKeys(mapper, def, record, __opts);\n } else if (def.type === 'belongsTo') {\n task = self.loadBelongsTo(mapper, def, record, __opts);\n }\n if (task) {\n tasks.push(task);\n }\n });\n\n return Promise.all(tasks);\n }).then(function () {\n var response = new Response(record, {}, 'find');\n response.found = record ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterFind lifecycle hook\n op = opts.op = 'afterFind';\n return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Retrieve the records that match the selection query.\n *\n * @name Adapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n findAll: function findAll(mapper, query, opts) {\n var self = this;\n opts || (opts = {});\n opts.with || (opts.with = []);\n\n var records = [];\n var op = void 0;\n var activeWith = opts._activeWith;\n\n if (jsData.utils.isObject(activeWith)) {\n var activeQuery = activeWith.query || {};\n if (activeWith.replace) {\n query = activeQuery;\n } else {\n jsData.utils.deepFillIn(query, activeQuery);\n }\n }\n\n // beforeFindAll lifecycle hook\n op = opts.op = 'beforeFindAll';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n op = opts.op = 'findAll';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._findAll(mapper, query, opts));\n }).then(function (results) {\n var _results7 = babelHelpers.slicedToArray(results, 1);\n\n var _records = _results7[0];\n\n _records || (_records = []);\n records = _records;\n var tasks = [];\n jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {\n var task = void 0;\n if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {\n if (def.type === 'hasMany') {\n task = self.loadHasMany(mapper, def, records, __opts);\n } else {\n task = self.loadHasOne(mapper, def, records, __opts);\n }\n } else if (def.type === 'hasMany' && def.localKeys) {\n task = self.loadHasManyLocalKeys(mapper, def, records, __opts);\n } else if (def.type === 'hasMany' && def.foreignKeys) {\n task = self.loadHasManyForeignKeys(mapper, def, records, __opts);\n } else if (def.type === 'belongsTo') {\n task = self.loadBelongsTo(mapper, def, records, __opts);\n }\n if (task) {\n tasks.push(task);\n }\n });\n return Promise.all(tasks);\n }).then(function () {\n var response = new Response(records, {}, 'findAll');\n response.found = records.length;\n response = self.respond(response, opts);\n\n // afterFindAll lifecycle hook\n op = opts.op = 'afterFindAll';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Resolve the value of the specified option based on the given options and\n * this adapter's settings. Override with care.\n *\n * @name Adapter#getOpt\n * @method\n * @param {string} opt The name of the option.\n * @param {Object} [opts] Configuration options.\n * @return {*} The value of the specified option.\n */\n getOpt: function getOpt(opt, opts) {\n opts || (opts = {});\n return jsData.utils.isUndefined(opts[opt]) ? jsData.utils.plainCopy(this[opt]) : jsData.utils.plainCopy(opts[opt]);\n },\n\n\n /**\n * Logging utility method. Override this method if you want to send log\n * messages to something other than the console.\n *\n * @name Adapter#log\n * @method\n * @param {string} level Log level.\n * @param {...*} values Values to log.\n */\n log: function log(level) {\n for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n if (level && !args.length) {\n args.push(level);\n level = 'debug';\n }\n if (level === 'debug' && !this.debug) {\n return;\n }\n var prefix = level.toUpperCase() + ': (Adapter)';\n if (console[level]) {\n var _console;\n\n (_console = console)[level].apply(_console, [prefix].concat(args));\n } else {\n var _console2;\n\n (_console2 = console).log.apply(_console2, [prefix].concat(args));\n }\n },\n\n\n /**\n * Retrieve sum of the specified field of the records that match the selection\n * query. Called by `Mapper#sum`.\n *\n * @name Adapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field By to sum.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n sum: function sum(mapper, field, query, opts) {\n var self = this;\n var op = void 0;\n if (!jsData.utils.isString(field)) {\n throw new Error('field must be a string!');\n }\n query || (query = {});\n opts || (opts = {});\n\n // beforeSum lifecycle hook\n op = opts.op = 'beforeSum';\n return jsData.utils.resolve(self[op](mapper, field, query, opts)).then(function () {\n // Allow for re-assignment from lifecycle hook\n op = opts.op = 'sum';\n self.dbg(op, mapper, field, query, opts);\n return jsData.utils.resolve(self._sum(mapper, field, query, opts));\n }).then(function (results) {\n var _results8 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results8[0];\n var result = _results8[1];\n\n result || (result = {});\n var response = new Response(data, result, op);\n response = self.respond(response, opts);\n\n // afterSum lifecycle hook\n op = opts.op = 'afterSum';\n return jsData.utils.resolve(self[op](mapper, field, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * @name Adapter#respond\n * @method\n * @param {Object} response Response object.\n * @param {Object} opts Configuration options.\n * return {Object} If `opts.raw == true` then return `response`, else return\n * `response.data`.\n */\n respond: function respond(response, opts) {\n return this.getOpt('raw', opts) ? response : response.data;\n },\n\n\n /**\n * Apply the given update to the record with the specified primary key. Called\n * by `Mapper#update`.\n *\n * @name Adapter#update\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id The primary key of the record to be updated.\n * @param {Object} props The update to apply to the record.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n update: function update(mapper, id, props, opts) {\n var self = this;\n props || (props = {});\n opts || (opts = {});\n var op = void 0;\n\n // beforeUpdate lifecycle hook\n op = opts.op = 'beforeUpdate';\n return jsData.utils.resolve(self[op](mapper, id, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n op = opts.op = 'update';\n self.dbg(op, mapper, id, props, opts);\n return jsData.utils.resolve(self._update(mapper, id, props, opts));\n }).then(function (results) {\n var _results9 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results9[0];\n var result = _results9[1];\n\n result || (result = {});\n var response = new Response(data, result, 'update');\n response.updated = data ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterUpdate lifecycle hook\n op = opts.op = 'afterUpdate';\n return jsData.utils.resolve(self[op](mapper, id, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Apply the given update to all records that match the selection query.\n * Called by `Mapper#updateAll`.\n *\n * @name Adapter#updateAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The update to apply to the selected records.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n updateAll: function updateAll(mapper, props, query, opts) {\n var self = this;\n props || (props = {});\n query || (query = {});\n opts || (opts = {});\n var op = void 0;\n\n // beforeUpdateAll lifecycle hook\n op = opts.op = 'beforeUpdateAll';\n return jsData.utils.resolve(self[op](mapper, props, query, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n op = opts.op = 'updateAll';\n self.dbg(op, mapper, props, query, opts);\n return jsData.utils.resolve(self._updateAll(mapper, props, query, opts));\n }).then(function (results) {\n var _results10 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results10[0];\n var result = _results10[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'updateAll');\n response.updated = data.length;\n response = self.respond(response, opts);\n\n // afterUpdateAll lifecycle hook\n op = opts.op = 'afterUpdateAll';\n return jsData.utils.resolve(self[op](mapper, props, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Update the given records in a single batch. Called by `Mapper#updateMany`.\n *\n * @name Adapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object[]} records The records to update.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n updateMany: function updateMany(mapper, records, opts) {\n var self = this;\n records || (records = []);\n opts || (opts = {});\n var op = void 0;\n var idAttribute = mapper.idAttribute;\n\n records = records.filter(function (record) {\n return jsData.utils.get(record, idAttribute);\n });\n\n // beforeUpdateMany lifecycle hook\n op = opts.op = 'beforeUpdateMany';\n return jsData.utils.resolve(self[op](mapper, records, opts)).then(function (_records) {\n // Allow for re-assignment from lifecycle hook\n records = jsData.utils.isUndefined(_records) ? records : _records;\n records = records.map(function (record) {\n return withoutRelations(mapper, record);\n });\n op = opts.op = 'updateMany';\n self.dbg(op, mapper, records, opts);\n return jsData.utils.resolve(self._updateMany(mapper, records, opts));\n }).then(function (results) {\n var _results11 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results11[0];\n var result = _results11[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'updateMany');\n response.updated = data.length;\n response = self.respond(response, opts);\n\n // afterUpdateMany lifecycle hook\n op = opts.op = 'afterUpdateMany';\n return jsData.utils.resolve(self[op](mapper, records, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n }\n });\n\n module.exports = Adapter;\n\n}));\n//# sourceMappingURL=js-data-adapter.js.map\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/js-data-adapter/dist/js-data-adapter.js\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = undefined;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"undefined\"\n ** module id = 3\n ** module chunks = 0\n **/"],"sourceRoot":""}
\ No newline at end of file
diff --git a/fetch/dist/js-data-fetch.min.js b/fetch/dist/js-data-fetch.min.js
deleted file mode 100644
index 35f0608..0000000
--- a/fetch/dist/js-data-fetch.min.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*!
-* js-data-fetch
-* @version 3.0.0-beta.2 - Homepage
-* @copyright (c) 2014-2016 js-data-http project authors
-* @license MIT
-*
-* @overview HTTP adapter for js-data that uses the fetch API.
-*/
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("js-data"),require("undefined")):"function"==typeof define&&define.amd?define(["js-data","undefined"],t):"object"==typeof exports?exports.HttpAdapter=t(require("js-data"),require("undefined")):e.HttpAdapter=t(e.JSData,e.undefined)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e){return null!=e&&""!==e}function o(e,t){return t||(t=""),e.filter(i).join(t)}function u(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];var r=o(t,"/");return r.replace(/([^:\/]|^)\/{2,}/g,"$1/")}function a(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function s(e,t){if(!t)return e;var n=[];return d.utils.forOwn(t,function(e,t){null!==e&&"undefined"!=typeof e&&(d.utils.isArray(e)||(e=[e]),e.forEach(function(e){"[object Date]"===window.toString.call(e)?e=e.toISOString():d.utils.isObject(e)&&(e=d.utils.toJson(e)),n.push(a(t)+"="+a(e))}))}),n.length>0&&(e+=(-1===e.indexOf("?")?"?":"&")+n.join("&")),e}function l(e){var t=this;e||(e={}),d.utils.fillIn(e,b),p.default.call(t,e)}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d=n(1),c=n(2),p=r(c),h=n(3),y=!1;try{y=window&&window.fetch}catch(e){}var v=function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var i=n[n.length-1];return e.dbg.apply(e,[i.op].concat(n)),d.utils.resolve()},g=function(){for(var e=this,t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];var i=n[n.length-2];return e.dbg.apply(e,[i.op].concat(n)),d.utils.resolve()},m=p.default.prototype,b={basePath:"",forceTrailingSlash:!1,http:h,httpConfig:{},suffix:"",useFetch:!1};l.prototype=Object.create(p.default.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),Object.defineProperty(l,"__super__",{configurable:!0,value:p.default}),d.utils.addHiddenPropsToTarget(l.prototype,{afterDEL:g,afterGET:g,afterHTTP:g,afterPOST:g,afterPUT:g,beforeDEL:v,beforeGET:v,beforeHTTP:v,beforePOST:v,beforePUT:v,_count:function(e,t,n){var r=this;return r.GET(r.getPath("count",e,n.params,n),n).then(function(t){return r._end(e,n,t)})},_create:function(e,t,n){var r=this;return r.POST(r.getPath("create",e,t,n),r.serialize(e,t,n),n).then(function(t){return r._end(e,n,t)})},_createMany:function(e,t,n){var r=this;return r.POST(r.getPath("createMany",e,null,n),r.serialize(e,t,n),n).then(function(t){return r._end(e,n,t)})},_destroy:function(e,t,n){var r=this;return r.DEL(r.getPath("destroy",e,t,n),n).then(function(t){return r._end(e,n,t)})},_destroyAll:function(e,t,n){var r=this;return r.DEL(r.getPath("destroyAll",e,null,n),n).then(function(t){return r._end(e,n,t)})},_end:function(e,t,n){return[this.deserialize(e,n,t),n]},_find:function(e,t,n){var r=this;return r.GET(r.getPath("find",e,t,n),n).then(function(t){return r._end(e,n,t)})},_findAll:function(e,t,n){var r=this;return r.GET(r.getPath("findAll",e,n.params,n),n).then(function(t){return r._end(e,n,t)})},_sum:function(e,t,n,r){var i=this;return i.GET(i.getPath("sum",e,r.params,r),r).then(function(t){return i._end(e,r,t)})},_update:function(e,t,n,r){var i=this;return i.PUT(i.getPath("update",e,t,r),i.serialize(e,n,r),r).then(function(t){return i._end(e,r,t)})},_updateAll:function(e,t,n,r){var i=this;return i.PUT(i.getPath("updateAll",e,null,r),i.serialize(e,t,r),r).then(function(t){return i._end(e,r,t)})},_updateMany:function(e,t,n){var r=this;return r.PUT(r.getPath("updateMany",e,null,n),r.serialize(e,t,n),n).then(function(t){return r._end(e,n,t)})},count:function(e,t,n){var r=this;return t||(t={}),n||(n={}),n.params=r.getParams(n),n.params.count=!0,n.suffix=r.getSuffix(e,n),d.utils.deepMixIn(n.params,t),n.params=r.queryTransform(e,n.params,n),m.count.call(r,e,t,n)},create:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),m.create.call(r,e,t,n)},createMany:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),m.createMany.call(r,e,t,n)},DEL:function(e,t,n){var r=this,i=void 0;return t||(t={}),n||(n={}),t.url=e||t.url,t.method=t.method||"delete",i=n.op="beforeDEL",d.utils.resolve(r[i](e,t,n)).then(function(o){return t=d.utils.isUndefined(o)?t:o,i=n.op="DEL",r.dbg(i,e,t,n),r.HTTP(t,n)}).then(function(o){return i=n.op="afterDEL",d.utils.resolve(r[i](e,t,n,o)).then(function(e){return d.utils.isUndefined(e)?o:e})})},deserialize:function(e,t,n){return n||(n={}),d.utils.isFunction(n.deserialize)?n.deserialize(e,t,n):d.utils.isFunction(e.deserialize)?e.deserialize(e,t,n):t&&t.hasOwnProperty("data")?t.data:t},destroy:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),m.destroy.call(r,e,t,n)},destroyAll:function(e,t,n){var r=this;return t||(t={}),n||(n={}),n.params=r.getParams(n),d.utils.deepMixIn(n.params,t),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),m.destroyAll.call(r,e,t,n)},error:function(){if(console){var e;(e=console)["function"==typeof console.error?"error":"log"].apply(e,arguments)}},fetch:function(e){function t(t,n){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,t){var n={method:e.method,headers:new Headers(e.headers)};return e.data&&(n.body=d.utils.toJson(e.data)),fetch(new Request(s(e.url,e.params),n)).then(function(t){return t.config={method:e.method,url:e.url},t.json().then(function(e){return t.data=e,t})})}),find:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),m.find.call(r,e,t,n)},findAll:function(e,t,n){var r=this;return t||(t={}),n||(n={}),n.params=r.getParams(n),n.suffix=r.getSuffix(e,n),d.utils.deepMixIn(n.params,t),n.params=r.queryTransform(e,n.params,n),m.findAll.call(r,e,t,n)},GET:function(e,t,n){var r=this,i=void 0;return t||(t={}),n||(n={}),t.url=e||t.url,t.method=t.method||"get",i=n.op="beforeGET",d.utils.resolve(r[i](e,t,n)).then(function(o){return t=d.utils.isUndefined(o)?t:o,i=n.op="GET",r.dbg(i,e,t,n),r.HTTP(t,n)}).then(function(o){return i=n.op="afterGET",d.utils.resolve(r[i](e,t,n,o)).then(function(e){return d.utils.isUndefined(e)?o:e})})},getEndpoint:function(e,t,n){var r=this;n||(n={}),n.params=d.utils.isUndefined(n.params)?{}:n.params;var i=e.relationList||[],o=d.utils.isUndefined(n.endpoint)?d.utils.isUndefined(e.endpoint)?e.name:e.endpoint:n.endpoint;return i.forEach(function(e){if("belongsTo"===e.type&&e.parent){var i=void 0,a=e.foreignKey,s=e.getRelation(),l=n.params[a];if(l===!1||!a||!s)return l===!1&&delete n.params[a],!1;if(delete n.params[a],d.utils.isObject(t)&&(i=t),i&&(l=l||e.getForeignKey(i)||(e.getLocalField(i)?d.utils.get(e.getLocalField(i),s.idAttribute):null)),l){var c=function(){delete n.endpoint;var e={};return d.utils.forOwn(n,function(t,n){e[n]=t}),d.utils._(e,s),o=u(r.getEndpoint(s,l,e),l,o),{v:!1}}();if("object"===("undefined"==typeof c?"undefined":f(c)))return c.v}}}),o},getPath:function(e,t,n,r){var i=this;r||(r={});var o=[d.utils.isUndefined(r.basePath)?d.utils.isUndefined(t.basePath)?i.basePath:t.basePath:r.basePath,i.getEndpoint(t,d.utils.isString(n)||d.utils.isNumber(n)||"create"===e?n:null,r)];return"find"!==e&&"update"!==e&&"destroy"!==e||o.push(n),u.apply(d.utils,o)},getParams:function(e){return e||(e={}),d.utils.isUndefined(e.params)?{}:d.utils.copy(e.params)},getSuffix:function(e,t){return t||(t={}),d.utils.isUndefined(t.suffix)?d.utils.isUndefined(e.suffix)?this.suffix:e.suffix:t.suffix},HTTP:function(e,t){function n(t){var n=i.toUTCString()+" - "+e.method.toUpperCase()+" "+e.url+" - "+t.status+" "+((new Date).getTime()-i.getTime())+"ms";return t.status>=200&&t.status<300?(r.log&&r.dbg("debug",n,t),t):(r.error&&r.error("'FAILED: "+n,t),d.utils.reject(t))}var r=this,i=new Date;t||(t={});var o=e.data,u=e.cache,a=e.timeout;e=d.utils.copy(e,null,null,null,["data","cache","timeout"]),e=d.utils.deepMixIn(e,r.httpConfig),e.data=o,e.cache=u,e.timeout=a,r.forceTrailingSlash&&"/"!==e.url[e.url.length-1]&&(e.url+="/"),e.method=e.method.toUpperCase();var s=e.suffix||t.suffix||r.suffix;if(s&&e.url.substr(e.url.length-s.length)!==s&&(e.url+=s),!r.http)throw new Error("You have not configured this adapter with an http library!");return d.utils.resolve(r.beforeHTTP(e,t)).then(function(i){return e=i||e,y&&(r.useFetch||t.useFetch||!r.http)?r.fetch(e,t).then(n,n):r.http(e).then(n,n).catch(function(n){return r.responseError(n,e,t)})}).then(function(n){return d.utils.resolve(r.afterHTTP(e,t,n)).then(function(e){return e||n})})},POST:function(e,t,n,r){var i=this,o=void 0;return n||(n={}),r||(r={}),n.url=e||n.url,n.data=t||n.data,n.method=n.method||"post",o=r.op="beforePOST",d.utils.resolve(i[o](e,t,n,r)).then(function(u){return n=d.utils.isUndefined(u)?n:u,o=r.op="POST",i.dbg(o,e,t,n,r),i.HTTP(n,r)}).then(function(u){return o=r.op="afterPOST",d.utils.resolve(i[o](e,t,n,r,u)).then(function(e){return d.utils.isUndefined(e)?u:e})})},PUT:function(e,t,n,r){var i=this,o=void 0;return n||(n={}),r||(r={}),n.url=e||n.url,n.data=t||n.data,n.method=n.method||"put",o=r.op="beforePUT",d.utils.resolve(i[o](e,t,n,r)).then(function(u){return n=d.utils.isUndefined(u)?n:u,o=r.op="PUT",i.dbg(o,e,t,n,r),i.HTTP(n,r)}).then(function(u){return o=r.op="afterPUT",d.utils.resolve(i[o](e,t,n,r,u)).then(function(e){return d.utils.isUndefined(e)?u:e})})},queryTransform:function(e,t,n){return n||(n={}),d.utils.isFunction(n.queryTransform)?n.queryTransform(e,t,n):d.utils.isFunction(e.queryTransform)?e.queryTransform(e,t,n):t},responseError:function(e,t,n){return d.utils.reject(e)},serialize:function(e,t,n){return n||(n={}),d.utils.isFunction(n.serialize)?n.serialize(e,t,n):d.utils.isFunction(e.serialize)?e.serialize(e,t,n):t},sum:function(e,t,n,r){var i=this;if(n||(n={}),r||(r={}),!d.utils.utils.isString(t))throw new Error("field must be a string!");return r.params=i.getParams(r),r.params.sum=t,r.suffix=i.getSuffix(e,r),d.utils.deepMixIn(r.params,n),r.params=i.queryTransform(e,r.params,r),m.sum.call(i,e,t,n,r)},update:function(e,t,n,r){var i=this;return r||(r={}),r.params=i.getParams(r),r.params=i.queryTransform(e,r.params,r),r.suffix=i.getSuffix(e,r),m.update.call(i,e,t,n,r)},updateAll:function(e,t,n,r){var i=this;return n||(n={}),r||(r={}),r.params=i.getParams(r),d.utils.deepMixIn(r.params,n),r.params=i.queryTransform(e,r.params,r),r.suffix=i.getSuffix(e,r),m.updateAll.call(i,e,t,n,r)},updateMany:function(e,t,n){var r=this;return n||(n={}),n.params=r.getParams(n),n.params=r.queryTransform(e,n.params,n),n.suffix=r.getSuffix(e,n),m.updateMany.call(r,e,t,n)}}),l.addAction=function(e,t){if(!e||!d.utils.isString(e))throw new TypeError("action(name[, opts]): Expected: string, Found: "+("undefined"==typeof e?"undefined":f(e)));return function(n){if(n[e])throw new Error("action(name[, opts]): "+e+" already exists on target!");return t.request=t.request||function(e){return e},t.response=t.response||function(e){return e},t.responseError=t.responseError||function(e){return d.utils.reject(e)},n[e]=function(n,r){var i=this;d.utils.isObject(n)&&(r=n),r=r||{};var o=i.getAdapter(t.adapter||i.defaultAdapter||"http"),a={};if(d.utils.fillIn(a,t),!r.hasOwnProperty("endpoint")&&a.endpoint&&(r.endpoint=a.endpoint),"function"==typeof r.getEndpoint)a.url=r.getEndpoint(i,r);else{var s=[r.basePath||i.basePath||o.basePath,o.getEndpoint(i,d.utils.isSorN(n)?n:null,r)];d.utils.isSorN(n)&&s.push(n),s.push(t.pathname||e),a.url=u.apply(null,s)}return a.method=a.method||"GET",a.mapper=i.name,d.utils.deepMixIn(a)(r),d.utils.resolve(a).then(r.request||t.request).then(function(e){return o.HTTP(e)}).then(function(e){return e&&e.config&&(e.config.mapper=i.name),e}).then(r.response||t.response,r.responseError||t.responseError)},n}},l.addActions=function(e){return e||(e={}),function(e){return d.utils.forOwn(e,function(t,n){l.addAction(n,t)(e)}),e}},l.extend=d.utils.extend,l.version={beta:2,full:"3.0.0-beta.2",major:3,minor:0,patch:0},e.exports=l},function(t,n){t.exports=e},function(e,t,n){!function(e,t){t(n(1))}(this,function(t){"use strict";function n(e){var n=this;e||(e={}),t.utils.fillIn(e,l),t.utils.fillIn(n,e)}function r(e,n,r){var i=this;n||(n={}),i.data=e,t.utils.fillIn(i,n),i.op=r}var i={};i.typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i.defineProperty=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},i.slicedToArray=function(){function e(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(r=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&a.return&&a.return()}finally{if(i)throw o}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();var o=function(){for(var e=this,n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];var o=r[r.length-1];return e.dbg.apply(e,[o.op].concat(r)),t.utils.resolve()},u=function(){for(var e=this,n=arguments.length,r=Array(n),i=0;n>i;i++)r[i]=arguments[i];var o=r[r.length-2];return e.dbg.apply(e,[o.op].concat(r)),t.utils.resolve()},a=function(e){var t={},n=[];return e.forEach(function(e){e in t||(n.push(e),t[e]=0)}),n},s=function(e,n){return t.utils.omit(n,e.relationFields||[])},l={debug:!1,raw:!1};n.reserved=["orderBy","sort","limit","offset","skip","where"],n.Response=r,n.extend=t.utils.extend,t.utils.addHiddenPropsToTarget(n.prototype,{afterCount:u,afterCreate:u,afterCreateMany:u,afterDestroy:u,afterDestroyAll:u,afterFind:u,afterFindAll:u,afterSum:u,afterUpdate:u,afterUpdateAll:u,afterUpdateMany:u,beforeCount:o,beforeCreate:o,beforeCreateMany:o,beforeDestroy:o,beforeDestroyAll:o,beforeFind:o,beforeFindAll:o,beforeSum:o,beforeUpdate:o,beforeUpdateAll:o,beforeUpdateMany:o,dbg:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];this.log.apply(this,["debug"].concat(t))},count:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeCount",t.utils.resolve(u[a](e,n,o)).then(function(){return a=o.op="count",u.dbg(a,e,n,o),t.utils.resolve(u._count(e,n,o))}).then(function(s){var l=i.slicedToArray(s,2),f=l[0],d=l[1];d||(d={});var c=new r(f,d,a);return c=u.respond(c,o),a=o.op="afterCount",t.utils.resolve(u[a](e,n,o,c)).then(function(e){return t.utils.isUndefined(e)?c:e})})},create:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeCreate",t.utils.resolve(u[a](e,n,o)).then(function(r){return n=t.utils.isUndefined(r)?n:r,n=s(e,n),a=o.op="create",u.dbg(a,e,n,o),t.utils.resolve(u._create(e,n,o))}).then(function(s){var l=i.slicedToArray(s,2),f=l[0],d=l[1];d||(d={});var c=new r(f,d,"create");return c.created=f?1:0,c=u.respond(c,o),a=o.op="afterCreate",t.utils.resolve(u[a](e,n,o,c)).then(function(e){return t.utils.isUndefined(e)?c:e})})},createMany:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeCreateMany",t.utils.resolve(u[a](e,n,o)).then(function(r){return n=t.utils.isUndefined(r)?n:r,n=n.map(function(t){return s(e,t)}),a=o.op="createMany",u.dbg(a,e,n,o),t.utils.resolve(u._createMany(e,n,o))}).then(function(s){var l=i.slicedToArray(s,2),f=l[0],d=l[1];f||(f=[]),d||(d={});var c=new r(f,d,"createMany");return c.created=f.length,c=u.respond(c,o),a=o.op="afterCreateMany",t.utils.resolve(u[a](e,n,o,c)).then(function(e){return t.utils.isUndefined(e)?c:e})})},destroy:function(e,n,o){var u=this,a=void 0;return o||(o={}),a=o.op="beforeDestroy",t.utils.resolve(u[a](e,n,o)).then(function(){return a=o.op="destroy",u.dbg(a,e,n,o),t.utils.resolve(u._destroy(e,n,o))}).then(function(s){var l=i.slicedToArray(s,2),f=l[0],d=l[1];d||(d={});var c=new r(f,d,"destroy");return c=u.respond(c,o),a=o.op="afterDestroy",t.utils.resolve(u[a](e,n,o,c)).then(function(e){return t.utils.isUndefined(e)?c:e})})},destroyAll:function(e,n,o){var u=this,a=void 0;return n||(n={}),o||(o={}),a=o.op="beforeDestroyAll",t.utils.resolve(u[a](e,n,o)).then(function(){return a=o.op="destroyAll",u.dbg(a,e,n,o),t.utils.resolve(u._destroyAll(e,n,o))}).then(function(s){var l=i.slicedToArray(s,2),f=l[0],d=l[1];d||(d={});var c=new r(f,d,"destroyAll");return c=u.respond(c,o),a=o.op="afterDestroyAll",t.utils.resolve(u[a](e,n,o,c)).then(function(e){return t.utils.isUndefined(e)?c:e})})},makeHasManyForeignKey:function(e,t,n){return t.getForeignKey(n)},makeHasManyLocalKeys:function(e,n,r){var i=[],o=t.utils.get(r,n.localKeys)||[];return o=t.utils.isArray(o)?o:Object.keys(o),i=i.concat(o),a(i).filter(function(e){return e})},makeHasManyForeignKeys:function(e,n,r){return t.utils.get(r,e.idAttribute)},loadHasMany:function(e,n,r,i){var o=this,u=!1;t.utils.isObject(r)&&!t.utils.isArray(r)&&(u=!0,r=[r]);var a=r.map(function(t){return o.makeHasManyForeignKey(e,n,t)}),s={where:{}},l=s.where[n.foreignKey]={};return u?l["=="]=a[0]:l.in=a.filter(function(e){return e}),o.findAll(n.getRelation(),s,i).then(function(i){r.forEach(function(r){var o=[];u?o=i:i.forEach(function(i){t.utils.get(i,n.foreignKey)===r[e.idAttribute]&&o.push(i)}),n.setLocalField(r,o)})})},loadHasManyLocalKeys:function(e,n,r,o){var u=this,s=void 0,l=n.getRelation();if(t.utils.isObject(r)&&!t.utils.isArray(r)&&(s=r),s)return u.findAll(l,{where:i.defineProperty({},l.idAttribute,{in:u.makeHasManyLocalKeys(e,n,s)})},o).then(function(e){n.setLocalField(s,e)});var f=function(){var s=[];return r.forEach(function(t){s=s.concat(u.self.makeHasManyLocalKeys(e,n,t))}),{v:u.findAll(l,{where:i.defineProperty({},l.idAttribute,{in:a(s).filter(function(e){return e})})},o).then(function(e){return r.forEach(function(r){var i=[],o=t.utils.get(r,n.localKeys)||[];o=t.utils.isArray(o)?o:Object.keys(o),e.forEach(function(e){o&&-1!==o.indexOf(e[l.idAttribute])&&i.push(e)}),n.setLocalField(r,i)}),e})}}();return"object"===("undefined"==typeof f?"undefined":i.typeof(f))?f.v:void 0},loadHasManyForeignKeys:function(e,n,r,o){var u=this,a=n.getRelation(),s=e.idAttribute,l=void 0;return t.utils.isObject(r)&&!t.utils.isArray(r)&&(l=r),l?u.findAll(n.getRelation(),{where:i.defineProperty({},n.foreignKeys,{contains:u.makeHasManyForeignKeys(e,n,l)})},o).then(function(e){n.setLocalField(l,e)}):u.findAll(a,{where:i.defineProperty({},n.foreignKeys,{isectNotEmpty:r.map(function(t){return u.makeHasManyForeignKeys(e,n,t)})})},o).then(function(e){var i=n.foreignKeys;r.forEach(function(r){var o=[],u=t.utils.get(r,s);e.forEach(function(n){var r=t.utils.get(e,i)||[];-1!==r.indexOf(u)&&o.push(n)}),n.setLocalField(r,o)})})},loadHasOne:function(e,n,r,i){return t.utils.isObject(r)&&!t.utils.isArray(r)&&(r=[r]),this.loadHasMany(e,n,r,i).then(function(){r.forEach(function(e){var r=n.getLocalField(e);t.utils.isArray(r)&&r.length&&n.setLocalField(e,r[0])})})},makeBelongsToForeignKey:function(e,t,n){return t.getForeignKey(n)},loadBelongsTo:function(e,n,r,o){var u=this,a=n.getRelation();if(!t.utils.isObject(r)||t.utils.isArray(r)){var s=r.map(function(t){return u.makeBelongsToForeignKey(e,n,t)}).filter(function(e){return e});return u.findAll(a,{where:i.defineProperty({},a.idAttribute,{in:s})},o).then(function(e){r.forEach(function(t){e.forEach(function(e){e[a.idAttribute]===t[n.foreignKey]&&n.setLocalField(t,e)})})})}var l=function(){var t=r;return{v:u.find(a,u.makeBelongsToForeignKey(e,n,t),o).then(function(e){n.setLocalField(t,e)})}}();return"object"===("undefined"==typeof l?"undefined":i.typeof(l))?l.v:void 0},find:function(e,n,o){var u=this,a=void 0,s=void 0;return o||(o={}),o.with||(o.with=[]),s=o.op="beforeFind",t.utils.resolve(u[s](e,n,o)).then(function(){return s=o.op="find",u.dbg(s,e,n,o),t.utils.resolve(u._find(e,n,o))}).then(function(n){var r=i.slicedToArray(n,1),s=r[0];if(s){a=s;var l=[];return t.utils.forEachRelation(e,o,function(t,n){var r=void 0;!t.foreignKey||"hasOne"!==t.type&&"hasMany"!==t.type?"hasMany"===t.type&&t.localKeys?r=u.loadHasManyLocalKeys(e,t,a,n):"hasMany"===t.type&&t.foreignKeys?r=u.loadHasManyForeignKeys(e,t,a,n):"belongsTo"===t.type&&(r=u.loadBelongsTo(e,t,a,n)):r="hasOne"===t.type?u.loadHasOne(e,t,a,n):u.loadHasMany(e,t,a,n),r&&l.push(r)}),Promise.all(l)}}).then(function(){var i=new r(a,{},"find");return i.found=a?1:0,i=u.respond(i,o),s=o.op="afterFind",t.utils.resolve(u[s](e,n,o,i)).then(function(e){return t.utils.isUndefined(e)?i:e})})},findAll:function(e,n,o){var u=this;o||(o={}),o.with||(o.with=[]);var a=[],s=void 0,l=o._activeWith;if(t.utils.isObject(l)){var f=l.query||{};l.replace?n=f:t.utils.deepFillIn(n,f)}return s=o.op="beforeFindAll",t.utils.resolve(u[s](e,n,o)).then(function(){return s=o.op="findAll",u.dbg(s,e,n,o),t.utils.resolve(u._findAll(e,n,o))}).then(function(n){var r=i.slicedToArray(n,1),s=r[0];s||(s=[]),a=s;var l=[];return t.utils.forEachRelation(e,o,function(t,n){var r=void 0;!t.foreignKey||"hasOne"!==t.type&&"hasMany"!==t.type?"hasMany"===t.type&&t.localKeys?r=u.loadHasManyLocalKeys(e,t,a,n):"hasMany"===t.type&&t.foreignKeys?r=u.loadHasManyForeignKeys(e,t,a,n):"belongsTo"===t.type&&(r=u.loadBelongsTo(e,t,a,n)):r="hasMany"===t.type?u.loadHasMany(e,t,a,n):u.loadHasOne(e,t,a,n),r&&l.push(r)}),Promise.all(l)}).then(function(){var i=new r(a,{},"findAll");return i.found=a.length,i=u.respond(i,o),s=o.op="afterFindAll",t.utils.resolve(u[s](e,n,o,i)).then(function(e){return t.utils.isUndefined(e)?i:e})})},getOpt:function(e,n){return n||(n={}),t.utils.isUndefined(n[e])?t.utils.plainCopy(this[e]):t.utils.plainCopy(n[e])},log:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;t>r;r++)n[r-1]=arguments[r];if(e&&!n.length&&(n.push(e),e="debug"),"debug"!==e||this.debug){var i=e.toUpperCase()+": (Adapter)";if(console[e]){var o;(o=console)[e].apply(o,[i].concat(n))}else{var u;(u=console).log.apply(u,[i].concat(n))}}},sum:function(e,n,o,u){var a=this,s=void 0;if(!t.utils.isString(n))throw new Error("field must be a string!");return o||(o={}),u||(u={}),s=u.op="beforeSum",t.utils.resolve(a[s](e,n,o,u)).then(function(){return s=u.op="sum",a.dbg(s,e,n,o,u),t.utils.resolve(a._sum(e,n,o,u))}).then(function(l){var f=i.slicedToArray(l,2),d=f[0],c=f[1];c||(c={});var p=new r(d,c,s);return p=a.respond(p,u),s=u.op="afterSum",t.utils.resolve(a[s](e,n,o,u,p)).then(function(e){return t.utils.isUndefined(e)?p:e})})},respond:function(e,t){return this.getOpt("raw",t)?e:e.data},update:function(e,n,o,u){var a=this;o||(o={}),u||(u={});var s=void 0;return s=u.op="beforeUpdate",t.utils.resolve(a[s](e,n,o,u)).then(function(r){return o=t.utils.isUndefined(r)?o:r,s=u.op="update",a.dbg(s,e,n,o,u),t.utils.resolve(a._update(e,n,o,u))}).then(function(l){var f=i.slicedToArray(l,2),d=f[0],c=f[1];c||(c={});var p=new r(d,c,"update");return p.updated=d?1:0,p=a.respond(p,u),s=u.op="afterUpdate",t.utils.resolve(a[s](e,n,o,u,p)).then(function(e){return t.utils.isUndefined(e)?p:e})})},updateAll:function(e,n,o,u){var a=this;n||(n={}),o||(o={}),u||(u={});var s=void 0;return s=u.op="beforeUpdateAll",t.utils.resolve(a[s](e,n,o,u)).then(function(r){return n=t.utils.isUndefined(r)?n:r,s=u.op="updateAll",a.dbg(s,e,n,o,u),t.utils.resolve(a._updateAll(e,n,o,u))}).then(function(l){var f=i.slicedToArray(l,2),d=f[0],c=f[1];d||(d=[]),c||(c={});var p=new r(d,c,"updateAll");return p.updated=d.length,p=a.respond(p,u),s=u.op="afterUpdateAll",t.utils.resolve(a[s](e,n,o,u,p)).then(function(e){return t.utils.isUndefined(e)?p:e})})},updateMany:function(e,n,o){var u=this;n||(n=[]),o||(o={});var a=void 0,l=e.idAttribute;return n=n.filter(function(e){return t.utils.get(e,l)}),a=o.op="beforeUpdateMany",t.utils.resolve(u[a](e,n,o)).then(function(r){return n=t.utils.isUndefined(r)?n:r,n=n.map(function(t){return s(e,t)}),a=o.op="updateMany",u.dbg(a,e,n,o),t.utils.resolve(u._updateMany(e,n,o))}).then(function(s){var l=i.slicedToArray(s,2),f=l[0],d=l[1];f||(f=[]),d||(d={});var c=new r(f,d,"updateMany");return c.updated=f.length,c=u.respond(c,o),a=o.op="afterUpdateMany",t.utils.resolve(u[a](e,n,o,c)).then(function(e){return t.utils.isUndefined(e)?c:e})})}}),e.exports=n})},function(e,t){e.exports=void 0}])});
-//# sourceMappingURL=js-data-fetch.min.map
\ No newline at end of file
diff --git a/fetch/dist/js-data-fetch.min.map b/fetch/dist/js-data-fetch.min.map
deleted file mode 100644
index 516db84..0000000
--- a/fetch/dist/js-data-fetch.min.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["fetch/dist/js-data-fetch.js"],"names":["root","factory","exports","module","require","define","amd","this","__WEBPACK_EXTERNAL_MODULE_1__","__WEBPACK_EXTERNAL_MODULE_3__","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireDefault","obj","__esModule","default","isValidString","value","join","items","separator","filter","makePath","_len3","arguments","length","args","Array","_key3","result","replace","encode","val","encodeURIComponent","buildUrl","url","params","parts","_jsData","utils","forOwn","key","isArray","forEach","v","window","toString","toISOString","isObject","toJson","push","indexOf","HttpAdapter","opts","self","fillIn","DEFAULTS","_jsDataAdapter2","_typeof","Symbol","iterator","constructor","_jsDataAdapter","axios","hasFetch","fetch","e","noop","_len","_key","dbg","apply","op","concat","resolve","noop2","_len2","_key2","__super__","prototype","basePath","forceTrailingSlash","http","httpConfig","suffix","useFetch","Object","create","enumerable","writable","configurable","defineProperty","addHiddenPropsToTarget","afterDEL","afterGET","afterHTTP","afterPOST","afterPUT","beforeDEL","beforeGET","beforeHTTP","beforePOST","beforePUT","_count","mapper","query","GET","getPath","then","response","_end","_create","props","POST","serialize","_createMany","_destroy","DEL","_destroyAll","deserialize","_find","_findAll","_sum","field","_update","PUT","_updateAll","_updateMany","records","count","getParams","getSuffix","deepMixIn","queryTransform","createMany","config","method","_config","isUndefined","HTTP","_response","isFunction","hasOwnProperty","data","destroy","destroyAll","error","console","_console","_fetch","_x","_x2","requestConfig","headers","Headers","body","Request","json","find","findAll","getEndpoint","relationList","endpoint","name","def","type","parent","item","parentKey","foreignKey","parentDef","getRelation","parentId","getForeignKey","getLocalField","get","idAttribute","_ret","_opts","_","isString","isNumber","copy","logResponse","str","start","toUTCString","toUpperCase","status","Date","getTime","log","reject","payload","cache","timeout","substr","Error","catch","err","responseError","sum","update","updateAll","updateMany","addAction","TypeError","request","adapter","getAdapter","defaultAdapter","_args","isSorN","pathname","addActions","extend","version","beta","full","major","minor","patch","global","jsData","Adapter","Response","meta","babelHelpers","typeof","slicedToArray","sliceIterator","arr","i","_arr","_n","_d","_e","undefined","_s","_i","next","done","unique","array","seen","final","withoutRelations","omit","relationFields","debug","raw","reserved","afterCount","afterCreate","afterCreateMany","afterDestroy","afterDestroyAll","afterFind","afterFindAll","afterSum","afterUpdate","afterUpdateAll","afterUpdateMany","beforeCount","beforeCreate","beforeCreateMany","beforeDestroy","beforeDestroyAll","beforeFind","beforeFindAll","beforeSum","beforeUpdate","beforeUpdateAll","beforeUpdateMany","results","_results","respond","_props","_results2","created","map","record","_results3","_results4","_results5","makeHasManyForeignKey","makeHasManyLocalKeys","localKeys","itemKeys","keys","x","makeHasManyForeignKeys","loadHasMany","__opts","singular","IDs","where","criteria","relatedItems","attached","relatedItem","setLocalField","loadHasManyLocalKeys","relatedMapper","in","loadHasManyForeignKeys","foreignKeys","contains","isectNotEmpty","foreignKeysField","_relatedItems","loadHasOne","relatedData","makeBelongsToForeignKey","loadBelongsTo","relationDef","_ret2","with","_results6","_record","tasks","forEachRelation","task","Promise","all","found","activeWith","_activeWith","activeQuery","deepFillIn","_results7","_records","getOpt","opt","plainCopy","level","_len4","_key4","prefix","_console2","_results8","_results9","updated","_results10","_results11"],"mappings":"CAAA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD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
\ No newline at end of file
diff --git a/node/.gitignore b/node/.gitignore
index e69de29..5d5e8fc 100644
--- a/node/.gitignore
+++ b/node/.gitignore
@@ -0,0 +1,2 @@
+dist/*.js
+dist/*.map
\ No newline at end of file
diff --git a/node/dist/js-data-http-node.js b/node/dist/js-data-http-node.js
deleted file mode 100644
index bdf5871..0000000
--- a/node/dist/js-data-http-node.js
+++ /dev/null
@@ -1,2980 +0,0 @@
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("js-data"), require("axios"));
- else if(typeof define === 'function' && define.amd)
- define(["js-data", "axios"], factory);
- else {
- var a = typeof exports === 'object' ? factory(require("js-data"), require("axios")) : factory(root["js-data"], root["axios"]);
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
- }
-})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-/******/
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-/******/
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-/******/
-/******/
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-/******/
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-/******/
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-/******/
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- 'use strict';
-
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
-
- var _jsData = __webpack_require__(1);
-
- var _jsDataAdapter = __webpack_require__(2);
-
- var _jsDataAdapter2 = _interopRequireDefault(_jsDataAdapter);
-
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
- /* global fetch:true Headers:true Request:true */
- var axios = __webpack_require__(3);
-
-
- var hasFetch = false;
-
- try {
- hasFetch = window && window.fetch;
- } catch (e) {}
-
- var noop = function noop() {
- var self = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var opts = args[args.length - 1];
- self.dbg.apply(self, [opts.op].concat(args));
- return _jsData.utils.resolve();
- };
-
- var noop2 = function noop2() {
- var self = this;
-
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- var opts = args[args.length - 2];
- self.dbg.apply(self, [opts.op].concat(args));
- return _jsData.utils.resolve();
- };
-
- function isValidString(value) {
- return value != null && value !== '';
- }
- function join(items, separator) {
- separator || (separator = '');
- return items.filter(isValidString).join(separator);
- }
- function makePath() {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
-
- var result = join(args, '/');
- return result.replace(/([^:\/]|^)\/{2,}/g, '$1/');
- }
-
- function encode(val) {
- return encodeURIComponent(val).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',').replace(/%20/g, '+').replace(/%5B/gi, '[').replace(/%5D/gi, ']');
- }
-
- function buildUrl(url, params) {
- if (!params) {
- return url;
- }
-
- var parts = [];
-
- _jsData.utils.forOwn(params, function (val, key) {
- if (val === null || typeof val === 'undefined') {
- return;
- }
- if (!_jsData.utils.isArray(val)) {
- val = [val];
- }
-
- val.forEach(function (v) {
- if (window.toString.call(v) === '[object Date]') {
- v = v.toISOString();
- } else if (_jsData.utils.isObject(v)) {
- v = _jsData.utils.toJson(v);
- }
- parts.push(encode(key) + '=' + encode(v));
- });
- });
-
- if (parts.length > 0) {
- url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&');
- }
-
- return url;
- }
-
- var __super__ = _jsDataAdapter2.default.prototype;
-
- var DEFAULTS = {
- // Default and user-defined settings
- /**
- * @name HttpAdapter#basePath
- * @type {string}
- */
- basePath: '',
-
- /**
- * @name HttpAdapter#forceTrailingSlash
- * @type {boolean}
- * @default false
- */
- forceTrailingSlash: false,
-
- /**
- * @name HttpAdapter#http
- * @type {Function}
- */
- http: axios,
-
- /**
- * @name HttpAdapter#httpConfig
- * @type {Object}
- */
- httpConfig: {},
-
- /**
- * @name HttpAdapter#suffix
- * @type {string}
- */
- suffix: '',
-
- /**
- * @name HttpAdapter#useFetch
- * @type {boolean}
- * @default false
- */
- useFetch: false
- };
-
- /**
- * HttpAdapter class.
- *
- * @class HttpAdapter
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.basePath=''] TODO
- * @param {boolean} [opts.debug=false] TODO
- * @param {boolean} [opts.forceTrailingSlash=false] TODO
- * @param {Object} [opts.http=axios] TODO
- * @param {Object} [opts.httpConfig={}] TODO
- * @param {string} [opts.suffix=''] TODO
- * @param {boolean} [opts.useFetch=false] TODO
- */
- function HttpAdapter(opts) {
- var self = this;
- opts || (opts = {});
- _jsData.utils.fillIn(opts, DEFAULTS);
- _jsDataAdapter2.default.call(self, opts);
- }
-
- // Setup prototype inheritance from Adapter
- HttpAdapter.prototype = Object.create(_jsDataAdapter2.default.prototype, {
- constructor: {
- value: HttpAdapter,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
-
- Object.defineProperty(HttpAdapter, '__super__', {
- configurable: true,
- value: _jsDataAdapter2.default
- });
-
- _jsData.utils.addHiddenPropsToTarget(HttpAdapter.prototype, {
- /**
- * @name HttpAdapter#afterDEL
- * @method
- * @param {string} url
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterDEL: noop2,
-
- /**
- * @name HttpAdapter#afterGET
- * @method
- * @param {string} url
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterGET: noop2,
-
- /**
- * @name HttpAdapter#afterHTTP
- * @method
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterHTTP: noop2,
-
- /**
- * @name HttpAdapter#afterPOST
- * @method
- * @param {string} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterPOST: noop2,
-
- /**
- * @name HttpAdapter#afterPUT
- * @method
- * @param {string} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- * @param {Object} response
- */
- afterPUT: noop2,
-
- /**
- * @name HttpAdapter#beforeDEL
- * @method
- * @param {Object} url
- * @param {Object} config
- * @param {Object} opts
- */
- beforeDEL: noop,
-
- /**
- * @name HttpAdapter#beforeGET
- * @method
- * @param {Object} url
- * @param {Object} config
- * @param {Object} opts
- */
- beforeGET: noop,
-
- /**
- * @name HttpAdapter#beforeHTTP
- * @method
- * @param {Object} config
- * @param {Object} opts
- */
- beforeHTTP: noop,
-
- /**
- * @name HttpAdapter#beforePOST
- * @method
- * @param {Object} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- */
- beforePOST: noop,
-
- /**
- * @name HttpAdapter#beforePUT
- * @method
- * @param {Object} url
- * @param {Object} data
- * @param {Object} config
- * @param {Object} opts
- */
- beforePUT: noop,
-
- _count: function _count(mapper, query, opts) {
- var self = this;
- return self.GET(self.getPath('count', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _create: function _create(mapper, props, opts) {
- var self = this;
- return self.POST(self.getPath('create', mapper, props, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _createMany: function _createMany(mapper, props, opts) {
- var self = this;
- return self.POST(self.getPath('createMany', mapper, null, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _destroy: function _destroy(mapper, id, opts) {
- var self = this;
- return self.DEL(self.getPath('destroy', mapper, id, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _destroyAll: function _destroyAll(mapper, query, opts) {
- var self = this;
- return self.DEL(self.getPath('destroyAll', mapper, null, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _end: function _end(mapper, opts, response) {
- return [this.deserialize(mapper, response, opts), response];
- },
- _find: function _find(mapper, id, opts) {
- var self = this;
- return self.GET(self.getPath('find', mapper, id, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _findAll: function _findAll(mapper, query, opts) {
- var self = this;
- return self.GET(self.getPath('findAll', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _sum: function _sum(mapper, field, query, opts) {
- var self = this;
- return self.GET(self.getPath('sum', mapper, opts.params, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _update: function _update(mapper, id, props, opts) {
- var self = this;
- return self.PUT(self.getPath('update', mapper, id, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _updateAll: function _updateAll(mapper, props, query, opts) {
- var self = this;
- return self.PUT(self.getPath('updateAll', mapper, null, opts), self.serialize(mapper, props, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
- _updateMany: function _updateMany(mapper, records, opts) {
- var self = this;
- return self.PUT(self.getPath('updateMany', mapper, null, opts), self.serialize(mapper, records, opts), opts).then(function (response) {
- return self._end(mapper, opts, response);
- });
- },
-
-
- /**
- * Retrieve the number of records that match the selection `query`.
- *
- * @name HttpAdapter#count
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- count: function count(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params.count = true;
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.count.call(self, mapper, query, opts);
- },
-
-
- /**
- * Create a new the record from the provided `props`.
- *
- * @name HttpAdapter#create
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props Properties to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- create: function create(mapper, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.create.call(self, mapper, props, opts);
- },
-
-
- /**
- * Create multiple new records in batch.
- *
- * @name HttpAdapter#createMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Array} props Array of property objects to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- createMany: function createMany(mapper, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.createMany.call(self, mapper, props, opts);
- },
-
-
- /**
- * Make an Http request to `url` according to the configuration in `config`.
- *
- * @name HttpAdapter#DEL
- * @method
- * @param {string} url Url for the request.
- * @param {Object} [config] Http configuration that will be passed to
- * {@link HttpAdapter#HTTP}.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- DEL: function DEL(url, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.method = config.method || 'delete';
-
- // beforeDEL lifecycle hook
- op = opts.op = 'beforeDEL';
- return _jsData.utils.resolve(self[op](url, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'DEL';
- self.dbg(op, url, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterDEL lifecycle hook
- op = opts.op = 'afterDEL';
- return _jsData.utils.resolve(self[op](url, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Transform the server response object into the payload that will be returned
- * to JSData.
- *
- * @name HttpAdapter#deserialize
- * @method
- * @param {Object} mapper The mapper used for the operation.
- * @param {Object} response Response object from {@link HttpAdapter#HTTP}.
- * @param {Object} opts Configuration options.
- * @return {(Object|Array)} Deserialized data.
- */
- deserialize: function deserialize(mapper, response, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.deserialize)) {
- return opts.deserialize(mapper, response, opts);
- }
- if (_jsData.utils.isFunction(mapper.deserialize)) {
- return mapper.deserialize(mapper, response, opts);
- }
- if (response && response.hasOwnProperty('data')) {
- return response.data;
- }
- return response;
- },
-
-
- /**
- * Destroy the record with the given primary key.
- *
- * @name HttpAdapter#destroy
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to destroy.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- destroy: function destroy(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.destroy.call(self, mapper, id, opts);
- },
-
-
- /**
- * Destroy the records that match the selection `query`.
- *
- * @name HttpAdapter#destroyAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- destroyAll: function destroyAll(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.destroyAll.call(self, mapper, query, opts);
- },
-
-
- /**
- * Log an error.
- *
- * @name HttpAdapter#error
- * @method
- * @param {...*} [args] Arguments to log.
- */
- error: function error() {
- if (console) {
- var _console;
-
- (_console = console)[typeof console.error === 'function' ? 'error' : 'log'].apply(_console, arguments);
- }
- },
-
-
- /**
- * Make an Http request using `window.fetch`.
- *
- * @name HttpAdapter#fetch
- * @method
- * @param {Object} config Request configuration.
- * @param {Object} config.data Payload for the request.
- * @param {string} config.method Http method for the request.
- * @param {Object} config.headers Headers for the request.
- * @param {Object} config.params Querystring for the request.
- * @param {string} config.url Url for the request.
- * @param {Object} [opts] Configuration options.
- */
- fetch: function (_fetch) {
- function fetch(_x, _x2) {
- return _fetch.apply(this, arguments);
- }
-
- fetch.toString = function () {
- return _fetch.toString();
- };
-
- return fetch;
- }(function (config, opts) {
- var requestConfig = {
- method: config.method,
- // turn the plain headers object into the Fetch Headers object
- headers: new Headers(config.headers)
- };
-
- if (config.data) {
- requestConfig.body = _jsData.utils.toJson(config.data);
- }
-
- return fetch(new Request(buildUrl(config.url, config.params), requestConfig)).then(function (response) {
- response.config = {
- method: config.method,
- url: config.url
- };
- return response.json().then(function (data) {
- response.data = data;
- return response;
- });
- });
- }),
-
-
- /**
- * Retrieve the record with the given primary key.
- *
- * @name HttpAdapter#find
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to retrieve.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- find: function find(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.find.call(self, mapper, id, opts);
- },
-
-
- /**
- * Retrieve the records that match the selection `query`.
- *
- * @name HttpAdapter#findAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- findAll: function findAll(mapper, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.findAll.call(self, mapper, query, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#GET
- * @method
- * @param {string} url The url for the request.
- * @param {Object} config Request configuration options.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- GET: function GET(url, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.method = config.method || 'get';
-
- // beforeGET lifecycle hook
- op = opts.op = 'beforeGET';
- return _jsData.utils.resolve(self[op](url, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'GET';
- self.dbg(op, url, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterGET lifecycle hook
- op = opts.op = 'afterGET';
- return _jsData.utils.resolve(self[op](url, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * @name HttpAdapter#getEndpoint
- * @method
- * @param {Object} mapper TODO
- * @param {*} id TODO
- * @param {boolean} opts TODO
- * @return {string} Full path.
- */
- getEndpoint: function getEndpoint(mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = _jsData.utils.isUndefined(opts.params) ? {} : opts.params;
- var relationList = mapper.relationList || [];
- var endpoint = _jsData.utils.isUndefined(opts.endpoint) ? _jsData.utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint : opts.endpoint;
-
- relationList.forEach(function (def) {
- if (def.type !== 'belongsTo' || !def.parent) {
- return;
- }
- var item = void 0;
- var parentKey = def.foreignKey;
- var parentDef = def.getRelation();
- var parentId = opts.params[parentKey];
-
- if (parentId === false || !parentKey || !parentDef) {
- if (parentId === false) {
- delete opts.params[parentKey];
- }
- return false;
- } else {
- delete opts.params[parentKey];
-
- if (_jsData.utils.isObject(id)) {
- item = id;
- }
-
- if (item) {
- parentId = parentId || def.getForeignKey(item) || (def.getLocalField(item) ? _jsData.utils.get(def.getLocalField(item), parentDef.idAttribute) : null);
- }
-
- if (parentId) {
- var _ret = function () {
- delete opts.endpoint;
- var _opts = {};
- _jsData.utils.forOwn(opts, function (value, key) {
- _opts[key] = value;
- });
- _jsData.utils._(_opts, parentDef);
- endpoint = makePath(self.getEndpoint(parentDef, parentId, _opts), parentId, endpoint);
- return {
- v: false
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
- }
- }
- });
-
- return endpoint;
- },
-
-
- /**
- * @name HttpAdapter#getPath
- * @method
- * @param {string} method TODO
- * @param {Object} mapper TODO
- * @param {(string|number)?} id TODO
- * @param {Object} opts Configuration options.
- */
- getPath: function getPath(method, mapper, id, opts) {
- var self = this;
- opts || (opts = {});
- var args = [_jsData.utils.isUndefined(opts.basePath) ? _jsData.utils.isUndefined(mapper.basePath) ? self.basePath : mapper.basePath : opts.basePath, self.getEndpoint(mapper, _jsData.utils.isString(id) || _jsData.utils.isNumber(id) || method === 'create' ? id : null, opts)];
- if (method === 'find' || method === 'update' || method === 'destroy') {
- args.push(id);
- }
- return makePath.apply(_jsData.utils, args);
- },
- getParams: function getParams(opts) {
- opts || (opts = {});
- if (_jsData.utils.isUndefined(opts.params)) {
- return {};
- }
- return _jsData.utils.copy(opts.params);
- },
- getSuffix: function getSuffix(mapper, opts) {
- opts || (opts = {});
- if (_jsData.utils.isUndefined(opts.suffix)) {
- if (_jsData.utils.isUndefined(mapper.suffix)) {
- return this.suffix;
- }
- return mapper.suffix;
- }
- return opts.suffix;
- },
-
-
- /**
- * Make an Http request.
- *
- * @name HttpAdapter#HTTP
- * @method
- * @param {Object} config Request configuration options.
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- HTTP: function HTTP(config, opts) {
- var self = this;
- var start = new Date();
- opts || (opts = {});
- var payload = config.data;
- var cache = config.cache;
- var timeout = config.timeout;
- config = _jsData.utils.copy(config, null, null, null, ['data', 'cache', 'timeout']);
- config = _jsData.utils.deepMixIn(config, self.httpConfig);
- config.data = payload;
- config.cache = cache;
- config.timeout = timeout;
- if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
- config.url += '/';
- }
- config.method = config.method.toUpperCase();
- var suffix = config.suffix || opts.suffix || self.suffix;
- if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
- config.url += suffix;
- }
-
- function logResponse(data) {
- var str = start.toUTCString() + ' - ' + config.method.toUpperCase() + ' ' + config.url + ' - ' + data.status + ' ' + (new Date().getTime() - start.getTime()) + 'ms';
- if (data.status >= 200 && data.status < 300) {
- if (self.log) {
- self.dbg('debug', str, data);
- }
- return data;
- } else {
- if (self.error) {
- self.error('\'FAILED: ' + str, data);
- }
- return _jsData.utils.reject(data);
- }
- }
-
- if (!self.http) {
- throw new Error('You have not configured this adapter with an http library!');
- }
-
- return _jsData.utils.resolve(self.beforeHTTP(config, opts)).then(function (_config) {
- config = _config || config;
- if (hasFetch && (self.useFetch || opts.useFetch || !self.http)) {
- return self.fetch(config, opts).then(logResponse, logResponse);
- }
- return self.http(config).then(logResponse, logResponse).catch(function (err) {
- return self.responseError(err, config, opts);
- });
- }).then(function (response) {
- return _jsData.utils.resolve(self.afterHTTP(config, opts, response)).then(function (_response) {
- return _response || response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#POST
- * @method
- * @param {*} url TODO
- * @param {Object} data TODO
- * @param {Object} config TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- POST: function POST(url, data, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.data = data || config.data;
- config.method = config.method || 'post';
-
- // beforePOST lifecycle hook
- op = opts.op = 'beforePOST';
- return _jsData.utils.resolve(self[op](url, data, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'POST';
- self.dbg(op, url, data, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterPOST lifecycle hook
- op = opts.op = 'afterPOST';
- return _jsData.utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#PUT
- * @method
- * @param {*} url TODO
- * @param {Object} data TODO
- * @param {Object} config TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- PUT: function PUT(url, data, config, opts) {
- var self = this;
- var op = void 0;
- config || (config = {});
- opts || (opts = {});
- config.url = url || config.url;
- config.data = data || config.data;
- config.method = config.method || 'put';
-
- // beforePUT lifecycle hook
- op = opts.op = 'beforePUT';
- return _jsData.utils.resolve(self[op](url, data, config, opts)).then(function (_config) {
- // Allow re-assignment from lifecycle hook
- config = _jsData.utils.isUndefined(_config) ? config : _config;
- op = opts.op = 'PUT';
- self.dbg(op, url, data, config, opts);
- return self.HTTP(config, opts);
- }).then(function (response) {
- // afterPUT lifecycle hook
- op = opts.op = 'afterPUT';
- return _jsData.utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {
- // Allow re-assignment from lifecycle hook
- return _jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#queryTransform
- * @method
- * @param {Object} mapper TODO
- * @param {*} params TODO
- * @param {*} opts TODO
- * @return {*} Transformed params.
- */
- queryTransform: function queryTransform(mapper, params, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.queryTransform)) {
- return opts.queryTransform(mapper, params, opts);
- }
- if (_jsData.utils.isFunction(mapper.queryTransform)) {
- return mapper.queryTransform(mapper, params, opts);
- }
- return params;
- },
-
-
- /**
- * Error handler invoked when the promise returned by {@link HttpAdapter#http}
- * is rejected. Default implementation is to just return the error wrapped in
- * a rejected Promise, aka rethrow the error. {@link HttpAdapter#http} is
- * called by {@link HttpAdapter#HTTP}.
- *
- * @name HttpAdapter#responseError
- * @method
- * @param {*} err The error that {@link HttpAdapter#http} rejected with.
- * @param {Object} config The `config` argument that was passed to {@link HttpAdapter#HTTP}.
- * @param {*} opts The `opts` argument that was passed to {@link HttpAdapter#HTTP}.
- * @return {Promise}
- */
- responseError: function responseError(err, config, opts) {
- return _jsData.utils.reject(err);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#serialize
- * @method
- * @param {Object} mapper TODO
- * @param {Object} data TODO
- * @param {*} opts TODO
- * @return {*} Serialized data.
- */
- serialize: function serialize(mapper, data, opts) {
- opts || (opts = {});
- if (_jsData.utils.isFunction(opts.serialize)) {
- return opts.serialize(mapper, data, opts);
- }
- if (_jsData.utils.isFunction(mapper.serialize)) {
- return mapper.serialize(mapper, data, opts);
- }
- return data;
- },
-
-
- /**
- * Retrieve the sum of the field of the records that match the selection query.
- *
- * @name HttpAdapter#sum
- * @method
- * @param {Object} mapper The mapper.
- * @param {string} field The field to sum.
- * @param {Object} query Selection query.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- sum: function sum(mapper, field, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- if (!_jsData.utils.utils.isString(field)) {
- throw new Error('field must be a string!');
- }
- opts.params = self.getParams(opts);
- opts.params.sum = field;
- opts.suffix = self.getSuffix(mapper, opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
-
- return __super__.sum.call(self, mapper, field, query, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#update
- * @method
- * @param {Object} mapper TODO
- * @param {*} id TODO
- * @param {*} props TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- update: function update(mapper, id, props, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.update.call(self, mapper, id, props, opts);
- },
-
-
- /**
- * TODO
- *
- * @name HttpAdapter#updateAll
- * @method
- * @param {Object} mapper TODO
- * @param {Object} props TODO
- * @param {Object} query TODO
- * @param {Object} [opts] Configuration options.
- * @return {Promise}
- */
- updateAll: function updateAll(mapper, props, query, opts) {
- var self = this;
- query || (query = {});
- opts || (opts = {});
- opts.params = self.getParams(opts);
- _jsData.utils.deepMixIn(opts.params, query);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.updateAll.call(self, mapper, props, query, opts);
- },
-
-
- /**
- * Update multiple records in batch.
- *
- * {@link HttpAdapter#beforeUpdateMany} will be called before calling
- * {@link HttpAdapter#PUT}.
- * {@link HttpAdapter#afterUpdateMany} will be called after calling
- * {@link HttpAdapter#PUT}.
- *
- * @name HttpAdapter#updateMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Array} records Array of property objects to send as the payload.
- * @param {Object} [opts] Configuration options.
- * @param {string} [opts.params] TODO
- * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO
- * @return {Promise}
- */
- updateMany: function updateMany(mapper, records, opts) {
- var self = this;
- opts || (opts = {});
- opts.params = self.getParams(opts);
- opts.params = self.queryTransform(mapper, opts.params, opts);
- opts.suffix = self.getSuffix(mapper, opts);
-
- return __super__.updateMany.call(self, mapper, records, opts);
- }
- });
-
- /**
- * Add an Http actions to a mapper.
- *
- * @name HttpAdapter.addAction
- * @method
- * @param {string} name Name of the new action.
- * @param {Object} [opts] Action configuration
- * @param {string} [opts.adapter]
- * @param {string} [opts.pathname]
- * @param {Function} [opts.request]
- * @param {Function} [opts.response]
- * @param {Function} [opts.responseError]
- * @return {Function} Decoration function, which should be passed the mapper to
- * decorate when invoked.
- */
- HttpAdapter.addAction = function (name, opts) {
- if (!name || !_jsData.utils.isString(name)) {
- throw new TypeError('action(name[, opts]): Expected: string, Found: ' + (typeof name === 'undefined' ? 'undefined' : _typeof(name)));
- }
- return function (mapper) {
- if (mapper[name]) {
- throw new Error('action(name[, opts]): ' + name + ' already exists on target!');
- }
- opts.request = opts.request || function (config) {
- return config;
- };
- opts.response = opts.response || function (response) {
- return response;
- };
- opts.responseError = opts.responseError || function (err) {
- return _jsData.utils.reject(err);
- };
- mapper[name] = function (id, _opts) {
- var self = this;
- if (_jsData.utils.isObject(id)) {
- _opts = id;
- }
- _opts = _opts || {};
- var adapter = self.getAdapter(opts.adapter || self.defaultAdapter || 'http');
- var config = {};
- _jsData.utils.fillIn(config, opts);
- if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {
- _opts.endpoint = config.endpoint;
- }
- if (typeof _opts.getEndpoint === 'function') {
- config.url = _opts.getEndpoint(self, _opts);
- } else {
- var _args = [_opts.basePath || self.basePath || adapter.basePath, adapter.getEndpoint(self, _jsData.utils.isSorN(id) ? id : null, _opts)];
- if (_jsData.utils.isSorN(id)) {
- _args.push(id);
- }
- _args.push(opts.pathname || name);
- config.url = makePath.apply(null, _args);
- }
- config.method = config.method || 'GET';
- config.mapper = self.name;
- _jsData.utils.deepMixIn(config)(_opts);
- return _jsData.utils.resolve(config).then(_opts.request || opts.request).then(function (config) {
- return adapter.HTTP(config);
- }).then(function (data) {
- if (data && data.config) {
- data.config.mapper = self.name;
- }
- return data;
- }).then(_opts.response || opts.response, _opts.responseError || opts.responseError);
- };
- return mapper;
- };
- };
-
- /**
- * Add multiple Http actions to a mapper. See {@link HttpAdapter.addAction} for
- * action configuration options.
- *
- * @name HttpAdapter.addActions
- * @method
- * @param {Object.} opts Object where the key is an action name
- * and the value is the configuration for the action.
- * @return {Function} Decoration function, which should be passed the mapper to
- * decorate when invoked.
- */
- HttpAdapter.addActions = function (opts) {
- opts || (opts = {});
- return function (mapper) {
- _jsData.utils.forOwn(mapper, function (value, key) {
- HttpAdapter.addAction(key, value)(mapper);
- });
- return mapper;
- };
- };
-
- /**
- * Alternative to ES6 class syntax for extending `HttpAdapter`.
- *
- * __ES6__:
- * ```javascript
- * class MyHttpAdapter extends HttpAdapter {
- * deserialize (Model, data, opts) {
- * const data = super.deserialize(Model, data, opts)
- * data.foo = 'bar'
- * return data
- * }
- * }
- * ```
- *
- * __ES5__:
- * ```javascript
- * var instanceProps = {
- * // override deserialize
- * deserialize: function (Model, data, opts) {
- * var Ctor = this.constructor
- * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize
- * // call the super deserialize
- * var data = superDeserialize(Model, data, opts)
- * data.foo = 'bar'
- * return data
- * },
- * say: function () { return 'hi' }
- * }
- * var classProps = {
- * yell: function () { return 'HI' }
- * }
- *
- * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps)
- * var adapter = new MyHttpAdapter()
- * adapter.say() // "hi"
- * MyHttpAdapter.yell() // "HI"
- * ```
- *
- * @name HttpAdapter.extend
- * @method
- * @param {Object} [instanceProps] Properties that will be added to the
- * prototype of the subclass.
- * @param {Object} [classProps] Properties that will be added as static
- * properties to the subclass itself.
- * @return {Object} Subclass of `HttpAdapter`.
- */
- HttpAdapter.extend = _jsData.utils.extend;
-
- /**
- * Details of the current version of the `js-data-http` module.
- *
- * @name HttpAdapter.version
- * @type {Object}
- * @property {string} version.full The full semver value.
- * @property {number} version.major The major version number.
- * @property {number} version.minor The minor version number.
- * @property {number} version.patch The patch version number.
- * @property {(string|boolean)} version.alpha The alpha version value,
- * otherwise `false` if the current version is not alpha.
- * @property {(string|boolean)} version.beta The beta version value,
- * otherwise `false` if the current version is not beta.
- */
- HttpAdapter.version = {
- beta: 2,
- full: '3.0.0-beta.2',
- major: 3,
- minor: 0,
- patch: 0
-};
-
- /**
- * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http`
- * that works on Node.js is registered in NPM as `js-data-http-node`. The build
- * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower
- * as `js-data-fetch`.
- *
- * __Script tag__:
- * ```javascript
- * window.HttpAdapter
- * ```
- * __CommonJS__:
- * ```javascript
- * var HttpAdapter = require('js-data-http')
- * ```
- * __ES6 Modules__:
- * ```javascript
- * import HttpAdapter from 'js-data-http'
- * ```
- * __AMD__:
- * ```javascript
- * define('myApp', ['js-data-http'], function (HttpAdapter) { ... })
- * ```
- *
- * @module js-data-http
- */
-
- module.exports = HttpAdapter;
-
-/***/ },
-/* 1 */
-/***/ function(module, exports) {
-
- module.exports = __WEBPACK_EXTERNAL_MODULE_1__;
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- (function (global, factory) {
- true ? factory(__webpack_require__(1)) :
- typeof define === 'function' && define.amd ? define('js-data-adapter', ['js-data'], factory) :
- (factory(global.JSData));
- }(this, function (jsData) { 'use strict';
-
- var babelHelpers = {};
- babelHelpers.typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
- return typeof obj;
- } : function (obj) {
- return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
- };
-
- babelHelpers.defineProperty = function (obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
-
- return obj;
- };
-
- babelHelpers.slicedToArray = function () {
- function sliceIterator(arr, i) {
- var _arr = [];
- var _n = true;
- var _d = false;
- var _e = undefined;
-
- try {
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
- _arr.push(_s.value);
-
- if (i && _arr.length === i) break;
- }
- } catch (err) {
- _d = true;
- _e = err;
- } finally {
- try {
- if (!_n && _i["return"]) _i["return"]();
- } finally {
- if (_d) throw _e;
- }
- }
-
- return _arr;
- }
-
- return function (arr, i) {
- if (Array.isArray(arr)) {
- return arr;
- } else if (Symbol.iterator in Object(arr)) {
- return sliceIterator(arr, i);
- } else {
- throw new TypeError("Invalid attempt to destructure non-iterable instance");
- }
- };
- }();
-
- babelHelpers;
-
- var noop = function noop() {
- var self = this;
-
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
-
- var opts = args[args.length - 1];
- self.dbg.apply(self, [opts.op].concat(args));
- return jsData.utils.resolve();
- };
-
- var noop2 = function noop2() {
- var self = this;
-
- for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
-
- var opts = args[args.length - 2];
- self.dbg.apply(self, [opts.op].concat(args));
- return jsData.utils.resolve();
- };
-
- var unique = function unique(array) {
- var seen = {};
- var final = [];
- array.forEach(function (item) {
- if (item in seen) {
- return;
- }
- final.push(item);
- seen[item] = 0;
- });
- return final;
- };
-
- var withoutRelations = function withoutRelations(mapper, props) {
- return jsData.utils.omit(props, mapper.relationFields || []);
- };
-
- var DEFAULTS = {
- /**
- * Whether to log debugging information.
- *
- * @name Adapter#debug
- * @type {boolean}
- * @default false
- */
- debug: false,
-
- /**
- * Whether to return a more detailed response object.
- *
- * @name Adapter#raw
- * @type {boolean}
- * @default false
- */
- raw: false
- };
-
- /**
- * Abstract class meant to be extended by adapters.
- *
- * @class Adapter
- * @abstract
- * @param {Object} [opts] Configuration opts.
- * @param {boolean} [opts.debug=false] Whether to log debugging information.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed response
- * object.
- */
- function Adapter(opts) {
- var self = this;
- opts || (opts = {});
- jsData.utils.fillIn(opts, DEFAULTS);
- jsData.utils.fillIn(self, opts);
- }
-
- Adapter.reserved = ['orderBy', 'sort', 'limit', 'offset', 'skip', 'where'];
-
- /**
- * Response object used when `raw` is `true`. May contain other fields in
- * addition to `data`.
- *
- * @typedef {Object} Response
- * @property {Object} data Response data.
- * @property {string} op The operation for which the response was created.
- */
- function Response(data, meta, op) {
- var self = this;
- meta || (meta = {});
- self.data = data;
- jsData.utils.fillIn(self, meta);
- self.op = op;
- }
-
- Adapter.Response = Response;
-
- /**
- * Alternative to ES6 class syntax for extending `Adapter`.
- *
- * @name Adapter.extend
- * @method
- * @param {Object} [instanceProps] Properties that will be added to the
- * prototype of the subclass.
- * @param {Object} [classProps] Properties that will be added as static
- * properties to the subclass itself.
- * @return {Object} Subclass of `Adapter`.
- */
- Adapter.extend = jsData.utils.extend;
-
- jsData.utils.addHiddenPropsToTarget(Adapter.prototype, {
- /**
- * Lifecycle method method called by count.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes count to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the count.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
- *
- * @name Adapter#afterCount
- * @method
- * @param {Object} mapper The `mapper` argument passed to count.
- * @param {Object} props The `props` argument passed to count.
- * @param {Object} opts The `opts` argument passed to count.
- * @property {string} opts.op `afterCount`
- * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCount: noop2,
-
- /**
- * Lifecycle method method called by create.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes create to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created record.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
- *
- * @name Adapter#afterCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to create.
- * @param {Object} props The `props` argument passed to create.
- * @param {Object} opts The `opts` argument passed to create.
- * @property {string} opts.op `afterCreate`
- * @param {Object|Response} response Created record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCreate: noop2,
-
- /**
- * Lifecycle method method called by createMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created records.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
- *
- * @name Adapter#afterCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to createMany.
- * @param {Object[]} props The `props` argument passed to createMany.
- * @param {Object} opts The `opts` argument passed to createMany.
- * @property {string} opts.op `afterCreateMany`
- * @param {Object[]|Response} response Created records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterCreateMany: noop2,
-
- /**
- * Lifecycle method method called by destroy.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
- *
- * @name Adapter#afterDestroy
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroy.
- * @param {(string|number)} id The `id` argument passed to destroy.
- * @param {Object} opts The `opts` argument passed to destroy.
- * @property {string} opts.op `afterDestroy`
- * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.
- */
- afterDestroy: noop2,
-
- /**
- * Lifecycle method method called by destroyAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
- *
- * @name Adapter#afterDestroyAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroyAll.
- * @param {Object} query The `query` argument passed to destroyAll.
- * @param {Object} opts The `opts` argument passed to destroyAll.
- * @property {string} opts.op `afterDestroyAll`
- * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.
- */
- afterDestroyAll: noop2,
-
- /**
- * Lifecycle method method called by find.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes find to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found record, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
- *
- * @name Adapter#afterFind
- * @method
- * @param {Object} mapper The `mapper` argument passed to find.
- * @param {(string|number)} id The `id` argument passed to find.
- * @param {Object} opts The `opts` argument passed to find.
- * @property {string} opts.op `afterFind`
- * @param {Object|Response} response The found record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterFind: noop2,
-
- /**
- * Lifecycle method method called by findAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
- *
- * @name Adapter#afterFindAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to findAll.
- * @param {Object} query The `query` argument passed to findAll.
- * @param {Object} opts The `opts` argument passed to findAll.
- * @property {string} opts.op `afterFindAll`
- * @param {Object[]|Response} response The found records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterFindAll: noop2,
-
- /**
- * Lifecycle method method called by sum.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes sum to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the sum.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
- *
- * @name Adapter#afterSum
- * @method
- * @param {Object} mapper The `mapper` argument passed to sum.
- * @param {Object} props The `props` argument passed to sum.
- * @param {Object} opts The `opts` argument passed to sum.
- * @property {string} opts.op `afterSum`
- * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.
- */
- afterSum: noop2,
-
- /**
- * Lifecycle method method called by update.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes update to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated record.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
- *
- * @name Adapter#afterUpdate
- * @method
- * @param {Object} mapper The `mapper` argument passed to update.
- * @param {(string|number)} id The `id` argument passed to update.
- * @param {Object} props The `props` argument passed to update.
- * @param {Object} opts The `opts` argument passed to update.
- * @property {string} opts.op `afterUpdate`
- * @param {Object|Response} response The updated record or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdate: noop2,
-
- /**
- * Lifecycle method method called by updateAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
- *
- * @name Adapter#afterUpdateAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateAll.
- * @param {Object} props The `props` argument passed to updateAll.
- * @param {Object} query The `query` argument passed to updateAll.
- * @param {Object} opts The `opts` argument passed to updateAll.
- * @property {string} opts.op `afterUpdateAll`
- * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdateAll: noop2,
-
- /**
- * Lifecycle method method called by updateMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
- *
- * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.
- *
- * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
- *
- * @name Adapter#afterUpdateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateMany.
- * @param {Object[]} records The `records` argument passed to updateMany.
- * @param {Object} opts The `opts` argument passed to updateMany.
- * @property {string} opts.op `afterUpdateMany`
- * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.
- */
- afterUpdateMany: noop2,
-
- /**
- * Lifecycle method method called by count.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes count to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.
- *
- * @name Adapter#beforeCount
- * @method
- * @param {Object} mapper The `mapper` argument passed to count.
- * @param {Object} query The `query` argument passed to count.
- * @param {Object} opts The `opts` argument passed to count.
- * @property {string} opts.op `beforeCount`
- */
- beforeCount: noop,
-
- /**
- * Lifecycle method method called by create.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes create to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.
- *
- * @name Adapter#beforeCreate
- * @method
- * @param {Object} mapper The `mapper` argument passed to create.
- * @param {Object} props The `props` argument passed to create.
- * @param {Object} opts The `opts` argument passed to create.
- * @property {string} opts.op `beforeCreate`
- */
- beforeCreate: noop,
-
- /**
- * Lifecycle method method called by createMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.
- *
- * @name Adapter#beforeCreateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to createMany.
- * @param {Object[]} props The `props` argument passed to createMany.
- * @param {Object} opts The `opts` argument passed to createMany.
- * @property {string} opts.op `beforeCreateMany`
- */
- beforeCreateMany: noop,
-
- /**
- * Lifecycle method method called by destroy.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.
- *
- * @name Adapter#beforeDestroy
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroy.
- * @param {(string|number)} id The `id` argument passed to destroy.
- * @param {Object} opts The `opts` argument passed to destroy.
- * @property {string} opts.op `beforeDestroy`
- */
- beforeDestroy: noop,
-
- /**
- * Lifecycle method method called by destroyAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.
- *
- * @name Adapter#beforeDestroyAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to destroyAll.
- * @param {Object} query The `query` argument passed to destroyAll.
- * @param {Object} opts The `opts` argument passed to destroyAll.
- * @property {string} opts.op `beforeDestroyAll`
- */
- beforeDestroyAll: noop,
-
- /**
- * Lifecycle method method called by find.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes find to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.
- *
- * @name Adapter#beforeFind
- * @method
- * @param {Object} mapper The `mapper` argument passed to find.
- * @param {(string|number)} id The `id` argument passed to find.
- * @param {Object} opts The `opts` argument passed to find.
- * @property {string} opts.op `beforeFind`
- */
- beforeFind: noop,
-
- /**
- * Lifecycle method method called by findAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.
- *
- * @name Adapter#beforeFindAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to findAll.
- * @param {Object} query The `query` argument passed to findAll.
- * @param {Object} opts The `opts` argument passed to findAll.
- * @property {string} opts.op `beforeFindAll`
- */
- beforeFindAll: noop,
-
- /**
- * Lifecycle method method called by sum.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes sum to wait for the Promise to resolve before continuing.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.
- *
- * @name Adapter#beforeSum
- * @method
- * @param {Object} mapper The `mapper` argument passed to sum.
- * @param {Object} query The `query` argument passed to sum.
- * @param {Object} opts The `opts` argument passed to sum.
- * @property {string} opts.op `beforeSum`
- */
- beforeSum: noop,
-
- /**
- * Lifecycle method method called by update.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes update to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.
- *
- * @name Adapter#beforeUpdate
- * @method
- * @param {Object} mapper The `mapper` argument passed to update.
- * @param {(string|number)} id The `id` argument passed to update.
- * @param {Object} props The `props` argument passed to update.
- * @param {Object} opts The `opts` argument passed to update.
- * @property {string} opts.op `beforeUpdate`
- */
- beforeUpdate: noop,
-
- /**
- * Lifecycle method method called by updateAll.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.
- *
- * @name Adapter#beforeUpdateAll
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateAll.
- * @param {Object} props The `props` argument passed to updateAll.
- * @param {Object} query The `query` argument passed to updateAll.
- * @param {Object} opts The `opts` argument passed to updateAll.
- * @property {string} opts.op `beforeUpdateAll`
- */
- beforeUpdateAll: noop,
-
- /**
- * Lifecycle method method called by updateMany.
- *
- * Override this method to add custom behavior for this lifecycle hook.
- *
- * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.
- *
- * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.
- *
- * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.
- *
- * @name Adapter#beforeUpdateMany
- * @method
- * @param {Object} mapper The `mapper` argument passed to updateMany.
- * @param {Object[]} props The `props` argument passed to updateMany.
- * @param {Object} opts The `opts` argument passed to updateMany.
- * @property {string} opts.op `beforeUpdateMany`
- */
- beforeUpdateMany: noop,
-
- /**
- * Shortcut for `#log('debug'[, arg1[, arg2[, argn]]])`.
- *
- * @name Adapter#dbg
- * @method
- */
- dbg: function dbg() {
- for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
-
- this.log.apply(this, ['debug'].concat(args));
- },
-
-
- /**
- * Retrieve the number of records that match the selection query. Called by
- * `Mapper#count`.
- *
- * @name Adapter#count
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- count: function count(mapper, query, opts) {
- var self = this;
- var op = void 0;
- query || (query = {});
- opts || (opts = {});
-
- // beforeCount lifecycle hook
- op = opts.op = 'beforeCount';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- // Allow for re-assignment from lifecycle hook
- op = opts.op = 'count';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._count(mapper, query, opts));
- }).then(function (results) {
- var _results = babelHelpers.slicedToArray(results, 2);
-
- var data = _results[0];
- var result = _results[1];
-
- result || (result = {});
- var response = new Response(data, result, op);
- response = self.respond(response, opts);
-
- // afterCount lifecycle hook
- op = opts.op = 'afterCount';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Create a new record. Called by `Mapper#create`.
- *
- * @name Adapter#create
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The record to be created.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- create: function create(mapper, props, opts) {
- var self = this;
- var op = void 0;
- props || (props = {});
- opts || (opts = {});
-
- // beforeCreate lifecycle hook
- op = opts.op = 'beforeCreate';
- return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- props = withoutRelations(mapper, props);
- op = opts.op = 'create';
- self.dbg(op, mapper, props, opts);
- return jsData.utils.resolve(self._create(mapper, props, opts));
- }).then(function (results) {
- var _results2 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results2[0];
- var result = _results2[1];
-
- result || (result = {});
- var response = new Response(data, result, 'create');
- response.created = data ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterCreate lifecycle hook
- op = opts.op = 'afterCreate';
- return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Create multiple records in a single batch. Called by `Mapper#createMany`.
- *
- * @name Adapter#createMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The records to be created.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- createMany: function createMany(mapper, props, opts) {
- var self = this;
- var op = void 0;
- props || (props = {});
- opts || (opts = {});
-
- // beforeCreateMany lifecycle hook
- op = opts.op = 'beforeCreateMany';
- return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- props = props.map(function (record) {
- return withoutRelations(mapper, record);
- });
- op = opts.op = 'createMany';
- self.dbg(op, mapper, props, opts);
- return jsData.utils.resolve(self._createMany(mapper, props, opts));
- }).then(function (results) {
- var _results3 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results3[0];
- var result = _results3[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'createMany');
- response.created = data.length;
- response = self.respond(response, opts);
-
- // afterCreateMany lifecycle hook
- op = opts.op = 'afterCreateMany';
- return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Destroy the record with the given primary key. Called by
- * `Mapper#destroy`.
- *
- * @name Adapter#destroy
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to destroy.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- destroy: function destroy(mapper, id, opts) {
- var self = this;
- var op = void 0;
- opts || (opts = {});
-
- // beforeDestroy lifecycle hook
- op = opts.op = 'beforeDestroy';
- return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {
- op = opts.op = 'destroy';
- self.dbg(op, mapper, id, opts);
- return jsData.utils.resolve(self._destroy(mapper, id, opts));
- }).then(function (results) {
- var _results4 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results4[0];
- var result = _results4[1];
-
- result || (result = {});
- var response = new Response(data, result, 'destroy');
- response = self.respond(response, opts);
-
- // afterDestroy lifecycle hook
- op = opts.op = 'afterDestroy';
- return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Destroy the records that match the selection query. Called by
- * `Mapper#destroyAll`.
- *
- * @name Adapter#destroyAll
- * @method
- * @param {Object} mapper the mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- destroyAll: function destroyAll(mapper, query, opts) {
- var self = this;
- var op = void 0;
- query || (query = {});
- opts || (opts = {});
-
- // beforeDestroyAll lifecycle hook
- op = opts.op = 'beforeDestroyAll';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- op = opts.op = 'destroyAll';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._destroyAll(mapper, query, opts));
- }).then(function (results) {
- var _results5 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results5[0];
- var result = _results5[1];
-
- result || (result = {});
- var response = new Response(data, result, 'destroyAll');
- response = self.respond(response, opts);
-
- // afterDestroyAll lifecycle hook
- op = opts.op = 'afterDestroyAll';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Return the foreignKey from the given record for the provided relationship.
- *
- * There may be reasons why you may want to override this method, like when
- * the id of the parent doesn't exactly match up to the key on the child.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyForeignKey
- * @method
- * @return {*}
- */
- makeHasManyForeignKey: function makeHasManyForeignKey(mapper, def, record) {
- return def.getForeignKey(record);
- },
-
-
- /**
- * Return the localKeys from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyLocalKeys
- * @method
- * @return {*}
- */
- makeHasManyLocalKeys: function makeHasManyLocalKeys(mapper, def, record) {
- var localKeys = [];
- var itemKeys = jsData.utils.get(record, def.localKeys) || [];
- itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);
- localKeys = localKeys.concat(itemKeys);
- return unique(localKeys).filter(function (x) {
- return x;
- });
- },
-
-
- /**
- * Return the foreignKeys from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeHasManyForeignKeys
- * @method
- * @return {*}
- */
- makeHasManyForeignKeys: function makeHasManyForeignKeys(mapper, def, record) {
- return jsData.utils.get(record, mapper.idAttribute);
- },
-
-
- /**
- * Load a hasMany relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadHasMany
- * @method
- * @return {Promise}
- */
- loadHasMany: function loadHasMany(mapper, def, records, __opts) {
- var self = this;
- var singular = false;
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- singular = true;
- records = [records];
- }
- var IDs = records.map(function (record) {
- return self.makeHasManyForeignKey(mapper, def, record);
- });
- var query = {
- where: {}
- };
- var criteria = query.where[def.foreignKey] = {};
- if (singular) {
- // more efficient query when we only have one record
- criteria['=='] = IDs[0];
- } else {
- criteria['in'] = IDs.filter(function (id) {
- return id;
- });
- }
- return self.findAll(def.getRelation(), query, __opts).then(function (relatedItems) {
- records.forEach(function (record) {
- var attached = [];
- // avoid unneccesary iteration when we only have one record
- if (singular) {
- attached = relatedItems;
- } else {
- relatedItems.forEach(function (relatedItem) {
- if (jsData.utils.get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {
- attached.push(relatedItem);
- }
- });
- }
- def.setLocalField(record, attached);
- });
- });
- },
- loadHasManyLocalKeys: function loadHasManyLocalKeys(mapper, def, records, __opts) {
- var self = this;
- var record = void 0;
- var relatedMapper = def.getRelation();
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- record = records;
- }
-
- if (record) {
- return self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {
- 'in': self.makeHasManyLocalKeys(mapper, def, record)
- })
- }, __opts).then(function (relatedItems) {
- def.setLocalField(record, relatedItems);
- });
- } else {
- var _ret = function () {
- var localKeys = [];
- records.forEach(function (record) {
- localKeys = localKeys.concat(self.self.makeHasManyLocalKeys(mapper, def, record));
- });
- return {
- v: self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {
- 'in': unique(localKeys).filter(function (x) {
- return x;
- })
- })
- }, __opts).then(function (relatedItems) {
- records.forEach(function (item) {
- var attached = [];
- var itemKeys = jsData.utils.get(item, def.localKeys) || [];
- itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);
- relatedItems.forEach(function (relatedItem) {
- if (itemKeys && itemKeys.indexOf(relatedItem[relatedMapper.idAttribute]) !== -1) {
- attached.push(relatedItem);
- }
- });
- def.setLocalField(item, attached);
- });
- return relatedItems;
- })
- };
- }();
-
- if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === "object") return _ret.v;
- }
- },
- loadHasManyForeignKeys: function loadHasManyForeignKeys(mapper, def, records, __opts) {
- var self = this;
- var relatedMapper = def.getRelation();
- var idAttribute = mapper.idAttribute;
- var record = void 0;
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- record = records;
- }
-
- if (record) {
- return self.findAll(def.getRelation(), {
- where: babelHelpers.defineProperty({}, def.foreignKeys, {
- 'contains': self.makeHasManyForeignKeys(mapper, def, record)
- })
- }, __opts).then(function (relatedItems) {
- def.setLocalField(record, relatedItems);
- });
- } else {
- return self.findAll(relatedMapper, {
- where: babelHelpers.defineProperty({}, def.foreignKeys, {
- 'isectNotEmpty': records.map(function (record) {
- return self.makeHasManyForeignKeys(mapper, def, record);
- })
- })
- }, __opts).then(function (relatedItems) {
- var foreignKeysField = def.foreignKeys;
- records.forEach(function (record) {
- var _relatedItems = [];
- var id = jsData.utils.get(record, idAttribute);
- relatedItems.forEach(function (relatedItem) {
- var foreignKeys = jsData.utils.get(relatedItems, foreignKeysField) || [];
- if (foreignKeys.indexOf(id) !== -1) {
- _relatedItems.push(relatedItem);
- }
- });
- def.setLocalField(record, _relatedItems);
- });
- });
- }
- },
-
-
- /**
- * Load a hasOne relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadHasOne
- * @method
- * @return {Promise}
- */
- loadHasOne: function loadHasOne(mapper, def, records, __opts) {
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- records = [records];
- }
- return this.loadHasMany(mapper, def, records, __opts).then(function () {
- records.forEach(function (record) {
- var relatedData = def.getLocalField(record);
- if (jsData.utils.isArray(relatedData) && relatedData.length) {
- def.setLocalField(record, relatedData[0]);
- }
- });
- });
- },
-
-
- /**
- * Return the foreignKey from the given record for the provided relationship.
- *
- * Override with care.
- *
- * @name Adapter#makeBelongsToForeignKey
- * @method
- * @return {*}
- */
- makeBelongsToForeignKey: function makeBelongsToForeignKey(mapper, def, record) {
- return def.getForeignKey(record);
- },
-
-
- /**
- * Load a belongsTo relationship.
- *
- * Override with care.
- *
- * @name Adapter#loadBelongsTo
- * @method
- * @return {Promise}
- */
- loadBelongsTo: function loadBelongsTo(mapper, def, records, __opts) {
- var self = this;
- var relationDef = def.getRelation();
-
- if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {
- var _ret2 = function () {
- var record = records;
- return {
- v: self.find(relationDef, self.makeBelongsToForeignKey(mapper, def, record), __opts).then(function (relatedItem) {
- def.setLocalField(record, relatedItem);
- })
- };
- }();
-
- if ((typeof _ret2 === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret2)) === "object") return _ret2.v;
- } else {
- var keys = records.map(function (record) {
- return self.makeBelongsToForeignKey(mapper, def, record);
- }).filter(function (key) {
- return key;
- });
- return self.findAll(relationDef, {
- where: babelHelpers.defineProperty({}, relationDef.idAttribute, {
- 'in': keys
- })
- }, __opts).then(function (relatedItems) {
- records.forEach(function (record) {
- relatedItems.forEach(function (relatedItem) {
- if (relatedItem[relationDef.idAttribute] === record[def.foreignKey]) {
- def.setLocalField(record, relatedItem);
- }
- });
- });
- });
- }
- },
-
-
- /**
- * Retrieve the record with the given primary key. Called by `Mapper#find`.
- *
- * @name Adapter#find
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id Primary key of the record to retrieve.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @param {string[]} [opts.with=[]] Relations to eager load.
- * @return {Promise}
- */
- find: function find(mapper, id, opts) {
- var self = this;
- var record = void 0,
- op = void 0;
- opts || (opts = {});
- opts.with || (opts.with = []);
-
- // beforeFind lifecycle hook
- op = opts.op = 'beforeFind';
- return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {
- op = opts.op = 'find';
- self.dbg(op, mapper, id, opts);
- return jsData.utils.resolve(self._find(mapper, id, opts));
- }).then(function (results) {
- var _results6 = babelHelpers.slicedToArray(results, 1);
-
- var _record = _results6[0];
-
- if (!_record) {
- return;
- }
- record = _record;
- var tasks = [];
-
- jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {
- var task = void 0;
- if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {
- if (def.type === 'hasOne') {
- task = self.loadHasOne(mapper, def, record, __opts);
- } else {
- task = self.loadHasMany(mapper, def, record, __opts);
- }
- } else if (def.type === 'hasMany' && def.localKeys) {
- task = self.loadHasManyLocalKeys(mapper, def, record, __opts);
- } else if (def.type === 'hasMany' && def.foreignKeys) {
- task = self.loadHasManyForeignKeys(mapper, def, record, __opts);
- } else if (def.type === 'belongsTo') {
- task = self.loadBelongsTo(mapper, def, record, __opts);
- }
- if (task) {
- tasks.push(task);
- }
- });
-
- return Promise.all(tasks);
- }).then(function () {
- var response = new Response(record, {}, 'find');
- response.found = record ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterFind lifecycle hook
- op = opts.op = 'afterFind';
- return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Retrieve the records that match the selection query.
- *
- * @name Adapter#findAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @param {string[]} [opts.with=[]] Relations to eager load.
- * @return {Promise}
- */
- findAll: function findAll(mapper, query, opts) {
- var self = this;
- opts || (opts = {});
- opts.with || (opts.with = []);
-
- var records = [];
- var op = void 0;
- var activeWith = opts._activeWith;
-
- if (jsData.utils.isObject(activeWith)) {
- var activeQuery = activeWith.query || {};
- if (activeWith.replace) {
- query = activeQuery;
- } else {
- jsData.utils.deepFillIn(query, activeQuery);
- }
- }
-
- // beforeFindAll lifecycle hook
- op = opts.op = 'beforeFindAll';
- return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {
- op = opts.op = 'findAll';
- self.dbg(op, mapper, query, opts);
- return jsData.utils.resolve(self._findAll(mapper, query, opts));
- }).then(function (results) {
- var _results7 = babelHelpers.slicedToArray(results, 1);
-
- var _records = _results7[0];
-
- _records || (_records = []);
- records = _records;
- var tasks = [];
- jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {
- var task = void 0;
- if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {
- if (def.type === 'hasMany') {
- task = self.loadHasMany(mapper, def, records, __opts);
- } else {
- task = self.loadHasOne(mapper, def, records, __opts);
- }
- } else if (def.type === 'hasMany' && def.localKeys) {
- task = self.loadHasManyLocalKeys(mapper, def, records, __opts);
- } else if (def.type === 'hasMany' && def.foreignKeys) {
- task = self.loadHasManyForeignKeys(mapper, def, records, __opts);
- } else if (def.type === 'belongsTo') {
- task = self.loadBelongsTo(mapper, def, records, __opts);
- }
- if (task) {
- tasks.push(task);
- }
- });
- return Promise.all(tasks);
- }).then(function () {
- var response = new Response(records, {}, 'findAll');
- response.found = records.length;
- response = self.respond(response, opts);
-
- // afterFindAll lifecycle hook
- op = opts.op = 'afterFindAll';
- return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Resolve the value of the specified option based on the given options and
- * this adapter's settings. Override with care.
- *
- * @name Adapter#getOpt
- * @method
- * @param {string} opt The name of the option.
- * @param {Object} [opts] Configuration options.
- * @return {*} The value of the specified option.
- */
- getOpt: function getOpt(opt, opts) {
- opts || (opts = {});
- return jsData.utils.isUndefined(opts[opt]) ? jsData.utils.plainCopy(this[opt]) : jsData.utils.plainCopy(opts[opt]);
- },
-
-
- /**
- * Logging utility method. Override this method if you want to send log
- * messages to something other than the console.
- *
- * @name Adapter#log
- * @method
- * @param {string} level Log level.
- * @param {...*} values Values to log.
- */
- log: function log(level) {
- for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
- args[_key4 - 1] = arguments[_key4];
- }
-
- if (level && !args.length) {
- args.push(level);
- level = 'debug';
- }
- if (level === 'debug' && !this.debug) {
- return;
- }
- var prefix = level.toUpperCase() + ': (Adapter)';
- if (console[level]) {
- var _console;
-
- (_console = console)[level].apply(_console, [prefix].concat(args));
- } else {
- var _console2;
-
- (_console2 = console).log.apply(_console2, [prefix].concat(args));
- }
- },
-
-
- /**
- * Retrieve sum of the specified field of the records that match the selection
- * query. Called by `Mapper#sum`.
- *
- * @name Adapter#sum
- * @method
- * @param {Object} mapper The mapper.
- * @param {string} field By to sum.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- sum: function sum(mapper, field, query, opts) {
- var self = this;
- var op = void 0;
- if (!jsData.utils.isString(field)) {
- throw new Error('field must be a string!');
- }
- query || (query = {});
- opts || (opts = {});
-
- // beforeSum lifecycle hook
- op = opts.op = 'beforeSum';
- return jsData.utils.resolve(self[op](mapper, field, query, opts)).then(function () {
- // Allow for re-assignment from lifecycle hook
- op = opts.op = 'sum';
- self.dbg(op, mapper, field, query, opts);
- return jsData.utils.resolve(self._sum(mapper, field, query, opts));
- }).then(function (results) {
- var _results8 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results8[0];
- var result = _results8[1];
-
- result || (result = {});
- var response = new Response(data, result, op);
- response = self.respond(response, opts);
-
- // afterSum lifecycle hook
- op = opts.op = 'afterSum';
- return jsData.utils.resolve(self[op](mapper, field, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * @name Adapter#respond
- * @method
- * @param {Object} response Response object.
- * @param {Object} opts Configuration options.
- * return {Object} If `opts.raw == true` then return `response`, else return
- * `response.data`.
- */
- respond: function respond(response, opts) {
- return this.getOpt('raw', opts) ? response : response.data;
- },
-
-
- /**
- * Apply the given update to the record with the specified primary key. Called
- * by `Mapper#update`.
- *
- * @name Adapter#update
- * @method
- * @param {Object} mapper The mapper.
- * @param {(string|number)} id The primary key of the record to be updated.
- * @param {Object} props The update to apply to the record.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- update: function update(mapper, id, props, opts) {
- var self = this;
- props || (props = {});
- opts || (opts = {});
- var op = void 0;
-
- // beforeUpdate lifecycle hook
- op = opts.op = 'beforeUpdate';
- return jsData.utils.resolve(self[op](mapper, id, props, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- op = opts.op = 'update';
- self.dbg(op, mapper, id, props, opts);
- return jsData.utils.resolve(self._update(mapper, id, props, opts));
- }).then(function (results) {
- var _results9 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results9[0];
- var result = _results9[1];
-
- result || (result = {});
- var response = new Response(data, result, 'update');
- response.updated = data ? 1 : 0;
- response = self.respond(response, opts);
-
- // afterUpdate lifecycle hook
- op = opts.op = 'afterUpdate';
- return jsData.utils.resolve(self[op](mapper, id, props, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Apply the given update to all records that match the selection query.
- * Called by `Mapper#updateAll`.
- *
- * @name Adapter#updateAll
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object} props The update to apply to the selected records.
- * @param {Object} [query] Selection query.
- * @param {Object} [query.where] Filtering criteria.
- * @param {string|Array} [query.orderBy] Sorting criteria.
- * @param {string|Array} [query.sort] Same as `query.sort`.
- * @param {number} [query.limit] Limit results.
- * @param {number} [query.skip] Offset results.
- * @param {number} [query.offset] Same as `query.skip`.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- updateAll: function updateAll(mapper, props, query, opts) {
- var self = this;
- props || (props = {});
- query || (query = {});
- opts || (opts = {});
- var op = void 0;
-
- // beforeUpdateAll lifecycle hook
- op = opts.op = 'beforeUpdateAll';
- return jsData.utils.resolve(self[op](mapper, props, query, opts)).then(function (_props) {
- // Allow for re-assignment from lifecycle hook
- props = jsData.utils.isUndefined(_props) ? props : _props;
- op = opts.op = 'updateAll';
- self.dbg(op, mapper, props, query, opts);
- return jsData.utils.resolve(self._updateAll(mapper, props, query, opts));
- }).then(function (results) {
- var _results10 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results10[0];
- var result = _results10[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'updateAll');
- response.updated = data.length;
- response = self.respond(response, opts);
-
- // afterUpdateAll lifecycle hook
- op = opts.op = 'afterUpdateAll';
- return jsData.utils.resolve(self[op](mapper, props, query, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- },
-
-
- /**
- * Update the given records in a single batch. Called by `Mapper#updateMany`.
- *
- * @name Adapter#updateMany
- * @method
- * @param {Object} mapper The mapper.
- * @param {Object[]} records The records to update.
- * @param {Object} [opts] Configuration options.
- * @param {boolean} [opts.raw=false] Whether to return a more detailed
- * response object.
- * @return {Promise}
- */
- updateMany: function updateMany(mapper, records, opts) {
- var self = this;
- records || (records = []);
- opts || (opts = {});
- var op = void 0;
- var idAttribute = mapper.idAttribute;
-
- records = records.filter(function (record) {
- return jsData.utils.get(record, idAttribute);
- });
-
- // beforeUpdateMany lifecycle hook
- op = opts.op = 'beforeUpdateMany';
- return jsData.utils.resolve(self[op](mapper, records, opts)).then(function (_records) {
- // Allow for re-assignment from lifecycle hook
- records = jsData.utils.isUndefined(_records) ? records : _records;
- records = records.map(function (record) {
- return withoutRelations(mapper, record);
- });
- op = opts.op = 'updateMany';
- self.dbg(op, mapper, records, opts);
- return jsData.utils.resolve(self._updateMany(mapper, records, opts));
- }).then(function (results) {
- var _results11 = babelHelpers.slicedToArray(results, 2);
-
- var data = _results11[0];
- var result = _results11[1];
-
- data || (data = []);
- result || (result = {});
- var response = new Response(data, result, 'updateMany');
- response.updated = data.length;
- response = self.respond(response, opts);
-
- // afterUpdateMany lifecycle hook
- op = opts.op = 'afterUpdateMany';
- return jsData.utils.resolve(self[op](mapper, records, opts, response)).then(function (_response) {
- // Allow for re-assignment from lifecycle hook
- return jsData.utils.isUndefined(_response) ? response : _response;
- });
- });
- }
- });
-
- module.exports = Adapter;
-
- }));
- //# sourceMappingURL=js-data-adapter.js.map
-
-/***/ },
-/* 3 */
-/***/ function(module, exports) {
-
- module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
-
-/***/ }
-/******/ ])
-});
-;
-//# sourceMappingURL=js-data-http-node.js.map
\ No newline at end of file
diff --git a/node/dist/js-data-http-node.js.map b/node/dist/js-data-http-node.js.map
deleted file mode 100644
index 2e944d4..0000000
--- a/node/dist/js-data-http-node.js.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 66471f2167b1b4c3962f","webpack:///./src/index.js","webpack:///external \"js-data\"","webpack:///./~/js-data-adapter/dist/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AEA;AACA,kDAAiD,+BAA+B;AAChF;;AAEA;AACA;AACA,QAAO;AACP;AACA;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA,QAAO;AACP;AACA;AACA;AACA,IAAG;;AAEH;;AAEA;AACA;;AAEA,oEAAmE,aAAa;AAChF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,uEAAsE,eAAe;AACrF;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,eAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa,OAAO;AACpB,cAAa,QAAQ;AACrB,cAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,iBAAgB,OAAO;AACvB,iBAAgB,OAAO;AACvB;AACA;AACA;AACA,uBAAsB;AACtB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa,OAAO;AACpB;AACA,cAAa,OAAO;AACpB;AACA,eAAc,OAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,oBAAoB,eAAe;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,6BAA6B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,8BAA8B,eAAe;AAC9E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,mBAAmB,0BAA0B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,mBAAmB,0BAA0B,eAAe;AAC3E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,+BAA+B,eAAe;AAC7E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,gCAAgC,eAAe;AAChF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,oBAAoB,eAAe;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,gBAAgB,iCAAiC,eAAe;AAC/E;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,kCAAkC,eAAe;AAClF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB,gBAAe,kBAAkB,kCAAkC,eAAe;AAClF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,mBAAkB,OAAO;AACzB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAwE,eAAe;AACvF;AACA;;AAEA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA,UAAS;AACT,QAAO;AACP;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA,oDAAmD;AACnD;AACA;AACA,kBAAiB;AACjB,gBAAe;AACf,cAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB;AACjB;AACA,gBAAe;AACf;AACA,cAAa;AACb;AACA,UAAS;;AAET;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA,UAAS;AACT,QAAO;AACP;AACA,gDAA+C;AAC/C;AACA;AACA,cAAa;AACb,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,YAAW;AACX,UAAS;AACT;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA,UAAS;;AAET;AACA,QAAO;AACP;AACA;AACA,UAAS;AACT;AACA,UAAS;AACT;AACA,gDAA+C;AAC/C;AACA,YAAW;AACX,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,cAAa;AACb,YAAW;AACX,UAAS;AACT;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,gBAAe,SAAS;AACxB,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA,UAAS;;AAET;AACA,QAAO;AACP,+CAA8C;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,gBAAe,SAAS;AACxB,iBAAgB;AAChB;AACA;AACA;AACA,yBAAwB;AACxB;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA,YAAW;AACX;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA,QAAO;AACP,gDAA+C;AAC/C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,iBAAgB,EAAE;AAClB;AACA;AACA,yBAAwB;AACxB;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,KAAK;AACpB;AACA;AACA,6FAA4F,eAAe;AAC3G;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,QAAO;AACP;;AAEA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB;AACA;AACA;AACA;AACA,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,gBAAgB;AAC/B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA,2BAA0B;AAC1B,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,aAAa;AAC5B,gBAAe,aAAa;AAC5B,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA,2BAA0B;AAC1B,2BAA0B;AAC1B,yBAAwB;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP,MAAK;;;AAGL;AACA;AACA;AACA;AACA;AACA,gBAAe,OAAO;AACtB,gBAAe,SAAS;AACxB,gBAAe,OAAO;AACtB,gBAAe,QAAQ;AACvB;AACA,iBAAgB;AAChB;AACA;AACA;AACA;AACA,yBAAwB;AACxB;AACA;;AAEA;AACA;AACA,QAAO;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA,QAAO;AACP;;AAEA;AACA;;AAEA;AACA,+BAA8B;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT,QAAO;AACP;AACA,IAAG;;AAEH;;AAEA,EAAC;AACD,4C;;;;;;AC3lDA,gD","file":"./node/dist/js-data-http-node.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"js-data\"), require(\"axios\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"js-data\", \"axios\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"js-data\"), require(\"axios\")) : factory(root[\"js-data\"], root[\"axios\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function(__WEBPACK_EXTERNAL_MODULE_1__, __WEBPACK_EXTERNAL_MODULE_3__) {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 66471f2167b1b4c3962f\n **/","/* global fetch:true Headers:true Request:true */\nconst axios = require('axios')\nimport {utils} from 'js-data'\nimport Adapter from 'js-data-adapter'\n\nlet hasFetch = false\n\ntry {\n hasFetch = window && window.fetch\n} catch (e) {}\n\nconst noop = function (...args) {\n const self = this\n const opts = args[args.length - 1]\n self.dbg(opts.op, ...args)\n return utils.resolve()\n}\n\nconst noop2 = function (...args) {\n const self = this\n const opts = args[args.length - 2]\n self.dbg(opts.op, ...args)\n return utils.resolve()\n}\n\nfunction isValidString (value) {\n return (value != null && value !== '')\n}\nfunction join (items, separator) {\n separator || (separator = '')\n return items.filter(isValidString).join(separator)\n}\nfunction makePath (...args) {\n let result = join(args, '/')\n return result.replace(/([^:\\/]|^)\\/{2,}/g, '$1/')\n}\n\nfunction encode (val) {\n return encodeURIComponent(val)\n .replace(/%40/gi, '@')\n .replace(/%3A/gi, ':')\n .replace(/%24/g, '$')\n .replace(/%2C/gi, ',')\n .replace(/%20/g, '+')\n .replace(/%5B/gi, '[')\n .replace(/%5D/gi, ']')\n}\n\nfunction buildUrl (url, params) {\n if (!params) {\n return url\n }\n\n const parts = []\n\n utils.forOwn(params, function (val, key) {\n if (val === null || typeof val === 'undefined') {\n return\n }\n if (!utils.isArray(val)) {\n val = [val]\n }\n\n val.forEach(function (v) {\n if (window.toString.call(v) === '[object Date]') {\n v = v.toISOString()\n } else if (utils.isObject(v)) {\n v = utils.toJson(v)\n }\n parts.push(`${encode(key)}=${encode(v)}`)\n })\n })\n\n if (parts.length > 0) {\n url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&')\n }\n\n return url\n}\n\nconst __super__ = Adapter.prototype\n\nconst DEFAULTS = {\n // Default and user-defined settings\n /**\n * @name HttpAdapter#basePath\n * @type {string}\n */\n basePath: '',\n\n /**\n * @name HttpAdapter#forceTrailingSlash\n * @type {boolean}\n * @default false\n */\n forceTrailingSlash: false,\n\n /**\n * @name HttpAdapter#http\n * @type {Function}\n */\n http: axios,\n\n /**\n * @name HttpAdapter#httpConfig\n * @type {Object}\n */\n httpConfig: {},\n\n /**\n * @name HttpAdapter#suffix\n * @type {string}\n */\n suffix: '',\n\n /**\n * @name HttpAdapter#useFetch\n * @type {boolean}\n * @default false\n */\n useFetch: false\n}\n\n/**\n * HttpAdapter class.\n *\n * @class HttpAdapter\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.basePath=''] TODO\n * @param {boolean} [opts.debug=false] TODO\n * @param {boolean} [opts.forceTrailingSlash=false] TODO\n * @param {Object} [opts.http=axios] TODO\n * @param {Object} [opts.httpConfig={}] TODO\n * @param {string} [opts.suffix=''] TODO\n * @param {boolean} [opts.useFetch=false] TODO\n */\nfunction HttpAdapter (opts) {\n const self = this\n opts || (opts = {})\n utils.fillIn(opts, DEFAULTS)\n Adapter.call(self, opts)\n}\n\n// Setup prototype inheritance from Adapter\nHttpAdapter.prototype = Object.create(Adapter.prototype, {\n constructor: {\n value: HttpAdapter,\n enumerable: false,\n writable: true,\n configurable: true\n }\n})\n\nObject.defineProperty(HttpAdapter, '__super__', {\n configurable: true,\n value: Adapter\n})\n\nutils.addHiddenPropsToTarget(HttpAdapter.prototype, {\n /**\n * @name HttpAdapter#afterDEL\n * @method\n * @param {string} url\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterDEL: noop2,\n\n /**\n * @name HttpAdapter#afterGET\n * @method\n * @param {string} url\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterGET: noop2,\n\n /**\n * @name HttpAdapter#afterHTTP\n * @method\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterHTTP: noop2,\n\n /**\n * @name HttpAdapter#afterPOST\n * @method\n * @param {string} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterPOST: noop2,\n\n /**\n * @name HttpAdapter#afterPUT\n * @method\n * @param {string} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n * @param {Object} response\n */\n afterPUT: noop2,\n\n /**\n * @name HttpAdapter#beforeDEL\n * @method\n * @param {Object} url\n * @param {Object} config\n * @param {Object} opts\n */\n beforeDEL: noop,\n\n /**\n * @name HttpAdapter#beforeGET\n * @method\n * @param {Object} url\n * @param {Object} config\n * @param {Object} opts\n */\n beforeGET: noop,\n\n /**\n * @name HttpAdapter#beforeHTTP\n * @method\n * @param {Object} config\n * @param {Object} opts\n */\n beforeHTTP: noop,\n\n /**\n * @name HttpAdapter#beforePOST\n * @method\n * @param {Object} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n */\n beforePOST: noop,\n\n /**\n * @name HttpAdapter#beforePUT\n * @method\n * @param {Object} url\n * @param {Object} data\n * @param {Object} config\n * @param {Object} opts\n */\n beforePUT: noop,\n\n _count (mapper, query, opts) {\n const self = this\n return self.GET(\n self.getPath('count', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _create (mapper, props, opts) {\n const self = this\n return self.POST(\n self.getPath('create', mapper, props, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _createMany (mapper, props, opts) {\n const self = this\n return self.POST(\n self.getPath('createMany', mapper, null, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _destroy (mapper, id, opts) {\n const self = this\n return self.DEL(\n self.getPath('destroy', mapper, id, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _destroyAll (mapper, query, opts) {\n const self = this\n return self.DEL(\n self.getPath('destroyAll', mapper, null, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _end (mapper, opts, response) {\n return [this.deserialize(mapper, response, opts), response]\n },\n\n _find (mapper, id, opts) {\n const self = this\n return self.GET(\n self.getPath('find', mapper, id, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _findAll (mapper, query, opts) {\n const self = this\n return self.GET(\n self.getPath('findAll', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _sum (mapper, field, query, opts) {\n const self = this\n return self.GET(\n self.getPath('sum', mapper, opts.params, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _update (mapper, id, props, opts) {\n const self = this\n return self.PUT(\n self.getPath('update', mapper, id, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _updateAll (mapper, props, query, opts) {\n const self = this\n return self.PUT(\n self.getPath('updateAll', mapper, null, opts),\n self.serialize(mapper, props, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n _updateMany (mapper, records, opts) {\n const self = this\n return self.PUT(\n self.getPath('updateMany', mapper, null, opts),\n self.serialize(mapper, records, opts),\n opts\n ).then(function (response) {\n return self._end(mapper, opts, response)\n })\n },\n\n /**\n * Retrieve the number of records that match the selection `query`.\n *\n * @name HttpAdapter#count\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n count (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params.count = true\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.count.call(self, mapper, query, opts)\n },\n\n /**\n * Create a new the record from the provided `props`.\n *\n * @name HttpAdapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props Properties to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n create (mapper, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.create.call(self, mapper, props, opts)\n },\n\n /**\n * Create multiple new records in batch.\n *\n * @name HttpAdapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Array} props Array of property objects to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n createMany (mapper, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.createMany.call(self, mapper, props, opts)\n },\n\n /**\n * Make an Http request to `url` according to the configuration in `config`.\n *\n * @name HttpAdapter#DEL\n * @method\n * @param {string} url Url for the request.\n * @param {Object} [config] Http configuration that will be passed to\n * {@link HttpAdapter#HTTP}.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n DEL (url, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.method = config.method || 'delete'\n\n // beforeDEL lifecycle hook\n op = opts.op = 'beforeDEL'\n return utils.resolve(self[op](url, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'DEL'\n self.dbg(op, url, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterDEL lifecycle hook\n op = opts.op = 'afterDEL'\n return utils.resolve(self[op](url, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * Transform the server response object into the payload that will be returned\n * to JSData.\n *\n * @name HttpAdapter#deserialize\n * @method\n * @param {Object} mapper The mapper used for the operation.\n * @param {Object} response Response object from {@link HttpAdapter#HTTP}.\n * @param {Object} opts Configuration options.\n * @return {(Object|Array)} Deserialized data.\n */\n deserialize (mapper, response, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.deserialize)) {\n return opts.deserialize(mapper, response, opts)\n }\n if (utils.isFunction(mapper.deserialize)) {\n return mapper.deserialize(mapper, response, opts)\n }\n if (response && response.hasOwnProperty('data')) {\n return response.data\n }\n return response\n },\n\n /**\n * Destroy the record with the given primary key.\n *\n * @name HttpAdapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n destroy (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.destroy.call(self, mapper, id, opts)\n },\n\n /**\n * Destroy the records that match the selection `query`.\n *\n * @name HttpAdapter#destroyAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n destroyAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.destroyAll.call(self, mapper, query, opts)\n },\n\n /**\n * Log an error.\n *\n * @name HttpAdapter#error\n * @method\n * @param {...*} [args] Arguments to log.\n */\n error (...args) {\n if (console) {\n console[typeof console.error === 'function' ? 'error' : 'log'](...args)\n }\n },\n\n /**\n * Make an Http request using `window.fetch`.\n *\n * @name HttpAdapter#fetch\n * @method\n * @param {Object} config Request configuration.\n * @param {Object} config.data Payload for the request.\n * @param {string} config.method Http method for the request.\n * @param {Object} config.headers Headers for the request.\n * @param {Object} config.params Querystring for the request.\n * @param {string} config.url Url for the request.\n * @param {Object} [opts] Configuration options.\n */\n fetch (config, opts) {\n const requestConfig = {\n method: config.method,\n // turn the plain headers object into the Fetch Headers object\n headers: new Headers(config.headers)\n }\n\n if (config.data) {\n requestConfig.body = utils.toJson(config.data)\n }\n\n return fetch(new Request(buildUrl(config.url, config.params), requestConfig)).then(function (response) {\n response.config = {\n method: config.method,\n url: config.url\n }\n return response.json().then(function (data) {\n response.data = data\n return response\n })\n })\n },\n\n /**\n * Retrieve the record with the given primary key.\n *\n * @name HttpAdapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n find (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.find.call(self, mapper, id, opts)\n },\n\n /**\n * Retrieve the records that match the selection `query`.\n *\n * @name HttpAdapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n findAll (mapper, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.findAll.call(self, mapper, query, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#GET\n * @method\n * @param {string} url The url for the request.\n * @param {Object} config Request configuration options.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n GET (url, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.method = config.method || 'get'\n\n // beforeGET lifecycle hook\n op = opts.op = 'beforeGET'\n return utils.resolve(self[op](url, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'GET'\n self.dbg(op, url, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterGET lifecycle hook\n op = opts.op = 'afterGET'\n return utils.resolve(self[op](url, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * @name HttpAdapter#getEndpoint\n * @method\n * @param {Object} mapper TODO\n * @param {*} id TODO\n * @param {boolean} opts TODO\n * @return {string} Full path.\n */\n getEndpoint (mapper, id, opts) {\n const self = this\n opts || (opts = {})\n opts.params = utils.isUndefined(opts.params) ? {} : opts.params\n const relationList = mapper.relationList || []\n let endpoint = utils.isUndefined(opts.endpoint) ? (utils.isUndefined(mapper.endpoint) ? mapper.name : mapper.endpoint) : opts.endpoint\n\n relationList.forEach(function (def) {\n if (def.type !== 'belongsTo' || !def.parent) {\n return\n }\n let item\n const parentKey = def.foreignKey\n const parentDef = def.getRelation()\n let parentId = opts.params[parentKey]\n\n if (parentId === false || !parentKey || !parentDef) {\n if (parentId === false) {\n delete opts.params[parentKey]\n }\n return false\n } else {\n delete opts.params[parentKey]\n\n if (utils.isObject(id)) {\n item = id\n }\n\n if (item) {\n parentId = parentId || def.getForeignKey(item) || (def.getLocalField(item) ? utils.get(def.getLocalField(item), parentDef.idAttribute) : null)\n }\n\n if (parentId) {\n delete opts.endpoint\n const _opts = {}\n utils.forOwn(opts, function (value, key) {\n _opts[key] = value\n })\n utils._(_opts, parentDef)\n endpoint = makePath(self.getEndpoint(parentDef, parentId, _opts), parentId, endpoint)\n return false\n }\n }\n })\n\n return endpoint\n },\n\n /**\n * @name HttpAdapter#getPath\n * @method\n * @param {string} method TODO\n * @param {Object} mapper TODO\n * @param {(string|number)?} id TODO\n * @param {Object} opts Configuration options.\n */\n getPath (method, mapper, id, opts) {\n const self = this\n opts || (opts = {})\n const args = [\n utils.isUndefined(opts.basePath) ? (utils.isUndefined(mapper.basePath) ? self.basePath : mapper.basePath) : opts.basePath,\n self.getEndpoint(mapper, (utils.isString(id) || utils.isNumber(id) || method === 'create') ? id : null, opts)\n ]\n if (method === 'find' || method === 'update' || method === 'destroy') {\n args.push(id)\n }\n return makePath.apply(utils, args)\n },\n\n getParams (opts) {\n opts || (opts = {})\n if (utils.isUndefined(opts.params)) {\n return {}\n }\n return utils.copy(opts.params)\n },\n\n getSuffix (mapper, opts) {\n opts || (opts = {})\n if (utils.isUndefined(opts.suffix)) {\n if (utils.isUndefined(mapper.suffix)) {\n return this.suffix\n }\n return mapper.suffix\n }\n return opts.suffix\n },\n\n /**\n * Make an Http request.\n *\n * @name HttpAdapter#HTTP\n * @method\n * @param {Object} config Request configuration options.\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n HTTP (config, opts) {\n const self = this\n const start = new Date()\n opts || (opts = {})\n const payload = config.data\n const cache = config.cache\n const timeout = config.timeout\n config = utils.copy(config, null, null, null, ['data', 'cache', 'timeout'])\n config = utils.deepMixIn(config, self.httpConfig)\n config.data = payload\n config.cache = cache\n config.timeout = timeout\n if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {\n config.url += '/'\n }\n config.method = config.method.toUpperCase()\n const suffix = config.suffix || opts.suffix || self.suffix\n if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {\n config.url += suffix\n }\n\n function logResponse (data) {\n const str = `${start.toUTCString()} - ${config.method.toUpperCase()} ${config.url} - ${data.status} ${(new Date().getTime() - start.getTime())}ms`\n if (data.status >= 200 && data.status < 300) {\n if (self.log) {\n self.dbg('debug', str, data)\n }\n return data\n } else {\n if (self.error) {\n self.error(`'FAILED: ${str}`, data)\n }\n return utils.reject(data)\n }\n }\n\n if (!self.http) {\n throw new Error('You have not configured this adapter with an http library!')\n }\n\n return utils.resolve(self.beforeHTTP(config, opts)).then(function (_config) {\n config = _config || config\n if (hasFetch && (self.useFetch || opts.useFetch || !self.http)) {\n return self.fetch(config, opts).then(logResponse, logResponse)\n }\n return self.http(config).then(logResponse, logResponse).catch(function (err) {\n return self.responseError(err, config, opts)\n })\n }).then(function (response) {\n return utils.resolve(self.afterHTTP(config, opts, response)).then(function (_response) {\n return _response || response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#POST\n * @method\n * @param {*} url TODO\n * @param {Object} data TODO\n * @param {Object} config TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n POST (url, data, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.data = data || config.data\n config.method = config.method || 'post'\n\n // beforePOST lifecycle hook\n op = opts.op = 'beforePOST'\n return utils.resolve(self[op](url, data, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'POST'\n self.dbg(op, url, data, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterPOST lifecycle hook\n op = opts.op = 'afterPOST'\n return utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#PUT\n * @method\n * @param {*} url TODO\n * @param {Object} data TODO\n * @param {Object} config TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n PUT (url, data, config, opts) {\n const self = this\n let op\n config || (config = {})\n opts || (opts = {})\n config.url = url || config.url\n config.data = data || config.data\n config.method = config.method || 'put'\n\n // beforePUT lifecycle hook\n op = opts.op = 'beforePUT'\n return utils.resolve(self[op](url, data, config, opts)).then(function (_config) {\n // Allow re-assignment from lifecycle hook\n config = utils.isUndefined(_config) ? config : _config\n op = opts.op = 'PUT'\n self.dbg(op, url, data, config, opts)\n return self.HTTP(config, opts)\n }).then(function (response) {\n // afterPUT lifecycle hook\n op = opts.op = 'afterPUT'\n return utils.resolve(self[op](url, data, config, opts, response)).then(function (_response) {\n // Allow re-assignment from lifecycle hook\n return utils.isUndefined(_response) ? response : _response\n })\n })\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#queryTransform\n * @method\n * @param {Object} mapper TODO\n * @param {*} params TODO\n * @param {*} opts TODO\n * @return {*} Transformed params.\n */\n queryTransform (mapper, params, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.queryTransform)) {\n return opts.queryTransform(mapper, params, opts)\n }\n if (utils.isFunction(mapper.queryTransform)) {\n return mapper.queryTransform(mapper, params, opts)\n }\n return params\n },\n\n /**\n * Error handler invoked when the promise returned by {@link HttpAdapter#http}\n * is rejected. Default implementation is to just return the error wrapped in\n * a rejected Promise, aka rethrow the error. {@link HttpAdapter#http} is\n * called by {@link HttpAdapter#HTTP}.\n *\n * @name HttpAdapter#responseError\n * @method\n * @param {*} err The error that {@link HttpAdapter#http} rejected with.\n * @param {Object} config The `config` argument that was passed to {@link HttpAdapter#HTTP}.\n * @param {*} opts The `opts` argument that was passed to {@link HttpAdapter#HTTP}.\n * @return {Promise}\n */\n responseError (err, config, opts) {\n return utils.reject(err)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#serialize\n * @method\n * @param {Object} mapper TODO\n * @param {Object} data TODO\n * @param {*} opts TODO\n * @return {*} Serialized data.\n */\n serialize (mapper, data, opts) {\n opts || (opts = {})\n if (utils.isFunction(opts.serialize)) {\n return opts.serialize(mapper, data, opts)\n }\n if (utils.isFunction(mapper.serialize)) {\n return mapper.serialize(mapper, data, opts)\n }\n return data\n },\n\n /**\n * Retrieve the sum of the field of the records that match the selection query.\n *\n * @name HttpAdapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field The field to sum.\n * @param {Object} query Selection query.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n sum (mapper, field, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n if (!utils.utils.isString(field)) {\n throw new Error('field must be a string!')\n }\n opts.params = self.getParams(opts)\n opts.params.sum = field\n opts.suffix = self.getSuffix(mapper, opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n\n return __super__.sum.call(self, mapper, field, query, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#update\n * @method\n * @param {Object} mapper TODO\n * @param {*} id TODO\n * @param {*} props TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n update (mapper, id, props, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.update.call(self, mapper, id, props, opts)\n },\n\n /**\n * TODO\n *\n * @name HttpAdapter#updateAll\n * @method\n * @param {Object} mapper TODO\n * @param {Object} props TODO\n * @param {Object} query TODO\n * @param {Object} [opts] Configuration options.\n * @return {Promise}\n */\n updateAll (mapper, props, query, opts) {\n const self = this\n query || (query = {})\n opts || (opts = {})\n opts.params = self.getParams(opts)\n utils.deepMixIn(opts.params, query)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.updateAll.call(self, mapper, props, query, opts)\n },\n\n /**\n * Update multiple records in batch.\n *\n * {@link HttpAdapter#beforeUpdateMany} will be called before calling\n * {@link HttpAdapter#PUT}.\n * {@link HttpAdapter#afterUpdateMany} will be called after calling\n * {@link HttpAdapter#PUT}.\n *\n * @name HttpAdapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Array} records Array of property objects to send as the payload.\n * @param {Object} [opts] Configuration options.\n * @param {string} [opts.params] TODO\n * @param {string} [opts.suffix={@link HttpAdapter#suffix}] TODO\n * @return {Promise}\n */\n updateMany (mapper, records, opts) {\n const self = this\n opts || (opts = {})\n opts.params = self.getParams(opts)\n opts.params = self.queryTransform(mapper, opts.params, opts)\n opts.suffix = self.getSuffix(mapper, opts)\n\n return __super__.updateMany.call(self, mapper, records, opts)\n }\n})\n\n/**\n * Add an Http actions to a mapper.\n *\n * @name HttpAdapter.addAction\n * @method\n * @param {string} name Name of the new action.\n * @param {Object} [opts] Action configuration\n * @param {string} [opts.adapter]\n * @param {string} [opts.pathname]\n * @param {Function} [opts.request]\n * @param {Function} [opts.response]\n * @param {Function} [opts.responseError]\n * @return {Function} Decoration function, which should be passed the mapper to\n * decorate when invoked.\n */\nHttpAdapter.addAction = function (name, opts) {\n if (!name || !utils.isString(name)) {\n throw new TypeError('action(name[, opts]): Expected: string, Found: ' + typeof name)\n }\n return function (mapper) {\n if (mapper[name]) {\n throw new Error('action(name[, opts]): ' + name + ' already exists on target!')\n }\n opts.request = opts.request || function (config) { return config }\n opts.response = opts.response || function (response) { return response }\n opts.responseError = opts.responseError || function (err) { return utils.reject(err) }\n mapper[name] = function (id, _opts) {\n const self = this\n if (utils.isObject(id)) {\n _opts = id\n }\n _opts = _opts || {}\n let adapter = self.getAdapter(opts.adapter || self.defaultAdapter || 'http')\n let config = {}\n utils.fillIn(config, opts)\n if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {\n _opts.endpoint = config.endpoint\n }\n if (typeof _opts.getEndpoint === 'function') {\n config.url = _opts.getEndpoint(self, _opts)\n } else {\n let args = [\n _opts.basePath || self.basePath || adapter.basePath,\n adapter.getEndpoint(self, utils.isSorN(id) ? id : null, _opts)\n ]\n if (utils.isSorN(id)) {\n args.push(id)\n }\n args.push(opts.pathname || name)\n config.url = makePath.apply(null, args)\n }\n config.method = config.method || 'GET'\n config.mapper = self.name\n utils.deepMixIn(config)(_opts)\n return utils.resolve(config)\n .then(_opts.request || opts.request)\n .then(function (config) { return adapter.HTTP(config) })\n .then(function (data) {\n if (data && data.config) {\n data.config.mapper = self.name\n }\n return data\n })\n .then(_opts.response || opts.response, _opts.responseError || opts.responseError)\n }\n return mapper\n }\n}\n\n/**\n * Add multiple Http actions to a mapper. See {@link HttpAdapter.addAction} for\n * action configuration options.\n *\n * @name HttpAdapter.addActions\n * @method\n * @param {Object.} opts Object where the key is an action name\n * and the value is the configuration for the action.\n * @return {Function} Decoration function, which should be passed the mapper to\n * decorate when invoked.\n */\nHttpAdapter.addActions = function (opts) {\n opts || (opts = {})\n return function (mapper) {\n utils.forOwn(mapper, function (value, key) {\n HttpAdapter.addAction(key, value)(mapper)\n })\n return mapper\n }\n}\n\n/**\n * Alternative to ES6 class syntax for extending `HttpAdapter`.\n *\n * __ES6__:\n * ```javascript\n * class MyHttpAdapter extends HttpAdapter {\n * deserialize (Model, data, opts) {\n * const data = super.deserialize(Model, data, opts)\n * data.foo = 'bar'\n * return data\n * }\n * }\n * ```\n *\n * __ES5__:\n * ```javascript\n * var instanceProps = {\n * // override deserialize\n * deserialize: function (Model, data, opts) {\n * var Ctor = this.constructor\n * var superDeserialize = (Ctor.__super__ || Object.getPrototypeOf(Ctor)).deserialize\n * // call the super deserialize\n * var data = superDeserialize(Model, data, opts)\n * data.foo = 'bar'\n * return data\n * },\n * say: function () { return 'hi' }\n * }\n * var classProps = {\n * yell: function () { return 'HI' }\n * }\n *\n * var MyHttpAdapter = HttpAdapter.extend(instanceProps, classProps)\n * var adapter = new MyHttpAdapter()\n * adapter.say() // \"hi\"\n * MyHttpAdapter.yell() // \"HI\"\n * ```\n *\n * @name HttpAdapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Object} Subclass of `HttpAdapter`.\n */\nHttpAdapter.extend = utils.extend\n\n/**\n * Details of the current version of the `js-data-http` module.\n *\n * @name HttpAdapter.version\n * @type {Object}\n * @property {string} version.full The full semver value.\n * @property {number} version.major The major version number.\n * @property {number} version.minor The minor version number.\n * @property {number} version.patch The patch version number.\n * @property {(string|boolean)} version.alpha The alpha version value,\n * otherwise `false` if the current version is not alpha.\n * @property {(string|boolean)} version.beta The beta version value,\n * otherwise `false` if the current version is not beta.\n */\nHttpAdapter.version = '<%= version %>'\n\n/**\n * Registered as `js-data-http` in NPM and Bower. The build of `js-data-http`\n * that works on Node.js is registered in NPM as `js-data-http-node`. The build\n * of `js-data-http` that does not bundle `axios` is registered in NPM and Bower\n * as `js-data-fetch`.\n *\n * __Script tag__:\n * ```javascript\n * window.HttpAdapter\n * ```\n * __CommonJS__:\n * ```javascript\n * var HttpAdapter = require('js-data-http')\n * ```\n * __ES6 Modules__:\n * ```javascript\n * import HttpAdapter from 'js-data-http'\n * ```\n * __AMD__:\n * ```javascript\n * define('myApp', ['js-data-http'], function (HttpAdapter) { ... })\n * ```\n *\n * @module js-data-http\n */\n\nmodule.exports = HttpAdapter\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_1__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"js-data\"\n ** module id = 1\n ** module chunks = 0\n **/","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('js-data')) :\n typeof define === 'function' && define.amd ? define('js-data-adapter', ['js-data'], factory) :\n (factory(global.JSData));\n}(this, function (jsData) { 'use strict';\n\n var babelHelpers = {};\n babelHelpers.typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj;\n };\n\n babelHelpers.defineProperty = function (obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n };\n\n babelHelpers.slicedToArray = function () {\n function sliceIterator(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n }();\n\n babelHelpers;\n\n var noop = function noop() {\n var self = this;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var opts = args[args.length - 1];\n self.dbg.apply(self, [opts.op].concat(args));\n return jsData.utils.resolve();\n };\n\n var noop2 = function noop2() {\n var self = this;\n\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var opts = args[args.length - 2];\n self.dbg.apply(self, [opts.op].concat(args));\n return jsData.utils.resolve();\n };\n\n var unique = function unique(array) {\n var seen = {};\n var final = [];\n array.forEach(function (item) {\n if (item in seen) {\n return;\n }\n final.push(item);\n seen[item] = 0;\n });\n return final;\n };\n\n var withoutRelations = function withoutRelations(mapper, props) {\n return jsData.utils.omit(props, mapper.relationFields || []);\n };\n\n var DEFAULTS = {\n /**\n * Whether to log debugging information.\n *\n * @name Adapter#debug\n * @type {boolean}\n * @default false\n */\n debug: false,\n\n /**\n * Whether to return a more detailed response object.\n *\n * @name Adapter#raw\n * @type {boolean}\n * @default false\n */\n raw: false\n };\n\n /**\n * Abstract class meant to be extended by adapters.\n *\n * @class Adapter\n * @abstract\n * @param {Object} [opts] Configuration opts.\n * @param {boolean} [opts.debug=false] Whether to log debugging information.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed response\n * object.\n */\n function Adapter(opts) {\n var self = this;\n opts || (opts = {});\n jsData.utils.fillIn(opts, DEFAULTS);\n jsData.utils.fillIn(self, opts);\n }\n\n Adapter.reserved = ['orderBy', 'sort', 'limit', 'offset', 'skip', 'where'];\n\n /**\n * Response object used when `raw` is `true`. May contain other fields in\n * addition to `data`.\n *\n * @typedef {Object} Response\n * @property {Object} data Response data.\n * @property {string} op The operation for which the response was created.\n */\n function Response(data, meta, op) {\n var self = this;\n meta || (meta = {});\n self.data = data;\n jsData.utils.fillIn(self, meta);\n self.op = op;\n }\n\n Adapter.Response = Response;\n\n /**\n * Alternative to ES6 class syntax for extending `Adapter`.\n *\n * @name Adapter.extend\n * @method\n * @param {Object} [instanceProps] Properties that will be added to the\n * prototype of the subclass.\n * @param {Object} [classProps] Properties that will be added as static\n * properties to the subclass itself.\n * @return {Object} Subclass of `Adapter`.\n */\n Adapter.extend = jsData.utils.extend;\n\n jsData.utils.addHiddenPropsToTarget(Adapter.prototype, {\n /**\n * Lifecycle method method called by count.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes count to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the count.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.\n *\n * @name Adapter#afterCount\n * @method\n * @param {Object} mapper The `mapper` argument passed to count.\n * @param {Object} props The `props` argument passed to count.\n * @param {Object} opts The `opts` argument passed to count.\n * @property {string} opts.op `afterCount`\n * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCount: noop2,\n\n /**\n * Lifecycle method method called by create.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes create to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created record.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.\n *\n * @name Adapter#afterCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to create.\n * @param {Object} props The `props` argument passed to create.\n * @param {Object} opts The `opts` argument passed to create.\n * @property {string} opts.op `afterCreate`\n * @param {Object|Response} response Created record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCreate: noop2,\n\n /**\n * Lifecycle method method called by createMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the created records.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.\n *\n * @name Adapter#afterCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to createMany.\n * @param {Object[]} props The `props` argument passed to createMany.\n * @param {Object} opts The `opts` argument passed to createMany.\n * @property {string} opts.op `afterCreateMany`\n * @param {Object[]|Response} response Created records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterCreateMany: noop2,\n\n /**\n * Lifecycle method method called by destroy.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.\n *\n * @name Adapter#afterDestroy\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroy.\n * @param {(string|number)} id The `id` argument passed to destroy.\n * @param {Object} opts The `opts` argument passed to destroy.\n * @property {string} opts.op `afterDestroy`\n * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.\n */\n afterDestroy: noop2,\n\n /**\n * Lifecycle method method called by destroyAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be `undefined`.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.\n *\n * @name Adapter#afterDestroyAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroyAll.\n * @param {Object} query The `query` argument passed to destroyAll.\n * @param {Object} opts The `opts` argument passed to destroyAll.\n * @property {string} opts.op `afterDestroyAll`\n * @param {undefined|Response} response `undefined` or {@link Response}, depending on the value of `opts.raw`.\n */\n afterDestroyAll: noop2,\n\n /**\n * Lifecycle method method called by find.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes find to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found record, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.\n *\n * @name Adapter#afterFind\n * @method\n * @param {Object} mapper The `mapper` argument passed to find.\n * @param {(string|number)} id The `id` argument passed to find.\n * @param {Object} opts The `opts` argument passed to find.\n * @property {string} opts.op `afterFind`\n * @param {Object|Response} response The found record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterFind: noop2,\n\n /**\n * Lifecycle method method called by findAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the found records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.\n *\n * @name Adapter#afterFindAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to findAll.\n * @param {Object} query The `query` argument passed to findAll.\n * @param {Object} opts The `opts` argument passed to findAll.\n * @property {string} opts.op `afterFindAll`\n * @param {Object[]|Response} response The found records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterFindAll: noop2,\n\n /**\n * Lifecycle method method called by sum.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes sum to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the sum.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.\n *\n * @name Adapter#afterSum\n * @method\n * @param {Object} mapper The `mapper` argument passed to sum.\n * @param {Object} props The `props` argument passed to sum.\n * @param {Object} opts The `opts` argument passed to sum.\n * @property {string} opts.op `afterSum`\n * @param {Object|Response} response Count or {@link Response}, depending on the value of `opts.raw`.\n */\n afterSum: noop2,\n\n /**\n * Lifecycle method method called by update.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes update to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated record.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.\n *\n * @name Adapter#afterUpdate\n * @method\n * @param {Object} mapper The `mapper` argument passed to update.\n * @param {(string|number)} id The `id` argument passed to update.\n * @param {Object} props The `props` argument passed to update.\n * @param {Object} opts The `opts` argument passed to update.\n * @property {string} opts.op `afterUpdate`\n * @param {Object|Response} response The updated record or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdate: noop2,\n\n /**\n * Lifecycle method method called by updateAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.\n *\n * @name Adapter#afterUpdateAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateAll.\n * @param {Object} props The `props` argument passed to updateAll.\n * @param {Object} query The `query` argument passed to updateAll.\n * @param {Object} opts The `opts` argument passed to updateAll.\n * @property {string} opts.op `afterUpdateAll`\n * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdateAll: noop2,\n\n /**\n * Lifecycle method method called by updateMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.\n *\n * If `opts.raw` is `true` then `response` will be a detailed response object, otherwise `response` will be the updated records, if any.\n *\n * `response` may be modified. You can also re-assign `response` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.\n *\n * @name Adapter#afterUpdateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateMany.\n * @param {Object[]} records The `records` argument passed to updateMany.\n * @param {Object} opts The `opts` argument passed to updateMany.\n * @property {string} opts.op `afterUpdateMany`\n * @param {Object[]|Response} response The updated records or {@link Response}, depending on the value of `opts.raw`.\n */\n afterUpdateMany: noop2,\n\n /**\n * Lifecycle method method called by count.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes count to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by count.\n *\n * @name Adapter#beforeCount\n * @method\n * @param {Object} mapper The `mapper` argument passed to count.\n * @param {Object} query The `query` argument passed to count.\n * @param {Object} opts The `opts` argument passed to count.\n * @property {string} opts.op `beforeCount`\n */\n beforeCount: noop,\n\n /**\n * Lifecycle method method called by create.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes create to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by create.\n *\n * @name Adapter#beforeCreate\n * @method\n * @param {Object} mapper The `mapper` argument passed to create.\n * @param {Object} props The `props` argument passed to create.\n * @param {Object} opts The `opts` argument passed to create.\n * @property {string} opts.op `beforeCreate`\n */\n beforeCreate: noop,\n\n /**\n * Lifecycle method method called by createMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes createMany to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by createMany.\n *\n * @name Adapter#beforeCreateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to createMany.\n * @param {Object[]} props The `props` argument passed to createMany.\n * @param {Object} opts The `opts` argument passed to createMany.\n * @property {string} opts.op `beforeCreateMany`\n */\n beforeCreateMany: noop,\n\n /**\n * Lifecycle method method called by destroy.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroy to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroy.\n *\n * @name Adapter#beforeDestroy\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroy.\n * @param {(string|number)} id The `id` argument passed to destroy.\n * @param {Object} opts The `opts` argument passed to destroy.\n * @property {string} opts.op `beforeDestroy`\n */\n beforeDestroy: noop,\n\n /**\n * Lifecycle method method called by destroyAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes destroyAll to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by destroyAll.\n *\n * @name Adapter#beforeDestroyAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to destroyAll.\n * @param {Object} query The `query` argument passed to destroyAll.\n * @param {Object} opts The `opts` argument passed to destroyAll.\n * @property {string} opts.op `beforeDestroyAll`\n */\n beforeDestroyAll: noop,\n\n /**\n * Lifecycle method method called by find.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes find to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by find.\n *\n * @name Adapter#beforeFind\n * @method\n * @param {Object} mapper The `mapper` argument passed to find.\n * @param {(string|number)} id The `id` argument passed to find.\n * @param {Object} opts The `opts` argument passed to find.\n * @property {string} opts.op `beforeFind`\n */\n beforeFind: noop,\n\n /**\n * Lifecycle method method called by findAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes findAll to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by findAll.\n *\n * @name Adapter#beforeFindAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to findAll.\n * @param {Object} query The `query` argument passed to findAll.\n * @param {Object} opts The `opts` argument passed to findAll.\n * @property {string} opts.op `beforeFindAll`\n */\n beforeFindAll: noop,\n\n /**\n * Lifecycle method method called by sum.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes sum to wait for the Promise to resolve before continuing.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by sum.\n *\n * @name Adapter#beforeSum\n * @method\n * @param {Object} mapper The `mapper` argument passed to sum.\n * @param {Object} query The `query` argument passed to sum.\n * @param {Object} opts The `opts` argument passed to sum.\n * @property {string} opts.op `beforeSum`\n */\n beforeSum: noop,\n\n /**\n * Lifecycle method method called by update.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes update to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by update.\n *\n * @name Adapter#beforeUpdate\n * @method\n * @param {Object} mapper The `mapper` argument passed to update.\n * @param {(string|number)} id The `id` argument passed to update.\n * @param {Object} props The `props` argument passed to update.\n * @param {Object} opts The `opts` argument passed to update.\n * @property {string} opts.op `beforeUpdate`\n */\n beforeUpdate: noop,\n\n /**\n * Lifecycle method method called by updateAll.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateAll to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateAll.\n *\n * @name Adapter#beforeUpdateAll\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateAll.\n * @param {Object} props The `props` argument passed to updateAll.\n * @param {Object} query The `query` argument passed to updateAll.\n * @param {Object} opts The `opts` argument passed to updateAll.\n * @property {string} opts.op `beforeUpdateAll`\n */\n beforeUpdateAll: noop,\n\n /**\n * Lifecycle method method called by updateMany.\n *\n * Override this method to add custom behavior for this lifecycle hook.\n *\n * Returning a Promise causes updateMany to wait for the Promise to resolve before continuing.\n *\n * `props` may be modified. You can also re-assign `props` to another value by returning a different value or a Promise that resolves to a different value.\n *\n * A thrown error or rejected Promise will bubble up and reject the Promise returned by updateMany.\n *\n * @name Adapter#beforeUpdateMany\n * @method\n * @param {Object} mapper The `mapper` argument passed to updateMany.\n * @param {Object[]} props The `props` argument passed to updateMany.\n * @param {Object} opts The `opts` argument passed to updateMany.\n * @property {string} opts.op `beforeUpdateMany`\n */\n beforeUpdateMany: noop,\n\n /**\n * Shortcut for `#log('debug'[, arg1[, arg2[, argn]]])`.\n *\n * @name Adapter#dbg\n * @method\n */\n dbg: function dbg() {\n for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n args[_key3] = arguments[_key3];\n }\n\n this.log.apply(this, ['debug'].concat(args));\n },\n\n\n /**\n * Retrieve the number of records that match the selection query. Called by\n * `Mapper#count`.\n *\n * @name Adapter#count\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n count: function count(mapper, query, opts) {\n var self = this;\n var op = void 0;\n query || (query = {});\n opts || (opts = {});\n\n // beforeCount lifecycle hook\n op = opts.op = 'beforeCount';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n // Allow for re-assignment from lifecycle hook\n op = opts.op = 'count';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._count(mapper, query, opts));\n }).then(function (results) {\n var _results = babelHelpers.slicedToArray(results, 2);\n\n var data = _results[0];\n var result = _results[1];\n\n result || (result = {});\n var response = new Response(data, result, op);\n response = self.respond(response, opts);\n\n // afterCount lifecycle hook\n op = opts.op = 'afterCount';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Create a new record. Called by `Mapper#create`.\n *\n * @name Adapter#create\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The record to be created.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n create: function create(mapper, props, opts) {\n var self = this;\n var op = void 0;\n props || (props = {});\n opts || (opts = {});\n\n // beforeCreate lifecycle hook\n op = opts.op = 'beforeCreate';\n return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n props = withoutRelations(mapper, props);\n op = opts.op = 'create';\n self.dbg(op, mapper, props, opts);\n return jsData.utils.resolve(self._create(mapper, props, opts));\n }).then(function (results) {\n var _results2 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results2[0];\n var result = _results2[1];\n\n result || (result = {});\n var response = new Response(data, result, 'create');\n response.created = data ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterCreate lifecycle hook\n op = opts.op = 'afterCreate';\n return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Create multiple records in a single batch. Called by `Mapper#createMany`.\n *\n * @name Adapter#createMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The records to be created.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n createMany: function createMany(mapper, props, opts) {\n var self = this;\n var op = void 0;\n props || (props = {});\n opts || (opts = {});\n\n // beforeCreateMany lifecycle hook\n op = opts.op = 'beforeCreateMany';\n return jsData.utils.resolve(self[op](mapper, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n props = props.map(function (record) {\n return withoutRelations(mapper, record);\n });\n op = opts.op = 'createMany';\n self.dbg(op, mapper, props, opts);\n return jsData.utils.resolve(self._createMany(mapper, props, opts));\n }).then(function (results) {\n var _results3 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results3[0];\n var result = _results3[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'createMany');\n response.created = data.length;\n response = self.respond(response, opts);\n\n // afterCreateMany lifecycle hook\n op = opts.op = 'afterCreateMany';\n return jsData.utils.resolve(self[op](mapper, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Destroy the record with the given primary key. Called by\n * `Mapper#destroy`.\n *\n * @name Adapter#destroy\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to destroy.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n destroy: function destroy(mapper, id, opts) {\n var self = this;\n var op = void 0;\n opts || (opts = {});\n\n // beforeDestroy lifecycle hook\n op = opts.op = 'beforeDestroy';\n return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {\n op = opts.op = 'destroy';\n self.dbg(op, mapper, id, opts);\n return jsData.utils.resolve(self._destroy(mapper, id, opts));\n }).then(function (results) {\n var _results4 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results4[0];\n var result = _results4[1];\n\n result || (result = {});\n var response = new Response(data, result, 'destroy');\n response = self.respond(response, opts);\n\n // afterDestroy lifecycle hook\n op = opts.op = 'afterDestroy';\n return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Destroy the records that match the selection query. Called by\n * `Mapper#destroyAll`.\n *\n * @name Adapter#destroyAll\n * @method\n * @param {Object} mapper the mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n destroyAll: function destroyAll(mapper, query, opts) {\n var self = this;\n var op = void 0;\n query || (query = {});\n opts || (opts = {});\n\n // beforeDestroyAll lifecycle hook\n op = opts.op = 'beforeDestroyAll';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n op = opts.op = 'destroyAll';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._destroyAll(mapper, query, opts));\n }).then(function (results) {\n var _results5 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results5[0];\n var result = _results5[1];\n\n result || (result = {});\n var response = new Response(data, result, 'destroyAll');\n response = self.respond(response, opts);\n\n // afterDestroyAll lifecycle hook\n op = opts.op = 'afterDestroyAll';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Return the foreignKey from the given record for the provided relationship.\n *\n * There may be reasons why you may want to override this method, like when\n * the id of the parent doesn't exactly match up to the key on the child.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyForeignKey\n * @method\n * @return {*}\n */\n makeHasManyForeignKey: function makeHasManyForeignKey(mapper, def, record) {\n return def.getForeignKey(record);\n },\n\n\n /**\n * Return the localKeys from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyLocalKeys\n * @method\n * @return {*}\n */\n makeHasManyLocalKeys: function makeHasManyLocalKeys(mapper, def, record) {\n var localKeys = [];\n var itemKeys = jsData.utils.get(record, def.localKeys) || [];\n itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);\n localKeys = localKeys.concat(itemKeys);\n return unique(localKeys).filter(function (x) {\n return x;\n });\n },\n\n\n /**\n * Return the foreignKeys from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeHasManyForeignKeys\n * @method\n * @return {*}\n */\n makeHasManyForeignKeys: function makeHasManyForeignKeys(mapper, def, record) {\n return jsData.utils.get(record, mapper.idAttribute);\n },\n\n\n /**\n * Load a hasMany relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadHasMany\n * @method\n * @return {Promise}\n */\n loadHasMany: function loadHasMany(mapper, def, records, __opts) {\n var self = this;\n var singular = false;\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n singular = true;\n records = [records];\n }\n var IDs = records.map(function (record) {\n return self.makeHasManyForeignKey(mapper, def, record);\n });\n var query = {\n where: {}\n };\n var criteria = query.where[def.foreignKey] = {};\n if (singular) {\n // more efficient query when we only have one record\n criteria['=='] = IDs[0];\n } else {\n criteria['in'] = IDs.filter(function (id) {\n return id;\n });\n }\n return self.findAll(def.getRelation(), query, __opts).then(function (relatedItems) {\n records.forEach(function (record) {\n var attached = [];\n // avoid unneccesary iteration when we only have one record\n if (singular) {\n attached = relatedItems;\n } else {\n relatedItems.forEach(function (relatedItem) {\n if (jsData.utils.get(relatedItem, def.foreignKey) === record[mapper.idAttribute]) {\n attached.push(relatedItem);\n }\n });\n }\n def.setLocalField(record, attached);\n });\n });\n },\n loadHasManyLocalKeys: function loadHasManyLocalKeys(mapper, def, records, __opts) {\n var self = this;\n var record = void 0;\n var relatedMapper = def.getRelation();\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n record = records;\n }\n\n if (record) {\n return self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {\n 'in': self.makeHasManyLocalKeys(mapper, def, record)\n })\n }, __opts).then(function (relatedItems) {\n def.setLocalField(record, relatedItems);\n });\n } else {\n var _ret = function () {\n var localKeys = [];\n records.forEach(function (record) {\n localKeys = localKeys.concat(self.self.makeHasManyLocalKeys(mapper, def, record));\n });\n return {\n v: self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, relatedMapper.idAttribute, {\n 'in': unique(localKeys).filter(function (x) {\n return x;\n })\n })\n }, __opts).then(function (relatedItems) {\n records.forEach(function (item) {\n var attached = [];\n var itemKeys = jsData.utils.get(item, def.localKeys) || [];\n itemKeys = jsData.utils.isArray(itemKeys) ? itemKeys : Object.keys(itemKeys);\n relatedItems.forEach(function (relatedItem) {\n if (itemKeys && itemKeys.indexOf(relatedItem[relatedMapper.idAttribute]) !== -1) {\n attached.push(relatedItem);\n }\n });\n def.setLocalField(item, attached);\n });\n return relatedItems;\n })\n };\n }();\n\n if ((typeof _ret === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret)) === \"object\") return _ret.v;\n }\n },\n loadHasManyForeignKeys: function loadHasManyForeignKeys(mapper, def, records, __opts) {\n var self = this;\n var relatedMapper = def.getRelation();\n var idAttribute = mapper.idAttribute;\n var record = void 0;\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n record = records;\n }\n\n if (record) {\n return self.findAll(def.getRelation(), {\n where: babelHelpers.defineProperty({}, def.foreignKeys, {\n 'contains': self.makeHasManyForeignKeys(mapper, def, record)\n })\n }, __opts).then(function (relatedItems) {\n def.setLocalField(record, relatedItems);\n });\n } else {\n return self.findAll(relatedMapper, {\n where: babelHelpers.defineProperty({}, def.foreignKeys, {\n 'isectNotEmpty': records.map(function (record) {\n return self.makeHasManyForeignKeys(mapper, def, record);\n })\n })\n }, __opts).then(function (relatedItems) {\n var foreignKeysField = def.foreignKeys;\n records.forEach(function (record) {\n var _relatedItems = [];\n var id = jsData.utils.get(record, idAttribute);\n relatedItems.forEach(function (relatedItem) {\n var foreignKeys = jsData.utils.get(relatedItems, foreignKeysField) || [];\n if (foreignKeys.indexOf(id) !== -1) {\n _relatedItems.push(relatedItem);\n }\n });\n def.setLocalField(record, _relatedItems);\n });\n });\n }\n },\n\n\n /**\n * Load a hasOne relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadHasOne\n * @method\n * @return {Promise}\n */\n loadHasOne: function loadHasOne(mapper, def, records, __opts) {\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n records = [records];\n }\n return this.loadHasMany(mapper, def, records, __opts).then(function () {\n records.forEach(function (record) {\n var relatedData = def.getLocalField(record);\n if (jsData.utils.isArray(relatedData) && relatedData.length) {\n def.setLocalField(record, relatedData[0]);\n }\n });\n });\n },\n\n\n /**\n * Return the foreignKey from the given record for the provided relationship.\n *\n * Override with care.\n *\n * @name Adapter#makeBelongsToForeignKey\n * @method\n * @return {*}\n */\n makeBelongsToForeignKey: function makeBelongsToForeignKey(mapper, def, record) {\n return def.getForeignKey(record);\n },\n\n\n /**\n * Load a belongsTo relationship.\n *\n * Override with care.\n *\n * @name Adapter#loadBelongsTo\n * @method\n * @return {Promise}\n */\n loadBelongsTo: function loadBelongsTo(mapper, def, records, __opts) {\n var self = this;\n var relationDef = def.getRelation();\n\n if (jsData.utils.isObject(records) && !jsData.utils.isArray(records)) {\n var _ret2 = function () {\n var record = records;\n return {\n v: self.find(relationDef, self.makeBelongsToForeignKey(mapper, def, record), __opts).then(function (relatedItem) {\n def.setLocalField(record, relatedItem);\n })\n };\n }();\n\n if ((typeof _ret2 === 'undefined' ? 'undefined' : babelHelpers.typeof(_ret2)) === \"object\") return _ret2.v;\n } else {\n var keys = records.map(function (record) {\n return self.makeBelongsToForeignKey(mapper, def, record);\n }).filter(function (key) {\n return key;\n });\n return self.findAll(relationDef, {\n where: babelHelpers.defineProperty({}, relationDef.idAttribute, {\n 'in': keys\n })\n }, __opts).then(function (relatedItems) {\n records.forEach(function (record) {\n relatedItems.forEach(function (relatedItem) {\n if (relatedItem[relationDef.idAttribute] === record[def.foreignKey]) {\n def.setLocalField(record, relatedItem);\n }\n });\n });\n });\n }\n },\n\n\n /**\n * Retrieve the record with the given primary key. Called by `Mapper#find`.\n *\n * @name Adapter#find\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id Primary key of the record to retrieve.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n find: function find(mapper, id, opts) {\n var self = this;\n var record = void 0,\n op = void 0;\n opts || (opts = {});\n opts.with || (opts.with = []);\n\n // beforeFind lifecycle hook\n op = opts.op = 'beforeFind';\n return jsData.utils.resolve(self[op](mapper, id, opts)).then(function () {\n op = opts.op = 'find';\n self.dbg(op, mapper, id, opts);\n return jsData.utils.resolve(self._find(mapper, id, opts));\n }).then(function (results) {\n var _results6 = babelHelpers.slicedToArray(results, 1);\n\n var _record = _results6[0];\n\n if (!_record) {\n return;\n }\n record = _record;\n var tasks = [];\n\n jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {\n var task = void 0;\n if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {\n if (def.type === 'hasOne') {\n task = self.loadHasOne(mapper, def, record, __opts);\n } else {\n task = self.loadHasMany(mapper, def, record, __opts);\n }\n } else if (def.type === 'hasMany' && def.localKeys) {\n task = self.loadHasManyLocalKeys(mapper, def, record, __opts);\n } else if (def.type === 'hasMany' && def.foreignKeys) {\n task = self.loadHasManyForeignKeys(mapper, def, record, __opts);\n } else if (def.type === 'belongsTo') {\n task = self.loadBelongsTo(mapper, def, record, __opts);\n }\n if (task) {\n tasks.push(task);\n }\n });\n\n return Promise.all(tasks);\n }).then(function () {\n var response = new Response(record, {}, 'find');\n response.found = record ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterFind lifecycle hook\n op = opts.op = 'afterFind';\n return jsData.utils.resolve(self[op](mapper, id, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Retrieve the records that match the selection query.\n *\n * @name Adapter#findAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @param {string[]} [opts.with=[]] Relations to eager load.\n * @return {Promise}\n */\n findAll: function findAll(mapper, query, opts) {\n var self = this;\n opts || (opts = {});\n opts.with || (opts.with = []);\n\n var records = [];\n var op = void 0;\n var activeWith = opts._activeWith;\n\n if (jsData.utils.isObject(activeWith)) {\n var activeQuery = activeWith.query || {};\n if (activeWith.replace) {\n query = activeQuery;\n } else {\n jsData.utils.deepFillIn(query, activeQuery);\n }\n }\n\n // beforeFindAll lifecycle hook\n op = opts.op = 'beforeFindAll';\n return jsData.utils.resolve(self[op](mapper, query, opts)).then(function () {\n op = opts.op = 'findAll';\n self.dbg(op, mapper, query, opts);\n return jsData.utils.resolve(self._findAll(mapper, query, opts));\n }).then(function (results) {\n var _results7 = babelHelpers.slicedToArray(results, 1);\n\n var _records = _results7[0];\n\n _records || (_records = []);\n records = _records;\n var tasks = [];\n jsData.utils.forEachRelation(mapper, opts, function (def, __opts) {\n var task = void 0;\n if (def.foreignKey && (def.type === 'hasOne' || def.type === 'hasMany')) {\n if (def.type === 'hasMany') {\n task = self.loadHasMany(mapper, def, records, __opts);\n } else {\n task = self.loadHasOne(mapper, def, records, __opts);\n }\n } else if (def.type === 'hasMany' && def.localKeys) {\n task = self.loadHasManyLocalKeys(mapper, def, records, __opts);\n } else if (def.type === 'hasMany' && def.foreignKeys) {\n task = self.loadHasManyForeignKeys(mapper, def, records, __opts);\n } else if (def.type === 'belongsTo') {\n task = self.loadBelongsTo(mapper, def, records, __opts);\n }\n if (task) {\n tasks.push(task);\n }\n });\n return Promise.all(tasks);\n }).then(function () {\n var response = new Response(records, {}, 'findAll');\n response.found = records.length;\n response = self.respond(response, opts);\n\n // afterFindAll lifecycle hook\n op = opts.op = 'afterFindAll';\n return jsData.utils.resolve(self[op](mapper, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Resolve the value of the specified option based on the given options and\n * this adapter's settings. Override with care.\n *\n * @name Adapter#getOpt\n * @method\n * @param {string} opt The name of the option.\n * @param {Object} [opts] Configuration options.\n * @return {*} The value of the specified option.\n */\n getOpt: function getOpt(opt, opts) {\n opts || (opts = {});\n return jsData.utils.isUndefined(opts[opt]) ? jsData.utils.plainCopy(this[opt]) : jsData.utils.plainCopy(opts[opt]);\n },\n\n\n /**\n * Logging utility method. Override this method if you want to send log\n * messages to something other than the console.\n *\n * @name Adapter#log\n * @method\n * @param {string} level Log level.\n * @param {...*} values Values to log.\n */\n log: function log(level) {\n for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {\n args[_key4 - 1] = arguments[_key4];\n }\n\n if (level && !args.length) {\n args.push(level);\n level = 'debug';\n }\n if (level === 'debug' && !this.debug) {\n return;\n }\n var prefix = level.toUpperCase() + ': (Adapter)';\n if (console[level]) {\n var _console;\n\n (_console = console)[level].apply(_console, [prefix].concat(args));\n } else {\n var _console2;\n\n (_console2 = console).log.apply(_console2, [prefix].concat(args));\n }\n },\n\n\n /**\n * Retrieve sum of the specified field of the records that match the selection\n * query. Called by `Mapper#sum`.\n *\n * @name Adapter#sum\n * @method\n * @param {Object} mapper The mapper.\n * @param {string} field By to sum.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n sum: function sum(mapper, field, query, opts) {\n var self = this;\n var op = void 0;\n if (!jsData.utils.isString(field)) {\n throw new Error('field must be a string!');\n }\n query || (query = {});\n opts || (opts = {});\n\n // beforeSum lifecycle hook\n op = opts.op = 'beforeSum';\n return jsData.utils.resolve(self[op](mapper, field, query, opts)).then(function () {\n // Allow for re-assignment from lifecycle hook\n op = opts.op = 'sum';\n self.dbg(op, mapper, field, query, opts);\n return jsData.utils.resolve(self._sum(mapper, field, query, opts));\n }).then(function (results) {\n var _results8 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results8[0];\n var result = _results8[1];\n\n result || (result = {});\n var response = new Response(data, result, op);\n response = self.respond(response, opts);\n\n // afterSum lifecycle hook\n op = opts.op = 'afterSum';\n return jsData.utils.resolve(self[op](mapper, field, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * @name Adapter#respond\n * @method\n * @param {Object} response Response object.\n * @param {Object} opts Configuration options.\n * return {Object} If `opts.raw == true` then return `response`, else return\n * `response.data`.\n */\n respond: function respond(response, opts) {\n return this.getOpt('raw', opts) ? response : response.data;\n },\n\n\n /**\n * Apply the given update to the record with the specified primary key. Called\n * by `Mapper#update`.\n *\n * @name Adapter#update\n * @method\n * @param {Object} mapper The mapper.\n * @param {(string|number)} id The primary key of the record to be updated.\n * @param {Object} props The update to apply to the record.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n update: function update(mapper, id, props, opts) {\n var self = this;\n props || (props = {});\n opts || (opts = {});\n var op = void 0;\n\n // beforeUpdate lifecycle hook\n op = opts.op = 'beforeUpdate';\n return jsData.utils.resolve(self[op](mapper, id, props, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n op = opts.op = 'update';\n self.dbg(op, mapper, id, props, opts);\n return jsData.utils.resolve(self._update(mapper, id, props, opts));\n }).then(function (results) {\n var _results9 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results9[0];\n var result = _results9[1];\n\n result || (result = {});\n var response = new Response(data, result, 'update');\n response.updated = data ? 1 : 0;\n response = self.respond(response, opts);\n\n // afterUpdate lifecycle hook\n op = opts.op = 'afterUpdate';\n return jsData.utils.resolve(self[op](mapper, id, props, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Apply the given update to all records that match the selection query.\n * Called by `Mapper#updateAll`.\n *\n * @name Adapter#updateAll\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object} props The update to apply to the selected records.\n * @param {Object} [query] Selection query.\n * @param {Object} [query.where] Filtering criteria.\n * @param {string|Array} [query.orderBy] Sorting criteria.\n * @param {string|Array} [query.sort] Same as `query.sort`.\n * @param {number} [query.limit] Limit results.\n * @param {number} [query.skip] Offset results.\n * @param {number} [query.offset] Same as `query.skip`.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n updateAll: function updateAll(mapper, props, query, opts) {\n var self = this;\n props || (props = {});\n query || (query = {});\n opts || (opts = {});\n var op = void 0;\n\n // beforeUpdateAll lifecycle hook\n op = opts.op = 'beforeUpdateAll';\n return jsData.utils.resolve(self[op](mapper, props, query, opts)).then(function (_props) {\n // Allow for re-assignment from lifecycle hook\n props = jsData.utils.isUndefined(_props) ? props : _props;\n op = opts.op = 'updateAll';\n self.dbg(op, mapper, props, query, opts);\n return jsData.utils.resolve(self._updateAll(mapper, props, query, opts));\n }).then(function (results) {\n var _results10 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results10[0];\n var result = _results10[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'updateAll');\n response.updated = data.length;\n response = self.respond(response, opts);\n\n // afterUpdateAll lifecycle hook\n op = opts.op = 'afterUpdateAll';\n return jsData.utils.resolve(self[op](mapper, props, query, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n },\n\n\n /**\n * Update the given records in a single batch. Called by `Mapper#updateMany`.\n *\n * @name Adapter#updateMany\n * @method\n * @param {Object} mapper The mapper.\n * @param {Object[]} records The records to update.\n * @param {Object} [opts] Configuration options.\n * @param {boolean} [opts.raw=false] Whether to return a more detailed\n * response object.\n * @return {Promise}\n */\n updateMany: function updateMany(mapper, records, opts) {\n var self = this;\n records || (records = []);\n opts || (opts = {});\n var op = void 0;\n var idAttribute = mapper.idAttribute;\n\n records = records.filter(function (record) {\n return jsData.utils.get(record, idAttribute);\n });\n\n // beforeUpdateMany lifecycle hook\n op = opts.op = 'beforeUpdateMany';\n return jsData.utils.resolve(self[op](mapper, records, opts)).then(function (_records) {\n // Allow for re-assignment from lifecycle hook\n records = jsData.utils.isUndefined(_records) ? records : _records;\n records = records.map(function (record) {\n return withoutRelations(mapper, record);\n });\n op = opts.op = 'updateMany';\n self.dbg(op, mapper, records, opts);\n return jsData.utils.resolve(self._updateMany(mapper, records, opts));\n }).then(function (results) {\n var _results11 = babelHelpers.slicedToArray(results, 2);\n\n var data = _results11[0];\n var result = _results11[1];\n\n data || (data = []);\n result || (result = {});\n var response = new Response(data, result, 'updateMany');\n response.updated = data.length;\n response = self.respond(response, opts);\n\n // afterUpdateMany lifecycle hook\n op = opts.op = 'afterUpdateMany';\n return jsData.utils.resolve(self[op](mapper, records, opts, response)).then(function (_response) {\n // Allow for re-assignment from lifecycle hook\n return jsData.utils.isUndefined(_response) ? response : _response;\n });\n });\n }\n });\n\n module.exports = Adapter;\n\n}));\n//# sourceMappingURL=js-data-adapter.js.map\n\n\n/*****************\n ** WEBPACK FOOTER\n ** ./~/js-data-adapter/dist/js-data-adapter.js\n ** module id = 2\n ** module chunks = 0\n **/","module.exports = __WEBPACK_EXTERNAL_MODULE_3__;\n\n\n/*****************\n ** WEBPACK FOOTER\n ** external \"axios\"\n ** module id = 3\n ** module chunks = 0\n **/"],"sourceRoot":""}
\ No newline at end of file