jinbi-utils 1.0.21 → 1.0.22
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.
- package/.eslintignore +7 -0
- package/dist/index.esm.js +3079 -0
- package/dist/index.esm.min.js +15 -0
- package/dist/index.umd.js +3192 -0
- package/dist/index.umd.min.js +16 -0
- package/package.json +1 -1
- package/src/common/index.ts +105 -105
- package/src/constant/common.constant.ts +1 -1
- package/src/file/index.ts +8 -8
- package/src/http/apiBuilder/api-builder.ts +3 -3
- package/src/http/http.ts +2 -2
- package/src/http/httpEnums.ts +7 -7
- package/src/iam/index.ts +3 -3
- package/src/index.ts +6 -6
- package/src/middleware/requestLogger.middware.ts +21 -7
- package/src/middleware/requestLoggerUnified.ts +22 -8
- package/src/number/index.ts +4 -4
- package/src/string/index.ts +1 -1
- package/src/utils/curl.ts +76 -85
- package/src/websocket/emitter.ts +2 -2
- package/src/websocket/manager.ts +4 -4
- package/src/websocket/pinia-store.ts +6 -6
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("axios"),require("pinia")):"function"==typeof define&&define.amd?define(["exports","axios","pinia"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self)["jinbi-utils"]={},t.axios,t.pinia)}(this,(function(t,e,r){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o={isWxWork:"wecom",isWeixin:"wechat",isMobile:"mobile",isMobileAny:"mobile"};function i(t){return null===t||""===t||void 0===t}var s=function(){var t=navigator.userAgent.toLowerCase(),e=/wxwork/.test(t),r=/micromessenger/.test(t)&&!e,n=window.innerWidth<=768;return{isWxWork:e,isWeixin:r,isMobileScreen:n,isMobileAny:e||r||n}},a=function(t){var e="wecom";for(var r in t){if(t[r]){e=o[r];break}}return e};var u=function(t,e){void 0===e&&(e="token");var r=t.toLowerCase();return"localstorage"===r?localStorage.getItem(e)||"":"sessionstorage"===r?sessionStorage.getItem(e)||"":localStorage.getItem(e)||sessionStorage.getItem("token")||""},c=function(t,e){void 0===e&&(e="token");var r=t.toLowerCase();"localstorage"===r?localStorage.removeItem(e):("sessionstorage"===r||localStorage.removeItem(e),sessionStorage.removeItem(e))};function l(t){return"string"==typeof t?t.replace(/-/g,"/"):t}function f(t,e){void 0===t&&(t=Date.now()),void 0===e&&(e="yyyy-MM-dd HH:mm:ss"),t=l(t);var r={"M+":(t=new Date(t)).getMonth()+1,"d+":t.getDate(),"h+":t.getHours()%12==0?12:t.getHours()%12,"H+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};return/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(""+t.getFullYear()).substr(4-RegExp.$1.length))),Object.keys(r).forEach((function(t){new RegExp("("+t+")").test(e)&&(e=e.replace(RegExp.$1,1===RegExp.$1.length?r[t]:("00"+r[t]).substr((""+r[t]).length)))})),e}
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */
|
|
16
|
+
var d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function p(t,e){function r(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var h=function(){return(h=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function v(t,e,r,n){return new(r||(r=Promise))((function(o,i){function s(t){try{u(n.next(t))}catch(t){i(t)}}function a(t){try{u(n.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((n=n.apply(t,e||[])).next())}))}function g(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function m(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),o=0;for(e=0;e<r;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n}var y={operation:"divide",factor:100,precision:2,formatAsCurrency:!1,currencySymbol:"¥"};function w(t,e){if(void 0===e&&(e="-"),i(t))return e;var r=t.toString();return r.includes(".")||(r+="."),r.replace(/\d(?=(\d{3})+\.)/g,(function(t){return t+","})).replace(/\.$/,"")}function b(t,e){if(void 0===e&&(e=0),i(t))return t;var r=Math.pow(10,e),n=Number(t)*r;return Math.ceil(n)/r}function S(t,e){var r=M(t,e),n=h(h({},y),e);if(n.formatter)return n.formatter(r);if(n.formatAsCurrency){var o=r.toFixed(n.precision),i=r>=1e3?w(o):o;return""+n.currencySymbol+i}return r.toFixed(n.precision)}function M(t,e){var r,n,o=h(h({},y),e);if(null==t||""===t)return 0;if("string"==typeof t){var i=t.replace(/[^\d.-]/g,"");r=i?parseFloat(i):0}else r=t;if(isNaN(r))return 0;if(n="multiply"===o.operation?r*o.factor:0!==o.factor?r/o.factor:0,void 0!==o.precision){var s=Math.pow(10,o.precision);n=Math.round(n*s)/s}return n}function A(t,e){void 0===e&&(e="B");var r=["B","KB","MB","GB","TB"],n=r.indexOf(e.toUpperCase());for(n=-1===n?0:n;t>=1024&&n<r.length;)t/=1024,n+=1;return{size:t,unit:r[n]}}function C(t){for(var e=t.match(/:(.*?);/)[1],r=window.atob(t.split(",")[1]),n=new ArrayBuffer(r.length),o=new Uint8Array(n),i=0;i<r.length;i+=1)o[i]=r.charCodeAt(i);return new Blob([n],{type:e})}function E(t){return new Promise((function(e,r){var n=new FileReader;n.onload=function(t){t&&t.target?e(t.target.result):r(t)},n.onerror=function(t){r(t)},n.readAsDataURL(t)}))}function x(t,e,r,n,o){if(void 0===o&&(o=[]),o.push(t),t[r]===e)throw"GOT IT!";if(t[n]&&t[n].length>0)for(var i=0;i<t[n].length;i++)x(t[n][i],e,r,n,o);o.pop()}var T={HTTP_STATUS:{TEMP_RESPOND:{Continue:100,SwitchingProtocal:101},SUCCESS:{Ok:200,Created:201,Accepted:202,NoAuthoritativeInformation:203,NoContent:204,ResetContent:205,ParticalContent:206},REDIRECT:{MultipleChoice:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,TemporaryRedirect:307,PermanentRedirect:308},REQUEST_ERROR:{BadRequest:400,UnAuthorized:401,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAccepted:406,ProxyAuthorizationRequired:407,RequestTimeout:408,UpgradeRequired:426,TokenUnAuthorized:499},SERVER_ERROR:{InternalServerError:500,BadGateway:502,ServiceUnavailable:503,GateTimeout:504,HttpVersionNotSupported:505}},CODES:{Success:"00000",UnAuthorized:"00099",UnAuthorizedPhone:"11001",UnAuthorizedWecom:"11000",UnAuthorizedHavePhone:"11002"},ERR_CODE_WHITE_LIST:[]},k=n(e).default.create({timeout:15e3,headers:{"Content-Type":"application/json"}}),I=function(){function t(t){this.fieldCatalog=t,this.params=t?{field_catalog:t}:{}}return t.prototype.build=function(){return this.params},t}(),B=function(){function t(t){this.fieldCatalog=t}return t.prototype.query=function(){return new N(this.fieldCatalog)},t.prototype.insert=function(){return new j(this.fieldCatalog)},t.prototype.update=function(){return new R(this.fieldCatalog)},t.query=function(t){return new N(t)},t.insert=function(t){return new j(t)},t.update=function(t){return new R(t)},t}(),O=function(){function t(t,e){this.parent=e,this.nestedFilters={logic:t,filters:[]}}return t.prototype.where=function(t,e,r){var n=this;return"object"==typeof t?(Object.entries(t).forEach((function(t){var e=t[0],r=t[1];n.nestedFilters.filters.push({field:e,op:"=",value:r})})),this):void 0===r?(this.nestedFilters.filters.push({field:t,op:"=",value:e}),this):(this.nestedFilters.filters.push({field:t,op:e,value:r}),this)},t.prototype.group=function(e){return void 0===e&&(e="and"),new t(e,this)},t.prototype.endGroup=function(){return this.parent instanceof t?(this.parent.addNestedFilters(this.nestedFilters),this.parent):(this.parent.whereNested(this.nestedFilters),this.parent)},t.prototype.addNestedFilters=function(t){this.nestedFilters.filters.push(t)},t.prototype.build=function(){return this.nestedFilters},t}(),N=function(t){function e(e){var r=t.call(this,e)||this;return r.params=h(h({},r.params),{filters:{logic:"and",filters:[]},order_by:[],limit:100,offset:0}),r}return p(e,t),e.prototype.where=function(t,e,r){var n=this;return"object"==typeof t?(Object.entries(t).forEach((function(t){var e=t[0],r=t[1];n.params.filters.filters.push({field:e,op:"=",value:r})})),this):void 0===r?(this.params.filters.filters.push({field:t,op:"=",value:e}),this):(this.params.filters.filters.push({field:t,op:e,value:r}),this)},e.prototype.whereNested=function(t){return this.params.filters.filters.push(t),this},e.prototype.group=function(t){return void 0===t&&(t="and"),new O(t,this)},e.prototype.orWhere=function(t,e,r){var n,o={logic:"or",filters:[]};if("object"==typeof t?Object.entries(t).forEach((function(t){var e=t[0],r=t[1];o.filters.push({field:e,op:"=",value:r})})):void 0===r?o.filters.push({field:t,op:"=",value:e}):o.filters.push({field:t,op:e,value:r}),0===this.params.filters.filters.length||"or"===this.params.filters.logic)(n=this.params.filters.filters).push.apply(n,o.filters),this.params.filters.logic="or";else{var i={logic:"and",filters:m(this.params.filters.filters)};this.params.filters.filters=[i,o],this.params.filters.logic="and"}return this},e.prototype.whereIn=function(t,e){return this.params.filters.filters.push({field:t,op:"in",value:e}),this},e.prototype.whereNotIn=function(t,e){return this.params.filters.filters.push({field:t,op:"not in",value:e}),this},e.prototype.whereLike=function(t,e){return this.params.filters.filters.push({field:t,op:"like",value:e}),this},e.prototype.whereBetween=function(t,e,r){return this.params.filters.filters.push({field:t,op:"between",value:[e,r]}),this},e.prototype.whereNull=function(t){return this.params.filters.filters.push({field:t,op:"is null",value:null}),this},e.prototype.whereNotNull=function(t){return this.params.filters.filters.push({field:t,op:"is not null",value:null}),this},e.prototype.logic=function(t){return this.params.filters.logic=t,this},e.prototype.orderBy=function(t,e){return void 0===e&&(e="asc"),this.params.order_by.push({field:t,direction:e}),this},e.prototype.limit=function(t){return this.params.limit=t,this},e.prototype.offset=function(t){return this.params.offset=t,this},e.prototype.paginate=function(t,e){return void 0===e&&(e=0),this.params.limit=t,this.params.offset=e,this},e}(I),j=function(t){function e(e){var r=t.call(this,e)||this;return r.params=h(h({},r.params),{insert:[]}),r}return p(e,t),e.prototype.add=function(t){return this.params.insert.push(t),this},e.prototype.addBatch=function(t){var e;return(e=this.params.insert).push.apply(e,t),this},e}(I),R=function(t){function e(e){var r=t.call(this,e)||this;return r.currentUpdate=null,r.params=h(h({},r.params),{update:[]}),r}return p(e,t),e.prototype.set=function(t){return this.currentUpdate={set:t,where:{}},this},e.prototype.where=function(t,e){if(!this.currentUpdate)throw new Error("必须先调用 set() 方法");return"object"==typeof t?this.currentUpdate.where=h(h({},this.currentUpdate.where),t):this.currentUpdate.where[t]=e,this},e.prototype.and=function(){return this.currentUpdate&&(this.params.update.push(this.currentUpdate),this.currentUpdate=null),this},e.prototype.setBatch=function(t){var e;return(e=this.params.update).push.apply(e,t),this},e.prototype.build=function(){return this.currentUpdate&&(this.params.update.push(this.currentUpdate),this.currentUpdate=null),this.params},e}(I);var D=new(function(){function t(){}return t.prototype.request=function(t){return v(this,void 0,void 0,(function(){var e,r,n,o,i,s,a,u,c,l,f,d;return g(this,(function(p){switch(p.label){case 0:e=(t.method||"GET").toUpperCase(),r="number"==typeof t.timeoutMs&&t.timeoutMs>0?t.timeoutMs:15e3,n=function(t){return h({},t||{})}(t.headers),o=void 0!==t.data&&null!==t.data,i=void 0,o&&("string"==typeof t.data||"undefined"!=typeof FormData&&t.data instanceof FormData||"undefined"!=typeof Blob&&t.data instanceof Blob||"undefined"!=typeof ArrayBuffer&&t.data instanceof ArrayBuffer?i=t.data:(Object.keys(n).some((function(t){return"content-type"===t.toLowerCase()}))||(n["Content-Type"]="application/json"),i=JSON.stringify(t.data))),s="undefined"!=typeof AbortController?new AbortController:null,a=s?setTimeout((function(){return s.abort()}),r):null,p.label=1;case 1:return p.trys.push([1,,4,5]),[4,fetch(t.url,{method:e,headers:n,body:i,redirect:!1===t.followRedirects?"manual":"follow",signal:s?s.signal:void 0})];case 2:return[4,(u=p.sent()).text()];case 3:return c=p.sent(),l=function(t){var e={};return t.forEach((function(t,r){e[r.toLowerCase()]=t})),e}(u.headers),f=l["content-type"]||"",d=f.includes("application/json")?function(t){try{return JSON.parse(t)}catch(t){return}}(c):void 0,[2,{status:u.status,headers:l,body:c,json:d}];case 4:return a&&clearTimeout(a),[7];case 5:return[2]}}))}))},t.prototype.get=function(t,e){return v(this,void 0,void 0,(function(){return g(this,(function(r){return[2,this.request(h(h({},e||{}),{url:t,method:"GET"}))]}))}))},t.prototype.post=function(t,e,r){return v(this,void 0,void 0,(function(){return g(this,(function(n){return[2,this.request(h(h({},r||{}),{url:t,method:"POST",data:e}))]}))}))},t}());function q(){var t=new Date;return String(t.getFullYear())+"年"+String(t.getMonth()+1)+"月"+String(t.getDate())+"日"+String(t.getHours())+":"+String(t.getMinutes())}function U(t){return v(this,void 0,void 0,(function(){var e,r;return g(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),"https://fe-log-producer.jinbizhihui.com",[4,D.post("https://fe-log-producer.jinbizhihui.com/log/save",t)];case 1:return e=n.sent(),console.log("[RequestLogger] 远程日志发送成功, result",e),[3,3];case 2:return r=n.sent(),console.error("[RequestLogger] 远程日志发送失败:",(null==r?void 0:r.message)||r),[3,3];case 3:return[2]}}))}))}function F(t){return v(this,void 0,void 0,(function(){var e,r,n;return g(this,(function(o){switch(o.label){case 0:e=t.req.header("content-type")||"",o.label=1;case 1:return o.trys.push([1,4,,5]),(r=t.req.raw)&&"function"==typeof r.clone?[4,r.clone().text()]:[3,3];case 2:if(!(n=o.sent()))return[2,void 0];if(e.includes("application/json"))try{return[2,JSON.parse(n)]}catch(t){return[2,n]}return[2,n];case 3:return[3,5];case 4:return o.sent(),[3,5];case 5:return[2,void 0]}}))}))}function P(t){var e={};try{t.res.headers.forEach((function(t,r){e[r]=t}))}catch(t){}return e}function L(t,e,r){return v(this,void 0,void 0,(function(){var n,o,i,s,a,u,c,l,f,d;return g(this,(function(p){switch(p.label){case 0:return n=t.req.header("x-forwarded-for")||t.req.header("x-real-ip")||"unknown",o=t.req.method,i=t.req.url,s=t.req.query(),a=function(t){var e={};try{var r=t.req.raw,n=null==r?void 0:r.headers;n&&n.forEach((function(t,r){e[r]=t}))}catch(t){}return e}(t),[4,F(t)];case 1:return u=p.sent(),c=q(),l=Date.now(),[4,e()];case 2:return p.sent(),f=Date.now()-l,d={status:t.res.status,headers:P(t),duration:f},[4,U({system:r,ip:n,path:i,method:o,time:c,params:{method:o,url:i,query:s,body:u},headers:a,result:d})];case 3:return p.sent(),[2]}}))}))}function z(t){var e,r={};try{for(var n=(null===(e=t.response)||void 0===e?void 0:e.headers)||{},o=0,i=Object.entries(n);o<i.length;o++){var s=i[o],a=s[0],u=s[1];r[a]=String(u)}}catch(t){}return r}function H(t,e,r){var n,o,i,s,a,u;return v(this,void 0,void 0,(function(){var c,l,f,d,p,h,v,m,y,w,b;return g(this,(function(g){switch(g.label){case 0:return c=t.ip||(null===(n=t.request)||void 0===n?void 0:n.ip)||"unknown",l=t.path||(null===(o=t.request)||void 0===o?void 0:o.path)||"",f=t.method||(null===(i=t.request)||void 0===i?void 0:i.method)||"",d=t.url||(null===(s=t.request)||void 0===s?void 0:s.url)||"",p=t.query||(null===(a=t.request)||void 0===a?void 0:a.query)||{},h=(null===(u=t.request)||void 0===u?void 0:u.body)||{},v=function(t){var e,r={};try{for(var n=t.headers||(null===(e=t.request)||void 0===e?void 0:e.headers)||{},o=0,i=Object.entries(n);o<i.length;o++){var s=i[o],a=s[0],u=s[1];r[a]=String(u)}}catch(t){}return r}(t),m=q(),y=Date.now(),[4,e()];case 1:return g.sent(),w=Date.now()-y,b={status:t.status,body:t.body,headers:z(t),duration:w},[4,U({system:r,ip:c,path:l,method:f,time:m,params:{method:f,url:d,query:p,body:h},headers:v,result:b})];case 2:return g.sent(),[2]}}))}))}function _(t){var e,r={};try{for(var n=(null===(e=t.getHeaders)||void 0===e?void 0:e.call(t))||{},o=0,i=Object.entries(n);o<i.length;o++){var s=i[o],a=s[0],u=s[1];void 0!==u&&(r[a]=String(u))}}catch(t){}return r}function W(t,e,r){return v(this,void 0,void 0,(function(){var n,o,i,s,a,u,c,l,f,d;return g(this,(function(p){switch(p.label){case 0:return n=t.headers["x-forwarded-for"]||t.headers["x-real-ip"]||t.ip||"unknown",o=t.url||"",i=t.method||"",s=t.query||{},a=t.body||{},u=function(t){var e={};try{for(var r=t.headers||{},n=0,o=Object.entries(r);n<o.length;n++){var i=o[n],s=i[0],a=i[1];e[s]=String(a)}}catch(t){}return e}(t),c=q(),l=Date.now(),f=Date.now()-l,d={status:e.statusCode,headers:_(e),duration:f},[4,U({system:r,ip:n,path:o,method:i,time:c,params:{method:i,url:o,query:s,body:a},headers:u,result:d})];case 1:return p.sent(),[2]}}))}))}function $(t){var e=t.replace("#","").match(/../g);return e?e.map((function(t){return parseInt(t,16)})):[0,0,0]}function Y(t,e,r){var n=function(t){var e=t.toString(16);return 1===e.length?"0"+e:e};return"#"+n(t)+n(e)+n(r)}function G(t,e){return!("undefined"==typeof window||!t)&&!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}var J=function(){function t(t){this.ws=null,this.reconnectAttempts=0,this.heartbeatTimer=null,this.listeners=new Map,this.opts={url:t.url,reconnectAttemptsLimit:t.reconnectAttemptsLimit||5,reconnectInterval:t.reconnectInterval||5e3,heartbeatInterval:t.heartbeatInterval||3e4,registerMessage:t.registerMessage}}return Object.defineProperty(t.prototype,"url",{get:function(){return this.opts.url},enumerable:!1,configurable:!0}),t.prototype.on=function(t,e){this.listeners.has(t)||this.listeners.set(t,new Set);var r=this.listeners.get(t);return r.add(e),function(){return r.delete(e)}},t.prototype.emit=function(t,e){var r=this.listeners.get(t);r&&r.forEach((function(t){try{t(e)}catch(t){}}))},t.prototype.connect=function(){try{this.ws=new WebSocket(this.opts.url),this.setupEventListeners()}catch(t){this.emit("error",{message:"WebSocket create failed"})}},t.prototype.setupEventListeners=function(){var t=this;this.ws&&(this.ws.onopen=function(){t.reconnectAttempts=0,t.opts.registerMessage&&t.send(t.opts.registerMessage),t.startHeartbeat(),t.emit("connected",!0)},this.ws.onmessage=function(e){try{var r=JSON.parse(e.data);t.emit("message",r)}catch(e){t.emit("error",{message:"Message parse failed"})}},this.ws.onclose=function(){t.stopHeartbeat(),t.emit("connected",!1),t.emit("closed",void 0),t.reconnect()},this.ws.onerror=function(){t.emit("error",{message:"WebSocket error"})})},t.prototype.send=function(t){if(this.ws&&1===this.ws.readyState)try{this.ws.send(JSON.stringify(t))}catch(t){}},t.prototype.startHeartbeat=function(){var t=this;this.stopHeartbeat(),this.heartbeatTimer=setInterval((function(){t.send({type:"ping"})}),this.opts.heartbeatInterval)},t.prototype.stopHeartbeat=function(){null!=this.heartbeatTimer&&(clearInterval(this.heartbeatTimer),this.heartbeatTimer=null)},t.prototype.reconnect=function(){var t=this;this.reconnectAttempts<this.opts.reconnectAttemptsLimit&&(this.reconnectAttempts++,setTimeout((function(){t.connect()}),this.opts.reconnectInterval))},t.prototype.disconnect=function(){if(this.stopHeartbeat(),this.ws)try{this.ws.close()}catch(t){}this.ws=null},Object.defineProperty(t.prototype,"isConnected",{get:function(){return!!this.ws&&1===this.ws.readyState},enumerable:!1,configurable:!0}),t}(),Q=function(){function t(){this.initialized=!1,this.manager=null}return t.getInstance=function(){return t.instance||(t.instance=new t),t.instance},t.prototype.init=function(t){return v(this,void 0,void 0,(function(){return g(this,(function(e){return this.initialized||(this.manager=new J(t),this.manager.connect(),this.initialized=!0),[2]}))}))},t.prototype.destroy=function(){this.manager&&this.manager.disconnect(),this.manager=null,this.initialized=!1},t.prototype.getManager=function(){return this.manager},t}().getInstance(),Z=new(function(){function t(){this.listeners=new Map}return t.prototype.on=function(t,e){this.listeners.has(t)||this.listeners.set(t,new Set);var r=this.listeners.get(t);return r.add(e),function(){return r.delete(e)}},t.prototype.off=function(t,e){var r=this.listeners.get(t);r&&r.delete(e)},t.prototype.emit=function(t,e){var r=this.listeners.get(t);r&&r.forEach((function(t){try{t(e)}catch(t){}}))},t}());t.ApiBuilder=B,t.InsertBuilder=j,t.QueryBuilder=N,t.UpdateBuilder=R,t.WebsocketManager=J,t.addClass=function(t,e){"undefined"!=typeof window&&t&&(G(t,e)||(t.className+=" "+e))},t.addDays=function(t,e,r){if(void 0===e&&(e=0),void 0===r&&(r="yyyy-MM-dd"),i(t))return"-";t=l(t);var n=new Date(t);return n.setDate(n.getDate()+Number(e)),f(n,r)},t.base64ToBlob=function(t){for(var e=t.split(","),r=e[0].match(/:(.\*?);/)[1],n=atob(e[1]),o=n.length,i=new Uint8Array(o);o--;)i[o]=n.charCodeAt(o);return new Blob([i],{type:r})},t.base64ToFile=function(t,e){for(var r=t.split(","),n=r[0].match(/:(.*);/)[1],o=atob(r[1]),i=o.length,s=new Uint8Array(i);i--;)s[i]=o.charCodeAt(i);return new File([s],e,{type:n})},t.base64ToFileOrBlob=function(t,e){return v(this,void 0,void 0,(function(){var r,n,o,i,s,a,u,c;return g(this,(function(l){for(r=t.split(","),n=r[0],o=r[1],i=n.match(/:(.*?);/)[1],s=atob(o),a=s.length,u=new Uint8Array(a),c=0;c<a;c++)u[c]=s.charCodeAt(c);return e?[2,new File([u],e,{type:i})]:[2,new Blob([u],{type:i})]}))}))},t.blobToDataURL=E,t.buildUUID=function(){for(var t=[],e=0;e<=15;e++)t[e]=e.toString(16);var r="";for(e=1;e<=36;e++)r+=9===e||14===e||19===e||24===e?"-":15===e?4:20===e?t[4*Math.random()|8]:t[16*Math.random()|0];return r.replace(/-/g,"")},t.calcFileSize=A,t.ceil=b,t.clearLoginData=function(){localStorage.removeItem("wecom_userinfo"),localStorage.removeItem("wecom_token"),localStorage.removeItem("projectActive"),localStorage.removeItem("loginTime"),localStorage.removeItem("projectInfo")},t.compatibleDate=l,t.compressImg=function(t,e,r){return new Promise((function(n,o){var i=parseFloat((t.size/1024/1024).toString()),s=new FileReader;s.onload=function(s){var a=new Image;a.onload=function(){var o=a.width,s=a.height,u=document.createElement("canvas"),c=u.getContext("2d"),l=e?e(o,s):1;(Number.isNaN(l)||"number"!=typeof l)&&(l=1);var f=r?r(i,l,o,s):1;if((Number.isNaN(f)||"number"!=typeof f)&&(f=1),c){var d=parseInt((o*l).toString(),10),p=parseInt((s*l).toString(),10);u.setAttribute("width",d.toString()),u.setAttribute("height",p.toString()),c.drawImage(a,0,0,d,p)}var h=u.toDataURL(t.type,f);n(C(h))},a.onerror=function(t){o(t)},s.target&&(a.src=s.target.result)},s.onerror=function(t){o(t)},s.readAsDataURL(t)}))},t.computeMoney=M,t.convertBase64UrlToBlob=function(t){for(var e=window.atob(t.split(",")[1]),r=new ArrayBuffer(e.length),n=new Uint8Array(r),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);return new Blob([r],{type:"image/png"})},t.convertCurrency=function(t){if(void 0===t&&(t=""),i(t))return"";if(Number(t)>=1e15)return t;var e,r,n,o=["零","壹","贰","叁","肆","伍","陆","柒","捌","玖"],s=["","拾","佰","仟"],a=["","万","亿","兆"],u=["角","分","毫","厘"],c="";if("0"===(t=parseFloat(t).toString()))return c=o[0]+"元整";if(-1===(t=t.toString()).indexOf(".")?(e=t,r=""):(e=(n=t.split("."))[0],r=n[1].substr(0,4)),parseInt(e,10)>0){for(var l=0,f=e.length,d=0;d<f;d+=1){var p=e.substr(d,1),h=f-d-1,v=h/4,g=h%4;"0"===p?l+=1:(l>0&&(c+=o[0]),l=0,c+=o[parseInt(p,10)]+s[g]),0===g&&l<4&&(c+=a[v])}c+="元"}if(""!==r){var m=r.length;for(d=0;d<m;d+=1){var y=r.substr(d,1);"0"!==y&&(c+=o[Number(y)]+u[d])}}return""===c?c+=o[0]+"元整":""===r&&(c+="整"),c},t.copyTextToClipboard=function(t){if("undefined"==typeof window||"undefined"==typeof document)return!1;var e=document.createElement("textarea"),r=document.activeElement;e.value=t,e.setAttribute("readonly",""),e.style.position="absolute",e.style.left="-9999px",e.style.fontSize="12pt",e.style.border="0",e.style.padding="0",e.style.margin="0";var n=document.getSelection(),o=null;n&&n.rangeCount>0&&(o=n.getRangeAt(0)),document.body.appendChild(e),e.select(),e.selectionStart=0,e.selectionEnd=t.length;var i=!1;try{i=document.execCommand("copy")}catch(t){console.error("复制失败:",t)}return e.remove(),o&&n&&(n.removeAllRanges(),n.addRange(o)),r&&r.focus(),i},t.createWebSocketStore=function(t){return void 0===t&&(t="websocket"),r.defineStore(t,{state:function(){return{isConnected:!1,wsManager:null,messages:[],connectionError:null}},getters:{connectionStatus:function(t){return t.isConnected?"已连接":"未连接"},lastMessage:function(t){return t.messages[t.messages.length-1]||null}},actions:{connect:function(t){var e;return v(this,void 0,void 0,(function(){return g(this,(function(r){return(null===(e=this.wsManager)||void 0===e?void 0:e.isConnected)||(this.wsManager=new J(t),this.setupEventListeners(),this.wsManager.connect()),[2]}))}))},setupEventListeners:function(){var t=this;this.wsManager&&(this.wsManager.on("connected",(function(e){t.isConnected=e,e&&(t.connectionError=null),Z.emit("websocket-connected",e)})),this.wsManager.on("message",(function(e){t.addMessage(e),Z.emit("websocket-message",e)})),this.wsManager.on("error",(function(e){t.connectionError=(null==e?void 0:e.message)||"WebSocket error",Z.emit("websocket-error",{message:t.connectionError})})),this.wsManager.on("closed",(function(){t.isConnected=!1,Z.emit("websocket-closed",void 0)})))},sendMessage:function(t){var e;null===(e=this.wsManager)||void 0===e||e.send(t)},addMessage:function(t){var e=h(h({},t),{timestamp:Date.now(),id:Math.random().toString(36).substring(2,11)});this.messages.push(e),this.messages.length>100&&this.messages.shift()},clearMessages:function(){this.messages=[]},disconnect:function(){var t;null===(t=this.wsManager)||void 0===t||t.disconnect(),this.wsManager=null,this.isConnected=!1,this.connectionError=null},reset:function(){this.disconnect(),this.clearMessages()}}})},t.darken=function(t,e){var r=$(t).map((function(t){return Math.floor(t*(1-e))}));return Y(r[0],r[1],r[2])},t.dataURLtoBlob=C,t.deepEqual=function t(e,r){var n=Object.keys,o=typeof e;return e&&r&&"object"===o&&o===typeof r?n(e).length===n(r).length&&n(e).every((function(n){return t(e[n],r[n])})):e===r},t.delay=function(t){return new Promise((function(e){return setTimeout(e,t)}))},t.deviceDetection=function(){if("undefined"==typeof window)return!1;var t=navigator.userAgent.toLowerCase(),e=/midp/i.test(t),r=/ucweb/i.test(t),n=/android/i.test(t),o=/iphone os/i.test(t),i=/windows ce/i.test(t),s=/windows mobile/i.test(t),a=/rv:1.2.3.4/i.test(t);return e||r||n||o||i||s||a},t.emitter=Z,t.fileSizeFormat=function(t,e,r){if(void 0===e&&(e="B"),void 0===r&&(r="-"),i(t))return r;var n=A(parseFloat(t.toString()),e);return""+b(n.size,2)+n.unit},t.filterRepeat=function(t,e){var r=new Set;return t.filter((function(t){var n=t[e];return!r.has(n)&&(r.add(n),!0)}))},t.findNodePath=function(t,e,r,n){var o=[];try{for(var i=0;i<r.length;i++)x(r[i],t,e,n,o)}catch(t){return o}},t.floor=function(t,e){if(void 0===e&&(e=0),i(t))return t;var r=Math.pow(10,e),n=Number(t)*r;return Math.floor(n)/r},t.formatBank=function(t,e){return void 0===e&&(e=""),i(t)?e:t.toString().replace(/\s/g,"").replace(/(.{4})/g,"$1 ")},t.formatBytes=function(t,e){if(void 0===e&&(e=2),0===t)return"0 Bytes";var r=e<0?0:e,n=Math.floor(Math.log(t)/Math.log(1024));return parseFloat((t/Math.pow(1024,n)).toFixed(r))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][n]},t.formatCentsToYuan=function(t,e){return S(t,h({operation:"divide",factor:100,formatAsCurrency:!0},e))},t.formatEmptyValue=function(t,e){return void 0===e&&(e="-"),i(t)?e:t},t.formatFloat=function(t,e){void 0===e&&(e=2);var r=parseFloat(String(t));if(Number.isNaN(r))return"";var n=(r=Math.round(Number(t)*Math.pow(10,e))/Math.pow(10,e)).toString(),o=n.indexOf(".");for(o<0&&(o=n.length,n+=".");n.length<=o+e;)n+="0";return n},t.formatMoney=S,t.formatPhone=function(t,e,r){if(void 0===e&&(e=" "),void 0===r&&(r="-"),i(t))return r;if(11!==t.toString().length)return t;var n=t.toString().replace(/[^\d]/g,"").split(""),o="";return n.forEach((function(t,r){3!==r&&7!==r||(o+=e),o+=t})),o},t.formatPhoneHide=function(t,e){if(void 0===e&&(e=""),i(t))return e;if(11!==t.toString().length)return t;var r=t.toString();return r.substr(0,3)+"****"+r.substr(7,11)},t.formatTime=f,t.formateTimestamp=function(t,e){if(void 0===e&&(e="YYYY年MM月DD日 hh:mm:ss"),!t)return"-";var r=new Date(t),n=r.getFullYear()+"",o=r.getMonth()+1,i=r.getDate(),s=r.getHours()>9?r.getHours():"0"+r.getHours(),a=r.getMinutes()>9?r.getMinutes():"0"+r.getMinutes(),u=r.getSeconds()>9?r.getSeconds():"0"+r.getSeconds();return e.replace("YYYY",n+"").replace("MM",o+"").replace("DD",i+"").replace("hh",s+"").replace("mm",a+"").replace("ss",u+"")},t.fromNow=function(t,e,r){if(void 0===e&&(e="yyyy年MM月dd日 HH时mm分ss秒"),void 0===r&&(r="-"),i(t))return r;t=l(t);var n=new Date(t),o=(Date.now()-n.getTime())/1e3;return o<0?t:o<30?"刚刚":o<3600?Math.ceil(o/60)+"分钟前":o<86400?Math.floor(o/3600)+"小时前":o<172800?"1天前":f(t,e)},t.genExportByBlob=function(t){var e=t.axiosRequest,r=t.notWithCredentials,n=void 0===r?[]:r;return function(t){var r=this,o=t.filename,i=t.url,s=t.data,a=void 0===s?{}:s,u=t.params,c=void 0===u?{}:u,l=t.method,f=void 0===l?"post":l;return new Promise((function(t,s){e({method:f,url:i,data:a,params:c,responseType:"blob",config:{withCredentials:n.some((function(t){return!i.includes(t)}))}}).then((function(e){return v(r,void 0,void 0,(function(){var r,n,i,a,u,c,l,f,d,p;return g(this,(function(h){switch(h.label){case 0:return"application/json"!==(r=null==e?void 0:e.data).type?[3,1]:((n=new FileReader).readAsText(r,"utf-8"),n.onload=function(){var t={};try{t=JSON.parse(n.result)}catch(e){t=r}s(t)},[3,3]);case 1:try{i=e.headers,a=i["content-disposition"],u=decodeURIComponent(a.split(";")[1].split("filename=")[1]),o&&!o.includes(".")?(c=u.split("."),l=c[c.length-1],o+="."+l):o||(o=u)}catch(t){o||(o="download.xlsx")}return f=new Blob([e.data]),d=document.createElement("a"),[4,E(f)];case 2:p=h.sent(),d.href=p,d.download=o,document.body.appendChild(d),d.click(),document.body.removeChild(d),t(e),h.label=3;case 3:return[2]}}))}))})).catch((function(t){s(t)}))}))}},t.generateEnglishLetters=function(){for(var t=[],e=65;e<91;e+=1)t.push(String.fromCharCode(e));return t},t.getCookie=function(t){for(var e="",r=document.cookie.split("; "),n=0;n<r.length;n++){var o=r[n].split("=");if(o[0]===t){e=o[1];break}}return e},t.getDeviceType=s,t.getEnvironment=function(){var t=window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i),e=/micromessenger/i.test(navigator.userAgent),r=/wxwork/i.test(navigator.userAgent);return r&&t?"com-wx-mobile":r&&!t?"com-wx-pc":e&&t?"wx-mobile":e&&!t?"wx-pc":"other"},t.getFileData=function(t){var e=t.split(","),r=e[0],n=void 0===r?"":r,o=e[1],i=void 0===o?"":o;return{name:decodeURIComponent(n),url:decodeURIComponent(i)}},t.getFromType=a,t.getIsComWx=function(){return/wxwork/i.test(navigator.userAgent)},t.getIsDevelopment=function(){var t=!1;return"uat2-h5-wecom.hengdayun.com"!==location.origin&&"127.0.0.1:8081"!==location.origin&&"localhost:8081"!==location.origin||(t=!0),t},t.getKeyList=function(t,e){if(!Array.isArray(t))return[];for(var r=[],n=0,o=t;n<o.length;n++){var i=o[n];i&&void 0!==i[e]&&null!==i[e]&&r.push(i[e])}return r},t.getQueryMap=function(t){if(!/^(?:(https?|ftp|rtsp|mms|ws|wss):\/\/)?/i.test(t))return console.error(t+"不符合超链接规范"),{};var e=t.indexOf("?");if(-1===e)return{};for(var r={},n=0,o=t.slice(e+1).split("&");n<o.length;n++){var i=o[n].split("="),s=i[0],a=i[1];s&&(r[s]=a||"")}return r},t.getQueryString=function(t,e){var r=new RegExp("&{1}"+e+"\\=[a-zA-Z0-9_-]+","g"),n=t.replace(/\?/g,"&").match(r)[0];return n.substr(n.indexOf("=")+1)},t.getQueryVariable=function(t){for(var e=window.location.search.substring(1).split("&"),r=0;r<e.length;r++){var n=e[r].split("=");if(n[0]===t)return n[1]}return!1},t.getSvgInfo=function(t){if("undefined"==typeof window||"undefined"==typeof DOMParser)return t;try{var e=(new DOMParser).parseFromString(t,"image/svg+xml").querySelector("svg");if(!e)return t;var r=e.getAttribute("viewBox");if(!r)throw new Error("Invalid SVG string: Missing viewBox attribute.");var n=r.split(" ");return{width:parseInt(n[2],10),height:parseInt(n[3],10),body:Array.from(e.querySelectorAll("path")).map((function(t){return t.outerHTML})).join(" ")}}catch(e){return console.error("解析 SVG 失败:",e),t}},t.getTicket=function(){return localStorage.getItem("jsapiTicket")},t.getToken=u,t.getWecomToken=function(){return localStorage.getItem("wecom_token")},t.handleFlatStr=function(t,e){void 0===t&&(t="state");var r=function(t,e){void 0===e&&(e="state");for(var r,n=t;"string"==typeof n;)try{r=n,n=decodeURIComponent(n),n=JSON.parse(n)}catch(t){n=r;break}for(;n&&"object"==typeof n&&e in n&&("string"==typeof n[e]||"object"==typeof n[e]);)if("string"==typeof(n=n[e]))try{n=decodeURIComponent(n),n=JSON.parse(n)}catch(t){break}return n}(e,t);return"object"==typeof r?JSON.stringify(r):String(r)},t.hasClass=G,t.hexToRgb=$,t.hideTextAtIndex=function(t,e,r){void 0===r&&(r="*"),"number"==typeof t&&(t=t.toString()),Array.isArray(e)||(e=[e]);for(var n=t.split(""),o=0,i=e;o<i.length;o++){var s=i[o];if("object"!=typeof s||Array.isArray(s))"number"==typeof s&&Number.isInteger(s)&&s>=0&&s<n.length&&(n[s]=r);else{var a=s.start,u=s.end;a>=0&&a<u&&u<n.length&&n.fill(r,a,u+1)}}return n.join("")},t.http=function(t){var e=t.cacheType,r=t.currentMode,n=t.errorCb,o=t.getTokenCb,i=t.tokenKey;return k.interceptors.request.use((function(t){return v(void 0,void 0,void 0,(function(){var r,n;return g(this,(function(o){return r=u(e,i),n=s(),t.headers.Authorization=r,t.headers.token=r,t.headers.FrontType=a(n),[2,t]}))}))}),(function(t){return Promise.reject(t)})),k.interceptors.response.use((function(t){return v(void 0,void 0,void 0,(function(){var n,s,a;return g(this,(function(u){return n=t.data,s=n.code||t.status,n instanceof Blob||s===T.CODES.Success?[2,n]:s===T.CODES.UnAuthorized?("local"!==r&&"dev"!==r&&"development"!==r&&(c(e,i),o&&"function"==typeof o&&o()),[2,Promise.reject(new Error("token过期!"))]):(a=n.message||n.msg,[2,Promise.reject(new Error(a||"Error"))])}))}))}),(function(t){return v(void 0,void 0,void 0,(function(){return g(this,(function(e){return n&&"function"==typeof n&&n(t),[2,Promise.reject(t)]}))}))})),k},t.httpEnum=T,t.humpTurnDashed=function(t){return void 0===t&&(t=""),t.replace(/\B([A-Z])/g,"-$1").toLowerCase()},t.intersection=function(t,e){return Array.isArray(t)&&Array.isArray(e)?t.filter((function(t){return e.includes(t)})):[]},t.isAllEmpty=function(t){return null==t||("string"==typeof t?0===t.trim().length:Array.isArray(t)?0===t.length:"object"==typeof t&&0===Object.keys(t).length)},t.isEmail=function(t){return/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(t)},t.isEmpty=i,t.isExternal=function(t){return/^(https?:|mailto:|tel:)/.test(t)},t.isImage=function(t){return/^image\//i.test(t)},t.isIncludeAllChildren=function(t,e,r){if(!Array.isArray(t)||!Array.isArray(e))return!1;var n=r||function(t,e){return JSON.stringify(t)===JSON.stringify(e)};return e.every((function(e){return t.some((function(t){return n(t,e)}))}))},t.isMobile=function(t){return/^0?(13[0-9]|14[5-9]|15[012356789]|166|17[0-8]|18[0-9]|19[8-9])[0-9]{8}$/.test(t.toString())},t.isMobileSimple=function(t){return t=t.toString(),/^1/.test(t)&&11===t.length},t.isPhone=function(t){return/^[1](([3][0-9])|([4][0,1,4-9])|([5][0-3,5-9])|([6][2,5,6,7])|([7][0-8])|([8][0-9])|([9][0-3,5-9]))[0-9]{8}$/.test(t)},t.isQQ=function(t){return/^[1-9][0-9]{4,9}$/gim.test(String(t))},t.isTelephone=function(t){return/^0[1-9][0-9]{1,2}-[2-8][0-9]{6,7}$/.test(String(t))},t.isUrl=function(t){return new RegExp("^(?:(https?|ftp|rtsp|mms|ws|wss):\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:localhost)|(?:[1-9]\\d{0,2}(?:\\.\\d{1,3}){3})|(?:$[0-9a-fA-F:]+$)|(?:(?:[a-zA-Z0-9-_]+\\.)+[a-zA-Z]{2,63}))(?::\\d{1,5})?(?:[/?#]\\S*)?$","i").test(t)},t.lighten=function(t,e){var r=$(t).map((function(t){return Math.floor((255-t)*e+t)}));return Y(r[0],r[1],r[2])},t.newDate=function(t){return t?new Date(l(t)):new Date},t.openLink=function(t,e){if(void 0===e&&(e="_blank"),"undefined"!=typeof window){var r=document.createElement("a");r.setAttribute("href",t),r.setAttribute("target",e),r.setAttribute("rel","noreferrer noopener"),r.setAttribute("id","external");var n=document.getElementById("external");n&&document.body.removeChild(n),document.body.appendChild(r),r.click(),r.remove()}},t.randomString=function(t){t=t||32;for(var e="ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678",r=e.length,n="",o=0;o<t;o++)n+=e.charAt(Math.floor(Math.random()*r));return n},t.recordLogMiddleware=function(t){var e=this;return function(r,n){return v(e,void 0,void 0,(function(){return g(this,(function(e){switch(function(t,e){var r;return function(t){var e,r;return t&&"string"==typeof t.method&&"string"==typeof t.url&&t.headers&&(void 0!==t.routerPath||void 0!==t.routeOptions||"function"==typeof t.getValidationFunction||"IncomingMessage"===(null===(r=null===(e=t.raw)||void 0===e?void 0:e.constructor)||void 0===r?void 0:r.name))}(t)&&void 0!==(null==e?void 0:e.statusCode)?"fastify":t&&t.req&&"function"==typeof t.req.header&&"function"==typeof t.req.query&&void 0!==t.req.raw?"hono":t&&t.request&&t.response&&"function"==typeof t.throw?t.requestContext||(null===(r=t.app)||void 0===r?void 0:r.getApplicationContext)?"midway":"koa":"unknown"}(r,n)){case"hono":return[2,L(r,n,t)];case"fastify":return[2,W(r,n,t)];case"koa":case"midway":return[2,H(r,n,t)];default:return console.warn("[requestLoggerUnified] Unknown framework detected, falling back to Koa-style handling"),[2,H(r,n,t)]}return[2]}))}))}},t.recordLogMiddlewareFastify=function(t){var e=this;return function(r,n){return v(e,void 0,void 0,(function(){return g(this,(function(e){return[2,W(r,n,t)]}))}))}},t.recordLogMiddlewareHono=function(t){var e=this;return function(r,n){return v(e,void 0,void 0,(function(){return g(this,(function(e){return[2,L(r,n,t)]}))}))}},t.recordLogMiddlewareKoa=function(t){var e=this;return function(r,n){return v(e,void 0,void 0,(function(){return g(this,(function(e){return[2,H(r,n,t)]}))}))}},t.recordLogMiddlewareMidway=function(t){var e=this;return function(r,n){return v(e,void 0,void 0,(function(){return g(this,(function(e){return[2,H(r,n,t)]}))}))}},t.removeClass=function(t,e){if("undefined"!=typeof window&&t&&G(t,e)){var r=new RegExp("(\\s|^)"+e+"(\\s|$)");t.className=t.className.replace(r," ").trim()}},t.removeTicket=function(){return localStorage.removeItem("jsapiTicket")},t.removeToken=c,t.rgbToHex=Y,t.sendLog=U,t.setTicket=function(t){return localStorage.setItem("jsapiTicket",t)},t.subBefore=function(t,e){return t&&"string"==typeof e?t.substring(0,t.indexOf(e)):""},t.sum=function(t){return Array.isArray(t)&&t.length>0?t.reduce((function(t,e){return t+e}),0):0},t.toThousands=w,t.toggleClass=function(t,e,r){if("undefined"!=typeof window){var n=r||document.body,o=n.className;o=o.replace(e,"").trim(),n.className=t?(o+" "+e).trim():o}},t.trimVal=function(t){return t?t.replace(/^\s+|\s+$/g,""):t},t.uuid=function(t,e){var r,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[];if(e=e||n.length,t)for(r=0;r<t;r++)o[r]=n[0|Math.random()*e];else{var i=void 0;for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",r=0;r<36;r++)o[r]||(i=0|16*Math.random(),o[r]=n[19==r?3&i|8:i])}return o.join("")},t.validateTwoDecimal=function(t){return!t||""===t||/^(\d+)(\.\d{1,2})?$/.test(t.toString())},t.websocketService=Q,Object.defineProperty(t,"__esModule",{value:!0})}));
|
package/package.json
CHANGED
package/src/common/index.ts
CHANGED
|
@@ -63,33 +63,33 @@ export function isEmpty(val: any): boolean {
|
|
|
63
63
|
|
|
64
64
|
export const clearLoginData = () => {
|
|
65
65
|
// 这里做指定的 key 清除 是为了 避免 清除掉 jsapiticket 等一些需要有的字段 防止多次请求
|
|
66
|
-
localStorage.removeItem('wecom_userinfo')
|
|
67
|
-
localStorage.removeItem('wecom_token')
|
|
68
|
-
localStorage.removeItem('projectActive')
|
|
69
|
-
localStorage.removeItem('loginTime')
|
|
70
|
-
localStorage.removeItem('projectInfo')
|
|
71
|
-
}
|
|
66
|
+
localStorage.removeItem('wecom_userinfo');
|
|
67
|
+
localStorage.removeItem('wecom_token');
|
|
68
|
+
localStorage.removeItem('projectActive');
|
|
69
|
+
localStorage.removeItem('loginTime');
|
|
70
|
+
localStorage.removeItem('projectInfo');
|
|
71
|
+
};
|
|
72
72
|
|
|
73
73
|
// 获取url中参数
|
|
74
74
|
export const getQueryString = (url: string, queryKey: string) => {
|
|
75
|
-
const reg = new RegExp(`&{1}${queryKey}\\=[a-zA-Z0-9_-]+`, 'g')
|
|
76
|
-
const matchResult = url.replace(/\?/g, '&').match(reg)![0]
|
|
77
|
-
return matchResult.substr(matchResult.indexOf('=') + 1)
|
|
78
|
-
}
|
|
75
|
+
const reg = new RegExp(`&{1}${queryKey}\\=[a-zA-Z0-9_-]+`, 'g');
|
|
76
|
+
const matchResult = url.replace(/\?/g, '&').match(reg)![0];
|
|
77
|
+
return matchResult.substr(matchResult.indexOf('=') + 1);
|
|
78
|
+
};
|
|
79
79
|
|
|
80
80
|
export const getQueryVariable = (variable) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
for (
|
|
84
|
-
|
|
85
|
-
if (pair[0] === variable) { return pair[1] }
|
|
81
|
+
const query = window.location.search.substring(1);
|
|
82
|
+
const vars = query.split('&');
|
|
83
|
+
for (let i = 0; i < vars.length; i++) {
|
|
84
|
+
const pair = vars[i].split('=');
|
|
85
|
+
if (pair[0] === variable) { return pair[1]; }
|
|
86
86
|
}
|
|
87
|
-
return (false)
|
|
88
|
-
}
|
|
87
|
+
return (false);
|
|
88
|
+
};
|
|
89
89
|
|
|
90
90
|
export const getWecomToken = () => {
|
|
91
|
-
return localStorage.getItem('wecom_token')
|
|
92
|
-
}
|
|
91
|
+
return localStorage.getItem('wecom_token');
|
|
92
|
+
};
|
|
93
93
|
// 判断设备类型
|
|
94
94
|
export const getDeviceType = (): IFromType => {
|
|
95
95
|
const ua = navigator.userAgent.toLowerCase();
|
|
@@ -108,97 +108,97 @@ export const getDeviceType = (): IFromType => {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
export const getFromType = (res: IFromType) => {
|
|
111
|
-
let result = 'wecom'
|
|
112
|
-
for(
|
|
113
|
-
const value = res[key]
|
|
111
|
+
let result = 'wecom';
|
|
112
|
+
for ( const key in res) {
|
|
113
|
+
const value = res[key];
|
|
114
114
|
if (value) {
|
|
115
|
-
result = fromTypeMap[key]
|
|
115
|
+
result = fromTypeMap[key];
|
|
116
116
|
break;
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
return result;
|
|
120
|
-
}
|
|
120
|
+
};
|
|
121
121
|
export function randomString(e) {
|
|
122
|
-
e = e || 32
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
let n = ''
|
|
126
|
-
for (let i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a))
|
|
127
|
-
return n
|
|
122
|
+
e = e || 32;
|
|
123
|
+
const t = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
|
|
124
|
+
const a = t.length;
|
|
125
|
+
let n = '';
|
|
126
|
+
for (let i = 0; i < e; i++) n += t.charAt(Math.floor(Math.random() * a));
|
|
127
|
+
return n;
|
|
128
128
|
}
|
|
129
129
|
export const getCookie = (cookieName) => {
|
|
130
|
-
let cookie = ''
|
|
131
|
-
|
|
130
|
+
let cookie = '';
|
|
131
|
+
const cookieArr = document.cookie.split('; ');
|
|
132
132
|
for (let i = 0; i < cookieArr.length; i++) {
|
|
133
|
-
|
|
133
|
+
const valueArr = cookieArr[i].split('=');
|
|
134
134
|
if (valueArr[0] === cookieName) {
|
|
135
|
-
cookie = valueArr[1]
|
|
136
|
-
break
|
|
135
|
+
cookie = valueArr[1];
|
|
136
|
+
break;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
return cookie
|
|
140
|
-
}
|
|
139
|
+
return cookie;
|
|
140
|
+
};
|
|
141
141
|
// || 'cc51882c781d8035b98335ccb44787b42dd9d91ba3b85a45ff3e867857a526bfbbddcdc27b8edce9a52882d1838e0b8e6ccf658ed105df9a898b1c977c588bd1'
|
|
142
142
|
export const buildUUID = () => {
|
|
143
|
-
const hexList: string[] = []
|
|
143
|
+
const hexList: string[] = [];
|
|
144
144
|
for (let i = 0; i <= 15; i++) {
|
|
145
|
-
hexList[i] = i.toString(16) as string
|
|
145
|
+
hexList[i] = i.toString(16) as string;
|
|
146
146
|
}
|
|
147
|
-
let uuid = ''
|
|
147
|
+
let uuid = '';
|
|
148
148
|
for (let i = 1; i <= 36; i++) {
|
|
149
149
|
if (i === 9 || i === 14 || i === 19 || i === 24) {
|
|
150
|
-
uuid += '-'
|
|
150
|
+
uuid += '-';
|
|
151
151
|
} else if (i === 15) {
|
|
152
|
-
uuid += 4
|
|
152
|
+
uuid += 4;
|
|
153
153
|
} else if (i === 20) {
|
|
154
154
|
uuid += hexList[(Math.random() * 4) | 8];
|
|
155
155
|
} else {
|
|
156
156
|
uuid += hexList[(Math.random() * 16) | 0];
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
|
-
return uuid.replace(/-/g, '')
|
|
160
|
-
}
|
|
159
|
+
return uuid.replace(/-/g, '');
|
|
160
|
+
};
|
|
161
161
|
|
|
162
162
|
export const getTicket = () => {
|
|
163
|
-
return localStorage.getItem('jsapiTicket')
|
|
164
|
-
}
|
|
163
|
+
return localStorage.getItem('jsapiTicket');
|
|
164
|
+
};
|
|
165
165
|
export const setTicket = (jsapiTicket) => {
|
|
166
|
-
return localStorage.setItem('jsapiTicket', jsapiTicket)
|
|
167
|
-
}
|
|
166
|
+
return localStorage.setItem('jsapiTicket', jsapiTicket);
|
|
167
|
+
};
|
|
168
168
|
export const removeTicket = () => {
|
|
169
|
-
return localStorage.removeItem('jsapiTicket')
|
|
170
|
-
}
|
|
169
|
+
return localStorage.removeItem('jsapiTicket');
|
|
170
|
+
};
|
|
171
171
|
|
|
172
172
|
|
|
173
173
|
export const formateTimestamp = (timestamp: number | null, type = 'YYYY年MM月DD日 hh:mm:ss') => {
|
|
174
174
|
if (!timestamp) {
|
|
175
|
-
return '-'
|
|
175
|
+
return '-';
|
|
176
176
|
}
|
|
177
|
-
const date = new Date(timestamp)
|
|
178
|
-
const year = date.getFullYear() + ''
|
|
179
|
-
const month = date.getMonth() + 1
|
|
180
|
-
const day = date.getDate()
|
|
181
|
-
const houre = date.getHours() > 9 ? date.getHours() : '0' + date.getHours()
|
|
182
|
-
const minute = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes()
|
|
183
|
-
const second = date.getSeconds() > 9 ? date.getSeconds() : '0' + date.getSeconds()
|
|
184
|
-
const result = type.replace('YYYY', year + '').replace('MM', month + '').replace('DD', day + '').replace('hh', houre + '').replace('mm', minute + '').replace('ss', second + '')
|
|
185
|
-
return result
|
|
177
|
+
const date = new Date(timestamp);
|
|
178
|
+
const year = date.getFullYear() + '';
|
|
179
|
+
const month = date.getMonth() + 1;
|
|
180
|
+
const day = date.getDate();
|
|
181
|
+
const houre = date.getHours() > 9 ? date.getHours() : '0' + date.getHours();
|
|
182
|
+
const minute = date.getMinutes() > 9 ? date.getMinutes() : '0' + date.getMinutes();
|
|
183
|
+
const second = date.getSeconds() > 9 ? date.getSeconds() : '0' + date.getSeconds();
|
|
184
|
+
const result = type.replace('YYYY', year + '').replace('MM', month + '').replace('DD', day + '').replace('hh', houre + '').replace('mm', minute + '').replace('ss', second + '');
|
|
185
|
+
return result;
|
|
186
186
|
|
|
187
|
-
}
|
|
187
|
+
};
|
|
188
188
|
|
|
189
189
|
|
|
190
190
|
export const convertBase64UrlToBlob = (urlData) => {
|
|
191
191
|
// console.log('urlData', urlData)
|
|
192
192
|
// 将以base64的图片url数据转换为Blob
|
|
193
|
-
|
|
193
|
+
const bytes = window.atob(urlData.split(',')[1]); // 去掉url的头,并转换为byte
|
|
194
194
|
// 处理异常,将ascii码小于0的转换为大于0
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
for (
|
|
198
|
-
ia[i] = bytes.charCodeAt(i)
|
|
195
|
+
const ab = new ArrayBuffer(bytes.length);
|
|
196
|
+
const ia = new Uint8Array(ab);
|
|
197
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
198
|
+
ia[i] = bytes.charCodeAt(i);
|
|
199
199
|
}
|
|
200
|
-
return new Blob([ab], { type: 'image/png' })
|
|
201
|
-
}
|
|
200
|
+
return new Blob([ab], { type: 'image/png' });
|
|
201
|
+
};
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
export const getEnvironment = () => {
|
|
@@ -207,10 +207,10 @@ export const getEnvironment = () => {
|
|
|
207
207
|
const isComWx = /wxwork/i.test(navigator.userAgent); // 是否企业微信
|
|
208
208
|
|
|
209
209
|
if (isComWx && isMobile) { //手机端企业微信
|
|
210
|
-
return 'com-wx-mobile'
|
|
210
|
+
return 'com-wx-mobile';
|
|
211
211
|
}
|
|
212
212
|
else if (isComWx && !isMobile) { //PC端企业微信
|
|
213
|
-
return 'com-wx-pc'
|
|
213
|
+
return 'com-wx-pc';
|
|
214
214
|
}
|
|
215
215
|
else if (isWx && isMobile) { // 手机端微信
|
|
216
216
|
return 'wx-mobile';
|
|
@@ -221,39 +221,39 @@ export const getEnvironment = () => {
|
|
|
221
221
|
else {
|
|
222
222
|
return 'other';
|
|
223
223
|
}
|
|
224
|
-
}
|
|
224
|
+
};
|
|
225
225
|
|
|
226
226
|
export const getIsComWx = () => {
|
|
227
227
|
const isComWx = /wxwork/i.test(navigator.userAgent); // 是否企业微信
|
|
228
|
-
return isComWx
|
|
229
|
-
}
|
|
228
|
+
return isComWx;
|
|
229
|
+
};
|
|
230
230
|
export const getIsDevelopment = () => {
|
|
231
|
-
let result = false
|
|
231
|
+
let result = false;
|
|
232
232
|
if (location.origin === 'uat2-h5-wecom.hengdayun.com' || location.origin === '127.0.0.1:8081' || location.origin === 'localhost:8081') {
|
|
233
|
-
result = true
|
|
233
|
+
result = true;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
return result
|
|
237
|
-
}
|
|
236
|
+
return result;
|
|
237
|
+
};
|
|
238
238
|
// 处理时间,企微不能通过dayjs以及moment处理时间
|
|
239
239
|
|
|
240
240
|
// 过滤数组重复数据
|
|
241
241
|
export const filterRepeat = (arr: any[], fieldName: string) => {
|
|
242
|
-
const set = new Set()
|
|
243
|
-
return arr.filter(item => {
|
|
244
|
-
const key = item[fieldName]
|
|
242
|
+
const set = new Set();
|
|
243
|
+
return arr.filter((item) => {
|
|
244
|
+
const key = item[fieldName];
|
|
245
245
|
if (set.has(key)) {
|
|
246
|
-
return false
|
|
246
|
+
return false;
|
|
247
247
|
} else {
|
|
248
|
-
set.add(key)
|
|
249
|
-
return true
|
|
248
|
+
set.add(key);
|
|
249
|
+
return true;
|
|
250
250
|
}
|
|
251
|
-
})
|
|
252
|
-
}
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
253
|
|
|
254
254
|
// 将 base64 转换为 Blob
|
|
255
255
|
export const base64ToBlob = (base64) => {
|
|
256
|
-
|
|
256
|
+
let arr = base64.split(","),
|
|
257
257
|
mime = arr[0].match(/:(.\*?);/)[1],
|
|
258
258
|
bstr = atob(arr[1]),
|
|
259
259
|
n = bstr.length,
|
|
@@ -264,43 +264,43 @@ export const base64ToBlob = (base64) => {
|
|
|
264
264
|
return new Blob([u8arr], {
|
|
265
265
|
type: mime,
|
|
266
266
|
});
|
|
267
|
-
}
|
|
267
|
+
};
|
|
268
268
|
// 将 base64 转换为 File
|
|
269
269
|
export const base64ToFile = (base64, fileName) => {
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
const arr = base64.split(",");
|
|
271
|
+
const mime = arr[0].match(/:(.*);/)[1];
|
|
272
272
|
|
|
273
|
-
|
|
273
|
+
const bstr = atob(arr[1]);
|
|
274
274
|
let n = bstr.length;
|
|
275
|
-
|
|
275
|
+
const u8arr = new Uint8Array(n);
|
|
276
276
|
|
|
277
277
|
while (n--) {
|
|
278
278
|
u8arr[n] = bstr.charCodeAt(n);
|
|
279
279
|
}
|
|
280
280
|
return new File([u8arr], fileName, { type: mime });
|
|
281
|
-
}
|
|
281
|
+
};
|
|
282
282
|
|
|
283
283
|
// 处理时间,企微不能通过dayjs以及moment处理时间
|
|
284
284
|
export const isImage = (type: string) => {
|
|
285
285
|
return /^image\//i.test(type);
|
|
286
|
-
}
|
|
286
|
+
};
|
|
287
287
|
|
|
288
288
|
// 获取文件数据
|
|
289
289
|
export const getFileData = (optionName: string) => {
|
|
290
|
-
const [name = '', url = ''] = optionName.split(',')
|
|
290
|
+
const [name = '', url = ''] = optionName.split(',');
|
|
291
291
|
return {
|
|
292
292
|
name: decodeURIComponent(name),
|
|
293
|
-
url: decodeURIComponent(url)
|
|
294
|
-
}
|
|
295
|
-
}
|
|
293
|
+
url: decodeURIComponent(url),
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
296
|
// 验证是否为数字
|
|
297
297
|
export const validateTwoDecimal = (v: number | string) => {
|
|
298
|
-
if (!v || v === '') return true
|
|
299
|
-
return /^(\d+)(\.\d{1,2})?$/.test(v.toString())
|
|
300
|
-
}
|
|
298
|
+
if (!v || v === '') return true;
|
|
299
|
+
return /^(\d+)(\.\d{1,2})?$/.test(v.toString());
|
|
300
|
+
};
|
|
301
301
|
// 生成uuid
|
|
302
302
|
export const uuid = (len, radix) => {
|
|
303
|
-
|
|
303
|
+
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
|
|
304
304
|
let uuid: string[] = [], i: string | number;
|
|
305
305
|
radix = radix || chars.length;
|
|
306
306
|
|
|
@@ -326,10 +326,10 @@ export const uuid = (len, radix) => {
|
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
return uuid.join('');
|
|
329
|
-
}
|
|
329
|
+
};
|
|
330
330
|
|
|
331
331
|
export const getToken = (cacheType: string, key = 'token') => {
|
|
332
|
-
let token = ''
|
|
332
|
+
let token = '';
|
|
333
333
|
const cacheTypeToLower = cacheType.toLowerCase();
|
|
334
334
|
if (cacheTypeToLower === 'localstorage') {
|
|
335
335
|
token = localStorage.getItem(key) || '';
|
|
@@ -339,7 +339,7 @@ export const getToken = (cacheType: string, key = 'token') => {
|
|
|
339
339
|
token = localStorage.getItem(key) || sessionStorage.getItem('token') || '';
|
|
340
340
|
}
|
|
341
341
|
return token;
|
|
342
|
-
}
|
|
342
|
+
};
|
|
343
343
|
export const removeToken = (cacheType: string, key = 'token') => {
|
|
344
344
|
const cacheTypeToLower = cacheType.toLowerCase();
|
|
345
345
|
if (cacheTypeToLower === 'localstorage') {
|
|
@@ -350,4 +350,4 @@ export const removeToken = (cacheType: string, key = 'token') => {
|
|
|
350
350
|
localStorage.removeItem(key);
|
|
351
351
|
sessionStorage.removeItem(key);
|
|
352
352
|
}
|
|
353
|
-
}
|
|
353
|
+
};
|
package/src/file/index.ts
CHANGED
|
@@ -301,19 +301,19 @@ export function genExportByBlob({
|
|
|
301
301
|
* @returns {File|Blob}
|
|
302
302
|
*/
|
|
303
303
|
export async function base64ToFileOrBlob(base64, filename) {
|
|
304
|
-
const [meta, content] = base64.split(',')
|
|
305
|
-
const mime = meta.match(/:(.*?);/)[1]
|
|
306
|
-
const bstr = atob(content)
|
|
307
|
-
const len = bstr.length
|
|
308
|
-
const u8arr = new Uint8Array(len)
|
|
304
|
+
const [meta, content] = base64.split(',');
|
|
305
|
+
const mime = meta.match(/:(.*?);/)[1];
|
|
306
|
+
const bstr = atob(content);
|
|
307
|
+
const len = bstr.length;
|
|
308
|
+
const u8arr = new Uint8Array(len);
|
|
309
309
|
|
|
310
310
|
for (let i = 0; i < len; i++) {
|
|
311
|
-
u8arr[i] = bstr.charCodeAt(i)
|
|
311
|
+
u8arr[i] = bstr.charCodeAt(i);
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
if (filename) {
|
|
315
|
-
return new File([u8arr], filename, { type: mime })
|
|
315
|
+
return new File([u8arr], filename, { type: mime });
|
|
316
316
|
} else {
|
|
317
|
-
return new Blob([u8arr], { type: mime })
|
|
317
|
+
return new Blob([u8arr], { type: mime });
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -133,7 +133,7 @@ class NestedQueryBuilder {
|
|
|
133
133
|
this.parent = parent;
|
|
134
134
|
this.nestedFilters = {
|
|
135
135
|
logic,
|
|
136
|
-
filters: []
|
|
136
|
+
filters: [],
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -269,7 +269,7 @@ export class QueryBuilder extends BaseBuilder<QueryParams> {
|
|
|
269
269
|
// 创建一个新的 OR 组
|
|
270
270
|
const orGroup: NestedFilters = {
|
|
271
271
|
logic: 'or',
|
|
272
|
-
filters: []
|
|
272
|
+
filters: [],
|
|
273
273
|
};
|
|
274
274
|
|
|
275
275
|
// 对象形式: orWhere({ user_id: 10086, status: 1 })
|
|
@@ -295,7 +295,7 @@ export class QueryBuilder extends BaseBuilder<QueryParams> {
|
|
|
295
295
|
// 否则将当前所有条件包装成一个 AND 组,然后与新的 OR 组一起放在顶层
|
|
296
296
|
const andGroup: NestedFilters = {
|
|
297
297
|
logic: 'and',
|
|
298
|
-
filters: [...this.params.filters.filters]
|
|
298
|
+
filters: [...this.params.filters.filters],
|
|
299
299
|
};
|
|
300
300
|
this.params.filters.filters = [andGroup, orGroup];
|
|
301
301
|
this.params.filters.logic = 'and';
|
package/src/http/http.ts
CHANGED
package/src/http/httpEnums.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const httpEnum = {
|
|
|
4
4
|
// 1xx,临时响应
|
|
5
5
|
TEMP_RESPOND: {
|
|
6
6
|
Continue: 100, // 服务器通知浏览器之前一切正常,请客户端继续请求,如果请求结束,可忽略
|
|
7
|
-
SwitchingProtocal: 101 // 针对请求头的Upgrade返回的信息。表明服务器正在切换到指定的协议
|
|
7
|
+
SwitchingProtocal: 101, // 针对请求头的Upgrade返回的信息。表明服务器正在切换到指定的协议
|
|
8
8
|
},
|
|
9
9
|
// 2xx,成功
|
|
10
10
|
SUCCESS: {
|
|
@@ -14,7 +14,7 @@ export const httpEnum = {
|
|
|
14
14
|
NoAuthoritativeInformation: 203, // 表明响应返回的元信息(meta-infomation)和最初的服务器不同,而是从本地或者第三方获取的
|
|
15
15
|
NoContent: 204, // 请求没有数据返回,但是头信息有用。用户代理(浏览器)会更新缓存的头信息
|
|
16
16
|
ResetContent: 205, // 告诉用户代理(浏览器)重置发送该请求的文档
|
|
17
|
-
ParticalContent: 206 // 客户端使用Range请求头时,返回该状态码
|
|
17
|
+
ParticalContent: 206, // 客户端使用Range请求头时,返回该状态码
|
|
18
18
|
},
|
|
19
19
|
// 3xx,重定向
|
|
20
20
|
REDIRECT: {
|
|
@@ -24,7 +24,7 @@ export const httpEnum = {
|
|
|
24
24
|
SeeOther: 303, // 服务通过返回的响应数据指导客户端通过GET方法去另一个URL获取资源。通常用于POST或者PUT的请求返回结果,重定向到信息提示页面或者进度展示页面。重定向页面的方法是GET方法。
|
|
25
25
|
NotModified: 304, // 资源未变更。服务器根据请求头判断,需要资源未修改,只返回响应头;否则将资源一起返回。
|
|
26
26
|
TemporaryRedirect: 307, // 临时重定向。基本和302相同。唯一的区别是这个状态码严格禁止浏览器到新URL请求资源时修改原来的请求方式和请求体。
|
|
27
|
-
PermanentRedirect: 308 // 永久重定向。基本和301相同。但是严格禁止修改请求方式和请求体。
|
|
27
|
+
PermanentRedirect: 308, // 永久重定向。基本和301相同。但是严格禁止修改请求方式和请求体。
|
|
28
28
|
},
|
|
29
29
|
// 4xx,请求错误
|
|
30
30
|
REQUEST_ERROR: {
|
|
@@ -45,8 +45,8 @@ export const httpEnum = {
|
|
|
45
45
|
BadGateway: 502, // 服务器作为网关使用时,收到上游服务器返回的无效响应。
|
|
46
46
|
ServiceUnavailable: 503, // 无法服务。一般发生在因维护而停机或者服务过载。一般还会伴随着返回一个响应头Retry-After: 说明恢复服务的估计时间。
|
|
47
47
|
GateTimeout: 504, // 网关超时。服务器作为网关或者代理,不能及时从上游服务器获取响应返回给客户端。
|
|
48
|
-
HttpVersionNotSupported: 505 // 发出的请求http版本服务器不支持。如果请求通过http2发送,服务器不支持http2.0,就会返回该状态码。
|
|
49
|
-
}
|
|
48
|
+
HttpVersionNotSupported: 505, // 发出的请求http版本服务器不支持。如果请求通过http2发送,服务器不支持http2.0,就会返回该状态码。
|
|
49
|
+
},
|
|
50
50
|
},
|
|
51
51
|
// http状态码
|
|
52
52
|
CODES: {
|
|
@@ -57,5 +57,5 @@ export const httpEnum = {
|
|
|
57
57
|
UnAuthorizedHavePhone: '11002', //查到手机号但是也报错
|
|
58
58
|
},
|
|
59
59
|
// http状态码白名单,在具体业务中处理
|
|
60
|
-
ERR_CODE_WHITE_LIST: []
|
|
61
|
-
}
|
|
60
|
+
ERR_CODE_WHITE_LIST: [],
|
|
61
|
+
};
|
package/src/iam/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ function flattenStateRecursive(state: unknown, keyName: string = 'state') {
|
|
|
40
40
|
export const handleFlatStr = (keyName: string = 'state', value: unknown) => {
|
|
41
41
|
// return `${key}=${value}`
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const flat = flattenStateRecursive(value, keyName);
|
|
44
|
+
const flatStr = typeof flat === 'object' ? JSON.stringify(flat) : String(flat);
|
|
45
45
|
return flatStr;
|
|
46
|
-
}
|
|
46
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -6,15 +6,15 @@ export * from './print';
|
|
|
6
6
|
export * from './validate';
|
|
7
7
|
export * from './number';
|
|
8
8
|
export * from './string';
|
|
9
|
-
export * from './http/httpEnums'
|
|
10
|
-
export * from './http/http'
|
|
11
|
-
export * from './http/apiBuilder'
|
|
12
|
-
export * from './middleware/requestLogger.middware'
|
|
13
|
-
export * from './iam'
|
|
9
|
+
export * from './http/httpEnums';
|
|
10
|
+
export * from './http/http';
|
|
11
|
+
export * from './http/apiBuilder';
|
|
12
|
+
export * from './middleware/requestLogger.middware';
|
|
13
|
+
export * from './iam';
|
|
14
14
|
export * from './color';
|
|
15
15
|
export * from './array';
|
|
16
16
|
export * from './dom';
|
|
17
17
|
// chunk-optimizer 是构建时工具,不应该被打包到浏览器端
|
|
18
18
|
// 如需使用,请通过单独的导入路径:import { createChunkOptimizer } from 'jinbi-utils/chunk-optimizer'
|
|
19
19
|
// export * from './build/chunk-optimizer'
|
|
20
|
-
export * from './websocket'
|
|
20
|
+
export * from './websocket';
|