@wavemaker/app-runtime-wm-build 11.5.0-next.40002 → 11.5.0-next.40301
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- app-runtime-wm-build/package.json +1 -1
- app-runtime-wm-build/wmapp/scripts/wm-libs.js +27 -32
- app-runtime-wm-build/wmapp/scripts/wm-libs.min.js +1 -1
- app-runtime-wm-build/wmapp/scripts/wm-loader.js +274 -271
- app-runtime-wm-build/wmapp/scripts/wm-loader.min.js +10 -10
- app-runtime-wm-build/wmapp/styles/css/wm-style.css +1 -1
- app-runtime-wm-build/wmmobile/scripts/wm-libs.js +27 -32
- app-runtime-wm-build/wmmobile/scripts/wm-libs.min.js +1 -1
- app-runtime-wm-build/wmmobile/scripts/wm-mobileloader.js +274 -271
- app-runtime-wm-build/wmmobile/scripts/wm-mobileloader.min.js +22 -22
- app-runtime-wm-build/wmmobile/styles/css/wm-style.css +1 -1
|
@@ -200791,42 +200791,38 @@ window.requestAnimationFrame = function() {
|
|
|
200791
200791
|
return info;
|
|
200792
200792
|
};
|
|
200793
200793
|
ServiceVariableManager.prototype.handleRequestMetaError = function(info, variable, success, errorCB, options) {
|
|
200794
|
-
|
|
200795
|
-
|
|
200796
|
-
|
|
200797
|
-
|
|
200798
|
-
|
|
200799
|
-
|
|
200800
|
-
break;
|
|
200794
|
+
var err_type = lodash__WEBPACK_IMPORTED_MODULE_10___default().get(info, "error.type");
|
|
200795
|
+
switch (err_type) {
|
|
200796
|
+
case _constants_variables_constants__WEBPACK_IMPORTED_MODULE_5__.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.NO_ACCESSTOKEN:
|
|
200797
|
+
(0, _util_oAuth_utils__WEBPACK_IMPORTED_MODULE_7__.performAuthorization)(undefined, info.securityDefnObj[_constants_variables_constants__WEBPACK_IMPORTED_MODULE_5__.VARIABLE_CONSTANTS.REST_SERVICE.OAUTH_PROVIDER_KEY], this.invoke.bind(this, variable, options, success, errorCB), null, this.getProviderInfo(variable, info.securityDefnObj["x-WM-PROVIDER_ID"]));
|
|
200798
|
+
this.processErrorResponse(variable, info.error.message, errorCB, options.xhrObj, true, true);
|
|
200799
|
+
break;
|
|
200801
200800
|
|
|
200802
|
-
|
|
200803
|
-
|
|
200804
|
-
|
|
200805
|
-
|
|
200801
|
+
case _constants_variables_constants__WEBPACK_IMPORTED_MODULE_5__.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.USER_UNAUTHORISED:
|
|
200802
|
+
info = this.handleAuthError(variable, success, errorCB, options);
|
|
200803
|
+
this.processErrorResponse(variable, info.error.message, errorCB, options.xhrObj, options.skipNotification, info.error.skipDefaultNotification);
|
|
200804
|
+
break;
|
|
200806
200805
|
|
|
200807
|
-
|
|
200808
|
-
|
|
200809
|
-
|
|
200810
|
-
|
|
200811
|
-
|
|
200812
|
-
|
|
200813
|
-
|
|
200814
|
-
|
|
200815
|
-
|
|
200816
|
-
}
|
|
200817
|
-
console.warn(info.error.message + "\n Possible reasons for this:\n " + reasons.join("\n "));
|
|
200806
|
+
case _constants_variables_constants__WEBPACK_IMPORTED_MODULE_5__.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.METADATA_MISSING:
|
|
200807
|
+
case _constants_variables_constants__WEBPACK_IMPORTED_MODULE_5__.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.CRUD_OPERATION_MISSING:
|
|
200808
|
+
if (info.error.message) {
|
|
200809
|
+
info.error.message = info.error.message.replace("$variable", variable.name);
|
|
200810
|
+
var reasons = void 0;
|
|
200811
|
+
if (err_type === _constants_variables_constants__WEBPACK_IMPORTED_MODULE_5__.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.METADATA_MISSING) {
|
|
200812
|
+
reasons = [ "1. You did not Preview the app after creating a Variable for the imported service.", "2. You deleted the imported service this Variable is linked to." ];
|
|
200813
|
+
} else {
|
|
200814
|
+
reasons = [ "1. You haven't chosen an endpoint for " + options.operation + " operation for this Entity." ];
|
|
200818
200815
|
}
|
|
200819
|
-
|
|
200820
|
-
|
|
200816
|
+
console.warn(info.error.message + "\n Possible reasons for this:\n " + reasons.join("\n "));
|
|
200817
|
+
}
|
|
200818
|
+
this.processErrorResponse(variable, info.error.message, errorCB, options.xhrObj, options.skipNotification, info.error.skipDefaultNotification);
|
|
200819
|
+
break;
|
|
200821
200820
|
|
|
200822
|
-
|
|
200823
|
-
|
|
200824
|
-
|
|
200825
|
-
|
|
200826
|
-
}
|
|
200821
|
+
default:
|
|
200822
|
+
if (info.error.message) {
|
|
200823
|
+
console.warn(info.error.message, variable.name);
|
|
200824
|
+
this.processErrorResponse(variable, info.error.message, errorCB, options.xhrObj, options.skipNotification, info.error.skipDefaultNotification);
|
|
200827
200825
|
}
|
|
200828
|
-
} catch (err) {
|
|
200829
|
-
console.error(err);
|
|
200830
200826
|
}
|
|
200831
200827
|
return info;
|
|
200832
200828
|
};
|
|
@@ -200947,7 +200943,6 @@ window.requestAnimationFrame = function() {
|
|
|
200947
200943
|
var info = this.handleRequestMetaError(requestParams, variable, success, error, options);
|
|
200948
200944
|
var reason = (lodash__WEBPACK_IMPORTED_MODULE_10___default().get(info, "error.message") || "An error occurred while triggering the variable: ") + ": " + variable.name;
|
|
200949
200945
|
(0, _util_utils__WEBPACK_IMPORTED_MODULE_0__.triggerFn)(error);
|
|
200950
|
-
_util_inflight_queue__WEBPACK_IMPORTED_MODULE_3__.$queue.process(variable);
|
|
200951
200946
|
return Promise.reject(reason);
|
|
200952
200947
|
}
|
|
200953
200948
|
if (_util_variable_service_variable_utils__WEBPACK_IMPORTED_MODULE_2__.ServiceVariableUtils.isFileUploadRequest(variable)) {
|
|
@@ -4283,7 +4283,7 @@ i.version="2.29.4",o(Zn),i.fn=lo,i.min=er,i.max=tr,i.now=nr,i.utc=m,i.unix=co,i.
|
|
|
4283
4283
|
/*!**********************************************************!*\
|
|
4284
4284
|
!*** ./src/manager/variable/service-variable.manager.ts ***!
|
|
4285
4285
|
\**********************************************************/
|
|
4286
|
-
(e,t,n)=>{"use strict";n.r(t),n.d(t,{ServiceVariableManager:()=>g});var r,i=n(/*! ../../util/utils */"./src/util/utils.ts"),o=n(/*! ../../util/file-upload.util */"./src/util/file-upload.util.ts"),a=n(/*! ../../util/variable/service-variable.utils */"./src/util/variable/service-variable.utils.ts"),s=n(/*! ../../util/inflight-queue */"./src/util/inflight-queue.ts"),u=n(/*! ./base-variable.manager */"./src/manager/variable/base-variable.manager.ts"),l=n(/*! ../../constants/variables.constants */"./src/constants/variables.constants.ts"),c=n(/*! ../../util/variable/variables.utils */"./src/util/variable/variables.utils.ts"),d=n(/*! ../../util/oAuth.utils */"./src/util/oAuth.utils.ts"),p=n(/*! ../../util/variable/pagination.utils */"./src/util/variable/pagination.utils.ts"),h=n(/*! ../../model/base-variable */"./src/model/base-variable.ts"),f=n(/*! lodash */"./node_modules/lodash/lodash.js"),m=n.n(f),v=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.fileUploadResponse=[],t.fileUploadCount=0,t.totalFilesCount=0,t.successFileUploadCount=0,t.failedFileUploadCount=0,t}return v(t,e),t.prototype.processErrorResponse=function(e,t,n,r,o,a){var u=this.getMethodInfo(e,{},{}),p=m().get(u,"securityDefinitions.0"),f=this.prepareCallbackOptions(r);o||(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,t,f,a),m().get(p,"type")===l.VARIABLE_CONSTANTS.REST_SERVICE.SECURITY_DEFN.OAUTH2&&m().includes([l.VARIABLE_CONSTANTS.HTTP_STATUS_CODE.UNAUTHORIZED,l.VARIABLE_CONSTANTS.HTTP_STATUS_CODE.FORBIDDEN],m().get(r,"status"))&&(0,d.removeAccessToken)(p["x-WM-PROVIDER_ID"]),(0,i.triggerFn)(n,t),e.notify(h.VariableEvents.AFTER_INVOKE,[this,t]),l.CONSTANTS.isStudioMode||(e.canUpdate=!0,s.$queue.process(e),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.CAN_UPDATE,e,t,f))},t.prototype.processSuccessResponse=function(e,t,n,r,o,a){var u,d,f,v={},g=(0,i.getValidJSON)(e);e=(0,i.isDefined)(g)?g:(0,i.xmlToJson)(e)||e;var y=(0,i.isPageable)(e);if("DataService"===t.serviceType||"JavaService"===t.serviceType){var _=(0,c.decodeData)(e);m().isString(e)&&(e=_)}y?(u=e.content,v=m().omit(e,"content")):u=e,f=this.prepareCallbackOptions(n.xhrObj,{pagination:v,rawData:u}),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.RESULT,t,e,f),(0,i.triggerFn)(r,e,v),t.transformationColumns&&this.transformData(e,t),u=m().isObject(u)?u:{value:u},d=(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.PREPARE_SETDATA,t,u,f),(0,i.isDefined)(d)&&(u=d);var b=(0,i.getClonedObject)(n.inputFields||t.dataBinding),w=a||this.getMethodInfo(t,b,n),S=p.PaginationUtils.getPaginationInfo(w,t);if(S){var E=p.PaginationUtils.generatePaginationRes(w,S,e,o,n,t);m().isEmpty(E)||p.PaginationUtils.setVariablePagination(t,E,n)}return n.forceRunMode||n.skipDataSetUpdate||(t._paginationConfig||(t.pagination=v),t.dataSet=u,y&&Object.defineProperty(t.dataSet,"content",{get:function(){return t.dataSet}})),t.notify(h.VariableEvents.AFTER_INVOKE,[this,u]),setTimeout((function(){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.SUCCESS,t,u,f),l.CONSTANTS.isStudioMode||(t.canUpdate=!0,s.$queue.process(t)),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.CAN_UPDATE,t,u,f)})),{data:t.dataSet,pagination:t.pagination}},t.prototype.uploadFileInFormData=function(e,t,n,r,i,a){var s=this,u=(0,o.upload)(i,e,a.data,{fileParamName:"files",url:a.url});return u.then((function(r){return s.fileUploadCount++,s.successFileUploadCount++,s.fileUploadResponse.push(r[0]),s.totalFilesCount===s.fileUploadCount&&(0===s.failedFileUploadCount?(s.processSuccessResponse(s.fileUploadResponse,e,t,n),s.fileUploadResponse=[],e.onSuccess||c.appManager&&c.appManager.notifyApp(c.appManager.getAppLocale().MESSAGE_FILE_UPLOAD_SUCCESS,"success")):((0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,s.fileUploadResponse),s.fileUploadResponse=[],c.appManager&&c.appManager.notifyApp(c.appManager.getAppLocale().MESSAGE_FILE_UPLOAD_ERROR,"error")),s.fileUploadCount=0,s.successFileUploadCount=0,s.totalFilesCount=0),r}),(function(n){s.fileUploadCount++,s.failedFileUploadCount++,s.fileUploadResponse.push(n);var o=(0,c.getErrMessage)(n,e.httpService.getLocale());return e._progressObservable&&e._progressObservable.next({status:"error",fileName:i.name,errMsg:o}),s.totalFilesCount===s.fileUploadCount&&(s.processErrorResponse(e,o,r,n,t.skipNotification),s.fileUploadResponse=[],s.fileUploadCount=0,s.failedFileUploadCount=0,s.totalFilesCount=0),n}),(function(t){return e._progressObservable&&e._progressObservable.next({progress:t,status:l.VARIABLE_CONSTANTS.EVENT.PROGRESS,fileName:i.name}),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.PROGRESS,e,t),t})),u},t.prototype.handleAuthError=function(e,t,n,r){var i;return m().get(c.securityService.get(),"authenticated")?i={error:{message:"You're not authorised to access the resource \""+e.service+'".'}}:(i={error:{message:"You're not authenticated to access the resource \""+e.service+'".',skipDefaultNotification:!0}},c.appManager.pushToSessionFailureRequests(e.invoke.bind(e,r,t,n)),c.appManager.handle401()),console.warn(e.name+": "+i.error.message),i},t.prototype.handleRequestMetaError=function(e,t,n,r,i){try{var o=m().get(e,"error.type");switch(o){case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.NO_ACCESSTOKEN:(0,d.performAuthorization)(void 0,e.securityDefnObj[l.VARIABLE_CONSTANTS.REST_SERVICE.OAUTH_PROVIDER_KEY],this.invoke.bind(this,t,i,n,r),null,this.getProviderInfo(t,e.securityDefnObj["x-WM-PROVIDER_ID"])),this.processErrorResponse(t,e.error.message,r,i.xhrObj,!0,!0);break;case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.USER_UNAUTHORISED:e=this.handleAuthError(t,n,r,i),this.processErrorResponse(t,e.error.message,r,i.xhrObj,i.skipNotification,e.error.skipDefaultNotification);break;case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.METADATA_MISSING:case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.CRUD_OPERATION_MISSING:if(e.error.message){e.error.message=e.error.message.replace("$variable",t.name);var a=void 0;a=o===l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.METADATA_MISSING?["1. You did not Preview the app after creating a Variable for the imported service.","2. You deleted the imported service this Variable is linked to."]:["1. You haven't chosen an endpoint for "+i.operation+" operation for this Entity."],console.warn(e.error.message+"\n Possible reasons for this:\n "+a.join("\n "))}this.processErrorResponse(t,e.error.message,r,i.xhrObj,i.skipNotification,e.error.skipDefaultNotification);break;default:e.error.message&&(console.warn(e.error.message,t.name),this.processErrorResponse(t,e.error.message,r,i.xhrObj,i.skipNotification,e.error.skipDefaultNotification))}}catch(e){console.error(e)}return e},t.prototype.transformData=function(e,t){e.wmTransformedData=[];var n=t.transformationColumns,r=m().get(e,t.dataField)||[],i=e.wmTransformedData;m().forEach(r,(function(e,t){i[t]={},m().forEach(n,(function(n,r){i[t][n]=e[r]}))}))},t.prototype.getMethodInfo=function(e,t,n){var r;if(m().isEmpty(c.metadataService))r=e.serviceInfo;else{var o=(0,i.getClonedObject)(c.metadataService.getByOperationId(e.operationId,e.getPrefabName()));r=null===o?null:m().get(o,"wmServiceOperationInfo")}if(!r)return r;var a=m().get(r.securityDefinitions,"0"),s=a&&a.type===l.VARIABLE_CONSTANTS.REST_SERVICE.SECURITY_DEFN.OAUTH2;return r.parameters&&r.parameters.forEach((function(r){r.readOnly||(r.sampleValue=t[r.name],-1!==l.VARIABLE_CONSTANTS.PAGINATION_PARAMS.indexOf(r.name)?"size"===r.name?r.sampleValue=n.size||r.sampleValue||parseInt(e.maxResults,10):"page"===r.name?r.sampleValue=n.page||r.sampleValue||1:"sort"===r.name&&(r.sampleValue=(0,c.getEvaluatedOrderBy)(e.orderBy,n.orderBy)||r.sampleValue||""):"access_token"===r.name&&s&&(r.sampleValue=(0,d.getAccessToken)(a[l.VARIABLE_CONSTANTS.REST_SERVICE.OAUTH_PROVIDER_KEY],null)))})),r},t.prototype.getProviderInfo=function(e,t){return(0,i.getClonedObject)(null===c.metadataService||void 0===c.metadataService?void 0:c.metadataService.getByProviderId(t,e.getPrefabName()))},t.prototype.isFileUploadInProgress=function(e){var t=!1;return m().forEach(e,(function(e){m().isArray(e)&&e[0]instanceof File&&m().forEach(e,(function(e){"onProgress"!==e.status||(t=!0)}))})),t},t.prototype.uploadFile=function(e,t,n,r,i,o){var a=this,s=0,u=[],l=[];if(m().forEach(i,(function(e){m().isArray(e)?(e[0]instanceof File&&s++,m().forEach(e,(function(e){(e instanceof File||m().find(m().values(e),(function(e){return e instanceof Blob})))&&(u.push(e),a.totalFilesCount++,s=s||1)}))):e instanceof File&&(s++,a.totalFilesCount++,u.push(e))})),1===s)return i.files.length>1?(m().forEach(u,(function(i){l.push(a.uploadFileInFormData(e,t,n,r,i,o))})),Promise.all(l)):this.uploadFileInFormData(e,t,n,r,u[0],o)},t.prototype._invoke=function(e,t,n,r){var o,u,d=this,p=(0,i.getClonedObject)(t.inputFields||e.dataBinding),h=(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.BEFORE_UPDATE,e,p,t);if(!1===h)return s.$queue.process(e),void(0,i.triggerFn)(r);m().isObject(h)&&(p=h);var f=this.getMethodInfo(e,p,t),v=a.ServiceVariableUtils.constructRequestParams(e,f,p,t);if(v.error){var g=this.handleRequestMetaError(v,e,n,r,t),y=(m().get(g,"error.message")||"An error occurred while triggering the variable: ")+": "+e.name;return(0,i.triggerFn)(r),s.$queue.process(e),Promise.reject(y)}if(a.ServiceVariableUtils.isFileUploadRequest(e)){var _=this.uploadFile(e,t,n,r,p,v);if(_)return _}return f&&m().isArray(f.produces)&&m().includes(f.produces,l.WS_CONSTANTS.CONTENT_TYPES.OCTET_STREAM)?e.simulateFileDownload(v,e.dataBinding.file||e.name,e.dataBinding.exportType,(function(){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.SUCCESS,e,null,null,null),s.$queue.process(e),(0,i.triggerFn)(n)}),(function(){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,null,null,null),s.$queue.process(e),(0,i.triggerFn)(r)})):(this.notifyInflight(e,!t.skipToggleState),o=function(r,i){if(r&&r.type||r&&r.status){var o=r.body||r.data,a=d.processSuccessResponse(o,e,m().extend(t,{xhrObj:r}),n,r.headers);d.notifyInflight(e,!1,a),i(r)}},u=function(n,i){var o=(0,c.getErrMessage)(n,e.httpService.getLocale());d.notifyInflight(e,!1),d.processErrorResponse(e,o,r,n,t.skipNotification),i({error:o,details:n})},new Promise((function(t,n){v.responseType="text",e.httpService.sendCall(v,e).then((function(e){o(e,t)}),(function(e){var t=(0,i.getValidJSON)(e.error);e.error=(0,i.isDefined)(t)?t:e.error,u(e,n)}))})))},t.prototype.invoke=function(e,t,n,r){return(t=t||{}).inputFields=t.inputFields||(0,i.getClonedObject)(e.dataBinding),s.$queue.submit(e).then(this._invoke.bind(this,e,t,n,r),r)},t.prototype.setPagination=function(e,t){e._paginationConfig=t},t.prototype.download=function(e,t,n,r){t=t||{};var o,s=(0,i.getClonedObject)(e.dataBinding),u=t.data||{},d=this.getMethodInfo(e,s,t);return d.relativePath+="/export",(o=a.ServiceVariableUtils.constructRequestParams(e,d,s)).data=u,o.data.fields=(0,c.formatExportExpression)(u.fields||[]),o.method=t.httpMethod||"POST",o.url=t.url||o.url,m().hasIn(o,"error.message")?((0,i.triggerFn)(r,o.error.message),Promise.reject(o.error.message)):e.httpService.send(o).then((function(t){t&&(0,i.isValidWebURL)(t.body.result)?(window.location.href=t.body.result,(0,i.triggerFn)(n,t)):((0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,t),(0,i.triggerFn)(r,t))}),(function(t,n){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,t,n),(0,i.triggerFn)(r,t)}))},t.prototype.getInputParms=function(e){var t;return t=m().isEmpty(c.metadataService)?e.serviceInfo:m().get(c.metadataService.getByOperationId(e.operationId,e.getPrefabName()),"wmServiceOperationInfo"),m().get(t,"parameters")},t.prototype.setInput=function(e,t,n,r){return(0,c.setInput)(e.dataBinding,t,n,r)},t.prototype.cancel=function(e,t){s.$queue.requestsQueue.has(e)&&(a.ServiceVariableUtils.isFileUploadRequest(e)?(e.httpService.cancel(e,t),t.status="abort",this.totalFilesCount--,(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ABORT,e,t),this.isFileUploadInProgress(e.dataBinding)||0!==this.totalFilesCount||(s.$queue.process(e),this.notifyInflight(e,!1))):e.httpService.cancel&&(e.httpService.cancel(e),s.$queue.process(e),this.notifyInflight(e,!1)))},t.prototype.defineFirstLastRecord=function(e){e.isList&&(Object.defineProperty(e,"firstRecord",{configurable:!0,get:function(){var t=e.dataSet;return m().head(t&&t.content)||m().head(t)||{}}}),Object.defineProperty(e,"lastRecord",{configurable:!0,get:function(){var t=e.dataSet;return m().last(t&&t.content)||m().last(t)||{}}}))},t.prototype.getQueryParams=function(e,t,n){var r=this.getInputParms(n),i=a.ServiceVariableUtils.excludePaginationParams(r),o={};return m().map(n.dataBinding,(function(e,t){o[t]=e})),m().forEach(e,(function(e){m().includes(i,e)&&(o[e]=t)})),o},t.prototype.searchRecords=function(e,t,n,r){var o=this.getQueryParams(m().split(t.searchKey,","),t.query,e),a={page:t.page,pagesize:t.pagesize,skipDataSetUpdate:!0,skipToggleState:!0,inFlightBehavior:"executeAll",inputFields:o};return t.onBeforeservicecall&&t.onBeforeservicecall(o),this.invoke(e,a,n,r).catch(i.noop)},t}(u.BaseVariableManager)},"./src/model/action/timer-action.ts":
|
|
4286
|
+
(e,t,n)=>{"use strict";n.r(t),n.d(t,{ServiceVariableManager:()=>g});var r,i=n(/*! ../../util/utils */"./src/util/utils.ts"),o=n(/*! ../../util/file-upload.util */"./src/util/file-upload.util.ts"),a=n(/*! ../../util/variable/service-variable.utils */"./src/util/variable/service-variable.utils.ts"),s=n(/*! ../../util/inflight-queue */"./src/util/inflight-queue.ts"),u=n(/*! ./base-variable.manager */"./src/manager/variable/base-variable.manager.ts"),l=n(/*! ../../constants/variables.constants */"./src/constants/variables.constants.ts"),c=n(/*! ../../util/variable/variables.utils */"./src/util/variable/variables.utils.ts"),d=n(/*! ../../util/oAuth.utils */"./src/util/oAuth.utils.ts"),p=n(/*! ../../util/variable/pagination.utils */"./src/util/variable/pagination.utils.ts"),h=n(/*! ../../model/base-variable */"./src/model/base-variable.ts"),f=n(/*! lodash */"./node_modules/lodash/lodash.js"),m=n.n(f),v=(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.fileUploadResponse=[],t.fileUploadCount=0,t.totalFilesCount=0,t.successFileUploadCount=0,t.failedFileUploadCount=0,t}return v(t,e),t.prototype.processErrorResponse=function(e,t,n,r,o,a){var u=this.getMethodInfo(e,{},{}),p=m().get(u,"securityDefinitions.0"),f=this.prepareCallbackOptions(r);o||(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,t,f,a),m().get(p,"type")===l.VARIABLE_CONSTANTS.REST_SERVICE.SECURITY_DEFN.OAUTH2&&m().includes([l.VARIABLE_CONSTANTS.HTTP_STATUS_CODE.UNAUTHORIZED,l.VARIABLE_CONSTANTS.HTTP_STATUS_CODE.FORBIDDEN],m().get(r,"status"))&&(0,d.removeAccessToken)(p["x-WM-PROVIDER_ID"]),(0,i.triggerFn)(n,t),e.notify(h.VariableEvents.AFTER_INVOKE,[this,t]),l.CONSTANTS.isStudioMode||(e.canUpdate=!0,s.$queue.process(e),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.CAN_UPDATE,e,t,f))},t.prototype.processSuccessResponse=function(e,t,n,r,o,a){var u,d,f,v={},g=(0,i.getValidJSON)(e);e=(0,i.isDefined)(g)?g:(0,i.xmlToJson)(e)||e;var y=(0,i.isPageable)(e);if("DataService"===t.serviceType||"JavaService"===t.serviceType){var _=(0,c.decodeData)(e);m().isString(e)&&(e=_)}y?(u=e.content,v=m().omit(e,"content")):u=e,f=this.prepareCallbackOptions(n.xhrObj,{pagination:v,rawData:u}),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.RESULT,t,e,f),(0,i.triggerFn)(r,e,v),t.transformationColumns&&this.transformData(e,t),u=m().isObject(u)?u:{value:u},d=(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.PREPARE_SETDATA,t,u,f),(0,i.isDefined)(d)&&(u=d);var b=(0,i.getClonedObject)(n.inputFields||t.dataBinding),w=a||this.getMethodInfo(t,b,n),S=p.PaginationUtils.getPaginationInfo(w,t);if(S){var E=p.PaginationUtils.generatePaginationRes(w,S,e,o,n,t);m().isEmpty(E)||p.PaginationUtils.setVariablePagination(t,E,n)}return n.forceRunMode||n.skipDataSetUpdate||(t._paginationConfig||(t.pagination=v),t.dataSet=u,y&&Object.defineProperty(t.dataSet,"content",{get:function(){return t.dataSet}})),t.notify(h.VariableEvents.AFTER_INVOKE,[this,u]),setTimeout((function(){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.SUCCESS,t,u,f),l.CONSTANTS.isStudioMode||(t.canUpdate=!0,s.$queue.process(t)),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.CAN_UPDATE,t,u,f)})),{data:t.dataSet,pagination:t.pagination}},t.prototype.uploadFileInFormData=function(e,t,n,r,i,a){var s=this,u=(0,o.upload)(i,e,a.data,{fileParamName:"files",url:a.url});return u.then((function(r){return s.fileUploadCount++,s.successFileUploadCount++,s.fileUploadResponse.push(r[0]),s.totalFilesCount===s.fileUploadCount&&(0===s.failedFileUploadCount?(s.processSuccessResponse(s.fileUploadResponse,e,t,n),s.fileUploadResponse=[],e.onSuccess||c.appManager&&c.appManager.notifyApp(c.appManager.getAppLocale().MESSAGE_FILE_UPLOAD_SUCCESS,"success")):((0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,s.fileUploadResponse),s.fileUploadResponse=[],c.appManager&&c.appManager.notifyApp(c.appManager.getAppLocale().MESSAGE_FILE_UPLOAD_ERROR,"error")),s.fileUploadCount=0,s.successFileUploadCount=0,s.totalFilesCount=0),r}),(function(n){s.fileUploadCount++,s.failedFileUploadCount++,s.fileUploadResponse.push(n);var o=(0,c.getErrMessage)(n,e.httpService.getLocale());return e._progressObservable&&e._progressObservable.next({status:"error",fileName:i.name,errMsg:o}),s.totalFilesCount===s.fileUploadCount&&(s.processErrorResponse(e,o,r,n,t.skipNotification),s.fileUploadResponse=[],s.fileUploadCount=0,s.failedFileUploadCount=0,s.totalFilesCount=0),n}),(function(t){return e._progressObservable&&e._progressObservable.next({progress:t,status:l.VARIABLE_CONSTANTS.EVENT.PROGRESS,fileName:i.name}),(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.PROGRESS,e,t),t})),u},t.prototype.handleAuthError=function(e,t,n,r){var i;return m().get(c.securityService.get(),"authenticated")?i={error:{message:"You're not authorised to access the resource \""+e.service+'".'}}:(i={error:{message:"You're not authenticated to access the resource \""+e.service+'".',skipDefaultNotification:!0}},c.appManager.pushToSessionFailureRequests(e.invoke.bind(e,r,t,n)),c.appManager.handle401()),console.warn(e.name+": "+i.error.message),i},t.prototype.handleRequestMetaError=function(e,t,n,r,i){var o=m().get(e,"error.type");switch(o){case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.NO_ACCESSTOKEN:(0,d.performAuthorization)(void 0,e.securityDefnObj[l.VARIABLE_CONSTANTS.REST_SERVICE.OAUTH_PROVIDER_KEY],this.invoke.bind(this,t,i,n,r),null,this.getProviderInfo(t,e.securityDefnObj["x-WM-PROVIDER_ID"])),this.processErrorResponse(t,e.error.message,r,i.xhrObj,!0,!0);break;case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.USER_UNAUTHORISED:e=this.handleAuthError(t,n,r,i),this.processErrorResponse(t,e.error.message,r,i.xhrObj,i.skipNotification,e.error.skipDefaultNotification);break;case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.METADATA_MISSING:case l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.CRUD_OPERATION_MISSING:if(e.error.message){e.error.message=e.error.message.replace("$variable",t.name);var a=void 0;a=o===l.VARIABLE_CONSTANTS.REST_SERVICE.ERR_TYPE.METADATA_MISSING?["1. You did not Preview the app after creating a Variable for the imported service.","2. You deleted the imported service this Variable is linked to."]:["1. You haven't chosen an endpoint for "+i.operation+" operation for this Entity."],console.warn(e.error.message+"\n Possible reasons for this:\n "+a.join("\n "))}this.processErrorResponse(t,e.error.message,r,i.xhrObj,i.skipNotification,e.error.skipDefaultNotification);break;default:e.error.message&&(console.warn(e.error.message,t.name),this.processErrorResponse(t,e.error.message,r,i.xhrObj,i.skipNotification,e.error.skipDefaultNotification))}return e},t.prototype.transformData=function(e,t){e.wmTransformedData=[];var n=t.transformationColumns,r=m().get(e,t.dataField)||[],i=e.wmTransformedData;m().forEach(r,(function(e,t){i[t]={},m().forEach(n,(function(n,r){i[t][n]=e[r]}))}))},t.prototype.getMethodInfo=function(e,t,n){var r;if(m().isEmpty(c.metadataService))r=e.serviceInfo;else{var o=(0,i.getClonedObject)(c.metadataService.getByOperationId(e.operationId,e.getPrefabName()));r=null===o?null:m().get(o,"wmServiceOperationInfo")}if(!r)return r;var a=m().get(r.securityDefinitions,"0"),s=a&&a.type===l.VARIABLE_CONSTANTS.REST_SERVICE.SECURITY_DEFN.OAUTH2;return r.parameters&&r.parameters.forEach((function(r){r.readOnly||(r.sampleValue=t[r.name],-1!==l.VARIABLE_CONSTANTS.PAGINATION_PARAMS.indexOf(r.name)?"size"===r.name?r.sampleValue=n.size||r.sampleValue||parseInt(e.maxResults,10):"page"===r.name?r.sampleValue=n.page||r.sampleValue||1:"sort"===r.name&&(r.sampleValue=(0,c.getEvaluatedOrderBy)(e.orderBy,n.orderBy)||r.sampleValue||""):"access_token"===r.name&&s&&(r.sampleValue=(0,d.getAccessToken)(a[l.VARIABLE_CONSTANTS.REST_SERVICE.OAUTH_PROVIDER_KEY],null)))})),r},t.prototype.getProviderInfo=function(e,t){return(0,i.getClonedObject)(null===c.metadataService||void 0===c.metadataService?void 0:c.metadataService.getByProviderId(t,e.getPrefabName()))},t.prototype.isFileUploadInProgress=function(e){var t=!1;return m().forEach(e,(function(e){m().isArray(e)&&e[0]instanceof File&&m().forEach(e,(function(e){"onProgress"!==e.status||(t=!0)}))})),t},t.prototype.uploadFile=function(e,t,n,r,i,o){var a=this,s=0,u=[],l=[];if(m().forEach(i,(function(e){m().isArray(e)?(e[0]instanceof File&&s++,m().forEach(e,(function(e){(e instanceof File||m().find(m().values(e),(function(e){return e instanceof Blob})))&&(u.push(e),a.totalFilesCount++,s=s||1)}))):e instanceof File&&(s++,a.totalFilesCount++,u.push(e))})),1===s)return i.files.length>1?(m().forEach(u,(function(i){l.push(a.uploadFileInFormData(e,t,n,r,i,o))})),Promise.all(l)):this.uploadFileInFormData(e,t,n,r,u[0],o)},t.prototype._invoke=function(e,t,n,r){var o,u,d=this,p=(0,i.getClonedObject)(t.inputFields||e.dataBinding),h=(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.BEFORE_UPDATE,e,p,t);if(!1===h)return s.$queue.process(e),void(0,i.triggerFn)(r);m().isObject(h)&&(p=h);var f=this.getMethodInfo(e,p,t),v=a.ServiceVariableUtils.constructRequestParams(e,f,p,t);if(v.error){var g=this.handleRequestMetaError(v,e,n,r,t),y=(m().get(g,"error.message")||"An error occurred while triggering the variable: ")+": "+e.name;return(0,i.triggerFn)(r),Promise.reject(y)}if(a.ServiceVariableUtils.isFileUploadRequest(e)){var _=this.uploadFile(e,t,n,r,p,v);if(_)return _}return f&&m().isArray(f.produces)&&m().includes(f.produces,l.WS_CONSTANTS.CONTENT_TYPES.OCTET_STREAM)?e.simulateFileDownload(v,e.dataBinding.file||e.name,e.dataBinding.exportType,(function(){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.SUCCESS,e,null,null,null),s.$queue.process(e),(0,i.triggerFn)(n)}),(function(){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,null,null,null),s.$queue.process(e),(0,i.triggerFn)(r)})):(this.notifyInflight(e,!t.skipToggleState),o=function(r,i){if(r&&r.type||r&&r.status){var o=r.body||r.data,a=d.processSuccessResponse(o,e,m().extend(t,{xhrObj:r}),n,r.headers);d.notifyInflight(e,!1,a),i(r)}},u=function(n,i){var o=(0,c.getErrMessage)(n,e.httpService.getLocale());d.notifyInflight(e,!1),d.processErrorResponse(e,o,r,n,t.skipNotification),i({error:o,details:n})},new Promise((function(t,n){v.responseType="text",e.httpService.sendCall(v,e).then((function(e){o(e,t)}),(function(e){var t=(0,i.getValidJSON)(e.error);e.error=(0,i.isDefined)(t)?t:e.error,u(e,n)}))})))},t.prototype.invoke=function(e,t,n,r){return(t=t||{}).inputFields=t.inputFields||(0,i.getClonedObject)(e.dataBinding),s.$queue.submit(e).then(this._invoke.bind(this,e,t,n,r),r)},t.prototype.setPagination=function(e,t){e._paginationConfig=t},t.prototype.download=function(e,t,n,r){t=t||{};var o,s=(0,i.getClonedObject)(e.dataBinding),u=t.data||{},d=this.getMethodInfo(e,s,t);return d.relativePath+="/export",(o=a.ServiceVariableUtils.constructRequestParams(e,d,s)).data=u,o.data.fields=(0,c.formatExportExpression)(u.fields||[]),o.method=t.httpMethod||"POST",o.url=t.url||o.url,m().hasIn(o,"error.message")?((0,i.triggerFn)(r,o.error.message),Promise.reject(o.error.message)):e.httpService.send(o).then((function(t){t&&(0,i.isValidWebURL)(t.body.result)?(window.location.href=t.body.result,(0,i.triggerFn)(n,t)):((0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,t),(0,i.triggerFn)(r,t))}),(function(t,n){(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ERROR,e,t,n),(0,i.triggerFn)(r,t)}))},t.prototype.getInputParms=function(e){var t;return t=m().isEmpty(c.metadataService)?e.serviceInfo:m().get(c.metadataService.getByOperationId(e.operationId,e.getPrefabName()),"wmServiceOperationInfo"),m().get(t,"parameters")},t.prototype.setInput=function(e,t,n,r){return(0,c.setInput)(e.dataBinding,t,n,r)},t.prototype.cancel=function(e,t){s.$queue.requestsQueue.has(e)&&(a.ServiceVariableUtils.isFileUploadRequest(e)?(e.httpService.cancel(e,t),t.status="abort",this.totalFilesCount--,(0,c.initiateCallback)(l.VARIABLE_CONSTANTS.EVENT.ABORT,e,t),this.isFileUploadInProgress(e.dataBinding)||0!==this.totalFilesCount||(s.$queue.process(e),this.notifyInflight(e,!1))):e.httpService.cancel&&(e.httpService.cancel(e),s.$queue.process(e),this.notifyInflight(e,!1)))},t.prototype.defineFirstLastRecord=function(e){e.isList&&(Object.defineProperty(e,"firstRecord",{configurable:!0,get:function(){var t=e.dataSet;return m().head(t&&t.content)||m().head(t)||{}}}),Object.defineProperty(e,"lastRecord",{configurable:!0,get:function(){var t=e.dataSet;return m().last(t&&t.content)||m().last(t)||{}}}))},t.prototype.getQueryParams=function(e,t,n){var r=this.getInputParms(n),i=a.ServiceVariableUtils.excludePaginationParams(r),o={};return m().map(n.dataBinding,(function(e,t){o[t]=e})),m().forEach(e,(function(e){m().includes(i,e)&&(o[e]=t)})),o},t.prototype.searchRecords=function(e,t,n,r){var o=this.getQueryParams(m().split(t.searchKey,","),t.query,e),a={page:t.page,pagesize:t.pagesize,skipDataSetUpdate:!0,skipToggleState:!0,inFlightBehavior:"executeAll",inputFields:o};return t.onBeforeservicecall&&t.onBeforeservicecall(o),this.invoke(e,a,n,r).catch(i.noop)},t}(u.BaseVariableManager)},"./src/model/action/timer-action.ts":
|
|
4287
4287
|
/*!******************************************!*\
|
|
4288
4288
|
!*** ./src/model/action/timer-action.ts ***!
|
|
4289
4289
|
\******************************************/
|