datafolder 1.0.17 → 1.0.18

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/QyBatch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {
2
- isDeepStrictEqual as s
2
+ isDeepStrictEqual as o
3
3
  } from "node:util";
4
4
 
5
5
  import {
@@ -8,52 +8,55 @@ import {
8
8
  } from "./QyFileContentUtils.js";
9
9
 
10
10
  import {
11
- pathSplit as o,
11
+ pathSplit as s,
12
12
  ensurePropNamePathList as n,
13
13
  isString as c,
14
14
  SpecialOperators as e,
15
15
  getSuffix as g,
16
16
  SpecialFilePaths as t,
17
- toSingleName as C,
17
+ toSingleName as p,
18
18
  isSimpleType as h,
19
19
  isEmptyObj as d,
20
20
  isNumber as a,
21
- getNowRounded as m
21
+ getNowRounded as m,
22
+ isDate as u,
23
+ isArray as f,
24
+ isFloat32Array as C
22
25
  } from "./QyUtils.js";
23
26
 
24
27
  import {
25
28
  QyAclCmdGenerator as i,
26
- CmdNames as u
29
+ CmdNames as y
27
30
  } from "./QyAcl.js";
28
31
 
29
32
  import {
30
- calDifferenceList as f
33
+ calDifferenceList as v
31
34
  } from "./QyIndex.js";
32
35
 
33
36
  import {
34
- getDefaultOptions as p
37
+ getDefaultOptions as _
35
38
  } from "./QyDefaultOptions.js";
36
39
 
37
40
  import {
38
- QyCD as v
41
+ QyCD as D
39
42
  } from "./QyCD.js";
40
43
 
41
44
  import {
42
- getPrefixPropPaths as y
45
+ getPrefixPropPaths as x
43
46
  } from "./QyIndexPropTree.js";
44
47
 
45
48
  import {
46
- logger as _
49
+ logger as F
47
50
  } from "./QyLogger.js";
48
51
 
49
- let D = Array.isArray, x = e.$del, O = t.IndexPropPathsFileName, F = {
52
+ let O = e.$del, L = t.IndexPropPathsFileName, q = {
50
53
  none: 0,
51
54
  basic: 1,
52
55
  delta: 2,
53
56
  all: 3
54
57
  };
55
58
 
56
- class L extends v {
59
+ class Q extends D {
57
60
  fileLogLevel;
58
61
  actionQueue;
59
62
  changeId;
@@ -64,46 +67,46 @@ class L extends v {
64
67
  running;
65
68
  constructor(e, t) {
66
69
  super(e), t = {
67
- ...p("QyBatch"),
70
+ ..._("QyBatch"),
68
71
  ...t
69
72
  };
70
- e = F[t.fileLogLevel.toLowerCase()];
73
+ e = q[t.fileLogLevel.toLowerCase()];
71
74
  Object.assign(this, {
72
75
  options: t,
73
76
  fileLogLevel: e ?? 1,
74
77
  qyAclCmdGenerator: new i(),
75
- qyCmdObjHistory: new j(t.maxHistoryCmdObjCount),
78
+ qyCmdObjHistory: new H(t.maxHistoryCmdObjCount),
76
79
  actionQueue: [],
77
80
  changeList: [],
78
81
  syncList: []
79
82
  });
80
83
  }
81
84
  createDir(e, t = this.currentDir) {
82
- return c(e) && (e = o(e)), N(this, "createDir", this.qyCache.getOrCreateDir(e, t));
85
+ return c(e) && (e = s(e)), N(this, "createDir", this.qyCache.getOrCreateDir(e, t));
83
86
  }
84
87
  delDir(e, t = this.currentDir) {
85
- return c(e) && (e = o(e)), N(this, "delDir", this.qyCache.getOrCreateDir(e, t).ensureAllLoaded());
88
+ return c(e) && (e = s(e)), N(this, "delDir", this.qyCache.getOrCreateDir(e, t).ensureAllLoaded());
86
89
  }
87
90
  createFile(e, t = this.currentDir) {
88
- return c(e) && (e = o(e)), N(this, "createFile", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
91
+ return c(e) && (e = s(e)), N(this, "createFile", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
89
92
  }
90
93
  delFile(e, t = this.currentDir) {
91
- return c(e) && (e = o(e)), N(this, "delFile", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
94
+ return c(e) && (e = s(e)), N(this, "delFile", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
92
95
  }
93
96
  expireFile(e, t, i = this.currentDir) {
94
97
  return this.expireFileM(e, 1e3 * t, i);
95
98
  }
96
99
  expireFileM(e, t, i = this.currentDir) {
97
- return M(this, e, t, "f", i);
100
+ return T(this, e, t, "f", i);
98
101
  }
99
102
  expireDir(e, t, i = this.currentDir) {
100
103
  return this.expireDirM(e, 1e3 * t, i);
101
104
  }
102
105
  expireDirM(e, t, i = this.currentDir) {
103
- return M(this, e, t, "d", i);
106
+ return T(this, e, t, "d", i);
104
107
  }
105
108
  expireContent(e, t, i, r = this.currentDir) {
106
- c(e) && (e = o(e));
109
+ c(e) && (e = s(e));
107
110
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
108
111
  return N(this, "expireContent", e, {
109
112
  expireInfoObj: t,
@@ -114,13 +117,13 @@ class L extends v {
114
117
  return this.expireContent(e, t, !0, i);
115
118
  }
116
119
  removeFileExpire(e, t = !1, i = this.currentDir) {
117
- return E(this, e, "f", t, i);
120
+ return M(this, e, "f", t, i);
118
121
  }
119
122
  removeDirExpire(e, t = !1, i = this.currentDir) {
120
- return E(this, e, "d", t, i);
123
+ return M(this, e, "d", t, i);
121
124
  }
122
125
  removeContentExpire(e, t, i = !1, r = this.currentDir) {
123
- c(e) && (e = o(e));
126
+ c(e) && (e = s(e));
124
127
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
125
128
  return N(this, "removeContentExpire", e, {
126
129
  expireInfoObj: t,
@@ -128,23 +131,36 @@ class L extends v {
128
131
  });
129
132
  }
130
133
  createIndex(e, t, i = this.currentDir) {
131
- return c(e) && (e = o(e)), D(t) || (t = [ t ]), N(this, "createIndex", this.qyCache.getOrCreateDir(e, i), {
134
+ return c(e) && (e = s(e)), f(t) || (t = [ t ]), N(this, "createIndex", this.qyCache.getOrCreateDir(e, i), {
132
135
  indexPropPathList: t
133
136
  });
134
137
  }
135
138
  delIndex(e, t, i = this.currentDir) {
136
- return c(e) && (e = o(e)), N(this, "delIndex", this.qyCache.getOrCreateDir(e, i), {
139
+ return c(e) && (e = s(e)), N(this, "delIndex", this.qyCache.getOrCreateDir(e, i), {
137
140
  indexPropPath: t
138
141
  });
139
142
  }
140
143
  insert(e, t, i = !1, r = !1, n = this.currentDir) {
141
- c(e) && (e = o(e));
144
+ c(e) && (e = s(e));
142
145
  e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
143
146
  return N(this, "insert", e, {
144
147
  content: i || h(t) ? t : structuredClone(t),
145
148
  noCreate: r
146
149
  });
147
150
  }
151
+ insertEmbedding(e, t, i = this.currentDir) {
152
+ var r = this.qyCache, e = (c(e) && (e = s(e)), r.getOrCreateFile(e, i));
153
+ return N(this, "insertEmbedding", r.getOrCreateEmbeddingFile(e.fullPathHash), {
154
+ content: C(t) ? t : new Float32Array(t),
155
+ srcFile: e
156
+ });
157
+ }
158
+ delEmbedding(e, t = this.currentDir) {
159
+ var i = this.qyCache, e = (c(e) && (e = s(e)), i.getOrCreateFile(e, t));
160
+ return N(this, "delEmbedding", i.getOrCreateEmbeddingFile(e.fullPathHash), {
161
+ srcFile: e
162
+ });
163
+ }
148
164
  remove(e, t, i = this.currentDir) {
149
165
  return this.insert(e, r(t), !0, !0, i);
150
166
  }
@@ -154,10 +170,10 @@ class L extends v {
154
170
  }, i, !1, r);
155
171
  }
156
172
  delContent(e, t = this.currentDir) {
157
- return c(e) && (e = o(e)), N(this, "delContent", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
173
+ return c(e) && (e = s(e)), N(this, "delContent", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
158
174
  }
159
175
  insertTrigger(e, t, i, r) {
160
- return c(t) && (t = o(t)), i = n(i), N(this, "insertTrigger", this.qyCache.getOrCreateTriggerFile(e), {
176
+ return c(t) && (t = s(t)), i = n(i), N(this, "insertTrigger", this.qyCache.getOrCreateTriggerFile(e), {
161
177
  fileNamePath: t,
162
178
  propNamePathList: i,
163
179
  modCode: r
@@ -188,27 +204,27 @@ class L extends v {
188
204
  i.length = 0, this.running = !1, this.resetCurrentDir();
189
205
  var {
190
206
  changeList: i,
191
- qyAclCmdGenerator: o,
192
- qyCmdObjHistory: s,
207
+ qyAclCmdGenerator: s,
208
+ qyCmdObjHistory: o,
193
209
  syncList: l
194
210
  } = this, c = i.length;
195
211
  if (0 == c) return n.decreaseChangeId(), 0;
196
- var h = g(c), o = o.takeCmdArgAsListObj();
212
+ var h = g(c), s = s.takeCmdArgAsListObj();
197
213
  let d;
198
214
  0 < r && (r = i.map(({
199
215
  logStr: e
200
216
  }) => e).join("\n"), d = new Date().toISOString() + `: ${c} change${h}:
201
217
  ${r}
202
218
  `);
203
- var m, u, c = n.save(t, o, d, (e => {
219
+ var m, u, c = n.save(t, s, d, (e => {
204
220
  var t = e.syncList, i = t.length;
205
221
  for (let e = 0; e < i; e += 2) {
206
- var r, n = e + 1, a = t[e], o = t[n];
207
- a.startsWith("d") ? (r = o.subdirNameList, t[n] = 0 < r.length ? r : void 0) : a.startsWith("f") ? (r = o.fileNameList,
208
- t[n] = 0 < r.length ? r : void 0) : t[n] = o.fileContent;
222
+ var r, n = e + 1, a = t[e], s = t[n];
223
+ a.startsWith("d") ? (r = s.subdirNameList, t[n] = 0 < r.length ? r : void 0) : a.startsWith("f") ? (r = s.fileNameList,
224
+ t[n] = 0 < r.length ? r : void 0) : t[n] = s.fileContent;
209
225
  }
210
226
  if (0 < i) return t;
211
- })(this), e), h = (l.length = 0, s.push(o), i.filter(({
227
+ })(this), e), h = (l.length = 0, o.push(s), i.filter(({
212
228
  item: e,
213
229
  delta: t
214
230
  }) => t && 0 < e.triggerNodes?.length));
@@ -231,12 +247,12 @@ ${r}
231
247
  modCode: n
232
248
  } = e, {
233
249
  name: a,
234
- fileContent: o
235
- } = e, o = o && o[0], e = this._action_insert({
250
+ fileContent: s
251
+ } = e, s = s && s[0], e = this._action_insert({
236
252
  item: e,
237
253
  content: [ i, r, n ]
238
254
  });
239
- return e && (t = this.qyCache, o && !s(o, i) && t.removeTriggerFromTree(a, o),
255
+ return e && (t = this.qyCache, s && !o(s, i) && t.removeTriggerFromTree(a, s),
240
256
  t.insertTriggerToTree(a, i, r, n)), e;
241
257
  }
242
258
  _action_removeTrigger(e) {
@@ -272,23 +288,23 @@ ${r}
272
288
  var e, {
273
289
  item: t,
274
290
  indexPropPathList: i
275
- } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(O), {
291
+ } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(L), {
276
292
  fileContent: a,
277
- qyIndexPropTree: o
293
+ qyIndexPropTree: s
278
294
  } = (n.created || this._action_createFile({
279
295
  item: n
280
- }), n), s = [], l = {};
296
+ }), n), o = [], l = {};
281
297
  for (e of i) {
282
- var c = C(e);
283
- a && a[c] || (s.push(e), l[c] = 1, o.insert(e));
298
+ var c = p(e);
299
+ a && a[c] || (o.push(e), l[c] = 1, s.insert(e));
284
300
  }
285
- if (0 != s.length) {
286
- _.log(`Creating index ${JSON.stringify(s)} for ` + t.fullPath), this._action_insert({
301
+ if (0 != o.length) {
302
+ F.log(`Creating index ${JSON.stringify(o)} for ` + t.fullPath), this._action_insert({
287
303
  item: n,
288
304
  content: l
289
305
  });
290
306
  {
291
- var h, d = this, m = t, u = r, i = y(s);
307
+ var h, d = this, m = t, u = r, i = x(o);
292
308
  let e;
293
309
  for (h of i) {
294
310
  var f = u.searchOrCreateSubdir(h);
@@ -299,9 +315,9 @@ ${r}
299
315
  for (var g of e = e || m.fileList) {
300
316
  var {
301
317
  fileContent: g,
302
- name: p
318
+ name: C
303
319
  } = g;
304
- null != g && b(d, f, h, p, void 0, g);
320
+ null != g && E(d, f, h, C, void 0, g);
305
321
  }
306
322
  }
307
323
  }
@@ -314,10 +330,10 @@ ${r}
314
330
  item: e,
315
331
  indexPropPath: r
316
332
  } = e, e = this.qyCache.getIndexDir(e);
317
- e && ((i = e.getFile(O)) ? (t = i.qyIndexPropTree, this._action_insert({
333
+ e && ((i = e.getFile(L)) ? (t = i.qyIndexPropTree, this._action_insert({
318
334
  item: i,
319
335
  content: {
320
- [C(r)]: x
336
+ [p(r)]: O
321
337
  }
322
338
  }), t.remove(r).hasPrefix || (i = e.getSubdir(r)) && this._action_delDir({
323
339
  item: i
@@ -336,7 +352,7 @@ ${r}
336
352
  parentDir: r,
337
353
  name: n
338
354
  } = i;
339
- return i.created = !1, I(this, e), t || q(this, r, u.R, r.fileMapKey, n),
355
+ return i.created = !1, b(this, e), t || P(this, r, y.R, r.fileMapKey, n),
340
356
  !0;
341
357
  }
342
358
  _action_delDir(e) {
@@ -348,17 +364,17 @@ ${r}
348
364
  name: r,
349
365
  subdirMap: n,
350
366
  fileMap: a,
351
- subdirMapKey: o,
352
- fileMapKey: s
367
+ subdirMapKey: s,
368
+ fileMapKey: o
353
369
  } = t;
354
370
  if (a) {
355
- q(this, t, u.D, s);
371
+ P(this, t, y.D, o);
356
372
  for (var l of t.fileList) this._action_delFile({
357
373
  item: l
358
374
  }, !0);
359
375
  }
360
376
  if (n) {
361
- q(this, t, u.D, o);
377
+ P(this, t, y.D, s);
362
378
  for (var c of t.allSubdirs()) {
363
379
  let {
364
380
  subdirMap: e,
@@ -366,19 +382,19 @@ ${r}
366
382
  subdirMapKey: i,
367
383
  fileMapKey: r
368
384
  } = c;
369
- if (e && q(this, c, u.D, i), t) {
370
- q(this, c, u.D, r);
385
+ if (e && P(this, c, y.D, i), t) {
386
+ P(this, c, y.D, r);
371
387
  for (var h of c.fileList) this._action_delFile({
372
388
  item: h
373
389
  }, !0);
374
390
  }
375
- I(this, {
391
+ b(this, {
376
392
  actionName: "delDir",
377
393
  item: c
378
394
  }), c.created = !1;
379
395
  }
380
396
  }
381
- return !!i && (t.created = !1, I(this, e), q(this, i, u.R, i.subdirMapKey, r),
397
+ return !!i && (t.created = !1, b(this, e), P(this, i, y.R, i.subdirMapKey, r),
382
398
  !0);
383
399
  }
384
400
  _action_delContent(e) {
@@ -388,9 +404,36 @@ ${r}
388
404
  content: i,
389
405
  delta: {
390
406
  oldValue: i,
391
- newValue: x
407
+ newValue: O
392
408
  }
393
- }), I(this, e), q(this, t, u.D, t.fileContentKey), P(this, t, i), !0);
409
+ }), b(this, e), P(this, t, y.D, t.fileContentKey), I(this, t, i), !0);
410
+ }
411
+ _action_insertEmbedding(e) {
412
+ e.actionName = "insertEmbedding";
413
+ var {
414
+ item: e,
415
+ content: t,
416
+ srcFile: i
417
+ } = e, i = (this._action_insert({
418
+ item: this.qyCache.getOrCreateH2FFile(i.fullPathHash),
419
+ content: i.namePath
420
+ }), this._action_insert({
421
+ item: e,
422
+ content: t
423
+ }));
424
+ return i;
425
+ }
426
+ _action_delEmbedding(e) {
427
+ e.actionName = "delEmbedding";
428
+ var {
429
+ item: e,
430
+ srcFile: t
431
+ } = e, e = this._action_delFile({
432
+ item: e
433
+ });
434
+ return e && this._action_delFile({
435
+ item: this.qyCache.getOrCreateH2FFile(t.fullPathHash)
436
+ }), e;
394
437
  }
395
438
  _action_insert(e) {
396
439
  e.actionName = "insert";
@@ -399,7 +442,7 @@ ${r}
399
442
  content: i,
400
443
  noCreate: r
401
444
  } = e;
402
- if (null == i) return _.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
445
+ if (null == i) return F.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
403
446
  !1;
404
447
  if (!t.created) {
405
448
  if (r) return !1;
@@ -409,13 +452,13 @@ ${r}
409
452
  }
410
453
  var n, a, r = l(t.fileContent, i), {
411
454
  merged: i,
412
- delta: o
455
+ delta: s
413
456
  } = r;
414
- return !!o && ({
415
- oldValue: o,
457
+ return !!s && ({
458
+ oldValue: s,
416
459
  newValue: n
417
- } = o, !!n) && (a = t.fileContentKey, null == i ? q(this, t, u.D, a) : q(this, t, u.M, a, n),
418
- Object.assign(e, r), I(this, e), t.fileContent = i, P(this, t, o, n, i),
460
+ } = s, !!n) && (a = t.fileContentKey, null == i ? P(this, t, y.D, a) : P(this, t, y.M, a, n),
461
+ Object.assign(e, r), b(this, e), t.fileContent = i, I(this, t, s, n, i),
419
462
  !0);
420
463
  }
421
464
  _action_createFile(e) {
@@ -426,7 +469,7 @@ ${r}
426
469
  }), Object.assign(i, {
427
470
  created: !0,
428
471
  fileContentLoaded: !0
429
- }), I(this, e), q(this, t, u.A, t.fileMapKey, i.name), !0);
472
+ }), b(this, e), P(this, t, y.A, t.fileMapKey, i.name), !0);
430
473
  }
431
474
  _action_createDir(e) {
432
475
  e.actionName = "createDir";
@@ -438,12 +481,12 @@ ${r}
438
481
  created: !0,
439
482
  subdirMapLoaded: !0,
440
483
  fileMapLoaded: !0
441
- }), I(this, {
484
+ }), b(this, {
442
485
  actionName: "createDir",
443
486
  item: e
444
487
  });
445
488
  var r = e.parentDir;
446
- q(this, r, u.A, r.subdirMapKey, e.name);
489
+ P(this, r, y.A, r.subdirMapKey, e.name);
447
490
  }
448
491
  return !0;
449
492
  }
@@ -456,7 +499,7 @@ ${r}
456
499
  parentDir: r,
457
500
  name: n
458
501
  } = e;
459
- return !!r && null != (i = T(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
502
+ return !!r && null != (i = S(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
460
503
  (r = this._action_insert({
461
504
  item: r,
462
505
  content: {
@@ -476,7 +519,7 @@ ${r}
476
519
  return !!r && (t = this.qyCache, !!(r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
477
520
  item: r,
478
521
  content: {
479
- [n]: x
522
+ [n]: O
480
523
  }
481
524
  })) && (d(r.fileContent) && this._action_delFile({
482
525
  item: r
@@ -489,13 +532,13 @@ ${r}
489
532
  expireInfoObj: i,
490
533
  isMilliSecond: r
491
534
  } = e, n = m();
492
- var e = S(i, e => T(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
493
- item: o,
535
+ var e = j(i, e => S(e, r, n)), a = this.qyCache, s = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), s = this._action_insert({
536
+ item: s,
494
537
  content: {
495
538
  ...e
496
539
  }
497
540
  });
498
- return o && a.monitorContentExpire(t, e), o;
541
+ return s && a.monitorContentExpire(t, e), s;
499
542
  }
500
543
  _action_removeContentExpire(e) {
501
544
  e.actionName = "removeContentExpire";
@@ -504,7 +547,7 @@ ${r}
504
547
  expireInfoObj: i,
505
548
  infoFileOnly: r
506
549
  } = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
507
- return !!a && (i = D(i) ? Object.fromEntries(i.map(e => [ e, x ])) : S(i, e => e ? x : void 0),
550
+ return !!a && (i = f(i) ? Object.fromEntries(i.map(e => [ e, O ])) : j(i, e => e ? O : void 0),
508
551
  (t = this._action_insert({
509
552
  item: a,
510
553
  content: i
@@ -522,7 +565,7 @@ function N(e, t, i, r) {
522
565
  }), e;
523
566
  }
524
567
 
525
- function I(e, t) {
568
+ function b(e, t) {
526
569
  var {
527
570
  changeList: e,
528
571
  fileLogLevel: i
@@ -546,41 +589,41 @@ function I(e, t) {
546
589
  })(t, i)), e.push(t);
547
590
  }
548
591
 
549
- function q(e, t, i, r, n = void 0) {
592
+ function P(e, t, i, r, n = void 0) {
550
593
  var {
551
594
  qyAclCmdGenerator: e,
552
595
  qyCache: a,
553
- syncList: o,
554
- changeId: s
596
+ syncList: s,
597
+ changeId: o
555
598
  } = e;
556
- e.pushCmd(i, r, n), r.startsWith("d") ? t.dChangeId = s : r.startsWith("f") ? t.fChangeId = s : t.cChangeId = s,
557
- a && a.qyKVData.removeKey(r) && o.push(r, t);
599
+ e.pushCmd(i, r, n), r.startsWith("d") ? t.dChangeId = o : r.startsWith("f") ? t.fChangeId = o : t.cChangeId = o,
600
+ a && a.qyKVData.removeKey(r) && s.push(r, t);
558
601
  }
559
602
 
560
- function P(e, t, i, r = void 0, n = void 0) {
603
+ function I(e, t, i, r = void 0, n = void 0) {
561
604
  var {
562
605
  underHiddenFolder: t,
563
606
  name: a,
564
- parentDir: o
607
+ parentDir: s
565
608
  } = t;
566
609
  if (!t) {
567
- var s = e.qyCache.getIndexDir(o);
568
- if (s) {
569
- t = s.getFile(O);
570
- if (t) for (var l of t.qyIndexPropTree.getAllIndexPropPaths()) b(e, s.searchOrCreateSubdir(l), l, a, i, r, n);
610
+ var o = e.qyCache.getIndexDir(s);
611
+ if (o) {
612
+ t = o.getFile(L);
613
+ if (t) for (var l of t.qyIndexPropTree.getAllIndexPropPaths()) E(e, o.searchOrCreateSubdir(l), l, a, i, r, n);
571
614
  }
572
615
  }
573
616
  }
574
617
 
575
- function b(t, e, i, r, n, a, o = void 0) {
576
- e = f(e, i, r, n, a, o);
618
+ function E(t, e, i, r, n, a, s = void 0) {
619
+ e = v(e, i, r, n, a, s);
577
620
  if (e) {
578
- var s, l, c, {
621
+ var o, l, c, {
579
622
  toAddFileList: i,
580
623
  toDelFileList: r
581
624
  } = e;
582
- for (s of i) t._action_createFile({
583
- item: s
625
+ for (o of i) t._action_createFile({
626
+ item: o
584
627
  });
585
628
  for (l of r) t._action_delFile({
586
629
  item: l
@@ -594,7 +637,7 @@ function b(t, e, i, r, n, a, o = void 0) {
594
637
  }
595
638
  }
596
639
 
597
- class j {
640
+ class H {
598
641
  maxLength;
599
642
  actionQueue;
600
643
  nextPos;
@@ -622,35 +665,35 @@ class j {
622
665
  }
623
666
  }
624
667
 
625
- function S(e, t = void 0, i = [], r = {}) {
668
+ function j(e, t = void 0, i = [], r = {}) {
626
669
  if (h(e)) {
627
670
  var n = t ? t(e) : e;
628
671
  null != n && (r[JSON.stringify(i)] = n);
629
672
  } else {
630
- var a, o = i.length;
631
- for (a in e) i.push(a), S(e[a], t, i, r), i.length = o;
673
+ var a, s = i.length;
674
+ for (a in e) i.push(a), j(e[a], t, i, r), i.length = s;
632
675
  }
633
676
  return r;
634
677
  }
635
678
 
636
- function T(e, t, i) {
637
- return a(e) ? (t ? e : 1e3 * e) + i : c(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !(e instanceof Date) || (t = e.getTime()) <= i ? void 0 : t;
679
+ function S(e, t, i) {
680
+ return a(e) ? (t ? e : 1e3 * e) + i : c(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !u(e) || (t = e.getTime()) <= i ? void 0 : t;
638
681
  }
639
682
 
640
- function M(e, t, i, r, n) {
641
- var a = e.qyCache, r = (c(t) && (t = o(t)), "f" == r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
683
+ function T(e, t, i, r, n) {
684
+ var a = e.qyCache, r = (c(t) && (t = s(t)), "f" == r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
642
685
  return N(e, "expireItem", r, {
643
686
  milliSecond: i
644
687
  });
645
688
  }
646
689
 
647
- function E(e, t, i, r, n) {
648
- var a = e.qyCache, i = (c(t) && (t = o(t)), "f" == i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
690
+ function M(e, t, i, r, n) {
691
+ var a = e.qyCache, i = (c(t) && (t = s(t)), "f" == i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
649
692
  return N(e, "removeItemExpire", i, {
650
693
  infoFileOnly: r
651
694
  });
652
695
  }
653
696
 
654
697
  export {
655
- L as QyBatch
698
+ Q as QyBatch
656
699
  };
@@ -0,0 +1,10 @@
1
+ export declare class QyBinaryHeap {
2
+ items: any[];
3
+ cmpFun: any;
4
+ constructor(cmpFun?: (x: any, y: any) => number);
5
+ get size(): number;
6
+ get isEmpty(): boolean;
7
+ peek(): any;
8
+ push(item: any): void;
9
+ pop(): any;
10
+ }
@@ -0,0 +1,55 @@
1
+ class t {
2
+ items = [];
3
+ cmpFun;
4
+ constructor(t = (t, e) => t - e) {
5
+ this.cmpFun = t;
6
+ }
7
+ get size() {
8
+ return this.items.length;
9
+ }
10
+ get isEmpty() {
11
+ return 0 == this.items.length;
12
+ }
13
+ peek() {
14
+ return this.items[0];
15
+ }
16
+ push(t) {
17
+ var e = this.items;
18
+ e.push(t), i(this);
19
+ }
20
+ pop() {
21
+ if (!this.isEmpty) {
22
+ for (var t = this.items, e = t[0], [ t, i = 0 ] = (t[0] = t.at(-1),
23
+ --t.length, [ this ]), {
24
+ items: s,
25
+ cmpFun: r
26
+ } = t, h = s.length; i < h; ) {
27
+ var n = 2 * i + 1;
28
+ if (!(n < h)) break;
29
+ {
30
+ let t = i;
31
+ 0 < r(s[n], s[t]) && (t = n);
32
+ n = 1 + n;
33
+ if ((t = n < h && 0 < r(s[n], s[t]) ? n : t) == i) break;
34
+ [ s[i], s[t] ] = [ s[t], s[i] ], i = t;
35
+ }
36
+ }
37
+ return e;
38
+ }
39
+ }
40
+ }
41
+
42
+ function i(t, e = t.items.length - 1) {
43
+ for (var {
44
+ items: i,
45
+ cmpFun: s
46
+ } = t; 0 < e; ) {
47
+ var r = Math.floor((e - 1) / 2);
48
+ if (!(0 < s(i[e], i[r]))) break;
49
+ [ i[e], i[r] ] = [ i[r], i[e] ], e = r;
50
+ }
51
+ }
52
+
53
+ export {
54
+ t as QyBinaryHeap
55
+ };