datafolder 1.0.17 → 1.0.19

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,59 +1,62 @@
1
1
  import {
2
- isDeepStrictEqual as s
2
+ isDeepStrictEqual as c
3
3
  } from "node:util";
4
4
 
5
5
  import {
6
- mergeContentAndGenDelta as l,
6
+ mergeContentAndGenDelta as o,
7
7
  objToDelMarks as r
8
8
  } from "./QyFileContentUtils.js";
9
9
 
10
10
  import {
11
- pathSplit as o,
11
+ pathSplit as s,
12
12
  ensurePropNamePathList as n,
13
- isString as c,
13
+ isString as l,
14
14
  SpecialOperators as e,
15
- getSuffix as g,
15
+ getSuffix as f,
16
16
  SpecialFilePaths as t,
17
17
  toSingleName as C,
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 g,
24
+ isFloat32Array as p
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, b = t.IndexPropPathsFileName, L = {
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,48 +67,57 @@ 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 = L[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 A(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 l(e) && (e = s(e)), q(this, "createDir", {
86
+ item: this.qyCache.getOrCreateDir(e, t)
87
+ });
83
88
  }
84
89
  delDir(e, t = this.currentDir) {
85
- return c(e) && (e = o(e)), N(this, "delDir", this.qyCache.getOrCreateDir(e, t).ensureAllLoaded());
90
+ return l(e) && (e = s(e)), q(this, "delDir", {
91
+ item: this.qyCache.getOrCreateDir(e, t).ensureAllLoaded()
92
+ });
86
93
  }
87
94
  createFile(e, t = this.currentDir) {
88
- return c(e) && (e = o(e)), N(this, "createFile", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
95
+ return l(e) && (e = s(e)), q(this, "createFile", {
96
+ item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
97
+ });
89
98
  }
90
99
  delFile(e, t = this.currentDir) {
91
- return c(e) && (e = o(e)), N(this, "delFile", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
100
+ return l(e) && (e = s(e)), q(this, "delFile", {
101
+ item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
102
+ });
92
103
  }
93
104
  expireFile(e, t, i = this.currentDir) {
94
105
  return this.expireFileM(e, 1e3 * t, i);
95
106
  }
96
107
  expireFileM(e, t, i = this.currentDir) {
97
- return M(this, e, t, "f", i);
108
+ return T(this, e, t, "f", i);
98
109
  }
99
110
  expireDir(e, t, i = this.currentDir) {
100
111
  return this.expireDirM(e, 1e3 * t, i);
101
112
  }
102
113
  expireDirM(e, t, i = this.currentDir) {
103
- return M(this, e, t, "d", i);
114
+ return T(this, e, t, "d", i);
104
115
  }
105
116
  expireContent(e, t, i, r = this.currentDir) {
106
- c(e) && (e = o(e));
117
+ l(e) && (e = s(e));
107
118
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
108
- return N(this, "expireContent", e, {
119
+ return q(this, "expireContent", {
120
+ item: e,
109
121
  expireInfoObj: t,
110
122
  isMilliSecond: i
111
123
  });
@@ -114,37 +126,62 @@ class L extends v {
114
126
  return this.expireContent(e, t, !0, i);
115
127
  }
116
128
  removeFileExpire(e, t = !1, i = this.currentDir) {
117
- return E(this, e, "f", t, i);
129
+ return M(this, e, "f", t, i);
118
130
  }
119
131
  removeDirExpire(e, t = !1, i = this.currentDir) {
120
- return E(this, e, "d", t, i);
132
+ return M(this, e, "d", t, i);
121
133
  }
122
134
  removeContentExpire(e, t, i = !1, r = this.currentDir) {
123
- c(e) && (e = o(e));
135
+ l(e) && (e = s(e));
124
136
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
125
- return N(this, "removeContentExpire", e, {
137
+ return q(this, "removeContentExpire", {
138
+ item: e,
126
139
  expireInfoObj: t,
127
140
  infoFileOnly: i
128
141
  });
129
142
  }
130
143
  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), {
144
+ l(e) && (e = s(e)), g(t) || (t = [ t ]);
145
+ e = this.qyCache.getOrCreateDir(e, i);
146
+ return q(this, "createIndex", {
147
+ item: e,
132
148
  indexPropPathList: t
133
149
  });
134
150
  }
135
151
  delIndex(e, t, i = this.currentDir) {
136
- return c(e) && (e = o(e)), N(this, "delIndex", this.qyCache.getOrCreateDir(e, i), {
152
+ l(e) && (e = s(e));
153
+ e = this.qyCache.getOrCreateDir(e, i);
154
+ return q(this, "delIndex", {
155
+ item: e,
137
156
  indexPropPath: t
138
157
  });
139
158
  }
140
159
  insert(e, t, i = !1, r = !1, n = this.currentDir) {
141
- c(e) && (e = o(e));
160
+ l(e) && (e = s(e));
142
161
  e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
143
- return N(this, "insert", e, {
144
- content: i || h(t) ? t : structuredClone(t),
162
+ return q(this, "insert", {
163
+ item: e,
164
+ content: t = i || h(t) ? t : structuredClone(t),
145
165
  noCreate: r
146
166
  });
147
167
  }
168
+ insertEmbedding(e, t, i = this.currentDir) {
169
+ var r = this.qyCache, r = (p(t) || (t = new Float32Array(t)), l(e) && (e = s(e)),
170
+ r.getOrCreateFile(e, i));
171
+ return q(this, "insertEmbedding", {
172
+ item: r,
173
+ embedding: t
174
+ });
175
+ }
176
+ delEmbedding(e, t = this.currentDir) {
177
+ var i = this.qyCache, i = (l(e) && (e = s(e)), i.getOrCreateFile(e, t));
178
+ return q(this, "delEmbedding", {
179
+ item: i
180
+ });
181
+ }
182
+ insertWithEmbedding(e, t, i, r = !1, n = !1, a = this.currentDir) {
183
+ return this.insert(e, t, r, n, a), this.insertEmbedding(e, i, a);
184
+ }
148
185
  remove(e, t, i = this.currentDir) {
149
186
  return this.insert(e, r(t), !0, !0, i);
150
187
  }
@@ -154,25 +191,38 @@ class L extends v {
154
191
  }, i, !1, r);
155
192
  }
156
193
  delContent(e, t = this.currentDir) {
157
- return c(e) && (e = o(e)), N(this, "delContent", this.qyCache.getOrCreateFile(e, t).ensureLoaded());
194
+ l(e) && (e = s(e));
195
+ e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
196
+ return q(this, "delContent", {
197
+ item: e
198
+ });
158
199
  }
159
200
  insertTrigger(e, t, i, r) {
160
- return c(t) && (t = o(t)), i = n(i), N(this, "insertTrigger", this.qyCache.getOrCreateTriggerFile(e), {
201
+ l(t) && (t = s(t)), i = n(i);
202
+ e = this.qyCache.getOrCreateTriggerFile(e);
203
+ return q(this, "insertTrigger", {
204
+ item: e,
161
205
  fileNamePath: t,
162
206
  propNamePathList: i,
163
207
  modCode: r
164
208
  });
165
209
  }
166
210
  removeTrigger(e) {
167
- return N(this, "removeTrigger", this.qyCache.getOrCreateTriggerFile(e));
211
+ return q(this, "removeTrigger", {
212
+ item: this.qyCache.getOrCreateTriggerFile(e)
213
+ });
168
214
  }
169
215
  insertRpc(e, t) {
170
- return N(this, "insertRpc", this.qyCache.getOrCreateRpcFile(e), {
216
+ e = this.qyCache.getOrCreateRpcFile(e);
217
+ return q(this, "insertRpc", {
218
+ item: e,
171
219
  modCode: t
172
220
  });
173
221
  }
174
222
  removeRpc(e) {
175
- return N(this, "removeRpc", this.qyCache.getOrCreateRpcFile(e));
223
+ return q(this, "removeRpc", {
224
+ item: this.qyCache.getOrCreateRpcFile(e)
225
+ });
176
226
  }
177
227
  run(e = !1) {
178
228
  var {
@@ -188,27 +238,27 @@ class L extends v {
188
238
  i.length = 0, this.running = !1, this.resetCurrentDir();
189
239
  var {
190
240
  changeList: i,
191
- qyAclCmdGenerator: o,
192
- qyCmdObjHistory: s,
241
+ qyAclCmdGenerator: s,
242
+ qyCmdObjHistory: o,
193
243
  syncList: l
194
244
  } = this, c = i.length;
195
245
  if (0 == c) return n.decreaseChangeId(), 0;
196
- var h = g(c), o = o.takeCmdArgAsListObj();
246
+ var h = f(c), s = s.takeCmdArgAsListObj();
197
247
  let d;
198
248
  0 < r && (r = i.map(({
199
249
  logStr: e
200
250
  }) => e).join("\n"), d = new Date().toISOString() + `: ${c} change${h}:
201
251
  ${r}
202
252
  `);
203
- var m, u, c = n.save(t, o, d, (e => {
253
+ var m, u, c = n.save(t, s, d, (e => {
204
254
  var t = e.syncList, i = t.length;
205
255
  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;
256
+ var r, n = e + 1, a = t[e], s = t[n];
257
+ a.startsWith("d") ? (r = s.subdirNameList, t[n] = 0 < r.length ? r : void 0) : a.startsWith("f") ? (r = s.fileNameList,
258
+ t[n] = 0 < r.length ? r : void 0) : t[n] = s.fileContent;
209
259
  }
210
260
  if (0 < i) return t;
211
- })(this), e), h = (l.length = 0, s.push(o), i.filter(({
261
+ })(this), e), h = (l.length = 0, o.push(s), i.filter(({
212
262
  item: e,
213
263
  delta: t
214
264
  }) => t && 0 < e.triggerNodes?.length));
@@ -216,7 +266,7 @@ ${r}
216
266
  for ({
217
267
  item: m,
218
268
  delta: u
219
- } of h) for (var f of m.triggerNodes) f.checkTrigger(m, u);
269
+ } of h) for (var g of m.triggerNodes) g.checkTrigger(m, u);
220
270
  return e ? c : t;
221
271
  }
222
272
  getTopHistoryCmdObj() {
@@ -231,12 +281,12 @@ ${r}
231
281
  modCode: n
232
282
  } = e, {
233
283
  name: a,
234
- fileContent: o
235
- } = e, o = o && o[0], e = this._action_insert({
284
+ fileContent: s
285
+ } = e, s = s && s[0], e = this._action_insert({
236
286
  item: e,
237
287
  content: [ i, r, n ]
238
288
  });
239
- return e && (t = this.qyCache, o && !s(o, i) && t.removeTriggerFromTree(a, o),
289
+ return e && (t = this.qyCache, s && !c(s, i) && t.removeTriggerFromTree(a, s),
240
290
  t.insertTriggerToTree(a, i, r, n)), e;
241
291
  }
242
292
  _action_removeTrigger(e) {
@@ -272,36 +322,36 @@ ${r}
272
322
  var e, {
273
323
  item: t,
274
324
  indexPropPathList: i
275
- } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(O), {
325
+ } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(b), {
276
326
  fileContent: a,
277
- qyIndexPropTree: o
327
+ qyIndexPropTree: s
278
328
  } = (n.created || this._action_createFile({
279
329
  item: n
280
- }), n), s = [], l = {};
330
+ }), n), o = [], l = {};
281
331
  for (e of i) {
282
332
  var c = C(e);
283
- a && a[c] || (s.push(e), l[c] = 1, o.insert(e));
333
+ a && a[c] || (o.push(e), l[c] = 1, s.insert(e));
284
334
  }
285
- if (0 != s.length) {
286
- _.log(`Creating index ${JSON.stringify(s)} for ` + t.fullPath), this._action_insert({
335
+ if (0 != o.length) {
336
+ F.log(`Creating index ${JSON.stringify(o)} for ` + t.fullPath), this._action_insert({
287
337
  item: n,
288
338
  content: l
289
339
  });
290
340
  {
291
- var h, d = this, m = t, u = r, i = y(s);
341
+ var h, d = this, m = t, u = r, i = x(o);
292
342
  let e;
293
343
  for (h of i) {
294
- var f = u.searchOrCreateSubdir(h);
295
- if (!f.created) {
344
+ var g = u.searchOrCreateSubdir(h);
345
+ if (!g.created) {
296
346
  d._action_createDir({
297
- item: f
347
+ item: g
298
348
  });
299
- for (var g of e = e || m.fileList) {
349
+ for (var f of e = e || m.fileList) {
300
350
  var {
301
- fileContent: g,
351
+ fileContent: f,
302
352
  name: p
303
- } = g;
304
- null != g && b(d, f, h, p, void 0, g);
353
+ } = f;
354
+ null != f && E(d, g, h, p, void 0, f);
305
355
  }
306
356
  }
307
357
  }
@@ -314,10 +364,10 @@ ${r}
314
364
  item: e,
315
365
  indexPropPath: r
316
366
  } = e, e = this.qyCache.getIndexDir(e);
317
- e && ((i = e.getFile(O)) ? (t = i.qyIndexPropTree, this._action_insert({
367
+ e && ((i = e.getFile(b)) ? (t = i.qyIndexPropTree, this._action_insert({
318
368
  item: i,
319
369
  content: {
320
- [C(r)]: x
370
+ [C(r)]: O
321
371
  }
322
372
  }), t.remove(r).hasPrefix || (i = e.getSubdir(r)) && this._action_delDir({
323
373
  item: i
@@ -336,7 +386,7 @@ ${r}
336
386
  parentDir: r,
337
387
  name: n
338
388
  } = i;
339
- return i.created = !1, I(this, e), t || q(this, r, u.R, r.fileMapKey, n),
389
+ return i.created = !1, N(this, e), t || I(this, r, y.R, r.fileMapKey, n),
340
390
  !0;
341
391
  }
342
392
  _action_delDir(e) {
@@ -348,17 +398,17 @@ ${r}
348
398
  name: r,
349
399
  subdirMap: n,
350
400
  fileMap: a,
351
- subdirMapKey: o,
352
- fileMapKey: s
401
+ subdirMapKey: s,
402
+ fileMapKey: o
353
403
  } = t;
354
404
  if (a) {
355
- q(this, t, u.D, s);
405
+ I(this, t, y.D, o);
356
406
  for (var l of t.fileList) this._action_delFile({
357
407
  item: l
358
408
  }, !0);
359
409
  }
360
410
  if (n) {
361
- q(this, t, u.D, o);
411
+ I(this, t, y.D, s);
362
412
  for (var c of t.allSubdirs()) {
363
413
  let {
364
414
  subdirMap: e,
@@ -366,19 +416,19 @@ ${r}
366
416
  subdirMapKey: i,
367
417
  fileMapKey: r
368
418
  } = c;
369
- if (e && q(this, c, u.D, i), t) {
370
- q(this, c, u.D, r);
419
+ if (e && I(this, c, y.D, i), t) {
420
+ I(this, c, y.D, r);
371
421
  for (var h of c.fileList) this._action_delFile({
372
422
  item: h
373
423
  }, !0);
374
424
  }
375
- I(this, {
425
+ N(this, {
376
426
  actionName: "delDir",
377
427
  item: c
378
428
  }), c.created = !1;
379
429
  }
380
430
  }
381
- return !!i && (t.created = !1, I(this, e), q(this, i, u.R, i.subdirMapKey, r),
431
+ return !!i && (t.created = !1, N(this, e), I(this, i, y.R, i.subdirMapKey, r),
382
432
  !0);
383
433
  }
384
434
  _action_delContent(e) {
@@ -388,9 +438,44 @@ ${r}
388
438
  content: i,
389
439
  delta: {
390
440
  oldValue: i,
391
- newValue: x
441
+ newValue: O
392
442
  }
393
- }), I(this, e), q(this, t, u.D, t.fileContentKey), P(this, t, i), !0);
443
+ }), N(this, e), I(this, t, y.D, t.fileContentKey), P(this, t, i), !0);
444
+ }
445
+ _action_insertEmbedding(e) {
446
+ e.actionName = "insertEmbedding";
447
+ var t, i, r = this.qyCache, n = r.qyEmbeddings, {
448
+ item: e,
449
+ embedding: a
450
+ } = e, s = a.length, r = r.getOrCreateInfoFile(e), o = r.fileContent;
451
+ let l = !1;
452
+ return r.created && o.length == s ? (t = e.fullPathHash, o = o.idx, i = n.getEmbedding(t, s, o),
453
+ c(a, i) || ((i = n.updateEmbedding(t, a, o)) != o && this._action_insert({
454
+ item: r,
455
+ content: {
456
+ idx: i
457
+ }
458
+ }), l = !0)) : ({
459
+ fullPathHash: t,
460
+ namePath: o
461
+ } = e, i = n.addEmbedding(t, a), this._action_insert({
462
+ item: r,
463
+ content: {
464
+ length: s,
465
+ idx: i,
466
+ namePath: r.created ? void 0 : o
467
+ }
468
+ }), l = !0), l, l;
469
+ }
470
+ _action_delEmbedding(e) {
471
+ e.actionName = "delEmbedding";
472
+ var t = this.qyCache, i = t.qyEmbeddings, e = e.item;
473
+ let r, n;
474
+ var a, t = t.getInfoFile(e);
475
+ if (t && (a = t.fileContent, a) && (r = a.length, n = a.idx), i.delEmbedding(e.fullPathHash, r, n),
476
+ t) return this._action_delFile({
477
+ item: t
478
+ }), !0;
394
479
  }
395
480
  _action_insert(e) {
396
481
  e.actionName = "insert";
@@ -399,7 +484,7 @@ ${r}
399
484
  content: i,
400
485
  noCreate: r
401
486
  } = e;
402
- if (null == i) return _.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
487
+ if (null == i) return F.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
403
488
  !1;
404
489
  if (!t.created) {
405
490
  if (r) return !1;
@@ -407,15 +492,15 @@ ${r}
407
492
  item: t
408
493
  });
409
494
  }
410
- var n, a, r = l(t.fileContent, i), {
495
+ var n, a, r = o(t.fileContent, i), {
411
496
  merged: i,
412
- delta: o
497
+ delta: s
413
498
  } = r;
414
- return !!o && ({
415
- oldValue: o,
499
+ return !!s && ({
500
+ oldValue: s,
416
501
  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),
502
+ } = s, !!n) && (a = t.fileContentKey, null == i ? I(this, t, y.D, a) : I(this, t, y.M, a, n),
503
+ Object.assign(e, r), N(this, e), t.fileContent = i, P(this, t, s, n, i),
419
504
  !0);
420
505
  }
421
506
  _action_createFile(e) {
@@ -426,7 +511,7 @@ ${r}
426
511
  }), Object.assign(i, {
427
512
  created: !0,
428
513
  fileContentLoaded: !0
429
- }), I(this, e), q(this, t, u.A, t.fileMapKey, i.name), !0);
514
+ }), N(this, e), I(this, t, y.A, t.fileMapKey, i.name), !0);
430
515
  }
431
516
  _action_createDir(e) {
432
517
  e.actionName = "createDir";
@@ -438,12 +523,12 @@ ${r}
438
523
  created: !0,
439
524
  subdirMapLoaded: !0,
440
525
  fileMapLoaded: !0
441
- }), I(this, {
526
+ }), N(this, {
442
527
  actionName: "createDir",
443
528
  item: e
444
529
  });
445
530
  var r = e.parentDir;
446
- q(this, r, u.A, r.subdirMapKey, e.name);
531
+ I(this, r, y.A, r.subdirMapKey, e.name);
447
532
  }
448
533
  return !0;
449
534
  }
@@ -456,7 +541,7 @@ ${r}
456
541
  parentDir: r,
457
542
  name: n
458
543
  } = e;
459
- return !!r && null != (i = T(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
544
+ return !!r && null != (i = S(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
460
545
  (r = this._action_insert({
461
546
  item: r,
462
547
  content: {
@@ -476,7 +561,7 @@ ${r}
476
561
  return !!r && (t = this.qyCache, !!(r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
477
562
  item: r,
478
563
  content: {
479
- [n]: x
564
+ [n]: O
480
565
  }
481
566
  })) && (d(r.fileContent) && this._action_delFile({
482
567
  item: r
@@ -489,13 +574,13 @@ ${r}
489
574
  expireInfoObj: i,
490
575
  isMilliSecond: r
491
576
  } = 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,
577
+ var e = j(i, e => S(e, r, n)), a = this.qyCache, s = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), s = this._action_insert({
578
+ item: s,
494
579
  content: {
495
580
  ...e
496
581
  }
497
582
  });
498
- return o && a.monitorContentExpire(t, e), o;
583
+ return s && a.monitorContentExpire(t, e), s;
499
584
  }
500
585
  _action_removeContentExpire(e) {
501
586
  e.actionName = "removeContentExpire";
@@ -504,7 +589,7 @@ ${r}
504
589
  expireInfoObj: i,
505
590
  infoFileOnly: r
506
591
  } = 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),
592
+ return !!a && (i = g(i) ? Object.fromEntries(i.map(e => [ e, O ])) : j(i, e => e ? O : void 0),
508
593
  (t = this._action_insert({
509
594
  item: a,
510
595
  content: i
@@ -514,15 +599,12 @@ ${r}
514
599
  }
515
600
  }
516
601
 
517
- function N(e, t, i, r) {
518
- return e.actionQueue.push({
519
- actionName: t,
520
- item: i,
521
- ...r
522
- }), e;
602
+ function q(e, t, i) {
603
+ return e.running ? e["_action_" + t](i) : (i.actionName = t, e.actionQueue.push(i)),
604
+ e;
523
605
  }
524
606
 
525
- function I(e, t) {
607
+ function N(e, t) {
526
608
  var {
527
609
  changeList: e,
528
610
  fileLogLevel: i
@@ -546,41 +628,41 @@ function I(e, t) {
546
628
  })(t, i)), e.push(t);
547
629
  }
548
630
 
549
- function q(e, t, i, r, n = void 0) {
631
+ function I(e, t, i, r, n = void 0) {
550
632
  var {
551
633
  qyAclCmdGenerator: e,
552
634
  qyCache: a,
553
- syncList: o,
554
- changeId: s
635
+ syncList: s,
636
+ changeId: o
555
637
  } = 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);
638
+ e.pushCmd(i, r, n), r.startsWith("d") ? t.dChangeId = o : r.startsWith("f") ? t.fChangeId = o : t.cChangeId = o,
639
+ a && a.qyKVData.removeKey(r) && s.push(r, t);
558
640
  }
559
641
 
560
642
  function P(e, t, i, r = void 0, n = void 0) {
561
643
  var {
562
644
  underHiddenFolder: t,
563
645
  name: a,
564
- parentDir: o
646
+ parentDir: s
565
647
  } = t;
566
648
  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);
649
+ var o = e.qyCache.getIndexDir(s);
650
+ if (o) {
651
+ t = o.getFile(b);
652
+ if (t) for (var l of t.qyIndexPropTree.getAllIndexPropPaths()) E(e, o.searchOrCreateSubdir(l), l, a, i, r, n);
571
653
  }
572
654
  }
573
655
  }
574
656
 
575
- function b(t, e, i, r, n, a, o = void 0) {
576
- e = f(e, i, r, n, a, o);
657
+ function E(t, e, i, r, n, a, s = void 0) {
658
+ e = v(e, i, r, n, a, s);
577
659
  if (e) {
578
- var s, l, c, {
660
+ var o, l, c, {
579
661
  toAddFileList: i,
580
662
  toDelFileList: r
581
663
  } = e;
582
- for (s of i) t._action_createFile({
583
- item: s
664
+ for (o of i) t._action_createFile({
665
+ item: o
584
666
  });
585
667
  for (l of r) t._action_delFile({
586
668
  item: l
@@ -594,7 +676,7 @@ function b(t, e, i, r, n, a, o = void 0) {
594
676
  }
595
677
  }
596
678
 
597
- class j {
679
+ class A {
598
680
  maxLength;
599
681
  actionQueue;
600
682
  nextPos;
@@ -622,35 +704,37 @@ class j {
622
704
  }
623
705
  }
624
706
 
625
- function S(e, t = void 0, i = [], r = {}) {
707
+ function j(e, t = void 0, i = [], r = {}) {
626
708
  if (h(e)) {
627
709
  var n = t ? t(e) : e;
628
710
  null != n && (r[JSON.stringify(i)] = n);
629
711
  } else {
630
- var a, o = i.length;
631
- for (a in e) i.push(a), S(e[a], t, i, r), i.length = o;
712
+ var a, s = i.length;
713
+ for (a in e) i.push(a), j(e[a], t, i, r), i.length = s;
632
714
  }
633
715
  return r;
634
716
  }
635
717
 
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;
718
+ function S(e, t, i) {
719
+ return a(e) ? (t ? e : 1e3 * e) + i : l(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !u(e) || (t = e.getTime()) <= i ? void 0 : t;
638
720
  }
639
721
 
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));
642
- return N(e, "expireItem", r, {
722
+ function T(e, t, i, r, n) {
723
+ var a = e.qyCache, r = (l(t) && (t = s(t)), "f" == r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
724
+ return q(e, "expireItem", {
725
+ item: r,
643
726
  milliSecond: i
644
727
  });
645
728
  }
646
729
 
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));
649
- return N(e, "removeItemExpire", i, {
730
+ function M(e, t, i, r, n) {
731
+ var a = e.qyCache, i = (l(t) && (t = s(t)), "f" == i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
732
+ return q(e, "removeItemExpire", {
733
+ item: i,
650
734
  infoFileOnly: r
651
735
  });
652
736
  }
653
737
 
654
738
  export {
655
- L as QyBatch
739
+ Q as QyBatch
656
740
  };