@ibiz-template/core 0.0.1-alpha.22 → 0.0.1-alpha.26
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/dist/system/index.system.js +1 -1
- package/out/factory-center.d.ts +11 -0
- package/out/factory-center.d.ts.map +1 -0
- package/out/factory-center.js +10 -0
- package/out/index.d.ts +1 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/install.d.ts.map +1 -1
- package/out/install.js +2 -0
- package/out/types.d.ts +10 -0
- package/out/types.d.ts.map +1 -1
- package/out/utils/net/http-response.d.ts +3 -8
- package/out/utils/net/http-response.d.ts.map +1 -1
- package/out/utils/net/http-response.js +0 -7
- package/out/utils/net/net.d.ts +18 -11
- package/out/utils/net/net.d.ts.map +1 -1
- package/out/utils/net/net.js +12 -5
- package/package.json +4 -4
- package/src/factory-center.ts +9 -0
- package/src/index.ts +1 -0
- package/src/install.ts +2 -0
- package/src/types.ts +10 -0
- package/src/utils/net/http-response.ts +5 -8
- package/src/utils/net/net.ts +22 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
System.register(["axios","lodash-es","qx-util","qs","pluralize"],(function(t){"use strict";var e,n,r,o,i,s;return{setters:[function(t){e=t.default},function(t){n=t.debounce},function(t){r=t.getCookie,o=t.notNilEmpty},function(t){i=t.stringify},function(t){s=t.default}],execute:function(){t({debounceAndMerge:function(t,e,r,o){var i,s=n((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return i=void 0,t.apply(void 0,v([],b(e),!1))}),r,o);return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t;return i&&(r=e(i,r)),i=r,s.apply(void 0,v([],b(r),!1))}},getToken:m,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new x,new g},isOverlap:function(t,e){return Array.from(new Set(v(v([],b(t),!1),b(e),!1))).length!==t.length+e.length},plural:k,pluralLower:function(t){return k(t).toLowerCase()}});var a,c,u=t("CoreConst",function(){function t(){}return t.DEFAULT_MODEL_SERVICE_TAG="default",t.TOKEN="access_token",t}()),l=t("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});t("LoginMode",a),function(t){t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.CAS="CAS"}(a||t("LoginMode",a={})),t("MenuPermissionMode",c),function(t){t.MIXIN="MIXIN",t.RESOURCE="RESOURCE",t.RT="RT"}(c||t("MenuPermissionMode",c={}));t("IBizContext",(function(t,e){if(void 0===t&&(t={}),e){var n=this;Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var r={};Object.keys(e).forEach((function(t){r[t]={enumerable:!0,set:function(e){n._context[t]=null==e?null:e},get:function(){return void 0!==n._context[t]?n._context[t]:e[t]}}})),Object.defineProperties(this,r)}Object.assign(this,t)}));var
|
|
1
|
+
System.register(["axios","lodash-es","qx-util","qs","pluralize"],(function(t){"use strict";var e,n,r,o,i,s;return{setters:[function(t){e=t.default},function(t){n=t.debounce},function(t){r=t.getCookie,o=t.notNilEmpty},function(t){i=t.stringify},function(t){s=t.default}],execute:function(){t({debounceAndMerge:function(t,e,r,o){var i,s=n((function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return i=void 0,t.apply(void 0,v([],b(e),!1))}),r,o);return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t;return i&&(r=e(i,r)),i=r,s.apply(void 0,v([],b(r),!1))}},getToken:m,install:function(){if(window.ibiz)throw new Error("ibiz 已经存在, 无需重复安装");window.ibiz=new x,window.___fc=new E,new g},isOverlap:function(t,e){return Array.from(new Set(v(v([],b(t),!1),b(e),!1))).length!==t.length+e.length},plural:k,pluralLower:function(t){return k(t).toLowerCase()}});var a,c,u=t("CoreConst",function(){function t(){}return t.DEFAULT_MODEL_SERVICE_TAG="default",t.TOKEN="access_token",t}()),l=t("HttpStatusMessageConst",{200:"服务器成功返回请求的数据。",201:"新建或修改数据成功。",202:"一个请求已经进入后台排队(异步任务)。",204:"删除数据成功。",400:"发出的请求有错误,服务器没有进行新建或修改数据的操作。",401:"用户没有权限(令牌、用户名、密码错误)。",403:"用户得到授权,但是访问是被禁止的。",404:"发出的请求针对的是不存在的记录,服务器没有进行操作。",406:"请求的格式不可得。",410:"请求的资源被永久删除,且不会再得到的。",422:"当创建一个对象时,发生一个验证错误。",500:"服务器发生错误,请检查服务器。",502:"网关错误。",503:"服务不可用,服务器暂时过载或维护。",504:"网关超时。"});t("LoginMode",a),function(t){t.DEFAULT="DEFAULT",t.CUSTOM="CUSTOM",t.CAS="CAS"}(a||t("LoginMode",a={})),t("MenuPermissionMode",c),function(t){t.MIXIN="MIXIN",t.RESOURCE="RESOURCE",t.RT="RT"}(c||t("MenuPermissionMode",c={}));t("IBizContext",(function(t,e){if(void 0===t&&(t={}),e){var n=this;Object.defineProperty(this,"_context",{enumerable:!1,value:{}});var r={};Object.keys(e).forEach((function(t){r[t]={enumerable:!0,set:function(e){n._context[t]=null==e?null:e},get:function(){return void 0!==n._context[t]?n._context[t]:e[t]}}})),Object.defineProperties(this,r)}Object.assign(this,t)}));var f=t("Environment",{baseUrl:"",remoteModelUrl:"/remotemodel",assetsUrl:"./assets",dcSystem:"",ExportFile:"/ibizutil/download",UploadFile:"/ibizutil/upload",casLoginUrl:"",loginMode:a.DEFAULT,menuPermissionMode:c.MIXIN,enablePermission:!0}),h=t("HttpError",(function(t){this.name="HttpError";var e=t.response;this.response=t.response,e?(e.data?this.message=e.data.message:this.message=e.statusText,this.message||(this.message=l[e.status]),this.message||(this.message="网络异常,请稍后重试!"),this.status=e.status):(this.message=t.message,this.status=500)})),p=(t("RuntimeError",(function(t){this.message=t,this.name="Runtime Error"})),function(){return p=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},p.apply(this,arguments)});function d(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function y(t,e){var n,r,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(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=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++,r=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],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}function b(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function v(t,e,n){if(n||2===arguments.length)for(var r,o=0,i=e.length;o<i;o++)!r&&o in e||(r||(r=Array.prototype.slice.call(e,0,o)),r[o]=e[o]);return t.concat(r||Array.prototype.slice.call(e))}function m(){return r(u.TOKEN)}var g=t("Interceptor",function(){function t(){this.init()}return t.prototype.init=function(){e.interceptors.request.use((function(t){t.headers||(t.headers={}),t.headers.Authorization="Bearer ".concat(m());var e=ibiz.orgData;return e&&(e.systemid&&(t.headers.srfsystemid=e.systemid),e.orgid&&(t.headers.srforgid=e.orgid)),t}))},t}());function w(t,e,n,r,o){var i="".concat(t,"-").concat(e);return n&&(i+="-".concat(n)),r&&(i+="__".concat(r)),o&&(i+="--".concat(o)),i}t("Namespace",function(){function t(t,e){this.block=t,this.namespace=e||"ibiz"}return t.prototype.b=function(t){return void 0===t&&(t=""),w(this.namespace,this.block,t,"","")},t.prototype.e=function(t){return t?w(this.namespace,this.block,"",t,""):""},t.prototype.m=function(t){return t?w(this.namespace,this.block,"","",t):""},t.prototype.be=function(t,e){return t&&e?w(this.namespace,this.block,t,e,""):""},t.prototype.em=function(t,e){return t&&e?w(this.namespace,this.block,"",t,e):""},t.prototype.bm=function(t,e){return t&&e?w(this.namespace,this.block,t,"",e):""},t.prototype.bem=function(t,e,n){return t&&e&&n?w(this.namespace,this.block,t,e,n):""},t.prototype.is=function(t,e){return t&&e?"".concat("is-").concat(t):""},t.prototype.cssVar=function(t){var e={};for(var n in t)t[n]&&(e[this.cssVarName(n)]=t[n]);return e},t.prototype.cssVarBlock=function(t){var e={};for(var n in t)t[n]&&(e[this.cssVarBlockName(n)]=t[n]);return e},t.prototype.cssVarName=function(t){return"--".concat(this.namespace,"-").concat(t)},t.prototype.cssVarBlockName=function(t){return"--".concat(this.namespace,"-").concat(this.block,"-").concat(t)},t}()),t("HttpResponse",(function(t,e,n){this.local=!0,this.ok=!1,this.headers={},this.config={},this.data=t,this.status=e||200,this.statusText=n||"",this.status>=200&&this.status<300&&(this.ok=!0)}));var P=t("Net",function(){function t(t){this._prefix="",t&&(this._prefix=t)}return Object.defineProperty(t.prototype,"prefix",{get:function(){return this._prefix||ibiz.env.baseUrl},enumerable:!1,configurable:!0}),t.prototype.post=function(t,n,r,o){return void 0===r&&(r={}),void 0===o&&(o={}),d(this,void 0,void 0,(function(){var i,s;return y(this,(function(a){switch(a.label){case 0:t=this.handleAppPresetParam(t,r),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e({method:"post",url:t,data:n,headers:p({"Content-Type":"application/json;charset=UTF-8",Accept:"application/json"},o)})];case 2:return i=a.sent(),[2,this.doResponseResult(i)];case 3:throw s=a.sent(),new h(s);case 4:return[2]}}))}))},t.prototype.get=function(t,n,r,o){return void 0===n&&(n={}),void 0===r&&(r={}),void 0===o&&(o={}),d(this,void 0,void 0,(function(){var i,s;return y(this,(function(a){switch(a.label){case 0:t=this.attachUrlParam(t,n),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e.get(t,p({headers:r},o))];case 2:return i=a.sent(),[2,this.doResponseResult(i)];case 3:throw s=a.sent(),new h(s);case 4:return[2]}}))}))},t.prototype.delete=function(t,n,r){return void 0===r&&(r={}),d(this,void 0,void 0,(function(){var o,i;return y(this,(function(s){switch(s.label){case 0:t=this.handleAppPresetParam(t,n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,e.delete(t,{headers:r})];case 2:return o=s.sent(),[2,this.doResponseResult(o)];case 3:throw i=s.sent(),new h(i);case 4:return[2]}}))}))},t.prototype.put=function(t,n,r,o){return void 0===r&&(r={}),void 0===o&&(o={}),d(this,void 0,void 0,(function(){var i,s;return y(this,(function(a){switch(a.label){case 0:t=this.handleAppPresetParam(t,r),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e.put(t,n,{headers:o})];case 2:return i=a.sent(),[2,this.doResponseResult(i)];case 3:throw s=a.sent(),new h(s);case 4:return[2]}}))}))},t.prototype.getModel=function(t,n){return void 0===n&&(n={}),d(this,void 0,void 0,(function(){var r,o;return y(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e.get(t,{headers:n})];case 1:return r=i.sent(),[2,this.doResponseResult(r)];case 2:throw o=i.sent(),new h(o);case 3:return[2]}}))}))},t.prototype.doResponseResult=function(t){var e=t;return e.status>=200&&e.status<=299&&(e.ok=!0),e},t.prototype.handleAppPresetParam=function(t,e){if(e){var n=Object.keys(e),r={};return n.forEach((function(t){t.startsWith("srf")&&o(e[t])&&(r[t]=e[t])})),this.attachUrlParam(t,e)}return t},t.prototype.attachUrlParam=function(t,e){t=this.attachUrl(t);var n=i(e);return o(n)&&(t=t.endsWith("?")||-1!==t.indexOf("?")&&t.endsWith("&")?"".concat(t).concat(n):-1===t.indexOf("?")||t.endsWith("&")?"".concat(t,"?").concat(n):"".concat(t,"&").concat(n)),t},t.prototype.attachUrl=function(t){return"".concat(this.prefix).concat(t)},t}());function k(t){return s(t)}t("UrlHelper",function(){function t(){}return Object.defineProperty(t,"routeBase",{get:function(){return"".concat(this.appBase,"/#")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"appBase",{get:function(){var t=window.location,e=t.origin,n=t.pathname;return"".concat(e).concat(n).replace(/\/$/,"")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"routePath",{get:function(){return window.location.hash.replace("#","")},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fullPath",{get:function(){return window.location.href},enumerable:!1,configurable:!0}),t}());var x=t("IBizSys",(function(){this.env=f,this.net=new P})),E=t("FactoryCenter",(function(){}))}}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-center.d.ts","sourceRoot":"","sources":["../src/factory-center.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,aAAa;CAAG"}
|
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/out/index.js
CHANGED
package/out/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAO9B"}
|
package/out/install.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FactoryCenter } from './factory-center';
|
|
1
2
|
import { IBizSys } from './ibizsys';
|
|
2
3
|
import { Interceptor } from './utils';
|
|
3
4
|
/**
|
|
@@ -12,5 +13,6 @@ export function install() {
|
|
|
12
13
|
throw new Error('ibiz 已经存在, 无需重复安装');
|
|
13
14
|
}
|
|
14
15
|
window.ibiz = new IBizSys();
|
|
16
|
+
window.___fc = new FactoryCenter();
|
|
15
17
|
new Interceptor();
|
|
16
18
|
}
|
package/out/types.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import { FactoryCenter } from './factory-center';
|
|
1
2
|
import { IBizSys } from './ibizsys';
|
|
2
3
|
declare global {
|
|
3
4
|
const ibiz: IBizSys;
|
|
5
|
+
const ___fc: FactoryCenter;
|
|
4
6
|
interface Window {
|
|
5
7
|
ibiz: IBizSys;
|
|
8
|
+
/**
|
|
9
|
+
* 全局工厂中心
|
|
10
|
+
*
|
|
11
|
+
* @author lxm
|
|
12
|
+
* @date 2022-10-17 15:10:43
|
|
13
|
+
* @type {FactoryCenter}
|
|
14
|
+
*/
|
|
15
|
+
___fc: FactoryCenter;
|
|
6
16
|
}
|
|
7
17
|
/**
|
|
8
18
|
* 上下文
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,IAAI,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,IAAI,EAAE,OAAO,CAAC;IACpB,MAAM,KAAK,EAAE,aAAa,CAAC;IAE3B,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,CAAC;QACd;;;;;;WAMG;QACH,KAAK,EAAE,aAAa,CAAC;KACtB;IAED;;;;;;OAMG;IACH,UAAU,QAAQ;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,KAAK;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
|
|
@@ -64,14 +64,9 @@ export declare class HttpResponse<T = IData> implements IHttpResponse<T> {
|
|
|
64
64
|
data: T;
|
|
65
65
|
status: number;
|
|
66
66
|
statusText: string;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
* @author chitanda
|
|
71
|
-
* @date 2022-08-18 15:08:46
|
|
72
|
-
* @type {AxiosResponseHeaders}
|
|
73
|
-
*/
|
|
74
|
-
headers: AxiosResponseHeaders;
|
|
67
|
+
headers: AxiosResponseHeaders | Partial<Record<string, string> & {
|
|
68
|
+
'set-cookie'?: string[] | undefined;
|
|
69
|
+
}>;
|
|
75
70
|
/**
|
|
76
71
|
* AxiosResponse 本地仿造时值为空
|
|
77
72
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-response.d.ts","sourceRoot":"","sources":["../../../src/utils/net/http-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,KAAK,CAAE,SAAQ,aAAa;IAC7D;;;;;;;OAOG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY,CAAC,CAAC,GAAG,KAAK,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAC9D;;;;;OAKG;IACH,KAAK,UAAQ;IAEb,EAAE,UAAS;IAEX,IAAI,EAAE,CAAC,CAAC;IAER,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IAEnB
|
|
1
|
+
{"version":3,"file":"http-response.d.ts","sourceRoot":"","sources":["../../../src/utils/net/http-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,KAAK,CAAE,SAAQ,aAAa;IAC7D;;;;;;;OAOG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY,CAAC,CAAC,GAAG,KAAK,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAC9D;;;;;OAKG;IACH,KAAK,UAAQ;IAEb,EAAE,UAAS;IAEX,IAAI,EAAE,CAAC,CAAC;IAER,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IAEnB,OAAO,EACH,oBAAoB,GACpB,OAAO,CACL,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,CACjE,CAAM;IAEX;;;;;;OAMG;IACH,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAM;IAEvC;;;;;;;;OAQG;gBACS,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAQjE"}
|
|
@@ -27,13 +27,6 @@ export class HttpResponse {
|
|
|
27
27
|
*/
|
|
28
28
|
this.local = true;
|
|
29
29
|
this.ok = false;
|
|
30
|
-
/**
|
|
31
|
-
* header 本地仿造时值为空
|
|
32
|
-
*
|
|
33
|
-
* @author chitanda
|
|
34
|
-
* @date 2022-08-18 15:08:46
|
|
35
|
-
* @type {AxiosResponseHeaders}
|
|
36
|
-
*/
|
|
37
30
|
this.headers = {};
|
|
38
31
|
/**
|
|
39
32
|
* AxiosResponse 本地仿造时值为空
|
package/out/utils/net/net.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RawAxiosRequestHeaders } from 'axios';
|
|
2
2
|
import { IHttpResponse } from './http-response';
|
|
3
3
|
/**
|
|
4
4
|
* 全局请求工具类
|
|
@@ -31,52 +31,59 @@ export declare class Net {
|
|
|
31
31
|
* Post 请求
|
|
32
32
|
*
|
|
33
33
|
* @author chitanda
|
|
34
|
-
* @date 2022-
|
|
34
|
+
* @date 2022-10-19 11:10:30
|
|
35
35
|
* @param {string} url
|
|
36
|
+
* @param {IData} data
|
|
36
37
|
* @param {IParams} [params={}]
|
|
38
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
37
39
|
* @return {*} {Promise<IHttpResponse>}
|
|
38
40
|
*/
|
|
39
|
-
post(url: string, data: IData, params?: IParams, headers?:
|
|
41
|
+
post(url: string, data: IData, params?: IParams, headers?: RawAxiosRequestHeaders): Promise<IHttpResponse>;
|
|
40
42
|
/**
|
|
41
43
|
* Get 请求
|
|
42
44
|
*
|
|
43
45
|
* @author chitanda
|
|
44
|
-
* @date 2022-
|
|
46
|
+
* @date 2022-10-19 11:10:24
|
|
45
47
|
* @param {string} url
|
|
46
48
|
* @param {IParams} [params={}]
|
|
49
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
50
|
+
* @param {IParams} [option={}]
|
|
47
51
|
* @return {*} {Promise<IHttpResponse>}
|
|
48
52
|
*/
|
|
49
|
-
get(url: string, params?: IParams, headers?:
|
|
53
|
+
get(url: string, params?: IParams, headers?: RawAxiosRequestHeaders, option?: IParams): Promise<IHttpResponse>;
|
|
50
54
|
/**
|
|
51
55
|
* Delete 请求
|
|
52
56
|
*
|
|
53
57
|
* @author chitanda
|
|
54
|
-
* @date 2022-
|
|
58
|
+
* @date 2022-10-19 11:10:17
|
|
55
59
|
* @param {string} url
|
|
56
60
|
* @param {IParams} [params]
|
|
61
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
57
62
|
* @return {*} {Promise<IHttpResponse>}
|
|
58
63
|
*/
|
|
59
|
-
delete(url: string, params?: IParams, headers?:
|
|
64
|
+
delete(url: string, params?: IParams, headers?: RawAxiosRequestHeaders): Promise<IHttpResponse>;
|
|
60
65
|
/**
|
|
61
66
|
* Put 请求
|
|
62
67
|
*
|
|
63
68
|
* @author chitanda
|
|
64
|
-
* @date 2022-
|
|
69
|
+
* @date 2022-10-19 11:10:11
|
|
65
70
|
* @param {string} url
|
|
66
71
|
* @param {IData} data
|
|
72
|
+
* @param {IParams} [params={}]
|
|
73
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
67
74
|
* @return {*} {Promise<IHttpResponse>}
|
|
68
75
|
*/
|
|
69
|
-
put(url: string, data: IData, params?: IParams, headers?:
|
|
76
|
+
put(url: string, data: IData, params?: IParams, headers?: RawAxiosRequestHeaders): Promise<IHttpResponse>;
|
|
70
77
|
/**
|
|
71
78
|
* 获取模型数据
|
|
72
79
|
*
|
|
73
80
|
* @author chitanda
|
|
74
81
|
* @date 2022-07-14 15:07:15
|
|
75
82
|
* @param {string} url
|
|
76
|
-
* @param {
|
|
83
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
77
84
|
* @return {*} {Promise<IHttpResponse>}
|
|
78
85
|
*/
|
|
79
|
-
getModel(url: string, headers?:
|
|
86
|
+
getModel(url: string, headers?: RawAxiosRequestHeaders): Promise<IHttpResponse>;
|
|
80
87
|
/**
|
|
81
88
|
* 统一处理请求返回
|
|
82
89
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../../src/utils/net/net.ts"],"names":[],"mappings":"AAAA,OAAc,
|
|
1
|
+
{"version":3,"file":"net.d.ts","sourceRoot":"","sources":["../../../src/utils/net/net.ts"],"names":[],"mappings":"AAAA,OAAc,EAEZ,sBAAsB,EAEvB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;GAOG;AACH,qBAAa,GAAG;IACd;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,CAAM;IAE/B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;OAMG;gBACS,MAAM,CAAC,EAAE,MAAM;IAM3B;;;;;;;;;;OAUG;IACG,IAAI,CACR,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAmBzB;;;;;;;;;;OAUG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,sBAA2B,EACpC,MAAM,GAAE,OAAY,GACnB,OAAO,CAAC,aAAa,CAAC;IAczB;;;;;;;;;OASG;IACG,MAAM,CACV,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAChB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAUzB;;;;;;;;;;OAUG;IACG,GAAG,CACP,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,OAAY,EACpB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAUzB;;;;;;;;OAQG;IACG,QAAQ,CACZ,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,aAAa,CAAC;IAWzB;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IAQxB;;;;;;;;;OASG;IACH,OAAO,CAAC,oBAAoB;IAc5B;;;;;;;;;OASG;IACH,OAAO,CAAC,cAAc;IAiBtB;;;;;;;;OAQG;IACH,OAAO,CAAC,SAAS;CAGlB"}
|
package/out/utils/net/net.js
CHANGED
|
@@ -39,9 +39,11 @@ export class Net {
|
|
|
39
39
|
* Post 请求
|
|
40
40
|
*
|
|
41
41
|
* @author chitanda
|
|
42
|
-
* @date 2022-
|
|
42
|
+
* @date 2022-10-19 11:10:30
|
|
43
43
|
* @param {string} url
|
|
44
|
+
* @param {IData} data
|
|
44
45
|
* @param {IParams} [params={}]
|
|
46
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
45
47
|
* @return {*} {Promise<IHttpResponse>}
|
|
46
48
|
*/
|
|
47
49
|
async post(url, data, params = {}, headers = {}) {
|
|
@@ -63,9 +65,11 @@ export class Net {
|
|
|
63
65
|
* Get 请求
|
|
64
66
|
*
|
|
65
67
|
* @author chitanda
|
|
66
|
-
* @date 2022-
|
|
68
|
+
* @date 2022-10-19 11:10:24
|
|
67
69
|
* @param {string} url
|
|
68
70
|
* @param {IParams} [params={}]
|
|
71
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
72
|
+
* @param {IParams} [option={}]
|
|
69
73
|
* @return {*} {Promise<IHttpResponse>}
|
|
70
74
|
*/
|
|
71
75
|
async get(url, params = {}, headers = {}, option = {}) {
|
|
@@ -86,9 +90,10 @@ export class Net {
|
|
|
86
90
|
* Delete 请求
|
|
87
91
|
*
|
|
88
92
|
* @author chitanda
|
|
89
|
-
* @date 2022-
|
|
93
|
+
* @date 2022-10-19 11:10:17
|
|
90
94
|
* @param {string} url
|
|
91
95
|
* @param {IParams} [params]
|
|
96
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
92
97
|
* @return {*} {Promise<IHttpResponse>}
|
|
93
98
|
*/
|
|
94
99
|
async delete(url, params, headers = {}) {
|
|
@@ -105,9 +110,11 @@ export class Net {
|
|
|
105
110
|
* Put 请求
|
|
106
111
|
*
|
|
107
112
|
* @author chitanda
|
|
108
|
-
* @date 2022-
|
|
113
|
+
* @date 2022-10-19 11:10:11
|
|
109
114
|
* @param {string} url
|
|
110
115
|
* @param {IData} data
|
|
116
|
+
* @param {IParams} [params={}]
|
|
117
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
111
118
|
* @return {*} {Promise<IHttpResponse>}
|
|
112
119
|
*/
|
|
113
120
|
async put(url, data, params = {}, headers = {}) {
|
|
@@ -126,7 +133,7 @@ export class Net {
|
|
|
126
133
|
* @author chitanda
|
|
127
134
|
* @date 2022-07-14 15:07:15
|
|
128
135
|
* @param {string} url
|
|
129
|
-
* @param {
|
|
136
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
130
137
|
* @return {*} {Promise<IHttpResponse>}
|
|
131
138
|
*/
|
|
132
139
|
async getModel(url, headers = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/core",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.26",
|
|
4
4
|
"description": "核心包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"author": "chitanda",
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"axios": "^
|
|
31
|
+
"axios": "^1.1.3",
|
|
32
32
|
"pluralize": "^8.0.0",
|
|
33
33
|
"qs": "^6.11.0"
|
|
34
34
|
},
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"@types/pluralize": "^0.0.29",
|
|
37
37
|
"@types/qs": "^6.9.7",
|
|
38
38
|
"lodash-es": "^4.17.21",
|
|
39
|
-
"qx-util": "
|
|
39
|
+
"qx-util": "0.4.3"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"lodash-es": "^4.17.21",
|
|
43
43
|
"qx-util": "^0.4.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "f516fd1387cea04747beec765f3287a92bf5f39f"
|
|
46
46
|
}
|
package/src/index.ts
CHANGED
package/src/install.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FactoryCenter } from './factory-center';
|
|
1
2
|
import { IBizSys } from './ibizsys';
|
|
2
3
|
import { Interceptor } from './utils';
|
|
3
4
|
|
|
@@ -13,5 +14,6 @@ export function install(): void {
|
|
|
13
14
|
throw new Error('ibiz 已经存在, 无需重复安装');
|
|
14
15
|
}
|
|
15
16
|
window.ibiz = new IBizSys();
|
|
17
|
+
window.___fc = new FactoryCenter();
|
|
16
18
|
new Interceptor();
|
|
17
19
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { FactoryCenter } from './factory-center';
|
|
2
3
|
import { IBizSys } from './ibizsys';
|
|
3
4
|
|
|
4
5
|
declare global {
|
|
5
6
|
const ibiz: IBizSys;
|
|
7
|
+
const ___fc: FactoryCenter;
|
|
6
8
|
|
|
7
9
|
interface Window {
|
|
8
10
|
ibiz: IBizSys;
|
|
11
|
+
/**
|
|
12
|
+
* 全局工厂中心
|
|
13
|
+
*
|
|
14
|
+
* @author lxm
|
|
15
|
+
* @date 2022-10-17 15:10:43
|
|
16
|
+
* @type {FactoryCenter}
|
|
17
|
+
*/
|
|
18
|
+
___fc: FactoryCenter;
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
/**
|
|
@@ -75,14 +75,11 @@ export class HttpResponse<T = IData> implements IHttpResponse<T> {
|
|
|
75
75
|
|
|
76
76
|
statusText: string;
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
* @type {AxiosResponseHeaders}
|
|
84
|
-
*/
|
|
85
|
-
headers: AxiosResponseHeaders = {};
|
|
78
|
+
headers:
|
|
79
|
+
| AxiosResponseHeaders
|
|
80
|
+
| Partial<
|
|
81
|
+
Record<string, string> & { 'set-cookie'?: string[] | undefined }
|
|
82
|
+
> = {};
|
|
86
83
|
|
|
87
84
|
/**
|
|
88
85
|
* AxiosResponse 本地仿造时值为空
|
package/src/utils/net/net.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import axios, {
|
|
1
|
+
import axios, {
|
|
2
|
+
AxiosError,
|
|
3
|
+
RawAxiosRequestHeaders,
|
|
4
|
+
AxiosResponse,
|
|
5
|
+
} from 'axios';
|
|
2
6
|
import { stringify } from 'qs';
|
|
3
7
|
import { notNilEmpty } from 'qx-util';
|
|
4
8
|
import { HttpError } from '../../error';
|
|
@@ -44,16 +48,18 @@ export class Net {
|
|
|
44
48
|
* Post 请求
|
|
45
49
|
*
|
|
46
50
|
* @author chitanda
|
|
47
|
-
* @date 2022-
|
|
51
|
+
* @date 2022-10-19 11:10:30
|
|
48
52
|
* @param {string} url
|
|
53
|
+
* @param {IData} data
|
|
49
54
|
* @param {IParams} [params={}]
|
|
55
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
50
56
|
* @return {*} {Promise<IHttpResponse>}
|
|
51
57
|
*/
|
|
52
58
|
async post(
|
|
53
59
|
url: string,
|
|
54
60
|
data: IData,
|
|
55
61
|
params: IParams = {},
|
|
56
|
-
headers:
|
|
62
|
+
headers: RawAxiosRequestHeaders = {},
|
|
57
63
|
): Promise<IHttpResponse> {
|
|
58
64
|
url = this.handleAppPresetParam(url, params);
|
|
59
65
|
try {
|
|
@@ -77,15 +83,17 @@ export class Net {
|
|
|
77
83
|
* Get 请求
|
|
78
84
|
*
|
|
79
85
|
* @author chitanda
|
|
80
|
-
* @date 2022-
|
|
86
|
+
* @date 2022-10-19 11:10:24
|
|
81
87
|
* @param {string} url
|
|
82
88
|
* @param {IParams} [params={}]
|
|
89
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
90
|
+
* @param {IParams} [option={}]
|
|
83
91
|
* @return {*} {Promise<IHttpResponse>}
|
|
84
92
|
*/
|
|
85
93
|
async get(
|
|
86
94
|
url: string,
|
|
87
95
|
params: IParams = {},
|
|
88
|
-
headers:
|
|
96
|
+
headers: RawAxiosRequestHeaders = {},
|
|
89
97
|
option: IParams = {},
|
|
90
98
|
): Promise<IHttpResponse> {
|
|
91
99
|
// if (params.srfparentdata) {
|
|
@@ -105,15 +113,16 @@ export class Net {
|
|
|
105
113
|
* Delete 请求
|
|
106
114
|
*
|
|
107
115
|
* @author chitanda
|
|
108
|
-
* @date 2022-
|
|
116
|
+
* @date 2022-10-19 11:10:17
|
|
109
117
|
* @param {string} url
|
|
110
118
|
* @param {IParams} [params]
|
|
119
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
111
120
|
* @return {*} {Promise<IHttpResponse>}
|
|
112
121
|
*/
|
|
113
122
|
async delete(
|
|
114
123
|
url: string,
|
|
115
124
|
params?: IParams,
|
|
116
|
-
headers:
|
|
125
|
+
headers: RawAxiosRequestHeaders = {},
|
|
117
126
|
): Promise<IHttpResponse> {
|
|
118
127
|
url = this.handleAppPresetParam(url, params);
|
|
119
128
|
try {
|
|
@@ -128,16 +137,18 @@ export class Net {
|
|
|
128
137
|
* Put 请求
|
|
129
138
|
*
|
|
130
139
|
* @author chitanda
|
|
131
|
-
* @date 2022-
|
|
140
|
+
* @date 2022-10-19 11:10:11
|
|
132
141
|
* @param {string} url
|
|
133
142
|
* @param {IData} data
|
|
143
|
+
* @param {IParams} [params={}]
|
|
144
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
134
145
|
* @return {*} {Promise<IHttpResponse>}
|
|
135
146
|
*/
|
|
136
147
|
async put(
|
|
137
148
|
url: string,
|
|
138
149
|
data: IData,
|
|
139
150
|
params: IParams = {},
|
|
140
|
-
headers:
|
|
151
|
+
headers: RawAxiosRequestHeaders = {},
|
|
141
152
|
): Promise<IHttpResponse> {
|
|
142
153
|
url = this.handleAppPresetParam(url, params);
|
|
143
154
|
try {
|
|
@@ -154,12 +165,12 @@ export class Net {
|
|
|
154
165
|
* @author chitanda
|
|
155
166
|
* @date 2022-07-14 15:07:15
|
|
156
167
|
* @param {string} url
|
|
157
|
-
* @param {
|
|
168
|
+
* @param {RawAxiosRequestHeaders} [headers={}]
|
|
158
169
|
* @return {*} {Promise<IHttpResponse>}
|
|
159
170
|
*/
|
|
160
171
|
async getModel(
|
|
161
172
|
url: string,
|
|
162
|
-
headers:
|
|
173
|
+
headers: RawAxiosRequestHeaders = {},
|
|
163
174
|
): Promise<IHttpResponse> {
|
|
164
175
|
try {
|
|
165
176
|
const response = await axios.get(url, {
|