orion-design 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/_commonjsHelpers-BFTU3MAI.js +7 -0
  2. package/dist/bignumber-upqAL281.js +2907 -0
  3. package/dist/dayjs.min-CYqA_arp.js +12 -0
  4. package/dist/error/OrionError.d.ts +3 -0
  5. package/dist/error/OrionError.js +12 -0
  6. package/dist/index.d.ts +1 -0
  7. package/dist/index.js +3 -0
  8. package/dist/print/LodopFuncs.d.ts +1 -0
  9. package/dist/print/LodopFuncs.js +159 -0
  10. package/dist/print/index.d.ts +25 -0
  11. package/dist/print/index.js +230 -0
  12. package/dist/request/ErrorHandlerChain.d.ts +9 -0
  13. package/dist/request/ErrorHandlerChain.js +18 -0
  14. package/dist/request/RequestFilterChain.d.ts +10 -0
  15. package/dist/request/RequestFilterChain.js +18 -0
  16. package/dist/request/ResponseParserChain.d.ts +10 -0
  17. package/dist/request/ResponseParserChain.js +18 -0
  18. package/dist/request/disivion/DateSerializer.d.ts +5 -0
  19. package/dist/request/disivion/DateSerializer.js +61 -0
  20. package/dist/request/disivion/DivisionErrorHandler.d.ts +6 -0
  21. package/dist/request/disivion/DivisionErrorHandler.js +59 -0
  22. package/dist/request/disivion/DivisionResponseParser.d.ts +5 -0
  23. package/dist/request/disivion/DivisionResponseParser.js +23 -0
  24. package/dist/request/disivion/index.d.ts +1 -0
  25. package/dist/request/disivion/index.js +28 -0
  26. package/dist/request/disivion/request.d.ts +21 -0
  27. package/dist/request/disivion/request.js +19345 -0
  28. package/dist/request/error/BizExceptionResponseError.d.ts +7 -0
  29. package/dist/request/error/BizExceptionResponseError.js +17 -0
  30. package/dist/request/error/ExceptionResponseError.d.ts +7 -0
  31. package/dist/request/error/ExceptionResponseError.js +17 -0
  32. package/dist/request/error/ResponseError.d.ts +5 -0
  33. package/dist/request/error/ResponseError.js +14 -0
  34. package/dist/request/error/SessionExceptionResponseError.d.ts +7 -0
  35. package/dist/request/error/SessionExceptionResponseError.js +17 -0
  36. package/dist/request/index.d.ts +1 -0
  37. package/dist/request/index.js +28 -0
  38. package/dist/request/postByOpenNewWindow.d.ts +1 -0
  39. package/dist/request/postByOpenNewWindow.js +41 -0
  40. package/dist/utils/DateUtil.d.ts +10 -0
  41. package/dist/utils/DateUtil.js +58 -0
  42. package/dist/utils/NumberUtil.d.ts +4 -0
  43. package/dist/utils/NumberUtil.js +10 -0
  44. package/dist/utils/cloneDeep.d.ts +1 -0
  45. package/dist/utils/cloneDeep.js +2255 -0
  46. package/dist/utils/delay.d.ts +1 -0
  47. package/dist/utils/delay.js +5 -0
  48. package/dist/utils/index.d.ts +6 -0
  49. package/dist/utils/index.js +10 -0
  50. package/dist/utils/md5.d.ts +1 -0
  51. package/dist/utils/md5.js +326 -0
  52. package/dist/utils/uuid.d.ts +1 -0
  53. package/dist/utils/uuid.js +63 -0
  54. package/package.json +45 -0
@@ -0,0 +1,7 @@
1
+ import type { AxiosResponse } from 'axios';
2
+ import ResponseError from './ResponseError';
3
+ export default class BizExceptionResponseError extends ResponseError {
4
+ response: AxiosResponse;
5
+ reponseData: unknown;
6
+ constructor(message: string, cause: Error, response: AxiosResponse, reponseData: unknown);
7
+ }
@@ -0,0 +1,17 @@
1
+ import ResponseError from './ResponseError.js';
2
+
3
+ class BizExceptionResponseError extends ResponseError {
4
+ constructor(message, cause, response, reponseData) {
5
+ super(message, cause, response);
6
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
7
+ if (Error.captureStackTrace) {
8
+ Error.captureStackTrace(this, BizExceptionResponseError);
9
+ }
10
+ this.name = 'BizExceptionResponseError';
11
+ // CustomData
12
+ this.response = response;
13
+ this.reponseData = reponseData;
14
+ }
15
+ }
16
+
17
+ export { BizExceptionResponseError as default };
@@ -0,0 +1,7 @@
1
+ import type { AxiosResponse } from 'axios';
2
+ import ResponseError from './ResponseError';
3
+ export default class ExceptionResponseError extends ResponseError {
4
+ response: AxiosResponse;
5
+ reponseData: unknown;
6
+ constructor(message: string, cause: Error, response: AxiosResponse, reponseData: unknown);
7
+ }
@@ -0,0 +1,17 @@
1
+ import ResponseError from './ResponseError.js';
2
+
3
+ class ExceptionResponseError extends ResponseError {
4
+ constructor(message, cause, response, reponseData) {
5
+ super(message, cause, response);
6
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
7
+ if (Error.captureStackTrace) {
8
+ Error.captureStackTrace(this, ExceptionResponseError);
9
+ }
10
+ this.name = 'ExceptionResponseError';
11
+ // CustomData
12
+ this.response = response;
13
+ this.reponseData = reponseData;
14
+ }
15
+ }
16
+
17
+ export { ExceptionResponseError as default };
@@ -0,0 +1,5 @@
1
+ import type { AxiosResponse } from 'axios';
2
+ export default class ResponseError extends Error {
3
+ response: AxiosResponse;
4
+ constructor(message: string, options: ErrorOptions, reponse: AxiosResponse);
5
+ }
@@ -0,0 +1,14 @@
1
+ class ResponseError extends Error {
2
+ constructor(message, options, reponse) {
3
+ super(message, { cause: options.cause });
4
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
5
+ if (Error.captureStackTrace) {
6
+ Error.captureStackTrace(this, ResponseError);
7
+ }
8
+ this.name = 'ResponseError';
9
+ // CustomData
10
+ this.response = reponse;
11
+ }
12
+ }
13
+
14
+ export { ResponseError as default };
@@ -0,0 +1,7 @@
1
+ import type { AxiosResponse } from 'axios';
2
+ import ResponseError from './ResponseError';
3
+ export default class SessionExceptionResponseError extends ResponseError {
4
+ response: AxiosResponse;
5
+ reponseData: unknown;
6
+ constructor(message: string, cause: Error, response: AxiosResponse, reponseData: unknown);
7
+ }
@@ -0,0 +1,17 @@
1
+ import ResponseError from './ResponseError.js';
2
+
3
+ class SessionExceptionResponseError extends ResponseError {
4
+ constructor(message, cause, response, reponseData) {
5
+ super(message, cause, response);
6
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
7
+ if (Error.captureStackTrace) {
8
+ Error.captureStackTrace(this, SessionExceptionResponseError);
9
+ }
10
+ this.name = 'SessionExceptionResponseError';
11
+ // CustomData
12
+ this.response = response;
13
+ this.reponseData = reponseData;
14
+ }
15
+ }
16
+
17
+ export { SessionExceptionResponseError as default };
@@ -0,0 +1 @@
1
+ export { default as divisionRequest } from './disivion';
@@ -0,0 +1,28 @@
1
+ export { default as divisionRequest } from './disivion/request.js';
2
+ import '../_commonjsHelpers-BFTU3MAI.js';
3
+ import 'util';
4
+ import 'stream';
5
+ import 'path';
6
+ import 'http';
7
+ import 'https';
8
+ import 'url';
9
+ import 'fs';
10
+ import 'assert';
11
+ import 'tty';
12
+ import 'os';
13
+ import 'zlib';
14
+ import 'events';
15
+ import '../dayjs.min-CYqA_arp.js';
16
+ import '../utils/md5.js';
17
+ import '../bignumber-upqAL281.js';
18
+ import './ResponseParserChain.js';
19
+ import './ErrorHandlerChain.js';
20
+ import './RequestFilterChain.js';
21
+ import './disivion/DateSerializer.js';
22
+ import './disivion/DivisionResponseParser.js';
23
+ import './disivion/DivisionErrorHandler.js';
24
+ import './error/ResponseError.js';
25
+ import './error/ExceptionResponseError.js';
26
+ import './error/BizExceptionResponseError.js';
27
+ import './error/SessionExceptionResponseError.js';
28
+ import '../utils/cloneDeep.js';
@@ -0,0 +1 @@
1
+ export default function postByOpenNewWindow(url: string): void;
@@ -0,0 +1,41 @@
1
+ function postByOpenNewWindow(url) {
2
+ if (!url) {
3
+ throw new Error('url is null.');
4
+ }
5
+ if (!(typeof url == 'string')) {
6
+ throw new Error('url is not string.');
7
+ }
8
+ // 1. 通过原生FORM发起下载文件的请求
9
+ // a. 动态创建一个FORM并追加到body
10
+ const submitDataForm = document.createElement('FORM');
11
+ submitDataForm.method = 'POST';
12
+ document.body.appendChild(submitDataForm);
13
+ // b. 将URL中的各字段分解为FORM中的实体并追加到动态创建的FORM中
14
+ const questionMarkPos = url.indexOf('?');
15
+ let action = '';
16
+ let params = '';
17
+ if (questionMarkPos != -1) {
18
+ action = url.substring(0, questionMarkPos);
19
+ params = url.substring(questionMarkPos + 1);
20
+ const urlArray = params.split('&');
21
+ for (let i = 0; i < urlArray.length; i++) {
22
+ const [key, value] = urlArray[i].split('=');
23
+ const o = document.createElement('INPUT');
24
+ o.type = 'hidden';
25
+ o.name = key;
26
+ o.id = key;
27
+ o.value = decodeURIComponent(value);
28
+ submitDataForm.appendChild(o);
29
+ }
30
+ }
31
+ else {
32
+ action = url;
33
+ }
34
+ // c. 通过FORM的submit方法发起请求
35
+ submitDataForm.action = action;
36
+ submitDataForm.target = '_blank';
37
+ submitDataForm.submit();
38
+ submitDataForm.outerHTML = '';
39
+ }
40
+
41
+ export { postByOpenNewWindow as default };
@@ -0,0 +1,10 @@
1
+ interface DateUtilFormat {
2
+ format(value: Date, targetFormat: string): string;
3
+ format(value: string, sourceFormat: string, targetFormat: string): string;
4
+ }
5
+ export interface DateUtilI {
6
+ format: DateUtilFormat['format'];
7
+ stringToDate(value: string, format: string): Date;
8
+ }
9
+ declare const DateUtil: DateUtilI;
10
+ export default DateUtil;
@@ -0,0 +1,58 @@
1
+ import { d as dayjs } from '../dayjs.min-CYqA_arp.js';
2
+ import OrionError from '../error/OrionError.js';
3
+ import '../_commonjsHelpers-BFTU3MAI.js';
4
+
5
+ const DateUtil = {
6
+ format(p1, p2, p3) {
7
+ if (p1 instanceof Date && typeof p2 === 'string') {
8
+ const value = p1;
9
+ const format = p2;
10
+ if (!value) {
11
+ throw new OrionError('value is null.');
12
+ }
13
+ if (!format) {
14
+ throw new OrionError('format is null.');
15
+ }
16
+ return dayjs(value).format(format);
17
+ }
18
+ else if (typeof p1 === 'string' && typeof p2 === 'string' && typeof p3 === 'string') {
19
+ const value = p1;
20
+ const sourceFormat = p2;
21
+ const targetFormat = p3;
22
+ if (!value || !sourceFormat || !targetFormat) {
23
+ throw new OrionError(`Invalid arguments: ${value}, ${sourceFormat}, ${targetFormat}`);
24
+ }
25
+ if (dayjs(value, sourceFormat, true).isValid()) {
26
+ return dayjs(value, sourceFormat).format(targetFormat);
27
+ }
28
+ else {
29
+ throw new OrionError(`日期[${value}]与格式[${sourceFormat}]不匹配。`);
30
+ }
31
+ }
32
+ else {
33
+ throw new OrionError(`入参数量[${arguments.length}]不正确。`);
34
+ }
35
+ },
36
+ stringToDate(value, format) {
37
+ if (!value) {
38
+ throw new OrionError('value is null.');
39
+ }
40
+ if (!format) {
41
+ throw new OrionError('format is null.');
42
+ }
43
+ if (typeof value !== 'string') {
44
+ throw new OrionError('value is not a string.');
45
+ }
46
+ if (typeof format !== 'string') {
47
+ throw new OrionError('format is not a string.');
48
+ }
49
+ if (dayjs(value, format, true).isValid()) {
50
+ return dayjs(value, format).toDate();
51
+ }
52
+ else {
53
+ throw new OrionError(`日期[${value}]与格式[${format}]不匹配。`);
54
+ }
55
+ },
56
+ };
57
+
58
+ export { DateUtil as default };
@@ -0,0 +1,4 @@
1
+ declare const NumberUtil: {
2
+ round: (value: number, how: number) => number;
3
+ };
4
+ export default NumberUtil;
@@ -0,0 +1,10 @@
1
+ import { B as BigNumber } from '../bignumber-upqAL281.js';
2
+
3
+ const NumberUtil = {
4
+ round: (value, how) => {
5
+ const bg = new BigNumber(value);
6
+ return Number(bg.toFixed(how, 4));
7
+ },
8
+ };
9
+
10
+ export { NumberUtil as default };
@@ -0,0 +1 @@
1
+ export { cloneDeep as default } from 'lodash-es';