orion-design 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/dist/components/Flex/Col.d.ts +25 -0
  2. package/dist/components/Flex/Item.d.ts +25 -0
  3. package/dist/components/Flex/Row.d.ts +25 -0
  4. package/dist/components/Flex/index.d.ts +10 -0
  5. package/dist/components/Flex/index.js +151 -0
  6. package/dist/components/Modal/Modal.d.ts +2 -0
  7. package/dist/components/Space/index.d.ts +76 -0
  8. package/dist/components/_util/classNames.d.ts +2 -0
  9. package/dist/components/_util/classNames.js +31 -0
  10. package/dist/components/_util/isValid.d.ts +2 -0
  11. package/dist/components/_util/isValid.js +5 -0
  12. package/dist/components/_util/props-util/index.d.ts +6 -0
  13. package/dist/components/_util/props-util/index.js +53 -0
  14. package/dist/components/_util/props-util/initDefaultProps.d.ts +6 -0
  15. package/dist/components/_util/props-util/initDefaultProps.js +25 -0
  16. package/dist/components/_util/type.d.ts +62 -0
  17. package/dist/components/_util/type.js +66 -0
  18. package/dist/components/_util/util.d.ts +18 -0
  19. package/dist/components/_util/util.js +83 -0
  20. package/dist/components/_util/vue-types/index.d.ts +12 -0
  21. package/dist/components/_util/vue-types/index.js +473 -0
  22. package/dist/components/components.d.ts +4 -0
  23. package/dist/components/components.js +10 -0
  24. package/dist/components/index.d.ts +3 -0
  25. package/dist/components/index.js +23 -0
  26. package/dist/components-O4L3qYfM.js +61 -0
  27. package/dist/error/OrionError.js +9 -7
  28. package/dist/index.css +44 -0
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.js +11 -0
  31. package/dist/print/LodopFuncs.js +109 -140
  32. package/dist/print/index.js +204 -199
  33. package/dist/request/ErrorHandlerChain.js +13 -13
  34. package/dist/request/RequestFilterChain.js +13 -13
  35. package/dist/request/ResponseParserChain.js +13 -13
  36. package/dist/request/disivion/DateSerializer.js +43 -51
  37. package/dist/request/disivion/DivisionErrorHandler.js +42 -42
  38. package/dist/request/disivion/DivisionResponseParser.js +22 -18
  39. package/dist/request/disivion/index.d.ts +21 -1
  40. package/dist/request/disivion/index.js +174 -153
  41. package/dist/request/error/BizExceptionResponseError.js +10 -10
  42. package/dist/request/error/ExceptionResponseError.js +10 -10
  43. package/dist/request/error/ResponseError.js +11 -9
  44. package/dist/request/error/SessionExceptionResponseError.js +10 -10
  45. package/dist/request/index.d.ts +3 -0
  46. package/dist/request/index.js +3 -2
  47. package/dist/style/index.d.ts +3 -0
  48. package/dist/style/index.js +1 -0
  49. package/dist/utils/DateUtil.js +46 -50
  50. package/dist/utils/NumberUtil.js +5 -5
  51. package/dist/utils/cloneDeep.js +1 -2255
  52. package/dist/utils/delay.js +1 -1
  53. package/dist/utils/index.js +2 -2
  54. package/dist/utils/md5.js +215 -271
  55. package/dist/version/index.d.ts +2 -0
  56. package/dist/version/index.js +6 -0
  57. package/dist/version/version.d.ts +2 -0
  58. package/dist/version/version.js +3 -0
  59. package/global.d.ts +9 -0
  60. package/package.json +25 -9
  61. package/dist/bignumber-upqAL281.js +0 -2907
  62. package/dist/request/disivion/request.d.ts +0 -21
  63. package/dist/request/disivion/request.js +0 -476
  64. package/dist/request/postByOpenNewWindow.d.ts +0 -1
  65. package/dist/request/postByOpenNewWindow.js +0 -41
@@ -3,228 +3,233 @@ import { getLodop } from './LodopFuncs.js';
3
3
 
4
4
  // @ts-nocheck
5
5
  function lodopInit() {
6
- // 获取lodop
7
- const LODOP = getLodop();
8
- return new Promise((resolve) => {
9
- resolve(LODOP);
10
- });
6
+ // 获取lodop
7
+ const LODOP = getLodop();
8
+ return new Promise(resolve => {
9
+ resolve(LODOP);
10
+ });
11
11
  }
12
12
  // 获取打印机列表
13
13
  function getPrinterList() {
14
- lodopInit();
15
- const printers = [];
16
- const count = LODOP.GET_PRINTER_COUNT();
17
- for (let i = 0; i < count; i++) {
18
- printers.push({
19
- value: i,
20
- content: LODOP.GET_PRINTER_NAME(i),
21
- });
22
- }
23
- return printers;
14
+ lodopInit();
15
+ const printers = [];
16
+ const count = LODOP.GET_PRINTER_COUNT();
17
+ for (let i = 0; i < count; i++) {
18
+ printers.push({
19
+ value: i,
20
+ content: LODOP.GET_PRINTER_NAME(i)
21
+ });
22
+ }
23
+ return printers;
24
24
  }
25
25
  // 获取打印机名称列表
26
26
  function getPrinterNameList() {
27
- lodopInit();
28
- const printers = [];
29
- const count = LODOP.GET_PRINTER_COUNT();
30
- for (let i = 0; i < count; i++) {
31
- const prname = LODOP.GET_PRINTER_NAME(i);
32
- printers.push({
33
- value: prname,
34
- content: prname,
35
- });
36
- }
37
- return printers;
27
+ lodopInit();
28
+ const printers = [];
29
+ const count = LODOP.GET_PRINTER_COUNT();
30
+ for (let i = 0; i < count; i++) {
31
+ const prname = LODOP.GET_PRINTER_NAME(i);
32
+ printers.push({
33
+ value: prname,
34
+ content: prname
35
+ });
36
+ }
37
+ return printers;
38
38
  }
39
39
  //////////////////////////////////// 接口
40
40
  // 获取默认打印机名称
41
41
  async function getDefaultPrinter() {
42
- const LODOP = await lodopInit();
43
- return LODOP.GET_PRINTER_NAME(-1); // 获取默认打印机名称(-1是指定默认打印机)
42
+ const LODOP = await lodopInit();
43
+ return LODOP.GET_PRINTER_NAME(-1); // 获取默认打印机名称(-1是指定默认打印机)
44
44
  }
45
45
  // 无打印模板,预览打印
46
46
  async function preview(params) {
47
- if (!params) {
48
- throw new OrionError('打印异常:入参为空,请检查');
49
- }
50
- const { pdfurl, print_para = {} } = params;
51
- if (!pdfurl) {
52
- throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
53
- }
54
- const LODOP = await lodopInit();
55
- //获取传入的打印参数
56
- let page_width = 0;
57
- if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
58
- page_width = print_para.page_width;
59
- }
60
- let page_height = 0;
61
- if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
62
- page_height = print_para.page_height;
63
- }
64
- let page_type = '';
65
- if (print_para.page_type) {
66
- page_type = print_para.page_type;
67
- }
68
- let direction = 1;
69
- if (print_para.direction) {
70
- direction = print_para.direction;
71
- }
72
- let print_duplex = 0;
73
- if (print_para.print_duplex) {
74
- print_duplex = print_para.print_duplex;
75
- }
76
- let print_defaultsource = 0;
77
- if (print_para.print_defaultsource) {
78
- print_defaultsource = print_para.print_defaultsource;
79
- }
80
- // 历史问题,防止重复打印的问题
81
- LODOP.PRINT_INIT('');
82
- if (print_para.print_mode_map) {
83
- Object.keys(print_para.print_mode_map).map((item) => {
84
- LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
85
- });
86
- }
87
- LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
88
- LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
89
- LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
90
- LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url));
91
- LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true); // 移除预览的线条
92
- LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印'); // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名
93
- LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true); //返回打印机状态
94
- return new Promise((resolve) => {
95
- LODOP.On_Return = function (TaskID, Value) {
96
- resolve(Value);
97
- };
98
- LODOP.PREVIEW();
47
+ if (!params) {
48
+ throw new OrionError('打印异常:入参为空,请检查');
49
+ }
50
+ const {
51
+ pdfurl,
52
+ print_para = {}
53
+ } = params;
54
+ if (!pdfurl) {
55
+ throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
56
+ }
57
+ const LODOP = await lodopInit();
58
+ //获取传入的打印参数
59
+ let page_width = 0;
60
+ if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
61
+ page_width = print_para.page_width;
62
+ }
63
+ let page_height = 0;
64
+ if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
65
+ page_height = print_para.page_height;
66
+ }
67
+ let page_type = '';
68
+ if (print_para.page_type) {
69
+ page_type = print_para.page_type;
70
+ }
71
+ let direction = 1;
72
+ if (print_para.direction) {
73
+ direction = print_para.direction;
74
+ }
75
+ let print_duplex = 0;
76
+ if (print_para.print_duplex) {
77
+ print_duplex = print_para.print_duplex;
78
+ }
79
+ let print_defaultsource = 0;
80
+ if (print_para.print_defaultsource) {
81
+ print_defaultsource = print_para.print_defaultsource;
82
+ }
83
+ // 历史问题,防止重复打印的问题
84
+ LODOP.PRINT_INIT('');
85
+ if (print_para.print_mode_map) {
86
+ Object.keys(print_para.print_mode_map).map(item => {
87
+ LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
99
88
  });
89
+ }
90
+ LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
91
+ LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
92
+ LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
93
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url));
94
+ LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true); // 移除预览的线条
95
+ LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印'); // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名
96
+ LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true); //返回打印机状态
97
+ return new Promise(resolve => {
98
+ LODOP.On_Return = function (TaskID, Value) {
99
+ resolve(Value);
100
+ };
101
+ LODOP.PREVIEW();
102
+ });
100
103
  }
101
104
  async function print(params) {
102
- if (!params) {
103
- throw new OrionError('打印异常:入参为空,请检查');
104
- }
105
- const { pdfurl, print_para = {}, printer } = params;
106
- if (!pdfurl) {
107
- throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
108
- }
109
- if (printer) {
110
- return await printWithCertainPrinter(pdfurl, print_para, printer);
111
- }
112
- else {
113
- // 没设置打印机
114
- return await printNeedSelectPrinter(pdfurl, print_para);
115
- }
105
+ if (!params) {
106
+ throw new OrionError('打印异常:入参为空,请检查');
107
+ }
108
+ const {
109
+ pdfurl,
110
+ print_para = {},
111
+ printer
112
+ } = params;
113
+ if (!pdfurl) {
114
+ throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
115
+ }
116
+ if (printer) {
117
+ return await printWithCertainPrinter(pdfurl, print_para, printer);
118
+ } else {
119
+ // 没设置打印机
120
+ return await printNeedSelectPrinter(pdfurl, print_para);
121
+ }
116
122
  }
117
123
  async function printWithCertainPrinter(pdfurl, print_para = {}, pr_name) {
118
- if (!pdfurl) {
119
- throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
120
- }
121
- if (!pr_name) {
122
- throw new OrionError('打印异常:未设置打印机,无法进行打印');
123
- }
124
- //获取传入的打印参数
125
- let page_width = 0;
126
- if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
127
- page_width = print_para.page_width;
128
- }
129
- let page_height = 0;
130
- if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
131
- page_height = print_para.page_height;
132
- }
133
- let page_type = '';
134
- if (print_para.page_type) {
135
- page_type = print_para.page_type;
136
- }
137
- let direction = 1;
138
- if (print_para.direction) {
139
- direction = print_para.direction;
140
- }
141
- let print_duplex = 0;
142
- if (print_para.print_duplex) {
143
- print_duplex = print_para.print_duplex;
144
- }
145
- let print_defaultsource = 0;
146
- if (print_para.print_defaultsource) {
147
- print_defaultsource = print_para.print_defaultsource;
148
- }
149
- const LODOP = await lodopInit();
150
- // 指定打印设备(打印机)
151
- LODOP.PRINT_INIT('');
152
- // 设置了打印机
153
- if (pr_name === -1) {
154
- LODOP.SET_PRINTER_INDEXA(LODOP.GET_PRINTER_NAME(-1));
155
- }
156
- else {
157
- LODOP.SET_PRINTER_INDEXA(pr_name);
158
- }
159
- LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
160
- if (print_para.print_mode_map) {
161
- Object.keys(print_para.print_mode_map).map((item) => {
162
- LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
163
- });
164
- }
165
- LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
166
- LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
167
- LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url));
168
- LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true); //返回打印机状态
169
- return new Promise((resolve) => {
170
- LODOP.On_Return = function (TaskID, Value) {
171
- resolve(Value);
172
- };
173
- LODOP.PRINT();
124
+ if (!pdfurl) {
125
+ throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印');
126
+ }
127
+ if (!pr_name) {
128
+ throw new OrionError('打印异常:未设置打印机,无法进行打印');
129
+ }
130
+ //获取传入的打印参数
131
+ let page_width = 0;
132
+ if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
133
+ page_width = print_para.page_width;
134
+ }
135
+ let page_height = 0;
136
+ if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
137
+ page_height = print_para.page_height;
138
+ }
139
+ let page_type = '';
140
+ if (print_para.page_type) {
141
+ page_type = print_para.page_type;
142
+ }
143
+ let direction = 1;
144
+ if (print_para.direction) {
145
+ direction = print_para.direction;
146
+ }
147
+ let print_duplex = 0;
148
+ if (print_para.print_duplex) {
149
+ print_duplex = print_para.print_duplex;
150
+ }
151
+ let print_defaultsource = 0;
152
+ if (print_para.print_defaultsource) {
153
+ print_defaultsource = print_para.print_defaultsource;
154
+ }
155
+ const LODOP = await lodopInit();
156
+ // 指定打印设备(打印机)
157
+ LODOP.PRINT_INIT('');
158
+ // 设置了打印机
159
+ if (pr_name === -1) {
160
+ LODOP.SET_PRINTER_INDEXA(LODOP.GET_PRINTER_NAME(-1));
161
+ } else {
162
+ LODOP.SET_PRINTER_INDEXA(pr_name);
163
+ }
164
+ LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
165
+ if (print_para.print_mode_map) {
166
+ Object.keys(print_para.print_mode_map).map(item => {
167
+ LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
174
168
  });
169
+ }
170
+ LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
171
+ LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
172
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url));
173
+ LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true); //返回打印机状态
174
+ return new Promise(resolve => {
175
+ LODOP.On_Return = function (TaskID, Value) {
176
+ resolve(Value);
177
+ };
178
+ LODOP.PRINT();
179
+ });
175
180
  }
176
181
  // 无打印模板,直接打印,需要选择打印机
177
182
  async function printNeedSelectPrinter(url, print_para = {}) {
178
- if (url === null || url === '' || typeof url === 'undefined') {
179
- throw new OrionError('打印异常:未知的文件地址[' + url + '],无法进行打印');
180
- }
181
- const LODOP = await lodopInit();
182
- //获取传入的打印参数
183
- let page_width = 0;
184
- if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
185
- page_width = print_para.page_width;
186
- }
187
- let page_height = 0;
188
- if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
189
- page_height = print_para.page_height;
190
- }
191
- let page_type = '';
192
- if (print_para.page_type) {
193
- page_type = print_para.page_type;
194
- }
195
- let direction = 1;
196
- if (print_para.direction) {
197
- direction = print_para.direction;
198
- }
199
- let print_duplex = 0;
200
- if (print_para.print_duplex) {
201
- print_duplex = print_para.print_duplex;
202
- }
203
- let print_defaultsource = 0;
204
- if (print_para.print_defaultsource) {
205
- print_defaultsource = print_para.print_defaultsource;
206
- }
207
- // 历史问题,防止重复打印的问题
208
- LODOP.PRINT_INIT('');
209
- if (print_para.print_mode_map) {
210
- Object.keys(print_para.print_mode_map).map((item) => {
211
- LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
212
- });
213
- }
214
- LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
215
- LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
216
- LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
217
- LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', url);
218
- LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true); // 移除预览的线条
219
- LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印'); // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名
220
- //返回打印机状态
221
- LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true);
222
- return new Promise((resolve) => {
223
- LODOP.On_Return = function (TaskID, Value) {
224
- resolve(Value);
225
- };
226
- LODOP.PRINTA();
183
+ if (url === null || url === '' || typeof url === 'undefined') {
184
+ throw new OrionError('打印异常:未知的文件地址[' + url + '],无法进行打印');
185
+ }
186
+ const LODOP = await lodopInit();
187
+ //获取传入的打印参数
188
+ let page_width = 0;
189
+ if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {
190
+ page_width = print_para.page_width;
191
+ }
192
+ let page_height = 0;
193
+ if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {
194
+ page_height = print_para.page_height;
195
+ }
196
+ let page_type = '';
197
+ if (print_para.page_type) {
198
+ page_type = print_para.page_type;
199
+ }
200
+ let direction = 1;
201
+ if (print_para.direction) {
202
+ direction = print_para.direction;
203
+ }
204
+ let print_duplex = 0;
205
+ if (print_para.print_duplex) {
206
+ print_duplex = print_para.print_duplex;
207
+ }
208
+ let print_defaultsource = 0;
209
+ if (print_para.print_defaultsource) {
210
+ print_defaultsource = print_para.print_defaultsource;
211
+ }
212
+ // 历史问题,防止重复打印的问题
213
+ LODOP.PRINT_INIT('');
214
+ if (print_para.print_mode_map) {
215
+ Object.keys(print_para.print_mode_map).map(item => {
216
+ LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
227
217
  });
218
+ }
219
+ LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0);
220
+ LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0);
221
+ LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
222
+ LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', url);
223
+ LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true); // 移除预览的线条
224
+ LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印'); // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名
225
+ //返回打印机状态
226
+ LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true);
227
+ return new Promise(resolve => {
228
+ LODOP.On_Return = function (TaskID, Value) {
229
+ resolve(Value);
230
+ };
231
+ LODOP.PRINTA();
232
+ });
228
233
  }
229
234
 
230
235
  export { getDefaultPrinter, getPrinterList, getPrinterNameList, lodopInit, preview, print, printNeedSelectPrinter };
@@ -1,18 +1,18 @@
1
1
  class ErrorHandlerChain {
2
- handlers;
3
- index;
4
- constructor(handlers) {
5
- this.handlers = handlers ? handlers : [];
6
- this.index = 0;
7
- }
8
- async handle(error, chain) {
9
- if (this.index == this.handlers.length) {
10
- throw error;
11
- }
12
- const handler = this.handlers[this.index];
13
- this.index++;
14
- return await handler.handle(error, chain);
2
+ handlers;
3
+ index;
4
+ constructor(handlers) {
5
+ this.handlers = handlers ? handlers : [];
6
+ this.index = 0;
7
+ }
8
+ async handle(error, chain) {
9
+ if (this.index == this.handlers.length) {
10
+ throw error;
15
11
  }
12
+ const handler = this.handlers[this.index];
13
+ this.index++;
14
+ return await handler.handle(error, chain);
15
+ }
16
16
  }
17
17
 
18
18
  export { ErrorHandlerChain as default };
@@ -1,18 +1,18 @@
1
1
  class RequestFilterChain {
2
- filters;
3
- index;
4
- constructor(filters) {
5
- this.filters = filters ? filters : [];
6
- this.index = 0;
7
- }
8
- doFilter(request, chain) {
9
- if (this.index == this.filters.length) {
10
- return;
11
- }
12
- const filter = this.filters[this.index];
13
- this.index++;
14
- filter.doFilter(request, chain);
2
+ filters;
3
+ index;
4
+ constructor(filters) {
5
+ this.filters = filters ? filters : [];
6
+ this.index = 0;
7
+ }
8
+ doFilter(request, chain) {
9
+ if (this.index == this.filters.length) {
10
+ return;
15
11
  }
12
+ const filter = this.filters[this.index];
13
+ this.index++;
14
+ filter.doFilter(request, chain);
15
+ }
16
16
  }
17
17
 
18
18
  export { RequestFilterChain as default };
@@ -1,18 +1,18 @@
1
1
  class ResponseParserChain {
2
- parsers;
3
- index;
4
- constructor(parsers) {
5
- this.parsers = parsers ? parsers : [];
6
- this.index = 0;
7
- }
8
- doParse(response, chain) {
9
- if (this.index == this.parsers.length) {
10
- return response;
11
- }
12
- const parser = this.parsers[this.index];
13
- this.index++;
14
- return parser.parse(response, chain);
2
+ parsers;
3
+ index;
4
+ constructor(parsers) {
5
+ this.parsers = parsers ? parsers : [];
6
+ this.index = 0;
7
+ }
8
+ doParse(response, chain) {
9
+ if (this.index == this.parsers.length) {
10
+ return response;
15
11
  }
12
+ const parser = this.parsers[this.index];
13
+ this.index++;
14
+ return parser.parse(response, chain);
15
+ }
16
16
  }
17
17
 
18
18
  export { ResponseParserChain as default };
@@ -1,60 +1,52 @@
1
1
  import dayjs from 'dayjs';
2
2
 
3
3
  class DateSerializer {
4
- format;
5
- constructor(format = 'YYYY-MM-DD HH:mm:ss.SSS') {
6
- this.format = format;
7
- }
8
- serialize(data) {
9
- const format = this.format;
10
- function objTransfer(data) {
11
- const result = {};
12
- Object.keys(data).forEach((key) => {
13
- const value = data[key];
14
- if (value instanceof Date || dayjs.isDayjs(value)) {
15
- result[key] = dayjs(value).format(format);
16
- }
17
- else if (value && value instanceof Object && !Array.isArray(value)) {
18
- result[key] = objTransfer(value);
19
- }
20
- else if (value && Array.isArray(value)) {
21
- result[key] = arrayTransfer(value);
22
- }
23
- else {
24
- result[key] = value;
25
- }
26
- });
27
- return result;
4
+ format;
5
+ constructor(format = 'YYYY-MM-DD HH:mm:ss.SSS') {
6
+ this.format = format;
7
+ }
8
+ serialize(data) {
9
+ const format = this.format;
10
+ function objTransfer(data) {
11
+ const result = {};
12
+ Object.keys(data).forEach(key => {
13
+ const value = data[key];
14
+ if (value instanceof Date || dayjs.isDayjs(value)) {
15
+ result[key] = dayjs(value).format(format);
16
+ } else if (value && value instanceof Object && !Array.isArray(value)) {
17
+ result[key] = objTransfer(value);
18
+ } else if (value && Array.isArray(value)) {
19
+ result[key] = arrayTransfer(value);
20
+ } else {
21
+ result[key] = value;
28
22
  }
29
- function arrayTransfer(data) {
30
- return data.map((value) => {
31
- if (value instanceof Date || dayjs.isDayjs(value)) {
32
- return dayjs(value).format(format);
33
- }
34
- else if (value && value instanceof Object && !Array.isArray(value)) {
35
- return objTransfer(value);
36
- }
37
- else if (value && Array.isArray(value)) {
38
- return arrayTransfer(value);
39
- }
40
- else {
41
- return value;
42
- }
43
- });
23
+ });
24
+ return result;
25
+ }
26
+ function arrayTransfer(data) {
27
+ return data.map(value => {
28
+ if (value instanceof Date || dayjs.isDayjs(value)) {
29
+ return dayjs(value).format(format);
30
+ } else if (value && value instanceof Object && !Array.isArray(value)) {
31
+ return objTransfer(value);
32
+ } else if (value && Array.isArray(value)) {
33
+ return arrayTransfer(value);
34
+ } else {
35
+ return value;
44
36
  }
45
- Object.keys(data).forEach((key) => {
46
- const value = data[key];
47
- if (value instanceof Date || dayjs.isDayjs(value)) {
48
- data[key] = dayjs(value).format(this.format);
49
- }
50
- else if (value && typeof value == 'object' && !Array.isArray(value)) {
51
- data[key] = objTransfer(value);
52
- }
53
- else if (value && Array.isArray(value)) {
54
- data[key] = arrayTransfer(value);
55
- }
56
- });
37
+ });
57
38
  }
39
+ Object.keys(data).forEach(key => {
40
+ const value = data[key];
41
+ if (value instanceof Date || dayjs.isDayjs(value)) {
42
+ data[key] = dayjs(value).format(this.format);
43
+ } else if (value && typeof value == 'object' && !Array.isArray(value)) {
44
+ data[key] = objTransfer(value);
45
+ } else if (value && Array.isArray(value)) {
46
+ data[key] = arrayTransfer(value);
47
+ }
48
+ });
49
+ }
58
50
  }
59
51
 
60
52
  export { DateSerializer as default };