datafolder 1.0.19 → 1.0.21

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.
package/src/QyDir.js CHANGED
@@ -6,8 +6,8 @@ import {
6
6
  getSubdirMapKey as i,
7
7
  getFileMapKey as t,
8
8
  SpecialFilePaths as r,
9
- isString as d,
10
- getNowTime as l
9
+ isString as h,
10
+ getNowTime as n
11
11
  } from "./QyUtils.js";
12
12
 
13
13
  import {
@@ -20,7 +20,7 @@ import {
20
20
 
21
21
  let s = r.HiddenFolderName;
22
22
 
23
- class u extends e {
23
+ class d extends e {
24
24
  _subdirCount = 0;
25
25
  _fileCount = 0;
26
26
  subdirMapChangeCount = 0;
@@ -43,7 +43,7 @@ class u extends e {
43
43
  return f(this), this._fileCount;
44
44
  }
45
45
  get subdirCount() {
46
- return n(this), this._subdirCount;
46
+ return l(this), this._subdirCount;
47
47
  }
48
48
  get isDir() {
49
49
  return !0;
@@ -61,7 +61,7 @@ class u extends e {
61
61
  return this._fileMapKey || (this._fileMapKey = t(this.fullPathHash));
62
62
  }
63
63
  get subdirMap() {
64
- return n(this), this._subdirMap;
64
+ return l(this), this._subdirMap;
65
65
  }
66
66
  get fileMap() {
67
67
  return f(this), this._fileMap;
@@ -84,7 +84,7 @@ class u extends e {
84
84
  if ("/" === e) return this.qyCache?.rootDir || this;
85
85
  let t = this.subdirMap;
86
86
  var r = (t = t || (this._subdirMap = {}))[e];
87
- return r || (r = t[e] = new u(e, i, this), this.setChildTriggerNodes(r)),
87
+ return r || (r = t[e] = new d(e, i, this), this.setChildTriggerNodes(r)),
88
88
  r;
89
89
  }
90
90
  getOrCreateFile(e, i = !1) {
@@ -117,28 +117,28 @@ class u extends e {
117
117
  return this.searchOrCreateSubdir(e, i, e.length - 1).getOrCreateFile(e.at(-1), i);
118
118
  }
119
119
  get subdirList() {
120
- return h(this, "_subdirList", this.subdirMapChangeCount, () => this.created && this.subdirMap ? Object.values(this.subdirMap).filter(e => e.created) : []);
120
+ return u(this, "_subdirList", this.subdirMapChangeCount, () => this.created && this.subdirMap ? Object.values(this.subdirMap).filter(e => e.created) : []);
121
121
  }
122
122
  get subdirNameList() {
123
- return h(this, "_subdirNameList", this.subdirMapChangeCount, () => this.subdirList.map(e => e.name));
123
+ return u(this, "_subdirNameList", this.subdirMapChangeCount, () => this.subdirList.map(e => e.name));
124
124
  }
125
125
  get sortedSubdirList() {
126
- return h(this, "_sortedSubdirList", this.subdirMapChangeCount, () => this.subdirList.sort((e, i) => e.cmp(i)));
126
+ return u(this, "_sortedSubdirList", this.subdirMapChangeCount, () => this.subdirList.sort((e, i) => e.cmp(i)));
127
127
  }
128
128
  get sortedSubdirNameList() {
129
- return h(this, "_sortedSubdirNameList", this.subdirMapChangeCount, () => this.sortedSubdirList.map(e => e.nameNum));
129
+ return u(this, "_sortedSubdirNameList", this.subdirMapChangeCount, () => this.sortedSubdirList.map(e => e.nameNum));
130
130
  }
131
131
  get fileList() {
132
- return h(this, "_fileList", this.fileMapChangeCount, () => this.created && this.fileMap ? Object.values(this.fileMap).filter(e => e.created) : []);
132
+ return u(this, "_fileList", this.fileMapChangeCount, () => this.created && this.fileMap ? Object.values(this.fileMap).filter(e => e.created) : []);
133
133
  }
134
134
  get fileNameList() {
135
- return h(this, "_fileNameList", this.fileMapChangeCount, () => this.fileList.map(e => e.name));
135
+ return u(this, "_fileNameList", this.fileMapChangeCount, () => this.fileList.map(e => e.name));
136
136
  }
137
137
  get sortedFileList() {
138
- return h(this, "_sortedFileList", this.fileMapChangeCount, () => this.fileList.sort((e, i) => e.cmp(i)));
138
+ return u(this, "_sortedFileList", this.fileMapChangeCount, () => this.fileList.sort((e, i) => e.cmp(i)));
139
139
  }
140
140
  get sortedFileNameList() {
141
- return h(this, "_sortedFileNameList", this.fileMapChangeCount, () => this.sortedFileList.map(e => e.nameNum));
141
+ return u(this, "_sortedFileNameList", this.fileMapChangeCount, () => this.sortedFileList.map(e => e.nameNum));
142
142
  }
143
143
  *allSubdirs() {
144
144
  var e, i, t = this.subdirList;
@@ -172,24 +172,18 @@ class u extends e {
172
172
  *filterSubdirNames(e) {
173
173
  for (var i of this.subdirList) e(i.name) && (yield i);
174
174
  }
175
- *compareSubdirRangeL2H(e) {
176
- var i, t = this.sortedSubdirList;
177
- let r = !1;
178
- for (i of t) {
179
- var s = i.nameNum;
180
- if (d(s)) {
181
- if (r) return;
182
- } else if (e(s)) yield i, r = !0; else if (r) return;
183
- }
184
- }
185
- *compareSubdirRangeH2L(i) {
186
- var t = this.sortedSubdirList;
187
- let r = !1;
188
- for (let e = t.length - 1; 0 <= e; --e) {
189
- var s = t[e], a = s.nameNum;
190
- if (d(a)) {
191
- if (r) return;
192
- } else if (i(a)) yield s, r = !0; else if (r) return;
175
+ *filterFileNames(e) {
176
+ for (var i of this.fileList) e(i.name) && (yield i);
177
+ }
178
+ *compareItemRange(i, e = !1, t = !1) {
179
+ var r = e ? this.sortedFileList : this.sortedSubdirList;
180
+ let s = !1;
181
+ var a = r.length;
182
+ for (let e = t ? a - 1 : 0; t ? 0 <= e : e < a; t ? --e : ++e) {
183
+ var d = r[e], u = d.nameNum;
184
+ if (h(u)) {
185
+ if (s) return;
186
+ } else if (i(u)) yield d, s = !0; else if (s) return;
193
187
  }
194
188
  }
195
189
  ensureAllLoaded() {
@@ -198,12 +192,12 @@ class u extends e {
198
192
  }
199
193
  }
200
194
 
201
- function h(e, i, t, r) {
195
+ function u(e, i, t, r) {
202
196
  var e = e.cache, s = i + "ChangeCount";
203
197
  return e[i] && e[s] == t || (e[i] = r(), e[s] = t), e[i];
204
198
  }
205
199
 
206
- function n(e) {
200
+ function l(e) {
207
201
  if (e.created && !e.subdirMapLoaded) {
208
202
  e.subdirMapLoaded = !0;
209
203
  var i = e.qyCache;
@@ -211,7 +205,7 @@ function n(e) {
211
205
  var t = i.qyKVData.getValueSync(e.subdirMapKey);
212
206
  if (t) {
213
207
  var r, s = e._subdirMap || (e._subdirMap = {});
214
- for (r in t) r in s || (s[r] = new u(r, !0, e));
208
+ for (r in t) r in s || (s[r] = new d(r, !0, e));
215
209
  e.underHiddenFolder || p(e, i, "d");
216
210
  }
217
211
  }
@@ -243,14 +237,14 @@ function p(e, i, t) {
243
237
  }
244
238
  var r = i.getExpireInfoFile(e.fullPathHash, t);
245
239
  if (r) {
246
- var s, a = r.fileContent, d = l(), u = i.qyDB;
240
+ var s, a = r.fileContent, d = n(), u = i.qyDB;
247
241
  for (s in a) {
248
- var h = "d" == t ? e.getOrCreateSubdir(s) : e.getOrCreateFile(s), n = a[s];
249
- n <= d ? o(u, h) : i.monitorItemExpire(h, n);
242
+ var h = "d" == t ? e.getOrCreateSubdir(s) : e.getOrCreateFile(s), l = a[s];
243
+ l <= d ? o(u, h) : i.monitorItemExpire(h, l);
250
244
  }
251
245
  }
252
246
  }
253
247
 
254
248
  export {
255
- u as QyDir
249
+ d as QyDir
256
250
  };
package/src/QyIndex.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare function getIndexPropPaths(queryObj: any): any[] | undefined;
2
- export declare function calDifferenceList(indexPropDir: any, indexPropPath: any, fileName: any, oldValue: any, newValue: any, rawContent: any): {
2
+ export declare function calDifferenceList(indexPropDir: any, indexPropPath: any, oldValue: any, newValue: any, rawContent: any): {
3
3
  toAddFileList: any[];
4
4
  toDelFileList: any[];
5
5
  } | undefined;
package/src/QyIndex.js CHANGED
@@ -5,14 +5,14 @@ import {
5
5
  isString as s,
6
6
  isNotNullObj as c,
7
7
  SpecialOperators as i,
8
- getSuffix as p,
8
+ getSuffix as m,
9
9
  fromSingleName as r,
10
- toSingleName as o,
10
+ toSingleName as u,
11
11
  isArray as v
12
12
  } from "./QyUtils.js";
13
13
 
14
14
  import {
15
- getValByNamePath as m
15
+ getValByNamePath as p
16
16
  } from "./QyFileContentUtils.js";
17
17
 
18
18
  import {
@@ -20,83 +20,83 @@ import {
20
20
  } from "./QyUnionNode.js";
21
21
 
22
22
  import {
23
- QyIntersectNode as b
23
+ QyIntersectNode as h
24
24
  } from "./QyIntersectNode.js";
25
25
 
26
26
  import {
27
- logger as S
27
+ logger as N
28
28
  } from "./QyLogger.js";
29
29
 
30
30
  let {
31
- $or: h,
32
- $and: N
33
- } = i, $ = new y(), l = [];
31
+ $or: $,
32
+ $and: F
33
+ } = i, I = new y(), o = [];
34
34
 
35
35
  function e(e) {
36
36
  if (null != e && !s(e)) return function r(i, n, t, l) {
37
- if (C(i)) 0 < t.length && (n[o(t)] = 1); else {
38
- let e = i[h] || i[N];
37
+ if (Q(i)) 0 < t.length && (n[u(t)] = 1); else {
38
+ let e = i[$] || i[F];
39
39
  if (null != e) if (v(e)) for (var f of e) r(f, n, t, l), t.length = l; else r(e, n, t, l),
40
- t.length = l; else for (var u in i) t.push(u), r(i[u], n, t, l + 1),
40
+ t.length = l; else for (var o in i) t.push(o), r(i[o], n, t, l + 1),
41
41
  t.length = l;
42
42
  }
43
43
  }(e, e = {}, [], 0), Object.keys(e).map(e => r(e));
44
44
  }
45
45
 
46
- function n(e, r, i, n, t, l) {
47
- n = m(n, r), t = m(t, r);
48
- if (n !== t) {
49
- var f, u, o, a, l = v(t) || v(m(l, r)), s = Object.fromEntries(Q(n, l).map(e => [ JSON.stringify(e), e ])), d = Object.fromEntries(Q(t, l).map(e => [ JSON.stringify(e), e ])), g = [], c = [];
50
- for (f in s) d[f] || (u = s[f], (u = e.searchSubdir(u)) && (u = u.getFile(i)) && c.push(u));
51
- for (o in d) s[o] || (a = d[o], a = e.searchOrCreateSubdir(a), g.push(a.getOrCreateFile(i)));
46
+ function n(e, r, i, n, t) {
47
+ i = p(i, r), n = p(n, r);
48
+ if (i !== n) {
49
+ var l, f, o, u, t = v(n) || v(p(t, r)), a = Object.fromEntries(L(i, t).map(e => [ JSON.stringify(e), e ])), s = Object.fromEntries(L(n, t).map(e => [ JSON.stringify(e), e ])), d = [], g = [];
50
+ for (l in a) !s[l] && (f = a[l], f = e.searchFile(f)) && g.push(f);
51
+ for (o in s) a[o] || (u = s[o], d.push(e.searchOrCreateFile(u)));
52
52
  return {
53
- toAddFileList: g,
54
- toDelFileList: c
53
+ toAddFileList: d,
54
+ toDelFileList: g
55
55
  };
56
56
  }
57
57
  }
58
58
 
59
- function F(e, r, i, n, t, l) {
60
- if (s(n) || c(n)) if (e.isDir) O(e, i, n, t, l); else {
59
+ function S(e, r, i, n, t, l) {
60
+ if (s(n) || c(n)) if (e.isDir) j(e, i, n, t, l); else {
61
61
  var f = e.$or;
62
62
  if (f) {
63
- for (var u of f) if (F(u, r, i, n, t, l), l?.isFull) return;
64
- } else for (var o of L(e = s(e) ? a(e) : e, r)) if (O(o, i, n, t, l), l?.isFull) return;
63
+ for (var o of f) if (S(o, r, i, n, t, l), l?.isFull) return;
64
+ } else for (var u of b(e = s(e) ? a(e) : e, r)) if (j(u, i, n, t, l), l?.isFull) return;
65
65
  }
66
66
  }
67
67
 
68
- function* L(e, r, i = 0) {
68
+ function* b(e, r, i = 0) {
69
69
  i == e.length ? yield r : yield* function* r(i, n, t, l) {
70
70
  if (null == n) return;
71
71
  if ("**" == n) {
72
72
  t.isHiddenFolder || (yield t);
73
73
  for (var e of t.allSubdirs()) yield e;
74
- } else if ("*" == n) for (var f of t.subdirList) yield* L(i, f, l + 1); else if (g(n)) for (var u of t.filterSubdirNames(n)) yield* L(i, u, l + 1); else if (v(n)) for (var o of n) yield* r(i, o, t, l); else {
74
+ } else if ("*" == n) for (var f of t.subdirList) yield* b(i, f, l + 1); else if (g(n)) for (var o of t.filterSubdirNames(n)) yield* b(i, o, l + 1); else if (v(n)) for (var u of n) yield* r(i, u, t, l); else {
75
75
  let e = n.$or || n.$in;
76
- if (v(e)) for (var a of e) yield* r(i, a, t, l); else if (H(n)) for (var s of R(t, n)) yield* L(i, s, l + 1); else {
76
+ if (v(e)) for (var a of e) yield* r(i, a, t, l); else if (C(n)) for (var s of w(t, n)) yield* b(i, s, l + 1); else {
77
77
  let e = t.getSubdir(n);
78
- e && (yield* L(i, e, l + 1));
78
+ e && (yield* b(i, e, l + 1));
79
79
  }
80
80
  }
81
81
  }(e, e[i], r, i);
82
82
  }
83
83
 
84
- function O(r, i, n, t, l) {
84
+ function j(r, i, n, t, l) {
85
85
  var f = r.fileCount;
86
86
  if (!(f <= 0)) {
87
87
  let e = 0;
88
88
  if (s(n)) {
89
- var u = r.getFile(n);
90
- u && l.countOne() && (t.push(u), ++e);
89
+ var o = r.getFile(n);
90
+ o && l.countOne() && (t.push(o), ++e);
91
91
  } else {
92
- var o, u = r.qyCache, i = (0 < i?.length && u.qyDB.createIndex(r, i),
93
- u.getIndexDir(r));
92
+ var u, o = r.qyCache, i = (0 < i?.length && o.qyDB.createIndex(r, i),
93
+ o.getIndexDir(r));
94
94
  if (!i) return;
95
- for (o of function i(n, e) {
96
- if (null == e) return $;
97
- if (d(e)) return new y(n.getSubdir(e));
98
- if (g(e)) return j(n.filterSubdirNames(e));
99
- if (H(e)) return j(R(n, e));
95
+ for (u of function i(n, e) {
96
+ if (null == e) return I;
97
+ if (d(e)) return new y(n.getFile(e));
98
+ if (g(e)) return R(n.filterFileNames(e));
99
+ if (C(e)) return R(w(n, e, !0));
100
100
  let {
101
101
  $link: t,
102
102
  $spec: l
@@ -104,74 +104,75 @@ function O(r, i, n, t, l) {
104
104
  if (null != t) {
105
105
  let e = new y(), {
106
106
  qyCache: r,
107
- subdirList: i
107
+ fileList: i
108
108
  } = n;
109
- for (var f of i) D(r, t, f.name, l) && e.addDir(f);
109
+ for (var f of i) D(r, t, f.name, l) && e.addItem(f);
110
110
  return e;
111
111
  }
112
- let u = new b();
113
- if (v(e)) for (var r of e) u.addNode(i(n, r)); else for (var o in e) {
114
- let r = e[o];
115
- if (o == h) if (v(r)) {
112
+ let o = new h();
113
+ if (v(e)) for (var r of e) o.addNode(i(n, r)); else for (var u in e) {
114
+ let r = e[u];
115
+ if (u == $) if (v(r)) {
116
116
  let e = new y();
117
117
  for (var a of r) e.addNode(i(n, a));
118
- u.addNode(e);
119
- } else u.addNode(i(n, r)); else if (o == N) if (v(r)) for (var s of r) u.addNode(i(n, s)); else u.addNode(i(n, r)); else {
120
- let e = n.getSubdir(o);
121
- if (null == e) return $;
122
- u.addNode(i(e, r));
118
+ o.addNode(e);
119
+ } else o.addNode(i(n, r)); else if (u == F) if (v(r)) for (var s of r) o.addNode(i(n, s)); else o.addNode(i(n, r)); else {
120
+ let e = n.getSubdir(u);
121
+ if (null == e) return I;
122
+ o.addNode(i(e, r));
123
123
  }
124
124
  }
125
- return u;
126
- }(i, n).getFiles(l)) t.push(r.getFile(o)), ++e;
125
+ return o;
126
+ }(i, n).getFiles(l)) t.push(r.getFile(u)), ++e;
127
127
  }
128
- S.info(`Checking ${f} file${p(f)}, result: ${e} file` + p(e));
128
+ N.info(`Checking ${f} file${m(f)}, result: ${e} file` + m(e));
129
129
  }
130
130
  }
131
131
 
132
- function u(e) {
132
+ function O(e) {
133
133
  var r = typeof e;
134
134
  return "number" == r || "boolean" == r || "string" == r && !(e in i);
135
135
  }
136
136
 
137
- function j(e) {
138
- if (0 == e.length) return $;
137
+ function R(e) {
138
+ if (0 == e.length) return I;
139
139
  var r, i = new y();
140
- for (r of e) i.addDir(r);
140
+ for (r of e) i.addItem(r);
141
141
  return i;
142
142
  }
143
143
 
144
- function H(e) {
144
+ function C(e) {
145
145
  return null != e && null != (e.$gt ?? e.$lt ?? e.$gte ?? e.$lte);
146
146
  }
147
147
 
148
- function C(e) {
149
- return null == e || d(e) || g(e) || H(e);
148
+ function Q(e) {
149
+ return null == e || d(e) || g(e) || C(e);
150
150
  }
151
151
 
152
- function R(e, {
152
+ function w(e, {
153
153
  $gt: r,
154
154
  $gte: i,
155
155
  $lte: n,
156
156
  $lt: t
157
- }) {
157
+ }, l = !1) {
158
158
  if (null != r && null != i && (i <= r ? i = void 0 : r = void 0), null != t && null != n && (t <= n ? n = void 0 : t = void 0),
159
159
  null != r) if (null != t) {
160
- if (r < t) return e.compareSubdirRangeL2H(e => r < e && e < t);
160
+ if (r < t) return e.compareItemRange(e => r < e && e < t, l);
161
161
  } else {
162
- if (null == n) return e.compareSubdirRangeH2L(e => r < e);
163
- if (r < n) return e.compareSubdirRangeL2H(e => r < e && e <= n);
162
+ if (null == n) return e.compareItemRange(e => r < e, l, !0);
163
+ if (r < n) return e.compareItemRange(e => r < e && e <= n, l);
164
164
  } else if (null != i) if (null != t) {
165
- if (i < t) return e.compareSubdirRangeL2H(e => i <= e && e < t);
165
+ if (i < t) return e.compareItemRange(e => i <= e && e < t, l);
166
166
  } else {
167
- if (null == n) return e.compareSubdirRangeH2L(e => i <= e);
168
- if (i < n) return e.compareSubdirRangeL2H(e => i <= e && e <= n);
169
- if (i == n) return [ e.getSubdir(i) ];
167
+ if (null == n) return e.compareItemRange(e => i <= e, l, !0);
168
+ if (i < n) return e.compareItemRange(e => i <= e && e <= n, l);
169
+ var f;
170
+ if (i == n) return (f = l ? e.getFile(i) : e.getSubdir(i)) ? [ f ] : o;
170
171
  } else {
171
- if (null != t) return e.compareSubdirRangeL2H(e => e < t);
172
- if (null != n) return e.compareSubdirRangeL2H(e => e <= n);
172
+ if (null != t) return e.compareItemRange(e => e < t, l);
173
+ if (null != n) return e.compareItemRange(e => e <= n, l);
173
174
  }
174
- return l;
175
+ return o;
175
176
  }
176
177
 
177
178
  function D(e, r, i, n) {
@@ -191,8 +192,8 @@ function D(e, r, i, n) {
191
192
  if (l) {
192
193
  if (d(n)) return D(i, l, n, f);
193
194
  if (v(n)) {
194
- for (var u of n) if (D(i, l, u, f)) return !0;
195
- } else for (var o in n) if (D(i, l, o, f)) return !0;
195
+ for (var o of n) if (D(i, l, o, f)) return !0;
196
+ } else for (var u in n) if (D(i, l, u, f)) return !0;
196
197
  return !1;
197
198
  }
198
199
  if (d(n) || v(n)) return !1;
@@ -202,17 +203,17 @@ function D(e, r, i, n) {
202
203
  }(e, r.fileContent, n));
203
204
  }
204
205
 
205
- function Q(e, r, i = [], n = [], t = 0) {
206
- if (null != e) if (u(e = c(e) && r ? Object.values(e) : e)) n[t] = e, n.length = t + 1,
207
- i.push([ ...n ]); else if (v(e)) {
206
+ function L(e, r, i = [], n = [], t = 0) {
207
+ if (null != e && "" !== e) if (O(e = c(e) && r ? Object.values(e) : e)) n[t] = e,
208
+ n.length = t + 1, i.push([ ...n ]); else if (v(e)) {
208
209
  n.length = t + 1;
209
- for (var l of e.filter(e => u(e))) n[t] = l, i.push([ ...n ]);
210
- } else if (c(e)) for (var f in e) n[t] = f, n.length = t + 1, Q(e[f], !1, i, n, t + 1);
210
+ for (var l of e.filter(e => O(e))) n[t] = l, i.push([ ...n ]);
211
+ } else if (c(e)) for (var f in e) n[t] = f, n.length = t + 1, L(e[f], !1, i, n, t + 1);
211
212
  return i;
212
213
  }
213
214
 
214
215
  export {
215
216
  e as getIndexPropPaths,
216
217
  n as calDifferenceList,
217
- F as parseNamePathAndQuery
218
+ S as parseNamePathAndQuery
218
219
  };
@@ -14,14 +14,14 @@ class n extends t {
14
14
  nodeList: e,
15
15
  fileCount: i
16
16
  } = this;
17
- if (0 != e.length && 0 != i) return s(this), e[0].containsFile(t) && l(e, t);
17
+ if (0 != i && 0 != e.length) return s(this), e[0].containsFile(t) && l(e, t);
18
18
  }
19
19
  *getFiles(t, e = {}) {
20
20
  var {
21
21
  nodeList: i,
22
22
  fileCount: n
23
23
  } = this;
24
- if (0 != i.length && 0 != n) {
24
+ if (0 != n && 0 != i.length) {
25
25
  s(this);
26
26
  for (var o of i[0].getFiles()) if (!(o in e) && l(i, o) && this.encounterOne(e, o, t) && (yield o,
27
27
  t?.isFull)) return;
@@ -32,7 +32,7 @@ class n extends t {
32
32
  t && null != t.fileCount && ({
33
33
  fileCount: e,
34
34
  nodeList: i
35
- } = this, 0 < i.length && 0 == e || (t instanceof n ? (i.push(...t.nodeList),
35
+ } = this, 0 == e && 0 < i.length || (t instanceof n ? (i.push(...t.nodeList),
36
36
  this.sorted = !1) : i.push(t), (null == e || e > t.fileCount) && (this.fileCount = t.fileCount)));
37
37
  }
38
38
  }
@@ -16,11 +16,11 @@ export declare class QyQueryNode {
16
16
  encounterOne(resultMap: any, fileName: any, queryCounter: any): true | undefined;
17
17
  }
18
18
  export declare class QyUnionNode extends QyQueryNode {
19
- dirMap: any;
19
+ fileMap: any;
20
20
  checkedDirMap: any;
21
- constructor(dir?: undefined);
21
+ constructor(item?: undefined);
22
22
  containsFile(fileName: any): boolean;
23
23
  getFiles(queryCounter?: any, resultMap?: {}): Generator<any, void, any>;
24
24
  addNode(node: any): void;
25
- addDir(dir: any): void;
25
+ addItem(item: any): void;
26
26
  }
@@ -16,9 +16,9 @@ class i {
16
16
  encounterOne(i) {
17
17
  var {
18
18
  encounteredMap: e,
19
- isFull: r
19
+ isFull: t
20
20
  } = this;
21
- if (!(r || i in e)) return e[i] = 1, this.countOne();
21
+ if (!(t || i in e)) return e[i] = 1, this.countOne();
22
22
  }
23
23
  countOne() {
24
24
  if (this.count++ >= this.cursor) return ++this.added, !0;
@@ -29,67 +29,67 @@ class e {
29
29
  fileCount = 0;
30
30
  nodeList = [];
31
31
  constructor() {}
32
- encounterOne(i, e, r) {
33
- if (!r || r.encounterOne(e)) return i[e] = 1, !0;
32
+ encounterOne(i, e, t) {
33
+ if (!t || t.encounterOne(e)) return i[e] = 1, !0;
34
34
  }
35
35
  }
36
36
 
37
37
  class o extends e {
38
- dirMap = {};
38
+ fileMap = {};
39
39
  checkedDirMap = {};
40
40
  constructor(i = void 0) {
41
- super(), i && this.addDir(i);
41
+ super(), i && this.addItem(i);
42
42
  }
43
- containsFile(e) {
43
+ containsFile(i) {
44
44
  var {
45
- fileCount: i,
46
- dirMap: r,
47
- nodeList: t
45
+ fileCount: e,
46
+ fileMap: t,
47
+ nodeList: n
48
48
  } = this;
49
- if (0 < i) {
50
- for (var n in r) if (null != r[n].getFile(e)) return !0;
51
- for (let i = 0; i < t.length; ++i) if (t[i].containsFile(e)) return !0;
49
+ if (0 < e) {
50
+ for (var r in t) {
51
+ r = t[r].fileContent;
52
+ if (r && Object.hasOwn(r, i)) return !0;
53
+ }
54
+ for (var s of n) if (s.containsFile(i)) return !0;
52
55
  }
53
56
  return !1;
54
57
  }
55
58
  *getFiles(i = void 0, e = {}) {
56
- var r, t, {
57
- dirMap: n,
59
+ var t, n, {
60
+ fileMap: r,
58
61
  nodeList: s
59
62
  } = this;
60
- for (r in n) {
61
- var o = n[r];
62
- if (0 != o.fileCount) for (var u of o.fileNameList) if (!(u in e) && this.encounterOne(e, u, i) && (yield u,
63
- i?.isFull)) return;
64
- }
65
- for (t of s) if (yield* t.getFiles(i, e), i?.isFull) return;
63
+ for (t in r) for (var o in r[t].fileContent) if (!(o in e) && this.encounterOne(e, o, i) && (yield o,
64
+ i?.isFull)) return;
65
+ for (n of s) if (yield* n.getFiles(i, e), i?.isFull) return;
66
66
  }
67
67
  addNode(i) {
68
68
  if (i) {
69
69
  var {
70
- dirMap: e,
71
- checkedDirMap: r,
72
- nodeList: t
70
+ fileMap: e,
71
+ checkedDirMap: t,
72
+ nodeList: n
73
73
  } = this;
74
74
  if (i instanceof o) {
75
- for (var n in i.dirMap) e[n] = i.dirMap[n];
76
- for (var s in t.push(...i.nodeList), i.checkedDirMap) r[s] = 1;
77
- } else t.push(i);
75
+ for (var r in i.fileMap) e[r] = i.fileMap[r];
76
+ for (var s in n.push(...i.nodeList), i.checkedDirMap) t[s] = 1;
77
+ } else n.push(i);
78
78
  this.fileCount += i.fileCount;
79
79
  }
80
80
  }
81
- addDir(i) {
81
+ addItem(i) {
82
82
  var {
83
- dirMap: e,
84
- checkedDirMap: r
83
+ fileMap: e,
84
+ checkedDirMap: t
85
85
  } = this, {
86
- fileCount: t,
87
- subdirCount: n,
88
- fullPathHash: s
86
+ isFile: n,
87
+ fullPathHash: r
89
88
  } = i;
90
- if (!(s in e || s in r)) {
91
- if (0 < n) for (var o of i.subdirList) this.addDir(o);
92
- 0 < t ? (e[s] = i, this.fileCount += t) : r[s] = 1;
89
+ if (n) e[r] = i, ++this.fileCount; else if (!(r in t)) {
90
+ for (var s of i.subdirList) this.addItem(s);
91
+ for (var o of i.fileList) this.addItem(o);
92
+ t[r] = 1;
93
93
  }
94
94
  }
95
95
  }