New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@farris/bef

Package Overview
Dependencies
Maintainers
17
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@farris/bef - npm Package Compare versions

Comparing version 0.0.12-20200904172208-dev to 0.0.12-20200908200114-dev

2

bundles/farris-bef.umd.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@ecp-caf/caf-common"),require("date-fns"),require("rxjs"),require("rxjs/operators"),require("rxjs/operators/map"),require("@angular/core"),require("@farris/devkit"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@farris/bef",["exports","@ecp-caf/caf-common","date-fns","rxjs","rxjs/operators","rxjs/operators/map","@angular/core","@farris/devkit","@angular/common/http"],t):t((e.farris=e.farris||{},e.farris.bef={}),e.cafCommon,e.dateFns,e.rxjs,e.rxjs.operators,e.rxjs["operators/map"],e.ng.core,e.devkit,e.ng.common.http)}(this,function(e,t,n,d,l,s,o,I,a){"use strict";var S=(r.Added="Added",r.Modify="Modify",r.Deleted="Deleted",r);function r(){}var p=new o.InjectionToken("@farris/be BE_SERVER_URL"),u=new o.InjectionToken("@farris/be BE_SESSION_HANDLING_STRATEGY_TOKEN"),b=(i.getPropInfo=function(e,t){var r,n,i,o=I.FieldMetadataUtil.getNgFields(e);Object.keys(o).forEach(function(e){e===t&&(r="NgField",n=null,i=o[e])});var a=I.FieldMetadataUtil.getNgObjects(e);Object.keys(a).forEach(function(e){e===t&&(r="NgObject",n=a[e].type,i=a[e])});var s=I.FieldMetadataUtil.getNgList(e);Object.keys(s).forEach(function(e){e===t&&(r="NgList",n=s[e].type,i=s[e])});var p=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(p).forEach(function(e){e===t&&(r="NgDynamic",n=p[e].type,i=p[e])}),{propType:r,propEntityType:n,propMetadata:i}},i.getPrimaryKey=function(e){var t=I.FieldMetadataUtil.getPrimaryFieldMetadata(e);return t?t.dataField:""},i.isObjectProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgObjects(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},i.isDynamicProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},i.appendInitialData=function(e,t){var r=Object.assign({},t);delete r.id,delete r.parentID,e.initialData=r},i);function i(){}var c=(y.prototype.build=function(e){var t=this;return this.changeDetail={ChangeType:S.Modify,ChangeInfo:{DataId:""}},e.forEach(function(e){t.buildChangeDetail(e)}),this.changeDetail},y.prototype.buildChangeDetail=function(l){var d=l.path.concat();this.changeDetail.ChangeInfo.DataId||(this.changeDetail.ChangeInfo.DataId=d[0].split(":")[1]);for(var f=this.changeDetail,g=this.entityType,e=function(e){var t=v.getChangeInfo(f),r=d[e],n=b.getPropInfo(g,r),i=n.propType,o=n.propEntityType,a=n.propMetadata.dataField||r;if("NgField"===i){if(r===b.getPrimaryKey(g))return"continue";if(l.type!==I.ModifyType.ValueChange)throw Error("简单类型的属性上不支持ValueChange类型之外的变更");t[a]=l.value,f=null}else if("NgObject"===i)if(d[e+1].split(":")[1],d[e+1].split(":")[0]){var s=t[a],p=d.slice(0,e+1);s=(h=v.entityCollection.getEntityByPath(p))?h.toJSON():{},t[a]=s,g=f=null}else c=(c=t[a])||{ChangeType:S.Modify,ChangeInfo:{}},t[a]=c,f=c,g=o;else if("NgList"===i){f.ChangeInfo[a]||(f.ChangeInfo[a]=[]);var u=f.ChangeInfo[a];if(e!==d.length-1){var c,y=d[e+1].split(":")[1];return(c=u.find(function(e){return e.ChangeInfo.DataId===y}))||(c=v.createEmptyChangeDetail(S.Modify,y),u.push(c)),f=c,g=o,"continue"}l.type===I.ModifyType.Add||l.type===I.ModifyType.Insert||(l.type,I.ModifyType.Remove),g=f=null}else if("NgDynamic"===i){p=d.slice(0,e+1);var h=v.entityCollection.getEntityByPath(p);t[a]={ChangeType:S.Modify,ChangeInfo:h?h.toJSON():{}},g=f=null}},v=this,t=1;t<d.length&&f;t+=2)e(t)},y.prototype.getChangeInfo=function(e){return e.hasOwnProperty("ChangeInfo")?e.ChangeInfo:e},y.prototype.createEmptyChangeDetail=function(e,t){return{ChangeType:e,ChangeInfo:{DataId:t}}},y);function y(e,t){this.entityType=e,this.entityCollection=t}var h=(f.prototype.handle=function(e,t,r){this.handleChangeDetails(e,t,r)},f.prototype.handleChangeDetails=function(n,i,e){var o=this;e&&e.forEach(function(e){var t=e.ChangeInfo.dataId||e.ChangeInfo.DataId,r=o.getEntityById(i,t);r&&o.handleChangeDetail(n,r,e)})},f.prototype.handleChangeDetail=function(u,c,e){var y=this;if(e&&c&&e.ChangeType===S.Modify){var h=e.ChangeInfo;Object.keys(h).forEach(function(e){var t=b.getPropInfo(u,e),r=t.propType,n=t.propEntityType;if("NgField"===r)c[e]=h[e];else if("NgObject"===r){var i=c[e];if(i.primaryKey){var o=h[e];i.load(o)}else{var a=h[e];y.handleChangeDetail(n,i,a)}}else if("NgList"===r){var s=c[e],p=h[e];y.handleChangeDetails(n,s,p)}})}},f.prototype.getEntityById=function(e,t){return(e instanceof I.EntityCollection?e.getEntityById(t):e.get(t))||null},f);function f(){}var g=(v.prototype.getUserSessionId=function(){return this.sessionService.getUserSessionId()},v.prototype.getCurrentSessionId=function(){var e;return this.sessionService&&(e=this.sessionService.getCurrentSeesionId()),e=e||this.getUserSessionId()},v.decorators=[{type:o.Injectable}],v.ctorParameters=function(){return[{type:t.SessionService,decorators:[{type:o.Optional}]}]},v);function v(e){this.sessionService=e}var C=(m.prototype.getItem=function(e){return this.getAllBeSessions()[e]},m.prototype.setItem=function(e,t){var r=this.getAllBeSessions();r[e]=t,this.setAllBeSessions(r)},m.prototype.removeItem=function(e){var t=this.getAllBeSessions();t[e]&&delete t[e],this.setAllBeSessions(t)},m.prototype.clear=function(e,t){!0===this.isInFramework()?this.removeItemsByFrmSessionId(e):this.removeItem(t)},m.prototype.removeItemsByFrmSessionId=function(t){var r=this.getAllBeSessions();Object.keys(r).forEach(function(e){!0===e.startsWith(t)&&delete r[e]}),this.setAllBeSessions(r)},m.prototype.getAllBeSessions=function(){var e=window.sessionStorage.getItem(this.sessionStorageKey);return e?JSON.parse(e):{}},m.prototype.setAllBeSessions=function(e){var t=JSON.stringify(e);window.sessionStorage.setItem(this.sessionStorageKey,t)},m.prototype.isInFramework=function(){var e=window.location.hash;return!!e&&-1!==e.indexOf("tabId=")},m);function m(){this.sessionStorageKey="BE_SESSION_ID"}var E=function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function x(e,t){function r(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function B(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function P(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o["return"])&&r.call(o)}finally{if(i)throw i.error}}return a}function R(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(P(arguments[t]));return e}var D=(q.convertToHeaders=function(t){if(1==(t=t||new a.HttpHeaders)instanceof a.HttpHeaders)return t;if(0<Object.keys(t).length){var r=new a.HttpHeaders;Object.keys(t).forEach(function(e){r=r.append(e,t[e])}),t=r}else t=new a.HttpHeaders;return t},q.appendSessionId=function(e,t){return e.append("SessionId",t)},q.appendCafRuntimeCommonVariable=function(e,t){return e.append("X-CAF-Runtime-CommonVariable",t)},q.appendCafRuntimeContext=function(e,t){return e.append("X-CAF-Runtime-Context",t)},q.appendContextType=function(e,t){return t=t||"application/json",e.append("Content-Type",t)},q.appendRequireMessage=function(e,t){return void 0===t&&(t=!0),e.append("Bff-Require-Message",t.toString())},q.toJson=function(r){if(!(r instanceof a.HttpHeaders))return null;var n={};return r.keys().forEach(function(e){var t=r.getAll(e);1<t.length?n[e]=t:n[e]=t[0]||""}),n},q);function q(){}var O=(w.buildParams=function(e){var t=new a.HttpParams;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r].toString();t=t.append(r,n)}return t},w);function w(){}var T=(j.hasRequestInfo=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.requestInfo||!t.requestInfo.dataChange)||!!t.dataChange},j.hasRequestInfoWithR=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.RequestInfo||!t.RequestInfo.dataChange)||!!t.dataChange},j.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},j.buildBodyWithRequestInfo=function(e,t){if(e.RequestInfo||e.requestInfo)return e;var r=this.buildRequestInfo(t);return Object.assign({},e,{requestInfo:r})},j);function j(){}var U=(M.unWrapResponseInfo=function(e){if(!e)return e;if(!1===e.hasOwnProperty("returnValue"))return e.hasOwnProperty("result")&&e.hasOwnProperty("pagination")?e.result:e;var t=e.returnValue;return t&&t.hasOwnProperty("result")&&t.hasOwnProperty("pagination")?t.result:e.returnValue},M);function M(){}var A=(H.prototype.getService=function(){var e=window;try{for(;!e.gspframeworkService&&e!==e.parent&&this.isSameOrigin(e.parent);)e=window.parent}catch(t){}return e.gspframeworkService&&e.gspframeworkService.rtf||{}},H.prototype.isSameOrigin=function(e){var t=window.location.host;try{if(e&&e.location&&"undefined"!=typeof e.location.host)return e.location.host===t}catch(r){return!1}return!1},Object.defineProperty(H.prototype,"params",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("session")&&"function"==typeof this.rtf.session.getCommonVariable?this.rtf.session.getCommonVariable():null},enumerable:!0,configurable:!0}),Object.defineProperty(H.prototype,"httpService",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("http")&&"function"==typeof this.rtf.http.request?this.rtf.http:null},enumerable:!0,configurable:!0}),H.prototype.request=function(e,t,r){return void 0===r&&(r={}),this.defaultHttpClient.request(e,t,r)},H.decorators=[{type:o.Injectable}],H.ctorParameters=function(){return[{type:a.HttpClient}]},H);function H(e){this.defaultHttpClient=e,this.httpClient=e,this.rtf=this.getService()}var V=(Object.defineProperty(k.prototype,"frmSessionId",{get:function(){return this.frmSessionService.getCurrentSessionId()},enumerable:!0,configurable:!0}),k.prototype.getFrameworkSessionId=function(){return this.frmSessionId},k.prototype.getSessionIdFromStorage=function(){var e=this.getSessionStorageKey();return this.storageStrategy.getItem(e)},k);function k(e,t){this.storageStrategy=e,this.frmSessionService=t}var N,F=(x(_,N=V),_.prototype.getSessionId=function(){var e=this.getSessionIdFromStorage();return e?d.of(e):this.createSession()},_.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},_.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.clear(this.frmSessionId,e)},_.prototype.extendRequestHeaders=function(e){var t=this.getFrameworkSessionId(),r=this.getSessionIdFromStorage();return e=D.appendCafRuntimeCommonVariable(e,t),e=D.appendCafRuntimeContext(e,r),e=D.appendSessionId(e,r)},_.prototype.handleReponseHeaders=function(e){console.log(e)},_.prototype.createSession=function(){var t=this,e={responseType:"text"};return this.frmSessionId&&(e.headers=new a.HttpHeaders({SessionId:this.frmSessionId}),e.headers=e.headers.append("X-CAF-Runtime-CommonVariable",this.frmSessionId),e.headers=D.toJson(e.headers)),this.httpService.request("POST",this.beSessionUri,e).pipe(l.tap(function(e){t.setSessionId(e)}))},_.prototype.extendHttpHeader=function(){},_.prototype.getSessionStorageKey=function(){return this.frmSessionId+"_"+this.beSessionUri},_);function _(e,t,r,n){var i=N.call(this,e,t)||this;return i.beSessionUri=n,i.httpClient=r,i.httpService=new A(i.httpClient),i}var L,K=(x(W,L=V),W.prototype.getSessionId=function(){var e=this.getSessionStorageKey(),t=this.storageStrategy.getItem(e);return d.of(t)},W.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},W.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.removeItem(e)},W.prototype.extendRequestHeaders=function(e){var t=this.getFrameworkSessionId(),r=this.getSessionIdFromStorage();return e=D.appendCafRuntimeCommonVariable(e,t),r&&(e=D.appendCafRuntimeContext(e,r)),e},W.prototype.handleReponseHeaders=function(e){console.log(e)},W.prototype.getSessionStorageKey=function(){return this.frmSessionId+"_"+window.location.hash},W);function W(e,t,r){var n=L.call(this,e,t)||this;return n.beSessionUri=r,n}var G=(J.prototype.create=function(e,t,r,n){var i=this.createStorageStrategy(),o=this.createBeSessionUri(r);return"UnifiedSession"===e?new K(i,t,o):new F(i,t,n,o)},J.prototype.createStorageStrategy=function(){return new C},J.prototype.createBeSessionUri=function(e){return e+"/service/createsession"},J.decorators=[{type:o.Injectable}],J);function J(){}var z=(Object.defineProperty(Q.prototype,"token",{get:function(){return this.handlingStrategy.getFrameworkSessionId()},enumerable:!0,configurable:!0}),Q.prototype.getBeSessionId=function(){return this.handlingStrategy.getSessionId()},Q.prototype.setBeSessionId=function(e){this.handlingStrategy.setSessionId(e)},Q.prototype.clearBeSessionId=function(){this.handlingStrategy.clearSessionId()},Q.prototype.extendRequestHeaders=function(e){return this.handlingStrategy.extendRequestHeaders(e)},Q.prototype.handleResponseHeaders=function(e){return this.handlingStrategy.handleReponseHeaders(e)},Q.prototype.createBeSession=function(){return this.handlingStrategy.createSession()},Q.prototype.createHandlingStrategy=function(e,t,r,n){var i;return i=(i=e?e.get(u,null,o.InjectFlags.Optional):"SeparatedSession")||"SeparatedSession",(new G).create(i,r,n,t)},Q.decorators=[{type:o.Injectable}],Q.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:g},{type:o.Injector}]},Q);function Q(e,t,r,n){this.handlingStrategy=this.createHandlingStrategy(n,e,r,t)}var X,Y="@farris/bef NG_VARIABLE",Z=I.makePropDecorator(Y,function(e){return e}),$=(x(ee,X=I.Repository),Object.defineProperty(ee.prototype,"restService",{get:function(){return this.dataService.restService},enumerable:!0,configurable:!0}),Object.defineProperty(ee.prototype,"changeBuilder",{get:function(){return this.entityManager.changeBuilder},enumerable:!0,configurable:!0}),Object.defineProperty(ee.prototype,"changeHandler",{get:function(){return this.entityManager.changeHandler},enumerable:!0,configurable:!0}),ee.prototype.getList=function(){return this.dataService.getList(null,null,null,null)},ee.prototype.getById=function(e){return this.dataService.getById(e)},ee.prototype.updateById=function(e){return this.dataService.updateById(e)},ee.prototype.create=function(e){return this.dataService.create(e)},ee.prototype.append=function(e){return this.dataService.append(e)},ee.prototype.appendByPath=function(e){return this.dataService.appendByPath(e)},ee.prototype.removeById=function(e,t){return this.dataService.removeById(e,t)},ee.prototype.removeByIds=function(e,t){return this.dataService.removeByIds(e,t)},ee.prototype.removeByPath=function(e,t){return this.dataService.removeByPath(e,t)},ee.prototype.updateChangesById=function(e){return this.dataService.updateChangesById(e)},ee.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},ee.prototype.updateAllChanges=function(){return this.dataService.updateAllChanges()},ee.prototype.applyChanges=function(){return this.dataService.applyChanges()},ee.prototype.updateDataAndVariableChanges=function(){var e={FilterConditions:[],SortConditions:[],IsUsePagination:!0,Pagination:{PageIndex:1,PageSize:1,PageCount:0,TotalCount:0}},t=JSON.stringify(e),r=this.restService.buildRequestInfo();if(this.isEmptyRequestInfo(r))return d.of(null);var n=this.restService.baseUri+"/extension/query?entityFilter="+t,i={body:r};return this.restService.invoke(n,"PUT",null,i,!1,!0,!0)},ee.prototype.applyChangesById=function(e){return this.dataService.applyChangesById(e)},ee.prototype.cancelChanges=function(){return this.dataService.cancelChanges()},ee.prototype.clearAllEntityChanges=function(){return this.entityManager.clearAllEntityChanges()},ee.prototype.getDataChangeDetails=function(){return this.entityManager.buildAllEntityChangeDetails()},ee.prototype.handleDataChangeDetails=function(e){return this.entityManager.handleDataChangeDetails(e)},ee.prototype.getVariableChangeDetail=function(){return this.variableManager.buildChangeDetail()},ee.prototype.handleVariableChangeDetail=function(e){this.variableManager.handleChangeDetail(e)},ee.prototype.isEmptyRequestInfo=function(e){return!e||(!e.dataChange||e.dataChange.length<1)&&(!e.variableChange||Object.keys(e.variableChange).length<1)},ee.decorators=[{type:o.Injectable}],ee.ctorParameters=function(){return[]},ee);function ee(){return X.call(this)||this}var te,re=(x(ne,te=I.EntityManager),ne.prototype.buildAllEntityChangeDetails=function(){var r=this,n=[];return this.entityCollection.getAllEntities().forEach(function(e){if(0!==e.changes.length){var t=r.changeBuilder.build(e.changes);t&&t.ChangeInfo&&t.ChangeInfo.DataId&&n.push(t)}}),n},ne.prototype.buildEntityChangeDetailById=function(e){var t=this.entityCollection.getEntityById(e);return 0===t.changes.length?null:this.changeBuilder.build(t.changes)},ne.prototype.handleDataChangeDetails=function(e){this.changeHandler.handle(this.entityType,this.entityCollection,e)},ne.prototype.reset=function(){this.entityCollection.clear()},ne);function ne(e){var t=te.call(this,e)||this;return t.changeBuilder=new c(t.entityCollection.entityType,t.entityCollection),t.changeHandler=new h,t}var ie=(oe.createEmpty=function(e,t){var r={ChangeType:e,ChangeInfo:{}};return t&&(r.ChangeInfo.DataId=t),r},oe.getChangeInfo=function(e){return!0===this.isChangeDetail(e)?e.ChangeInfo:e},oe.isChangeDetail=function(e){var t=Object.keys(e);return 2===t.length&&-1<t.indexOf("ChangeType")&&-1<t.indexOf("ChangeInfo")},oe);function oe(){}var ae=(se.prototype.handleChangeDetail=function(e){},se.prototype.buildChangeDetail=function(){var o=this,a=ie.createEmpty(S.Modify);return this.ngVariableMap.forEach(function(e,t){var r=e.mapping,n=o.getValueFromUIState(r),i=o.innerValueMap.get(t);!1===o.isValueEqual(n,i)&&(o.innerValueMap.set(t,n),o.appendToChangeInfo(a,t,n))}),0===Object.keys(a.ChangeInfo).length?null:a},se.prototype.reset=function(){this.innerValueMap.clear()},se.prototype.appendToChangeInfo=function(e,t,r){if(!0===this.isUdtVariable(r)){var n=ie.createEmpty(S.Modify);n.ChangeInfo=r,e.ChangeInfo[t]=n}else e.ChangeInfo[t]=r},se.prototype.getValueFromUIState=function(e){var t=this.getRootUIState(),r=e.split(".").reduce(function(e,t){return e?e[t]:null},t);return r instanceof Date?n.format(r,"yyyy-MM-dd HH:mm:ss"):r},se.prototype.getRootUIState=function(){var e=this.appContext.frameContextManager.getRootFrameContext();if(this.injector){var t=this.injector.get(I.FrameContext,null);t&&(e=t.getVirtualRootFrameContext()||e)}if(e)return e.uiState},se.prototype.isValueEqual=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},se.prototype.isUdtVariable=function(e){return e&&e.constructor&&"[object Object]"===e.toString()&&e.constructor.prototype.hasOwnProperty("isPrototypeOf")},se.prototype.setValueToUIState=function(e,t){},se.ctorParameters=function(){return[{type:I.AppContext},{type:undefined},{type:o.Injector,decorators:[{type:o.Optional}]}]},se);function se(e,t,r){var n=this;this.appContext=e,this.ngVariables=t,this.injector=r,this.ngVariableMap=new Map,this.innerValueMap=new Map,Object.keys(t).forEach(function(e){n.ngVariableMap.set(e,t[e])})}var pe=(ue.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},ue);function ue(){}var ce=(ye.convertToPathArray=function(e,t){var n=this,r=I.BindingPathConverter.toBindingPathArray(e),i=[],o=t.list.currentItem;return i.push(o.primaryKeyValue),r.forEach(function(e){var t=I.PropertyUtil.getPropertyByName(o.properties,e);if(t.type!==I.BindingPropertyType.List)throw new Error(t.name+"不是子表对应的属性");var r=o[e];o=r.currentItem,i.push(n.trimTrailingS(e)),i.push(o.primaryKeyValue)}),i},ye.convertToPathUrl=function(e,t){var r=this.convertToPathArray(e,t);return r.pop(),"/"+r.join("/")},ye.convertToObjectCodes=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,i=[],o=1;o<n;o+=2)i.push(r[o]);return i},ye.convertToDataIdsForUpdate=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,i=[],o=0;o<n;o+=2)i.push(r[o]);return i},ye.convertToDataIdsForAdd=function(e,t){var r=this.convertToDataIdsForUpdate(e,t);return r.pop(),r},ye.convertPathToUrl=function(e){for(var t=e.split("/"),r=t.length-1;0<r;r--)t[r]&&t[r].endsWith("s")&&(t[r]=t[r].substr(0,t[r].length-1).toLowerCase());return t.join("/")},ye.trimTrailingS=function(e){return e.substr(0,e.length-1)},ye.convertPathsToNodeCodes=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1===e.indexOf(":")}).forEach(function(e){t.push(e)}),t},ye.convertPathsToIds=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1!==e.indexOf(":")}).forEach(function(e){t.push(e.split(":")[1])}),t},ye);function ye(){}var he=(Object.defineProperty(le.prototype,"restProxy",{get:function(){return this.repository.restService.proxy},enumerable:!0,configurable:!0}),le.prototype.getList=function(e,t,r,n){var p=this;0!==r&&(r=r||this.repository.entityCollection.pageSize,n=n||this.repository.entityCollection.pageIndex);var i=this.buildEntityFilter(e,t,r,n),o=this.restService.buildRequestInfo();return this.restService.extendQuery(i,o).pipe(l.map(function(e){var t=e.returnValue,r=t.result;p.repository.buildEntities(r);var n=[];r.forEach(function(e){var t=p.repository.buildEntity(e);b.appendInitialData(t,e),n.push(t)});var i=t.pagination;if(i&&0<Object.keys(i).length){var o=i.pageSize,a=i.pageIndex,s=i.totalCount;p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:a,pageSize:o,totalCount:s})}else p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:1,pageSize:0,totalCount:n.length});return p.repository.entityCollection.loadEntities(n),n}))},le.prototype.buildEntityFilter=function(e,t,r,n){return e||t||r||n?(e&&0<e.length&&(e[e.length-1].Relation=0),{FilterConditions:e,SortConditions:t,IsUsePagination:0!==r,Pagination:{PageIndex:n,PageSize:r,PageCount:0,TotalCount:0}}):null},le.prototype.getById=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.extendRetrieve(e,t).pipe(l.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.loadEntities([r]),r}))},le.prototype.getPagedById=function(o){var a=this,e=this.restService.buildRequestInfo(),t=this.repository.entityCollection.getPaginationConfigByPath("/"),r=this.buildChildPagination(t),n=this.buildRetrieveParam(r);return this.restService.serviceRetrieve(o,n,e).pipe(l.map(function(e){var t=e.returnValue||{},r=t.result,n=t.pagination;a.updatePagination(n);var i=a.repository.entityCollection.getEntityById(o);return a.reloadEntityData(i,r),i}))},le.prototype.getByIdWithPaged=function(e){var o=this,t=this.restService.buildRequestInfo(),r=this.repository.entityCollection.getPaginationConfigByPath("/"),n=this.buildChildPagination(r),i=this.buildRetrieveParam(n);return this.restService.serviceRetrieve(e,i,t).pipe(l.map(function(e){var t=e.returnValue||{},r=t.result,n=t.pagination;o.updatePagination(n);var i=o.repository.buildEntity(r);return o.repository.entityCollection.loadEntities([i]),i}))},le.prototype.queryChild=function(s,e,t,r,n){var p=this,i=this.restService.buildRequestInfo(),u=ce.convertPathsToNodeCodes(s),o={nodeCodes:u.map(function(e){return e.substring(0,e.length-1)}),ids:ce.convertPathsToIds(s),pagination:{pageIndex:e,pageSize:t},requestInfo:i},c=u[u.length-1];return c=c.substring(0,c.length-1),this.restService.queryChild(o).pipe(l.map(function(e){var t=e.returnValue;if(!t)return null;var r=t.result,n=void 0===r?[]:r,i=t.pagination,o=void 0===i?{}:i,a=[];n.forEach(function(e){var r=I.FieldMetadataUtil.getNgList(p.repository.entityType),n=null;u.forEach(function(e){var t=r[e];n=t.type,r=I.FieldMetadataUtil.getNgList(n)});var t=new n(e);b.appendInitialData(t,e),a.push(t)}),u=u.map(function(e){return e.charAt(0).toLocaleLowerCase()+e.substr(1)}),p.repository.entityCollection.resetEntities(s,a),p.repository.entityCollection.setPaginationConfigByPath("/"+c,o)}))},le.prototype.buildChildPagination=function(r){var n={};return Object.keys(r).forEach(function(e){var t=r[e];"object"==typeof t&&(n[e]=t)}),n},le.prototype.updatePagination=function(t){var r=this;t&&Object.keys(t).forEach(function(e){r.repository.entityCollection.setPaginationConfigByPath("/"+e,t[e])})},le.prototype.buildRetrieveParam=function(n,i){void 0===i&&(i=!1);var e={};if(n&&0<Object.keys(n).length){var o={};Object.keys(n).forEach(function(e){var t=n[e],r=t.pageIndex;i||(r=1),o[e]={pagination:{pageSize:t.pageSize||0,pageIndex:r}}}),e.filters=o}return e},le.prototype.editById=function(n){var i=this;if(!this.repository.entityCollection.getEntityById(n))return d.of(null);var e=pe.buildRequestInfo(this.repository);return this.restProxy.edit(n,e).pipe(l.map(function(e){var t=e.returnValue.data,r=i.repository.entityCollection.getEntityById(n);return r&&t&&i.reloadEntityData(r,t),r}))},le.prototype.updateById=function(n){var i=this;if(!this.repository.entityCollection.getEntityById(n))return d.of(null);var e=this.restService.buildRequestInfo();return this.restService.extendRetrieve(n,e).pipe(l.map(function(e){var t=e.returnValue,r=i.repository.entityCollection.getEntityById(n);return i.reloadEntityData(r,t),r}))},le.prototype.updateByIdWithPaged=function(e){var i=this,o=this.repository.entityCollection.getEntityById(e);if(!o)return d.of(null);var t=this.restService.buildRequestInfo(),r=this.repository.entityCollection.getPaginationConfigByPath("/"),n=this.buildChildPagination(r),a=this.buildRetrieveParam(n,!0);return this.restService.serviceRetrieve(e,a,t).pipe(l.map(function(e){var t=e.returnValue||{},r=t.result,n=t.pagination;return i.updatePagination(n),i.reloadEntityData(o,r),o}))},le.prototype.reloadEntityData=function(e,t){e&&(this.appContext.changeDetectionController.detach(),e.load(t),e.changes.splice(0,e.changes.length),this.appContext.changeDetectionController.reattach())},le.prototype.create=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(l.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return b.appendInitialData(r,t),n.repository.entityCollection.loadEntities([r]),r}))},le.prototype.append=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(l.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.addEntity(r),r}))},le.prototype.insert=function(n,e){var i=this,t=this.buildRequestInfo();return this.restProxy.create(e,t).pipe(l.map(function(e){var t=e.returnValue,r=i.repository.buildEntity(t);return i.repository.entityCollection.insertEntity(r,n),r}))},le.prototype.appendByPath=function(r){var n=this,e=this.restService.buildRequestInfo();return this.restService.createByPath(r,e).pipe(l.map(function(e){var t=e.returnValue;return n.repository.entityManager.appendEntityByPath(r,t,t)}))},le.prototype.insertByPath=function(r,n){var i=this,e=this.buildRequestInfo();return this.restProxy.createByPath(r,e).pipe(l.map(function(e){var t=e.returnValue;return i.repository.entityManager.insertEntityByPath(r,t,t,n)}))},le.prototype.removeById=function(t,e){var r=this;e=e===undefined||e;var n=this.restService.buildRequestInfo();return this.restService.extendDelete(t,n).pipe(l.switchMap(function(){return!0===e?r.applyChangesById(t).pipe(l.tap(function(e){e&&r.repository.entityCollection.removeEntityById(t)})):(r.repository.entityCollection.removeEntityById(t),r.repository.dataChangeHistory.addChange({dataId:t,changeType:I.DataChangeType.Delete}),d.of(!0))}))},le.prototype.removeAndSaveById=function(e){var t=this,r=pe.buildRequestInfo(this.repository);return this.restProxy.deleteAndSave(e,r).pipe(l.switchMap(function(){return t.repository.entityCollection.removeEntityById(e),d.of(!0)}))},le.prototype.removeByIds=function(r,e){var n=this;e=e===undefined||e;var t=this.restService.buildRequestInfo();return this.restService.extendBatchDelete(r,t).pipe(l.switchMap(function(){if(e)return n.applyChangesByIdArray(r).pipe(l.tap(function(e){e&&n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)})}));if(n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)}),r&&0<r.length){var t=[];r.forEach(function(e){t.push({dataId:e,changeType:I.DataChangeType.Delete})}),n.repository.dataChangeHistory.addChanges(t)}return d.of(!0)}))},le.prototype.checkEntityValueExists=function(e,t){for(var r=!1,n=0;n<t.length;n++)if(e.primaryValue===t[n]){r=!0;break}return r},le.prototype.removeByPath=function(e,t){var r=this,n=this.restService.buildRequestInfo();return this.restService.extendDeletByPath(e,t,n).pipe(l.map(function(){return r.repository.entityManager.removeEntityByPath(e,t),r.repository.dataChangeHistory.addChange({fpath:e,dataId:t,changeType:I.DataChangeType.Delete}),!0}))},le.prototype.updateChangesById=function(e){var t=this,r=this.repository.entityCollection.getEntityById(e);if(!r.changes)return d.of(!0);if(0===r.changes.length)return d.of(!0);var n=this.repository.entityManager.buildEntityChangeDetailById(e),i=this.restService.buildRequestInfo();return this.restService.update(n,i).pipe(l.tap(function(){t.repository.entityManager.clearEntityChangesById(e)}),l.map(function(){return!0}))},le.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},le.prototype.updateAllChanges=function(){var r=this,n=[],e=this.repository.entityCollection.toArray();return 0===e.length?d.of(!0):(e.forEach(function(e){var t=r.updateChangesById(e.primaryValue);n.push(t)}),d.zip.apply(void 0,R(n)).pipe(l.map(function(){return!0})))},le.prototype.applyChanges=function(){var e=this,t=this.restService.buildRequestInfo();return this.restService.save(t).pipe(l.tap(function(){e.repository.entityManager.clearAllEntityChanges(),e.repository.dataChangeHistory.clear()}),l.map(function(){return!0}))},le.prototype.applyChangesByIdArray=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(l.tap(function(){t.repository.entityManager.clearEntityChangesByArray(e),t.repository.dataChangeHistory.clearByIds(e)}),l.map(function(){return!0}))},le.prototype.applyChangesById=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(l.tap(function(){t.repository.entityManager.clearEntityChangesById(e),t.repository.dataChangeHistory.clearByIds([e])}),l.map(function(){return!0}))},le.prototype.cancelChanges=function(){var e=this;return this.restService.cancel().pipe(l.tap(function(){e.repository.entityManager.clearAllEntityChanges(),e.repository.dataChangeHistory.clear()}),l.map(function(){return!0}))},le.prototype.buildRequestInfo=function(){return{dataChange:this.repository.entityManager.buildAllEntityChangeDetails(),variableChange:this.repository.variableManager.buildChangeDetail()}},le);function le(e,t){this.injector=e,this.repository=t;var r=e.get(g),n=e.get(a.HttpClient),i=e.get(p)+"/"+this.repository.apiUri,o=e.get(I.EventBus);this.restService=new Pe(n,i,r,this.repository,o),this.appContext=e.get(I.AppContext)}var de=(fe.prototype.onResponse=function(e,t){return e&&e.innerDataChange&&!0!==t&&this.context.handleDataChangeDetails(e.innerDataChange),this.context.clearAllEntityChanges(),e&&e.hasOwnProperty("returnValue")?e.returnValue:e},fe.prototype.onError=function(e,t,r){var n,i,o=this.context.appContext.getFormAppContext(),a=o.ApplicationId,s=window.DEVKIT_LOADING_SERVICE;if(s&&s instanceof Array&&0<s.length)try{for(var p=B(s),u=p.next();!u.done;u=p.next()){var c=u.value;"function"==typeof c.clearAll&&c.clearAll()}}catch(l){n={error:l}}finally{try{u&&!u.done&&(i=p["return"])&&i.call(p)}finally{if(n)throw n.error}}if(t)return d.throwError(e);var y=this.context.restService.eventBus,h=window[a]||{};return y&&h.isExceptionHandlerExist?(y.post("Exception","","onException",e,o),r?d.of(null):d.EMPTY):d.throwError(e)},fe.prototype.extendHeaders=function(t){var r=this;return this.context.restService.sessionService.getBeSessionId().pipe(l.switchMap(function(e){return t=r.context.restService.sessionService.extendRequestHeaders(t),d.of(t)}))},fe.prototype.extendUrl=function(e,t){if(!t)return e;for(var r in t)if(t.hasOwnProperty(r)){var n=JSON.stringify(t[r]);e=-1===e.indexOf("?")?e+"?"+r+"="+n:e+"&"+r+"="+n}return e},fe.prototype.extendBody=function(t){var r=this;return!t||"object"!=typeof t||Object.keys(t).length<1||(Object.keys(t).forEach(function(e){"requestInfo"===e&&(t.requestInfo=r.context.restService.buildRequestInfo())}),1===Object.keys(t).length&&(t=Object.values(t)[0])),t},fe.prototype.parseHeaders=function(e){var t="BEFSessionID";e.headers&&e.headers.has(t)&&this.context.restService.sessionService.setBeSessionId(e.headers.get(t))},fe);function fe(e){this.context=e}var ge,ve=(x(Ie,ge=$),Object.defineProperty(Ie.prototype,"proxy",{get:function(){return this.befProxy},set:function(e){this.befProxy=e,this.befProxy.setProxyExtend(new de(this))},enumerable:!0,configurable:!0}),Ie.prototype.getEntities=function(e,t,r,n){return this.dataService.getList(e,t,r,n)},Ie.prototype.getPagedById=function(e){return this.dataService.getPagedById(e)},Ie.prototype.getByIdWithPaged=function(e){return this.dataService.getByIdWithPaged(e)},Ie.prototype.queryChild=function(e,t,r,n,i){return this.dataService.queryChild(e,t,r,n,i)},Ie.prototype.getEntityById=function(e){return this.dataService.getById(e)},Ie.prototype.updateEntityById=function(e){return this.dataService.updateById(e)},Ie.prototype.updateByIdWithPaged=function(e){return this.dataService.updateByIdWithPaged(e)},Ie.prototype.editEntityById=function(e){return this.dataService.editById(e)},Ie.prototype.createEntity=function(e){return this.dataService.create(e)},Ie.prototype.appendEntity=function(e){return this.dataService.append(e)},Ie.prototype.insert=function(e,t){return this.dataService.insert(e,t)},Ie.prototype.insertByPath=function(e,t){return this.dataService.insertByPath(e,t)},Ie.prototype.appendEntityByPath=function(e){return this.dataService.appendByPath(e)},Ie.prototype.removeEntityById=function(e,t){return this.dataService.removeById(e,t)},Ie.prototype.removeEntityAndSaveById=function(e){return this.dataService.removeAndSaveById(e)},Ie.prototype.removeEntityByPath=function(e,t){return this.dataService.removeByPath(e,t)},Ie.prototype.saveEntityById=function(e){return this.dataService.applyChangesById(e)},Ie.prototype.saveEntities=function(){return this.dataService.applyChanges()},Ie.prototype.cancelEntityChanges=function(){return this.dataService.cancelChanges()},Ie.prototype.reset=function(){this.entityManager.reset(),this.variableManager.reset(),this.restService.sessionService.clearBeSessionId()},Ie.prototype.getInjector=function(){return this.injector},Ie.decorators=[{type:o.Injectable}],Ie.ctorParameters=function(){return[{type:o.Injector}]},Ie);function Ie(e){var t=ge.call(this)||this;t.injector=e,t.entityManager=new re(t.entityCollection),t.appContext=t.injector.get(I.AppContext);var r=I.MetadataUtil.getPropsMetadatasByName(t.constructor,Y);return t.variableManager=new ae(t.appContext,r,t.injector),t.dataService=new he(t.injector,t),t.serverUri=e.get(p),t}var Se=(be.prototype.extendUri=function(e){return this.serverUri+"/"+e},be.decorators=[{type:o.Injectable}],be.ctorParameters=function(){return[{type:String,decorators:[{type:o.Inject,args:[p]}]}]},be);function be(e){this.serverUri=e}var Ce="DELETE",me="PUT",Ee="POST",xe=(Be.prototype.setBaseUri=function(e){this.baseUri=e},Be.prototype.setProxyExtend=function(e){this.proxyExtend=e},Be.prototype.query=function(e){var t=this.baseUri;return e&&(t=t+"?entityFilter="+JSON.stringify(e)),this.request(t,"GET")},Be.prototype.extendQuery=function(e,t){var r=this.baseUri+"/extension/query";e&&(r=r+"?entityFilter="+JSON.stringify(e));var n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i,!1)},Be.prototype.retrieve=function(e){var t=this.baseUri+"/"+e;return this.request(t,"GET")},Be.prototype.serviceRetrieve=function(e,t,r){var n=this.baseUri+"/service/retrieve/"+e,i={body:{retrieveParam:t,requestInfo:r}};return this.request(n,me,null,i)},Be.prototype.queryChild=function(e){var t=this.baseUri+"/service/querychild",r={body:e};return this.request(t,me,null,r)},Be.prototype.extendRetrieve=function(e,t){var r=this.baseUri+"/extension/retrieve/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.edit=function(e,t){var r=this.baseUri+"/service/edit/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.create=function(e,t){var r={defaultValue:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,Ee,null,n)},Be.prototype.createByPath=function(e,t){var r=ce.convertPathToUrl(e),n=""+this.baseUri+r,i=t,o=this.addBodyToOptions({},i);return this.request(n,Ee,null,o)},Be.prototype.update=function(e,t){var r={changeDetail:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,"PATCH",null,n)},Be.prototype.save=function(e){var t=e,r=this.addBodyToOptions({},t);return this.request(this.baseUri,me,null,r)},Be.prototype["delete"]=function(e){var t=this.baseUri+"/"+e;return this.request(t,Ce)},Be.prototype.deleteAndSave=function(e,t){var r=this.baseUri+"/service/delete/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.extendDelete=function(e,t){var r=this.baseUri+"/extension/delete/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.deletByPath=function(e,t){var r=ce.convertPathToUrl(e),n=""+this.baseUri+r+"/"+t;return this.request(n,Ce)},Be.prototype.extendDeletByPath=function(e,t,r){var n=ce.convertPathToUrl(e),i=this.baseUri+"/extension"+n+"/"+t,o=r,a=this.addBodyToOptions({},o);return this.request(i,me,null,a)},Be.prototype.batchDelete=function(e){var t={ids:e.join(",")};return this.request(this.baseUri,Ce,t)},Be.prototype.extendBatchDelete=function(e,t){var r=this.baseUri+"/extension/batchdelete",n={ids:e.join(",")},i=t,o=this.addBodyToOptions({},i);return this.request(r,me,n,o)},Be.prototype.cancel=function(){var e=this.baseUri+"/service/cancel";return this.request(e,Ee)},Be.prototype.request=function(t,r,e,n,i,o,a){var s=this;n=n||{},void 0!==i&&"boolean"==typeof i||(i=!1),void 0!==o&&"boolean"==typeof o||(o=!1),e&&(n.params=e),n.headers=D.convertToHeaders(n.headers);var p=this.hasRequestInfo(n);return n&&n.body&&n.body.hasOwnProperty("RequestInfo")&&(n.body.requestInfo=n.body.RequestInfo,delete n.body.RequestInfo),this.proxyExtend.extendHeaders(n.headers).pipe(l.switchMap(function(e){return n.headers=D.toJson(e),n.observe="response",s.httpService.request(r,t,n)}),l.tap(function(e){return s.proxyExtend.parseHeaders(e)}),l.map(function(e){return e.body}),l.map(function(e){return p?(s.proxyExtend.onResponse(e,a),e):s.unWrapResponseInfo(e)}),l.catchError(function(e){return s.proxyExtend.onError(e,i,o)}))},Be.prototype.invoke=function(t,r,n){var i=this;return n.params&&(t=this.proxyExtend.extendUrl(t,n.params),n.params=null),n.body&&(n.body=this.proxyExtend.extendBody(n.body)),n.headers=D.convertToHeaders(n.headers),this.proxyExtend.extendHeaders(n.headers).pipe(l.switchMap(function(e){return n.headers=D.toJson(e),n.observe="response",i.httpService.request(r,t,n).pipe(l.tap(function(e){return i.proxyExtend.parseHeaders(e)}),l.map(function(e){return e.body}),l.map(function(e){return i.proxyExtend.onResponse(e)}),l.catchError(function(e){return i.proxyExtend.onError(e,!1,!1)}))}))},Be.prototype.addBodyToOptions=function(e,t){return e=e||{},Object.assign(e,{body:t})},Be.prototype.buildParams=function(e){return O.buildParams(e)},Be.prototype.hasRequestInfo=function(e){return T.hasRequestInfo(e)||T.hasRequestInfoWithR(e)},Be.prototype.unWrapResponseInfo=function(e){return U.unWrapResponseInfo(e)},Be.decorators=[{type:o.Injectable}],Be.ctorParameters=function(){return[{type:a.HttpClient},{type:Se}]},Be);function Be(e,t){this.httpClient=e,this.uriService=t,this.httpService=new A(this.httpClient)}var Pe=(Object.defineProperty(Re.prototype,"proxy",{get:function(){return this.repository.proxy?this.repository.proxy:this.createBefProxy()},enumerable:!0,configurable:!0}),Re.prototype.createBefProxy=function(){var e=this.repository.serverUri,t=new Se(e),r=new xe(this.httpClient,t);r.setBaseUri(this.baseUri);var n=new de(this.repository);return r.setProxyExtend(n),r},Re.prototype.query=function(e){return this.proxy.query(e)},Re.prototype.extendQuery=function(e,t){return this.proxy.extendQuery(e,t)},Re.prototype.serviceRetrieve=function(e,t,r){return this.proxy.serviceRetrieve(e,t,r)},Re.prototype.queryChild=function(e){return this.proxy.queryChild(e)},Re.prototype.retrieve=function(e){return this.proxy.retrieve(e)},Re.prototype.extendRetrieve=function(e,t){return this.proxy.extendRetrieve(e,t)},Re.prototype.create=function(e,t){return this.proxy.create(e,t)},Re.prototype.createByPath=function(e,t){return this.proxy.createByPath(e,t)},Re.prototype.update=function(e,t){return this.proxy.update(e,t)},Re.prototype.save=function(e){return this.proxy.save(e)},Re.prototype["delete"]=function(e){return this.proxy["delete"](e)},Re.prototype.extendDelete=function(e,t){return this.proxy.extendDelete(e,t)},Re.prototype.deletByPath=function(e,t){return this.proxy.deletByPath(e,t)},Re.prototype.extendDeletByPath=function(e,t,r){return this.proxy.extendDeletByPath(e,t,r)},Re.prototype.batchDelete=function(e){return this.proxy.batchDelete(e)},Re.prototype.extendBatchDelete=function(e,t){return this.proxy.extendBatchDelete(e,t)},Re.prototype.cancel=function(){return this.proxy.cancel()},Re.prototype.request=function(e,t,r,n,i,o,a){return this.innerRequest(e,t,r,n,i,o,a,!1)},Re.prototype.invoke=function(e,t,r,n,i,o,a){if(n&&n.body&&n.body.RequestInfo)throw new Error("请使用requestInfo提交变更");return this.innerRequest(e,t,r,n,i,o,a,!0)},Re.prototype.innerRequest=function(t,r,e,n,i,o,a,s){var p=this;n=n||{};var u="BEFSessionID";void 0!==i&&"boolean"==typeof i||(i=!1),void 0!==o&&"boolean"==typeof o||(o=!1),void 0!==s&&"boolean"==typeof s||(s=!1);var c=s?this.existRequestInfo:this.hasRequestInfo;e&&(n.params=e);var y=c(n),h=D.convertToHeaders(n.headers);return this.sessionService.getBeSessionId().pipe(l.switchMap(function(e){return h=p.sessionService.extendRequestHeaders(h),n.headers=D.toJson(h),n.observe="response",p.httpService.request(r,t,n)}),l.tap(function(e){e.headers&&e.headers.has(u)&&p.sessionService.setBeSessionId(e.headers.get(u))}),l.map(function(e){return e.body}),l.map(function(e){return p.handleReponseInfo(e,y,a)}),l.catchError(function(e){return p.handleErrors(e,i,o)}))},Re.prototype.handleReponseInfo=function(e,t,r){return t?(e&&e.innerDataChange&&!0!==r&&this.repository.handleDataChangeDetails(e.innerDataChange),this.repository.clearAllEntityChanges(),e):this.unWrapResponseInfo(e)},Re.prototype.handleErrors=function(e,t,r){if(this.clearLoading(),t)return d.throwError(e);var n=this.repository.appContext.getFormAppContext(),i=n.ApplicationId,o=!!(window[i]||{}).isExceptionHandlerExist;return this.eventBus&&o?(this.eventBus.post("Exception","","onException",e,n),r?d.of(null):d.empty()):d.throwError(e)},Re.prototype.clearLoading=function(){var e,t;if(!1!==(window.DEVKIT_LOADING_SERVICE&&window.DEVKIT_LOADING_SERVICE instanceof Array&&0<window.DEVKIT_LOADING_SERVICE.length||!1)){var r=window.DEVKIT_LOADING_SERVICE;try{for(var n=B(r),i=n.next();!i.done;i=n.next()){var o=i.value;"function"==typeof o.clearAll&&o.clearAll()}}catch(a){e={error:a}}finally{try{i&&!i.done&&(t=n["return"])&&t.call(n)}finally{if(e)throw e.error}}}},Re.prototype.unWrapResponseInfo=function(e){return U.unWrapResponseInfo(e)},Re.prototype.hasRequestInfo=function(e){return T.hasRequestInfoWithR(e)},Re.prototype.existRequestInfo=function(e){return T.hasRequestInfo(e)},Re.prototype.buildParams=function(e){return O.buildParams(e)},Re.prototype.buildBodyWithRequestInfo=function(e){return T.buildBodyWithRequestInfo(e,this.repository)},Re.prototype.buildRequestInfo=function(){return T.buildRequestInfo(this.repository)},Re.decorators=[{type:o.Injectable}],Re.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:g},{type:ve},{type:I.EventBus}]},Re);function Re(e,t,r,n,i){this.httpClient=e,this.httpService=new A(this.httpClient),this.baseUri=t;var o=n.getInjector();this.sessionService=new z(e,t,r,o),this.repository=n,this.eventBus=i}var De=(qe.prototype.getData=function(e,t){var r=e.split(".")[0],n=e.split(".")[1];return t=t||{},!0===this.ifEnableExtendLoadMethod(e)?this.extendGetHelpData(n,r,t):this.getHelpData(n,r,t)},qe.prototype.saveUserSettings=function(e){return this.befRepository.restService.invoke("/api/runtime/bcc/v1.0/datagrid/settings","POST",null,{body:e},!1)},qe.prototype.getUserSettings=function(e){var t="/api/runtime/bcc/v1.0/datagrid/settings/"+e;return this.befRepository.restService.invoke(t,"GET",null,null,!1)},qe.prototype.ifEnableExtendLoadMethod=function(e){if(this.context&&this.context.hasOwnProperty("enableExtendLoadMethod"))return this.context.enableExtendLoadMethod;var t=!1;if(this.frameContext){var r=e+"@"+this.frameContext.repository.apiUri;t=this.frameContext.getParam(r)}return t},qe.prototype.getHelpData=function(e,t,r){var n=this,i=this.befRepository.restService.baseUri+"/elementhelps/"+e;return this.befRepository.updateDataAndVariableChanges().pipe(l.switchMap(function(){return n.befRepository.restService.invoke(i,"GET",{nodeCode:t,queryParam:JSON.stringify(r)},null,!1)}))},qe.prototype.extendGetHelpData=function(e,t,r){var n=this.befRepository.restService.baseUri+"/extension/elementhelps",i={body:{labelId:e,nodeCode:t,queryParam:r,requestInfo:this.befRepository.restService.buildRequestInfo()}};return this.befRepository.restService.invoke(n,"PUT",null,i,!1,!0,!0).pipe(l.map(function(e){return e&&e.returnValue||null}))},qe.prototype.convert2TreeDataWithPathCode=function(n,t,r){var i=this;void 0===t&&(t=1),void 0===r&&(r="01");var e=n.filter(function(e){return e.layer===t&&e.pathcode===r});if(1<t&&(e=n.filter(function(e){return e.layer===t&&e.pathcode.substr(0,2*(t-1))===r})),e.length){var o=e.map(function(e){return{data:e,children:[]}});return o.forEach(function(e){var t,r=i.convert2TreeDataWithPathCode(n,e.data.layer+1,e.data.pathcode);(t=e.children).push.apply(t,R(r))}),o}},qe.decorators=[{type:o.Injectable}],qe.ctorParameters=function(){return[{type:I.Repository},{type:I.FrameContext,decorators:[{type:o.Optional}]}]},qe);function qe(e,t){this.frameContext=t,this.befRepository=e}var Oe=(we.prototype.createSession=function(e){var t=this.sessionService.getUserSessionId();return t?this.befRepository.restService.invoke(e,"POST",null,{headers:new a.HttpHeaders({SessionId:t}),responseType:"text"},!1).pipe(l.switchMap(function(e){return d.of({status:!0,payload:e})})):d.of({status:!1,payload:"用户登录信息已过期,请重新登录"})},we.prototype.getData=function(e,t){var r=this,n={};t.condition&&(n=t.condition),"/"===e[e.length-1]&&(e=e.substr(0,e.length-1));var i=e+"/extension/query",o=e+"/service/createsession";if(n){var a=JSON.stringify(n);i=i+"?entityFilter="+a}return this.createSession(o).pipe(l.switchMap(function(e){if(e.status)return e.payload,r.befRepository.restService.invoke(i,"PUT",null,{},!1);throw new Error(e.payload)}),s.map(function(e){var t=e.returnValue,r={items:t.result};return t.pagination?Object.assign({},r,{total:t.pagination.totalCount,pageInfo:{pageSize:t.pagination.pageSize,pageIndex:t.pagination.pageIndex,enablePager:!0}}):r}))},we.decorators=[{type:o.Injectable}],we.ctorParameters=function(){return[{type:I.Repository},{type:g}]},we);function we(e,t){this.sessionService=t,this.befRepository=e}var Te=(je.isExistUnsaveData=function(e){var t=!1;if(!e||!e.entityCollection)throw"Current Object is null or it's entityCollection is null.";var r=e.entityCollection.toArray();if(e.dataChangeHistory.isChanged())return!0;for(var n=0;n<r.length;n++)if(0<r[n].changes.length){t=!0;break}return t},je);function je(){}var Ue=(Me.prototype.toString=function(){return this.url},Me);function Me(e,t){void 0===t&&(t=null);var r=this;this.url=e,this.paths=t,this.paths&&Object.keys(t).forEach(function(e){-1!==r.url.indexOf("{"+e+"}")&&(r.url=r.url.replace("{"+e+"}",""+t[e]))})}var Ae=(He.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return this.befRest.restService.invoke(e,r,t,{headers:n})},He.decorators=[{type:o.Injectable}],He.ctorParameters=function(){return[{type:I.Repository}]},He);function He(e){this.befRest=e}var Ve=(ke.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return this.befRest.restService.invoke(e,r,t,{headers:n})},ke.decorators=[{type:o.Injectable}],ke.ctorParameters=function(){return[{type:I.Repository}]},ke);function ke(e){this.befRest=e}e.VERSION="ver.",e.ChangeDetailType=S,e.BE_SERVER_URI_TOKEN=p,e.BE_SESSION_HANDLING_STRATEGY_TOKEN=u,e.BefChangeBuilder=c,e.BefChangeHandler=h,e.BefSessionService=z,e.BefRestService=Pe,e.BefProxy=xe,e.BefLookupRestService=De,e.BefLookupDefaultService=Oe,e.BefRepository=ve,e.FrameworkSessionService=g,e.NG_VARIABLE=Y,e.NgVariable=Z,e.BefRepositoryUtil=Te,e.BefDataPathUtil=ce,e.UriService=Se,e.Uri=Ue,e.DefaultComboHttpService=Ae,e.DefaultDynamiControlGroupHttpService=Ve,e.ɵa=$,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@ecp-caf/caf-common"),require("date-fns"),require("rxjs"),require("rxjs/operators"),require("rxjs/operators/map"),require("@angular/core"),require("@farris/devkit"),require("@angular/common/http")):"function"==typeof define&&define.amd?define("@farris/bef",["exports","@ecp-caf/caf-common","date-fns","rxjs","rxjs/operators","rxjs/operators/map","@angular/core","@farris/devkit","@angular/common/http"],t):t((e.farris=e.farris||{},e.farris.bef={}),e.cafCommon,e.dateFns,e.rxjs,e.rxjs.operators,e.rxjs["operators/map"],e.ng.core,e.devkit,e.ng.common.http)}(this,function(e,t,n,d,f,s,o,I,a){"use strict";var S=(r.Added="Added",r.Modify="Modify",r.Deleted="Deleted",r);function r(){}var p=new o.InjectionToken("@farris/be BE_SERVER_URL"),u=new o.InjectionToken("@farris/be BE_SESSION_HANDLING_STRATEGY_TOKEN"),b=(i.getPropInfo=function(e,t){var r,n,i,o=I.FieldMetadataUtil.getNgFields(e);Object.keys(o).forEach(function(e){e===t&&(r="NgField",n=null,i=o[e])});var a=I.FieldMetadataUtil.getNgObjects(e);Object.keys(a).forEach(function(e){e===t&&(r="NgObject",n=a[e].type,i=a[e])});var s=I.FieldMetadataUtil.getNgList(e);Object.keys(s).forEach(function(e){e===t&&(r="NgList",n=s[e].type,i=s[e])});var p=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(p).forEach(function(e){e===t&&(r="NgDynamic",n=p[e].type,i=p[e])}),{propType:r,propEntityType:n,propMetadata:i}},i.getPrimaryKey=function(e){var t=I.FieldMetadataUtil.getPrimaryFieldMetadata(e);return t?t.dataField:""},i.isObjectProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgObjects(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},i.isDynamicProp=function(e,t){var r=!1,n=I.FieldMetadataUtil.getNgDynamic(e);return Object.keys(n).forEach(function(e){e===t&&(r=!0)}),r},i.appendInitialData=function(e,t){var r=Object.assign({},t);delete r.id,delete r.parentID,e.initialData=r},i);function i(){}var c=(y.prototype.build=function(e){var t=this;return this.changeDetail={ChangeType:S.Modify,ChangeInfo:{DataId:""}},e.forEach(function(e){t.buildChangeDetail(e)}),this.changeDetail},y.prototype.buildChangeDetail=function(l){var d=l.path.concat();this.changeDetail.ChangeInfo.DataId||(this.changeDetail.ChangeInfo.DataId=d[0].split(":")[1]);for(var f=this.changeDetail,g=this.entityType,e=function(e){var t=v.getChangeInfo(f),r=d[e],n=b.getPropInfo(g,r),i=n.propType,o=n.propEntityType,a=n.propMetadata.dataField||r;if("NgField"===i){if(r===b.getPrimaryKey(g))return"continue";if(l.type!==I.ModifyType.ValueChange)throw Error("简单类型的属性上不支持ValueChange类型之外的变更");t[a]=l.value,f=null}else if("NgObject"===i)if(d[e+1].split(":")[1],d[e+1].split(":")[0]){var s=t[a],p=d.slice(0,e+1);s=(h=v.entityCollection.getEntityByPath(p))?h.toJSON():{},t[a]=s,g=f=null}else c=(c=t[a])||{ChangeType:S.Modify,ChangeInfo:{}},t[a]=c,f=c,g=o;else if("NgList"===i){f.ChangeInfo[a]||(f.ChangeInfo[a]=[]);var u=f.ChangeInfo[a];if(e!==d.length-1){var c,y=d[e+1].split(":")[1];return(c=u.find(function(e){return e.ChangeInfo.DataId===y}))||(c=v.createEmptyChangeDetail(S.Modify,y),u.push(c)),f=c,g=o,"continue"}l.type===I.ModifyType.Add||l.type===I.ModifyType.Insert||(l.type,I.ModifyType.Remove),g=f=null}else if("NgDynamic"===i){p=d.slice(0,e+1);var h=v.entityCollection.getEntityByPath(p);t[a]={ChangeType:S.Modify,ChangeInfo:h?h.toJSON():{}},g=f=null}},v=this,t=1;t<d.length&&f;t+=2)e(t)},y.prototype.getChangeInfo=function(e){return e.hasOwnProperty("ChangeInfo")?e.ChangeInfo:e},y.prototype.createEmptyChangeDetail=function(e,t){return{ChangeType:e,ChangeInfo:{DataId:t}}},y);function y(e,t){this.entityType=e,this.entityCollection=t}var h=(l.prototype.handle=function(e,t,r){this.handleChangeDetails(e,t,r)},l.prototype.handleChangeDetails=function(n,i,e){var o=this;e&&e.forEach(function(e){var t=e.ChangeInfo.dataId||e.ChangeInfo.DataId,r=o.getEntityById(i,t);r&&o.handleChangeDetail(n,r,e)})},l.prototype.handleChangeDetail=function(u,c,e){var y=this;if(e&&c&&e.ChangeType===S.Modify){var h=e.ChangeInfo;Object.keys(h).forEach(function(e){var t=b.getPropInfo(u,e),r=t.propType,n=t.propEntityType;if("NgField"===r)c[e]=h[e];else if("NgObject"===r){var i=c[e];if(i.primaryKey){var o=h[e];i.load(o)}else{var a=h[e];y.handleChangeDetail(n,i,a)}}else if("NgList"===r){var s=c[e],p=h[e];y.handleChangeDetails(n,s,p)}})}},l.prototype.getEntityById=function(e,t){return(e instanceof I.EntityCollection?e.getEntityById(t):e.get(t))||null},l);function l(){}var g=(v.prototype.getUserSessionId=function(){return this.sessionService.getUserSessionId()},v.prototype.getCurrentSessionId=function(){var e;return this.sessionService&&(e=this.sessionService.getCurrentSeesionId()),e=e||this.getUserSessionId()},v.decorators=[{type:o.Injectable}],v.ctorParameters=function(){return[{type:t.SessionService,decorators:[{type:o.Optional}]}]},v);function v(e){this.sessionService=e}var C=(m.prototype.getItem=function(e){return this.getAllBeSessions()[e]},m.prototype.setItem=function(e,t){var r=this.getAllBeSessions();r[e]=t,this.setAllBeSessions(r)},m.prototype.removeItem=function(e){var t=this.getAllBeSessions();t[e]&&delete t[e],this.setAllBeSessions(t)},m.prototype.clear=function(e,t){!0===this.isInFramework()?this.removeItemsByFrmSessionId(e):this.removeItem(t)},m.prototype.removeItemsByFrmSessionId=function(t){var r=this.getAllBeSessions();Object.keys(r).forEach(function(e){!0===e.startsWith(t)&&delete r[e]}),this.setAllBeSessions(r)},m.prototype.getAllBeSessions=function(){var e=window.sessionStorage.getItem(this.sessionStorageKey);return e?JSON.parse(e):{}},m.prototype.setAllBeSessions=function(e){var t=JSON.stringify(e);window.sessionStorage.setItem(this.sessionStorageKey,t)},m.prototype.isInFramework=function(){var e=window.location.hash;return!!e&&-1!==e.indexOf("tabId=")},m);function m(){this.sessionStorageKey="BE_SESSION_ID"}var E=function(e,t){return(E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function x(e,t){function r(){this.constructor=e}E(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function B(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function P(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(s){i={error:s}}finally{try{n&&!n.done&&(r=o["return"])&&r.call(o)}finally{if(i)throw i.error}}return a}function R(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(P(arguments[t]));return e}var D=(q.convertToHeaders=function(t){if(1==(t=t||new a.HttpHeaders)instanceof a.HttpHeaders)return t;if(0<Object.keys(t).length){var r=new a.HttpHeaders;Object.keys(t).forEach(function(e){r=r.append(e,t[e])}),t=r}else t=new a.HttpHeaders;return t},q.appendSessionId=function(e,t){return e.append("SessionId",t)},q.appendCafRuntimeCommonVariable=function(e,t){return e.append("X-CAF-Runtime-CommonVariable",t)},q.appendCafRuntimeContext=function(e,t){return e.append("X-CAF-Runtime-Context",t)},q.appendContextType=function(e,t){return t=t||"application/json",e.append("Content-Type",t)},q.appendRequireMessage=function(e,t){return void 0===t&&(t=!0),e.append("Bff-Require-Message",t.toString())},q.toJson=function(r){if(!(r instanceof a.HttpHeaders))return null;var n={};return r.keys().forEach(function(e){var t=r.getAll(e);1<t.length?n[e]=t:n[e]=t[0]||""}),n},q);function q(){}var O=(w.buildParams=function(e){var t=new a.HttpParams;for(var r in e)if(e.hasOwnProperty(r)){var n=e[r].toString();t=t.append(r,n)}return t},w);function w(){}var T=(j.hasRequestInfo=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.requestInfo||!t.requestInfo.dataChange)||!!t.dataChange},j.hasRequestInfoWithR=function(e){if(!e||!e.body)return!1;var t=e.body;return!(!t.RequestInfo||!t.RequestInfo.dataChange)||!!t.dataChange},j.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},j.buildBodyWithRequestInfo=function(e,t){if(e.RequestInfo||e.requestInfo)return e;var r=this.buildRequestInfo(t);return Object.assign({},e,{requestInfo:r})},j);function j(){}var U=(M.unWrapResponseInfo=function(e){if(!e)return e;if(!1===e.hasOwnProperty("returnValue"))return e.hasOwnProperty("result")&&e.hasOwnProperty("pagination")?e.result:e;var t=e.returnValue;return t&&t.hasOwnProperty("result")&&t.hasOwnProperty("pagination")?t.result:e.returnValue},M);function M(){}var A=(H.prototype.getService=function(){var e=window;try{for(;!e.gspframeworkService&&e!==e.parent&&this.isSameOrigin(e.parent);)e=window.parent}catch(t){}return e.gspframeworkService&&e.gspframeworkService.rtf||{}},H.prototype.isSameOrigin=function(e){var t=window.location.host;try{if(e&&e.location&&"undefined"!=typeof e.location.host)return e.location.host===t}catch(r){return!1}return!1},Object.defineProperty(H.prototype,"params",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("session")&&"function"==typeof this.rtf.session.getCommonVariable?this.rtf.session.getCommonVariable():null},enumerable:!0,configurable:!0}),Object.defineProperty(H.prototype,"httpService",{get:function(){return this.rtf&&this.rtf.hasOwnProperty("http")&&"function"==typeof this.rtf.http.request?this.rtf.http:null},enumerable:!0,configurable:!0}),H.prototype.request=function(e,t,r){return void 0===r&&(r={}),this.defaultHttpClient.request(e,t,r)},H.decorators=[{type:o.Injectable}],H.ctorParameters=function(){return[{type:a.HttpClient}]},H);function H(e){this.defaultHttpClient=e,this.httpClient=e,this.rtf=this.getService()}var V=(Object.defineProperty(k.prototype,"frmSessionId",{get:function(){return this.frmSessionService.getCurrentSessionId()},enumerable:!0,configurable:!0}),k.prototype.getFrameworkSessionId=function(){return this.frmSessionId},k.prototype.getSessionIdFromStorage=function(){var e=this.getSessionStorageKey();return this.storageStrategy.getItem(e)},k);function k(e,t){this.storageStrategy=e,this.frmSessionService=t}var N,F=(x(_,N=V),_.prototype.getSessionId=function(){var e=this.getSessionIdFromStorage();return e?d.of(e):this.createSession()},_.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},_.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.clear(this.frmSessionId,e)},_.prototype.extendRequestHeaders=function(e){var t=this.getFrameworkSessionId(),r=this.getSessionIdFromStorage();return e=D.appendCafRuntimeCommonVariable(e,t),e=D.appendCafRuntimeContext(e,r),e=D.appendSessionId(e,r)},_.prototype.handleReponseHeaders=function(e){console.log(e)},_.prototype.createSession=function(){var t=this,e={responseType:"text"};return this.frmSessionId&&(e.headers=new a.HttpHeaders({SessionId:this.frmSessionId}),e.headers=e.headers.append("X-CAF-Runtime-CommonVariable",this.frmSessionId),e.headers=D.toJson(e.headers)),this.httpService.request("POST",this.beSessionUri,e).pipe(f.tap(function(e){t.setSessionId(e)}))},_.prototype.extendHttpHeader=function(){},_.prototype.getSessionStorageKey=function(){return this.frmSessionId+"_"+this.beSessionUri},_);function _(e,t,r,n){var i=N.call(this,e,t)||this;return i.beSessionUri=n,i.httpClient=r,i.httpService=new A(i.httpClient),i}var L,K=(x(W,L=V),W.prototype.getSessionId=function(){var e=this.getSessionStorageKey(),t=this.storageStrategy.getItem(e);return d.of(t)},W.prototype.setSessionId=function(e){var t=this.getSessionStorageKey();this.storageStrategy.setItem(t,e)},W.prototype.clearSessionId=function(){var e=this.getSessionStorageKey();this.storageStrategy.removeItem(e)},W.prototype.extendRequestHeaders=function(e){var t=this.getFrameworkSessionId(),r=this.getSessionIdFromStorage();return e=D.appendCafRuntimeCommonVariable(e,t),r&&(e=D.appendCafRuntimeContext(e,r)),e},W.prototype.handleReponseHeaders=function(e){console.log(e)},W.prototype.getSessionStorageKey=function(){return this.frmSessionId+"_"+window.location.hash},W);function W(e,t,r){var n=L.call(this,e,t)||this;return n.beSessionUri=r,n}var G=(J.prototype.create=function(e,t,r,n){var i=this.createStorageStrategy(),o=this.createBeSessionUri(r);return"UnifiedSession"===e?new K(i,t,o):new F(i,t,n,o)},J.prototype.createStorageStrategy=function(){return new C},J.prototype.createBeSessionUri=function(e){return e+"/service/createsession"},J.decorators=[{type:o.Injectable}],J);function J(){}var z=(Object.defineProperty(Q.prototype,"token",{get:function(){return this.handlingStrategy.getFrameworkSessionId()},enumerable:!0,configurable:!0}),Q.prototype.getBeSessionId=function(){return this.handlingStrategy.getSessionId()},Q.prototype.setBeSessionId=function(e){this.handlingStrategy.setSessionId(e)},Q.prototype.clearBeSessionId=function(){this.handlingStrategy.clearSessionId()},Q.prototype.extendRequestHeaders=function(e){return this.handlingStrategy.extendRequestHeaders(e)},Q.prototype.handleResponseHeaders=function(e){return this.handlingStrategy.handleReponseHeaders(e)},Q.prototype.createBeSession=function(){return this.handlingStrategy.createSession()},Q.prototype.createHandlingStrategy=function(e,t,r,n){var i;return i=(i=e?e.get(u,null,o.InjectFlags.Optional):"SeparatedSession")||"SeparatedSession",(new G).create(i,r,n,t)},Q.decorators=[{type:o.Injectable}],Q.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:g},{type:o.Injector}]},Q);function Q(e,t,r,n){this.handlingStrategy=this.createHandlingStrategy(n,e,r,t)}var X,Y="@farris/bef NG_VARIABLE",Z=I.makePropDecorator(Y,function(e){return e}),$=(x(ee,X=I.Repository),Object.defineProperty(ee.prototype,"restService",{get:function(){return this.dataService.restService},enumerable:!0,configurable:!0}),Object.defineProperty(ee.prototype,"changeBuilder",{get:function(){return this.entityManager.changeBuilder},enumerable:!0,configurable:!0}),Object.defineProperty(ee.prototype,"changeHandler",{get:function(){return this.entityManager.changeHandler},enumerable:!0,configurable:!0}),ee.prototype.getList=function(){return this.dataService.getList(null,null,null,null)},ee.prototype.getById=function(e){return this.dataService.getById(e)},ee.prototype.updateById=function(e){return this.dataService.updateById(e)},ee.prototype.create=function(e){return this.dataService.create(e)},ee.prototype.append=function(e){return this.dataService.append(e)},ee.prototype.appendByPath=function(e){return this.dataService.appendByPath(e)},ee.prototype.removeById=function(e,t){return this.dataService.removeById(e,t)},ee.prototype.removeByIds=function(e,t){return this.dataService.removeByIds(e,t)},ee.prototype.removeByPath=function(e,t){return this.dataService.removeByPath(e,t)},ee.prototype.updateChangesById=function(e){return this.dataService.updateChangesById(e)},ee.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},ee.prototype.updateAllChanges=function(){return this.dataService.updateAllChanges()},ee.prototype.applyChanges=function(){return this.dataService.applyChanges()},ee.prototype.updateDataAndVariableChanges=function(){var e={FilterConditions:[],SortConditions:[],IsUsePagination:!0,Pagination:{PageIndex:1,PageSize:1,PageCount:0,TotalCount:0}},t=JSON.stringify(e),r=this.restService.buildRequestInfo();if(this.isEmptyRequestInfo(r))return d.of(null);var n=this.restService.baseUri+"/extension/query?entityFilter="+t,i={body:r};return this.restService.invoke(n,"PUT",null,i,!1,!0,!0)},ee.prototype.applyChangesById=function(e){return this.dataService.applyChangesById(e)},ee.prototype.cancelChanges=function(){return this.dataService.cancelChanges()},ee.prototype.clearAllEntityChanges=function(){return this.entityManager.clearAllEntityChanges()},ee.prototype.getDataChangeDetails=function(){return this.entityManager.buildAllEntityChangeDetails()},ee.prototype.handleDataChangeDetails=function(e){return this.entityManager.handleDataChangeDetails(e)},ee.prototype.getVariableChangeDetail=function(){return this.variableManager.buildChangeDetail()},ee.prototype.handleVariableChangeDetail=function(e){this.variableManager.handleChangeDetail(e)},ee.prototype.isEmptyRequestInfo=function(e){return!e||(!e.dataChange||e.dataChange.length<1)&&(!e.variableChange||Object.keys(e.variableChange).length<1)},ee.decorators=[{type:o.Injectable}],ee.ctorParameters=function(){return[]},ee);function ee(){return X.call(this)||this}var te,re=(x(ne,te=I.EntityManager),ne.prototype.buildAllEntityChangeDetails=function(){var r=this,n=[];return this.entityCollection.getAllEntities().forEach(function(e){if(0!==e.changes.length){var t=r.changeBuilder.build(e.changes);t&&t.ChangeInfo&&t.ChangeInfo.DataId&&n.push(t)}}),n},ne.prototype.buildEntityChangeDetailById=function(e){var t=this.entityCollection.getEntityById(e);return 0===t.changes.length?null:this.changeBuilder.build(t.changes)},ne.prototype.handleDataChangeDetails=function(e){this.changeHandler.handle(this.entityType,this.entityCollection,e)},ne.prototype.reset=function(){this.entityCollection.clear()},ne);function ne(e){var t=te.call(this,e)||this;return t.changeBuilder=new c(t.entityCollection.entityType,t.entityCollection),t.changeHandler=new h,t}var ie=(oe.createEmpty=function(e,t){var r={ChangeType:e,ChangeInfo:{}};return t&&(r.ChangeInfo.DataId=t),r},oe.getChangeInfo=function(e){return!0===this.isChangeDetail(e)?e.ChangeInfo:e},oe.isChangeDetail=function(e){var t=Object.keys(e);return 2===t.length&&-1<t.indexOf("ChangeType")&&-1<t.indexOf("ChangeInfo")},oe);function oe(){}var ae=(se.prototype.handleChangeDetail=function(e){},se.prototype.buildChangeDetail=function(){var o=this,a=ie.createEmpty(S.Modify);return this.ngVariableMap.forEach(function(e,t){var r=e.mapping,n=o.getValueFromUIState(r),i=o.innerValueMap.get(t);!1===o.isValueEqual(n,i)&&(o.innerValueMap.set(t,n),o.appendToChangeInfo(a,t,n))}),0===Object.keys(a.ChangeInfo).length?null:a},se.prototype.reset=function(){this.innerValueMap.clear()},se.prototype.appendToChangeInfo=function(e,t,r){if(!0===this.isUdtVariable(r)){var n=ie.createEmpty(S.Modify);n.ChangeInfo=r,e.ChangeInfo[t]=n}else e.ChangeInfo[t]=r},se.prototype.getValueFromUIState=function(e){var t=this.getRootUIState(),r=e.split(".").reduce(function(e,t){return e?e[t]:null},t);return r instanceof Date?n.format(r,"yyyy-MM-dd HH:mm:ss"):r},se.prototype.getRootUIState=function(){var e=this.appContext.frameContextManager.getRootFrameContext();if(this.injector){var t=this.injector.get(I.FrameContext,null);t&&(e=t.getVirtualRootFrameContext()||e)}if(e)return e.uiState},se.prototype.isValueEqual=function(e,t){return JSON.stringify(e)===JSON.stringify(t)},se.prototype.isUdtVariable=function(e){return e&&e.constructor&&"[object Object]"===e.toString()&&e.constructor.prototype.hasOwnProperty("isPrototypeOf")},se.prototype.setValueToUIState=function(e,t){},se.ctorParameters=function(){return[{type:I.AppContext},{type:undefined},{type:o.Injector,decorators:[{type:o.Optional}]}]},se);function se(e,t,r){var n=this;this.appContext=e,this.ngVariables=t,this.injector=r,this.ngVariableMap=new Map,this.innerValueMap=new Map,Object.keys(t).forEach(function(e){n.ngVariableMap.set(e,t[e])})}var pe=(ue.buildRequestInfo=function(e){return{dataChange:e.entityManager.buildAllEntityChangeDetails(),variableChange:e.variableManager.buildChangeDetail()}},ue);function ue(){}var ce=(ye.convertToPathArray=function(e,t){var n=this,r=I.BindingPathConverter.toBindingPathArray(e),i=[],o=t.list.currentItem;return i.push(o.primaryKeyValue),r.forEach(function(e){var t=I.PropertyUtil.getPropertyByName(o.properties,e);if(t.type!==I.BindingPropertyType.List)throw new Error(t.name+"不是子表对应的属性");var r=o[e];o=r.currentItem,i.push(n.trimTrailingS(e)),i.push(o.primaryKeyValue)}),i},ye.convertToPathUrl=function(e,t){var r=this.convertToPathArray(e,t);return r.pop(),"/"+r.join("/")},ye.convertToObjectCodes=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,i=[],o=1;o<n;o+=2)i.push(r[o]);return i},ye.convertToDataIdsForUpdate=function(e,t){for(var r=this.convertToPathArray(e,t),n=r.length,i=[],o=0;o<n;o+=2)i.push(r[o]);return i},ye.convertToDataIdsForAdd=function(e,t){var r=this.convertToDataIdsForUpdate(e,t);return r.pop(),r},ye.convertPathToUrl=function(e){for(var t=e.split("/"),r=t.length-1;0<r;r--)t[r]&&t[r].endsWith("s")&&(t[r]=t[r].substr(0,t[r].length-1).toLowerCase());return t.join("/")},ye.trimTrailingS=function(e){return e.substr(0,e.length-1)},ye.convertPathsToNodeCodes=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1===e.indexOf(":")}).forEach(function(e){t.push(e)}),t},ye.convertPathsToIds=function(e){var t=[];return!e||e.length<1||e.filter(function(e){return!!e&&-1!==e.indexOf(":")}).forEach(function(e){t.push(e.split(":")[1])}),t},ye);function ye(){}var he=(Object.defineProperty(le.prototype,"restProxy",{get:function(){return this.repository.restService.proxy},enumerable:!0,configurable:!0}),le.prototype.getList=function(e,t,r,n){var p=this;0!==r&&(r=r||this.repository.entityCollection.pageSize,n=n||this.repository.entityCollection.pageIndex);var i=this.buildEntityFilter(e,t,r,n),o=this.restService.buildRequestInfo();return this.restService.extendQuery(i,o).pipe(f.map(function(e){var t=e.returnValue,r=t.result;p.repository.buildEntities(r);var n=[];r.forEach(function(e){var t=p.repository.buildEntity(e);b.appendInitialData(t,e),n.push(t)});var i=t.pagination;if(i&&0<Object.keys(i).length){var o=i.pageSize,a=i.pageIndex,s=i.totalCount;p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:a,pageSize:o,totalCount:s})}else p.repository.entityCollection.updatePaginationInfoByPath("/",{pageIndex:1,pageSize:0,totalCount:n.length});return p.repository.entityCollection.loadEntities(n),n}))},le.prototype.buildEntityFilter=function(e,t,r,n){return e||t||r||n?(e&&0<e.length&&(e[e.length-1].Relation=0),{FilterConditions:e,SortConditions:t,IsUsePagination:0!==r,Pagination:{PageIndex:n,PageSize:r,PageCount:0,TotalCount:0}}):null},le.prototype.getById=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.extendRetrieve(e,t).pipe(f.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.loadEntities([r]),r}))},le.prototype.getPagedById=function(o){var a=this,e=this.restService.buildRequestInfo(),t=this.repository.entityCollection.getPaginationConfigByPath("/"),r=this.buildChildPagination(t),n=this.buildRetrieveParam(r);return this.restService.serviceRetrieve(o,n,e).pipe(f.map(function(e){var t=e.returnValue||{},r=t.result,n=t.pagination;a.updatePagination(n);var i=a.repository.entityCollection.getEntityById(o);return a.reloadEntityData(i,r),i}))},le.prototype.getByIdWithPaged=function(e){var o=this,t=this.restService.buildRequestInfo(),r=this.repository.entityCollection.getPaginationConfigByPath("/"),n=this.buildChildPagination(r),i=this.buildRetrieveParam(n);return this.restService.serviceRetrieve(e,i,t).pipe(f.map(function(e){var t=e.returnValue||{},r=t.result,n=t.pagination;o.updatePagination(n);var i=o.repository.buildEntity(r);return o.repository.entityCollection.loadEntities([i]),i}))},le.prototype.queryChild=function(s,e,t,r,n){var p=this,i=this.restService.buildRequestInfo(),u=ce.convertPathsToNodeCodes(s),o=u.map(function(e){return e.substring(0,e.length-1)}),a=ce.convertPathsToIds(s),c={nodeCodes:o,ids:a,pagination:{pageIndex:e,pageSize:t},requestInfo:i},y=u[u.length-1];y=y.substring(0,y.length-1);var h=a[a.length-1],l=y+"_"+h;return this.restService.queryChild(c).pipe(f.map(function(e){var t=e.returnValue;if(!t)return null;var r=t.result,n=void 0===r?[]:r,i=t.pagination,o=void 0===i?{}:i,a=[];n.forEach(function(e){var r=I.FieldMetadataUtil.getNgList(p.repository.entityType),n=null;u.forEach(function(e){var t=r[e];n=t.type,r=I.FieldMetadataUtil.getNgList(n)});var t=new n(e);b.appendInitialData(t,e),a.push(t)}),u=u.map(function(e){return e.charAt(0).toLocaleLowerCase()+e.substr(1)}),p.repository.entityCollection.setPaginationConfigByPath("/"+l,o),p.repository.entityCollection.setPaginationConfigByPath("/"+y,o),p.repository.entityCollection.resetEntities(s,a)}))},le.prototype.buildChildPagination=function(r){var n={};return Object.keys(r).forEach(function(e){var t=r[e];"object"==typeof t&&(n[e]=t)}),n},le.prototype.updatePagination=function(t){var r=this;t&&Object.keys(t).forEach(function(e){r.repository.entityCollection.setPaginationConfigByPath("/"+e,t[e])})},le.prototype.buildRetrieveParam=function(n,i){void 0===i&&(i=!1);var e={};if(n&&0<Object.keys(n).length){var o={};Object.keys(n).forEach(function(e){var t=n[e],r=t.pageIndex;i||(r=1),o[e]={pagination:{pageSize:t.pageSize||0,pageIndex:r}}}),e.filters=o}return e},le.prototype.editById=function(n){var i=this;if(!this.repository.entityCollection.getEntityById(n))return d.of(null);var e=pe.buildRequestInfo(this.repository);return this.restProxy.edit(n,e).pipe(f.map(function(e){var t=e.returnValue.data,r=i.repository.entityCollection.getEntityById(n);return r&&t&&i.reloadEntityData(r,t),r}))},le.prototype.updateById=function(n){var i=this;if(!this.repository.entityCollection.getEntityById(n))return d.of(null);var e=this.restService.buildRequestInfo();return this.restService.extendRetrieve(n,e).pipe(f.map(function(e){var t=e.returnValue,r=i.repository.entityCollection.getEntityById(n);return i.reloadEntityData(r,t),r}))},le.prototype.updateByIdWithPaged=function(e){var i=this,o=this.repository.entityCollection.getEntityById(e);if(!o)return d.of(null);var t=this.restService.buildRequestInfo(),r=this.repository.entityCollection.getPaginationConfigByPath("/"),n=this.buildChildPagination(r),a=this.buildRetrieveParam(n,!0);return this.restService.serviceRetrieve(e,a,t).pipe(f.map(function(e){var t=e.returnValue||{},r=t.result,n=t.pagination;return i.updatePagination(n),i.reloadEntityData(o,r),o}))},le.prototype.reloadEntityData=function(e,t){e&&(this.appContext.changeDetectionController.detach(),e.load(t),e.changes.splice(0,e.changes.length),this.appContext.changeDetectionController.reattach())},le.prototype.create=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(f.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return b.appendInitialData(r,t),n.repository.entityCollection.loadEntities([r]),r}))},le.prototype.append=function(e){var n=this,t=this.restService.buildRequestInfo();return this.restService.create(e,t).pipe(f.map(function(e){var t=e.returnValue,r=n.repository.buildEntity(t);return n.repository.entityCollection.addEntity(r),r}))},le.prototype.insert=function(n,e){var i=this,t=this.buildRequestInfo();return this.restProxy.create(e,t).pipe(f.map(function(e){var t=e.returnValue,r=i.repository.buildEntity(t);return i.repository.entityCollection.insertEntity(r,n),r}))},le.prototype.appendByPath=function(r){var n=this,e=this.restService.buildRequestInfo();return this.restService.createByPath(r,e).pipe(f.map(function(e){var t=e.returnValue;return n.repository.entityManager.appendEntityByPath(r,t,t)}))},le.prototype.insertByPath=function(r,n){var i=this,e=this.buildRequestInfo();return this.restProxy.createByPath(r,e).pipe(f.map(function(e){var t=e.returnValue;return i.repository.entityManager.insertEntityByPath(r,t,t,n)}))},le.prototype.removeById=function(t,e){var r=this;e=e===undefined||e;var n=this.restService.buildRequestInfo();return this.restService.extendDelete(t,n).pipe(f.switchMap(function(){return!0===e?r.applyChangesById(t).pipe(f.tap(function(e){e&&r.repository.entityCollection.removeEntityById(t)})):(r.repository.entityCollection.removeEntityById(t),r.repository.dataChangeHistory.addChange({dataId:t,changeType:I.DataChangeType.Delete}),d.of(!0))}))},le.prototype.removeAndSaveById=function(e){var t=this,r=pe.buildRequestInfo(this.repository);return this.restProxy.deleteAndSave(e,r).pipe(f.switchMap(function(){return t.repository.entityCollection.removeEntityById(e),d.of(!0)}))},le.prototype.removeByIds=function(r,e){var n=this;e=e===undefined||e;var t=this.restService.buildRequestInfo();return this.restService.extendBatchDelete(r,t).pipe(f.switchMap(function(){if(e)return n.applyChangesByIdArray(r).pipe(f.tap(function(e){e&&n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)})}));if(n.repository.entityCollection.removeEntities(function(e){return n.checkEntityValueExists(e,r)}),r&&0<r.length){var t=[];r.forEach(function(e){t.push({dataId:e,changeType:I.DataChangeType.Delete})}),n.repository.dataChangeHistory.addChanges(t)}return d.of(!0)}))},le.prototype.checkEntityValueExists=function(e,t){for(var r=!1,n=0;n<t.length;n++)if(e.primaryValue===t[n]){r=!0;break}return r},le.prototype.removeByPath=function(e,t){var r=this,n=this.restService.buildRequestInfo();return this.restService.extendDeletByPath(e,t,n).pipe(f.map(function(){return r.repository.entityManager.removeEntityByPath(e,t),r.repository.dataChangeHistory.addChange({fpath:e,dataId:t,changeType:I.DataChangeType.Delete}),!0}))},le.prototype.updateChangesById=function(e){var t=this,r=this.repository.entityCollection.getEntityById(e);if(!r.changes)return d.of(!0);if(0===r.changes.length)return d.of(!0);var n=this.repository.entityManager.buildEntityChangeDetailById(e),i=this.restService.buildRequestInfo();return this.restService.update(n,i).pipe(f.tap(function(){t.repository.entityManager.clearEntityChangesById(e)}),f.map(function(){return!0}))},le.prototype.updateChangesByPath=function(e,t){throw new Error("Not Implement")},le.prototype.updateAllChanges=function(){var r=this,n=[],e=this.repository.entityCollection.toArray();return 0===e.length?d.of(!0):(e.forEach(function(e){var t=r.updateChangesById(e.primaryValue);n.push(t)}),d.zip.apply(void 0,R(n)).pipe(f.map(function(){return!0})))},le.prototype.applyChanges=function(){var e=this,t=this.restService.buildRequestInfo();return this.restService.save(t).pipe(f.tap(function(){e.repository.entityManager.clearAllEntityChanges(),e.repository.dataChangeHistory.clear()}),f.map(function(){return!0}))},le.prototype.applyChangesByIdArray=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(f.tap(function(){t.repository.entityManager.clearEntityChangesByArray(e),t.repository.dataChangeHistory.clearByIds(e)}),f.map(function(){return!0}))},le.prototype.applyChangesById=function(e){var t=this,r=this.restService.buildRequestInfo();return this.restService.save(r).pipe(f.tap(function(){t.repository.entityManager.clearEntityChangesById(e),t.repository.dataChangeHistory.clearByIds([e])}),f.map(function(){return!0}))},le.prototype.cancelChanges=function(){var e=this;return this.restService.cancel().pipe(f.tap(function(){e.repository.entityManager.clearAllEntityChanges(),e.repository.dataChangeHistory.clear()}),f.map(function(){return!0}))},le.prototype.buildRequestInfo=function(){return{dataChange:this.repository.entityManager.buildAllEntityChangeDetails(),variableChange:this.repository.variableManager.buildChangeDetail()}},le);function le(e,t){this.injector=e,this.repository=t;var r=e.get(g),n=e.get(a.HttpClient),i=e.get(p)+"/"+this.repository.apiUri,o=e.get(I.EventBus);this.restService=new Pe(n,i,r,this.repository,o),this.appContext=e.get(I.AppContext)}var de=(fe.prototype.onResponse=function(e,t){return e&&e.innerDataChange&&!0!==t&&this.context.handleDataChangeDetails(e.innerDataChange),this.context.clearAllEntityChanges(),e&&e.hasOwnProperty("returnValue")?e.returnValue:e},fe.prototype.onError=function(e,t,r){var n,i,o=this.context.appContext.getFormAppContext(),a=o.ApplicationId,s=window.DEVKIT_LOADING_SERVICE;if(s&&s instanceof Array&&0<s.length)try{for(var p=B(s),u=p.next();!u.done;u=p.next()){var c=u.value;"function"==typeof c.clearAll&&c.clearAll()}}catch(l){n={error:l}}finally{try{u&&!u.done&&(i=p["return"])&&i.call(p)}finally{if(n)throw n.error}}if(t)return d.throwError(e);var y=this.context.restService.eventBus,h=window[a]||{};return y&&h.isExceptionHandlerExist?(y.post("Exception","","onException",e,o),r?d.of(null):d.EMPTY):d.throwError(e)},fe.prototype.extendHeaders=function(t){var r=this;return this.context.restService.sessionService.getBeSessionId().pipe(f.switchMap(function(e){return t=r.context.restService.sessionService.extendRequestHeaders(t),d.of(t)}))},fe.prototype.extendUrl=function(e,t){if(!t)return e;for(var r in t)if(t.hasOwnProperty(r)){var n=JSON.stringify(t[r]);e=-1===e.indexOf("?")?e+"?"+r+"="+n:e+"&"+r+"="+n}return e},fe.prototype.extendBody=function(t){var r=this;return!t||"object"!=typeof t||Object.keys(t).length<1||(Object.keys(t).forEach(function(e){"requestInfo"===e&&(t.requestInfo=r.context.restService.buildRequestInfo())}),1===Object.keys(t).length&&(t=Object.values(t)[0])),t},fe.prototype.parseHeaders=function(e){var t="BEFSessionID";e.headers&&e.headers.has(t)&&this.context.restService.sessionService.setBeSessionId(e.headers.get(t))},fe);function fe(e){this.context=e}var ge,ve=(x(Ie,ge=$),Object.defineProperty(Ie.prototype,"proxy",{get:function(){return this.befProxy},set:function(e){this.befProxy=e,this.befProxy.setProxyExtend(new de(this))},enumerable:!0,configurable:!0}),Ie.prototype.getEntities=function(e,t,r,n){return this.dataService.getList(e,t,r,n)},Ie.prototype.getPagedById=function(e){return this.dataService.getPagedById(e)},Ie.prototype.getByIdWithPaged=function(e){return this.dataService.getByIdWithPaged(e)},Ie.prototype.queryChild=function(e,t,r,n,i){return this.dataService.queryChild(e,t,r,n,i)},Ie.prototype.getEntityById=function(e){return this.dataService.getById(e)},Ie.prototype.updateEntityById=function(e){return this.dataService.updateById(e)},Ie.prototype.updateByIdWithPaged=function(e){return this.dataService.updateByIdWithPaged(e)},Ie.prototype.editEntityById=function(e){return this.dataService.editById(e)},Ie.prototype.createEntity=function(e){return this.dataService.create(e)},Ie.prototype.appendEntity=function(e){return this.dataService.append(e)},Ie.prototype.insert=function(e,t){return this.dataService.insert(e,t)},Ie.prototype.insertByPath=function(e,t){return this.dataService.insertByPath(e,t)},Ie.prototype.appendEntityByPath=function(e){return this.dataService.appendByPath(e)},Ie.prototype.removeEntityById=function(e,t){return this.dataService.removeById(e,t)},Ie.prototype.removeEntityAndSaveById=function(e){return this.dataService.removeAndSaveById(e)},Ie.prototype.removeEntityByPath=function(e,t){return this.dataService.removeByPath(e,t)},Ie.prototype.saveEntityById=function(e){return this.dataService.applyChangesById(e)},Ie.prototype.saveEntities=function(){return this.dataService.applyChanges()},Ie.prototype.cancelEntityChanges=function(){return this.dataService.cancelChanges()},Ie.prototype.reset=function(){this.entityManager.reset(),this.variableManager.reset(),this.restService.sessionService.clearBeSessionId()},Ie.prototype.getInjector=function(){return this.injector},Ie.decorators=[{type:o.Injectable}],Ie.ctorParameters=function(){return[{type:o.Injector}]},Ie);function Ie(e){var t=ge.call(this)||this;t.injector=e,t.entityManager=new re(t.entityCollection),t.appContext=t.injector.get(I.AppContext);var r=I.MetadataUtil.getPropsMetadatasByName(t.constructor,Y);return t.variableManager=new ae(t.appContext,r,t.injector),t.dataService=new he(t.injector,t),t.serverUri=e.get(p),t}var Se=(be.prototype.extendUri=function(e){return this.serverUri+"/"+e},be.decorators=[{type:o.Injectable}],be.ctorParameters=function(){return[{type:String,decorators:[{type:o.Inject,args:[p]}]}]},be);function be(e){this.serverUri=e}var Ce="DELETE",me="PUT",Ee="POST",xe=(Be.prototype.setBaseUri=function(e){this.baseUri=e},Be.prototype.setProxyExtend=function(e){this.proxyExtend=e},Be.prototype.query=function(e){var t=this.baseUri;return e&&(t=t+"?entityFilter="+JSON.stringify(e)),this.request(t,"GET")},Be.prototype.extendQuery=function(e,t){var r=this.baseUri+"/extension/query";e&&(r=r+"?entityFilter="+JSON.stringify(e));var n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i,!1)},Be.prototype.retrieve=function(e){var t=this.baseUri+"/"+e;return this.request(t,"GET")},Be.prototype.serviceRetrieve=function(e,t,r){var n=this.baseUri+"/service/retrieve/"+e,i={body:{retrieveParam:t,requestInfo:r}};return this.request(n,me,null,i)},Be.prototype.queryChild=function(e){var t=this.baseUri+"/service/querychild",r={body:e};return this.request(t,me,null,r)},Be.prototype.extendRetrieve=function(e,t){var r=this.baseUri+"/extension/retrieve/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.edit=function(e,t){var r=this.baseUri+"/service/edit/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.create=function(e,t){var r={defaultValue:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,Ee,null,n)},Be.prototype.createByPath=function(e,t){var r=ce.convertPathToUrl(e),n=""+this.baseUri+r,i=t,o=this.addBodyToOptions({},i);return this.request(n,Ee,null,o)},Be.prototype.update=function(e,t){var r={changeDetail:e,requestInfo:t},n=this.addBodyToOptions({},r);return this.request(this.baseUri,"PATCH",null,n)},Be.prototype.save=function(e){var t=e,r=this.addBodyToOptions({},t);return this.request(this.baseUri,me,null,r)},Be.prototype["delete"]=function(e){var t=this.baseUri+"/"+e;return this.request(t,Ce)},Be.prototype.deleteAndSave=function(e,t){var r=this.baseUri+"/service/delete/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.extendDelete=function(e,t){var r=this.baseUri+"/extension/delete/"+e,n=t,i=this.addBodyToOptions({},n);return this.request(r,me,null,i)},Be.prototype.deletByPath=function(e,t){var r=ce.convertPathToUrl(e),n=""+this.baseUri+r+"/"+t;return this.request(n,Ce)},Be.prototype.extendDeletByPath=function(e,t,r){var n=ce.convertPathToUrl(e),i=this.baseUri+"/extension"+n+"/"+t,o=r,a=this.addBodyToOptions({},o);return this.request(i,me,null,a)},Be.prototype.batchDelete=function(e){var t={ids:e.join(",")};return this.request(this.baseUri,Ce,t)},Be.prototype.extendBatchDelete=function(e,t){var r=this.baseUri+"/extension/batchdelete",n={ids:e.join(",")},i=t,o=this.addBodyToOptions({},i);return this.request(r,me,n,o)},Be.prototype.cancel=function(){var e=this.baseUri+"/service/cancel";return this.request(e,Ee)},Be.prototype.request=function(t,r,e,n,i,o,a){var s=this;n=n||{},void 0!==i&&"boolean"==typeof i||(i=!1),void 0!==o&&"boolean"==typeof o||(o=!1),e&&(n.params=e),n.headers=D.convertToHeaders(n.headers);var p=this.hasRequestInfo(n);return n&&n.body&&n.body.hasOwnProperty("RequestInfo")&&(n.body.requestInfo=n.body.RequestInfo,delete n.body.RequestInfo),this.proxyExtend.extendHeaders(n.headers).pipe(f.switchMap(function(e){return n.headers=D.toJson(e),n.observe="response",s.httpService.request(r,t,n)}),f.tap(function(e){return s.proxyExtend.parseHeaders(e)}),f.map(function(e){return e.body}),f.map(function(e){return p?(s.proxyExtend.onResponse(e,a),e):s.unWrapResponseInfo(e)}),f.catchError(function(e){return s.proxyExtend.onError(e,i,o)}))},Be.prototype.invoke=function(t,r,n){var i=this;return n.params&&(t=this.proxyExtend.extendUrl(t,n.params),n.params=null),n.body&&(n.body=this.proxyExtend.extendBody(n.body)),n.headers=D.convertToHeaders(n.headers),this.proxyExtend.extendHeaders(n.headers).pipe(f.switchMap(function(e){return n.headers=D.toJson(e),n.observe="response",i.httpService.request(r,t,n).pipe(f.tap(function(e){return i.proxyExtend.parseHeaders(e)}),f.map(function(e){return e.body}),f.map(function(e){return i.proxyExtend.onResponse(e)}),f.catchError(function(e){return i.proxyExtend.onError(e,!1,!1)}))}))},Be.prototype.addBodyToOptions=function(e,t){return e=e||{},Object.assign(e,{body:t})},Be.prototype.buildParams=function(e){return O.buildParams(e)},Be.prototype.hasRequestInfo=function(e){return T.hasRequestInfo(e)||T.hasRequestInfoWithR(e)},Be.prototype.unWrapResponseInfo=function(e){return U.unWrapResponseInfo(e)},Be.decorators=[{type:o.Injectable}],Be.ctorParameters=function(){return[{type:a.HttpClient},{type:Se}]},Be);function Be(e,t){this.httpClient=e,this.uriService=t,this.httpService=new A(this.httpClient)}var Pe=(Object.defineProperty(Re.prototype,"proxy",{get:function(){return this.repository.proxy?this.repository.proxy:this.createBefProxy()},enumerable:!0,configurable:!0}),Re.prototype.createBefProxy=function(){var e=this.repository.serverUri,t=new Se(e),r=new xe(this.httpClient,t);r.setBaseUri(this.baseUri);var n=new de(this.repository);return r.setProxyExtend(n),r},Re.prototype.query=function(e){return this.proxy.query(e)},Re.prototype.extendQuery=function(e,t){return this.proxy.extendQuery(e,t)},Re.prototype.serviceRetrieve=function(e,t,r){return this.proxy.serviceRetrieve(e,t,r)},Re.prototype.queryChild=function(e){return this.proxy.queryChild(e)},Re.prototype.retrieve=function(e){return this.proxy.retrieve(e)},Re.prototype.extendRetrieve=function(e,t){return this.proxy.extendRetrieve(e,t)},Re.prototype.create=function(e,t){return this.proxy.create(e,t)},Re.prototype.createByPath=function(e,t){return this.proxy.createByPath(e,t)},Re.prototype.update=function(e,t){return this.proxy.update(e,t)},Re.prototype.save=function(e){return this.proxy.save(e)},Re.prototype["delete"]=function(e){return this.proxy["delete"](e)},Re.prototype.extendDelete=function(e,t){return this.proxy.extendDelete(e,t)},Re.prototype.deletByPath=function(e,t){return this.proxy.deletByPath(e,t)},Re.prototype.extendDeletByPath=function(e,t,r){return this.proxy.extendDeletByPath(e,t,r)},Re.prototype.batchDelete=function(e){return this.proxy.batchDelete(e)},Re.prototype.extendBatchDelete=function(e,t){return this.proxy.extendBatchDelete(e,t)},Re.prototype.cancel=function(){return this.proxy.cancel()},Re.prototype.request=function(e,t,r,n,i,o,a){return this.innerRequest(e,t,r,n,i,o,a,!1)},Re.prototype.invoke=function(e,t,r,n,i,o,a){if(n&&n.body&&n.body.RequestInfo)throw new Error("请使用requestInfo提交变更");return this.innerRequest(e,t,r,n,i,o,a,!0)},Re.prototype.innerRequest=function(t,r,e,n,i,o,a,s){var p=this;n=n||{};var u="BEFSessionID";void 0!==i&&"boolean"==typeof i||(i=!1),void 0!==o&&"boolean"==typeof o||(o=!1),void 0!==s&&"boolean"==typeof s||(s=!1);var c=s?this.existRequestInfo:this.hasRequestInfo;e&&(n.params=e);var y=c(n),h=D.convertToHeaders(n.headers);return this.sessionService.getBeSessionId().pipe(f.switchMap(function(e){return h=p.sessionService.extendRequestHeaders(h),n.headers=D.toJson(h),n.observe="response",p.httpService.request(r,t,n)}),f.tap(function(e){e.headers&&e.headers.has(u)&&p.sessionService.setBeSessionId(e.headers.get(u))}),f.map(function(e){return e.body}),f.map(function(e){return p.handleReponseInfo(e,y,a)}),f.catchError(function(e){return p.handleErrors(e,i,o)}))},Re.prototype.handleReponseInfo=function(e,t,r){return t?(e&&e.innerDataChange&&!0!==r&&this.repository.handleDataChangeDetails(e.innerDataChange),this.repository.clearAllEntityChanges(),e):this.unWrapResponseInfo(e)},Re.prototype.handleErrors=function(e,t,r){if(this.clearLoading(),t)return d.throwError(e);var n=this.repository.appContext.getFormAppContext(),i=n.ApplicationId,o=!!(window[i]||{}).isExceptionHandlerExist;return this.eventBus&&o?(this.eventBus.post("Exception","","onException",e,n),r?d.of(null):d.empty()):d.throwError(e)},Re.prototype.clearLoading=function(){var e,t;if(!1!==(window.DEVKIT_LOADING_SERVICE&&window.DEVKIT_LOADING_SERVICE instanceof Array&&0<window.DEVKIT_LOADING_SERVICE.length||!1)){var r=window.DEVKIT_LOADING_SERVICE;try{for(var n=B(r),i=n.next();!i.done;i=n.next()){var o=i.value;"function"==typeof o.clearAll&&o.clearAll()}}catch(a){e={error:a}}finally{try{i&&!i.done&&(t=n["return"])&&t.call(n)}finally{if(e)throw e.error}}}},Re.prototype.unWrapResponseInfo=function(e){return U.unWrapResponseInfo(e)},Re.prototype.hasRequestInfo=function(e){return T.hasRequestInfoWithR(e)},Re.prototype.existRequestInfo=function(e){return T.hasRequestInfo(e)},Re.prototype.buildParams=function(e){return O.buildParams(e)},Re.prototype.buildBodyWithRequestInfo=function(e){return T.buildBodyWithRequestInfo(e,this.repository)},Re.prototype.buildRequestInfo=function(){return T.buildRequestInfo(this.repository)},Re.decorators=[{type:o.Injectable}],Re.ctorParameters=function(){return[{type:a.HttpClient},{type:String},{type:g},{type:ve},{type:I.EventBus}]},Re);function Re(e,t,r,n,i){this.httpClient=e,this.httpService=new A(this.httpClient),this.baseUri=t;var o=n.getInjector();this.sessionService=new z(e,t,r,o),this.repository=n,this.eventBus=i}var De=(qe.prototype.getData=function(e,t){var r=e.split(".")[0],n=e.split(".")[1];return t=t||{},!0===this.ifEnableExtendLoadMethod(e)?this.extendGetHelpData(n,r,t):this.getHelpData(n,r,t)},qe.prototype.saveUserSettings=function(e){return this.befRepository.restService.invoke("/api/runtime/bcc/v1.0/datagrid/settings","POST",null,{body:e},!1)},qe.prototype.getUserSettings=function(e){var t="/api/runtime/bcc/v1.0/datagrid/settings/"+e;return this.befRepository.restService.invoke(t,"GET",null,null,!1)},qe.prototype.ifEnableExtendLoadMethod=function(e){if(this.context&&this.context.hasOwnProperty("enableExtendLoadMethod"))return this.context.enableExtendLoadMethod;var t=!1;if(this.frameContext){var r=e+"@"+this.frameContext.repository.apiUri;t=this.frameContext.getParam(r)}return t},qe.prototype.getHelpData=function(e,t,r){var n=this,i=this.befRepository.restService.baseUri+"/elementhelps/"+e;return this.befRepository.updateDataAndVariableChanges().pipe(f.switchMap(function(){return n.befRepository.restService.invoke(i,"GET",{nodeCode:t,queryParam:JSON.stringify(r)},null,!1)}))},qe.prototype.extendGetHelpData=function(e,t,r){var n=this.befRepository.restService.baseUri+"/extension/elementhelps",i={body:{labelId:e,nodeCode:t,queryParam:r,requestInfo:this.befRepository.restService.buildRequestInfo()}};return this.befRepository.restService.invoke(n,"PUT",null,i,!1,!0,!0).pipe(f.map(function(e){return e&&e.returnValue||null}))},qe.prototype.convert2TreeDataWithPathCode=function(n,t,r){var i=this;void 0===t&&(t=1),void 0===r&&(r="01");var e=n.filter(function(e){return e.layer===t&&e.pathcode===r});if(1<t&&(e=n.filter(function(e){return e.layer===t&&e.pathcode.substr(0,2*(t-1))===r})),e.length){var o=e.map(function(e){return{data:e,children:[]}});return o.forEach(function(e){var t,r=i.convert2TreeDataWithPathCode(n,e.data.layer+1,e.data.pathcode);(t=e.children).push.apply(t,R(r))}),o}},qe.decorators=[{type:o.Injectable}],qe.ctorParameters=function(){return[{type:I.Repository},{type:I.FrameContext,decorators:[{type:o.Optional}]}]},qe);function qe(e,t){this.frameContext=t,this.befRepository=e}var Oe=(we.prototype.createSession=function(e){var t=this.sessionService.getUserSessionId();return t?this.befRepository.restService.invoke(e,"POST",null,{headers:new a.HttpHeaders({SessionId:t}),responseType:"text"},!1).pipe(f.switchMap(function(e){return d.of({status:!0,payload:e})})):d.of({status:!1,payload:"用户登录信息已过期,请重新登录"})},we.prototype.getData=function(e,t){var r=this,n={};t.condition&&(n=t.condition),"/"===e[e.length-1]&&(e=e.substr(0,e.length-1));var i=e+"/extension/query",o=e+"/service/createsession";if(n){var a=JSON.stringify(n);i=i+"?entityFilter="+a}return this.createSession(o).pipe(f.switchMap(function(e){if(e.status)return e.payload,r.befRepository.restService.invoke(i,"PUT",null,{},!1);throw new Error(e.payload)}),s.map(function(e){var t=e.returnValue,r={items:t.result};return t.pagination?Object.assign({},r,{total:t.pagination.totalCount,pageInfo:{pageSize:t.pagination.pageSize,pageIndex:t.pagination.pageIndex,enablePager:!0}}):r}))},we.decorators=[{type:o.Injectable}],we.ctorParameters=function(){return[{type:I.Repository},{type:g}]},we);function we(e,t){this.sessionService=t,this.befRepository=e}var Te=(je.isExistUnsaveData=function(e){var t=!1;if(!e||!e.entityCollection)throw"Current Object is null or it's entityCollection is null.";var r=e.entityCollection.toArray();if(e.dataChangeHistory.isChanged())return!0;for(var n=0;n<r.length;n++)if(0<r[n].changes.length){t=!0;break}return t},je);function je(){}var Ue=(Me.prototype.toString=function(){return this.url},Me);function Me(e,t){void 0===t&&(t=null);var r=this;this.url=e,this.paths=t,this.paths&&Object.keys(t).forEach(function(e){-1!==r.url.indexOf("{"+e+"}")&&(r.url=r.url.replace("{"+e+"}",""+t[e]))})}var Ae=(He.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return this.befRest.restService.invoke(e,r,t,{headers:n})},He.decorators=[{type:o.Injectable}],He.ctorParameters=function(){return[{type:I.Repository}]},He);function He(e){this.befRest=e}var Ve=(ke.prototype.getData=function(e,t,r){void 0===t&&(t={}),void 0===r&&(r="GET");var n=new a.HttpHeaders({"content-type":"application/json"});return this.befRest.restService.invoke(e,r,t,{headers:n})},ke.decorators=[{type:o.Injectable}],ke.ctorParameters=function(){return[{type:I.Repository}]},ke);function ke(e){this.befRest=e}e.VERSION="ver.",e.ChangeDetailType=S,e.BE_SERVER_URI_TOKEN=p,e.BE_SESSION_HANDLING_STRATEGY_TOKEN=u,e.BefChangeBuilder=c,e.BefChangeHandler=h,e.BefSessionService=z,e.BefRestService=Pe,e.BefProxy=xe,e.BefLookupRestService=De,e.BefLookupDefaultService=Oe,e.BefRepository=ve,e.FrameworkSessionService=g,e.NG_VARIABLE=Y,e.NgVariable=Z,e.BefRepositoryUtil=Te,e.BefDataPathUtil=ce,e.UriService=Se,e.Uri=Ue,e.DefaultComboHttpService=Ae,e.DefaultDynamiControlGroupHttpService=Ve,e.ɵa=$,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=farris-bef.umd.min.js.map
{
"name": "@farris/bef",
"version": "0.0.12-20200904172208-dev",
"version": "0.0.12-20200908200114-dev",
"peerDependencies": {

@@ -5,0 +5,0 @@ "@angular/common": "^7.2.0",

Sorry, the diff of this file is too big to display

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 too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc