@http-ext/core
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -75,6 +75,7 @@ (function (global, factory) { | ||
function __awaiter(thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
@@ -117,5 +118,5 @@ }); | ||
function __values(o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
if (o && typeof o.length === "number") return { | ||
next: function () { | ||
@@ -126,2 +127,3 @@ if (o && i >= o.length) o = void 0; | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
} | ||
@@ -207,2 +209,17 @@ | ||
function __classPrivateFieldGet(receiver, privateMap) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to get private field on non-instance"); | ||
} | ||
return privateMap.get(receiver); | ||
} | ||
function __classPrivateFieldSet(receiver, privateMap, value) { | ||
if (!privateMap.has(receiver)) { | ||
throw new TypeError("attempted to set private field on non-instance"); | ||
} | ||
privateMap.set(receiver, value); | ||
return value; | ||
} | ||
function findMatcherOrThrow(_a) { | ||
@@ -382,4 +399,3 @@ var matchExpression = _a.matchExpression, matcherList = _a.matcherList, errorFactory = _a.errorFactory; | ||
function isPromise(value) { | ||
/* @todo Use optional chaining when available */ | ||
return value && typeof value.then === 'function'; | ||
return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; | ||
} | ||
@@ -397,2 +413,5 @@ | ||
function invalidHandleRequestConditionError() { | ||
return new Error('"shouldHandleRequest" should be a function.'); | ||
} | ||
var HttpExt = /** @class */ (function () { | ||
@@ -445,6 +464,10 @@ function HttpExt(_a) { | ||
var request = _a.request, plugin = _a.plugin; | ||
if (!isFunction(plugin.condition)) { | ||
var shouldHandleRequest = plugin.shouldHandleRequest || plugin.condition; | ||
if (shouldHandleRequest != null && !isFunction(shouldHandleRequest)) { | ||
throw invalidHandleRequestConditionError(); | ||
} | ||
if (shouldHandleRequest == null) { | ||
return rxjs.of(true); | ||
} | ||
return fromSyncOrAsync(plugin.condition({ request: request })); | ||
return fromSyncOrAsync(shouldHandleRequest({ request: request })); | ||
}; | ||
@@ -451,0 +474,0 @@ return HttpExt; |
@@ -15,3 +15,3 @@ !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@http-ext/core",["exports","rxjs","rxjs/operators"],r):r(((n=n||self)["http-ext"]=n["http-ext"]||{},n["http-ext"].core={}),n.rxjs,n.rxjs.operators)}(this,(function(n,r,e){"use strict"; | ||
and limitations under the License. | ||
***************************************************************************** */function t(n,r){var e="function"==typeof Symbol&&n[Symbol.iterator];if(!e)return n;var t,o,u=e.call(n),i=[];try{for(;(void 0===r||r-- >0)&&!(t=u.next()).done;)i.push(t.value)}catch(n){o={error:n}}finally{try{t&&!t.done&&(e=u.return)&&e.call(u)}finally{if(o)throw o.error}}return i}function o(n){var r=n.matchExpression,e=n.matcherList,t=n.errorFactory,o=e.find((function(n){return n.canHandle(r)}));if(null==o)throw t(r);return o}function u(n){return new Error("InvalidUrlError: "+n+" is not a valid URL.")}function i(n){return new Error("InvalidOriginMatchExpression: "+JSON.stringify(n)+" is an invalid origin match expression.")}var a=function(n){return Array.isArray(n)};function s(n){return function(r){return typeof r===n}}var c=function(n){return s("string")(n)},l={canHandle:function(n){return c(n)},handle:function(n){return n.value===n.matchExpression}},f={canHandle:function(n){return a(n)},handle:function(n){var r=n.value;return n.matchExpression.some((function(n){return o({matchExpression:n,matcherList:[l],errorFactory:i}).handle({value:r,matchExpression:n})}))}},h=function(n){return s("function")(n)},p={canHandle:function(n){return h(n)},handle:function(n){var r=n.value;return(0,n.matchExpression)(r)}},d={canHandle:function(n){return n instanceof RegExp},handle:function(n){var r=n.value;return n.matchExpression.test(r)}};function v(n){return new Error("InvalidMethodMatchExpression: "+JSON.stringify(n)+" is an invalid method match expression.")}var x={canHandle:function(n){return a(n)},handle:function(n){var r=n.value;return n.matchExpression.includes(r)}},m={canHandle:function(n){return c(n)},handle:function(n){return n.value===n.matchExpression}};var y=function(n){return r.iif((function(){return r=n,s("boolean")(r);var r}),r.of(n),r.throwError("InvalidPluginConditionError: expect boolean got "+typeof n+"."))};function E(n){return r.isObservable(n)?n:function(n){return n&&"function"==typeof n.then}(n)?r.from(n):r.of(n)}var g=function(){function n(n){var r=n.plugins;this._plugins=r}return n.prototype.handle=function(n){var r=n.request,e=n.httpHandler;return this._handle({request:r,plugins:this._plugins,httpHandler:e})},n.prototype._handle=function(n){var r=this,o=n.request,u=n.plugins,i=n.httpHandler;if(0===u.length)return i({request:o});var a=t(u,1)[0],s=a.handler,c=function(n){return E(r._handle({request:n.request,plugins:u.slice(1),httpHandler:i}))};return this._shouldHandle({request:o,plugin:a}).pipe(e.mergeMap(y),e.mergeMap((function(n){return!1===n?c({request:o}):E(s.handle({request:o,next:c}))})))},n.prototype._shouldHandle=function(n){var e=n.request,t=n.plugin;return h(t.condition)?E(t.condition({request:e})):r.of(!0)},n}();n.HttpExt=g,n.createRequest=function(n){return{url:n.url,method:n.method||"GET",body:n.body||null,headers:n.headers||{},params:n.params||{},responseType:n.responseType||"json"}},n.createResponse=function(n){return{body:n.body,status:null==n.status?200:n.status,statusText:n.statusText||"OK",headers:n.headers||{}}},n.matchMethod=function(n){return function(r){var e=r.request.method;return o({matchExpression:n,matcherList:[m,x],errorFactory:v}).handle({matchExpression:n,value:e})}},n.matchOrigin=function(n){return function(r){var e=function(n){var r=t(n.split("://"),2),e=r[0],o=r[1];if(null==e||null==o)throw u(n);var i=o.match(/^[a-z0-9.:-]+/);if(null==i)throw u(n);return e+"://"+i[0]}(r.request.url);return o({matchExpression:n,matcherList:[l,f,d,p],errorFactory:i}).handle({matchExpression:n,value:e})}},Object.defineProperty(n,"__esModule",{value:!0})})); | ||
***************************************************************************** */function t(n,r){var e="function"==typeof Symbol&&n[Symbol.iterator];if(!e)return n;var t,o,u=e.call(n),a=[];try{for(;(void 0===r||r-- >0)&&!(t=u.next()).done;)a.push(t.value)}catch(n){o={error:n}}finally{try{t&&!t.done&&(e=u.return)&&e.call(u)}finally{if(o)throw o.error}}return a}function o(n){var r=n.matchExpression,e=n.matcherList,t=n.errorFactory,o=e.find((function(n){return n.canHandle(r)}));if(null==o)throw t(r);return o}function u(n){return new Error("InvalidUrlError: "+n+" is not a valid URL.")}function a(n){return new Error("InvalidOriginMatchExpression: "+JSON.stringify(n)+" is an invalid origin match expression.")}var i=function(n){return Array.isArray(n)};function s(n){return function(r){return typeof r===n}}var l=function(n){return s("string")(n)},c={canHandle:function(n){return l(n)},handle:function(n){return n.value===n.matchExpression}},f={canHandle:function(n){return i(n)},handle:function(n){var r=n.value;return n.matchExpression.some((function(n){return o({matchExpression:n,matcherList:[c],errorFactory:a}).handle({value:r,matchExpression:n})}))}},h=function(n){return s("function")(n)},d={canHandle:function(n){return h(n)},handle:function(n){var r=n.value;return(0,n.matchExpression)(r)}},p={canHandle:function(n){return n instanceof RegExp},handle:function(n){var r=n.value;return n.matchExpression.test(r)}};function v(n){return new Error("InvalidMethodMatchExpression: "+JSON.stringify(n)+" is an invalid method match expression.")}var x={canHandle:function(n){return i(n)},handle:function(n){var r=n.value;return n.matchExpression.includes(r)}},m={canHandle:function(n){return l(n)},handle:function(n){return n.value===n.matchExpression}};var y=function(n){return r.iif((function(){return r=n,s("boolean")(r);var r}),r.of(n),r.throwError("InvalidPluginConditionError: expect boolean got "+typeof n+"."))};function E(n){return r.isObservable(n)?n:function(n){return"function"==typeof(null==n?void 0:n.then)}(n)?r.from(n):r.of(n)}var g=function(){function n(n){var r=n.plugins;this._plugins=r}return n.prototype.handle=function(n){var r=n.request,e=n.httpHandler;return this._handle({request:r,plugins:this._plugins,httpHandler:e})},n.prototype._handle=function(n){var r=this,o=n.request,u=n.plugins,a=n.httpHandler;if(0===u.length)return a({request:o});var i=t(u,1)[0],s=i.handler,l=function(n){return E(r._handle({request:n.request,plugins:u.slice(1),httpHandler:a}))};return this._shouldHandle({request:o,plugin:i}).pipe(e.mergeMap(y),e.mergeMap((function(n){return!1===n?l({request:o}):E(s.handle({request:o,next:l}))})))},n.prototype._shouldHandle=function(n){var e=n.request,t=n.plugin,o=t.shouldHandleRequest||t.condition;if(null!=o&&!h(o))throw new Error('"shouldHandleRequest" should be a function.');return null==o?r.of(!0):E(o({request:e}))},n}();n.HttpExt=g,n.createRequest=function(n){return{url:n.url,method:n.method||"GET",body:n.body||null,headers:n.headers||{},params:n.params||{},responseType:n.responseType||"json"}},n.createResponse=function(n){return{body:n.body,status:null==n.status?200:n.status,statusText:n.statusText||"OK",headers:n.headers||{}}},n.matchMethod=function(n){return function(r){var e=r.request.method;return o({matchExpression:n,matcherList:[m,x],errorFactory:v}).handle({matchExpression:n,value:e})}},n.matchOrigin=function(n){return function(r){var e=function(n){var r=t(n.split("://"),2),e=r[0],o=r[1];if(null==e||null==o)throw u(n);var a=o.match(/^[a-z0-9.:-]+/);if(null==a)throw u(n);return e+"://"+a[0]}(r.request.url);return o({matchExpression:n,matcherList:[c,f,p,d],errorFactory:a}).handle({matchExpression:n,value:e})}},Object.defineProperty(n,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=http-ext-core.umd.min.js.map |
@@ -6,2 +6,13 @@ # Change Log | ||
# [1.2.0](https://github.com/jscutlery/http-ext/compare/v1.1.0...v1.2.0) (2020-03-31) | ||
### Features | ||
* **core:** ✅ deprecate `condition` in favor of `shouldHandleRequest` ([11b7fbb](https://github.com/jscutlery/http-ext/commit/11b7fbb9b818b15699c3c441245b3a299c6f4851)) | ||
# [1.1.0](https://github.com/jscutlery/http-ext/compare/v1.0.0...v1.1.0) (2020-01-14) | ||
@@ -8,0 +19,0 @@ |
@@ -5,2 +5,2 @@ export { matchOrigin, matchMethod } from './lib/matchers'; | ||
export { createResponse } from './lib/response'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaHR0cC1leHQvY29yZS8iLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxXQUFXLEVBQUUsV0FBVyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDMUQsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRXpDLE9BQU8sRUFBa0IsYUFBYSxFQUFjLE1BQU0sZUFBZSxDQUFDO0FBQzFFLE9BQU8sRUFBbUIsY0FBYyxFQUFFLE1BQU0sZ0JBQWdCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgeyBIdHRwRXh0UGx1Z2luLCBSZXF1ZXN0Q29uZGl0aW9uIH0gZnJvbSAnLi9saWIvcGx1Z2luJztcbmV4cG9ydCB7IFBsdWdpbkhhbmRsZXJBcmdzLCBQbHVnaW5IYW5kbGVyIH0gZnJvbSAnLi9saWIvaGFuZGxlcic7XG5leHBvcnQgeyBtYXRjaE9yaWdpbiwgbWF0Y2hNZXRob2QgfSBmcm9tICcuL2xpYi9tYXRjaGVycyc7XG5leHBvcnQgeyBIdHRwRXh0IH0gZnJvbSAnLi9saWIvaHR0cC1leHQnO1xuZXhwb3J0IHsgTmV4dEZuIH0gZnJvbSAnLi9saWIvcmVxdWVzdC1oYW5kbGVyJztcbmV4cG9ydCB7IEh0dHBFeHRSZXF1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vZCB9IGZyb20gJy4vbGliL3JlcXVlc3QnO1xuZXhwb3J0IHsgSHR0cEV4dFJlc3BvbnNlLCBjcmVhdGVSZXNwb25zZSwgUmVzcG9uc2VBcmdzIH0gZnJvbSAnLi9saWIvcmVzcG9uc2UnO1xuIl19 |
@@ -6,2 +6,5 @@ import { of } from 'rxjs'; | ||
import { isFunction } from './utils/is-function'; | ||
export function invalidHandleRequestConditionError() { | ||
return new Error('"shouldHandleRequest" should be a function.'); | ||
} | ||
export class HttpExt { | ||
@@ -49,8 +52,12 @@ constructor({ plugins }) { | ||
_shouldHandle({ request, plugin }) { | ||
if (!isFunction(plugin.condition)) { | ||
const shouldHandleRequest = plugin.shouldHandleRequest || plugin.condition; | ||
if (shouldHandleRequest != null && !isFunction(shouldHandleRequest)) { | ||
throw invalidHandleRequestConditionError(); | ||
} | ||
if (shouldHandleRequest == null) { | ||
return of(true); | ||
} | ||
return fromSyncOrAsync(plugin.condition({ request })); | ||
return fromSyncOrAsync(shouldHandleRequest({ request })); | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC1leHQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaHR0cC1leHQvY29yZS8iLCJzb3VyY2VzIjpbImxpYi9odHRwLWV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQWMsRUFBRSxFQUFFLE1BQU0sTUFBTSxDQUFDO0FBQ3RDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQU0xQyxPQUFPLEVBQUUsNkJBQTZCLEVBQUUsTUFBTSxrQ0FBa0MsQ0FBQztBQUNqRixPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sNEJBQTRCLENBQUM7QUFDN0QsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLHFCQUFxQixDQUFDO0FBRWpELE1BQU0sT0FBTyxPQUFP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ZGxlUmVxdWVzdCA9PSBudWxsKSB7XG4gICAgICByZXR1cm4gb2YodHJ1ZSk7XG4gICAgfVxuXG4gICAgcmV0dXJuIGZyb21TeW5jT3JBc3luYyhzaG91bGRIYW5kbGVSZXF1ZXN0KHsgcmVxdWVzdCB9KSk7XG4gIH1cbn1cbiJdfQ== |
@@ -1,1 +0,1 @@ | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGh0dHAtZXh0L2NvcmUvIiwic291cmNlcyI6WyJsaWIvcGx1Z2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBPYnNlcnZhYmxlIH0gZnJvbSAncnhqcyc7XG5cbmltcG9ydCB7IEh0dHBFeHRSZXF1ZXN0IH0gZnJvbSAnLi9yZXF1ZXN0JztcbmltcG9ydCB7IFBsdWdpbkhhbmRsZXIgfSBmcm9tICcuL2hhbmRsZXInO1xuXG5leHBvcnQgdHlwZSBSZXF1ZXN0Q29uZGl0aW9uID0gKHtcbiAgcmVxdWVzdFxufToge1xuICByZXF1ZXN0OiBIdHRwRXh0UmVxdWVzdDtcbn0pID0+IGJvb2xlYW4gfCBQcm9taXNlPGJvb2xlYW4+IHwgT2JzZXJ2YWJsZTxib29sZWFuPjtcblxuZXhwb3J0IGludGVyZmFjZSBIdHRwRXh0UGx1Z2luIHtcbiAgY29uZGl0aW9uPzogUmVxdWVzdENvbmRpdGlvbjtcbiAgaGFuZGxlcjogUGx1Z2luSGFuZGxlcjtcbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGh0dHAtZXh0L2NvcmUvIiwic291cmNlcyI6WyJsaWIvcGx1Z2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBPYnNlcnZhYmxlIH0gZnJvbSAncnhqcyc7XG5cbmltcG9ydCB7IEh0dHBFeHRSZXF1ZXN0IH0gZnJvbSAnLi9yZXF1ZXN0JztcbmltcG9ydCB7IFBsdWdpbkhhbmRsZXIgfSBmcm9tICcuL2hhbmRsZXInO1xuXG5leHBvcnQgdHlwZSBSZXF1ZXN0Q29uZGl0aW9uID0gKHtcbiAgcmVxdWVzdFxufToge1xuICByZXF1ZXN0OiBIdHRwRXh0UmVxdWVzdDtcbn0pID0+IGJvb2xlYW4gfCBQcm9taXNlPGJvb2xlYW4+IHwgT2JzZXJ2YWJsZTxib29sZWFuPjtcblxuZXhwb3J0IGludGVyZmFjZSBIdHRwRXh0UGx1Z2luIHtcbiAgLyoqXG4gICAqIEBkZXByZWNhdGVkIHVzZSB7QExpbmsgSHR0cEV4dFBsdWdpbi5zaG91bGRIYW5kbGVSZXF1ZXN0fSBpbnN0ZWFkLlxuICAgKi9cbiAgY29uZGl0aW9uPzogUmVxdWVzdENvbmRpdGlvbjtcbiAgc2hvdWxkSGFuZGxlUmVxdWVzdD86IFJlcXVlc3RDb25kaXRpb247XG4gIGhhbmRsZXI6IFBsdWdpbkhhbmRsZXI7XG59XG4iXX0= |
export function isPromise(value) { | ||
/* @todo Use optional chaining when available */ | ||
return value && typeof value.then === 'function'; | ||
return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtcHJvbWlzZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BodHRwLWV4dC9jb3JlLyIsInNvdXJjZXMiOlsibGliL3V0aWxzL2lzLXByb21pc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFNBQVMsQ0FBSSxLQUFVO0lBQ3JDLGdEQUFnRDtJQUNoRCxPQUFPLEtBQUssSUFBSSxPQUFPLEtBQUssQ0FBQyxJQUFJLEtBQUssVUFBVSxDQUFDO0FBQ25ELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNQcm9taXNlPFQ+KHZhbHVlOiBhbnkpOiB2YWx1ZSBpcyBQcm9taXNlPFQ+IHtcbiAgLyogQHRvZG8gVXNlIG9wdGlvbmFsIGNoYWluaW5nIHdoZW4gYXZhaWxhYmxlICovXG4gIHJldHVybiB2YWx1ZSAmJiB0eXBlb2YgdmFsdWUudGhlbiA9PT0gJ2Z1bmN0aW9uJztcbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtcHJvbWlzZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BodHRwLWV4dC9jb3JlLyIsInNvdXJjZXMiOlsibGliL3V0aWxzL2lzLXByb21pc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFNBQVMsQ0FBSSxLQUFVO0lBQ3JDLE9BQU8sUUFBTyxLQUFLLGFBQUwsS0FBSyx1QkFBTCxLQUFLLENBQUUsSUFBSSxDQUFBLEtBQUssVUFBVSxDQUFDO0FBQzNDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNQcm9taXNlPFQ+KHZhbHVlOiBhbnkpOiB2YWx1ZSBpcyBQcm9taXNlPFQ+IHtcbiAgcmV0dXJuIHR5cGVvZiB2YWx1ZT8udGhlbiA9PT0gJ2Z1bmN0aW9uJztcbn1cbiJdfQ== |
@@ -5,2 +5,2 @@ export { matchOrigin, matchMethod } from './lib/matchers'; | ||
export { createResponse } from './lib/response'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaHR0cC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ZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE9BQU8sRUFBRSxXQUFXLEVBQUUsV0FBVyxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFDMUQsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGdCQUFnQixDQUFDO0FBRXpDLE9BQU8sRUFBa0IsYUFBYSxFQUFjLE1BQU0sZUFBZSxDQUFDO0FBQzFFLE9BQU8sRUFBbUIsY0FBYyxFQUFnQixNQUFNLGdCQUFnQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHsgSHR0cEV4dFBsdWdpbiwgUmVxdWVzdENvbmRpdGlvbiB9IGZyb20gJy4vbGliL3BsdWdpbic7XG5leHBvcnQgeyBQbHVnaW5IYW5kbGVyQXJncywgUGx1Z2luSGFuZGxlciB9IGZyb20gJy4vbGliL2hhbmRsZXInO1xuZXhwb3J0IHsgbWF0Y2hPcmlnaW4sIG1hdGNoTWV0aG9kIH0gZnJvbSAnLi9saWIvbWF0Y2hlcnMnO1xuZXhwb3J0IHsgSHR0cEV4dCB9IGZyb20gJy4vbGliL2h0dHAtZXh0JztcbmV4cG9ydCB7IE5leHRGbiB9IGZyb20gJy4vbGliL3JlcXVlc3QtaGFuZGxlcic7XG5leHBvcnQgeyBIdHRwRXh0UmVxdWVzdCwgY3JlYXRlUmVxdWVzdCwgSHR0cE1ldGhvZCB9IGZyb20gJy4vbGliL3JlcXVlc3QnO1xuZXhwb3J0IHsgSHR0cEV4dFJlc3BvbnNlLCBjcmVhdGVSZXNwb25zZSwgUmVzcG9uc2VBcmdzIH0gZnJvbSAnLi9saWIvcmVzcG9uc2UnO1xuIl19 |
@@ -7,2 +7,5 @@ import { __read } from "tslib"; | ||
import { isFunction } from './utils/is-function'; | ||
export function invalidHandleRequestConditionError() { | ||
return new Error('"shouldHandleRequest" should be a function.'); | ||
} | ||
var HttpExt = /** @class */ (function () { | ||
@@ -55,6 +58,10 @@ function HttpExt(_a) { | ||
var request = _a.request, plugin = _a.plugin; | ||
if (!isFunction(plugin.condition)) { | ||
var shouldHandleRequest = plugin.shouldHandleRequest || plugin.condition; | ||
if (shouldHandleRequest != null && !isFunction(shouldHandleRequest)) { | ||
throw invalidHandleRequestConditionError(); | ||
} | ||
if (shouldHandleRequest == null) { | ||
return of(true); | ||
} | ||
return fromSyncOrAsync(plugin.condition({ request: request })); | ||
return fromSyncOrAsync(shouldHandleRequest({ request: request })); | ||
}; | ||
@@ -64,2 +71,2 @@ return HttpExt; | ||
export { HttpExt }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHR0cC1leHQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaHR0cC1leHQvY29yZS8iLCJzb3VyY2VzIjpbImxpYi9odHRwLWV4dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFjLEVBQUUsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUN0QyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZ0JBQWdCLENBQUM7QUFNMUMsT0FBTyxFQUFFLDZCQUE2QixFQUFFLE1BQU0sa0NBQWtDLENBQUM7QUFDakYsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBQzdELE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQUVqRDtJQUdFLGlCQUFZLEVBQXlDO1lBQXZDLG9CQUFPO1FBQ25CLElBQUksQ0FBQyxRQUFRLEdBQUcsT0FBTyxDQUFDO0lBQzFCLENBQUM7SUFFRCx3QkFBTSxHQUFOLFVBQU8sRUFNTjtZQUxDLG9CQUFPLEVBQ1AsNEJBQVc7UUFLWCxPQUFPLElBQUksQ0FBQyxPQUFPLENBQUM7WUFDbEIsT0FBTyxTQUFBO1lBQ1AsT0FBTyxFQUFFLElBQUksQ0FBQyxRQUFRO1l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0pKTtcbiAgfVxufVxuIl19 |
@@ -1,1 +0,1 @@ | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGh0dHAtZXh0L2NvcmUvIiwic291cmNlcyI6WyJsaWIvcGx1Z2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBPYnNlcnZhYmxlIH0gZnJvbSAncnhqcyc7XG5cbmltcG9ydCB7IEh0dHBFeHRSZXF1ZXN0IH0gZnJvbSAnLi9yZXF1ZXN0JztcbmltcG9ydCB7IFBsdWdpbkhhbmRsZXIgfSBmcm9tICcuL2hhbmRsZXInO1xuXG5leHBvcnQgdHlwZSBSZXF1ZXN0Q29uZGl0aW9uID0gKHtcbiAgcmVxdWVzdFxufToge1xuICByZXF1ZXN0OiBIdHRwRXh0UmVxdWVzdDtcbn0pID0+IGJvb2xlYW4gfCBQcm9taXNlPGJvb2xlYW4+IHwgT2JzZXJ2YWJsZTxib29sZWFuPjtcblxuZXhwb3J0IGludGVyZmFjZSBIdHRwRXh0UGx1Z2luIHtcbiAgY29uZGl0aW9uPzogUmVxdWVzdENvbmRpdGlvbjtcbiAgaGFuZGxlcjogUGx1Z2luSGFuZGxlcjtcbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGh0dHAtZXh0L2NvcmUvIiwic291cmNlcyI6WyJsaWIvcGx1Z2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBPYnNlcnZhYmxlIH0gZnJvbSAncnhqcyc7XG5cbmltcG9ydCB7IEh0dHBFeHRSZXF1ZXN0IH0gZnJvbSAnLi9yZXF1ZXN0JztcbmltcG9ydCB7IFBsdWdpbkhhbmRsZXIgfSBmcm9tICcuL2hhbmRsZXInO1xuXG5leHBvcnQgdHlwZSBSZXF1ZXN0Q29uZGl0aW9uID0gKHtcbiAgcmVxdWVzdFxufToge1xuICByZXF1ZXN0OiBIdHRwRXh0UmVxdWVzdDtcbn0pID0+IGJvb2xlYW4gfCBQcm9taXNlPGJvb2xlYW4+IHwgT2JzZXJ2YWJsZTxib29sZWFuPjtcblxuZXhwb3J0IGludGVyZmFjZSBIdHRwRXh0UGx1Z2luIHtcbiAgLyoqXG4gICAqIEBkZXByZWNhdGVkIHVzZSB7QExpbmsgSHR0cEV4dFBsdWdpbi5zaG91bGRIYW5kbGVSZXF1ZXN0fSBpbnN0ZWFkLlxuICAgKi9cbiAgY29uZGl0aW9uPzogUmVxdWVzdENvbmRpdGlvbjtcbiAgc2hvdWxkSGFuZGxlUmVxdWVzdD86IFJlcXVlc3RDb25kaXRpb247XG4gIGhhbmRsZXI6IFBsdWdpbkhhbmRsZXI7XG59XG4iXX0= |
export function isPromise(value) { | ||
/* @todo Use optional chaining when available */ | ||
return value && typeof value.then === 'function'; | ||
return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtcHJvbWlzZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BodHRwLWV4dC9jb3JlLyIsInNvdXJjZXMiOlsibGliL3V0aWxzL2lzLXByb21pc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFNBQVMsQ0FBSSxLQUFVO0lBQ3JDLGdEQUFnRDtJQUNoRCxPQUFPLEtBQUssSUFBSSxPQUFPLEtBQUssQ0FBQyxJQUFJLEtBQUssVUFBVSxDQUFDO0FBQ25ELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNQcm9taXNlPFQ+KHZhbHVlOiBhbnkpOiB2YWx1ZSBpcyBQcm9taXNlPFQ+IHtcbiAgLyogQHRvZG8gVXNlIG9wdGlvbmFsIGNoYWluaW5nIHdoZW4gYXZhaWxhYmxlICovXG4gIHJldHVybiB2YWx1ZSAmJiB0eXBlb2YgdmFsdWUudGhlbiA9PT0gJ2Z1bmN0aW9uJztcbn1cbiJdfQ== | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtcHJvbWlzZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL0BodHRwLWV4dC9jb3JlLyIsInNvdXJjZXMiOlsibGliL3V0aWxzL2lzLXByb21pc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsTUFBTSxVQUFVLFNBQVMsQ0FBSSxLQUFVO0lBQ3JDLE9BQU8sUUFBTyxLQUFLLGFBQUwsS0FBSyx1QkFBTCxLQUFLLENBQUUsSUFBSSxDQUFBLEtBQUssVUFBVSxDQUFDO0FBQzNDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNQcm9taXNlPFQ+KHZhbHVlOiBhbnkpOiB2YWx1ZSBpcyBQcm9taXNlPFQ+IHtcbiAgcmV0dXJuIHR5cGVvZiB2YWx1ZT8udGhlbiA9PT0gJ2Z1bmN0aW9uJztcbn1cbiJdfQ== |
@@ -159,4 +159,3 @@ import { iif, of, throwError, isObservable, from } from 'rxjs'; | ||
function isPromise(value) { | ||
/* @todo Use optional chaining when available */ | ||
return value && typeof value.then === 'function'; | ||
return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; | ||
} | ||
@@ -174,2 +173,5 @@ | ||
function invalidHandleRequestConditionError() { | ||
return new Error('"shouldHandleRequest" should be a function.'); | ||
} | ||
class HttpExt { | ||
@@ -217,6 +219,10 @@ constructor({ plugins }) { | ||
_shouldHandle({ request, plugin }) { | ||
if (!isFunction(plugin.condition)) { | ||
const shouldHandleRequest = plugin.shouldHandleRequest || plugin.condition; | ||
if (shouldHandleRequest != null && !isFunction(shouldHandleRequest)) { | ||
throw invalidHandleRequestConditionError(); | ||
} | ||
if (shouldHandleRequest == null) { | ||
return of(true); | ||
} | ||
return fromSyncOrAsync(plugin.condition({ request })); | ||
return fromSyncOrAsync(shouldHandleRequest({ request })); | ||
} | ||
@@ -223,0 +229,0 @@ } |
@@ -179,4 +179,3 @@ import { __read } from 'tslib'; | ||
function isPromise(value) { | ||
/* @todo Use optional chaining when available */ | ||
return value && typeof value.then === 'function'; | ||
return typeof (value === null || value === void 0 ? void 0 : value.then) === 'function'; | ||
} | ||
@@ -194,2 +193,5 @@ | ||
function invalidHandleRequestConditionError() { | ||
return new Error('"shouldHandleRequest" should be a function.'); | ||
} | ||
var HttpExt = /** @class */ (function () { | ||
@@ -242,6 +244,10 @@ function HttpExt(_a) { | ||
var request = _a.request, plugin = _a.plugin; | ||
if (!isFunction(plugin.condition)) { | ||
var shouldHandleRequest = plugin.shouldHandleRequest || plugin.condition; | ||
if (shouldHandleRequest != null && !isFunction(shouldHandleRequest)) { | ||
throw invalidHandleRequestConditionError(); | ||
} | ||
if (shouldHandleRequest == null) { | ||
return of(true); | ||
} | ||
return fromSyncOrAsync(plugin.condition({ request: request })); | ||
return fromSyncOrAsync(shouldHandleRequest({ request: request })); | ||
}; | ||
@@ -248,0 +254,0 @@ return HttpExt; |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"exports":[{"export":[{"name":"matchOrigin","as":"matchOrigin"}],"from":"./lib/match-origin/match-origin"},{"export":[{"name":"matchMethod","as":"matchMethod"}],"from":"./lib/match-method/match-method"}],"metadata":{"HttpExtPlugin":{"__symbolic":"interface"},"RequestCondition":{"__symbolic":"interface"},"PluginHandlerArgs":{"__symbolic":"interface"},"PluginHandler":{"__symbolic":"interface"},"HttpExt":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":14,"character":27,"module":"./lib/http-ext"}]}],"handle":[{"__symbolic":"method"}],"_handle":[{"__symbolic":"method"}],"_shouldHandle":[{"__symbolic":"method"}]}},"NextFn":{"__symbolic":"interface"},"HttpExtRequest":{"__symbolic":"interface"},"createRequest":{"__symbolic":"function","parameters":["request"],"value":{"url":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"url"},"method":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"method"},"right":"GET"},"body":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"body"},"right":null},"headers":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"headers"},"right":{}},"params":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"params"},"right":{}},"responseType":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"responseType"},"right":"json"}}},"HttpMethod":{"__symbolic":"interface"},"HttpExtResponse":{"__symbolic":"interface"},"createResponse":{"__symbolic":"function","parameters":["response"],"value":{"body":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"body"},"status":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"status"},"right":null},"thenExpression":200,"elseExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"status"}},"statusText":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"statusText"},"right":"OK"},"headers":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"headers"},"right":{}}}}},"origins":{"HttpExtPlugin":"./lib/plugin","RequestCondition":"./lib/plugin","PluginHandlerArgs":"./lib/handler","PluginHandler":"./lib/handler","HttpExt":"./lib/http-ext","NextFn":"./lib/request-handler","HttpExtRequest":"./lib/request","createRequest":"./lib/request","HttpMethod":"./lib/request","HttpExtResponse":"./lib/response","createResponse":"./lib/response"},"importAs":"@http-ext/core"} | ||
{"__symbolic":"module","version":4,"exports":[{"export":[{"name":"matchOrigin","as":"matchOrigin"}],"from":"./lib/match-origin/match-origin"},{"export":[{"name":"matchMethod","as":"matchMethod"}],"from":"./lib/match-method/match-method"}],"metadata":{"HttpExtPlugin":{"__symbolic":"interface"},"RequestCondition":{"__symbolic":"interface"},"PluginHandlerArgs":{"__symbolic":"interface"},"PluginHandler":{"__symbolic":"interface"},"HttpExt":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Expression form not supported","line":18,"character":27,"module":"./lib/http-ext"}]}],"handle":[{"__symbolic":"method"}],"_handle":[{"__symbolic":"method"}],"_shouldHandle":[{"__symbolic":"method"}]}},"NextFn":{"__symbolic":"interface"},"HttpExtRequest":{"__symbolic":"interface"},"createRequest":{"__symbolic":"function","parameters":["request"],"value":{"url":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"url"},"method":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"method"},"right":"GET"},"body":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"body"},"right":null},"headers":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"headers"},"right":{}},"params":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"params"},"right":{}},"responseType":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"request"},"member":"responseType"},"right":"json"}}},"HttpMethod":{"__symbolic":"interface"},"HttpExtResponse":{"__symbolic":"interface"},"createResponse":{"__symbolic":"function","parameters":["response"],"value":{"body":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"body"},"status":{"__symbolic":"if","condition":{"__symbolic":"binop","operator":"==","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"status"},"right":null},"thenExpression":200,"elseExpression":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"status"}},"statusText":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"statusText"},"right":"OK"},"headers":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"response"},"member":"headers"},"right":{}}}},"ResponseArgs":{"__symbolic":"interface"}},"origins":{"HttpExtPlugin":"./lib/plugin","RequestCondition":"./lib/plugin","PluginHandlerArgs":"./lib/handler","PluginHandler":"./lib/handler","HttpExt":"./lib/http-ext","NextFn":"./lib/request-handler","HttpExtRequest":"./lib/request","createRequest":"./lib/request","HttpMethod":"./lib/request","HttpExtResponse":"./lib/response","createResponse":"./lib/response","ResponseArgs":"./lib/response"},"importAs":"@http-ext/core"} |
@@ -7,2 +7,2 @@ export { HttpExtPlugin, RequestCondition } from './lib/plugin'; | ||
export { HttpExtRequest, createRequest, HttpMethod } from './lib/request'; | ||
export { HttpExtResponse, createResponse } from './lib/response'; | ||
export { HttpExtResponse, createResponse, ResponseArgs } from './lib/response'; |
@@ -6,2 +6,3 @@ import { Observable } from 'rxjs'; | ||
import { HttpExtResponse } from './response'; | ||
export declare function invalidHandleRequestConditionError(): Error; | ||
export declare class HttpExt { | ||
@@ -8,0 +9,0 @@ private _plugins; |
@@ -8,4 +8,8 @@ import { Observable } from 'rxjs'; | ||
export interface HttpExtPlugin { | ||
/** | ||
* @deprecated use {@Link HttpExtPlugin.shouldHandleRequest} instead. | ||
*/ | ||
condition?: RequestCondition; | ||
shouldHandleRequest?: RequestCondition; | ||
handler: PluginHandler; | ||
} |
{ | ||
"name": "@http-ext/core", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "private": false, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
298847
133
1876
3