datafolder 1.0.28 → 1.0.29

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
@@ -10,17 +10,16 @@ import {
10
10
  pathSplit as o,
11
11
  ensurePropNamePathList as n,
12
12
  isString as l,
13
- SpecialOperators as e,
14
- getSuffix as f,
15
- SpecialFilePaths as t,
16
- toSingleName as _,
13
+ getSuffix as g,
14
+ SpecialFilePaths as e,
15
+ toSingleName as p,
17
16
  isSimpleType as c,
18
- isEmptyObj as m,
17
+ isEmptyObj as d,
19
18
  isNumber as r,
20
- getNowRounded as d,
19
+ getNowRounded as m,
21
20
  isDate as a,
22
21
  isArray as u,
23
- isFloat32Array as g
22
+ isFloat32Array as f
24
23
  } from "./QyUtils.js";
25
24
 
26
25
  import {
@@ -29,7 +28,7 @@ import {
29
28
  } from "./QyAcl.js";
30
29
 
31
30
  import {
32
- calDifferenceList as p
31
+ calDifferenceList as _
33
32
  } from "./QyIndex.js";
34
33
 
35
34
  import {
@@ -37,25 +36,25 @@ import {
37
36
  } from "./QyDefaultOptions.js";
38
37
 
39
38
  import {
40
- QyCD as y
39
+ QyCD as t
41
40
  } from "./QyCD.js";
42
41
 
43
42
  import {
44
- getPrefixPropPaths as x
43
+ getPrefixPropPaths as y
45
44
  } from "./QyIndexPropTree.js";
46
45
 
47
46
  import {
48
- logger as D
47
+ logger as x
49
48
  } from "./QyLogger.js";
50
49
 
51
- let F = e.$del, O = t.IndexPropPathsFileName, b = {
50
+ let D = e.IndexPropPathsFileName, F = {
52
51
  none: 0,
53
52
  basic: 1,
54
53
  delta: 2,
55
54
  all: 3
56
55
  };
57
56
 
58
- class L extends y {
57
+ class O extends t {
59
58
  fileLogLevel;
60
59
  actionQueue;
61
60
  changeId;
@@ -69,34 +68,34 @@ class L extends y {
69
68
  ...v("QyBatch"),
70
69
  ...t
71
70
  };
72
- e = b[t.fileLogLevel.toLowerCase()];
71
+ e = F[t.fileLogLevel.toLowerCase()];
73
72
  Object.assign(this, {
74
73
  options: t,
75
74
  fileLogLevel: e ?? 1,
76
75
  qyAclCmdGenerator: new i(),
77
- qyCmdObjHistory: new Q(t.maxHistoryCmdObjCount),
76
+ qyCmdObjHistory: new I(t.maxHistoryCmdObjCount),
78
77
  actionQueue: [],
79
78
  changeList: [],
80
79
  syncList: []
81
80
  });
82
81
  }
83
82
  createDir(e, t = this.currentDir) {
84
- return l(e) && (e = o(e)), q(this, this._action_createDir, {
83
+ return l(e) && (e = o(e)), b(this, this._action_createDir, {
85
84
  item: this.qyCache.getOrCreateDir(e, t)
86
85
  });
87
86
  }
88
87
  delDir(e, t = this.currentDir) {
89
- return l(e) && (e = o(e)), q(this, this._action_delDir, {
88
+ return l(e) && (e = o(e)), b(this, this._action_delDir, {
90
89
  item: this.qyCache.getOrCreateDir(e, t).ensureAllLoaded()
91
90
  });
92
91
  }
93
92
  createFile(e, t = this.currentDir) {
94
- return l(e) && (e = o(e)), q(this, this._action_createFile, {
93
+ return l(e) && (e = o(e)), b(this, this._action_createFile, {
95
94
  item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
96
95
  });
97
96
  }
98
97
  delFile(e, t = this.currentDir) {
99
- return l(e) && (e = o(e)), q(this, this._action_delFile, {
98
+ return l(e) && (e = o(e)), b(this, this._action_delFile, {
100
99
  item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
101
100
  });
102
101
  }
@@ -104,18 +103,18 @@ class L extends y {
104
103
  return this.expireFileM(e, 1e3 * t, i);
105
104
  }
106
105
  expireFileM(e, t, i = this.currentDir) {
107
- return T(this, e, t, "f", i);
106
+ return S(this, e, t, "f", i);
108
107
  }
109
108
  expireDir(e, t, i = this.currentDir) {
110
109
  return this.expireDirM(e, 1e3 * t, i);
111
110
  }
112
111
  expireDirM(e, t, i = this.currentDir) {
113
- return T(this, e, t, "d", i);
112
+ return S(this, e, t, "d", i);
114
113
  }
115
114
  expireContent(e, t, i, r = this.currentDir) {
116
115
  l(e) && (e = o(e));
117
116
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
118
- return q(this, this._action_expireContent, {
117
+ return b(this, this._action_expireContent, {
119
118
  item: e,
120
119
  expireInfoObj: t,
121
120
  isMilliSecond: i
@@ -125,15 +124,15 @@ class L extends y {
125
124
  return this.expireContent(e, t, !0, i);
126
125
  }
127
126
  removeFileExpire(e, t = !1, i = this.currentDir) {
128
- return M(this, e, "f", t, i);
127
+ return T(this, e, "f", t, i);
129
128
  }
130
129
  removeDirExpire(e, t = !1, i = this.currentDir) {
131
- return M(this, e, "d", t, i);
130
+ return T(this, e, "d", t, i);
132
131
  }
133
132
  removeContentExpire(e, t, i = !1, r = this.currentDir) {
134
133
  l(e) && (e = o(e));
135
134
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
136
- return q(this, this._action_removeContentExpire, {
135
+ return b(this, this._action_removeContentExpire, {
137
136
  item: e,
138
137
  expireInfoObj: t,
139
138
  infoFileOnly: i
@@ -142,7 +141,7 @@ class L extends y {
142
141
  createIndex(e, t, i = this.currentDir) {
143
142
  l(e) && (e = o(e)), u(t) || (t = [ t ]);
144
143
  e = this.qyCache.getOrCreateDir(e, i);
145
- return q(this, this._action_createIndex, {
144
+ return b(this, this._action_createIndex, {
146
145
  item: e,
147
146
  indexPropPathList: t
148
147
  });
@@ -150,7 +149,7 @@ class L extends y {
150
149
  delIndex(e, t, i = this.currentDir) {
151
150
  l(e) && (e = o(e));
152
151
  e = this.qyCache.getOrCreateDir(e, i);
153
- return q(this, this._action_delIndex, {
152
+ return b(this, this._action_delIndex, {
154
153
  item: e,
155
154
  indexPropPath: t
156
155
  });
@@ -158,48 +157,40 @@ class L extends y {
158
157
  insert(e, t, i = !0, r = !1, n = this.currentDir) {
159
158
  l(e) && (e = o(e));
160
159
  e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
161
- return t = i || c(t) ? t : structuredClone(t), q(this, this._action_insert, {
160
+ return t = i || c(t) ? t : structuredClone(t), b(this, this._action_insert, {
162
161
  item: e,
163
162
  content: t,
164
163
  noCreate: r
165
164
  });
166
165
  }
167
166
  insertEmbedding(e, t, i = this.currentDir) {
168
- var r = this.qyCache, r = (g(t) || (t = new Float32Array(t)), l(e) && (e = o(e)),
167
+ var r = this.qyCache, r = (f(t) || (t = new Float32Array(t)), l(e) && (e = o(e)),
169
168
  r.getOrCreateFile(e, i));
170
- return q(this, this._action_insertEmbedding, {
169
+ return b(this, this._action_insertEmbedding, {
171
170
  item: r,
172
171
  embedding: t
173
172
  });
174
173
  }
175
174
  delEmbedding(e, t = this.currentDir) {
176
175
  var i = this.qyCache, i = (l(e) && (e = o(e)), i.getOrCreateFile(e, t));
177
- return q(this, this._action_delEmbedding, {
176
+ return b(this, this._action_delEmbedding, {
178
177
  item: i
179
178
  });
180
179
  }
181
- insertWithEmbedding(e, t, i, r = !1, n = !1, a = this.currentDir) {
180
+ insertWithEmbedding(e, t, i, r = !0, n = !1, a = this.currentDir) {
182
181
  return this.insert(e, t, r, n, a), this.insertEmbedding(e, i, a);
183
182
  }
184
- put(e, t, i = this.currentDir) {
185
- l(e) && (e = o(e));
186
- e = this.qyCache.getOrCreateFile(e, i).ensureLoaded();
187
- return q(this, this._action_put, {
188
- item: e,
189
- content: t
190
- });
191
- }
192
183
  delContent(e, t = this.currentDir) {
193
184
  l(e) && (e = o(e));
194
185
  e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
195
- return q(this, this._action_delContent, {
186
+ return b(this, this._action_delContent, {
196
187
  item: e
197
188
  });
198
189
  }
199
190
  insertTrigger(e, t, i, r) {
200
191
  l(t) && (t = o(t)), i = n(i);
201
192
  e = this.qyCache.getOrCreateTriggerFile(e);
202
- return q(this, this._action_insertTrigger, {
193
+ return b(this, this._action_insertTrigger, {
203
194
  item: e,
204
195
  fileNamePath: t,
205
196
  propNamePathList: i,
@@ -207,19 +198,19 @@ class L extends y {
207
198
  });
208
199
  }
209
200
  removeTrigger(e) {
210
- return q(this, this._action_removeTrigger, {
201
+ return b(this, this._action_removeTrigger, {
211
202
  item: this.qyCache.getOrCreateTriggerFile(e)
212
203
  });
213
204
  }
214
205
  insertRpc(e, t) {
215
206
  e = this.qyCache.getOrCreateRpcFile(e);
216
- return q(this, this._action_insertRpc, {
207
+ return b(this, this._action_insertRpc, {
217
208
  item: e,
218
209
  modCode: t
219
210
  });
220
211
  }
221
212
  removeRpc(e) {
222
- return q(this, this._action_removeRpc, {
213
+ return b(this, this._action_removeRpc, {
223
214
  item: this.qyCache.getOrCreateRpcFile(e)
224
215
  });
225
216
  }
@@ -242,7 +233,7 @@ class L extends y {
242
233
  syncList: l
243
234
  } = this, c = i.length;
244
235
  if (0 == c) return n.decreaseChangeId(), 0;
245
- var h = f(c), o = o.takeCmdArgAsListObj();
236
+ var h = g(c), o = o.takeCmdArgAsListObj();
246
237
  let d;
247
238
  0 < r && (r = i.map(({
248
239
  logStr: e
@@ -265,7 +256,7 @@ ${r}
265
256
  for ({
266
257
  item: m,
267
258
  delta: u
268
- } of h) for (var g of m.triggerNodes) g.checkTrigger(m, u);
259
+ } of h) for (var f of m.triggerNodes) f.checkTrigger(m, u);
269
260
  return e ? c : t;
270
261
  }
271
262
  getTopHistoryCmdObj() {
@@ -273,30 +264,30 @@ ${r}
273
264
  }
274
265
  _action_insertTrigger(e) {
275
266
  e.actionName = "insertTrigger";
276
- var t, {
267
+ var {
277
268
  item: e,
278
- fileNamePath: i,
279
- propNamePathList: r,
280
- modCode: n
269
+ fileNamePath: t,
270
+ propNamePathList: i,
271
+ modCode: r
281
272
  } = e, {
282
- name: a,
283
- fileContent: o
284
- } = e, o = o && o[0], e = this._action_insert({
273
+ name: n,
274
+ fileContent: a
275
+ } = e, a = a && a[0], o = [ t, i ], e = (r && o.push(r), this._action_insert({
285
276
  item: e,
286
- content: [ i, r, n ]
287
- });
288
- return e && (t = this.qyCache, o && !h(o, i) && t.removeTriggerFromTree(a, o),
289
- t.insertTriggerToTree(a, i, r, n)), e;
277
+ content: o
278
+ }));
279
+ return e && (o = this.qyCache, a && !h(a, t) && o.removeTriggerFromTree(n, a),
280
+ o.insertTriggerToTree(n, t, i, r)), e;
290
281
  }
291
282
  _action_removeTrigger(e) {
292
283
  e.actionName = "removeTrigger";
293
284
  var e = e.item, {
294
285
  fileContent: t,
295
286
  name: i
296
- } = e;
297
- return !!this._action_delFile({
287
+ } = e, e = this._action_delFile({
298
288
  item: e
299
- }) && (this.qyCache.removeTriggerFromTree(i, t[0]), !0);
289
+ });
290
+ return e && this.qyCache.removeTriggerFromTree(i, t[0]), e;
300
291
  }
301
292
  _action_insertRpc(e) {
302
293
  e.actionName = "insertRpc";
@@ -321,36 +312,36 @@ ${r}
321
312
  var e, {
322
313
  item: t,
323
314
  indexPropPathList: i
324
- } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(O), {
315
+ } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(D), {
325
316
  fileContent: a,
326
317
  qyIndexPropTree: o
327
318
  } = (n.created || this._action_createFile({
328
319
  item: n
329
320
  }), n), s = [], l = {};
330
321
  for (e of i) {
331
- var c = _(e);
322
+ var c = p(e);
332
323
  a && a[c] || (s.push(e), l[c] = 1, o.insert(e));
333
324
  }
334
325
  if (0 != s.length) {
335
- D.log(`Creating index ${JSON.stringify(s)} for ` + t.fullPath), this._action_insert({
326
+ x.log(`Creating index ${JSON.stringify(s)} for ` + t.fullPath), this._action_insert({
336
327
  item: n,
337
328
  content: l
338
329
  });
339
330
  {
340
- var h, d = this, m = t, u = r, i = x(s);
331
+ var h, d = this, m = t, u = r, i = y(s);
341
332
  let e;
342
333
  for (h of i) {
343
- var g = u.searchOrCreateSubdir(h);
344
- if (!g.created) {
334
+ var f = u.searchOrCreateSubdir(h);
335
+ if (!f.created) {
345
336
  d._action_createDir({
346
- item: g
337
+ item: f
347
338
  });
348
- for (var f of e = e || m.fileList) {
339
+ for (var g of e = e || m.fileList) {
349
340
  var {
350
- fileContent: f,
341
+ fileContent: g,
351
342
  name: C
352
- } = f;
353
- null != f && E(d, g, h, C, void 0, f);
343
+ } = g;
344
+ null != g && N(d, f, h, C, void 0, g);
354
345
  }
355
346
  }
356
347
  }
@@ -363,12 +354,8 @@ ${r}
363
354
  item: e,
364
355
  indexPropPath: r
365
356
  } = e, e = this.qyCache.getIndexDir(e);
366
- e && ((i = e.getFile(O)) ? (t = i.qyIndexPropTree, this._action_insert({
367
- item: i,
368
- content: {
369
- [_(r)]: F
370
- }
371
- }), t.remove(r).hasPrefix || (i = e.getSubdir(r)) && this._action_delDir({
357
+ e && ((i = e.getFile(D)) ? (t = i.qyIndexPropTree, this._setProp(i, p(r), null),
358
+ t.remove(r).hasPrefix || (i = e.getSubdir(r)) && this._action_delDir({
372
359
  item: i
373
360
  })) : this._action_delDir({
374
361
  item: e
@@ -385,7 +372,7 @@ ${r}
385
372
  parentDir: r,
386
373
  name: n
387
374
  } = i;
388
- return i.created = !1, N(this, e), t || I(this, r, C.R, r.fileMapKey, n),
375
+ return i.created = !1, P(this, e), t || L(this, r, C.R, r.fileMapKey, n),
389
376
  !0;
390
377
  }
391
378
  _action_delDir(e) {
@@ -401,13 +388,13 @@ ${r}
401
388
  fileMapKey: s
402
389
  } = t;
403
390
  if (a) {
404
- I(this, t, C.D, s);
391
+ L(this, t, C.D, s);
405
392
  for (var l of t.fileList) this._action_delFile({
406
393
  item: l
407
394
  }, !0);
408
395
  }
409
396
  if (n) {
410
- I(this, t, C.D, o);
397
+ L(this, t, C.D, o);
411
398
  for (var c of t.allSubdirs()) {
412
399
  let {
413
400
  subdirMap: e,
@@ -415,19 +402,19 @@ ${r}
415
402
  subdirMapKey: i,
416
403
  fileMapKey: r
417
404
  } = c;
418
- if (e && I(this, c, C.D, i), t) {
419
- I(this, c, C.D, r);
405
+ if (e && L(this, c, C.D, i), t) {
406
+ L(this, c, C.D, r);
420
407
  for (var h of c.fileList) this._action_delFile({
421
408
  item: h
422
409
  }, !0);
423
410
  }
424
- N(this, {
411
+ P(this, {
425
412
  actionName: "delDir",
426
413
  item: c
427
414
  }), c.created = !1;
428
415
  }
429
416
  }
430
- return !!i && (t.created = !1, N(this, e), I(this, i, C.R, i.subdirMapKey, r),
417
+ return !!i && (t.created = !1, P(this, e), L(this, i, C.R, i.subdirMapKey, r),
431
418
  !0);
432
419
  }
433
420
  _action_delContent(e) {
@@ -437,9 +424,9 @@ ${r}
437
424
  content: i,
438
425
  delta: {
439
426
  oldValue: i,
440
- newValue: F
427
+ newValue: null
441
428
  }
442
- }), N(this, e), I(this, t, C.D, t.fileContentKey), P(this, t, i), !0);
429
+ }), P(this, e), L(this, t, C.D, t.fileContentKey), q(this, t, i), !0);
443
430
  }
444
431
  _action_insertEmbedding(e) {
445
432
  e.actionName = "insertEmbedding";
@@ -449,12 +436,8 @@ ${r}
449
436
  } = e, s = o.length, r = r.getOrCreateInfoFile(a), l = r.fileContent;
450
437
  let c = !1;
451
438
  return r.created && l.length == s ? (t = a.fullPathHash, l = l.idx, i = n.getEmbedding(t, s, l),
452
- h(o, i) || ((i = n.updateEmbedding(t, o, l)) != l && this._action_insert({
453
- item: r,
454
- content: {
455
- idx: i
456
- }
457
- }), c = !0)) : ({
439
+ h(o, i) || ((i = n.updateEmbedding(t, o, l)) != l && this._setProp(r, "idx", i),
440
+ c = !0)) : ({
458
441
  fullPathHash: t,
459
442
  namePath: l
460
443
  } = a, i = n.addEmbedding(t, o), this._action_insert({
@@ -464,7 +447,7 @@ ${r}
464
447
  idx: i,
465
448
  namePath: r.created ? void 0 : l
466
449
  }
467
- }), c = !0), c && N(this, e), c;
450
+ }), c = !0), c && P(this, e), c;
468
451
  }
469
452
  _action_delEmbedding(e) {
470
453
  e.actionName = "delEmbedding";
@@ -474,7 +457,7 @@ ${r}
474
457
  if (t && (o = t.fileContent, o) && (n = o.length, a = o.idx), i.delEmbedding(r.fullPathHash, n, a),
475
458
  t) return this._action_delFile({
476
459
  item: t
477
- }), N(this, e), !0;
460
+ }), P(this, e), !0;
478
461
  }
479
462
  _action_put(e) {
480
463
  e.actionName = "put";
@@ -482,40 +465,55 @@ ${r}
482
465
  item: t,
483
466
  content: i
484
467
  } = e;
485
- if (null == i) return D.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
468
+ if (null == i) return x.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
486
469
  !1;
487
470
  t.created || this._action_createFile({
488
471
  item: t
489
472
  });
490
473
  var r = t.fileContentKey;
491
- return i.$rpl = 1, I(this, t, C.M, r, i), N(this, e), t.fileContent = i,
474
+ return i.$rpl = 1, L(this, t, C.M, r, i), P(this, e), t.fileContent = i,
492
475
  !0;
493
476
  }
477
+ _setProp(e, t, i) {
478
+ var {
479
+ created: r,
480
+ fileContentKey: n,
481
+ fileContent: a
482
+ } = e, r = (r || this._action_createFile({
483
+ item: e
484
+ }), a ? a[t] : void 0);
485
+ return null === i ? null != a && delete a[t] : null != a ? a[t] = i : e.fileContent = {
486
+ [t]: i
487
+ }, L(this, e, C.M, n, t, i), r;
488
+ }
494
489
  _action_insert(e) {
495
490
  e.actionName = "insert";
496
- var {
497
- item: t,
498
- content: i,
499
- noCreate: r
491
+ var t, {
492
+ item: i,
493
+ content: r,
494
+ noCreate: n
500
495
  } = e;
501
- if (null == i) return D.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
496
+ let {
497
+ merged: a,
498
+ delta: o
499
+ } = e;
500
+ if (null == o && void 0 === r) return x.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
502
501
  !1;
503
- if (!t.created) {
504
- if (r) return !1;
502
+ if (!i.created) {
503
+ if (n) return !1;
505
504
  this._action_createFile({
506
- item: t
505
+ item: i
507
506
  });
508
507
  }
509
- var n, a, r = s(t.fileContent, i), {
510
- merged: i,
511
- delta: o
512
- } = r;
513
- return !!o && ({
514
- oldValue: o,
508
+ return null == a && null == o && (n = s(i.fileContent, r), a = n.merged,
509
+ o = n.delta), null != o && ({
510
+ oldValue: r,
515
511
  newValue: n
516
- } = o, a = t.fileContentKey, null == i ? I(this, t, C.D, a) : I(this, t, C.M, a, n),
517
- Object.assign(e, r), N(this, e), t.fileContent = i, P(this, t, o, n, i),
518
- !0);
512
+ } = o, t = i.fileContentKey, null == a ? L(this, i, C.D, t) : L(this, i, C.M, t, n),
513
+ Object.assign(e, {
514
+ merged: a,
515
+ delta: o
516
+ }), P(this, e), i.fileContent = a, q(this, i, r, n, a), !0);
519
517
  }
520
518
  _action_createFile(e) {
521
519
  e.actionName = "createFile";
@@ -525,7 +523,7 @@ ${r}
525
523
  }), Object.assign(i, {
526
524
  created: !0,
527
525
  fileContentLoaded: !0
528
- }), N(this, e), I(this, t, C.A, t.fileMapKey, i.name), !0);
526
+ }), P(this, e), L(this, t, C.A, t.fileMapKey, i.name), !0);
529
527
  }
530
528
  _action_createDir(e) {
531
529
  e.actionName = "createDir";
@@ -537,12 +535,12 @@ ${r}
537
535
  created: !0,
538
536
  subdirMapLoaded: !0,
539
537
  fileMapLoaded: !0
540
- }), N(this, {
538
+ }), P(this, {
541
539
  actionName: "createDir",
542
540
  item: e
543
541
  });
544
542
  var r = e.parentDir;
545
- I(this, r, C.A, r.subdirMapKey, e.name);
543
+ L(this, r, C.A, r.subdirMapKey, e.name);
546
544
  }
547
545
  return !0;
548
546
  }
@@ -555,7 +553,7 @@ ${r}
555
553
  parentDir: r,
556
554
  name: n
557
555
  } = e;
558
- return !!r && null != (i = S(i, !0, d())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
556
+ return !!r && null != (i = j(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
559
557
  (r = this._action_insert({
560
558
  item: r,
561
559
  content: {
@@ -575,9 +573,9 @@ ${r}
575
573
  return !!r && (t = this.qyCache, !!(r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
576
574
  item: r,
577
575
  content: {
578
- [n]: F
576
+ [n]: null
579
577
  }
580
- })) && (m(r.fileContent) && this._action_delFile({
578
+ })) && (d(r.fileContent) && this._action_delFile({
581
579
  item: r
582
580
  }), i || t.unmonitorItemExpire(e)), n);
583
581
  }
@@ -587,8 +585,8 @@ ${r}
587
585
  item: t,
588
586
  expireInfoObj: i,
589
587
  isMilliSecond: r
590
- } = e, n = d();
591
- var e = j(i, e => S(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
588
+ } = e, n = m();
589
+ var e = E(i, e => j(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
592
590
  item: o,
593
591
  content: {
594
592
  ...e
@@ -603,22 +601,22 @@ ${r}
603
601
  expireInfoObj: i,
604
602
  infoFileOnly: r
605
603
  } = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
606
- return !!a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, F ])) : j(i, e => e ? F : void 0),
604
+ return !!a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) : E(i, e => e ? null : void 0),
607
605
  (t = this._action_insert({
608
606
  item: a,
609
607
  content: i
610
- })) && (m(a.fileContent) && this._action_delFile({
608
+ })) && (d(a.fileContent, !0) && this._action_delFile({
611
609
  item: a
612
610
  }), r || n.unmonitorContentExpire(e, i)), t);
613
611
  }
614
612
  }
615
613
 
616
- function q(e, t, i) {
614
+ function b(e, t, i) {
617
615
  return e.running ? t.call(e, i) : (i.actionFun = t, e.actionQueue.push(i)),
618
616
  e;
619
617
  }
620
618
 
621
- function N(e, t) {
619
+ function P(e, t) {
622
620
  var {
623
621
  changeList: e,
624
622
  fileLogLevel: i
@@ -642,66 +640,55 @@ function N(e, t) {
642
640
  })(t, i)), e.push(t);
643
641
  }
644
642
 
645
- function I(e, t, i, r, n = void 0) {
643
+ function L(e, t, i, r, n = void 0, a = void 0) {
646
644
  var {
647
645
  qyAclCmdGenerator: e,
648
- qyCache: a,
649
- syncList: o,
650
- changeId: s
646
+ qyCache: o,
647
+ syncList: s,
648
+ changeId: l
651
649
  } = e;
652
- e.pushCmd(i, r, n), r.startsWith("d") ? t.dChangeId = s : r.startsWith("f") ? t.fChangeId = s : t.cChangeId = s,
653
- a && a.qyKVData.removeKey(r) && o.push(r, t);
650
+ e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = l : r.startsWith("f") ? t.fChangeId = l : t.cChangeId = l,
651
+ o && o.qyKVData.removeKey(r) && s.push(r, t);
654
652
  }
655
653
 
656
- function P(e, t, i, r = void 0, n = void 0) {
657
- var {
658
- underHiddenFolder: t,
659
- name: a,
660
- parentDir: o
661
- } = t;
662
- if (!t) {
663
- var s = e.qyCache.getIndexDir(o);
664
- if (s) {
665
- t = s.getFile(O);
666
- if (t) for (var l of t.qyIndexPropTree.getAllIndexPropPaths()) E(e, s.searchOrCreateSubdir(l), l, a, i, r, n);
654
+ function q(e, t, i, r = void 0, n = void 0) {
655
+ if (!t.underHiddenFolder) {
656
+ var a = e.qyCache.getIndexDir(t.parentDir);
657
+ if (a) {
658
+ var o = a.getFile(D);
659
+ if (o) {
660
+ var s, l = t.name;
661
+ for (s of o.qyIndexPropTree.getAllIndexPropPaths()) N(e, a.searchOrCreateSubdir(s), s, l, i, r, n);
662
+ }
667
663
  }
668
664
  }
669
665
  }
670
666
 
671
- function E(t, e, i, r, n, a, o = void 0) {
672
- e = p(e, i, n, a, o);
667
+ function N(t, e, i, r, n, a, o = void 0) {
668
+ e = _(e, i, n, a, o);
673
669
  if (e) {
674
670
  var s, l, c, {
675
671
  toAddFileList: i,
676
672
  toDelFileList: n
677
673
  } = e;
678
- for (s of i) {
679
- var h = s.fileContent ?? {};
680
- h[r] = 1, t._action_insert({
681
- item: s,
682
- content: h
683
- });
684
- }
685
- for (l of n) {
686
- var d = l.fileContent;
687
- null != d && Object.hasOwn(d, r) && (delete d[r], t._action_insert({
688
- item: l,
689
- content: d
690
- }));
691
- }
692
- for (c of n) if (m(c.fileContent)) {
693
- t._action_delFile({
694
- item: c
695
- });
696
- let e = c.parentDir;
697
- for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
698
- item: e
699
- }), e = e.parentDir;
674
+ for (s of i) t._setProp(s, r, 1);
675
+ for (l of n) l.created && t._setProp(l, r, null);
676
+ for (c of n) if (c.created) {
677
+ var h = c.fileContent;
678
+ if (null == h || d(h)) {
679
+ t._action_delFile({
680
+ item: c
681
+ });
682
+ let e = c.parentDir;
683
+ for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
684
+ item: e
685
+ }), e = e.parentDir;
686
+ }
700
687
  }
701
688
  }
702
689
  }
703
690
 
704
- class Q {
691
+ class I {
705
692
  maxLength;
706
693
  actionQueue;
707
694
  nextPos;
@@ -729,37 +716,37 @@ class Q {
729
716
  }
730
717
  }
731
718
 
732
- function j(e, t = void 0, i = [], r = {}) {
719
+ function E(e, t = void 0, i = [], r = {}) {
733
720
  if (c(e)) {
734
721
  var n = t ? t(e) : e;
735
- null != n && (r[JSON.stringify(i)] = n);
722
+ void 0 !== n && (r[JSON.stringify(i)] = n);
736
723
  } else {
737
724
  var a, o = i.length;
738
- for (a in e) i.push(a), j(e[a], t, i, r), i.length = o;
725
+ for (a in e) i.push(a), E(e[a], t, i, r), i.length = o;
739
726
  }
740
727
  return r;
741
728
  }
742
729
 
743
- function S(e, t, i) {
730
+ function j(e, t, i) {
744
731
  return r(e) ? (t ? e : 1e3 * e) + i : l(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !a(e) || (t = e.getTime()) <= i ? void 0 : t;
745
732
  }
746
733
 
747
- function T(e, t, i, r, n) {
734
+ function S(e, t, i, r, n) {
748
735
  var a = e.qyCache, r = (l(t) && (t = o(t)), "f" == r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
749
- return q(e, e._action_expireItem, {
736
+ return b(e, e._action_expireItem, {
750
737
  item: r,
751
738
  milliSecond: i
752
739
  });
753
740
  }
754
741
 
755
- function M(e, t, i, r, n) {
742
+ function T(e, t, i, r, n) {
756
743
  var a = e.qyCache, i = (l(t) && (t = o(t)), "f" == i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
757
- return q(e, e._action_removeItemExpire, {
744
+ return b(e, e._action_removeItemExpire, {
758
745
  item: i,
759
746
  infoFileOnly: r
760
747
  });
761
748
  }
762
749
 
763
750
  export {
764
- L as QyBatch
751
+ O as QyBatch
765
752
  };