@ibiz-template/core 0.0.1-alpha.0 → 0.0.1-alpha.3

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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/out/constant/core/core.d.ts +23 -0
  3. package/out/constant/core/core.d.ts.map +1 -0
  4. package/out/constant/core/core.js +22 -0
  5. package/out/constant/index.d.ts +2 -0
  6. package/out/constant/index.d.ts.map +1 -0
  7. package/out/constant/index.js +1 -0
  8. package/out/context/index.d.ts +29 -2
  9. package/out/context/index.d.ts.map +1 -1
  10. package/out/context/index.js +36 -5
  11. package/out/environment/environment.d.ts +6 -0
  12. package/out/environment/environment.d.ts.map +1 -0
  13. package/out/environment/environment.js +10 -0
  14. package/out/ibizsys.d.ts +44 -0
  15. package/out/ibizsys.d.ts.map +1 -0
  16. package/out/ibizsys.js +29 -0
  17. package/out/index.d.ts +8 -1
  18. package/out/index.d.ts.map +1 -1
  19. package/out/index.js +8 -8
  20. package/out/install.d.ts +9 -0
  21. package/out/install.d.ts.map +1 -0
  22. package/out/install.js +16 -0
  23. package/out/interface/i-environment/i-environment.d.ts +59 -0
  24. package/out/interface/i-environment/i-environment.d.ts.map +1 -0
  25. package/out/interface/{i-context/i-context.js → i-environment/i-environment.js} +0 -0
  26. package/out/interface/index.d.ts +2 -1
  27. package/out/interface/index.d.ts.map +1 -1
  28. package/out/interface/org-data/org-data.d.ts +43 -0
  29. package/out/interface/org-data/org-data.d.ts.map +1 -0
  30. package/out/interface/org-data/org-data.js +1 -0
  31. package/out/types.d.ts +38 -0
  32. package/out/types.d.ts.map +1 -0
  33. package/out/types.js +1 -0
  34. package/out/utils/index.d.ts +7 -0
  35. package/out/utils/index.d.ts.map +1 -0
  36. package/out/utils/index.js +6 -0
  37. package/out/utils/interceptor/interceptor.d.ts +13 -0
  38. package/out/utils/interceptor/interceptor.d.ts.map +1 -0
  39. package/out/utils/interceptor/interceptor.js +33 -0
  40. package/out/utils/namespace/namespace.d.ts +148 -0
  41. package/out/utils/namespace/namespace.d.ts.map +1 -0
  42. package/out/utils/namespace/namespace.js +216 -0
  43. package/out/utils/net/http-response.d.ts +94 -0
  44. package/out/utils/net/http-response.d.ts.map +1 -0
  45. package/out/utils/net/http-response.js +53 -0
  46. package/out/utils/net/net.d.ts +123 -0
  47. package/out/utils/net/net.d.ts.map +1 -0
  48. package/out/utils/net/net.js +197 -0
  49. package/out/utils/plural/plural.d.ts +21 -0
  50. package/out/utils/plural/plural.d.ts.map +1 -0
  51. package/out/utils/plural/plural.js +25 -0
  52. package/out/utils/util/util.d.ts +10 -0
  53. package/out/utils/util/util.d.ts.map +1 -0
  54. package/out/utils/util/util.js +13 -0
  55. package/package.json +22 -6
  56. package/src/constant/core/core.ts +23 -0
  57. package/src/constant/index.ts +1 -0
  58. package/src/context/index.ts +93 -0
  59. package/src/environment/environment.ts +12 -0
  60. package/src/ibizsys.ts +48 -0
  61. package/src/index.ts +9 -0
  62. package/src/install.ts +17 -0
  63. package/src/interface/i-environment/i-environment.ts +63 -0
  64. package/src/interface/index.ts +2 -0
  65. package/src/interface/org-data/org-data.ts +42 -0
  66. package/src/types.ts +43 -0
  67. package/src/utils/index.ts +6 -0
  68. package/src/utils/interceptor/interceptor.ts +35 -0
  69. package/src/utils/namespace/namespace.ts +244 -0
  70. package/src/utils/net/http-response.ts +113 -0
  71. package/src/utils/net/net.ts +232 -0
  72. package/src/utils/plural/plural.ts +27 -0
  73. package/src/utils/util/util.ts +14 -0
  74. package/out/interface/i-context/i-context.d.ts +0 -12
  75. package/out/interface/i-context/i-context.d.ts.map +0 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 千反田丷
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,23 @@
1
+ /**
2
+ * 核心全局静态变量
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-14 17:07:25
6
+ * @export
7
+ * @enum {number}
8
+ */
9
+ export declare class CoreConst {
10
+ /**
11
+ * 默认模型服务标识
12
+ */
13
+ static readonly DEFAULT_MODEL_SERVICE_TAG = "default";
14
+ /**
15
+ * 访问令牌标识
16
+ *
17
+ * @author chitanda
18
+ * @date 2022-07-20 15:07:28
19
+ * @static
20
+ */
21
+ static readonly TOKEN = "access_token";
22
+ }
23
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/constant/core/core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,qBAAa,SAAS;IACpB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,yBAAyB,aAAa;IAEtD;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,kBAAkB;CACxC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 核心全局静态变量
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-14 17:07:25
6
+ * @export
7
+ * @enum {number}
8
+ */
9
+ export class CoreConst {
10
+ }
11
+ /**
12
+ * 默认模型服务标识
13
+ */
14
+ CoreConst.DEFAULT_MODEL_SERVICE_TAG = 'default';
15
+ /**
16
+ * 访问令牌标识
17
+ *
18
+ * @author chitanda
19
+ * @date 2022-07-20 15:07:28
20
+ * @static
21
+ */
22
+ CoreConst.TOKEN = 'access_token';
@@ -0,0 +1,2 @@
1
+ export { CoreConst } from './core/core';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constant/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1 @@
1
+ export { CoreConst } from './core/core';
@@ -1,4 +1,15 @@
1
- import { IContext } from '../interface';
1
+ /**
2
+ * 上下文代理处理
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-14 10:07:45
6
+ * @class IBizContextProxyHandle
7
+ * @implements {ProxyHandler<IBizContext>}
8
+ */
9
+ export declare class IBizContextProxyHandle implements ProxyHandler<IBizContext> {
10
+ set(target: IBizContext, p: string | symbol, value: unknown): boolean;
11
+ get(target: IBizContext, p: string | symbol, _receiver: unknown): unknown;
12
+ }
2
13
  /**
3
14
  * 上下文处理类
4
15
  *
@@ -18,7 +29,7 @@ export declare class IBizContext implements IContext {
18
29
  * @protected
19
30
  * @type {(IBizContext | null)}
20
31
  */
21
- protected readonly _parent: IBizContext | null;
32
+ protected _parent: IBizContext | null;
22
33
  /**
23
34
  * Creates an instance of IBizContext.
24
35
  *
@@ -28,5 +39,21 @@ export declare class IBizContext implements IContext {
28
39
  * @param {IBizContext} [parent]
29
40
  */
30
41
  constructor(context?: IContext, parent?: IBizContext);
42
+ /**
43
+ * 创建代理
44
+ *
45
+ * @author chitanda
46
+ * @date 2022-07-14 11:07:37
47
+ * @protected
48
+ * @return {*} {IBizContext}
49
+ */
50
+ protected createProxy(): IBizContext;
51
+ /**
52
+ * 销毁上下文,避免内存泄漏
53
+ *
54
+ * @author chitanda
55
+ * @date 2022-07-14 11:07:45
56
+ */
57
+ destroy(): void;
31
58
  }
32
59
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAwBxC;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,QAAQ;IAoBvB,OAAO,EAAE,QAAQ;IAnBpC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAC5B;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAQ;IAEtD;;;;;;;OAOG;gBACgB,OAAO,GAAE,QAAa,EAAE,MAAM,CAAC,EAAE,WAAW;CAMhE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,qBAAa,sBAAuB,YAAW,YAAY,CAAC,WAAW,CAAC;IACtE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO;IAKrE,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO;CAa1E;AAED;;;;;;;GAOG;AACH,qBAAa,WAAY,YAAW,QAAQ;IAsBvB,OAAO,EAAE,QAAQ;IApBpC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAQ;IAE7C;;;;;;;OAOG;gBACgB,OAAO,GAAE,QAAa,EAAE,MAAM,CAAC,EAAE,WAAW;IAO/D;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,IAAI,WAAW;IAIpC;;;;;OAKG;IACH,OAAO,IAAI,IAAI;CAIhB"}
@@ -1,20 +1,30 @@
1
+ /* eslint-disable no-param-reassign */
2
+ /* eslint-disable no-constructor-return */
3
+ /* eslint-disable no-underscore-dangle */
4
+ /* eslint-disable max-classes-per-file */
1
5
  /**
2
- * 代理处理
6
+ * 上下文代理处理
3
7
  *
4
8
  * @author chitanda
5
9
  * @date 2022-07-14 10:07:45
6
10
  * @class IBizContextProxyHandle
7
11
  * @implements {ProxyHandler<IBizContext>}
8
12
  */
9
- class IBizContextProxyHandle {
13
+ export class IBizContextProxyHandle {
10
14
  set(target, p, value) {
11
- return (target.context[p] = value);
15
+ target.context[p] = value;
16
+ return true;
12
17
  }
13
18
  get(target, p, _receiver) {
14
- if (target.context[p]) {
19
+ if (target[p] !== undefined) {
20
+ return target[p];
21
+ }
22
+ if (target.context[p] !== undefined) {
15
23
  return target.context[p];
16
24
  }
17
- if (target._parent) {
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
+ if (target._parent && target._parent[p] !== undefined) {
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
28
  return target._parent[p];
19
29
  }
20
30
  }
@@ -50,6 +60,27 @@ export class IBizContext {
50
60
  if (parent) {
51
61
  this._parent = parent;
52
62
  }
63
+ return this.createProxy();
64
+ }
65
+ /**
66
+ * 创建代理
67
+ *
68
+ * @author chitanda
69
+ * @date 2022-07-14 11:07:37
70
+ * @protected
71
+ * @return {*} {IBizContext}
72
+ */
73
+ createProxy() {
53
74
  return new Proxy(this, new IBizContextProxyHandle());
54
75
  }
76
+ /**
77
+ * 销毁上下文,避免内存泄漏
78
+ *
79
+ * @author chitanda
80
+ * @date 2022-07-14 11:07:45
81
+ */
82
+ destroy() {
83
+ this.context = {};
84
+ this._parent = null;
85
+ }
55
86
  }
@@ -0,0 +1,6 @@
1
+ import { IEnvironment } from '../interface';
2
+ /**
3
+ * 环境变量
4
+ */
5
+ export declare const Environment: IEnvironment;
6
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAMzB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 环境变量
3
+ */
4
+ export const Environment = {
5
+ baseUrl: '',
6
+ assetsUrl: '/assets/',
7
+ dcSystem: '',
8
+ ExportFile: '/ibizutil/download',
9
+ UploadFile: '/ibizutil/upload',
10
+ };
@@ -0,0 +1,44 @@
1
+ import { OrgData } from './interface';
2
+ import { Net } from './utils';
3
+ /**
4
+ * 全局对象
5
+ *
6
+ * @author chitanda
7
+ * @date 2022-07-19 16:07:50
8
+ * @export
9
+ * @class IBizSys
10
+ */
11
+ export declare class IBizSys {
12
+ /**
13
+ * 环境变量
14
+ *
15
+ * @author chitanda
16
+ * @date 2022-07-19 18:07:04
17
+ */
18
+ env: import("./interface").IEnvironment;
19
+ /**
20
+ * 网络请求工具类
21
+ *
22
+ * @author chitanda
23
+ * @date 2022-07-19 17:07:56
24
+ * @type {Net}
25
+ */
26
+ net: Net;
27
+ /**
28
+ * sass 模式下的中心系统标识
29
+ *
30
+ * @author chitanda
31
+ * @date 2022-07-19 18:07:23
32
+ * @type {string}
33
+ */
34
+ orgData?: OrgData;
35
+ /**
36
+ * 应用数据
37
+ *
38
+ * @author chitanda
39
+ * @date 2022-07-20 19:07:22
40
+ * @type {IData}
41
+ */
42
+ appData?: IData;
43
+ }
44
+ //# sourceMappingURL=ibizsys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ibizsys.d.ts","sourceRoot":"","sources":["../src/ibizsys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;GAOG;AACH,qBAAa,OAAO;IAClB;;;;;OAKG;IACH,GAAG,qCAAe;IAElB;;;;;;OAMG;IACH,GAAG,EAAE,GAAG,CAAa;IAErB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB"}
package/out/ibizsys.js ADDED
@@ -0,0 +1,29 @@
1
+ import { Environment } from './environment/environment';
2
+ import { Net } from './utils';
3
+ /**
4
+ * 全局对象
5
+ *
6
+ * @author chitanda
7
+ * @date 2022-07-19 16:07:50
8
+ * @export
9
+ * @class IBizSys
10
+ */
11
+ export class IBizSys {
12
+ constructor() {
13
+ /**
14
+ * 环境变量
15
+ *
16
+ * @author chitanda
17
+ * @date 2022-07-19 18:07:04
18
+ */
19
+ this.env = Environment;
20
+ /**
21
+ * 网络请求工具类
22
+ *
23
+ * @author chitanda
24
+ * @date 2022-07-19 17:07:56
25
+ * @type {Net}
26
+ */
27
+ this.net = new Net();
28
+ }
29
+ }
package/out/index.d.ts CHANGED
@@ -1,2 +1,9 @@
1
- export declare function run(): void;
1
+ import './types';
2
+ export * from './constant';
3
+ export { IBizContext, IBizContextProxyHandle } from './context';
4
+ export { Environment } from './environment/environment';
5
+ export * from './interface';
6
+ export * from './utils';
7
+ export { IBizSys } from './ibizsys';
8
+ export { install } from './install';
2
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,wBAAgB,GAAG,IAAI,IAAI,CAM1B"}
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,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
package/out/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { IBizContext } from './context';
2
- export function run() {
3
- const p = new IBizContext({ a: 1, b: 2 });
4
- const c = new IBizContext({ c: 3 }, p);
5
- console.log(c.a); // 1
6
- console.log(c.b); // 2
7
- console.log(c.c); // 3
8
- }
1
+ import './types';
2
+ export * from './constant';
3
+ export { IBizContext, IBizContextProxyHandle } from './context';
4
+ export { Environment } from './environment/environment';
5
+ export * from './interface';
6
+ export * from './utils';
7
+ export { IBizSys } from './ibizsys';
8
+ export { install } from './install';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 初始化全局对象
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-19 17:07:37
6
+ * @export
7
+ */
8
+ export declare function install(): void;
9
+ //# sourceMappingURL=install.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAM9B"}
package/out/install.js ADDED
@@ -0,0 +1,16 @@
1
+ import { IBizSys } from './ibizsys';
2
+ import { Interceptor } from './utils';
3
+ /**
4
+ * 初始化全局对象
5
+ *
6
+ * @author chitanda
7
+ * @date 2022-07-19 17:07:37
8
+ * @export
9
+ */
10
+ export function install() {
11
+ if (window.ibiz) {
12
+ throw new Error('ibiz 已经存在, 无需重复安装');
13
+ }
14
+ window.ibiz = new IBizSys();
15
+ new Interceptor();
16
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * 配置参数
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-19 18:07:29
6
+ * @export
7
+ * @interface IEnvironment
8
+ */
9
+ export interface IEnvironment {
10
+ /**
11
+ * 命名空间
12
+ *
13
+ * @author chitanda
14
+ * @date 2022-09-06 11:09:32
15
+ * @type {string}
16
+ */
17
+ namespace?: string;
18
+ /**
19
+ * 请求根路径
20
+ *
21
+ * @author chitanda
22
+ * @date 2022-07-19 18:07:58
23
+ * @type {string}
24
+ */
25
+ baseUrl: string;
26
+ /**
27
+ * 资源文件根路径
28
+ *
29
+ * @author lxm
30
+ * @date 2022-08-25 14:08:08
31
+ * @type {string}
32
+ */
33
+ assetsUrl: string;
34
+ /**
35
+ * 中心系统标识
36
+ *
37
+ * @author chitanda
38
+ * @date 2022-08-22 23:08:46
39
+ * @type {string}
40
+ */
41
+ dcSystem: string;
42
+ /**
43
+ * 文件导出
44
+ *
45
+ * @author chitanda
46
+ * @date 2022-08-22 23:08:46
47
+ * @type {string}
48
+ */
49
+ ExportFile: string;
50
+ /**
51
+ * 文件上传
52
+ *
53
+ * @author chitanda
54
+ * @date 2022-08-22 23:08:46
55
+ * @type {string}
56
+ */
57
+ UploadFile: string;
58
+ }
59
+ //# sourceMappingURL=i-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -1,2 +1,3 @@
1
- export { IContext } from './i-context/i-context';
1
+ export { IEnvironment } from './i-environment/i-environment';
2
+ export { OrgData } from './org-data/org-data';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * 组织数据
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-20 18:07:59
6
+ * @export
7
+ * @interface OrgData
8
+ */
9
+ export interface OrgData {
10
+ /**
11
+ * 组织标识
12
+ *
13
+ * @author chitanda
14
+ * @date 2022-07-20 18:07:17
15
+ * @type {string}
16
+ */
17
+ orgid: string;
18
+ /**
19
+ * 组织名称
20
+ *
21
+ * @author chitanda
22
+ * @date 2022-07-20 18:07:31
23
+ * @type {string}
24
+ */
25
+ orgname: string;
26
+ /**
27
+ * 中心系统标识
28
+ *
29
+ * @author chitanda
30
+ * @date 2022-07-20 18:07:56
31
+ * @type {string}
32
+ */
33
+ dcsystemid: string;
34
+ /**
35
+ * 系统标识
36
+ *
37
+ * @author chitanda
38
+ * @date 2022-07-20 18:07:47
39
+ * @type {string}
40
+ */
41
+ systemid: string;
42
+ }
43
+ //# sourceMappingURL=org-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-data.d.ts","sourceRoot":"","sources":["../../../src/interface/org-data/org-data.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1 @@
1
+ export {};
package/out/types.d.ts ADDED
@@ -0,0 +1,38 @@
1
+ import { IBizSys } from './ibizsys';
2
+ declare global {
3
+ const ibiz: IBizSys;
4
+ interface Window {
5
+ ibiz: IBizSys;
6
+ }
7
+ /**
8
+ * 上下文
9
+ *
10
+ * @author chitanda
11
+ * @date 2022-07-14 15:07:52
12
+ * @interface IContext
13
+ */
14
+ interface IContext {
15
+ [key: string | symbol]: any;
16
+ }
17
+ /**
18
+ * 参数
19
+ *
20
+ * @author chitanda
21
+ * @date 2022-07-14 15:07:57
22
+ * @interface IParams
23
+ */
24
+ interface IParams {
25
+ [key: string | symbol]: any;
26
+ }
27
+ /**
28
+ * 数据
29
+ *
30
+ * @author chitanda
31
+ * @date 2022-07-14 15:07:31
32
+ * @interface IData
33
+ */
34
+ interface IData {
35
+ [key: string | symbol]: any;
36
+ }
37
+ }
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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;IAEpB,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,CAAC;KACf;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;CACF"}
package/out/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export { Interceptor } from './interceptor/interceptor';
2
+ export { Namespace } from './namespace/namespace';
3
+ export { IHttpResponse, HttpResponse } from './net/http-response';
4
+ export { Net } from './net/net';
5
+ export { plural, pluralLower } from './plural/plural';
6
+ export * from './util/util';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { Interceptor } from './interceptor/interceptor';
2
+ export { Namespace } from './namespace/namespace';
3
+ export { HttpResponse } from './net/http-response';
4
+ export { Net } from './net/net';
5
+ export { plural, pluralLower } from './plural/plural';
6
+ export * from './util/util';
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 默认请求拦截器
3
+ *
4
+ * @author chitanda
5
+ * @date 2022-07-20 18:07:11
6
+ * @export
7
+ * @class Interceptor
8
+ */
9
+ export declare class Interceptor {
10
+ constructor();
11
+ protected init(): void;
12
+ }
13
+ //# sourceMappingURL=interceptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interceptor.d.ts","sourceRoot":"","sources":["../../../src/utils/interceptor/interceptor.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,qBAAa,WAAW;;IAKtB,SAAS,CAAC,IAAI,IAAI,IAAI;CAkBvB"}
@@ -0,0 +1,33 @@
1
+ import axios from 'axios';
2
+ import { getToken } from '../util/util';
3
+ /**
4
+ * 默认请求拦截器
5
+ *
6
+ * @author chitanda
7
+ * @date 2022-07-20 18:07:11
8
+ * @export
9
+ * @class Interceptor
10
+ */
11
+ export class Interceptor {
12
+ constructor() {
13
+ this.init();
14
+ }
15
+ init() {
16
+ axios.interceptors.request.use(config => {
17
+ if (!config.headers) {
18
+ config.headers = {};
19
+ }
20
+ config.headers.Authorization = `Bearer ${getToken()}`;
21
+ const { orgData } = ibiz;
22
+ if (orgData) {
23
+ if (orgData.systemid) {
24
+ config.headers.srfsystemid = orgData.systemid;
25
+ }
26
+ if (orgData.orgid) {
27
+ config.headers.srforgid = orgData.orgid;
28
+ }
29
+ }
30
+ return config;
31
+ });
32
+ }
33
+ }