diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 02f08fb..0000000 --- a/.babelrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "presets": [ - "es2015" - ] -} \ No newline at end of file diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index c6c8b36..0000000 --- a/.editorconfig +++ /dev/null @@ -1,9 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 03af3ea..0000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,43 +0,0 @@ -# Contributing to js-data core - -[Read the general Contributing Guide](http://js-data.io/docs/contributing). - -## Project structure - -* `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 - -## Clone, build & test - -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 - -## To cut a release - -1. Checkout master -1. Bump version in `package.json` appropriately -1. Update `CHANGELOG.md` appropriately -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 - - 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/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 56d48b8..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,7 +0,0 @@ -(delete this line) GitHub Issues are not for support questions. -(delete this line) GitHub Issues are for bug reports, feature requests, and other issues. -(delete this line) Find out how to Get Support here: http://js-data.io/docs/support. - - - -Thanks! diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 4c14bdc..0000000 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,8 +0,0 @@ -Fixes # (it's a good idea to open an issue first for discussion) - -- [ ] - `npm test` succeeds -- [ ] - Pull request has been squashed into 1 commit -- [ ] - I did NOT commit changes to `dist/` -- [ ] - Code coverage does not decrease (if any source code was changed) -- [ ] - Appropriate JSDoc comments were updated in source code (if applicable) -- [ ] - Approprate changes to js-data.io docs have been suggested ("Suggest Edits" button) diff --git a/.gitignore b/.gitignore index 9773bff..58beaca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,15 +1,6 @@ -dist/*.js -dist/*.map -bower_components/ - -.idea/ - -*.iml - -coverage/ -junit/ -doc/ -node_modules/ +coverage +doc +node_modules *.log -typings -.nyc_output \ No newline at end of file +.nyc_output +typings/ \ No newline at end of file diff --git a/.mailmap b/.mailmap deleted file mode 100644 index 91ee7de..0000000 --- a/.mailmap +++ /dev/null @@ -1,2 +0,0 @@ -InternalFX Bryan -Jason Dobry Jason Dobry diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index f599e28..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/3.0.0-alpha.3/-_home_ubuntu_workspace_js-data-http_src_index.js.html b/3.0.0-alpha.3/-_home_ubuntu_workspace_js-data-http_src_index.js.html new file mode 100644 index 0000000..42de512 --- /dev/null +++ b/3.0.0-alpha.3/-_home_ubuntu_workspace_js-data-http_src_index.js.html @@ -0,0 +1,1750 @@ + + + + + + js-data-http Source: /home/ubuntu/workspace/js-data-http/src/index.js + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Source: /home/ubuntu/workspace/js-data-http/src/index.js

+ +
+
+
/* global fetch:true Headers:true Request:true */
+const axios = require('axios')
+import {utils} from 'js-data'
+const {
+  _,
+  copy,
+  deepMixIn,
+  extend,
+  fillIn,
+  forOwn,
+  isArray,
+  isFunction,
+  isNumber,
+  isObject,
+  isSorN,
+  isString,
+  resolve,
+  reject,
+  toJson
+} = utils
+
+let hasFetch = false
+
+try {
+  hasFetch = window && window.fetch
+} catch (e) {}
+
+function isValidString (value) {
+  return (value != null && value !== '')
+}
+function join (items, separator) {
+  separator || (separator = '')
+  return items.filter(isValidString).join(separator)
+}
+function makePath (...args) {
+  let 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
+  }
+
+  const parts = []
+
+  forOwn(params, function (val, key) {
+    if (val === null || typeof val === 'undefined') {
+      return
+    }
+    if (!isArray(val)) {
+      val = [val]
+    }
+
+    val.forEach(function (v) {
+      if (window.toString.call(v) === '[object Date]') {
+        v = v.toISOString()
+      } else if (isObject(v)) {
+        v = toJson(v)
+      }
+      parts.push(`${encode(key)}=${encode(v)}`)
+    })
+  })
+
+  if (parts.length > 0) {
+    url += (url.indexOf('?') === -1 ? '?' : '&') + parts.join('&')
+  }
+
+  return url
+}
+
+/**
+ * DSHttpAdapter class.
+ * @class DSHttpAdapter
+ * @alias DSHttpAdapter
+ *
+ * @param {Object} [opts] Configuration options.
+ * @param {string} [opts.basePath='']
+ * @param {boolean} [opts.debug=false]
+ * @param {boolean} [opts.forceTrailingSlash=false]
+ * @param {Object} [opts.http=axios]
+ * @param {Object} [opts.httpConfig={}]
+ * @param {string} [opts.suffix='']
+ * @param {boolean} [opts.useFetch=false]
+ */
+function DSHttpAdapter (opts) {
+  const self = this
+
+  // Default values for arguments
+  opts || (opts = {})
+
+  // Default and user-defined settings
+  /**
+   * @name DSHttpAdapter#basePath
+   * @type {string}
+   */
+  self.basePath = opts.basePath === undefined ? '' : opts.basePath
+
+  /**
+   * @name DSHttpAdapter#debug
+   * @type {boolean}
+   * @default false
+   */
+  self.debug = opts.debug === undefined ? false : opts.debug
+
+  /**
+   * @name DSHttpAdapter#forceTrailingSlash
+   * @type {boolean}
+   * @default false
+   */
+  self.forceTrailingSlash = opts.forceTrailingSlash === undefined ? false : opts.forceTrailingSlash
+
+  /**
+   * @name DSHttpAdapter#http
+   * @type {Function}
+   */
+  self.http = opts.http === undefined ? axios : opts.http
+
+  /**
+   * @name DSHttpAdapter#httpConfig
+   * @type {Object}
+   */
+  self.httpConfig = opts.httpConfig === undefined ? {} : opts.httpConfig
+
+  /**
+   * @name DSHttpAdapter#suffix
+   * @type {string}
+   */
+  self.suffix = opts.suffix === undefined ? '' : opts.suffix
+
+  /**
+   * @name DSHttpAdapter#useFetch
+   * @type {boolean}
+   * @default false
+   */
+  self.useFetch = opts.useFetch === undefined ? false : opts.useFetch
+}
+
+fillIn(DSHttpAdapter.prototype, {
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#create}. If this method
+   * returns a promise then {@link DSHttpAdapter#create} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#create}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#create}.
+   * @param {Object} props The `props` argument passed to {@link DSHttpAdapter#create}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#create}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#create} will return.
+   */
+  afterCreate () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#createMany}. If this method
+   * returns a promise then {@link DSHttpAdapter#createMany} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#createMany}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#createMany}.
+   * @param {Object} models The `models` argument passed to {@link DSHttpAdapter#createMany}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#createMany}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#createMany} will return.
+   */
+  afterCreateMany () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#DEL}. If this method
+   * returns a promise then {@link DSHttpAdapter#DEL} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#DEL}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} url The `url` argument passed to {@link DSHttpAdapter#DEL}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#DEL}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#DEL}.
+   * @param {Object} response The `response` value that {@link DSHttpAdapter#DEL} will return.
+   */
+  afterDEL () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#destroy}. If this method
+   * returns a promise then {@link DSHttpAdapter#destroy} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#destroy}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#destroy}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#destroy}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#destroy}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#destroy} will return.
+   */
+  afterDestroy () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#destroyAll}. If this method
+   * returns a promise then {@link DSHttpAdapter#destroyAll} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#destroyAll}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#destroyAll}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#destroyAll}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#destroyAll}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#destroyAll} will return.
+   */
+  afterDestroyAll () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#find}. If this method
+   * returns a promise then {@link DSHttpAdapter#find} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#find}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#find}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#find}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#find}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#find} will return.
+   */
+  afterFind () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#findAll}. If this method
+   * returns a promise then {@link DSHttpAdapter#findAll} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#findAll}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#findAll}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#findAll}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#findAll}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#findAll} will return.
+   */
+  afterFindAll () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#GET}. If this method
+   * returns a promise then {@link DSHttpAdapter#GET} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#GET}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} url The `url` argument passed to {@link DSHttpAdapter#GET}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#GET}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#GET}.
+   * @param {Object} response The `response` value that {@link DSHttpAdapter#GET} will return.
+   */
+  afterGET () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#HTTP}. If this method
+   * returns a promise then {@link DSHttpAdapter#HTTP} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#HTTP}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#HTTP}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#HTTP}.
+   * @param {Object} response The `response` value that {@link DSHttpAdapter#HTTP} will return.
+   */
+  afterHTTP () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#POST}. If this method
+   * returns a promise then {@link DSHttpAdapter#POST} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#POST}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} url The `url` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} data The `data` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} response The `response` value that {@link DSHttpAdapter#POST} will return.
+   */
+  afterPOST () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#PUT}. If this method
+   * returns a promise then {@link DSHttpAdapter#PUT} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#PUT}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} url The `url` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} data The `data` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} response The `response` value that {@link DSHttpAdapter#PUT} will return.
+   */
+  afterPUT () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#update}. If this method
+   * returns a promise then {@link DSHttpAdapter#update} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#update}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#update}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#update}.
+   * @param {Object} props The `props` argument passed to {@link DSHttpAdapter#update}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#update}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#update} will return.
+   */
+  afterUpdate () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#updateAll}. If this method
+   * returns a promise then {@link DSHttpAdapter#updateAll} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#updateAll}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} props The `props` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} query The `query` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#updateAll} will return.
+   */
+  afterUpdateAll () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#updateMany}. If this method
+   * returns a promise then {@link DSHttpAdapter#updateMany} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#updateMany}
+   * will resolve with that same value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#updateMany}.
+   * @param {Object} models The `models` argument passed to {@link DSHttpAdapter#updateMany}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#updateMany}.
+   * @param {Object} data The `data` value that {@link DSHttpAdapter#updateMany} will return.
+   */
+  afterUpdateMany () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#create}. If this method
+   * returns a promise then {@link DSHttpAdapter#create} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#create}.
+   * @param {Object} props The `props` argument passed to {@link DSHttpAdapter#create}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#create}.
+   */
+  beforeCreate () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#createMany}. If this method
+   * returns a promise then {@link DSHttpAdapter#createMany} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#createMany}.
+   * @param {Object} models The `models` argument passed to {@link DSHttpAdapter#createMany}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#createMany}.
+   */
+  beforeCreateMany () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#DEL}. If this method
+   * returns a promise then {@link DSHttpAdapter#DEL} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#create}
+   * will resolve with that same value, then the `config` argument passed to
+   * {@link DSHttpAdapter#DEL} will be replaced by the value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} url The `url` argument passed to {@link DSHttpAdapter#DEL}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#DEL}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#DEL}.
+   */
+  beforeDEL () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#destroy}. If this method
+   * returns a promise then {@link DSHttpAdapter#destroy} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#destroy}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#destroy}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#destroy}.
+   */
+  beforeDestroy () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#destroyAll}. If this method
+   * returns a promise then {@link DSHttpAdapter#destroyAll} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#destroyAll}.
+   * @param {Object} query The `query` argument passed to {@link DSHttpAdapter#destroyAll}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#destroyAll}.
+   */
+  beforeDestroyAll () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#find}. If this method
+   * returns a promise then {@link DSHttpAdapter#find} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#find}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#find}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#find}.
+   */
+  beforeFind () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#findAll}. If this method
+   * returns a promise then {@link DSHttpAdapter#findAll} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#findAll}.
+   * @param {Object} query The `query` argument passed to {@link DSHttpAdapter#findAll}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#findAll}.
+   */
+  beforeFindAll () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#GET}. If this method
+   * returns a promise then {@link DSHttpAdapter#GET} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#create}
+   * will resolve with that same value, then the `config` argument passed to
+   * {@link DSHttpAdapter#GET} will be replaced by the value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} url The `url` argument passed to {@link DSHttpAdapter#GET}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#GET}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#GET}.
+   */
+  beforeGET () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#HTTP}. If this method
+   * returns a promise then {@link DSHttpAdapter#HTTP} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#create}
+   * will resolve with that same value, then the `config` argument passed to
+   * {@link DSHttpAdapter#HTTP} will be replaced by the value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#HTTP}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#HTTP}.
+   */
+  beforeHTTP () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#POST}. If this method
+   * returns a promise then {@link DSHttpAdapter#POST} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#create}
+   * will resolve with that same value, then the `config` argument passed to
+   * {@link DSHttpAdapter#POST} will be replaced by the value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} url The `url` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} data The `data` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#POST}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#POST}.
+   */
+  beforePOST () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#PUT}. If this method
+   * returns a promise then {@link DSHttpAdapter#PUT} will wait for the
+   * promise to resolve before continuing. If this method returns any other
+   * value or the promise resolves with a value, then {@link DSHttpAdapter#create}
+   * will resolve with that same value, then the `config` argument passed to
+   * {@link DSHttpAdapter#PUT} will be replaced by the value.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} url The `url` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} data The `data` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} config The `config` argument passed to {@link DSHttpAdapter#PUT}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#PUT}.
+   */
+  beforePUT () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#update}. If this method
+   * returns a promise then {@link DSHttpAdapter#update} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#update}.
+   * @param {(string|number)} id The `id` argument passed to {@link DSHttpAdapter#update}.
+   * @param {Object} props The `props` argument passed to {@link DSHttpAdapter#update}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#update}.
+   */
+  beforeUpdate () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#updateAll}. If this method
+   * returns a promise then {@link DSHttpAdapter#updateAll} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} props The `props` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} query The `query` argument passed to {@link DSHttpAdapter#updateAll}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#updateAll}.
+   */
+  beforeUpdateAll () {},
+
+  /**
+   * Lifecycle hook called by {@link DSHttpAdapter#updateMany}. If this method
+   * returns a promise then {@link DSHttpAdapter#updateMany} will wait for the
+   * promise to resolve before continuing.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The `Model` argument passed to {@link DSHttpAdapter#updateMany}.
+   * @param {Object} models The `models` argument passed to {@link DSHttpAdapter#updateMany}.
+   * @param {Object} opts The `opts` argument passed to {@link DSHttpAdapter#updateMany}.
+   */
+  beforeUpdateMany () {},
+
+  /**
+   * Create a new the entity from the provided `props`.
+   *
+   * {@link DSHttpAdapter#beforeCreate} will be called before calling
+   * {@link DSHttpAdapter#POST}.
+   * {@link DSHttpAdapter#afterCreate} will be called after calling
+   * {@link DSHttpAdapter#POST}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {Object} props Properties to send as the payload.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  create (Model, props, opts) {
+    const self = this
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'create'
+    self.dbg(opts.op, Model, props, opts)
+    return resolve(self.beforeCreate(Model, props, opts)).then(function () {
+      return self.POST(
+        self.getPath('create', Model, props, opts),
+        self.serialize(Model, props, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterCreate(Model, props, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * Create multiple new entities in batch.
+   *
+   * {@link DSHttpAdapter#beforeCreateMany} will be called before calling
+   * {@link DSHttpAdapter#POST}.
+   * {@link DSHttpAdapter#afterCreateMany} will be called after calling
+   * {@link DSHttpAdapter#POST}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {Array} models Array of property objects to send as the payload.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  createMany (Model, models, opts) {
+    const self = this
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'createMany'
+    self.dbg(opts.op, Model, models, opts)
+    return resolve(self.beforeCreateMany(Model, models, opts)).then(function () {
+      return self.POST(
+        self.getPath('createMany', Model, null, opts),
+        self.serialize(Model, models, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterCreateMany(Model, models, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * Call {@link DSHttpAdapter#log} at the "debug" level.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {...*} [args] Args passed to {@link DSHttpAdapter#log}.
+   */
+  dbg (...args) {
+    this.log('debug', ...args)
+  },
+
+  /**
+   * Make an Http request to `url` according to the configuration in `config`.
+   *
+   * {@link DSHttpAdapter#beforeDEL} will be called before calling
+   * {@link DSHttpAdapter#HTTP}.
+   * {@link DSHttpAdapter#afterDEL} will be called after calling
+   * {@link DSHttpAdapter#HTTP}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} url Url for the request.
+   * @param {Object} [config] Http configuration that will be passed to
+   * {@link DSHttpAdapter#HTTP}.
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  DEL (url, config, opts) {
+    const self = this
+    config || (config = {})
+    config.url = url || config.url
+    config.method = config.method || 'delete'
+    return resolve(self.beforeDEL(url, config, opts)).then(function (_config) {
+      config = _config || config
+      return self.HTTP(config, opts)
+    }).then(function (response) {
+      return resolve(self.afterDEL(url, config, opts, response)).then(function (_response) {
+        return _response || response
+      })
+    })
+  },
+
+  /**
+   * Transform the server response object into the payload that will be returned
+   * to JSData.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model used for the operation.
+   * @param {Object} response Response object from {@link DSHttpAdapter#HTTP}.
+   * @param {Object} opts Configuration options.
+   * @return {(Object|Array)} Deserialized data.
+   */
+  deserialize (Model, response, opts) {
+    opts || (opts = {})
+    if (isFunction(opts.deserialize)) {
+      return opts.deserialize(Model, response, opts)
+    }
+    if (isFunction(Model.deserialize)) {
+      return Model.deserialize(Model, response, opts)
+    }
+    if (opts.raw) {
+      return response
+    }
+    return response ? ('data' in response ? response.data : response) : response
+  },
+
+  /**
+   * Destroy the entity with the given primary key.
+   *
+   * {@link DSHttpAdapter#beforeDestroy} will be called before calling
+   * {@link DSHttpAdapter#DEL}.
+   * {@link DSHttpAdapter#afterDestroy} will be called after calling
+   * {@link DSHttpAdapter#DEL}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {(string|number)} id Primary key of the entity to destroy.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  destroy (Model, id, opts) {
+    const self = this
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'destroy'
+    self.dbg(opts.op, Model, id, opts)
+    return resolve(self.beforeDestroy(Model, id, opts)).then(function () {
+      return self.DEL(
+        self.getPath('destroy', Model, id, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterDestroy(Model, id, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * Destroy the entities that match the selection `query`.
+   *
+   * {@link DSHttpAdapter#beforeDestroyAll} will be called before calling
+   * {@link DSHttpAdapter#DEL}.
+   * {@link DSHttpAdapter#afterDestroyAll} will be called after calling
+   * {@link DSHttpAdapter#DEL}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {Object} query Selection query.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  destroyAll (Model, query, opts) {
+    const self = this
+    query || (query = {})
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    deepMixIn(opts.params, query)
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'destroyAll'
+    self.dbg(opts.op, Model, query, opts)
+    return resolve(self.beforeDestroyAll(Model, query, opts)).then(function () {
+      return self.DEL(
+        self.getPath('destroyAll', Model, null, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterDestroyAll(Model, query, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * Log an error.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {...*} [args] Arguments to log.
+   */
+  error (...args) {
+    if (console) {
+      console[typeof console.error === 'function' ? 'error' : 'log'](...args)
+    }
+  },
+
+  /**
+   * Make an Http request using `window.fetch`.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @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 (config, opts) {
+    const requestConfig = {
+      method: config.method,
+      // turn the plain headers object into the Fetch Headers object
+      headers: new Headers(config.headers)
+    }
+
+    if (config.data) {
+      requestConfig.body = 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 entity with the given primary key.
+   *
+   * {@link DSHttpAdapter#beforeFind} will be called before calling
+   * {@link DSHttpAdapter#GET}.
+   * {@link DSHttpAdapter#afterFind} will be called after calling
+   * {@link DSHttpAdapter#GET}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {(string|number)} id Primary key of the entity to retrieve.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  find (Model, id, opts) {
+    const self = this
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'find'
+    self.dbg(opts.op, Model, id, opts)
+    return resolve(self.beforeFind(Model, id, opts)).then(function () {
+      return self.GET(
+        self.getPath('find', Model, id, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterFind(Model, id, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * Retrieve the entities that match the selection `query`.
+   *
+   * {@link DSHttpAdapter#beforeFindAll} will be called before calling
+   * {@link DSHttpAdapter#GET}.
+   * {@link DSHttpAdapter#afterFindAll} will be called after calling
+   * {@link DSHttpAdapter#GET}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {Object} query Selection query.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  findAll (Model, query, opts) {
+    const self = this
+    query || (query = {})
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'findAll'
+    self.dbg(opts.op, Model, query, opts)
+    deepMixIn(opts.params, query)
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    return resolve(self.beforeFindAll(Model, query, opts)).then(function () {
+      return self.GET(
+        self.getPath('findAll', Model, opts.params, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterFindAll(Model, query, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} url The url for the request.
+   * @param {Object} config Request configuration options.
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  GET (url, config, opts) {
+    const self = this
+    config || (config = {})
+    config.url = url || config.url
+    config.method = config.method || 'get'
+    return resolve(self.beforeGET(url, config, opts)).then(function (_config) {
+      config = _config || config
+      return self.HTTP(config, opts)
+    }).then(function (response) {
+      return resolve(self.afterGET(url, config, opts, response)).then(function (_response) {
+        return _response || response
+      })
+    })
+  },
+
+  /**
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} Model { description }
+   * @param {*} id { description }
+   * @param {boolean} opts { description }
+   * @return {string} Full path.
+   */
+  getEndpoint (Model, id, opts) {
+    opts || (opts = {})
+    opts.params || (opts.params = {})
+
+    let item
+    const parentKey = Model.parentKey
+    const endpoint = opts.hasOwnProperty('endpoint') ? opts.endpoint : Model.endpoint
+    let parentField = Model.parentField
+    const parentDef = Model.parent ? Model.getResource(Model.parent) : undefined
+    let parentId = opts.params[parentKey]
+
+    if (parentId === false || !parentKey || !parentDef) {
+      if (parentId === false) {
+        delete opts.params[parentKey]
+      }
+      return endpoint
+    } else {
+      delete opts.params[parentKey]
+
+      if (isString(id) || isNumber(id)) {
+        item = Model.get(id)
+      } else if (isObject(id)) {
+        item = id
+      }
+
+      if (item) {
+        parentId = parentId || item[parentKey] || (item[parentField] ? item[parentField][parentDef.idAttribute] : null)
+      }
+
+      if (parentId) {
+        delete opts.endpoint
+        const _opts = {}
+        forOwn(opts, function (value, key) {
+          _opts[key] = value
+        })
+        _(_opts, parentDef)
+        return makePath(this.getEndpoint(parentDef, parentId, _opts, parentId, endpoint))
+      } else {
+        return endpoint
+      }
+    }
+  },
+
+  /**
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} method TODO
+   * @param {*} Model TODO
+   * @param {(string|number)?} id TODO
+   * @param {Object} opts Configuration options.
+   */
+  getPath (method, Model, id, opts) {
+    const self = this
+    opts || (opts = {})
+    const args = [
+      opts.basePath === undefined ? (Model.basePath === undefined ? self.basePath : Model.basePath) : opts.basePath,
+      self.getEndpoint(Model, (isString(id) || isNumber(id) || method === 'create') ? id : null, opts)
+    ]
+    if (method === 'find' || method === 'update' || method === 'destroy') {
+      args.push(id)
+    }
+    return makePath.apply(utils, args)
+  },
+
+  /**
+   * Make an Http request.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} config Request configuration options.
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  HTTP (config, opts) {
+    const self = this
+    const start = new Date()
+    opts || (opts = {})
+    config = copy(config)
+    config = deepMixIn(config, self.httpConfig)
+    if (self.forceTrailingSlash && config.url[config.url.length - 1] !== '/') {
+      config.url += '/'
+    }
+    config.method = config.method.toUpperCase()
+    const suffix = config.suffix || opts.suffix || self.suffix
+    if (suffix && config.url.substr(config.url.length - suffix.length) !== suffix) {
+      config.url += suffix
+    }
+
+    function logResponse (data) {
+      const 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 reject(data)
+      }
+    }
+
+    if (!self.http) {
+      throw new Error('You have not configured this adapter with an http library!')
+    }
+
+    return 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 resolve(self.afterHTTP(config, opts, response)).then(function (_response) {
+        return _response || response
+      })
+    })
+  },
+
+  /**
+   * Log the provided arguments at the specified leve.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {string} level Log level.
+   * @param {...*} [args] Arguments to log.
+   */
+  log (level, ...args) {
+    if (level && !args.length) {
+      args.push(level)
+      level = 'debug'
+    }
+    if (level === 'debug' && !this.debug) {
+      return
+    }
+    const prefix = `${level.toUpperCase()}: (${this.name})`
+    if (console[level]) {
+      console[level](prefix, ...args)
+    } else {
+      console.log(prefix, ...args)
+    }
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} url { description }
+   * @param {*} data { description }
+   * @param {*} config { description }
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  POST (url, data, config, opts) {
+    const self = this
+    config || (config = {})
+    config.url = url || config.url
+    config.data = data || config.data
+    config.method = config.method || 'post'
+    return resolve(self.beforePOST(url, data, config, opts)).then(function (_config) {
+      config = _config || config
+      return self.HTTP(config, opts)
+    }).then(function (response) {
+      return resolve(self.afterPOST(url, data, config, opts, response)).then(function (_response) {
+        return _response || response
+      })
+    })
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} url { description }
+   * @param {*} data { description }
+   * @param {*} config { description }
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  PUT (url, data, config, opts) {
+    const self = this
+    config || (config = {})
+    config.url = url || config.url
+    config.data = data || config.data
+    config.method = config.method || 'put'
+    return resolve(self.beforePUT(url, data, config, opts)).then(function (_config) {
+      config = _config || config
+      return self.HTTP(config, opts)
+    }).then(function (response) {
+      return resolve(self.afterPUT(url, data, config, opts, response)).then(function (_response) {
+        return _response || response
+      })
+    })
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} Model { description }
+   * @param {*} params { description }
+   * @param {*} opts { description }
+   * @return {*} Transformed params.
+   */
+  queryTransform (Model, params, opts) {
+    opts || (opts = {})
+    if (isFunction(opts.queryTransform)) {
+      return opts.queryTransform(Model, params, opts)
+    }
+    if (isFunction(Model.queryTransform)) {
+      return Model.queryTransform(Model, params, opts)
+    }
+    return params
+  },
+
+  /**
+   * Error handler invoked when the promise returned by {@link DSHttpAdapter#http}
+   * is rejected. Default implementation is to just return the error wrapped in
+   * a rejected Promise, aka rethrow the error. {@link DSHttpAdapter#http} is
+   * called by {@link DSHttpAdapter#HTTP}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} err The error that {@link DSHttpAdapter#http} rejected with.
+   * @param {*} config The `config` argument that was passed to {@link DSHttpAdapter#HTTP}.
+   * @param {*} opts The `opts` argument that was passed to {@link DSHttpAdapter#HTTP}.
+   * @return {Promise}
+   */
+  responseError (err, config, opts) {
+    return reject(err)
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} Model { description }
+   * @param {*} data { description }
+   * @param {*} opts { description }
+   * @return {*} Serialized data.
+   */
+  serialize (Model, data, opts) {
+    opts || (opts = {})
+    if (isFunction(opts.serialize)) {
+      return opts.serialize(Model, data, opts)
+    }
+    if (isFunction(Model.serialize)) {
+      return Model.serialize(Model, data, opts)
+    }
+    return data
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} Model { description }
+   * @param {*} id { description }
+   * @param {*} props { description }
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  update (Model, id, props, opts) {
+    const self = this
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'update'
+    self.dbg(opts.op, Model, id, props, opts)
+    return resolve(self.beforeUpdate(Model, id, props, opts)).then(function () {
+      return self.PUT(
+        self.getPath('update', Model, id, opts),
+        self.serialize(Model, props, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterUpdate(Model, id, props, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * { function_description }
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {*} Model { description }
+   * @param {*} props { description }
+   * @param {*} query { description }
+   * @param {Object} [opts] Configuration options.
+   * @return {Promise}
+   */
+  updateAll (Model, props, query, opts) {
+    const self = this
+    query || (query = {})
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    deepMixIn(opts.params, query)
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'updateAll'
+    self.dbg(opts.op, Model, props, query, opts)
+    return resolve(self.beforeUpdateAll(Model, props, query, opts)).then(function () {
+      return self.PUT(
+        self.getPath('updateAll', Model, null, opts),
+        self.serialize(Model, props, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterUpdateAll(Model, props, query, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  },
+
+  /**
+   * Update multiple entities in batch.
+   *
+   * {@link DSHttpAdapter#beforeUpdateMany} will be called before calling
+   * {@link DSHttpAdapter#PUT}.
+   * {@link DSHttpAdapter#afterUpdateMany} will be called after calling
+   * {@link DSHttpAdapter#PUT}.
+   *
+   * @memberof DSHttpAdapter
+   * @instance
+   * @param {Object} Model The Model.
+   * @param {Array} models Array of property objects to send as the payload.
+   * @param {Object} [opts] Configuration options.
+   * @param {string} [opts.params] TODO
+   * @param {string} [opts.suffix={@link DSHttpAdapter#suffix}] TODO
+   * @return {Promise}
+   */
+  updateMany (Model, models, opts) {
+    const self = this
+    opts = opts ? copy(opts) : {}
+    opts.params || (opts.params = {})
+    opts.params = self.queryTransform(Model, opts.params, opts)
+    opts.suffix || (opts.suffix = Model.suffix)
+    opts.op = 'updateMany'
+    self.dbg(opts.op, Model, models, opts)
+    return resolve(self.beforeUpdateMany(Model, models, opts)).then(function () {
+      return self.PUT(
+        self.getPath('updateMany', Model, null, opts),
+        self.serialize(Model, models, opts),
+        opts
+      )
+    }).then(function (response) {
+      return self.deserialize(Model, response, opts)
+    }).then(function (data) {
+      return resolve(self.afterUpdateMany(Model, models, opts, data)).then(function (_data) {
+        return _data || data
+      })
+    })
+  }
+})
+
+/**
+ * Add an Http actions to a Model.
+ *
+ * @name DSHttpAdapter.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 Model to
+ * decorate when invoked.
+ */
+DSHttpAdapter.addAction = function (name, opts) {
+  if (!name || !isString(name)) {
+    throw new TypeError('action(name[, opts]): Expected: string, Found: ' + typeof name)
+  }
+  return function (Model) {
+    if (Model[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 reject(err) }
+    Model[name] = function (id, _opts) {
+      if (isObject(id)) {
+        _opts = id
+      }
+      _opts = _opts || {}
+      let adapter = this.getAdapter(opts.adapter || this.defaultAdapter || 'http')
+      let config = {}
+      fillIn(config, opts)
+      if (!_opts.hasOwnProperty('endpoint') && config.endpoint) {
+        _opts.endpoint = config.endpoint
+      }
+      if (typeof _opts.getEndpoint === 'function') {
+        config.url = _opts.getEndpoint(this, _opts)
+      } else {
+        let args = [
+          _opts.basePath || this.basePath || adapter.defaults.basePath,
+          adapter.getEndpoint(this, isSorN(id) ? id : null, _opts)
+        ]
+        if (isSorN(id)) {
+          args.push(id)
+        }
+        args.push(opts.pathname || name)
+        config.url = makePath.apply(null, args)
+      }
+      config.method = config.method || 'GET'
+      config.modelName = this.name
+      deepMixIn(config)(_opts)
+      return resolve(config)
+        .then(_opts.request || opts.request)
+        .then(function (config) { return adapter.HTTP(config) })
+        .then(function (data) {
+          if (data && data.config) {
+            data.config.modelName = this.name
+          }
+          return data
+        })
+        .then(_opts.response || opts.response, _opts.responseError || opts.responseError)
+    }
+    return Model
+  }
+}
+
+/**
+ * Add multiple Http actions to a Model. See {@link DSHttpAdapter.addAction} for
+ * action configuration options.
+ *
+ * @name DSHttpAdapter.addActions
+ * @method
+ * @param {Object.<string, 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 Model to
+ * decorate when invoked.
+ */
+DSHttpAdapter.addActions = function (opts) {
+  opts || (opts = {})
+  return function (Model) {
+    forOwn(Model, function (value, key) {
+      DSHttpAdapter.addAction(key, value)(Model)
+    })
+    return Model
+  }
+}
+
+/**
+ * Alternative to ES6 class syntax for extending `DSHttpAdapter`.
+ *
+ * __ES6__:
+ * ```javascript
+ * class MyHttpAdapter extends DSHttpAdapter {
+ *   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 = DSHttpAdapter.extend(instanceProps, classProps)
+ * var adapter = new MyHttpAdapter()
+ * adapter.say() // "hi"
+ * MyHttpAdapter.yell() // "HI"
+ * ```
+ *
+ * @name DSHttpAdapter.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 `DSHttpAdapter`.
+ */
+DSHttpAdapter.extend = extend
+
+/**
+ * Details of the current version of the `js-data-http` module.
+ *
+ * @name DSHttpAdapter.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.
+ */
+DSHttpAdapter.version = {
+  full: '<%= pkg.version %>',
+  major: parseInt('<%= major %>', 10),
+  minor: parseInt('<%= minor %>', 10),
+  patch: parseInt('<%= patch %>', 10),
+  alpha: '<%= alpha %>' !== 'false' ? '<%= alpha %>' : false,
+  beta: '<%= beta %>' !== 'false' ? '<%= beta %>' : false
+}
+
+/**
+ * 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.DSHttpAdapter
+ * ```
+ * __CommonJS__:
+ * ```javascript
+ * var DSHttpAdapter = require('js-data-http')
+ * ```
+ * __ES6 Modules__:
+ * ```javascript
+ * import DSHttpAdapter from 'js-data-http'
+ * ```
+ * __AMD__:
+ * ```javascript
+ * define('myApp', ['js-data-http'], function (DSHttpAdapter) { ... })
+ * ```
+ *
+ * @module js-data-http
+ */
+
+module.exports = DSHttpAdapter
+
+
+
+ + + + + +
+
+ +
+ + + +
+
+ + + +
+ +
Back to js-data.io
+ + + + js-data-http Copyright © 2014-2016 Jason Dobry + + + + Documentation generated by JSDoc 3.4.0 + + on 2016-01-27T00:16:19+00:00 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + diff --git a/3.0.0-alpha.3/DSHttpAdapter.html b/3.0.0-alpha.3/DSHttpAdapter.html new file mode 100644 index 0000000..ea4cccd --- /dev/null +++ b/3.0.0-alpha.3/DSHttpAdapter.html @@ -0,0 +1,14448 @@ + + + + + + js-data-http Class: DSHttpAdapter + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Class: DSHttpAdapter

+
+ +
+ +

+ DSHttpAdapter +

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

new DSHttpAdapter(opts)

+ + +
+
+ + +
+

DSHttpAdapter class.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
basePath + + +string + + + + + + + <optional>
+ + + + + +
+ + '' + +
debug + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +
forceTrailingSlash + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +
http + + +Object + + + + + + + <optional>
+ + + + + +
+ + axios + +
httpConfig + + +Object + + + + + + + <optional>
+ + + + + +
+ + {} + +
suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + '' + +
useFetch + + +boolean + + + + + + + <optional>
+ + + + + +
+ + false + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + +

Members

+ +
+ +
+
+

<static> version :Object

+ + +
+
+ +
+

Details of the current version of the js-data-http module.

+
+ + + +
Type:
+
    +
  • + +Object + + + +
  • +
+ + + +
+ + +
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
version.full + + +string + + + + +

The full semver value.

version.major + + +number + + + + +

The major version number.

version.minor + + +number + + + + +

The minor version number.

version.patch + + +number + + + + +

The patch version number.

version.alpha + + +string +| + +boolean + + + + +

The alpha version value, +otherwise false if the current version is not alpha.

version.beta + + +string +| + +boolean + + + + +

The beta version value, +otherwise false if the current version is not beta.

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

basePath :string

+ + +
+
+ + + +
Type:
+
    +
  • + +string + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

debug :boolean

+ + +
+
+ + + +
Type:
+
    +
  • + +boolean + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Default Value:
+
+
    +
  • false
  • +
+
+ + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

forceTrailingSlash :boolean

+ + +
+
+ + + +
Type:
+
    +
  • + +boolean + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Default Value:
+
+
    +
  • false
  • +
+
+ + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

http :function

+ + +
+
+ + + +
Type:
+
    +
  • + +function + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

httpConfig :Object

+ + +
+
+ + + +
Type:
+
    +
  • + +Object + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

suffix :string

+ + +
+
+ + + +
Type:
+
    +
  • + +string + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ + + +
+
+

useFetch :boolean

+ + +
+
+ + + +
Type:
+
    +
  • + +boolean + + + +
  • +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Default Value:
+
+
    +
  • false
  • +
+
+ + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + +
+ +
+ + + +

Methods

+ +
+ +
+
+

<static> addAction(name, opts)

+ + +
+
+ + +
+

Add an Http actions to a Model.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
name + + +string + + + + + + + + + + +

Name of the new action.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Action configuration

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
adapter + + +string + + + + + + + <optional>
+ + + + + +
pathname + + +string + + + + + + + <optional>
+ + + + + +
request + + +function + + + + + + + <optional>
+ + + + + +
response + + +function + + + + + + + <optional>
+ + + + + +
responseError + + +function + + + + + + + <optional>
+ + + + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoration function, which should be passed the Model to +decorate when invoked.

+
+ + + +
+
+ Type +
+
+ +function + + + +
+
+ + + + + +
+ + + +
+
+

<static> addActions(opts)

+ + +
+
+ + +
+

Add multiple Http actions to a Model. See DSHttpAdapter.addAction for +action configuration options.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
opts + + +Object.<string, Object> + + + + +

Object where the key is an action name +and the value is the configuration for the action.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Decoration function, which should be passed the Model to +decorate when invoked.

+
+ + + +
+
+ Type +
+
+ +function + + + +
+
+ + + + + +
+ + + +
+
+

<static> extend(instanceProps, classProps)

+ + +
+
+ + +
+

Alternative to ES6 class syntax for extending DSHttpAdapter.

+

ES6:

+
class MyHttpAdapter extends DSHttpAdapter {
+  deserialize (Model, data, opts) {
+    const data = super.deserialize(Model, data, opts)
+    data.foo = 'bar'
+    return data
+  }
+}

ES5:

+
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 = DSHttpAdapter.extend(instanceProps, classProps)
+var adapter = new MyHttpAdapter()
+adapter.say() // "hi"
+MyHttpAdapter.yell() // "HI"
+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
instanceProps + + +Object + + + + + + + <optional>
+ + + + + +

Properties that will be added to the +prototype of the subclass.

classProps + + +Object + + + + + + + <optional>
+ + + + + +

Properties that will be added as static +properties to the subclass itself.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Subclass of DSHttpAdapter.

+
+ + + +
+
+ Type +
+
+ +Object + + + +
+
+ + + + + +
+ + + +
+
+

afterCreate(Model, props, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#create. If this method +returns a promise then DSHttpAdapter#create will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#create +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#create.

props + + +Object + + + + +

The props argument passed to DSHttpAdapter#create.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#create.

data + + +Object + + + + +

The data value that DSHttpAdapter#create will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterCreateMany(Model, models, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#createMany. If this method +returns a promise then DSHttpAdapter#createMany will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#createMany +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#createMany.

models + + +Object + + + + +

The models argument passed to DSHttpAdapter#createMany.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#createMany.

data + + +Object + + + + +

The data value that DSHttpAdapter#createMany will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterDEL(url, config, opts, response)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#DEL. If this method +returns a promise then DSHttpAdapter#DEL will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#DEL +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + +

The url argument passed to DSHttpAdapter#DEL.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#DEL.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#DEL.

response + + +Object + + + + +

The response value that DSHttpAdapter#DEL will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterDestroy(Model, id, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#destroy. If this method +returns a promise then DSHttpAdapter#destroy will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#destroy +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#destroy.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#destroy.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#destroy.

data + + +Object + + + + +

The data value that DSHttpAdapter#destroy will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterDestroyAll(Model, id, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#destroyAll. If this method +returns a promise then DSHttpAdapter#destroyAll will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#destroyAll +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#destroyAll.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#destroyAll.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#destroyAll.

data + + +Object + + + + +

The data value that DSHttpAdapter#destroyAll will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterFind(Model, id, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#find. If this method +returns a promise then DSHttpAdapter#find will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#find +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#find.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#find.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#find.

data + + +Object + + + + +

The data value that DSHttpAdapter#find will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterFindAll(Model, id, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#findAll. If this method +returns a promise then DSHttpAdapter#findAll will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#findAll +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#findAll.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#findAll.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#findAll.

data + + +Object + + + + +

The data value that DSHttpAdapter#findAll will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterGET(url, config, opts, response)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#GET. If this method +returns a promise then DSHttpAdapter#GET will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#GET +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + +

The url argument passed to DSHttpAdapter#GET.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#GET.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#GET.

response + + +Object + + + + +

The response value that DSHttpAdapter#GET will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterHTTP(config, opts, response)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#HTTP. If this method +returns a promise then DSHttpAdapter#HTTP will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#HTTP +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +Object + + + + +

The config argument passed to DSHttpAdapter#HTTP.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#HTTP.

response + + +Object + + + + +

The response value that DSHttpAdapter#HTTP will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterPOST(url, data, config, opts, response)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#POST. If this method +returns a promise then DSHttpAdapter#POST will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#POST +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + +

The url argument passed to DSHttpAdapter#POST.

data + + +Object + + + + +

The data argument passed to DSHttpAdapter#POST.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#POST.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#POST.

response + + +Object + + + + +

The response value that DSHttpAdapter#POST will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterPUT(url, data, config, opts, response)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#PUT. If this method +returns a promise then DSHttpAdapter#PUT will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#PUT +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +string + + + + +

The url argument passed to DSHttpAdapter#PUT.

data + + +Object + + + + +

The data argument passed to DSHttpAdapter#PUT.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#PUT.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#PUT.

response + + +Object + + + + +

The response value that DSHttpAdapter#PUT will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterUpdate(Model, id, props, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#update. If this method +returns a promise then DSHttpAdapter#update will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#update +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#update.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#update.

props + + +Object + + + + +

The props argument passed to DSHttpAdapter#update.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#update.

data + + +Object + + + + +

The data value that DSHttpAdapter#update will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterUpdateAll(Model, props, query, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#updateAll. If this method +returns a promise then DSHttpAdapter#updateAll will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#updateAll +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#updateAll.

props + + +Object + + + + +

The props argument passed to DSHttpAdapter#updateAll.

query + + +Object + + + + +

The query argument passed to DSHttpAdapter#updateAll.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#updateAll.

data + + +Object + + + + +

The data value that DSHttpAdapter#updateAll will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

afterUpdateMany(Model, models, opts, data)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#updateMany. If this method +returns a promise then DSHttpAdapter#updateMany will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#updateMany +will resolve with that same value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#updateMany.

models + + +Object + + + + +

The models argument passed to DSHttpAdapter#updateMany.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#updateMany.

data + + +Object + + + + +

The data value that DSHttpAdapter#updateMany will return.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeCreate(Model, props, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#create. If this method +returns a promise then DSHttpAdapter#create will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#create.

props + + +Object + + + + +

The props argument passed to DSHttpAdapter#create.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#create.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeCreateMany(Model, models, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#createMany. If this method +returns a promise then DSHttpAdapter#createMany will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#createMany.

models + + +Object + + + + +

The models argument passed to DSHttpAdapter#createMany.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#createMany.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeDEL(url, config, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#DEL. If this method +returns a promise then DSHttpAdapter#DEL will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#create +will resolve with that same value, then the config argument passed to +DSHttpAdapter#DEL will be replaced by the value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +Object + + + + +

The url argument passed to DSHttpAdapter#DEL.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#DEL.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#DEL.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeDestroy(Model, id, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#destroy. If this method +returns a promise then DSHttpAdapter#destroy will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#destroy.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#destroy.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#destroy.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeDestroyAll(Model, query, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#destroyAll. If this method +returns a promise then DSHttpAdapter#destroyAll will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#destroyAll.

query + + +Object + + + + +

The query argument passed to DSHttpAdapter#destroyAll.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#destroyAll.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeFind(Model, id, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#find. If this method +returns a promise then DSHttpAdapter#find will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#find.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#find.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#find.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeFindAll(Model, query, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#findAll. If this method +returns a promise then DSHttpAdapter#findAll will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#findAll.

query + + +Object + + + + +

The query argument passed to DSHttpAdapter#findAll.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#findAll.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeGET(url, config, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#GET. If this method +returns a promise then DSHttpAdapter#GET will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#create +will resolve with that same value, then the config argument passed to +DSHttpAdapter#GET will be replaced by the value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +Object + + + + +

The url argument passed to DSHttpAdapter#GET.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#GET.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#GET.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeHTTP(config, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#HTTP. If this method +returns a promise then DSHttpAdapter#HTTP will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#create +will resolve with that same value, then the config argument passed to +DSHttpAdapter#HTTP will be replaced by the value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
config + + +Object + + + + +

The config argument passed to DSHttpAdapter#HTTP.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#HTTP.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforePOST(url, data, config, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#POST. If this method +returns a promise then DSHttpAdapter#POST will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#create +will resolve with that same value, then the config argument passed to +DSHttpAdapter#POST will be replaced by the value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +Object + + + + +

The url argument passed to DSHttpAdapter#POST.

data + + +Object + + + + +

The data argument passed to DSHttpAdapter#POST.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#POST.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#POST.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforePUT(url, data, config, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#PUT. If this method +returns a promise then DSHttpAdapter#PUT will wait for the +promise to resolve before continuing. If this method returns any other +value or the promise resolves with a value, then DSHttpAdapter#create +will resolve with that same value, then the config argument passed to +DSHttpAdapter#PUT will be replaced by the value.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + + +Object + + + + +

The url argument passed to DSHttpAdapter#PUT.

data + + +Object + + + + +

The data argument passed to DSHttpAdapter#PUT.

config + + +Object + + + + +

The config argument passed to DSHttpAdapter#PUT.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#PUT.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeUpdate(Model, id, props, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#update. If this method +returns a promise then DSHttpAdapter#update will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#update.

id + + +string +| + +number + + + + +

The id argument passed to DSHttpAdapter#update.

props + + +Object + + + + +

The props argument passed to DSHttpAdapter#update.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#update.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeUpdateAll(Model, props, query, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#updateAll. If this method +returns a promise then DSHttpAdapter#updateAll will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#updateAll.

props + + +Object + + + + +

The props argument passed to DSHttpAdapter#updateAll.

query + + +Object + + + + +

The query argument passed to DSHttpAdapter#updateAll.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#updateAll.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

beforeUpdateMany(Model, models, opts)

+ + +
+
+ + +
+

Lifecycle hook called by DSHttpAdapter#updateMany. If this method +returns a promise then DSHttpAdapter#updateMany will wait for the +promise to resolve before continuing.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model argument passed to DSHttpAdapter#updateMany.

models + + +Object + + + + +

The models argument passed to DSHttpAdapter#updateMany.

opts + + +Object + + + + +

The opts argument passed to DSHttpAdapter#updateMany.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

create(Model, props, opts)

+ + +
+
+ + +
+

Create a new the entity from the provided props.

+

DSHttpAdapter#beforeCreate will be called before calling +DSHttpAdapter#POST. +DSHttpAdapter#afterCreate will be called after calling +DSHttpAdapter#POST.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

props + + +Object + + + + + + + + + + +

Properties to send as the payload.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

createMany(Model, models, opts)

+ + +
+
+ + +
+

Create multiple new entities in batch.

+

DSHttpAdapter#beforeCreateMany will be called before calling +DSHttpAdapter#POST. +DSHttpAdapter#afterCreateMany will be called after calling +DSHttpAdapter#POST.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

models + + +Array + + + + + + + + + + +

Array of property objects to send as the payload.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

dbg(args)

+ + +
+
+ + +
+

Call DSHttpAdapter#log at the "debug" level.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
args + + +* + + + + + + + <optional>
+ + + + + + <repeatable>
+ +

Args passed to DSHttpAdapter#log.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

DEL(url, config, opts)

+ + +
+
+ + +
+

Make an Http request to url according to the configuration in config.

+

DSHttpAdapter#beforeDEL will be called before calling +DSHttpAdapter#HTTP. +DSHttpAdapter#afterDEL will be called after calling +DSHttpAdapter#HTTP.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
url + + +string + + + + + + + + + + +

Url for the request.

config + + +Object + + + + + + + <optional>
+ + + + + +

Http configuration that will be passed to +DSHttpAdapter#HTTP.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

deserialize(Model, response, opts)

+ + +
+
+ + +
+

Transform the server response object into the payload that will be returned +to JSData.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +Object + + + + +

The Model used for the operation.

response + + +Object + + + + +

Response object from DSHttpAdapter#HTTP.

opts + + +Object + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Deserialized data.

+
+ + + +
+
+ Type +
+
+ +Object +| + +Array + + + +
+
+ + + + + +
+ + + +
+
+

destroy(Model, id, opts)

+ + +
+
+ + +
+

Destroy the entity with the given primary key.

+

DSHttpAdapter#beforeDestroy will be called before calling +DSHttpAdapter#DEL. +DSHttpAdapter#afterDestroy will be called after calling +DSHttpAdapter#DEL.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

id + + +string +| + +number + + + + + + + + + + +

Primary key of the entity to destroy.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

destroyAll(Model, query, opts)

+ + +
+
+ + +
+

Destroy the entities that match the selection query.

+

DSHttpAdapter#beforeDestroyAll will be called before calling +DSHttpAdapter#DEL. +DSHttpAdapter#afterDestroyAll will be called after calling +DSHttpAdapter#DEL.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

query + + +Object + + + + + + + + + + +

Selection query.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

error(args)

+ + +
+
+ + +
+

Log an error.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
args + + +* + + + + + + + <optional>
+ + + + + + <repeatable>
+ +

Arguments to log.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

fetch(config, opts)

+ + +
+
+ + +
+

Make an Http request using window.fetch.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
config + + +Object + + + + + + + + + + +

Request configuration.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + + +Object + + + + +

Payload for the request.

method + + +string + + + + +

Http method for the request.

headers + + +Object + + + + +

Headers for the request.

params + + +Object + + + + +

Querystring for the request.

url + + +string + + + + +

Url for the request.

+ +
opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

find(Model, id, opts)

+ + +
+
+ + +
+

Retrieve the entity with the given primary key.

+

DSHttpAdapter#beforeFind will be called before calling +DSHttpAdapter#GET. +DSHttpAdapter#afterFind will be called after calling +DSHttpAdapter#GET.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

id + + +string +| + +number + + + + + + + + + + +

Primary key of the entity to retrieve.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

findAll(Model, query, opts)

+ + +
+
+ + +
+

Retrieve the entities that match the selection query.

+

DSHttpAdapter#beforeFindAll will be called before calling +DSHttpAdapter#GET. +DSHttpAdapter#afterFindAll will be called after calling +DSHttpAdapter#GET.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

query + + +Object + + + + + + + + + + +

Selection query.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

GET(url, config, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
url + + +string + + + + + + + + + + +

The url for the request.

config + + +Object + + + + + + + + + + +

Request configuration options.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

getEndpoint(Model, id, opts)

+ + +
+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +* + + + + +

{ description }

id + + +* + + + + +

{ description }

opts + + +boolean + + + + +

{ description }

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Full path.

+
+ + + +
+
+ Type +
+
+ +string + + + +
+
+ + + + + +
+ + + +
+
+

getPath(method, Model, id, opts)

+ + +
+
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
method + + +string + + + + + + + + + + +

TODO

Model + + +* + + + + + + + + + + +

TODO

id + + +string +| + +number + + + + + + + + + <nullable>
+ + + +

TODO

opts + + +Object + + + + + + + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

HTTP(config, opts)

+ + +
+
+ + +
+

Make an Http request.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
config + + +Object + + + + + + + + + + +

Request configuration options.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

log(level, args)

+ + +
+
+ + +
+

Log the provided arguments at the specified leve.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
level + + +string + + + + + + + + + + +

Log level.

args + + +* + + + + + + + <optional>
+ + + + + + <repeatable>
+ +

Arguments to log.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + +
+
+

POST(url, data, config, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
url + + +* + + + + + + + + + + +

{ description }

data + + +* + + + + + + + + + + +

{ description }

config + + +* + + + + + + + + + + +

{ description }

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

PUT(url, data, config, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
url + + +* + + + + + + + + + + +

{ description }

data + + +* + + + + + + + + + + +

{ description }

config + + +* + + + + + + + + + + +

{ description }

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

queryTransform(Model, params, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +* + + + + +

{ description }

params + + +* + + + + +

{ description }

opts + + +* + + + + +

{ description }

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Transformed params.

+
+ + + +
+
+ Type +
+
+ +* + + + +
+
+ + + + + +
+ + + +
+
+

responseError(err, config, opts)

+ + +
+
+ + +
+

Error handler invoked when the promise returned by DSHttpAdapter#http +is rejected. Default implementation is to just return the error wrapped in +a rejected Promise, aka rethrow the error. DSHttpAdapter#http is +called by DSHttpAdapter#HTTP.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
err + + +* + + + + +

The error that DSHttpAdapter#http rejected with.

config + + +* + + + + +

The config argument that was passed to DSHttpAdapter#HTTP.

opts + + +* + + + + +

The opts argument that was passed to DSHttpAdapter#HTTP.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

serialize(Model, data, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Model + + +* + + + + +

{ description }

data + + +* + + + + +

{ description }

opts + + +* + + + + +

{ description }

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+

Serialized data.

+
+ + + +
+
+ Type +
+
+ +* + + + +
+
+ + + + + +
+ + + +
+
+

update(Model, id, props, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +* + + + + + + + + + + +

{ description }

id + + +* + + + + + + + + + + +

{ description }

props + + +* + + + + + + + + + + +

{ description }

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

updateAll(Model, props, query, opts)

+ + +
+
+ + +
+

{ function_description }

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +* + + + + + + + + + + +

{ description }

props + + +* + + + + + + + + + + +

{ description }

query + + +* + + + + + + + + + + +

{ description }

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ + + +
+
+

updateMany(Model, models, opts)

+ + +
+
+ + +
+

Update multiple entities in batch.

+

DSHttpAdapter#beforeUpdateMany will be called before calling +DSHttpAdapter#PUT. +DSHttpAdapter#afterUpdateMany will be called after calling +DSHttpAdapter#PUT.

+
+ + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
Model + + +Object + + + + + + + + + + +

The Model.

models + + +Array + + + + + + + + + + +

Array of property objects to send as the payload.

opts + + +Object + + + + + + + <optional>
+ + + + + +

Configuration options.

+
Properties
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
params + + +string + + + + + + + <optional>
+ + + + + +
+ +

TODO

suffix + + +string + + + + + + + <optional>
+ + + + + +
+ + DSHttpAdapter#suffix + +

TODO

+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + + + +
+
+ Type +
+
+ +Promise + + + +
+
+ + + + + +
+ +
+ + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + +
+ +
Back to js-data.io
+ + + + js-data-http Copyright © 2014-2016 Jason Dobry + + + + Documentation generated by JSDoc 3.4.0 + + on 2016-01-27T00:16:20+00:00 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.0.0-alpha.3/classes.list.html b/3.0.0-alpha.3/classes.list.html new file mode 100644 index 0000000..fd2a3c1 --- /dev/null +++ b/3.0.0-alpha.3/classes.list.html @@ -0,0 +1,311 @@ + + + + + + js-data-http Classes + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Classes

+
+ +
+ +

+ +

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

Classes

+ +
+
DSHttpAdapter
+
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + +
+ +
Back to js-data.io
+ + + + js-data-http Copyright © 2014-2016 Jason Dobry + + + + Documentation generated by JSDoc 3.4.0 + + on 2016-01-27T00:16:20+00:00 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.eot b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 Binary files /dev/null and b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.eot differ diff --git a/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.svg b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000..94fb549 --- /dev/null +++ b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.ttf b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000..1413fc6 Binary files /dev/null and b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.ttf differ diff --git a/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.woff b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..9e61285 Binary files /dev/null and b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.woff differ diff --git a/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.woff2 b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000..64539b5 Binary files /dev/null and b/3.0.0-alpha.3/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/3.0.0-alpha.3/img/glyphicons-halflings-white.png b/3.0.0-alpha.3/img/glyphicons-halflings-white.png new file mode 100644 index 0000000..3bf6484 Binary files /dev/null and b/3.0.0-alpha.3/img/glyphicons-halflings-white.png differ diff --git a/3.0.0-alpha.3/img/glyphicons-halflings.png b/3.0.0-alpha.3/img/glyphicons-halflings.png new file mode 100644 index 0000000..a996999 Binary files /dev/null and b/3.0.0-alpha.3/img/glyphicons-halflings.png differ diff --git a/3.0.0-alpha.3/index.html b/3.0.0-alpha.3/index.html new file mode 100644 index 0000000..27ef9b3 --- /dev/null +++ b/3.0.0-alpha.3/index.html @@ -0,0 +1,388 @@ + + + + + + js-data-http Index + + + + + + + + + + + + + +
+
+ + +
+ +
+ + + + + + + +

js-data-http 3.0.0-alpha.3

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

js-data logo

+

js-data-http

Slack Status +npm version +Circle CI +npm downloads +Coverage Status +Codacy

+

This repo contains HTTP adapters for js-data:

+
    +
  • js-data-http - HTTP (XHR, includes 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 +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.
  • +
+

Tested on IE9, Chrome 46, Firefox 41 & Safari 7.1 using +bs logo

+

Table of contents

+

Quick Start

Browser

bower install --save js-data js-data-http or npm install --save js-data js-data-http.

+

ES6

+
const adapter = new DSHttpAdapter()
+
+class Base extends JSData.Model {}
+Base.registerAdapter('http', adapter, { default: true })
+
+class School extends Model {}
+class Student extends Model {}
+
+// "School" and "Student" will now use the http adapter by default

ES5

+
var adapter = new DSHttpAdapter()
+
+var Base = JSData.Model.extend({}, { name: 'Base' })
+Base.registerAdapter('http', adapter, { default: true })
+
+var School = Base.extend({}, { name: 'School' })
+var Student = Base.extend({}, { name: 'Student' })
+
+// "School" and "Student" will now use the http adapter by default

Node.js

npm install --save axios js-data js-data-http-node

+

ES6

+
import {Model} from 'js-data'
+import DSHttpAdapter from 'js-data-http-node'
+
+const adapter = new DSHttpAdapter()
+
+class Base extends Model {}
+Base.registerAdapter('http', adapter, { default: true })
+
+class School extends Model {}
+class Student extends Model {}
+
+// "School" and "Student" will now use the http adapter by default

ES5

+
var JSData = require('js-data')
+var Model = JSData.Model
+var DSHttpAdapter = require('js-data-http-node')
+
+var adapter = new DSHttpAdapter()
+
+var Base = Model.extend({}, { name: 'Base' })
+Base.registerAdapter('http', adapter, { default: true })
+
+var School = Base.extend({}, { name: 'School' })
+var Student = Base.extend({}, { name: 'Student' })
+
+// "School" and "Student" will now use the http adapter by default

Dependencies

js-data-http bundles axios and depends on js-data. js-data-fetch depends +on js-data. js-data-http-node depends on js-data and optionally axios.

+

See JSData's dependencies.

+

Documentation

+

API Reference

+

Support

Support questions are handled via Stack Overflow, Slack, and the +Mailing List. Ask your questions there.

+

Community

+

Contributing

First, support is handled via the Slack Channel and the +Mailing List. Ask your questions there.

+

When submitting issues on GitHub, please include as much detail as possible to +make debugging quick and easy.

+
    +
  • good - Your versions of js-data, js-data-http, etc., relevant console logs/error, +code examples that revealed the issue
  • +
  • better - A plnkr, fiddle, or +bin that demonstrates the issue
  • +
  • best - A Pull Request that fixes the issue, including test coverage for the +issue and the fix
  • +
+

Pull Requests

    +
  1. Contribute to the issue/discussion that is the reason you'll be developing in +the first place
  2. +
  3. Fork js-data-http
  4. +
  5. git clone git@github.com:<you>/js-data-http.git
  6. +
  7. cd js-data-http; npm install;
  8. +
  9. Write your code, including relevant documentation and tests
  10. +
  11. Run npm test (build and test)
  12. +
  13. Your code will be linted and checked for formatting, the tests will be run
  14. +
  15. The dist/ folder & files will be generated, do NOT commit dist/*! They +will be committed when a release is cut.
  16. +
  17. Submit your PR and we'll review!
  18. +
  19. Thanks!
  20. +
+

License

The MIT License (MIT)

+

Copyright (c) 2014-2016 Jason Dobry

+

Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions:

+

The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software.

+

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.

+
+ + + + + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + +
+ +
Back to js-data.io
+ + + + js-data-http Copyright © 2014-2016 Jason Dobry + + + + Documentation generated by JSDoc 3.4.0 + + on 2016-01-27T00:16:20+00:00 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.0.0-alpha.3/module-js-data-http.html b/3.0.0-alpha.3/module-js-data-http.html new file mode 100644 index 0000000..3c360dd --- /dev/null +++ b/3.0.0-alpha.3/module-js-data-http.html @@ -0,0 +1,319 @@ + + + + + + js-data-http Module: js-data-http + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Module: js-data-http

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

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:

+
window.DSHttpAdapter

CommonJS:

+
var DSHttpAdapter = require('js-data-http')

ES6 Modules:

+
import DSHttpAdapter from 'js-data-http'

AMD:

+
define('myApp', ['js-data-http'], function (DSHttpAdapter) { ... })
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ +
+ + + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + +
+ +
Back to js-data.io
+ + + + js-data-http Copyright © 2014-2016 Jason Dobry + + + + Documentation generated by JSDoc 3.4.0 + + on 2016-01-27T00:16:20+00:00 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.0.0-alpha.3/modules.list.html b/3.0.0-alpha.3/modules.list.html new file mode 100644 index 0000000..13f15d2 --- /dev/null +++ b/3.0.0-alpha.3/modules.list.html @@ -0,0 +1,311 @@ + + + + + + js-data-http Modules + + + + + + + + + + + + + +
+
+ + +
+ +
+ + +

Modules

+
+ +
+ +

+ +

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

Classes

+ +
+
DSHttpAdapter
+
+
+ + + + + + + + + + + + + +
+ +
+ + + + +
+
+ +
+ + +
+ +
+ + +
+
+ + + +
+ +
Back to js-data.io
+ + + + js-data-http Copyright © 2014-2016 Jason Dobry + + + + Documentation generated by JSDoc 3.4.0 + + on 2016-01-27T00:16:20+00:00 + + using the DocStrap template. + +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3.0.0-alpha.3/quicksearch.html b/3.0.0-alpha.3/quicksearch.html new file mode 100644 index 0000000..b436de9 --- /dev/null +++ b/3.0.0-alpha.3/quicksearch.html @@ -0,0 +1,31 @@ + + + + + + + + + + + + + diff --git a/3.0.0-alpha.3/scripts/docstrap.lib.js b/3.0.0-alpha.3/scripts/docstrap.lib.js new file mode 100644 index 0000000..1a5a9db --- /dev/null +++ b/3.0.0-alpha.3/scripts/docstrap.lib.js @@ -0,0 +1,11 @@ +if(!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){function c(a){var b="length"in a&&a.length,c=_.type(a);return"function"===c||_.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}function d(a,b,c){if(_.isFunction(b))return _.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return _.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(ha.test(b))return _.filter(b,a,c);b=_.filter(b,a)}return _.grep(a,function(a){return U.call(b,a)>=0!==c})}function e(a,b){for(;(a=a[b])&&1!==a.nodeType;);return a}function f(a){var b=oa[a]={};return _.each(a.match(na)||[],function(a,c){b[c]=!0}),b}function g(){Z.removeEventListener("DOMContentLoaded",g,!1),a.removeEventListener("load",g,!1),_.ready()}function h(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=_.expando+h.uid++}function i(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(ua,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:ta.test(c)?_.parseJSON(c):c}catch(e){}sa.set(a,b,c)}else c=void 0;return c}function j(){return!0}function k(){return!1}function l(){try{return Z.activeElement}catch(a){}}function m(a,b){return _.nodeName(a,"table")&&_.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function n(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function o(a){var b=Ka.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function p(a,b){for(var c=0,d=a.length;d>c;c++)ra.set(a[c],"globalEval",!b||ra.get(b[c],"globalEval"))}function q(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(ra.hasData(a)&&(f=ra.access(a),g=ra.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)_.event.add(b,e,j[e][c])}sa.hasData(a)&&(h=sa.access(a),i=_.extend({},h),sa.set(b,i))}}function r(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&_.nodeName(a,b)?_.merge([a],c):c}function s(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ya.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}function t(b,c){var d,e=_(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:_.css(e[0],"display");return e.detach(),f}function u(a){var b=Z,c=Oa[a];return c||(c=t(a,b),"none"!==c&&c||(Na=(Na||_("