mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2025-01-10 22:49:29 -07:00
782 lines
No EOL
62 KiB
JavaScript
782 lines
No EOL
62 KiB
JavaScript
"use strict";
|
|
|
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
|
|
/**
|
|
* Module of mixed-in functions shared between node and client code
|
|
*/
|
|
var isObject = require('./is-object');
|
|
/**
|
|
* Expose `RequestBase`.
|
|
*/
|
|
|
|
|
|
module.exports = RequestBase;
|
|
/**
|
|
* Initialize a new `RequestBase`.
|
|
*
|
|
* @api public
|
|
*/
|
|
|
|
function RequestBase(object) {
|
|
if (object) return mixin(object);
|
|
}
|
|
/**
|
|
* Mixin the prototype properties.
|
|
*
|
|
* @param {Object} obj
|
|
* @return {Object}
|
|
* @api private
|
|
*/
|
|
|
|
|
|
function mixin(object) {
|
|
for (var key in RequestBase.prototype) {
|
|
if (Object.prototype.hasOwnProperty.call(RequestBase.prototype, key)) object[key] = RequestBase.prototype[key];
|
|
}
|
|
|
|
return object;
|
|
}
|
|
/**
|
|
* Clear previous timeout.
|
|
*
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.clearTimeout = function () {
|
|
clearTimeout(this._timer);
|
|
clearTimeout(this._responseTimeoutTimer);
|
|
clearTimeout(this._uploadTimeoutTimer);
|
|
delete this._timer;
|
|
delete this._responseTimeoutTimer;
|
|
delete this._uploadTimeoutTimer;
|
|
return this;
|
|
};
|
|
/**
|
|
* Override default response body parser
|
|
*
|
|
* This function will be called to convert incoming data into request.body
|
|
*
|
|
* @param {Function}
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.parse = function (fn) {
|
|
this._parser = fn;
|
|
return this;
|
|
};
|
|
/**
|
|
* Set format of binary response body.
|
|
* In browser valid formats are 'blob' and 'arraybuffer',
|
|
* which return Blob and ArrayBuffer, respectively.
|
|
*
|
|
* In Node all values result in Buffer.
|
|
*
|
|
* Examples:
|
|
*
|
|
* req.get('/')
|
|
* .responseType('blob')
|
|
* .end(callback);
|
|
*
|
|
* @param {String} val
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.responseType = function (value) {
|
|
this._responseType = value;
|
|
return this;
|
|
};
|
|
/**
|
|
* Override default request body serializer
|
|
*
|
|
* This function will be called to convert data set via .send or .attach into payload to send
|
|
*
|
|
* @param {Function}
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.serialize = function (fn) {
|
|
this._serializer = fn;
|
|
return this;
|
|
};
|
|
/**
|
|
* Set timeouts.
|
|
*
|
|
* - response timeout is time between sending request and receiving the first byte of the response. Includes DNS and connection time.
|
|
* - deadline is the time from start of the request to receiving response body in full. If the deadline is too short large files may not load at all on slow connections.
|
|
* - upload is the time since last bit of data was sent or received. This timeout works only if deadline timeout is off
|
|
*
|
|
* Value of 0 or false means no timeout.
|
|
*
|
|
* @param {Number|Object} ms or {response, deadline}
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.timeout = function (options) {
|
|
if (!options || _typeof(options) !== 'object') {
|
|
this._timeout = options;
|
|
this._responseTimeout = 0;
|
|
this._uploadTimeout = 0;
|
|
return this;
|
|
}
|
|
|
|
for (var option in options) {
|
|
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
|
switch (option) {
|
|
case 'deadline':
|
|
this._timeout = options.deadline;
|
|
break;
|
|
|
|
case 'response':
|
|
this._responseTimeout = options.response;
|
|
break;
|
|
|
|
case 'upload':
|
|
this._uploadTimeout = options.upload;
|
|
break;
|
|
|
|
default:
|
|
console.warn('Unknown timeout option', option);
|
|
}
|
|
}
|
|
}
|
|
|
|
return this;
|
|
};
|
|
/**
|
|
* Set number of retry attempts on error.
|
|
*
|
|
* Failed requests will be retried 'count' times if timeout or err.code >= 500.
|
|
*
|
|
* @param {Number} count
|
|
* @param {Function} [fn]
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.retry = function (count, fn) {
|
|
// Default to 1 if no count passed or true
|
|
if (arguments.length === 0 || count === true) count = 1;
|
|
if (count <= 0) count = 0;
|
|
this._maxRetries = count;
|
|
this._retries = 0;
|
|
this._retryCallback = fn;
|
|
return this;
|
|
}; //
|
|
// NOTE: we do not include ESOCKETTIMEDOUT because that is from `request` package
|
|
// <https://github.com/sindresorhus/got/pull/537>
|
|
//
|
|
// NOTE: we do not include EADDRINFO because it was removed from libuv in 2014
|
|
// <https://github.com/libuv/libuv/commit/02e1ebd40b807be5af46343ea873331b2ee4e9c1>
|
|
// <https://github.com/request/request/search?q=ESOCKETTIMEDOUT&unscoped_q=ESOCKETTIMEDOUT>
|
|
//
|
|
//
|
|
// TODO: expose these as configurable defaults
|
|
//
|
|
|
|
|
|
var ERROR_CODES = new Set(['ETIMEDOUT', 'ECONNRESET', 'EADDRINUSE', 'ECONNREFUSED', 'EPIPE', 'ENOTFOUND', 'ENETUNREACH', 'EAI_AGAIN']);
|
|
var STATUS_CODES = new Set([408, 413, 429, 500, 502, 503, 504, 521, 522, 524]); // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST)
|
|
// const METHODS = new Set(['GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE']);
|
|
|
|
/**
|
|
* Determine if a request should be retried.
|
|
* (Inspired by https://github.com/sindresorhus/got#retry)
|
|
*
|
|
* @param {Error} err an error
|
|
* @param {Response} [res] response
|
|
* @returns {Boolean} if segment should be retried
|
|
*/
|
|
|
|
RequestBase.prototype._shouldRetry = function (err, res) {
|
|
if (!this._maxRetries || this._retries++ >= this._maxRetries) {
|
|
return false;
|
|
}
|
|
|
|
if (this._retryCallback) {
|
|
try {
|
|
var override = this._retryCallback(err, res);
|
|
|
|
if (override === true) return true;
|
|
if (override === false) return false; // undefined falls back to defaults
|
|
} catch (err_) {
|
|
console.error(err_);
|
|
}
|
|
} // TODO: we would need to make this easily configurable before adding it in (e.g. some might want to add POST)
|
|
|
|
/*
|
|
if (
|
|
this.req &&
|
|
this.req.method &&
|
|
!METHODS.has(this.req.method.toUpperCase())
|
|
)
|
|
return false;
|
|
*/
|
|
|
|
|
|
if (res && res.status && STATUS_CODES.has(res.status)) return true;
|
|
|
|
if (err) {
|
|
if (err.code && ERROR_CODES.has(err.code)) return true; // Superagent timeout
|
|
|
|
if (err.timeout && err.code === 'ECONNABORTED') return true;
|
|
if (err.crossDomain) return true;
|
|
}
|
|
|
|
return false;
|
|
};
|
|
/**
|
|
* Retry request
|
|
*
|
|
* @return {Request} for chaining
|
|
* @api private
|
|
*/
|
|
|
|
|
|
RequestBase.prototype._retry = function () {
|
|
this.clearTimeout(); // node
|
|
|
|
if (this.req) {
|
|
this.req = null;
|
|
this.req = this.request();
|
|
}
|
|
|
|
this._aborted = false;
|
|
this.timedout = false;
|
|
this.timedoutError = null;
|
|
return this._end();
|
|
};
|
|
/**
|
|
* Promise support
|
|
*
|
|
* @param {Function} resolve
|
|
* @param {Function} [reject]
|
|
* @return {Request}
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.then = function (resolve, reject) {
|
|
var _this = this;
|
|
|
|
if (!this._fullfilledPromise) {
|
|
var self = this;
|
|
|
|
if (this._endCalled) {
|
|
console.warn('Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises');
|
|
}
|
|
|
|
this._fullfilledPromise = new Promise(function (resolve, reject) {
|
|
self.on('abort', function () {
|
|
if (_this._maxRetries && _this._maxRetries > _this._retries) {
|
|
return;
|
|
}
|
|
|
|
if (_this.timedout && _this.timedoutError) {
|
|
reject(_this.timedoutError);
|
|
return;
|
|
}
|
|
|
|
var err = new Error('Aborted');
|
|
err.code = 'ABORTED';
|
|
err.status = _this.status;
|
|
err.method = _this.method;
|
|
err.url = _this.url;
|
|
reject(err);
|
|
});
|
|
self.end(function (err, res) {
|
|
if (err) reject(err);else resolve(res);
|
|
});
|
|
});
|
|
}
|
|
|
|
return this._fullfilledPromise.then(resolve, reject);
|
|
};
|
|
|
|
RequestBase.prototype.catch = function (cb) {
|
|
return this.then(undefined, cb);
|
|
};
|
|
/**
|
|
* Allow for extension
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.use = function (fn) {
|
|
fn(this);
|
|
return this;
|
|
};
|
|
|
|
RequestBase.prototype.ok = function (cb) {
|
|
if (typeof cb !== 'function') throw new Error('Callback required');
|
|
this._okCallback = cb;
|
|
return this;
|
|
};
|
|
|
|
RequestBase.prototype._isResponseOK = function (res) {
|
|
if (!res) {
|
|
return false;
|
|
}
|
|
|
|
if (this._okCallback) {
|
|
return this._okCallback(res);
|
|
}
|
|
|
|
return res.status >= 200 && res.status < 300;
|
|
};
|
|
/**
|
|
* Get request header `field`.
|
|
* Case-insensitive.
|
|
*
|
|
* @param {String} field
|
|
* @return {String}
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.get = function (field) {
|
|
return this._header[field.toLowerCase()];
|
|
};
|
|
/**
|
|
* Get case-insensitive header `field` value.
|
|
* This is a deprecated internal API. Use `.get(field)` instead.
|
|
*
|
|
* (getHeader is no longer used internally by the superagent code base)
|
|
*
|
|
* @param {String} field
|
|
* @return {String}
|
|
* @api private
|
|
* @deprecated
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.getHeader = RequestBase.prototype.get;
|
|
/**
|
|
* Set header `field` to `val`, or multiple fields with one object.
|
|
* Case-insensitive.
|
|
*
|
|
* Examples:
|
|
*
|
|
* req.get('/')
|
|
* .set('Accept', 'application/json')
|
|
* .set('X-API-Key', 'foobar')
|
|
* .end(callback);
|
|
*
|
|
* req.get('/')
|
|
* .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })
|
|
* .end(callback);
|
|
*
|
|
* @param {String|Object} field
|
|
* @param {String} val
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
RequestBase.prototype.set = function (field, value) {
|
|
if (isObject(field)) {
|
|
for (var key in field) {
|
|
if (Object.prototype.hasOwnProperty.call(field, key)) this.set(key, field[key]);
|
|
}
|
|
|
|
return this;
|
|
}
|
|
|
|
this._header[field.toLowerCase()] = value;
|
|
this.header[field] = value;
|
|
return this;
|
|
};
|
|
/**
|
|
* Remove header `field`.
|
|
* Case-insensitive.
|
|
*
|
|
* Example:
|
|
*
|
|
* req.get('/')
|
|
* .unset('User-Agent')
|
|
* .end(callback);
|
|
*
|
|
* @param {String} field field name
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.unset = function (field) {
|
|
delete this._header[field.toLowerCase()];
|
|
delete this.header[field];
|
|
return this;
|
|
};
|
|
/**
|
|
* Write the field `name` and `val`, or multiple fields with one object
|
|
* for "multipart/form-data" request bodies.
|
|
*
|
|
* ``` js
|
|
* request.post('/upload')
|
|
* .field('foo', 'bar')
|
|
* .end(callback);
|
|
*
|
|
* request.post('/upload')
|
|
* .field({ foo: 'bar', baz: 'qux' })
|
|
* .end(callback);
|
|
* ```
|
|
*
|
|
* @param {String|Object} name name of field
|
|
* @param {String|Blob|File|Buffer|fs.ReadStream} val value of field
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.field = function (name, value) {
|
|
// name should be either a string or an object.
|
|
if (name === null || undefined === name) {
|
|
throw new Error('.field(name, val) name can not be empty');
|
|
}
|
|
|
|
if (this._data) {
|
|
throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");
|
|
}
|
|
|
|
if (isObject(name)) {
|
|
for (var key in name) {
|
|
if (Object.prototype.hasOwnProperty.call(name, key)) this.field(key, name[key]);
|
|
}
|
|
|
|
return this;
|
|
}
|
|
|
|
if (Array.isArray(value)) {
|
|
for (var i in value) {
|
|
if (Object.prototype.hasOwnProperty.call(value, i)) this.field(name, value[i]);
|
|
}
|
|
|
|
return this;
|
|
} // val should be defined now
|
|
|
|
|
|
if (value === null || undefined === value) {
|
|
throw new Error('.field(name, val) val can not be empty');
|
|
}
|
|
|
|
if (typeof value === 'boolean') {
|
|
value = String(value);
|
|
}
|
|
|
|
this._getFormData().append(name, value);
|
|
|
|
return this;
|
|
};
|
|
/**
|
|
* Abort the request, and clear potential timeout.
|
|
*
|
|
* @return {Request} request
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.abort = function () {
|
|
if (this._aborted) {
|
|
return this;
|
|
}
|
|
|
|
this._aborted = true;
|
|
if (this.xhr) this.xhr.abort(); // browser
|
|
|
|
if (this.req) this.req.abort(); // node
|
|
|
|
this.clearTimeout();
|
|
this.emit('abort');
|
|
return this;
|
|
};
|
|
|
|
RequestBase.prototype._auth = function (user, pass, options, base64Encoder) {
|
|
switch (options.type) {
|
|
case 'basic':
|
|
this.set('Authorization', "Basic ".concat(base64Encoder("".concat(user, ":").concat(pass))));
|
|
break;
|
|
|
|
case 'auto':
|
|
this.username = user;
|
|
this.password = pass;
|
|
break;
|
|
|
|
case 'bearer':
|
|
// usage would be .auth(accessToken, { type: 'bearer' })
|
|
this.set('Authorization', "Bearer ".concat(user));
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return this;
|
|
};
|
|
/**
|
|
* Enable transmission of cookies with x-domain requests.
|
|
*
|
|
* Note that for this to work the origin must not be
|
|
* using "Access-Control-Allow-Origin" with a wildcard,
|
|
* and also must set "Access-Control-Allow-Credentials"
|
|
* to "true".
|
|
*
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.withCredentials = function (on) {
|
|
// This is browser-only functionality. Node side is no-op.
|
|
if (on === undefined) on = true;
|
|
this._withCredentials = on;
|
|
return this;
|
|
};
|
|
/**
|
|
* Set the max redirects to `n`. Does nothing in browser XHR implementation.
|
|
*
|
|
* @param {Number} n
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.redirects = function (n) {
|
|
this._maxRedirects = n;
|
|
return this;
|
|
};
|
|
/**
|
|
* Maximum size of buffered response body, in bytes. Counts uncompressed size.
|
|
* Default 200MB.
|
|
*
|
|
* @param {Number} n number of bytes
|
|
* @return {Request} for chaining
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.maxResponseSize = function (n) {
|
|
if (typeof n !== 'number') {
|
|
throw new TypeError('Invalid argument');
|
|
}
|
|
|
|
this._maxResponseSize = n;
|
|
return this;
|
|
};
|
|
/**
|
|
* Convert to a plain javascript object (not JSON string) of scalar properties.
|
|
* Note as this method is designed to return a useful non-this value,
|
|
* it cannot be chained.
|
|
*
|
|
* @return {Object} describing method, url, and data of this request
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.toJSON = function () {
|
|
return {
|
|
method: this.method,
|
|
url: this.url,
|
|
data: this._data,
|
|
headers: this._header
|
|
};
|
|
};
|
|
/**
|
|
* Send `data` as the request body, defaulting the `.type()` to "json" when
|
|
* an object is given.
|
|
*
|
|
* Examples:
|
|
*
|
|
* // manual json
|
|
* request.post('/user')
|
|
* .type('json')
|
|
* .send('{"name":"tj"}')
|
|
* .end(callback)
|
|
*
|
|
* // auto json
|
|
* request.post('/user')
|
|
* .send({ name: 'tj' })
|
|
* .end(callback)
|
|
*
|
|
* // manual x-www-form-urlencoded
|
|
* request.post('/user')
|
|
* .type('form')
|
|
* .send('name=tj')
|
|
* .end(callback)
|
|
*
|
|
* // auto x-www-form-urlencoded
|
|
* request.post('/user')
|
|
* .type('form')
|
|
* .send({ name: 'tj' })
|
|
* .end(callback)
|
|
*
|
|
* // defaults to x-www-form-urlencoded
|
|
* request.post('/user')
|
|
* .send('name=tobi')
|
|
* .send('species=ferret')
|
|
* .end(callback)
|
|
*
|
|
* @param {String|Object} data
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
// eslint-disable-next-line complexity
|
|
|
|
|
|
RequestBase.prototype.send = function (data) {
|
|
var isObject_ = isObject(data);
|
|
var type = this._header['content-type'];
|
|
|
|
if (this._formData) {
|
|
throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");
|
|
}
|
|
|
|
if (isObject_ && !this._data) {
|
|
if (Array.isArray(data)) {
|
|
this._data = [];
|
|
} else if (!this._isHost(data)) {
|
|
this._data = {};
|
|
}
|
|
} else if (data && this._data && this._isHost(this._data)) {
|
|
throw new Error("Can't merge these send calls");
|
|
} // merge
|
|
|
|
|
|
if (isObject_ && isObject(this._data)) {
|
|
for (var key in data) {
|
|
if (Object.prototype.hasOwnProperty.call(data, key)) this._data[key] = data[key];
|
|
}
|
|
} else if (typeof data === 'string') {
|
|
// default to x-www-form-urlencoded
|
|
if (!type) this.type('form');
|
|
type = this._header['content-type'];
|
|
if (type) type = type.toLowerCase().trim();
|
|
|
|
if (type === 'application/x-www-form-urlencoded') {
|
|
this._data = this._data ? "".concat(this._data, "&").concat(data) : data;
|
|
} else {
|
|
this._data = (this._data || '') + data;
|
|
}
|
|
} else {
|
|
this._data = data;
|
|
}
|
|
|
|
if (!isObject_ || this._isHost(data)) {
|
|
return this;
|
|
} // default to json
|
|
|
|
|
|
if (!type) this.type('json');
|
|
return this;
|
|
};
|
|
/**
|
|
* Sort `querystring` by the sort function
|
|
*
|
|
*
|
|
* Examples:
|
|
*
|
|
* // default order
|
|
* request.get('/user')
|
|
* .query('name=Nick')
|
|
* .query('search=Manny')
|
|
* .sortQuery()
|
|
* .end(callback)
|
|
*
|
|
* // customized sort function
|
|
* request.get('/user')
|
|
* .query('name=Nick')
|
|
* .query('search=Manny')
|
|
* .sortQuery(function(a, b){
|
|
* return a.length - b.length;
|
|
* })
|
|
* .end(callback)
|
|
*
|
|
*
|
|
* @param {Function} sort
|
|
* @return {Request} for chaining
|
|
* @api public
|
|
*/
|
|
|
|
|
|
RequestBase.prototype.sortQuery = function (sort) {
|
|
// _sort default to true but otherwise can be a function or boolean
|
|
this._sort = typeof sort === 'undefined' ? true : sort;
|
|
return this;
|
|
};
|
|
/**
|
|
* Compose querystring to append to req.url
|
|
*
|
|
* @api private
|
|
*/
|
|
|
|
|
|
RequestBase.prototype._finalizeQueryString = function () {
|
|
var query = this._query.join('&');
|
|
|
|
if (query) {
|
|
this.url += (this.url.includes('?') ? '&' : '?') + query;
|
|
}
|
|
|
|
this._query.length = 0; // Makes the call idempotent
|
|
|
|
if (this._sort) {
|
|
var index = this.url.indexOf('?');
|
|
|
|
if (index >= 0) {
|
|
var queryArray = this.url.slice(index + 1).split('&');
|
|
|
|
if (typeof this._sort === 'function') {
|
|
queryArray.sort(this._sort);
|
|
} else {
|
|
queryArray.sort();
|
|
}
|
|
|
|
this.url = this.url.slice(0, index) + '?' + queryArray.join('&');
|
|
}
|
|
}
|
|
}; // For backwards compat only
|
|
|
|
|
|
RequestBase.prototype._appendQueryString = function () {
|
|
console.warn('Unsupported');
|
|
};
|
|
/**
|
|
* Invoke callback with timeout error.
|
|
*
|
|
* @api private
|
|
*/
|
|
|
|
|
|
RequestBase.prototype._timeoutError = function (reason, timeout, errno) {
|
|
if (this._aborted) {
|
|
return;
|
|
}
|
|
|
|
var err = new Error("".concat(reason + timeout, "ms exceeded"));
|
|
err.timeout = timeout;
|
|
err.code = 'ECONNABORTED';
|
|
err.errno = errno;
|
|
this.timedout = true;
|
|
this.timedoutError = err;
|
|
this.abort();
|
|
this.callback(err);
|
|
};
|
|
|
|
RequestBase.prototype._setTimeouts = function () {
|
|
var self = this; // deadline
|
|
|
|
if (this._timeout && !this._timer) {
|
|
this._timer = setTimeout(function () {
|
|
self._timeoutError('Timeout of ', self._timeout, 'ETIME');
|
|
}, this._timeout);
|
|
} // response timeout
|
|
|
|
|
|
if (this._responseTimeout && !this._responseTimeoutTimer) {
|
|
this._responseTimeoutTimer = setTimeout(function () {
|
|
self._timeoutError('Response timeout of ', self._responseTimeout, 'ETIMEDOUT');
|
|
}, this._responseTimeout);
|
|
}
|
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