@datorama/akita-ng-entity-service
Advanced tools
Comparing version 5.1.1 to 6.0.0
@@ -8,14 +8,14 @@ (function (global, factory) { | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -27,3 +27,3 @@ /* global Reflect, Promise */ | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -114,4 +114,12 @@ }; | ||
function __exportStar(m, exports) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
}); | ||
function __exportStar(m, o) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); | ||
} | ||
@@ -197,7 +205,13 @@ | ||
var __setModuleDefault = Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}; | ||
function __importStar(mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result.default = mod; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
@@ -275,6 +289,6 @@ } | ||
}; | ||
NgEntityServiceNotifier.ngInjectableDef = core["ɵɵdefineInjectable"]({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier = __decorate([ | ||
core.Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceNotifier); | ||
NgEntityServiceNotifier.ɵprov = core["ɵɵdefineInjectable"]({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier.decorators = [ | ||
{ type: core.Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
return NgEntityServiceNotifier; | ||
@@ -294,2 +308,3 @@ }()); | ||
function mergeDeep(target) { | ||
var _a, _b; | ||
var sources = []; | ||
@@ -299,3 +314,2 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
} | ||
var _a, _b; | ||
if (!sources.length) | ||
@@ -366,6 +380,6 @@ return target; | ||
}; | ||
NgEntityServiceLoader.ngInjectableDef = core["ɵɵdefineInjectable"]({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader = __decorate([ | ||
core.Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceLoader); | ||
NgEntityServiceLoader.ɵprov = core["ɵɵdefineInjectable"]({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader.decorators = [ | ||
{ type: core.Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
return NgEntityServiceLoader; | ||
@@ -400,3 +414,3 @@ }()); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -408,3 +422,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -481,3 +495,3 @@ }); | ||
}); | ||
var configWithBody = __assign({}, config, { body: entity }); | ||
var configWithBody = __assign(__assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), operators.tap(function (responseEntity) { | ||
@@ -517,3 +531,3 @@ if (!config || (config && !config.skipWrite)) { | ||
}); | ||
var configWithBody = __assign({}, config, { body: entity }); | ||
var configWithBody = __assign(__assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), operators.tap(function (responseEntity) { | ||
@@ -520,0 +534,0 @@ if (!config || (config && !config.skipWrite)) { |
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common/http"),require("@angular/core"),require("@datorama/akita"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@datorama/akita-ng-entity-service",["exports","@angular/common/http","@angular/core","@datorama/akita","rxjs","rxjs/operators"],e):e(((t=t||self).datorama=t.datorama||{},t.datorama["akita-ng-entity-service"]={}),t.ng.common.http,t.ng.core,t.akita,t.rxjs,t.rxjs.operators)}(this,(function(t,e,r,o,n,i){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};var a,c=function(){return(c=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function u(t,e,r,o){var n,i=arguments.length,s=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(i<3?n(s):i>3?n(e,r,s):n(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function p(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,n,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function d(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(p(arguments[e]));return t}function h(t,e){return function(r){var o=r.payload,n=r.method,i=r.successMsg;e.dispatch({type:"success",storeName:t,payload:o,method:n,successMsg:i})}}function f(t,e){return function(r){var o=r.payload,n=r.method,i=r.errorMsg;e.dispatch({type:"error",storeName:t,payload:o,method:n,errorMsg:i})}}function l(t){return o.isNumber(t)||o.isString(t)}(a=t.HttpMethod||(t.HttpMethod={})).GET="GET",a.POST="POST",a.PUT="PUT",a.PATCH="PATCH",a.DELETE="DELETE";var g=function(){function t(){this.dispatcher=new n.Subject,this.action$=this.dispatcher.asObservable()}return t.prototype.dispatch=function(t){this.dispatcher.next(t)},t.ngInjectableDef=r["ɵɵdefineInjectable"]({factory:function(){return new t},token:t,providedIn:"root"}),t=u([r.Injectable({providedIn:"root"})],t)}(),m=new r.InjectionToken("NgEntityServiceGlobalConfig"),y={httpMethods:{GET:t.HttpMethod.GET,POST:t.HttpMethod.POST,PATCH:t.HttpMethod.PATCH,PUT:t.HttpMethod.PUT,DELETE:t.HttpMethod.DELETE}};function v(t){for(var e,r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!n.length)return t;var s=n.shift();if(o.isObject(t)&&o.isObject(s))for(var a in s)o.isObject(s[a])?(t[a]||Object.assign(t,((e={})[a]={},e)),v(t[a],s[a])):Object.assign(t,((r={})[a]=s[a],r));return v.apply(void 0,d([t],n))}var E=function(){function e(){this.dispatcher=new n.Subject,this.loading$=this.dispatcher.asObservable()}return e.prototype.dispatch=function(t){this.dispatcher.next(t)},e.prototype.loadersFor=function(e){var r=this,n=i.filter((function(t){var r=t.storeName;return!e||r===e})),s=function(t){return i.filter((function(e){var r=e.method;return o.isFunction(t)?t(r):r===t}))},a=function(t){return r.loading$.pipe(n,s(t),i.map((function(t){return t.loading})))},c=function(t,e){return r.loading$.pipe(n,s(e),i.filter((function(e){return e.entityId===t})),i.map((function(t){return t.loading})))};return{get$:a(t.HttpMethod.GET),add$:a(t.HttpMethod.POST),update$:a((function(e){return e===t.HttpMethod.PUT||e===t.HttpMethod.PATCH})),delete$:a(t.HttpMethod.DELETE),getEntity:function(e){return c(e,t.HttpMethod.GET)},updateEntity:function(e){return c(e,(function(e){return e===t.HttpMethod.PUT||e===t.HttpMethod.PATCH}))},deleteEntity:function(e){return c(e,t.HttpMethod.DELETE)}}},e.ngInjectableDef=r["ɵɵdefineInjectable"]({factory:function(){return new e},token:e,providedIn:"root"}),e=u([r.Injectable({providedIn:"root"})],e)}(),M=function(t){return i.map((function(e){return t&&t.mapResponseFn?t.mapResponseFn(e):e}))},b=function(a){function u(t,o){void 0===o&&(o={});var n=a.call(this)||this;n.store=t,n.config=o,n.http=r.inject(e.HttpClient),n.loader=r.inject(E),n.notifier=r.inject(g);var i=r.inject(m);return n.mergedConfig=v({},y,i,n.getDecoratorConfig(),o),n.baseUrl=n.mergedConfig.baseUrl,n.httpMethodMap=n.mergedConfig.httpMethods,n.dispatchSuccess=h(n.store.storeName,n.notifier),n.dispatchError=f(n.store.storeName,n.notifier),n}return function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(u,a),Object.defineProperty(u.prototype,"api",{get:function(){if(!this.baseUrl)throw new Error("baseUrl of "+this.constructor.name+" is not defined.");return this.baseUrl+"/"+this.resourceName},enumerable:!0,configurable:!0}),Object.defineProperty(u.prototype,"resourceName",{get:function(){return this.mergedConfig.resourceName||this.store.storeName},enumerable:!0,configurable:!0}),u.prototype.setBaseUrl=function(t){this.baseUrl=t},u.prototype.getHttp=function(){return this.http},u.prototype.getConfig=function(){return this.mergedConfig},u.prototype.get=function(e,r){var o=this,n=this.getHttpMethod(t.HttpMethod.GET),s=l(e),a=s?e:void 0,u=(s?r:e)||{},p=this.resolveUrl(u,a);return this.loader.dispatch({method:n,loading:!0,entityId:a,storeName:this.store.storeName}),this.http.request(n,p,u).pipe(M(u),i.tap((function(t){u.skipWrite||(s?o.store.upsert(a,t,(function(t,e){return c({id:t},e)})):u.append?o.store.add(t):u.upsert?o.store.upsertMany(t):o.store.set(t)),o.dispatchSuccess({method:n,payload:t,successMsg:u.successMsg})})),i.catchError((function(t){return o.handleError(n,t,u.errorMsg)})),i.finalize((function(){o.loader.dispatch({method:n,loading:!1,entityId:a,storeName:o.store.storeName})})))},u.prototype.add=function(e,r){var o=this,n=this.resolveUrl(r),s=this.getHttpMethod(t.HttpMethod.POST);this.loader.dispatch({method:s,loading:!0,storeName:this.store.storeName});var a=c({},r,{body:e});return this.http.request(s,n,a).pipe(M(r),i.tap((function(t){(!r||r&&!r.skipWrite)&&o.store.add(t,r),o.dispatchSuccess({method:s,payload:t,successMsg:r&&r.successMsg})})),i.catchError((function(t){return o.handleError(s,t,r&&r.errorMsg)})),i.finalize((function(){o.loader.dispatch({method:s,loading:!1,storeName:o.store.storeName})})))},u.prototype.update=function(e,r,o){var n=this,s=this.resolveUrl(o,e),a=o&&o.method||this.getHttpMethod(t.HttpMethod.PUT);this.loader.dispatch({method:a,loading:!0,entityId:e,storeName:this.store.storeName});var u=c({},o,{body:r});return this.http.request(a,s,u).pipe(M(o),i.tap((function(t){(!o||o&&!o.skipWrite)&&n.store.update(e,t),n.dispatchSuccess({method:a,payload:t,successMsg:o&&o.successMsg})})),i.catchError((function(t){return n.handleError(a,t,o&&o.errorMsg)})),i.finalize((function(){n.loader.dispatch({method:a,loading:!1,entityId:e,storeName:n.store.storeName})})))},u.prototype.delete=function(e,r){var o=this,n=this.resolveUrl(r,e),s=this.getHttpMethod(t.HttpMethod.DELETE);return this.loader.dispatch({method:s,loading:!0,entityId:e,storeName:this.store.storeName}),this.http.request(s,n,r).pipe(M(r),i.tap((function(t){(!r||r&&!r.skipWrite)&&o.store.remove(e),o.dispatchSuccess({method:s,payload:t,successMsg:r&&r.successMsg})})),i.catchError((function(t){return o.handleError(s,t,r&&r.errorMsg)})),i.finalize((function(){o.loader.dispatch({method:s,loading:!1,entityId:e,storeName:o.store.storeName})})))},u.prototype.getHttpMethod=function(t){var e;if(this.httpMethodMap&&(e=this.httpMethodMap[t]),!e)throw new Error("Unknown HttpMethod");return e},u.prototype.getDecoratorValue=function(t){return this.constructor[t]},u.prototype.getDecoratorConfig=function(){var t={},e=this.getDecoratorValue("baseUrl");e&&(t.baseUrl=e);var r=this.getDecoratorValue("resourceName");return r&&(t.resourceName=r),t},u.prototype.resolveUrl=function(t,e){var r=Object(t),n=r.url,i=r.urlPostfix,s=this.api;return n||(o.isDefined(e)&&(s+="/"+e),i&&(s+="/"+i),s)},u.prototype.handleError=function(t,e,r){return this.dispatchError({method:t,errorMsg:r,payload:e}),n.throwError(e)},u}(o.EntityService);t.NG_ENTITY_SERVICE_CONFIG=m,t.NgEntityService=b,t.NgEntityServiceConfig=function(t){return void 0===t&&(t={}),function(e){t.baseUrl&&(e.baseUrl=t.baseUrl),t.resourceName&&(e.resourceName=t.resourceName)}},t.NgEntityServiceLoader=E,t.NgEntityServiceNotifier=g,t.defaultConfig=y,t.errorAction=f,t.filterMethod=function(t){return i.filter((function(e){return e.method===t}))},t.filterStore=function(t){return i.filter((function(e){return e.storeName===t}))},t.isID=l,t.mapResponse=M,t.mergeDeep=v,t.ofType=function(t){return i.filter((function(e){return e.type===t}))},t.successAction=h,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};var a=function(){return(a=Object.assign||function(t){for(var e,r=1,o=arguments.length;r<o;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};Object.create;function c(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var o,n,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(t){n={error:t}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s}function u(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(c(arguments[e]));return t}var p;Object.create;function d(t,e){return function(r){var o=r.payload,n=r.method,i=r.successMsg;e.dispatch({type:"success",storeName:t,payload:o,method:n,successMsg:i})}}function h(t,e){return function(r){var o=r.payload,n=r.method,i=r.errorMsg;e.dispatch({type:"error",storeName:t,payload:o,method:n,errorMsg:i})}}function f(t){return o.isNumber(t)||o.isString(t)}(p=t.HttpMethod||(t.HttpMethod={})).GET="GET",p.POST="POST",p.PUT="PUT",p.PATCH="PATCH",p.DELETE="DELETE";var l=function(){function t(){this.dispatcher=new n.Subject,this.action$=this.dispatcher.asObservable()}return t.prototype.dispatch=function(t){this.dispatcher.next(t)},t.ɵprov=r["ɵɵdefineInjectable"]({factory:function(){return new t},token:t,providedIn:"root"}),t.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],t}(),g=new r.InjectionToken("NgEntityServiceGlobalConfig"),m={httpMethods:{GET:t.HttpMethod.GET,POST:t.HttpMethod.POST,PATCH:t.HttpMethod.PATCH,PUT:t.HttpMethod.PUT,DELETE:t.HttpMethod.DELETE}};function y(t){for(var e,r,n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(!n.length)return t;var s=n.shift();if(o.isObject(t)&&o.isObject(s))for(var a in s)o.isObject(s[a])?(t[a]||Object.assign(t,((e={})[a]={},e)),y(t[a],s[a])):Object.assign(t,((r={})[a]=s[a],r));return y.apply(void 0,u([t],n))}var v=function(){function e(){this.dispatcher=new n.Subject,this.loading$=this.dispatcher.asObservable()}return e.prototype.dispatch=function(t){this.dispatcher.next(t)},e.prototype.loadersFor=function(e){var r=this,n=i.filter((function(t){var r=t.storeName;return!e||r===e})),s=function(t){return i.filter((function(e){var r=e.method;return o.isFunction(t)?t(r):r===t}))},a=function(t){return r.loading$.pipe(n,s(t),i.map((function(t){return t.loading})))},c=function(t,e){return r.loading$.pipe(n,s(e),i.filter((function(e){return e.entityId===t})),i.map((function(t){return t.loading})))};return{get$:a(t.HttpMethod.GET),add$:a(t.HttpMethod.POST),update$:a((function(e){return e===t.HttpMethod.PUT||e===t.HttpMethod.PATCH})),delete$:a(t.HttpMethod.DELETE),getEntity:function(e){return c(e,t.HttpMethod.GET)},updateEntity:function(e){return c(e,(function(e){return e===t.HttpMethod.PUT||e===t.HttpMethod.PATCH}))},deleteEntity:function(e){return c(e,t.HttpMethod.DELETE)}}},e.ɵprov=r["ɵɵdefineInjectable"]({factory:function(){return new e},token:e,providedIn:"root"}),e.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],e}(),E=function(t){return i.map((function(e){return t&&t.mapResponseFn?t.mapResponseFn(e):e}))},M=function(c){function u(t,o){void 0===o&&(o={});var n=c.call(this)||this;n.store=t,n.config=o,n.http=r.inject(e.HttpClient),n.loader=r.inject(v),n.notifier=r.inject(l);var i=r.inject(g);return n.mergedConfig=y({},m,i,n.getDecoratorConfig(),o),n.baseUrl=n.mergedConfig.baseUrl,n.httpMethodMap=n.mergedConfig.httpMethods,n.dispatchSuccess=d(n.store.storeName,n.notifier),n.dispatchError=h(n.store.storeName,n.notifier),n}return function(t,e){function r(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(u,c),Object.defineProperty(u.prototype,"api",{get:function(){if(!this.baseUrl)throw new Error("baseUrl of "+this.constructor.name+" is not defined.");return this.baseUrl+"/"+this.resourceName},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"resourceName",{get:function(){return this.mergedConfig.resourceName||this.store.storeName},enumerable:!1,configurable:!0}),u.prototype.setBaseUrl=function(t){this.baseUrl=t},u.prototype.getHttp=function(){return this.http},u.prototype.getConfig=function(){return this.mergedConfig},u.prototype.get=function(e,r){var o=this,n=this.getHttpMethod(t.HttpMethod.GET),s=f(e),c=s?e:void 0,u=(s?r:e)||{},p=this.resolveUrl(u,c);return this.loader.dispatch({method:n,loading:!0,entityId:c,storeName:this.store.storeName}),this.http.request(n,p,u).pipe(E(u),i.tap((function(t){u.skipWrite||(s?o.store.upsert(c,t,(function(t,e){return a({id:t},e)})):u.append?o.store.add(t):u.upsert?o.store.upsertMany(t):o.store.set(t)),o.dispatchSuccess({method:n,payload:t,successMsg:u.successMsg})})),i.catchError((function(t){return o.handleError(n,t,u.errorMsg)})),i.finalize((function(){o.loader.dispatch({method:n,loading:!1,entityId:c,storeName:o.store.storeName})})))},u.prototype.add=function(e,r){var o=this,n=this.resolveUrl(r),s=this.getHttpMethod(t.HttpMethod.POST);this.loader.dispatch({method:s,loading:!0,storeName:this.store.storeName});var c=a(a({},r),{body:e});return this.http.request(s,n,c).pipe(E(r),i.tap((function(t){(!r||r&&!r.skipWrite)&&o.store.add(t,r),o.dispatchSuccess({method:s,payload:t,successMsg:r&&r.successMsg})})),i.catchError((function(t){return o.handleError(s,t,r&&r.errorMsg)})),i.finalize((function(){o.loader.dispatch({method:s,loading:!1,storeName:o.store.storeName})})))},u.prototype.update=function(e,r,o){var n=this,s=this.resolveUrl(o,e),c=o&&o.method||this.getHttpMethod(t.HttpMethod.PUT);this.loader.dispatch({method:c,loading:!0,entityId:e,storeName:this.store.storeName});var u=a(a({},o),{body:r});return this.http.request(c,s,u).pipe(E(o),i.tap((function(t){(!o||o&&!o.skipWrite)&&n.store.update(e,t),n.dispatchSuccess({method:c,payload:t,successMsg:o&&o.successMsg})})),i.catchError((function(t){return n.handleError(c,t,o&&o.errorMsg)})),i.finalize((function(){n.loader.dispatch({method:c,loading:!1,entityId:e,storeName:n.store.storeName})})))},u.prototype.delete=function(e,r){var o=this,n=this.resolveUrl(r,e),s=this.getHttpMethod(t.HttpMethod.DELETE);return this.loader.dispatch({method:s,loading:!0,entityId:e,storeName:this.store.storeName}),this.http.request(s,n,r).pipe(E(r),i.tap((function(t){(!r||r&&!r.skipWrite)&&o.store.remove(e),o.dispatchSuccess({method:s,payload:t,successMsg:r&&r.successMsg})})),i.catchError((function(t){return o.handleError(s,t,r&&r.errorMsg)})),i.finalize((function(){o.loader.dispatch({method:s,loading:!1,entityId:e,storeName:o.store.storeName})})))},u.prototype.getHttpMethod=function(t){var e;if(this.httpMethodMap&&(e=this.httpMethodMap[t]),!e)throw new Error("Unknown HttpMethod");return e},u.prototype.getDecoratorValue=function(t){return this.constructor[t]},u.prototype.getDecoratorConfig=function(){var t={},e=this.getDecoratorValue("baseUrl");e&&(t.baseUrl=e);var r=this.getDecoratorValue("resourceName");return r&&(t.resourceName=r),t},u.prototype.resolveUrl=function(t,e){var r=Object(t),n=r.url,i=r.urlPostfix,s=this.api;return n||(o.isDefined(e)&&(s+="/"+e),i&&(s+="/"+i),s)},u.prototype.handleError=function(t,e,r){return this.dispatchError({method:t,errorMsg:r,payload:e}),n.throwError(e)},u}(o.EntityService);t.NG_ENTITY_SERVICE_CONFIG=g,t.NgEntityService=M,t.NgEntityServiceConfig=function(t){return void 0===t&&(t={}),function(e){t.baseUrl&&(e.baseUrl=t.baseUrl),t.resourceName&&(e.resourceName=t.resourceName)}},t.NgEntityServiceLoader=v,t.NgEntityServiceNotifier=l,t.defaultConfig=m,t.errorAction=h,t.filterMethod=function(t){return i.filter((function(e){return e.method===t}))},t.filterStore=function(t){return i.filter((function(e){return e.storeName===t}))},t.isID=f,t.mapResponse=E,t.mergeDeep=y,t.ofType=function(t){return i.filter((function(e){return e.type===t}))},t.successAction=d,Object.defineProperty(t,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=datorama-akita-ng-entity-service.umd.min.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"mapResponse":{"__symbolic":"error","message":"Lambda not supported","line":12,"character":27,"module":"./lib/ng-entity.service"},"NgEntityService":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","module":"@datorama/akita","name":"EntityService","line":14,"character":66},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"EntityStore","module":"@datorama/akita","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":34,"character":52,"context":{"typeName":"S"},"module":"./lib/ng-entity.service"}]},{"__symbolic":"reference","name":"NgEntityServiceParams"}]}],"setBaseUrl":[{"__symbolic":"method"}],"getHttp":[{"__symbolic":"method"}],"getConfig":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}],"getHttpMethod":[{"__symbolic":"method"}],"getDecoratorValue":[{"__symbolic":"method"}],"getDecoratorConfig":[{"__symbolic":"method"}],"resolveUrl":[{"__symbolic":"method"}],"handleError":[{"__symbolic":"method"}]}},"NgEntityServiceGlobalConfig":{"__symbolic":"interface"},"NG_ENTITY_SERVICE_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":16,"character":44},"arguments":["NgEntityServiceGlobalConfig"]},"defaultConfig":{"httpMethods":{"GET":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"GET"},"POST":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"POST"},"PATCH":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"PATCH"},"PUT":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"PUT"},"DELETE":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"DELETE"}}},"mergeDeep":{"__symbolic":"function"},"NgEntityServiceConfig":{"__symbolic":"function","parameters":["config"],"defaults":[{}],"value":{"__symbolic":"error","message":"Lambda not supported","line":47,"character":9,"module":"./lib/ng-entity-service.config"}},"HttpMethod":{"GET":"GET","POST":"POST","PUT":"PUT","PATCH":"PATCH","DELETE":"DELETE"},"ActionType":{"__symbolic":"interface"},"EntityServiceAction":{"__symbolic":"interface"},"ofType":{"__symbolic":"error","message":"Lambda not supported","line":22,"character":22,"module":"./lib/ng-entity-service-notifier"},"filterMethod":{"__symbolic":"error","message":"Lambda not supported","line":24,"character":28,"module":"./lib/ng-entity-service-notifier"},"filterStore":{"__symbolic":"error","message":"Lambda not supported","line":27,"character":27,"module":"./lib/ng-entity-service-notifier"},"NgEntityServiceNotifier":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":29,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}},"isID":{"__symbolic":"function","parameters":["idOrConfig"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@datorama/akita","name":"isNumber","line":3,"character":9},"arguments":[{"__symbolic":"reference","name":"idOrConfig"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@datorama/akita","name":"isString","line":3,"character":33},"arguments":[{"__symbolic":"reference","name":"idOrConfig"}]}}},"NgEntityServiceParams":{"__symbolic":"interface"},"Msg":{"__symbolic":"interface"},"HttpConfig":{"__symbolic":"interface"},"HttpGetConfig":{"__symbolic":"interface"},"HttpAddConfig":{"__symbolic":"interface"},"HttpUpdateConfig":{"__symbolic":"interface"},"HttpDeleteConfig":{"__symbolic":"interface"},"NgEntityServiceLoader":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}],"loadersFor":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}},"successAction":{"__symbolic":"function","parameters":["storeName","notifier"],"value":{"__symbolic":"error","message":"Lambda not supported","line":6,"character":9,"module":"./lib/action-factory"}},"errorAction":{"__symbolic":"function","parameters":["storeName","notifier"],"value":{"__symbolic":"error","message":"Lambda not supported","line":21,"character":9,"module":"./lib/action-factory"}}},"origins":{"mapResponse":"./lib/ng-entity.service","NgEntityService":"./lib/ng-entity.service","NgEntityServiceGlobalConfig":"./lib/ng-entity-service.config","NG_ENTITY_SERVICE_CONFIG":"./lib/ng-entity-service.config","defaultConfig":"./lib/ng-entity-service.config","mergeDeep":"./lib/ng-entity-service.config","NgEntityServiceConfig":"./lib/ng-entity-service.config","HttpMethod":"./lib/ng-entity-service-notifier","ActionType":"./lib/ng-entity-service-notifier","EntityServiceAction":"./lib/ng-entity-service-notifier","ofType":"./lib/ng-entity-service-notifier","filterMethod":"./lib/ng-entity-service-notifier","filterStore":"./lib/ng-entity-service-notifier","NgEntityServiceNotifier":"./lib/ng-entity-service-notifier","isID":"./lib/helpers","NgEntityServiceParams":"./lib/types","Msg":"./lib/types","HttpConfig":"./lib/types","HttpGetConfig":"./lib/types","HttpAddConfig":"./lib/types","HttpUpdateConfig":"./lib/types","HttpDeleteConfig":"./lib/types","NgEntityServiceLoader":"./lib/ng-entity-service.loader","successAction":"./lib/action-factory","errorAction":"./lib/action-factory"},"importAs":"@datorama/akita-ng-entity-service"} | ||
{"__symbolic":"module","version":4,"metadata":{"mapResponse":{"__symbolic":"error","message":"Lambda not supported","line":12,"character":27,"module":"./lib/ng-entity.service"},"NgEntityService":{"__symbolic":"class","arity":1,"extends":{"__symbolic":"reference","module":"@datorama/akita","name":"EntityService","line":14,"character":66},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"EntityStore","module":"@datorama/akita","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":34,"character":52,"context":{"typeName":"S"},"module":"./lib/ng-entity.service"}]},{"__symbolic":"reference","name":"NgEntityServiceParams"}]}],"setBaseUrl":[{"__symbolic":"method"}],"getHttp":[{"__symbolic":"method"}],"getConfig":[{"__symbolic":"method"}],"get":[{"__symbolic":"method"},{"__symbolic":"method"},{"__symbolic":"method"}],"add":[{"__symbolic":"method"}],"update":[{"__symbolic":"method"}],"delete":[{"__symbolic":"method"}],"getHttpMethod":[{"__symbolic":"method"}],"getDecoratorValue":[{"__symbolic":"method"}],"getDecoratorConfig":[{"__symbolic":"method"}],"resolveUrl":[{"__symbolic":"method"}],"handleError":[{"__symbolic":"method"}]}},"NgEntityServiceGlobalConfig":{"__symbolic":"interface"},"NG_ENTITY_SERVICE_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":16,"character":44},"arguments":["NgEntityServiceGlobalConfig"]},"defaultConfig":{"httpMethods":{"GET":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"GET"},"POST":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"POST"},"PATCH":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"PATCH"},"PUT":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"PUT"},"DELETE":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"HttpMethod"},"member":"DELETE"}}},"mergeDeep":{"__symbolic":"function"},"NgEntityServiceConfig":{"__symbolic":"function","parameters":["config"],"defaults":[{}],"value":{"__symbolic":"error","message":"Lambda not supported","line":47,"character":9,"module":"./lib/ng-entity-service.config"}},"HttpMethod":{"GET":"GET","POST":"POST","PUT":"PUT","PATCH":"PATCH","DELETE":"DELETE"},"ActionType":{"__symbolic":"interface"},"EntityServiceAction":{"__symbolic":"interface"},"ofType":{"__symbolic":"error","message":"Lambda not supported","line":22,"character":22,"module":"./lib/ng-entity-service-notifier"},"filterMethod":{"__symbolic":"error","message":"Lambda not supported","line":24,"character":28,"module":"./lib/ng-entity-service-notifier"},"filterStore":{"__symbolic":"error","message":"Lambda not supported","line":27,"character":27,"module":"./lib/ng-entity-service-notifier"},"NgEntityServiceNotifier":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":29,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"isID":{"__symbolic":"function","parameters":["idOrConfig"],"value":{"__symbolic":"binop","operator":"||","left":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@datorama/akita","name":"isNumber","line":3,"character":9},"arguments":[{"__symbolic":"reference","name":"idOrConfig"}]},"right":{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@datorama/akita","name":"isString","line":3,"character":33},"arguments":[{"__symbolic":"reference","name":"idOrConfig"}]}}},"NgEntityServiceParams":{"__symbolic":"interface"},"Msg":{"__symbolic":"interface"},"HttpConfig":{"__symbolic":"interface"},"HttpGetConfig":{"__symbolic":"interface"},"HttpAddConfig":{"__symbolic":"interface"},"HttpUpdateConfig":{"__symbolic":"interface"},"HttpDeleteConfig":{"__symbolic":"interface"},"NgEntityServiceLoader":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}],"loadersFor":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"successAction":{"__symbolic":"function","parameters":["storeName","notifier"],"value":{"__symbolic":"error","message":"Lambda not supported","line":6,"character":9,"module":"./lib/action-factory"}},"errorAction":{"__symbolic":"function","parameters":["storeName","notifier"],"value":{"__symbolic":"error","message":"Lambda not supported","line":21,"character":9,"module":"./lib/action-factory"}}},"origins":{"mapResponse":"./lib/ng-entity.service","NgEntityService":"./lib/ng-entity.service","NgEntityServiceGlobalConfig":"./lib/ng-entity-service.config","NG_ENTITY_SERVICE_CONFIG":"./lib/ng-entity-service.config","defaultConfig":"./lib/ng-entity-service.config","mergeDeep":"./lib/ng-entity-service.config","NgEntityServiceConfig":"./lib/ng-entity-service.config","HttpMethod":"./lib/ng-entity-service-notifier","ActionType":"./lib/ng-entity-service-notifier","EntityServiceAction":"./lib/ng-entity-service-notifier","ofType":"./lib/ng-entity-service-notifier","filterMethod":"./lib/ng-entity-service-notifier","filterStore":"./lib/ng-entity-service-notifier","NgEntityServiceNotifier":"./lib/ng-entity-service-notifier","isID":"./lib/helpers","NgEntityServiceParams":"./lib/types","Msg":"./lib/types","HttpConfig":"./lib/types","HttpGetConfig":"./lib/types","HttpAddConfig":"./lib/types","HttpUpdateConfig":"./lib/types","HttpDeleteConfig":"./lib/types","NgEntityServiceLoader":"./lib/ng-entity-service.loader","successAction":"./lib/action-factory","errorAction":"./lib/action-factory"},"importAs":"@datorama/akita-ng-entity-service"} |
@@ -5,4 +5,5 @@ export * from './lib/ng-entity.service'; | ||
export * from './lib/helpers'; | ||
export * from './lib/types'; | ||
export * from './lib/ng-entity-service.loader'; | ||
export * from './lib/action-factory'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { Subject } from 'rxjs'; | ||
@@ -17,3 +16,3 @@ import { Injectable } from '@angular/core'; | ||
export const filterStore = (name) => filter((action) => action.storeName === name); | ||
let NgEntityServiceNotifier = class NgEntityServiceNotifier { | ||
export class NgEntityServiceNotifier { | ||
constructor() { | ||
@@ -26,8 +25,7 @@ this.dispatcher = new Subject(); | ||
} | ||
}; | ||
NgEntityServiceNotifier.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier = tslib_1.__decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceNotifier); | ||
export { NgEntityServiceNotifier }; | ||
} | ||
NgEntityServiceNotifier.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
//# sourceMappingURL=ng-entity-service-notifier.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"HttpMethod":{"GET":"GET","POST":"POST","PUT":"PUT","PATCH":"PATCH","DELETE":"DELETE"},"ActionType":{"__symbolic":"interface"},"EntityServiceAction":{"__symbolic":"interface"},"ofType":{"__symbolic":"error","message":"Lambda not supported","line":22,"character":22},"filterMethod":{"__symbolic":"error","message":"Lambda not supported","line":24,"character":28},"filterStore":{"__symbolic":"error","message":"Lambda not supported","line":27,"character":27},"NgEntityServiceNotifier":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":29,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"HttpMethod":{"GET":"GET","POST":"POST","PUT":"PUT","PATCH":"PATCH","DELETE":"DELETE"},"ActionType":{"__symbolic":"interface"},"EntityServiceAction":{"__symbolic":"interface"},"ofType":{"__symbolic":"error","message":"Lambda not supported","line":22,"character":22},"filterMethod":{"__symbolic":"error","message":"Lambda not supported","line":24,"character":28},"filterStore":{"__symbolic":"error","message":"Lambda not supported","line":27,"character":27},"NgEntityServiceNotifier":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":29,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}}}] |
@@ -1,2 +0,1 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { Subject } from 'rxjs'; | ||
@@ -8,3 +7,3 @@ import { Injectable } from '@angular/core'; | ||
import * as i0 from "@angular/core"; | ||
let NgEntityServiceLoader = class NgEntityServiceLoader { | ||
export class NgEntityServiceLoader { | ||
constructor() { | ||
@@ -34,8 +33,7 @@ this.dispatcher = new Subject(); | ||
} | ||
}; | ||
NgEntityServiceLoader.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader = tslib_1.__decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceLoader); | ||
export { NgEntityServiceLoader }; | ||
} | ||
NgEntityServiceLoader.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
//# sourceMappingURL=ng-entity-service.loader.js.map |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"NgEntityServiceLoader":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}],"loadersFor":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"NgEntityServiceLoader":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":8,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"dispatch":[{"__symbolic":"method"}],"loadersFor":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}}}] |
@@ -103,3 +103,3 @@ import { HttpClient } from '@angular/common/http'; | ||
}); | ||
const configWithBody = Object.assign({}, config, { body: entity }); | ||
const configWithBody = Object.assign(Object.assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap((responseEntity) => { | ||
@@ -138,3 +138,3 @@ if (!config || (config && !config.skipWrite)) { | ||
}); | ||
const configWithBody = Object.assign({}, config, { body: entity }); | ||
const configWithBody = Object.assign(Object.assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap((responseEntity) => { | ||
@@ -141,0 +141,0 @@ if (!config || (config && !config.skipWrite)) { |
@@ -0,1 +1,2 @@ | ||
export {}; | ||
//# sourceMappingURL=types.js.map |
@@ -5,4 +5,5 @@ export * from './lib/ng-entity.service'; | ||
export * from './lib/helpers'; | ||
export * from './lib/types'; | ||
export * from './lib/ng-entity-service.loader'; | ||
export * from './lib/action-factory'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { Subject } from 'rxjs'; | ||
@@ -27,6 +26,6 @@ import { Injectable } from '@angular/core'; | ||
}; | ||
NgEntityServiceNotifier.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier = tslib_1.__decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceNotifier); | ||
NgEntityServiceNotifier.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
return NgEntityServiceNotifier; | ||
@@ -33,0 +32,0 @@ }()); |
@@ -1,2 +0,2 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { __read, __spread } from "tslib"; | ||
import { InjectionToken } from '@angular/core'; | ||
@@ -16,2 +16,3 @@ import { HttpMethod } from './ng-entity-service-notifier'; | ||
export function mergeDeep(target) { | ||
var _a, _b; | ||
var sources = []; | ||
@@ -21,3 +22,2 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
} | ||
var _a, _b; | ||
if (!sources.length) | ||
@@ -38,3 +38,3 @@ return target; | ||
} | ||
return mergeDeep.apply(void 0, tslib_1.__spread([target], sources)); | ||
return mergeDeep.apply(void 0, __spread([target], sources)); | ||
} | ||
@@ -41,0 +41,0 @@ export function NgEntityServiceConfig(config) { |
@@ -1,2 +0,1 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { Subject } from 'rxjs'; | ||
@@ -44,6 +43,6 @@ import { Injectable } from '@angular/core'; | ||
}; | ||
NgEntityServiceLoader.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader = tslib_1.__decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceLoader); | ||
NgEntityServiceLoader.ɵprov = i0.ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
return NgEntityServiceLoader; | ||
@@ -50,0 +49,0 @@ }()); |
@@ -1,2 +0,2 @@ | ||
import * as tslib_1 from "tslib"; | ||
import { __assign, __extends } from "tslib"; | ||
import { HttpClient } from '@angular/common/http'; | ||
@@ -14,3 +14,3 @@ import { inject } from '@angular/core'; | ||
var NgEntityService = /** @class */ (function (_super) { | ||
tslib_1.__extends(NgEntityService, _super); | ||
__extends(NgEntityService, _super); | ||
function NgEntityService(store, config) { | ||
@@ -39,3 +39,3 @@ if (config === void 0) { config = {}; } | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -47,3 +47,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -76,3 +76,3 @@ }); | ||
if (isSingle) { | ||
_this.store.upsert(entityId, data, function (id, newState) { return (tslib_1.__assign({ id: id }, newState)); }); | ||
_this.store.upsert(entityId, data, function (id, newState) { return (__assign({ id: id }, newState)); }); | ||
} | ||
@@ -121,3 +121,3 @@ else { | ||
}); | ||
var configWithBody = tslib_1.__assign({}, config, { body: entity }); | ||
var configWithBody = __assign(__assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap(function (responseEntity) { | ||
@@ -157,3 +157,3 @@ if (!config || (config && !config.skipWrite)) { | ||
}); | ||
var configWithBody = tslib_1.__assign({}, config, { body: entity }); | ||
var configWithBody = __assign(__assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap(function (responseEntity) { | ||
@@ -160,0 +160,0 @@ if (!config || (config && !config.skipWrite)) { |
@@ -0,1 +1,2 @@ | ||
export {}; | ||
//# sourceMappingURL=types.js.map |
@@ -6,3 +6,2 @@ import { HttpClient } from '@angular/common/http'; | ||
import { filter, map, tap, catchError, finalize } from 'rxjs/operators'; | ||
import { __decorate } from 'tslib'; | ||
@@ -47,3 +46,3 @@ function successAction(storeName, notifier) { | ||
const filterStore = (name) => filter((action) => action.storeName === name); | ||
let NgEntityServiceNotifier = class NgEntityServiceNotifier { | ||
class NgEntityServiceNotifier { | ||
constructor() { | ||
@@ -56,7 +55,7 @@ this.dispatcher = new Subject(); | ||
} | ||
}; | ||
NgEntityServiceNotifier.ngInjectableDef = ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier = __decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceNotifier); | ||
} | ||
NgEntityServiceNotifier.ɵprov = ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
@@ -102,3 +101,3 @@ const NG_ENTITY_SERVICE_CONFIG = new InjectionToken('NgEntityServiceGlobalConfig'); | ||
let NgEntityServiceLoader = class NgEntityServiceLoader { | ||
class NgEntityServiceLoader { | ||
constructor() { | ||
@@ -128,7 +127,7 @@ this.dispatcher = new Subject(); | ||
} | ||
}; | ||
NgEntityServiceLoader.ngInjectableDef = ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader = __decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceLoader); | ||
} | ||
NgEntityServiceLoader.ɵprov = ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
@@ -227,3 +226,3 @@ const mapResponse = (config) => map((res) => (config && !!config.mapResponseFn ? config.mapResponseFn(res) : res)); | ||
}); | ||
const configWithBody = Object.assign({}, config, { body: entity }); | ||
const configWithBody = Object.assign(Object.assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap((responseEntity) => { | ||
@@ -262,3 +261,3 @@ if (!config || (config && !config.skipWrite)) { | ||
}); | ||
const configWithBody = Object.assign({}, config, { body: entity }); | ||
const configWithBody = Object.assign(Object.assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap((responseEntity) => { | ||
@@ -265,0 +264,0 @@ if (!config || (config && !config.skipWrite)) { |
@@ -1,2 +0,2 @@ | ||
import { __decorate, __spread, __extends, __assign } from 'tslib'; | ||
import { __spread, __extends, __assign } from 'tslib'; | ||
import { HttpClient } from '@angular/common/http'; | ||
@@ -58,6 +58,6 @@ import { ɵɵdefineInjectable, Injectable, InjectionToken, inject } from '@angular/core'; | ||
}; | ||
NgEntityServiceNotifier.ngInjectableDef = ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier = __decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceNotifier); | ||
NgEntityServiceNotifier.ɵprov = ɵɵdefineInjectable({ factory: function NgEntityServiceNotifier_Factory() { return new NgEntityServiceNotifier(); }, token: NgEntityServiceNotifier, providedIn: "root" }); | ||
NgEntityServiceNotifier.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
return NgEntityServiceNotifier; | ||
@@ -77,2 +77,3 @@ }()); | ||
function mergeDeep(target) { | ||
var _a, _b; | ||
var sources = []; | ||
@@ -82,3 +83,2 @@ for (var _i = 1; _i < arguments.length; _i++) { | ||
} | ||
var _a, _b; | ||
if (!sources.length) | ||
@@ -149,6 +149,6 @@ return target; | ||
}; | ||
NgEntityServiceLoader.ngInjectableDef = ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader = __decorate([ | ||
Injectable({ providedIn: 'root' }) | ||
], NgEntityServiceLoader); | ||
NgEntityServiceLoader.ɵprov = ɵɵdefineInjectable({ factory: function NgEntityServiceLoader_Factory() { return new NgEntityServiceLoader(); }, token: NgEntityServiceLoader, providedIn: "root" }); | ||
NgEntityServiceLoader.decorators = [ | ||
{ type: Injectable, args: [{ providedIn: 'root' },] } | ||
]; | ||
return NgEntityServiceLoader; | ||
@@ -183,3 +183,3 @@ }()); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -191,3 +191,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -264,3 +264,3 @@ }); | ||
}); | ||
var configWithBody = __assign({}, config, { body: entity }); | ||
var configWithBody = __assign(__assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap(function (responseEntity) { | ||
@@ -300,3 +300,3 @@ if (!config || (config && !config.skipWrite)) { | ||
}); | ||
var configWithBody = __assign({}, config, { body: entity }); | ||
var configWithBody = __assign(__assign({}, config), { body: entity }); | ||
return this.http.request(method, url, configWithBody).pipe(mapResponse(config), tap(function (responseEntity) { | ||
@@ -303,0 +303,0 @@ if (!config || (config && !config.skipWrite)) { |
@@ -17,3 +17,3 @@ import { Msg } from './types'; | ||
export declare const ofType: (type: ActionType) => import("rxjs").MonoTypeOperatorFunction<EntityServiceAction>; | ||
export declare const filterMethod: (method: HttpMethod | "GET" | "POST" | "PUT" | "PATCH" | "DELETE") => import("rxjs").MonoTypeOperatorFunction<EntityServiceAction>; | ||
export declare const filterMethod: (method: HttpMethod | keyof (typeof HttpMethod)) => import("rxjs").MonoTypeOperatorFunction<EntityServiceAction>; | ||
export declare const filterStore: (name: string) => import("rxjs").MonoTypeOperatorFunction<EntityServiceAction>; | ||
@@ -20,0 +20,0 @@ export declare class NgEntityServiceNotifier { |
@@ -8,3 +8,3 @@ import { HttpClient } from '@angular/common/http'; | ||
import { HttpAddConfig, HttpConfig, HttpDeleteConfig, HttpGetConfig, HttpUpdateConfig, NgEntityServiceParams } from './types'; | ||
export declare const mapResponse: <T>(config?: HttpConfig<T>) => import("rxjs").OperatorFunction<{}, {}>; | ||
export declare const mapResponse: <T>(config?: HttpConfig<T>) => import("rxjs").OperatorFunction<unknown, unknown>; | ||
export declare class NgEntityService<S extends EntityState = any> extends EntityService<S> { | ||
@@ -22,4 +22,4 @@ protected readonly store: EntityStore<S>; | ||
constructor(store: EntityStore<S>, config?: NgEntityServiceParams); | ||
readonly api: string; | ||
readonly resourceName: string; | ||
get api(): string; | ||
get resourceName(): string; | ||
setBaseUrl(baseUrl: string): void; | ||
@@ -26,0 +26,0 @@ getHttp(): HttpClient; |
{ | ||
"name": "@datorama/akita-ng-entity-service", | ||
"version": "5.1.1", | ||
"version": "6.0.0", | ||
"description": "Akita entity service", | ||
@@ -21,6 +21,7 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@datorama/akita": ">= 5.0.0", | ||
"@datorama/akita": ">= 6.0.0", | ||
"rxjs": ">= 6.1.0 < 7", | ||
"@angular/core": ">= 8.0.0", | ||
"rxjs": ">= 6.1.0 < 7", | ||
"tslib": ">= 1.7.0 < 2" | ||
"@angular/common": ">= 8.0.0", | ||
"tslib": "^2.0.0" | ||
}, | ||
@@ -27,0 +28,0 @@ "main": "bundles/datorama-akita-ng-entity-service.umd.js", |
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
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
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
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
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
340150
2579
5