@allahjs/utils 1.10.0 → 1.12.0

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 (88) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/core/arrayUtils/index.cjs +327 -3
  3. package/dist/core/arrayUtils/index.cjs.map +1 -1
  4. package/dist/core/arrayUtils/index.d.ts +137 -3
  5. package/dist/core/constants/asyncTaskScheduleVo.d.ts +1 -1
  6. package/dist/core/constants/comm.cjs +8 -8
  7. package/dist/core/constants/comm.cjs.map +1 -1
  8. package/dist/core/constants/comm.d.ts +4 -4
  9. package/dist/core/constants/index.cjs +2 -2
  10. package/dist/core/constants/index.d.ts +1 -1
  11. package/dist/core/diffUtils/index.cjs +219 -0
  12. package/dist/core/diffUtils/index.cjs.map +1 -0
  13. package/dist/core/diffUtils/index.d.ts +32 -0
  14. package/dist/core/fileUtils/index.cjs +21 -0
  15. package/dist/core/fileUtils/index.cjs.map +1 -0
  16. package/dist/core/fileUtils/index.d.ts +10 -0
  17. package/dist/core/index.cjs +20 -10
  18. package/dist/core/index.cjs.map +1 -1
  19. package/dist/core/index.d.ts +69 -1
  20. package/dist/core/pageUtils/index.cjs +21 -1
  21. package/dist/core/pageUtils/index.cjs.map +1 -1
  22. package/dist/core/pageUtils/index.d.ts +1 -0
  23. package/dist/esm/core/arrayUtils/index.d.ts +137 -3
  24. package/dist/esm/core/arrayUtils/index.js +327 -3
  25. package/dist/esm/core/arrayUtils/index.js.map +1 -1
  26. package/dist/esm/core/constants/asyncTaskScheduleVo.d.ts +1 -1
  27. package/dist/esm/core/constants/comm.d.ts +4 -4
  28. package/dist/esm/core/constants/comm.js +9 -9
  29. package/dist/esm/core/constants/comm.js.map +1 -1
  30. package/dist/esm/core/constants/index.d.ts +1 -1
  31. package/dist/esm/core/constants/index.js +1 -1
  32. package/dist/esm/core/diffUtils/index.d.ts +32 -0
  33. package/dist/esm/core/diffUtils/index.js +215 -0
  34. package/dist/esm/core/diffUtils/index.js.map +1 -0
  35. package/dist/esm/core/fileUtils/index.d.ts +10 -0
  36. package/dist/esm/core/fileUtils/index.js +16 -0
  37. package/dist/esm/core/fileUtils/index.js.map +1 -0
  38. package/dist/esm/core/index.d.ts +69 -1
  39. package/dist/esm/core/index.js +10 -0
  40. package/dist/esm/core/index.js.map +1 -1
  41. package/dist/esm/core/pageUtils/index.d.ts +1 -0
  42. package/dist/esm/core/pageUtils/index.js +21 -2
  43. package/dist/esm/core/pageUtils/index.js.map +1 -1
  44. package/dist/esm/form/attributes.d.ts +32 -0
  45. package/dist/esm/form/formItem.d.ts +163 -0
  46. package/dist/esm/form/index.d.ts +4 -1
  47. package/dist/esm/form/rule.d.ts +37 -0
  48. package/dist/esm/form/types.d.ts +12 -213
  49. package/dist/esm/index.d.ts +11 -2
  50. package/dist/esm/index.js +5 -0
  51. package/dist/esm/index.js.map +1 -1
  52. package/dist/esm/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js +20 -0
  53. package/dist/esm/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js.map +1 -0
  54. package/dist/esm/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js +256 -0
  55. package/dist/esm/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js.map +1 -0
  56. package/dist/esm/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js +11 -0
  57. package/dist/esm/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js.map +1 -0
  58. package/dist/esm/request/ReqQueue/index.d.ts +25 -0
  59. package/dist/esm/request/httpCode/index.d.ts +9 -0
  60. package/dist/esm/request/index.d.ts +6 -3
  61. package/dist/esm/request/index.js +4 -2
  62. package/dist/esm/request/index.js.map +1 -1
  63. package/dist/esm/request/uniRequest/index.d.ts +5 -0
  64. package/dist/esm/types/dbData/index.d.ts +83 -0
  65. package/dist/esm/types/index.d.ts +1 -0
  66. package/dist/form/attributes.d.ts +32 -0
  67. package/dist/form/formItem.d.ts +163 -0
  68. package/dist/form/index.d.ts +4 -1
  69. package/dist/form/rule.d.ts +37 -0
  70. package/dist/form/types.d.ts +12 -213
  71. package/dist/index.cjs +61 -50
  72. package/dist/index.cjs.map +1 -1
  73. package/dist/index.d.ts +11 -2
  74. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.cjs +23 -0
  75. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.cjs.map +1 -0
  76. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.cjs +260 -0
  77. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.cjs.map +1 -0
  78. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.cjs +14 -0
  79. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.cjs.map +1 -0
  80. package/dist/request/ReqQueue/index.d.ts +25 -0
  81. package/dist/request/httpCode/index.d.ts +9 -0
  82. package/dist/request/index.cjs +25 -20
  83. package/dist/request/index.cjs.map +1 -1
  84. package/dist/request/index.d.ts +6 -3
  85. package/dist/request/uniRequest/index.d.ts +5 -0
  86. package/dist/types/dbData/index.d.ts +83 -0
  87. package/dist/types/index.d.ts +1 -0
  88. package/package.json +28 -5
@@ -0,0 +1,260 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ class Diff {
6
+ diff(oldStr, newStr,
7
+ // Type below is not accurate/complete - see above for full possibilities - but it compiles
8
+ options = {}) {
9
+ let callback;
10
+ if (typeof options === 'function') {
11
+ callback = options;
12
+ options = {};
13
+ }
14
+ else if ('callback' in options) {
15
+ callback = options.callback;
16
+ }
17
+ // Allow subclasses to massage the input prior to running
18
+ const oldString = this.castInput(oldStr, options);
19
+ const newString = this.castInput(newStr, options);
20
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
21
+ const newTokens = this.removeEmpty(this.tokenize(newString, options));
22
+ return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
23
+ }
24
+ diffWithOptionsObj(oldTokens, newTokens, options, callback) {
25
+ var _a;
26
+ const done = (value) => {
27
+ value = this.postProcess(value, options);
28
+ if (callback) {
29
+ setTimeout(function () { callback(value); }, 0);
30
+ return undefined;
31
+ }
32
+ else {
33
+ return value;
34
+ }
35
+ };
36
+ const newLen = newTokens.length, oldLen = oldTokens.length;
37
+ let editLength = 1;
38
+ let maxEditLength = newLen + oldLen;
39
+ if (options.maxEditLength != null) {
40
+ maxEditLength = Math.min(maxEditLength, options.maxEditLength);
41
+ }
42
+ const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
43
+ const abortAfterTimestamp = Date.now() + maxExecutionTime;
44
+ const bestPath = [{ oldPos: -1, lastComponent: undefined }];
45
+ // Seed editLength = 0, i.e. the content starts with the same values
46
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
47
+ if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
48
+ // Identity per the equality and tokenizer
49
+ return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
50
+ }
51
+ // Once we hit the right edge of the edit graph on some diagonal k, we can
52
+ // definitely reach the end of the edit graph in no more than k edits, so
53
+ // there's no point in considering any moves to diagonal k+1 any more (from
54
+ // which we're guaranteed to need at least k+1 more edits).
55
+ // Similarly, once we've reached the bottom of the edit graph, there's no
56
+ // point considering moves to lower diagonals.
57
+ // We record this fact by setting minDiagonalToConsider and
58
+ // maxDiagonalToConsider to some finite value once we've hit the edge of
59
+ // the edit graph.
60
+ // This optimization is not faithful to the original algorithm presented in
61
+ // Myers's paper, which instead pointlessly extends D-paths off the end of
62
+ // the edit graph - see page 7 of Myers's paper which notes this point
63
+ // explicitly and illustrates it with a diagram. This has major performance
64
+ // implications for some common scenarios. For instance, to compute a diff
65
+ // where the new text simply appends d characters on the end of the
66
+ // original text of length n, the true Myers algorithm will take O(n+d^2)
67
+ // time while this optimization needs only O(n+d) time.
68
+ let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
69
+ // Main worker method. checks all permutations of a given edit length for acceptance.
70
+ const execEditLength = () => {
71
+ for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
72
+ let basePath;
73
+ const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
74
+ if (removePath) {
75
+ // No one else is going to attempt to use this value, clear it
76
+ // @ts-expect-error - perf optimisation. This type-violating value will never be read.
77
+ bestPath[diagonalPath - 1] = undefined;
78
+ }
79
+ let canAdd = false;
80
+ if (addPath) {
81
+ // what newPos will be after we do an insertion:
82
+ const addPathNewPos = addPath.oldPos - diagonalPath;
83
+ canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
84
+ }
85
+ const canRemove = removePath && removePath.oldPos + 1 < oldLen;
86
+ if (!canAdd && !canRemove) {
87
+ // If this path is a terminal then prune
88
+ // @ts-expect-error - perf optimisation. This type-violating value will never be read.
89
+ bestPath[diagonalPath] = undefined;
90
+ continue;
91
+ }
92
+ // Select the diagonal that we want to branch from. We select the prior
93
+ // path whose position in the old string is the farthest from the origin
94
+ // and does not pass the bounds of the diff graph
95
+ if (!canRemove || (canAdd && removePath.oldPos < addPath.oldPos)) {
96
+ basePath = this.addToPath(addPath, true, false, 0, options);
97
+ }
98
+ else {
99
+ basePath = this.addToPath(removePath, false, true, 1, options);
100
+ }
101
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
102
+ if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
103
+ // If we have hit the end of both strings, then we are done
104
+ return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
105
+ }
106
+ else {
107
+ bestPath[diagonalPath] = basePath;
108
+ if (basePath.oldPos + 1 >= oldLen) {
109
+ maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
110
+ }
111
+ if (newPos + 1 >= newLen) {
112
+ minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
113
+ }
114
+ }
115
+ }
116
+ editLength++;
117
+ };
118
+ // Performs the length of edit iteration. Is a bit fugly as this has to support the
119
+ // sync and async mode which is never fun. Loops over execEditLength until a value
120
+ // is produced, or until the edit length exceeds options.maxEditLength (if given),
121
+ // in which case it will return undefined.
122
+ if (callback) {
123
+ (function exec() {
124
+ setTimeout(function () {
125
+ if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
126
+ return callback(undefined);
127
+ }
128
+ if (!execEditLength()) {
129
+ exec();
130
+ }
131
+ }, 0);
132
+ }());
133
+ }
134
+ else {
135
+ while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
136
+ const ret = execEditLength();
137
+ if (ret) {
138
+ return ret;
139
+ }
140
+ }
141
+ }
142
+ }
143
+ addToPath(path, added, removed, oldPosInc, options) {
144
+ const last = path.lastComponent;
145
+ if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
146
+ return {
147
+ oldPos: path.oldPos + oldPosInc,
148
+ lastComponent: { count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }
149
+ };
150
+ }
151
+ else {
152
+ return {
153
+ oldPos: path.oldPos + oldPosInc,
154
+ lastComponent: { count: 1, added: added, removed: removed, previousComponent: last }
155
+ };
156
+ }
157
+ }
158
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
159
+ const newLen = newTokens.length, oldLen = oldTokens.length;
160
+ let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
161
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
162
+ newPos++;
163
+ oldPos++;
164
+ commonCount++;
165
+ if (options.oneChangePerToken) {
166
+ basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
167
+ }
168
+ }
169
+ if (commonCount && !options.oneChangePerToken) {
170
+ basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
171
+ }
172
+ basePath.oldPos = oldPos;
173
+ return newPos;
174
+ }
175
+ equals(left, right, options) {
176
+ if (options.comparator) {
177
+ return options.comparator(left, right);
178
+ }
179
+ else {
180
+ return left === right
181
+ || (!!options.ignoreCase && left.toLowerCase() === right.toLowerCase());
182
+ }
183
+ }
184
+ removeEmpty(array) {
185
+ const ret = [];
186
+ for (let i = 0; i < array.length; i++) {
187
+ if (array[i]) {
188
+ ret.push(array[i]);
189
+ }
190
+ }
191
+ return ret;
192
+ }
193
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
194
+ castInput(value, options) {
195
+ return value;
196
+ }
197
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
198
+ tokenize(value, options) {
199
+ return Array.from(value);
200
+ }
201
+ join(chars) {
202
+ // Assumes ValueT is string, which is the case for most subclasses.
203
+ // When it's false, e.g. in diffArrays, this method needs to be overridden (e.g. with a no-op)
204
+ // Yes, the casts are verbose and ugly, because this pattern - of having the base class SORT OF
205
+ // assume tokens and values are strings, but not completely - is weird and janky.
206
+ return chars.join('');
207
+ }
208
+ postProcess(changeObjects,
209
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
210
+ options) {
211
+ return changeObjects;
212
+ }
213
+ get useLongestToken() {
214
+ return false;
215
+ }
216
+ buildValues(lastComponent, newTokens, oldTokens) {
217
+ // First we convert our linked list of components in reverse order to an
218
+ // array in the right order:
219
+ const components = [];
220
+ let nextComponent;
221
+ while (lastComponent) {
222
+ components.push(lastComponent);
223
+ nextComponent = lastComponent.previousComponent;
224
+ delete lastComponent.previousComponent;
225
+ lastComponent = nextComponent;
226
+ }
227
+ components.reverse();
228
+ const componentLen = components.length;
229
+ let componentPos = 0, newPos = 0, oldPos = 0;
230
+ for (; componentPos < componentLen; componentPos++) {
231
+ const component = components[componentPos];
232
+ if (!component.removed) {
233
+ if (!component.added && this.useLongestToken) {
234
+ let value = newTokens.slice(newPos, newPos + component.count);
235
+ value = value.map(function (value, i) {
236
+ const oldValue = oldTokens[oldPos + i];
237
+ return oldValue.length > value.length ? oldValue : value;
238
+ });
239
+ component.value = this.join(value);
240
+ }
241
+ else {
242
+ component.value = this.join(newTokens.slice(newPos, newPos + component.count));
243
+ }
244
+ newPos += component.count;
245
+ // Common case
246
+ if (!component.added) {
247
+ oldPos += component.count;
248
+ }
249
+ }
250
+ else {
251
+ component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
252
+ oldPos += component.count;
253
+ }
254
+ }
255
+ return components;
256
+ }
257
+ }
258
+
259
+ exports.default = Diff;
260
+ //# sourceMappingURL=base.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.cjs","sources":["../../../../../../../../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js"],"sourcesContent":["export default class Diff {\n diff(oldStr, newStr, \n // Type below is not accurate/complete - see above for full possibilities - but it compiles\n options = {}) {\n let callback;\n if (typeof options === 'function') {\n callback = options;\n options = {};\n }\n else if ('callback' in options) {\n callback = options.callback;\n }\n // Allow subclasses to massage the input prior to running\n const oldString = this.castInput(oldStr, options);\n const newString = this.castInput(newStr, options);\n const oldTokens = this.removeEmpty(this.tokenize(oldString, options));\n const newTokens = this.removeEmpty(this.tokenize(newString, options));\n return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);\n }\n diffWithOptionsObj(oldTokens, newTokens, options, callback) {\n var _a;\n const done = (value) => {\n value = this.postProcess(value, options);\n if (callback) {\n setTimeout(function () { callback(value); }, 0);\n return undefined;\n }\n else {\n return value;\n }\n };\n const newLen = newTokens.length, oldLen = oldTokens.length;\n let editLength = 1;\n let maxEditLength = newLen + oldLen;\n if (options.maxEditLength != null) {\n maxEditLength = Math.min(maxEditLength, options.maxEditLength);\n }\n const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;\n const abortAfterTimestamp = Date.now() + maxExecutionTime;\n const bestPath = [{ oldPos: -1, lastComponent: undefined }];\n // Seed editLength = 0, i.e. the content starts with the same values\n let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);\n if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // Identity per the equality and tokenizer\n return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));\n }\n // Once we hit the right edge of the edit graph on some diagonal k, we can\n // definitely reach the end of the edit graph in no more than k edits, so\n // there's no point in considering any moves to diagonal k+1 any more (from\n // which we're guaranteed to need at least k+1 more edits).\n // Similarly, once we've reached the bottom of the edit graph, there's no\n // point considering moves to lower diagonals.\n // We record this fact by setting minDiagonalToConsider and\n // maxDiagonalToConsider to some finite value once we've hit the edge of\n // the edit graph.\n // This optimization is not faithful to the original algorithm presented in\n // Myers's paper, which instead pointlessly extends D-paths off the end of\n // the edit graph - see page 7 of Myers's paper which notes this point\n // explicitly and illustrates it with a diagram. This has major performance\n // implications for some common scenarios. For instance, to compute a diff\n // where the new text simply appends d characters on the end of the\n // original text of length n, the true Myers algorithm will take O(n+d^2)\n // time while this optimization needs only O(n+d) time.\n let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;\n // Main worker method. checks all permutations of a given edit length for acceptance.\n const execEditLength = () => {\n for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {\n let basePath;\n const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];\n if (removePath) {\n // No one else is going to attempt to use this value, clear it\n // @ts-expect-error - perf optimisation. This type-violating value will never be read.\n bestPath[diagonalPath - 1] = undefined;\n }\n let canAdd = false;\n if (addPath) {\n // what newPos will be after we do an insertion:\n const addPathNewPos = addPath.oldPos - diagonalPath;\n canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;\n }\n const canRemove = removePath && removePath.oldPos + 1 < oldLen;\n if (!canAdd && !canRemove) {\n // If this path is a terminal then prune\n // @ts-expect-error - perf optimisation. This type-violating value will never be read.\n bestPath[diagonalPath] = undefined;\n continue;\n }\n // Select the diagonal that we want to branch from. We select the prior\n // path whose position in the old string is the farthest from the origin\n // and does not pass the bounds of the diff graph\n if (!canRemove || (canAdd && removePath.oldPos < addPath.oldPos)) {\n basePath = this.addToPath(addPath, true, false, 0, options);\n }\n else {\n basePath = this.addToPath(removePath, false, true, 1, options);\n }\n newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);\n if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {\n // If we have hit the end of both strings, then we are done\n return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;\n }\n else {\n bestPath[diagonalPath] = basePath;\n if (basePath.oldPos + 1 >= oldLen) {\n maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);\n }\n if (newPos + 1 >= newLen) {\n minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);\n }\n }\n }\n editLength++;\n };\n // Performs the length of edit iteration. Is a bit fugly as this has to support the\n // sync and async mode which is never fun. Loops over execEditLength until a value\n // is produced, or until the edit length exceeds options.maxEditLength (if given),\n // in which case it will return undefined.\n if (callback) {\n (function exec() {\n setTimeout(function () {\n if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {\n return callback(undefined);\n }\n if (!execEditLength()) {\n exec();\n }\n }, 0);\n }());\n }\n else {\n while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {\n const ret = execEditLength();\n if (ret) {\n return ret;\n }\n }\n }\n }\n addToPath(path, added, removed, oldPosInc, options) {\n const last = path.lastComponent;\n if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: { count: last.count + 1, added: added, removed: removed, previousComponent: last.previousComponent }\n };\n }\n else {\n return {\n oldPos: path.oldPos + oldPosInc,\n lastComponent: { count: 1, added: added, removed: removed, previousComponent: last }\n };\n }\n }\n extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {\n const newLen = newTokens.length, oldLen = oldTokens.length;\n let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;\n while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {\n newPos++;\n oldPos++;\n commonCount++;\n if (options.oneChangePerToken) {\n basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };\n }\n }\n if (commonCount && !options.oneChangePerToken) {\n basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };\n }\n basePath.oldPos = oldPos;\n return newPos;\n }\n equals(left, right, options) {\n if (options.comparator) {\n return options.comparator(left, right);\n }\n else {\n return left === right\n || (!!options.ignoreCase && left.toLowerCase() === right.toLowerCase());\n }\n }\n removeEmpty(array) {\n const ret = [];\n for (let i = 0; i < array.length; i++) {\n if (array[i]) {\n ret.push(array[i]);\n }\n }\n return ret;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n castInput(value, options) {\n return value;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n tokenize(value, options) {\n return Array.from(value);\n }\n join(chars) {\n // Assumes ValueT is string, which is the case for most subclasses.\n // When it's false, e.g. in diffArrays, this method needs to be overridden (e.g. with a no-op)\n // Yes, the casts are verbose and ugly, because this pattern - of having the base class SORT OF\n // assume tokens and values are strings, but not completely - is weird and janky.\n return chars.join('');\n }\n postProcess(changeObjects, \n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n options) {\n return changeObjects;\n }\n get useLongestToken() {\n return false;\n }\n buildValues(lastComponent, newTokens, oldTokens) {\n // First we convert our linked list of components in reverse order to an\n // array in the right order:\n const components = [];\n let nextComponent;\n while (lastComponent) {\n components.push(lastComponent);\n nextComponent = lastComponent.previousComponent;\n delete lastComponent.previousComponent;\n lastComponent = nextComponent;\n }\n components.reverse();\n const componentLen = components.length;\n let componentPos = 0, newPos = 0, oldPos = 0;\n for (; componentPos < componentLen; componentPos++) {\n const component = components[componentPos];\n if (!component.removed) {\n if (!component.added && this.useLongestToken) {\n let value = newTokens.slice(newPos, newPos + component.count);\n value = value.map(function (value, i) {\n const oldValue = oldTokens[oldPos + i];\n return oldValue.length > value.length ? oldValue : value;\n });\n component.value = this.join(value);\n }\n else {\n component.value = this.join(newTokens.slice(newPos, newPos + component.count));\n }\n newPos += component.count;\n // Common case\n if (!component.added) {\n oldPos += component.count;\n }\n }\n else {\n component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));\n oldPos += component.count;\n }\n }\n return components;\n }\n}\n"],"names":[],"mappings":";;;;AAAe,MAAM,IAAI,CAAC;AAC1B,IAAI,IAAI,CAAC,MAAM,EAAE,MAAM;AACvB;AACA,IAAI,OAAO,GAAG,EAAE,EAAE;AAClB,QAAQ,IAAI,QAAQ;AACpB,QAAQ,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;AAC3C,YAAY,QAAQ,GAAG,OAAO;AAC9B,YAAY,OAAO,GAAG,EAAE;AACxB,QAAQ;AACR,aAAa,IAAI,UAAU,IAAI,OAAO,EAAE;AACxC,YAAY,QAAQ,GAAG,OAAO,CAAC,QAAQ;AACvC,QAAQ;AACR;AACA,QAAQ,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;AACzD,QAAQ,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;AACzD,QAAQ,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC7E,QAAQ,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC7E,QAAQ,OAAO,IAAI,CAAC,kBAAkB,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,CAAC,GAAG,CAAC,UAAU,KAAK,EAAE,CAAC,EAAE;AAC1D,wBAAwB,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9D,wBAAwB,OAAO,QAAQ,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,QAAQ,GAAG,KAAK;AAChF,oBAAoB,CAAC,CAAC;AACtB,oBAAoB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;AACtD,gBAAgB;AAChB,qBAAqB;AACrB,oBAAoB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AAClG,gBAAgB;AAChB,gBAAgB,MAAM,IAAI,SAAS,CAAC,KAAK;AACzC;AACA,gBAAgB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;AACtC,oBAAoB,MAAM,IAAI,SAAS,CAAC,KAAK;AAC7C,gBAAgB;AAChB,YAAY;AACZ,iBAAiB;AACjB,gBAAgB,SAAS,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9F,gBAAgB,MAAM,IAAI,SAAS,CAAC,KAAK;AACzC,YAAY;AACZ,QAAQ;AACR,QAAQ,OAAO,UAAU;AACzB,IAAI;AACJ;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var base = require('./base.cjs');
4
+
5
+ class CharacterDiff extends base.default {
6
+ }
7
+ const characterDiff = new CharacterDiff();
8
+ function diffChars(oldStr, newStr, options) {
9
+ return characterDiff.diff(oldStr, newStr, options);
10
+ }
11
+
12
+ exports.characterDiff = characterDiff;
13
+ exports.diffChars = diffChars;
14
+ //# sourceMappingURL=character.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"character.cjs","sources":["../../../../../../../../node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js"],"sourcesContent":["import Diff from './base.js';\nclass CharacterDiff extends Diff {\n}\nexport const characterDiff = new CharacterDiff();\nexport function diffChars(oldStr, newStr, options) {\n return characterDiff.diff(oldStr, newStr, options);\n}\n"],"names":["Diff"],"mappings":";;;;AACA,MAAM,aAAa,SAASA,YAAI,CAAC;AACjC;AACY,MAAC,aAAa,GAAG,IAAI,aAAa;AACvC,SAAS,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;AACnD,IAAI,OAAO,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;AACtD;;;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,25 @@
1
+ type IReqQueueInit = {
2
+ maxQueueLength?: number;
3
+ cacheMethod?: (v: Record<string, any>) => void;
4
+ };
5
+ declare class ReqQueue {
6
+ private static instance;
7
+ private static reqQueue;
8
+ private static maxQueueLength;
9
+ private static cacheMethod;
10
+ constructor(p: IReqQueueInit);
11
+ static init(p: IReqQueueInit): ReqQueue;
12
+ static getInstance(p: IReqQueueInit): ReqQueue;
13
+ /**
14
+ * 获取下日志队列
15
+ */
16
+ static getReqQueue(): Record<string, any>;
17
+ /**
18
+ * 添加或者更新一条记录
19
+ * @param data
20
+ * @param key
21
+ */
22
+ static addReqQueue(data: any, key?: string): Promise<void>;
23
+ }
24
+
25
+ export { ReqQueue as default };
@@ -0,0 +1,9 @@
1
+ import { IRequestOption } from '../typings/index.js';
2
+
3
+ /**
4
+ * HTTP编码属性
5
+ */
6
+ declare const codeMessage: any;
7
+ declare const defOption: IRequestOption;
8
+
9
+ export { codeMessage, defOption };
@@ -2,10 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index$3 = require('./httpCode/index.cjs');
6
- var index$2 = require('./httpUtils/index.cjs');
7
- var index$1 = require('./ReqQueue/index.cjs');
8
- var index = require('../core/cryptoUtils/index.cjs');
5
+ var index$1 = require('./httpCode/index.cjs');
6
+ var index$2 = require('./uniRequest/index.cjs');
7
+ var index = require('./ReqQueue/index.cjs');
8
+ var index$4 = require('./httpUtils/index.cjs');
9
+ var index$3 = require('../core/cryptoUtils/index.cjs');
9
10
 
10
11
  /**
11
12
  * 状态码检测
@@ -16,7 +17,7 @@ var index = require('../core/cryptoUtils/index.cjs');
16
17
  const checkStatus = async (response, opt) => {
17
18
  if (opt.cacheLog && !opt.isFile) {
18
19
  // 存储下日志
19
- await index$1.default.addReqQueue(response, opt.reqUuid);
20
+ await index.default.addReqQueue(response, opt.reqUuid);
20
21
  }
21
22
  if (response.status >= 200 && response.status < 300) {
22
23
  // 如果是浏览器,并且没有指定fetch,就返回data
@@ -29,14 +30,14 @@ const checkStatus = async (response, opt) => {
29
30
  return response.json();
30
31
  }
31
32
  // 请求异常
32
- const msg = response.data?.msg || index$3.codeMessage[response.status];
33
+ const msg = response.data?.msg || index$1.codeMessage[response.status];
33
34
  const errorData = {
34
35
  msg: msg,
35
36
  message: msg,
36
37
  url: response.url,
37
38
  status: response.status,
38
39
  code: response.status,
39
- statusText: index$3.codeMessage[response.status],
40
+ statusText: index$1.codeMessage[response.status],
40
41
  response
41
42
  };
42
43
  return Promise.reject(errorData);
@@ -44,14 +45,14 @@ const checkStatus = async (response, opt) => {
44
45
  const binRequest = async (url, option = {}, errorHandler, callback) => {
45
46
  // 判断是否开启了日志
46
47
  if (option.cacheLog) {
47
- option.reqUuid = await index.default.uuid();
48
- index$1.default.init({
48
+ option.reqUuid = await index$3.default.uuid();
49
+ index.default.init({
49
50
  cacheMethod: option.cacheMethod,
50
51
  maxQueueLength: option.maxCacheLog
51
52
  });
52
- await index$1.default.addReqQueue(url, option.reqUuid);
53
+ await index.default.addReqQueue(url, option.reqUuid);
53
54
  // 存储下日志
54
- await index$1.default.addReqQueue(option, option.reqUuid);
55
+ await index.default.addReqQueue(option, option.reqUuid);
55
56
  }
56
57
  // 地址拦截
57
58
  if (url.length === 0) {
@@ -69,7 +70,7 @@ const binRequest = async (url, option = {}, errorHandler, callback) => {
69
70
  return new Promise(resolve => resolve(cacheData.data));
70
71
  }
71
72
  }
72
- const requestUtil = index$2.getRequestUtils(option);
73
+ const requestUtil = index$4.getRequestUtils(option);
73
74
  // 判断是否外部接口
74
75
  if (option.isExternal) {
75
76
  return requestUtil(url, option).then((resJson) => {
@@ -80,7 +81,7 @@ const binRequest = async (url, option = {}, errorHandler, callback) => {
80
81
  });
81
82
  }
82
83
  // 检查参数
83
- const newOptions = index$2.requestErrorIntercept(url, option);
84
+ const newOptions = index$4.requestErrorIntercept(url, option);
84
85
  if (typeof AbortController !== 'undefined') {
85
86
  const controller = new AbortController();
86
87
  newOptions.signal = controller.signal;
@@ -97,7 +98,7 @@ const binRequest = async (url, option = {}, errorHandler, callback) => {
97
98
  headers: newOptions.headers,
98
99
  body: JSON.stringify(newOptions.data)
99
100
  };
100
- const originalFetch = index$2.generateFetchRequest();
101
+ const originalFetch = index$4.generateFetchRequest();
101
102
  const response = await originalFetch(newOptions.url, fetchObj);
102
103
  const decoder = new TextDecoder('utf-8');
103
104
  const encoder = new TextEncoder();
@@ -133,27 +134,27 @@ const binRequest = async (url, option = {}, errorHandler, callback) => {
133
134
  // 先对请求状态码进行检查
134
135
  .then(async (res) => await checkStatus(res, newOptions))
135
136
  // 检查响应数据
136
- .then((resJson) => index$2.responseErrorIntercept(resJson, newOptions, url, callback))
137
+ .then((resJson) => index$4.responseErrorIntercept(resJson, newOptions, url, callback))
137
138
  .catch((e) => {
138
139
  if (e.code === 'ECONNABORTED' || e.code === 20) {
139
140
  e = {
140
141
  ...e,
141
142
  code: 20,
142
- meg: index$3.codeMessage[20],
143
- message: index$3.codeMessage[20]
143
+ meg: index$1.codeMessage[20],
144
+ message: index$1.codeMessage[20]
144
145
  };
145
146
  }
146
147
  if (e.code === 'transitional' || e.message === 'Failed to fetch') {
147
148
  e = {
148
149
  ...e,
149
150
  code: 'transitional',
150
- meg: index$3.codeMessage['transitional'],
151
- message: index$3.codeMessage['transitional']
151
+ meg: index$1.codeMessage['transitional'],
152
+ message: index$1.codeMessage['transitional']
152
153
  };
153
154
  }
154
155
  if (option.cacheLog) {
155
156
  // 存储下日志
156
- index$1.default.addReqQueue(e, option.reqUuid);
157
+ index.default.addReqQueue(e, option.reqUuid);
157
158
  }
158
159
  if (errorHandler) {
159
160
  errorHandler(e, newOptions);
@@ -166,5 +167,9 @@ const binRequest = async (url, option = {}, errorHandler, callback) => {
166
167
  }));
167
168
  };
168
169
 
170
+ exports.codeMessage = index$1.codeMessage;
171
+ exports.defOption = index$1.defOption;
172
+ exports.uniRequest = index$2.default;
173
+ exports.ReqQueue = index.default;
169
174
  exports.default = binRequest;
170
175
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/request/index.ts"],"sourcesContent":[null],"names":["ReqQueue","codeMessage","cryptoUtils","getRequestUtils","requestErrorIntercept","generateFetchRequest","responseErrorIntercept"],"mappings":";;;;;;;;;AAOA;;;;;AAKG;AACH,MAAM,WAAW,GAAG,OAAO,QAAa,EAAE,GAAmB,KAAI;IAC/D,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;;QAE/B,MAAMA,eAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACnD;AACA,IAAA,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE;;AAEnD,QAAA,IAAI,GAAG,CAAC,MAAM,KAAK,OAAO,EAAE;AAC1B,YAAA,OAAO,QAAQ,CAAC,IAAI,EAAE;QACxB;AACA,QAAA,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE;YACvB,OAAO,QAAQ,CAAC,IAAI;QACtB;AACA,QAAA,OAAO,QAAQ,C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IAC1B,CAAC,CAAC;AAER;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/request/index.ts"],"sourcesContent":[null],"names":["ReqQueue","codeMessage","cryptoUtils","getRequestUtils","requestErrorIntercept","generateFetchRequest","responseErrorIntercept"],"mappings":";;;;;;;;;;AAUA;;;;;AAKG;AACH,MAAM,WAAW,GAAG,OAAO,QAAa,EAAE,GAAmB,KAAI;IAC/D,IAAI,GAAG,CAAC,QAAQ,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;;QAE/B,MAAMA,aAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,OAAO,CAAC;IACnD;AACA,IAAA,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,EAAE;;AAEnD,QAAA,IAAI,GAAG,CAAC,MAAM,KAAK,OAAO,EAAE;AAC1B,YAAA,OAAO,QAAQ,CAAC,IAAI,EAAE;QACxB;AACA,QAAA,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,EAAE;YACvB,OAAO,QAAQ,CAAC,IAAI;QACtB;AACA,QAAA,OAAO,QAAQ,CAAC,IAAI,EAAE;IACxB;;AAEA,IAAA,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,IAAIC,mBAAW,CAAC,QAAQ,CAAC,MAAM,CAAC;AAC9D,IAAA,MAAM,SAAS,GAAG;AAChB,QAAA,GAAG,EAAE,GAAG;AACR,QAAA,OAAO,EAAE,GAAG;QACZ,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,QAAQ,CAAC,MAAM;AACrB,QAAA,UAAU,EAAEA,mBAAW,CAAC,QAAQ,CAAC,MAAM,CAAC;QACxC;KACD;AACD,IAAA,OAAO,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC;AAClC,CAAC;AAYD,MAAM,UAAU,GAAG,OACjB,GAAW,EACX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A,mBAAW,CAAC,EAAE;aACxB;QACH;AACA,QAAA,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC,CAAC,OAAO,KAAK,iBAAiB,EAAE;AAChE,YAAA,CAAC,GAAG;AACF,gBAAA,GAAG,CAAC;AACJ,gBAAA,IAAI,EAAE,cAAc;AACpB,gBAAA,GAAG,EAAEA,mBAAW,CAAC,cAAc,CAAC;AAChC,gBAAA,OAAO,EAAEA,mBAAW,CAAC,cAAc;aACpC;QACH;AACA,QAAA,IAAI,MAAM,CAAC,QAAQ,EAAE;;YAEnBD,aAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;QACzC;QACA,IAAI,YAAY,EAAE;AAChB,YAAA,YAAY,CAAC,CAAC,EAAE,UAAU,CAAC;AAC3B,YAAA,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE;AAC7B,gBAAA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;YAC1B;AACA,YAAA,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE;QACpB;AACA,QAAA,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1B,CAAC,CAAC;AAER;;;;;;;;"}
@@ -1,7 +1,10 @@
1
+ export { codeMessage, defOption } from './httpCode/index.js';
1
2
  import { IRequestOption, ICallBack } from './typings/index.js';
2
3
  export { ICacheData } from './typings/index.js';
4
+ export { default as uniRequest } from './uniRequest/index.js';
5
+ export { default as ReqQueue } from './ReqQueue/index.js';
3
6
 
4
- type IZlResponse = {
7
+ type IResponse = {
5
8
  code: number;
6
9
  msg: string;
7
10
  message: string;
@@ -10,7 +13,7 @@ type IZlResponse = {
10
13
  status: number;
11
14
  statusText: string;
12
15
  };
13
- declare const binRequest: (url: string, option?: IRequestOption, errorHandler?: (error: IZlResponse, opt: IRequestOption) => void, callback?: ICallBack) => Promise<any>;
16
+ declare const binRequest: (url: string, option?: IRequestOption, errorHandler?: (error: IResponse, opt: IRequestOption) => void, callback?: ICallBack) => Promise<any>;
14
17
 
15
18
  export { ICallBack, IRequestOption, binRequest as default };
16
- export type { IZlResponse };
19
+ export type { IResponse };
@@ -0,0 +1,5 @@
1
+ import * as axios from 'axios';
2
+
3
+ declare const uniRequest: axios.AxiosInstance;
4
+
5
+ export { uniRequest as default };
@@ -0,0 +1,83 @@
1
+ import { IBaseFilter } from '../data/index.js';
2
+
3
+ interface ISysDistrict {
4
+ distId: string;
5
+ /**
6
+ * 编码
7
+ */
8
+ code: string;
9
+ /**
10
+ * 父编码
11
+ */
12
+ parentCode: string;
13
+ /**
14
+ * 节点类型
15
+ */
16
+ nodeType: string;
17
+ /**
18
+ * 地区名称
19
+ */
20
+ disName: string;
21
+ /**
22
+ * 地区编码
23
+ */
24
+ areaCode: string;
25
+ /**
26
+ * 备注
27
+ */
28
+ remark: string;
29
+ /**
30
+ * 地区类型
31
+ */
32
+ disType: string;
33
+ /**
34
+ * 排序号
35
+ */
36
+ sequenceNo: number;
37
+ /**
38
+ * 创建人
39
+ */
40
+ createBy: string;
41
+ /**
42
+ * 创建时间
43
+ */
44
+ createAt: number;
45
+ /**
46
+ * 拼音名称
47
+ */
48
+ spellName: string;
49
+ /**
50
+ * 创建时间
51
+ */
52
+ updateAt: number;
53
+ /**
54
+ * 更新人
55
+ */
56
+ updateBy: string;
57
+ /**
58
+ * 其他属性
59
+ */
60
+ otherProperty: string;
61
+ }
62
+ interface ISysDisFilter extends IBaseFilter {
63
+ parentCode?: string;
64
+ /**
65
+ * 地区类型
66
+ */
67
+ disType?: string;
68
+ /**
69
+ * 其他属性
70
+ */
71
+ otherProperty?: string;
72
+ /**
73
+ * 搜索方式
74
+ */
75
+ searchType?: 'all' | '';
76
+ /**
77
+ * 地区编码
78
+ */
79
+ areaCode?: string;
80
+ areaCodes?: string[];
81
+ }
82
+
83
+ export type { ISysDisFilter, ISysDistrict };
@@ -1 +1,2 @@
1
1
  export { IBaseFilter, IOptions, IOptions2, IOptions61, ITreeNode, IValidityNum, IWaterInfo, IWaterLives, defBaseFilter } from './data/index.js';
2
+ export { ISysDisFilter, ISysDistrict } from './dbData/index.js';