UNPKG

devextreme

Version:

HTML5 JavaScript Component Suite for Responsive Web Development

123 lines (117 loc) 3.89 kB
/** * DevExtreme (cjs/data/odata/request_dispatcher.js) * Version: 22.1.9 * Build date: Tue Apr 18 2023 * * Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ "use strict"; exports.default = void 0; var _utils = require("./utils"); require("./query_adapter"); function _typeof(obj) { return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { return typeof obj } : function(obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj }, _typeof(obj) } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) { descriptor.writable = true } Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor) } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) { _defineProperties(Constructor.prototype, protoProps) } if (staticProps) { _defineProperties(Constructor, staticProps) } Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor } function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return "symbol" === _typeof(key) ? key : String(key) } function _toPrimitive(input, hint) { if ("object" !== _typeof(input) || null === input) { return input } var prim = input[Symbol.toPrimitive]; if (void 0 !== prim) { var res = prim.call(input, hint || "default"); if ("object" !== _typeof(res)) { return res } throw new TypeError("@@toPrimitive must return a primitive value.") } return ("string" === hint ? String : Number)(input) } var DEFAULT_PROTOCOL_VERSION = 2; var RequestDispatcher = function() { function RequestDispatcher(options) { options = options || {}; this._url = String(options.url).replace(/\/+$/, ""); this._beforeSend = options.beforeSend; this._jsonp = options.jsonp; this._version = options.version || DEFAULT_PROTOCOL_VERSION; this._withCredentials = options.withCredentials; this._deserializeDates = options.deserializeDates; this._filterToLower = options.filterToLower } var _proto = RequestDispatcher.prototype; _proto.sendRequest = function(url, method, params, payload) { return (0, _utils.sendRequest)(this.version, { url: url, method: method, params: params || {}, payload: payload }, { beforeSend: this._beforeSend, jsonp: this._jsonp, withCredentials: this._withCredentials, deserializeDates: this._deserializeDates }) }; _createClass(RequestDispatcher, [{ key: "version", get: function() { return this._version } }, { key: "beforeSend", get: function() { return this._beforeSend } }, { key: "url", get: function() { return this._url } }, { key: "jsonp", get: function() { return this._jsonp } }, { key: "filterToLower", get: function() { return this._filterToLower } }]); return RequestDispatcher }(); exports.default = RequestDispatcher; module.exports = exports.default; module.exports.default = exports.default;