@ibiz-template/core 0.0.1-alpha.1 → 0.0.1-alpha.10

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 (69) hide show
  1. package/out/constant/http-status-message/http-status-message.d.ts +5 -0
  2. package/out/constant/http-status-message/http-status-message.d.ts.map +1 -0
  3. package/out/constant/http-status-message/http-status-message.js +20 -0
  4. package/out/constant/index.d.ts +1 -0
  5. package/out/constant/index.d.ts.map +1 -1
  6. package/out/constant/index.js +1 -0
  7. package/out/context/index.d.ts +10 -2
  8. package/out/context/index.d.ts.map +1 -1
  9. package/out/context/index.js +20 -4
  10. package/out/environment/environment.d.ts.map +1 -1
  11. package/out/environment/environment.js +6 -1
  12. package/out/error/http-error/http-error.d.ts +18 -0
  13. package/out/error/http-error/http-error.d.ts.map +1 -0
  14. package/out/error/http-error/http-error.js +36 -0
  15. package/out/error/index.d.ts +3 -0
  16. package/out/error/index.d.ts.map +1 -0
  17. package/out/error/index.js +2 -0
  18. package/out/error/runtime-error/runtime-error.d.ts +15 -0
  19. package/out/error/runtime-error/runtime-error.d.ts.map +1 -0
  20. package/out/error/runtime-error/runtime-error.js +15 -0
  21. package/out/ibizsys.d.ts +0 -7
  22. package/out/ibizsys.d.ts.map +1 -1
  23. package/out/ibizsys.js +1 -9
  24. package/out/index.d.ts +1 -1
  25. package/out/index.d.ts.map +1 -1
  26. package/out/index.js +1 -1
  27. package/out/install.d.ts.map +1 -1
  28. package/out/install.js +3 -2
  29. package/out/interface/i-environment/i-environment.d.ts +48 -1
  30. package/out/interface/i-environment/i-environment.d.ts.map +1 -1
  31. package/out/types.d.ts +10 -0
  32. package/out/types.d.ts.map +1 -1
  33. package/out/utils/index.d.ts +5 -2
  34. package/out/utils/index.d.ts.map +1 -1
  35. package/out/utils/index.js +4 -1
  36. package/out/utils/namespace/namespace.d.ts +148 -0
  37. package/out/utils/namespace/namespace.d.ts.map +1 -0
  38. package/out/utils/namespace/namespace.js +216 -0
  39. package/out/utils/net/http-response.d.ts +94 -0
  40. package/out/utils/net/http-response.d.ts.map +1 -0
  41. package/out/utils/net/http-response.js +53 -0
  42. package/out/utils/net/net.d.ts +16 -34
  43. package/out/utils/net/net.d.ts.map +1 -1
  44. package/out/utils/net/net.js +57 -28
  45. package/out/utils/plural/plural.d.ts +21 -0
  46. package/out/utils/plural/plural.d.ts.map +1 -0
  47. package/out/utils/plural/plural.js +25 -0
  48. package/out/utils/util/util.d.ts +29 -0
  49. package/out/utils/util/util.d.ts.map +1 -1
  50. package/out/utils/util/util.js +50 -0
  51. package/package.json +15 -9
  52. package/src/constant/http-status-message/http-status-message.ts +20 -0
  53. package/src/constant/index.ts +1 -0
  54. package/src/context/index.ts +24 -5
  55. package/src/environment/environment.ts +6 -1
  56. package/src/error/http-error/http-error.ts +43 -0
  57. package/src/error/index.ts +2 -0
  58. package/src/error/runtime-error/runtime-error.ts +14 -0
  59. package/src/ibizsys.ts +1 -10
  60. package/src/index.ts +1 -2
  61. package/src/install.ts +3 -2
  62. package/src/interface/i-environment/i-environment.ts +54 -2
  63. package/src/types.ts +11 -0
  64. package/src/utils/index.ts +5 -2
  65. package/src/utils/namespace/namespace.ts +244 -0
  66. package/src/utils/net/http-response.ts +113 -0
  67. package/src/utils/net/net.ts +67 -60
  68. package/src/utils/plural/plural.ts +27 -0
  69. package/src/utils/util/util.ts +64 -0
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 请求状态码文本
3
+ */
4
+ export declare const HttpStatusMessageConst: Record<number, string>;
5
+ //# sourceMappingURL=http-status-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-status-message.d.ts","sourceRoot":"","sources":["../../../src/constant/http-status-message/http-status-message.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgBzD,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * 请求状态码文本
3
+ */
4
+ export const HttpStatusMessageConst = {
5
+ 200: '服务器成功返回请求的数据。',
6
+ 201: '新建或修改数据成功。',
7
+ 202: '一个请求已经进入后台排队(异步任务)。',
8
+ 204: '删除数据成功。',
9
+ 400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
10
+ 401: '用户没有权限(令牌、用户名、密码错误)。',
11
+ 403: '用户得到授权,但是访问是被禁止的。',
12
+ 404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
13
+ 406: '请求的格式不可得。',
14
+ 410: '请求的资源被永久删除,且不会再得到的。',
15
+ 422: '当创建一个对象时,发生一个验证错误。',
16
+ 500: '服务器发生错误,请检查服务器。',
17
+ 502: '网关错误。',
18
+ 503: '服务不可用,服务器暂时过载或维护。',
19
+ 504: '网关超时。',
20
+ };
@@ -1,2 +1,3 @@
1
1
  export { CoreConst } from './core/core';
2
+ export { HttpStatusMessageConst } from './http-status-message/http-status-message';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constant/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/constant/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC"}
@@ -1 +1,2 @@
1
1
  export { CoreConst } from './core/core';
2
+ export { HttpStatusMessageConst } from './http-status-message/http-status-message';
@@ -29,13 +29,13 @@ export declare class IBizContext implements IContext {
29
29
  * @protected
30
30
  * @type {(IBizContext | null)}
31
31
  */
32
- protected _parent: IBizContext | null;
32
+ protected _parent: IContext | null;
33
33
  /**
34
34
  * Creates an instance of IBizContext.
35
35
  *
36
36
  * @author chitanda
37
37
  * @date 2022-07-14 10:07:15
38
- * @param {IContext} [context={}]
38
+ * @param {IContext} [context={}] 自身的上下文
39
39
  * @param {IBizContext} [parent]
40
40
  */
41
41
  constructor(context?: IContext, parent?: IBizContext);
@@ -48,6 +48,14 @@ export declare class IBizContext implements IContext {
48
48
  * @return {*} {IBizContext}
49
49
  */
50
50
  protected createProxy(): IBizContext;
51
+ /**
52
+ * 获取所有上下文参数,无多层级默认合并
53
+ *
54
+ * @author chitanda
55
+ * @date 2022-09-28 14:09:20
56
+ * @return {*} {IContext}
57
+ */
58
+ getContext(): IContext;
51
59
  /**
52
60
  * 销毁上下文,避免内存泄漏
53
61
  *
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAOA;;;;;;;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,QAAQ,GAAG,IAAI,CAAQ;IAE1C;;;;;;;OAOG;gBACgB,OAAO,GAAE,QAAa,EAAE,MAAM,CAAC,EAAE,WAAW;IAO/D;;;;;;;OAOG;IACH,SAAS,CAAC,WAAW,IAAI,WAAW;IAIpC;;;;;;OAMG;IACH,UAAU,IAAI,QAAQ;IAStB;;;;;OAKG;IACH,OAAO,IAAI,IAAI;CAIhB"}
@@ -2,6 +2,7 @@
2
2
  /* eslint-disable no-constructor-return */
3
3
  /* eslint-disable no-underscore-dangle */
4
4
  /* eslint-disable max-classes-per-file */
5
+ import { clone } from 'lodash-es';
5
6
  /**
6
7
  * 上下文代理处理
7
8
  *
@@ -16,14 +17,14 @@ export class IBizContextProxyHandle {
16
17
  return true;
17
18
  }
18
19
  get(target, p, _receiver) {
19
- if (target[p]) {
20
+ if (target[p] !== undefined) {
20
21
  return target[p];
21
22
  }
22
- if (target.context[p]) {
23
+ if (target.context[p] !== undefined) {
23
24
  return target.context[p];
24
25
  }
25
26
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
- if (target._parent) {
27
+ if (target._parent && target._parent[p] !== undefined) {
27
28
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
29
  return target._parent[p];
29
30
  }
@@ -43,7 +44,7 @@ export class IBizContext {
43
44
  *
44
45
  * @author chitanda
45
46
  * @date 2022-07-14 10:07:15
46
- * @param {IContext} [context={}]
47
+ * @param {IContext} [context={}] 自身的上下文
47
48
  * @param {IBizContext} [parent]
48
49
  */
49
50
  constructor(context = {}, parent) {
@@ -73,6 +74,21 @@ export class IBizContext {
73
74
  createProxy() {
74
75
  return new Proxy(this, new IBizContextProxyHandle());
75
76
  }
77
+ /**
78
+ * 获取所有上下文参数,无多层级默认合并
79
+ *
80
+ * @author chitanda
81
+ * @date 2022-09-28 14:09:20
82
+ * @return {*} {IContext}
83
+ */
84
+ getContext() {
85
+ if (this.parent) {
86
+ const ctx = this.parent.getContext();
87
+ Object.assign(ctx, clone(this.context));
88
+ return ctx;
89
+ }
90
+ return clone(this.context);
91
+ }
76
92
  /**
77
93
  * 销毁上下文,避免内存泄漏
78
94
  *
@@ -1 +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,YAEzB,CAAC"}
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,YAOzB,CAAC"}
@@ -2,5 +2,10 @@
2
2
  * 环境变量
3
3
  */
4
4
  export const Environment = {
5
- baseUrl: '/trainsys__web',
5
+ baseUrl: '',
6
+ remoteModelUrl: '/remotemodel',
7
+ assetsUrl: './assets',
8
+ dcSystem: '',
9
+ ExportFile: '/ibizutil/download',
10
+ UploadFile: '/ibizutil/upload',
6
11
  };
@@ -0,0 +1,18 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ /**
3
+ * 请求异常
4
+ *
5
+ * @author chitanda
6
+ * @date 2022-09-18 17:09:10
7
+ * @export
8
+ * @class HttpError
9
+ * @implements {Error}
10
+ */
11
+ export declare class HttpError implements Error {
12
+ name: string;
13
+ message: string;
14
+ status: number;
15
+ response?: AxiosResponse;
16
+ constructor(err: AxiosError);
17
+ }
18
+ //# sourceMappingURL=http-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../../src/error/http-error/http-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGlD;;;;;;;;GAQG;AACH,qBAAa,SAAU,YAAW,KAAK;IACrC,IAAI,EAAE,MAAM,CAAe;IAE3B,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,aAAa,CAAC;gBAEb,GAAG,EAAE,UAAU;CAqB5B"}
@@ -0,0 +1,36 @@
1
+ import { HttpStatusMessageConst } from '../../constant';
2
+ /**
3
+ * 请求异常
4
+ *
5
+ * @author chitanda
6
+ * @date 2022-09-18 17:09:10
7
+ * @export
8
+ * @class HttpError
9
+ * @implements {Error}
10
+ */
11
+ export class HttpError {
12
+ constructor(err) {
13
+ this.name = 'HttpError';
14
+ const res = err.response;
15
+ this.response = err.response;
16
+ if (res) {
17
+ if (res.data) {
18
+ this.message = res.data.message;
19
+ }
20
+ else {
21
+ this.message = res.statusText;
22
+ }
23
+ if (!this.message) {
24
+ this.message = HttpStatusMessageConst[res.status];
25
+ }
26
+ if (!this.message) {
27
+ this.message = '网络异常,请稍后重试!';
28
+ }
29
+ this.status = res.status;
30
+ }
31
+ else {
32
+ this.message = err.message;
33
+ this.status = 500;
34
+ }
35
+ }
36
+ }
@@ -0,0 +1,3 @@
1
+ export { HttpError } from './http-error/http-error';
2
+ export { RuntimeError } from './runtime-error/runtime-error';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { HttpError } from './http-error/http-error';
2
+ export { RuntimeError } from './runtime-error/runtime-error';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 运行时异常
3
+ *
4
+ * @author lxm
5
+ * @date 2022-09-21 18:09:09
6
+ * @export
7
+ * @class RuntimeError
8
+ * @implements {Error}
9
+ */
10
+ export declare class RuntimeError implements Error {
11
+ message: string;
12
+ name: string;
13
+ constructor(message: string);
14
+ }
15
+ //# sourceMappingURL=runtime-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-error.d.ts","sourceRoot":"","sources":["../../../src/error/runtime-error/runtime-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,qBAAa,YAAa,YAAW,KAAK;IAGrB,OAAO,EAAE,MAAM;IAFlC,IAAI,EAAE,MAAM,CAAmB;gBAEZ,OAAO,EAAE,MAAM;CACnC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 运行时异常
3
+ *
4
+ * @author lxm
5
+ * @date 2022-09-21 18:09:09
6
+ * @export
7
+ * @class RuntimeError
8
+ * @implements {Error}
9
+ */
10
+ export class RuntimeError {
11
+ constructor(message) {
12
+ this.message = message;
13
+ this.name = 'Runtime Error';
14
+ }
15
+ }
package/out/ibizsys.d.ts CHANGED
@@ -16,13 +16,6 @@ export declare class IBizSys {
16
16
  * @date 2022-07-19 18:07:04
17
17
  */
18
18
  env: import("./interface").IEnvironment;
19
- /**
20
- * 指令控制器
21
- *
22
- * @author chitanda
23
- * @date 2022-07-21 17:07:45
24
- */
25
- commands: import("@ibiz-template/command/out/command").CommandController;
26
19
  /**
27
20
  * 网络请求工具类
28
21
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ibizsys.d.ts","sourceRoot":"","sources":["../src/ibizsys.ts"],"names":[],"mappings":"AAEA,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;;;;;OAKG;IACH,QAAQ,iEAAY;IAEpB;;;;;;OAMG;IACH,GAAG,EAAE,GAAG,CAA6B;IAErC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB"}
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 CHANGED
@@ -1,4 +1,3 @@
1
- import { commands } from '@ibiz-template/command';
2
1
  import { Environment } from './environment/environment';
3
2
  import { Net } from './utils';
4
3
  /**
@@ -18,13 +17,6 @@ export class IBizSys {
18
17
  * @date 2022-07-19 18:07:04
19
18
  */
20
19
  this.env = Environment;
21
- /**
22
- * 指令控制器
23
- *
24
- * @author chitanda
25
- * @date 2022-07-21 17:07:45
26
- */
27
- this.commands = commands;
28
20
  /**
29
21
  * 网络请求工具类
30
22
  *
@@ -32,6 +24,6 @@ export class IBizSys {
32
24
  * @date 2022-07-19 17:07:56
33
25
  * @type {Net}
34
26
  */
35
- this.net = new Net(this.env.baseUrl);
27
+ this.net = new Net();
36
28
  }
37
29
  }
package/out/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import './types';
2
- export { commands } from '@ibiz-template/command';
3
2
  export * from './constant';
4
3
  export { IBizContext, IBizContextProxyHandle } from './context';
5
4
  export { Environment } from './environment/environment';
5
+ export * from './error';
6
6
  export * from './interface';
7
7
  export * from './utils';
8
8
  export { IBizSys } from './ibizsys';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,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"}
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,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"}
package/out/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import './types';
2
- export { commands } from '@ibiz-template/command';
3
2
  export * from './constant';
4
3
  export { IBizContext, IBizContextProxyHandle } from './context';
5
4
  export { Environment } from './environment/environment';
5
+ export * from './error';
6
6
  export * from './interface';
7
7
  export * from './utils';
8
8
  export { IBizSys } from './ibizsys';
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAK9B"}
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 CHANGED
@@ -8,8 +8,9 @@ import { Interceptor } from './utils';
8
8
  * @export
9
9
  */
10
10
  export function install() {
11
- if (!window.ibiz) {
12
- window.ibiz = new IBizSys();
11
+ if (window.ibiz) {
12
+ throw new Error('ibiz 已经存在, 无需重复安装');
13
13
  }
14
+ window.ibiz = new IBizSys();
14
15
  new Interceptor();
15
16
  }
@@ -7,7 +7,14 @@
7
7
  * @interface IEnvironment
8
8
  */
9
9
  export interface IEnvironment {
10
- [key: string | symbol]: any;
10
+ /**
11
+ * 命名空间
12
+ *
13
+ * @author chitanda
14
+ * @date 2022-09-06 11:09:32
15
+ * @type {string}
16
+ */
17
+ namespace?: string;
11
18
  /**
12
19
  * 请求根路径
13
20
  *
@@ -16,5 +23,45 @@ export interface IEnvironment {
16
23
  * @type {string}
17
24
  */
18
25
  baseUrl: string;
26
+ /**
27
+ * 远程模型路径
28
+ *
29
+ * @author chitanda
30
+ * @date 2022-09-22 18:09:25
31
+ * @type {string}
32
+ */
33
+ remoteModelUrl: string;
34
+ /**
35
+ * 资源文件根路径
36
+ *
37
+ * @author lxm
38
+ * @date 2022-08-25 14:08:08
39
+ * @type {string}
40
+ */
41
+ assetsUrl: string;
42
+ /**
43
+ * 中心系统标识
44
+ *
45
+ * @author chitanda
46
+ * @date 2022-08-22 23:08:46
47
+ * @type {string}
48
+ */
49
+ dcSystem: string;
50
+ /**
51
+ * 文件导出
52
+ *
53
+ * @author chitanda
54
+ * @date 2022-08-22 23:08:46
55
+ * @type {string}
56
+ */
57
+ ExportFile: string;
58
+ /**
59
+ * 文件上传
60
+ *
61
+ * @author chitanda
62
+ * @date 2022-08-22 23:08:46
63
+ * @type {string}
64
+ */
65
+ UploadFile: string;
19
66
  }
20
67
  //# sourceMappingURL=i-environment.d.ts.map
@@ -1 +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;IAE3B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAC5B;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB"}
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,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;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"}
package/out/types.d.ts CHANGED
@@ -34,5 +34,15 @@ declare global {
34
34
  interface IData {
35
35
  [key: string | symbol]: any;
36
36
  }
37
+ /**
38
+ * 任意对象结构
39
+ *
40
+ * @author chitanda
41
+ * @date 2022-09-21 15:09:30
42
+ * @interface IObject
43
+ */
44
+ interface IObject {
45
+ [key: string | symbol]: any;
46
+ }
37
47
  }
38
48
  //# sourceMappingURL=types.d.ts.map
@@ -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;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"}
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;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
@@ -1,4 +1,7 @@
1
1
  export { Interceptor } from './interceptor/interceptor';
2
- export { Net, NetResponse } from './net/net';
3
- export { getToken } from './util/util';
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';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +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,GAAG,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC"}
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"}
@@ -1,3 +1,6 @@
1
1
  export { Interceptor } from './interceptor/interceptor';
2
+ export { Namespace } from './namespace/namespace';
3
+ export { HttpResponse } from './net/http-response';
2
4
  export { Net } from './net/net';
3
- export { getToken } from './util/util';
5
+ export { plural, pluralLower } from './plural/plural';
6
+ export * from './util/util';
@@ -0,0 +1,148 @@
1
+ export declare const defaultNamespace = "ibiz";
2
+ /**
3
+ * 全局样式处理命名空间
4
+ *
5
+ * @author chitanda
6
+ * @date 2022-09-06 11:09:50
7
+ * @export
8
+ * @class Namespace
9
+ */
10
+ export declare class Namespace {
11
+ protected block: string;
12
+ /**
13
+ * 命名空间
14
+ *
15
+ * @author chitanda
16
+ * @date 2022-09-06 12:09:01
17
+ * @type {string}
18
+ */
19
+ namespace: string;
20
+ /**
21
+ * Creates an instance of Namespace.
22
+ *
23
+ * @author chitanda
24
+ * @date 2022-09-06 12:09:12
25
+ * @param {string} block 当前命名空间的根模块,例如组件的名称
26
+ * @param {string} [namespace] 指定命名空间,未指定使用默认值 ibiz
27
+ */
28
+ constructor(block: string, namespace?: string);
29
+ /**
30
+ * namespace-block
31
+ * namespace-block-blockSuffix
32
+ *
33
+ * @author chitanda
34
+ * @date 2022-09-06 12:09:08
35
+ * @param {string} [blockSuffix='']
36
+ * @return {*} {string}
37
+ */
38
+ b(blockSuffix?: string): string;
39
+ /**
40
+ * namespace-block__element
41
+ *
42
+ * @author chitanda
43
+ * @date 2022-09-06 12:09:48
44
+ * @param {string} [element]
45
+ * @return {*} {string}
46
+ */
47
+ e(element?: string): string;
48
+ /**
49
+ * namespace-block--modifier
50
+ *
51
+ * @author chitanda
52
+ * @date 2022-09-06 12:09:37
53
+ * @param {string} [modifier]
54
+ * @return {*} {string}
55
+ */
56
+ m(modifier?: string): string;
57
+ /**
58
+ * namespace-block-blockSuffix__element
59
+ *
60
+ * @author chitanda
61
+ * @date 2022-09-06 12:09:52
62
+ * @param {string} [blockSuffix]
63
+ * @param {string} [element]
64
+ * @return {*} {string}
65
+ */
66
+ be(blockSuffix?: string, element?: string): string;
67
+ /**
68
+ * namespace-block__element--modifier
69
+ *
70
+ * @author chitanda
71
+ * @date 2022-09-06 12:09:19
72
+ * @param {string} [element]
73
+ * @param {string} [modifier]
74
+ * @return {*} {string}
75
+ */
76
+ em(element?: string, modifier?: string): string;
77
+ /**
78
+ * namespace-block-blockSuffix--modifier
79
+ *
80
+ * @author chitanda
81
+ * @date 2022-09-06 12:09:59
82
+ * @param {string} [blockSuffix]
83
+ * @param {string} [modifier]
84
+ * @return {*} {string}
85
+ */
86
+ bm(blockSuffix?: string, modifier?: string): string;
87
+ /**
88
+ * namespace-block-blockSuffix__element--modifier
89
+ *
90
+ * @author chitanda
91
+ * @date 2022-09-06 12:09:37
92
+ * @param {string} [blockSuffix]
93
+ * @param {string} [element]
94
+ * @param {string} [modifier]
95
+ * @return {*} {string}
96
+ */
97
+ bem(blockSuffix?: string, element?: string, modifier?: string): string;
98
+ /**
99
+ * 返回状态 class
100
+ *
101
+ * is('loading', false) => '';
102
+ * is('loading', true) => 'is-loading';
103
+ *
104
+ * @author chitanda
105
+ * @date 2022-09-06 12:09:57
106
+ * @param {string} name
107
+ * @param {boolean} [state]
108
+ * @return {*} {string}
109
+ */
110
+ is(name: string, state?: boolean): string;
111
+ /**
112
+ * 生成使用到的 css 变量 style 对象
113
+ *
114
+ * @author chitanda
115
+ * @date 2022-09-06 15:09:41
116
+ * @param {Record<string, string>} object
117
+ * @return {*} {Record<string, string>}
118
+ */
119
+ cssVar(object: Record<string, string>): Record<string, string>;
120
+ /**
121
+ * 生成使用到的 css block 变量 style 对象
122
+ *
123
+ * @author chitanda
124
+ * @date 2022-09-06 15:09:03
125
+ * @param {Record<string, string>} object
126
+ * @return {*} {Record<string, string>}
127
+ */
128
+ cssVarBlock(object: Record<string, string>): Record<string, string>;
129
+ /**
130
+ * 生成 css var 变量名称
131
+ *
132
+ * @author chitanda
133
+ * @date 2022-09-06 15:09:21
134
+ * @param {string} name
135
+ * @return {*} {string}
136
+ */
137
+ cssVarName(name: string): string;
138
+ /**
139
+ * 生成块 css var 变量名称
140
+ *
141
+ * @author chitanda
142
+ * @date 2022-09-06 15:09:35
143
+ * @param {string} name
144
+ * @return {*} {string}
145
+ */
146
+ cssVarBlockName(name: string): string;
147
+ }
148
+ //# sourceMappingURL=namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/utils/namespace/namespace.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAwCvC;;;;;;;GAOG;AACH,qBAAa,SAAS;IAkBR,SAAS,CAAC,KAAK,EAAE,MAAM;IAjBnC;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;OAOG;gBACmB,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAIvD;;;;;;;;OAQG;IACH,CAAC,CAAC,WAAW,GAAE,MAAW,GAAG,MAAM;IAInC;;;;;;;OAOG;IACH,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAI3B;;;;;;;OAOG;IACH,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAI5B;;;;;;;;OAQG;IACH,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAMlD;;;;;;;;OAQG;IACH,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAM/C;;;;;;;;OAQG;IACH,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAMnD;;;;;;;;;OASG;IACH,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAMtE;;;;;;;;;;;OAWG;IACH,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAIzC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAU9D;;;;;;;OAOG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAUnE;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;;;;OAOG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGtC"}