datafolder 1.0.29 → 1.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/ChangeLog.md +2 -0
  2. package/package.json +4 -4
  3. package/scripts/airbnb.js +3 -3
  4. package/scripts/airbnb2.js +3 -3
  5. package/scripts/airbnb_queries.js +6 -6
  6. package/scripts/convertBinFiles.js +2 -2
  7. package/scripts/fastify.js +4 -2
  8. package/scripts/flights.js +1 -1
  9. package/scripts/flights2.js +1 -1
  10. package/scripts/flights2_queries.js +6 -6
  11. package/scripts/flights_queries.js +6 -6
  12. package/src/QyAcl.js +87 -91
  13. package/src/QyBatch.d.ts +6 -4
  14. package/src/QyBatch.js +163 -188
  15. package/src/QyBinWriter.js +14 -17
  16. package/src/QyBinaryHeap.js +2 -2
  17. package/src/QyCD.js +36 -36
  18. package/src/QyCache.js +1 -1
  19. package/src/QyCompressor.js +2 -2
  20. package/src/QyDB.js +1 -1
  21. package/src/QyDir.js +12 -12
  22. package/src/QyEmbeddingWriter.js +2 -2
  23. package/src/QyEmbeddings.js +18 -18
  24. package/src/QyExpire.d.ts +1 -1
  25. package/src/QyExpire.js +5 -7
  26. package/src/QyExpireInfo.js +32 -32
  27. package/src/QyExpire_Worker.js +38 -39
  28. package/src/QyFile.js +73 -73
  29. package/src/QyFileContentUtils.js +100 -100
  30. package/src/QyFileLogger.js +1 -1
  31. package/src/QyIndex.d.ts +1 -4
  32. package/src/QyIndex.js +145 -154
  33. package/src/QyIndexPropTree.d.ts +22 -9
  34. package/src/QyIndexPropTree.js +66 -70
  35. package/src/QyIntersectNode.js +8 -10
  36. package/src/QyItem.js +28 -28
  37. package/src/QyKVData.js +42 -47
  38. package/src/QyKVDataCleaner_Worker.js +40 -40
  39. package/src/QyKVDataSaver_Worker.js +5 -7
  40. package/src/QyMessageWorker.js +1 -1
  41. package/src/QyMessager.js +5 -5
  42. package/src/QyOpRunner.js +2 -2
  43. package/src/QySaver.js +21 -21
  44. package/src/QySnapshotCompactor_Worker.js +12 -21
  45. package/src/QySnapshotSaver_Worker.js +2 -2
  46. package/src/QySnapshots.js +79 -89
  47. package/src/QyStructure.js +7 -7
  48. package/src/QyTrigger.js +11 -16
  49. package/src/QyUnionNode.js +2 -2
  50. package/src/QyUtils.d.ts +0 -4
  51. package/src/QyUtils.js +70 -98
  52. package/src/hackernews.js +77 -59
  53. package/src/rpc/getFileContent.js +5 -4
  54. package/src/rpc/getSubItems.js +7 -5
  55. package/src/simulate.js +4 -4
  56. package/src/simulate2.js +3 -3
  57. package/src/soc_pokec.js +1 -1
  58. package/static/codemirror.bundle/editor.bundle.js +70 -37
  59. package/test/testQyAQL.js +23 -23
package/src/QyBatch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {
2
- isDeepStrictEqual as h
2
+ isDeepStrictEqual as d
3
3
  } from "node:util";
4
4
 
5
5
  import {
@@ -9,12 +9,12 @@ import {
9
9
  import {
10
10
  pathSplit as o,
11
11
  ensurePropNamePathList as n,
12
- isString as l,
12
+ isString as h,
13
13
  getSuffix as g,
14
14
  SpecialFilePaths as e,
15
- toSingleName as p,
16
- isSimpleType as c,
17
- isEmptyObj as d,
15
+ toSingleName as _,
16
+ isSimpleType as l,
17
+ isEmptyObj as c,
18
18
  isNumber as r,
19
19
  getNowRounded as m,
20
20
  isDate as a,
@@ -23,79 +23,68 @@ import {
23
23
  } from "./QyUtils.js";
24
24
 
25
25
  import {
26
- QyAclCmdGenerator as i,
27
- CmdNames as C
26
+ QyAclCmdGenerator as t,
27
+ CmdNames as p
28
28
  } from "./QyAcl.js";
29
29
 
30
30
  import {
31
- calDifferenceList as _
31
+ calDifferenceList as C
32
32
  } from "./QyIndex.js";
33
33
 
34
34
  import {
35
- getDefaultOptions as v
35
+ getDefaultOptions as i
36
36
  } from "./QyDefaultOptions.js";
37
37
 
38
38
  import {
39
- QyCD as t
39
+ QyCD as v
40
40
  } from "./QyCD.js";
41
41
 
42
42
  import {
43
- getPrefixPropPaths as y
44
- } from "./QyIndexPropTree.js";
45
-
46
- import {
47
- logger as x
43
+ logger as y
48
44
  } from "./QyLogger.js";
49
45
 
50
- let D = e.IndexPropPathsFileName, F = {
46
+ let x = e.IndexPropPathsFileName, D = {
51
47
  none: 0,
52
48
  basic: 1,
53
49
  delta: 2,
54
50
  all: 3
55
51
  };
56
52
 
57
- class O extends t {
53
+ class F extends v {
58
54
  fileLogLevel;
59
- actionQueue;
60
55
  changeId;
61
- changeList;
62
- syncList;
63
- qyAclCmdGenerator;
56
+ actionQueue = [];
57
+ changeList = [];
58
+ syncList = [];
64
59
  qyCmdObjHistory;
65
60
  running;
61
+ qyAclCmdGenerator = new t();
62
+ options;
66
63
  constructor(e, t) {
67
64
  super(e), t = {
68
- ...v("QyBatch"),
65
+ ...i("QyBatch"),
69
66
  ...t
70
67
  };
71
- e = F[t.fileLogLevel.toLowerCase()];
72
- Object.assign(this, {
73
- options: t,
74
- fileLogLevel: e ?? 1,
75
- qyAclCmdGenerator: new i(),
76
- qyCmdObjHistory: new I(t.maxHistoryCmdObjCount),
77
- actionQueue: [],
78
- changeList: [],
79
- syncList: []
80
- });
68
+ e = D[t.fileLogLevel.toLowerCase()];
69
+ this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new b(t.maxHistoryCmdObjCount);
81
70
  }
82
71
  createDir(e, t = this.currentDir) {
83
- return l(e) && (e = o(e)), b(this, this._action_createDir, {
72
+ return h(e) && (e = o(e)), O(this, this._action_createDir, {
84
73
  item: this.qyCache.getOrCreateDir(e, t)
85
74
  });
86
75
  }
87
76
  delDir(e, t = this.currentDir) {
88
- return l(e) && (e = o(e)), b(this, this._action_delDir, {
77
+ return h(e) && (e = o(e)), O(this, this._action_delDir, {
89
78
  item: this.qyCache.getOrCreateDir(e, t).ensureAllLoaded()
90
79
  });
91
80
  }
92
81
  createFile(e, t = this.currentDir) {
93
- return l(e) && (e = o(e)), b(this, this._action_createFile, {
82
+ return h(e) && (e = o(e)), O(this, this._action_createFile, {
94
83
  item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
95
84
  });
96
85
  }
97
86
  delFile(e, t = this.currentDir) {
98
- return l(e) && (e = o(e)), b(this, this._action_delFile, {
87
+ return h(e) && (e = o(e)), O(this, this._action_delFile, {
99
88
  item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
100
89
  });
101
90
  }
@@ -112,9 +101,9 @@ class O extends t {
112
101
  return S(this, e, t, "d", i);
113
102
  }
114
103
  expireContent(e, t, i, r = this.currentDir) {
115
- l(e) && (e = o(e));
104
+ h(e) && (e = o(e));
116
105
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
117
- return b(this, this._action_expireContent, {
106
+ return O(this, this._action_expireContent, {
118
107
  item: e,
119
108
  expireInfoObj: t,
120
109
  isMilliSecond: i
@@ -130,50 +119,50 @@ class O extends t {
130
119
  return T(this, e, "d", t, i);
131
120
  }
132
121
  removeContentExpire(e, t, i = !1, r = this.currentDir) {
133
- l(e) && (e = o(e));
122
+ h(e) && (e = o(e));
134
123
  e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
135
- return b(this, this._action_removeContentExpire, {
124
+ return O(this, this._action_removeContentExpire, {
136
125
  item: e,
137
126
  expireInfoObj: t,
138
127
  infoFileOnly: i
139
128
  });
140
129
  }
141
130
  createIndex(e, t, i = this.currentDir) {
142
- l(e) && (e = o(e)), u(t) || (t = [ t ]);
131
+ h(e) && (e = o(e)), u(t) || (t = [ t ]);
143
132
  e = this.qyCache.getOrCreateDir(e, i);
144
- return b(this, this._action_createIndex, {
133
+ return O(this, this._action_createIndex, {
145
134
  item: e,
146
135
  indexPropPathList: t
147
136
  });
148
137
  }
149
138
  delIndex(e, t, i = this.currentDir) {
150
- l(e) && (e = o(e));
139
+ h(e) && (e = o(e));
151
140
  e = this.qyCache.getOrCreateDir(e, i);
152
- return b(this, this._action_delIndex, {
141
+ return O(this, this._action_delIndex, {
153
142
  item: e,
154
143
  indexPropPath: t
155
144
  });
156
145
  }
157
146
  insert(e, t, i = !0, r = !1, n = this.currentDir) {
158
- l(e) && (e = o(e));
147
+ h(e) && (e = o(e));
159
148
  e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
160
- return t = i || c(t) ? t : structuredClone(t), b(this, this._action_insert, {
149
+ return t = i || l(t) ? t : structuredClone(t), O(this, this._action_insert, {
161
150
  item: e,
162
151
  content: t,
163
152
  noCreate: r
164
153
  });
165
154
  }
166
155
  insertEmbedding(e, t, i = this.currentDir) {
167
- var r = this.qyCache, r = (f(t) || (t = new Float32Array(t)), l(e) && (e = o(e)),
156
+ var r = this.qyCache, r = (f(t) || (t = new Float32Array(t)), h(e) && (e = o(e)),
168
157
  r.getOrCreateFile(e, i));
169
- return b(this, this._action_insertEmbedding, {
158
+ return O(this, this._action_insertEmbedding, {
170
159
  item: r,
171
160
  embedding: t
172
161
  });
173
162
  }
174
163
  delEmbedding(e, t = this.currentDir) {
175
- var i = this.qyCache, i = (l(e) && (e = o(e)), i.getOrCreateFile(e, t));
176
- return b(this, this._action_delEmbedding, {
164
+ var i = this.qyCache, i = (h(e) && (e = o(e)), i.getOrCreateFile(e, t));
165
+ return O(this, this._action_delEmbedding, {
177
166
  item: i
178
167
  });
179
168
  }
@@ -181,16 +170,16 @@ class O extends t {
181
170
  return this.insert(e, t, r, n, a), this.insertEmbedding(e, i, a);
182
171
  }
183
172
  delContent(e, t = this.currentDir) {
184
- l(e) && (e = o(e));
173
+ h(e) && (e = o(e));
185
174
  e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
186
- return b(this, this._action_delContent, {
175
+ return O(this, this._action_delContent, {
187
176
  item: e
188
177
  });
189
178
  }
190
179
  insertTrigger(e, t, i, r) {
191
- l(t) && (t = o(t)), i = n(i);
180
+ h(t) && (t = o(t)), i = n(i);
192
181
  e = this.qyCache.getOrCreateTriggerFile(e);
193
- return b(this, this._action_insertTrigger, {
182
+ return O(this, this._action_insertTrigger, {
194
183
  item: e,
195
184
  fileNamePath: t,
196
185
  propNamePathList: i,
@@ -198,19 +187,19 @@ class O extends t {
198
187
  });
199
188
  }
200
189
  removeTrigger(e) {
201
- return b(this, this._action_removeTrigger, {
190
+ return O(this, this._action_removeTrigger, {
202
191
  item: this.qyCache.getOrCreateTriggerFile(e)
203
192
  });
204
193
  }
205
194
  insertRpc(e, t) {
206
195
  e = this.qyCache.getOrCreateRpcFile(e);
207
- return b(this, this._action_insertRpc, {
196
+ return O(this, this._action_insertRpc, {
208
197
  item: e,
209
198
  modCode: t
210
199
  });
211
200
  }
212
201
  removeRpc(e) {
213
- return b(this, this._action_removeRpc, {
202
+ return O(this, this._action_removeRpc, {
214
203
  item: this.qyCache.getOrCreateRpcFile(e)
215
204
  });
216
205
  }
@@ -221,7 +210,7 @@ class O extends t {
221
210
  fileLogLevel: r,
222
211
  qyCache: n
223
212
  } = this;
224
- if (t || 0 == i.length) return 0;
213
+ if (t || 0 === i.length) return 0;
225
214
  this.running = !0;
226
215
  var a, t = this.changeId = n.increaseChangeId();
227
216
  for (a of i) a.actionFun.call(this, a);
@@ -230,17 +219,17 @@ class O extends t {
230
219
  changeList: i,
231
220
  qyAclCmdGenerator: o,
232
221
  qyCmdObjHistory: s,
233
- syncList: l
234
- } = this, c = i.length;
235
- if (0 == c) return n.decreaseChangeId(), 0;
236
- var h = g(c), o = o.takeCmdArgAsListObj();
237
- let d;
222
+ syncList: h
223
+ } = this, l = i.length;
224
+ if (0 === l) return n.decreaseChangeId(), 0;
225
+ var d = g(l), o = o.takeCmdArgAsListObj();
226
+ let c;
238
227
  0 < r && (r = i.map(({
239
228
  logStr: e
240
- }) => e).join("\n"), d = new Date().toISOString() + `: ${c} change${h}:
229
+ }) => e).join("\n"), c = new Date().toISOString() + `: ${l} change${d}:
241
230
  ${r}
242
231
  `);
243
- var m, u, c = n.save(t, o, d, (e => {
232
+ var m, u, l = n.save(t, o, c, (e => {
244
233
  var t = e.syncList, i = t.length;
245
234
  for (let e = 0; e < i; e += 2) {
246
235
  var r, n = e + 1, a = t[e], o = t[n];
@@ -248,7 +237,7 @@ ${r}
248
237
  t[n] = 0 < r.length ? r : void 0) : t[n] = o.fileContent;
249
238
  }
250
239
  if (0 < i) return t;
251
- })(this), e), h = (l.length = 0, s.push(o), i.filter(({
240
+ })(this), e), d = (h.length = 0, s.push(o), i.filter(({
252
241
  item: e,
253
242
  delta: t
254
243
  }) => t && 0 < e.triggerNodes?.length));
@@ -256,8 +245,8 @@ ${r}
256
245
  for ({
257
246
  item: m,
258
247
  delta: u
259
- } of h) for (var f of m.triggerNodes) f.checkTrigger(m, u);
260
- return e ? c : t;
248
+ } of d) for (var f of m.triggerNodes) f.checkTrigger(m, u);
249
+ return e ? l : t;
261
250
  }
262
251
  getTopHistoryCmdObj() {
263
252
  return this.qyCmdObjHistory.top();
@@ -276,7 +265,7 @@ ${r}
276
265
  item: e,
277
266
  content: o
278
267
  }));
279
- return e && (o = this.qyCache, a && !h(a, t) && o.removeTriggerFromTree(n, a),
268
+ return e && (o = this.qyCache, a && !d(a, t) && o.removeTriggerFromTree(n, a),
280
269
  o.insertTriggerToTree(n, t, i, r)), e;
281
270
  }
282
271
  _action_removeTrigger(e) {
@@ -312,36 +301,36 @@ ${r}
312
301
  var e, {
313
302
  item: t,
314
303
  indexPropPathList: i
315
- } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(D), {
316
- fileContent: a,
317
- qyIndexPropTree: o
318
- } = (n.created || this._action_createFile({
304
+ } = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(x), a = (n.created || this._action_createFile({
319
305
  item: n
320
- }), n), s = [], l = {};
306
+ }), n).qyIndexPropTree, o = [];
321
307
  for (e of i) {
322
- var c = p(e);
323
- a && a[c] || (s.push(e), l[c] = 1, o.insert(e));
308
+ var s = a.insert(e);
309
+ void 0 !== s && o.push(s);
324
310
  }
325
- if (0 != s.length) {
326
- x.log(`Creating index ${JSON.stringify(s)} for ` + t.fullPath), this._action_insert({
311
+ if (0 !== o.length) {
312
+ var h, l = {};
313
+ for (h of o) l[_(h.indexPropPath)] = 1;
314
+ y.log(`Creating index ${JSON.stringify(o.map(e => e.indexPropPath))} for ` + t.fullPath),
315
+ this._action_insert({
327
316
  item: n,
328
317
  content: l
329
318
  });
330
319
  {
331
- var h, d = this, m = t, u = r, i = y(s);
320
+ var d, c = this, m = t, u = r;
332
321
  let e;
333
- for (h of i) {
334
- var f = u.searchOrCreateSubdir(h);
335
- if (!f.created) {
336
- d._action_createDir({
337
- item: f
322
+ for (d of o) {
323
+ var f = d.indexPropPath, g = u.searchOrCreateSubdir(f);
324
+ if (!g.created) {
325
+ c._action_createDir({
326
+ item: g
338
327
  });
339
- for (var g of e = e || m.fileList) {
328
+ for (var p of e = void 0 === e ? m.fileList : e) {
340
329
  var {
341
- fileContent: g,
330
+ fileContent: p,
342
331
  name: C
343
- } = g;
344
- null != g && N(d, f, h, C, void 0, g);
332
+ } = p;
333
+ void 0 !== p && L(c, g, f, C, void 0, p);
345
334
  }
346
335
  }
347
336
  }
@@ -354,8 +343,8 @@ ${r}
354
343
  item: e,
355
344
  indexPropPath: r
356
345
  } = e, e = this.qyCache.getIndexDir(e);
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({
346
+ e && ((i = e.getFile(x)) ? (t = i.qyIndexPropTree, this._setProp(i, _(r), null),
347
+ t.remove(r)[1] || (i = e.getSubdir(r)) && this._action_delDir({
359
348
  item: i
360
349
  })) : this._action_delDir({
361
350
  item: e
@@ -365,14 +354,14 @@ ${r}
365
354
  e.actionName = "delFile";
366
355
  var i = e.item;
367
356
  if (!i.created) return !1;
368
- null != i.fileContent && this._action_delContent({
357
+ void 0 !== i.fileContent && this._action_delContent({
369
358
  item: i
370
359
  });
371
360
  var {
372
361
  parentDir: r,
373
362
  name: n
374
363
  } = i;
375
- return i.created = !1, P(this, e), t || L(this, r, C.R, r.fileMapKey, n),
364
+ return i.created = !1, P(this, e), t || q(this, r, p.R, r.fileMapKey, n),
376
365
  !0;
377
366
  }
378
367
  _action_delDir(e) {
@@ -388,66 +377,63 @@ ${r}
388
377
  fileMapKey: s
389
378
  } = t;
390
379
  if (a) {
391
- L(this, t, C.D, s);
392
- for (var l of t.fileList) this._action_delFile({
393
- item: l
380
+ q(this, t, p.D, s);
381
+ for (var h of t.fileList) this._action_delFile({
382
+ item: h
394
383
  }, !0);
395
384
  }
396
385
  if (n) {
397
- L(this, t, C.D, o);
398
- for (var c of t.allSubdirs()) {
386
+ q(this, t, p.D, o);
387
+ for (var l of t.allSubdirs()) {
399
388
  let {
400
389
  subdirMap: e,
401
390
  fileMap: t,
402
391
  subdirMapKey: i,
403
392
  fileMapKey: r
404
- } = c;
405
- if (e && L(this, c, C.D, i), t) {
406
- L(this, c, C.D, r);
407
- for (var h of c.fileList) this._action_delFile({
408
- item: h
393
+ } = l;
394
+ if (e && q(this, l, p.D, i), t) {
395
+ q(this, l, p.D, r);
396
+ for (var d of l.fileList) this._action_delFile({
397
+ item: d
409
398
  }, !0);
410
399
  }
411
400
  P(this, {
412
401
  actionName: "delDir",
413
- item: c
414
- }), c.created = !1;
402
+ item: l
403
+ }), l.created = !1;
415
404
  }
416
405
  }
417
- return !!i && (t.created = !1, P(this, e), L(this, i, C.R, i.subdirMapKey, r),
406
+ return void 0 !== i && (t.created = !1, P(this, e), q(this, i, p.R, i.subdirMapKey, r),
418
407
  !0);
419
408
  }
420
409
  _action_delContent(e) {
421
410
  e.actionName = "delContent";
422
411
  var t = e.item, i = t.fileContent;
423
- return null != i && (t.fileContent = void 0, Object.assign(e, {
424
- content: i,
425
- delta: {
426
- oldValue: i,
427
- newValue: null
428
- }
429
- }), P(this, e), L(this, t, C.D, t.fileContentKey), q(this, t, i), !0);
412
+ return void 0 !== i && (t.fileContent = void 0, e.content = i, e.delta = {
413
+ oldValue: i,
414
+ newValue: null
415
+ }, P(this, e), q(this, t, p.D, t.fileContentKey), N(this, t, i), !0);
430
416
  }
431
417
  _action_insertEmbedding(e) {
432
418
  e.actionName = "insertEmbedding";
433
419
  var t, i, r = this.qyCache, n = r.qyEmbeddings, {
434
420
  item: a,
435
421
  embedding: o
436
- } = e, s = o.length, r = r.getOrCreateInfoFile(a), l = r.fileContent;
437
- let c = !1;
438
- return r.created && l.length == s ? (t = a.fullPathHash, l = l.idx, i = n.getEmbedding(t, s, l),
439
- h(o, i) || ((i = n.updateEmbedding(t, o, l)) != l && this._setProp(r, "idx", i),
440
- c = !0)) : ({
422
+ } = e, s = o.length, r = r.getOrCreateInfoFile(a), h = r.fileContent;
423
+ let l = !1;
424
+ return r.created && h.length === s ? (t = a.fullPathHash, h = h.idx, i = n.getEmbedding(t, s, h),
425
+ d(o, i) || ((i = n.updateEmbedding(t, o, h)) !== h && this._setProp(r, "idx", i),
426
+ l = !0)) : ({
441
427
  fullPathHash: t,
442
- namePath: l
428
+ namePath: h
443
429
  } = a, i = n.addEmbedding(t, o), this._action_insert({
444
430
  item: r,
445
431
  content: {
446
432
  length: s,
447
433
  idx: i,
448
- namePath: r.created ? void 0 : l
434
+ namePath: r.created ? void 0 : h
449
435
  }
450
- }), c = !0), c && P(this, e), c;
436
+ }), l = !0), l && P(this, e), l;
451
437
  }
452
438
  _action_delEmbedding(e) {
453
439
  e.actionName = "delEmbedding";
@@ -465,13 +451,13 @@ ${r}
465
451
  item: t,
466
452
  content: i
467
453
  } = e;
468
- if (null == i) return x.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
454
+ if (void 0 === i) return y.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
469
455
  !1;
470
456
  t.created || this._action_createFile({
471
457
  item: t
472
458
  });
473
459
  var r = t.fileContentKey;
474
- return i.$rpl = 1, L(this, t, C.M, r, i), P(this, e), t.fileContent = i,
460
+ return i.$rpl = 1, q(this, t, p.M, r, i), P(this, e), t.fileContent = i,
475
461
  !0;
476
462
  }
477
463
  _setProp(e, t, i) {
@@ -482,9 +468,9 @@ ${r}
482
468
  } = e, r = (r || this._action_createFile({
483
469
  item: e
484
470
  }), a ? a[t] : void 0);
485
- return null === i ? null != a && delete a[t] : null != a ? a[t] = i : e.fileContent = {
471
+ return null === i ? void 0 !== a && delete a[t] : void 0 !== a ? a[t] = i : e.fileContent = {
486
472
  [t]: i
487
- }, L(this, e, C.M, n, t, i), r;
473
+ }, q(this, e, p.M, n, t, i), r;
488
474
  }
489
475
  _action_insert(e) {
490
476
  e.actionName = "insert";
@@ -497,7 +483,7 @@ ${r}
497
483
  merged: a,
498
484
  delta: o
499
485
  } = e;
500
- if (null == o && void 0 === r) return x.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
486
+ if (void 0 === o && void 0 === r) return y.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
501
487
  !1;
502
488
  if (!i.created) {
503
489
  if (n) return !1;
@@ -505,25 +491,21 @@ ${r}
505
491
  item: i
506
492
  });
507
493
  }
508
- return null == a && null == o && (n = s(i.fileContent, r), a = n.merged,
509
- o = n.delta), null != o && ({
494
+ return void 0 === a && void 0 === o && (n = s(i.fileContent, r), a = n.merged,
495
+ o = n.delta), void 0 !== o && ({
510
496
  oldValue: r,
511
497
  newValue: n
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);
498
+ } = o, t = i.fileContentKey, void 0 === a ? q(this, i, p.D, t) : q(this, i, p.M, t, n),
499
+ e.merged = a, e.delta = o, P(this, e), i.fileContent = a, N(this, i, r, n, a),
500
+ !0);
517
501
  }
518
502
  _action_createFile(e) {
519
503
  e.actionName = "createFile";
520
504
  var t, i = e.item;
521
505
  return !i.created && (t = i.parentDir, this._action_createDir({
522
506
  item: t
523
- }), Object.assign(i, {
524
- created: !0,
525
- fileContentLoaded: !0
526
- }), P(this, e), L(this, t, C.A, t.fileMapKey, i.name), !0);
507
+ }), i.created = !0, i.fileContentLoaded = !0, P(this, e), q(this, t, p.A, t.fileMapKey, i.name),
508
+ !0);
527
509
  }
528
510
  _action_createDir(e) {
529
511
  e.actionName = "createDir";
@@ -531,16 +513,12 @@ ${r}
531
513
  if (t.created) return !1;
532
514
  for (var i = []; !t.created; ) i.push(t), t = t.parentDir;
533
515
  for (let e of i.reverse()) {
534
- Object.assign(e, {
535
- created: !0,
536
- subdirMapLoaded: !0,
537
- fileMapLoaded: !0
538
- }), P(this, {
516
+ e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0, P(this, {
539
517
  actionName: "createDir",
540
518
  item: e
541
519
  });
542
520
  var r = e.parentDir;
543
- L(this, r, C.A, r.subdirMapKey, e.name);
521
+ q(this, r, p.A, r.subdirMapKey, e.name);
544
522
  }
545
523
  return !0;
546
524
  }
@@ -553,8 +531,8 @@ ${r}
553
531
  parentDir: r,
554
532
  name: n
555
533
  } = e;
556
- return !!r && null != (i = j(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
557
- (r = this._action_insert({
534
+ return void 0 !== r && void 0 !== (i = E(i, !0, m())) && (t = this.qyCache,
535
+ r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"), (r = this._action_insert({
558
536
  item: r,
559
537
  content: {
560
538
  [n]: i
@@ -570,14 +548,14 @@ ${r}
570
548
  parentDir: r,
571
549
  name: n
572
550
  } = e;
573
- return !!r && (t = this.qyCache, !!(r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
551
+ return void 0 !== r && (t = this.qyCache, void 0 !== (r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
574
552
  item: r,
575
553
  content: {
576
554
  [n]: null
577
555
  }
578
- })) && (d(r.fileContent) && this._action_delFile({
556
+ })) && (c(r.fileContent) && this._action_delFile({
579
557
  item: r
580
- }), i || t.unmonitorItemExpire(e)), n);
558
+ }), void 0 === i) && t.unmonitorItemExpire(e), n);
581
559
  }
582
560
  _action_expireContent(e) {
583
561
  e.actionName = "expireContent";
@@ -586,7 +564,7 @@ ${r}
586
564
  expireInfoObj: i,
587
565
  isMilliSecond: r
588
566
  } = 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({
567
+ var e = I(i, e => E(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
590
568
  item: o,
591
569
  content: {
592
570
  ...e
@@ -601,17 +579,17 @@ ${r}
601
579
  expireInfoObj: i,
602
580
  infoFileOnly: r
603
581
  } = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
604
- return !!a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) : E(i, e => e ? null : void 0),
582
+ return void 0 !== a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) : I(i, e => e ? null : void 0),
605
583
  (t = this._action_insert({
606
584
  item: a,
607
585
  content: i
608
- })) && (d(a.fileContent, !0) && this._action_delFile({
586
+ })) && (c(a.fileContent, !0) && this._action_delFile({
609
587
  item: a
610
588
  }), r || n.unmonitorContentExpire(e, i)), t);
611
589
  }
612
590
  }
613
591
 
614
- function b(e, t, i) {
592
+ function O(e, t, i) {
615
593
  return e.running ? t.call(e, i) : (i.actionFun = t, e.actionQueue.push(i)),
616
594
  e;
617
595
  }
@@ -630,65 +608,62 @@ function P(e, t) {
630
608
  delta: a
631
609
  } = e, i = e + ` "${i.fullPath ?? i}"`;
632
610
  if ("delContent" === e) {
633
- if (3 == t) return i + " " + JSON.stringify(r);
611
+ if (3 === t) return i + " " + JSON.stringify(r);
634
612
  } else if ("insert" === e && 2 <= t) return {
635
613
  oldValue: r,
636
614
  newValue: e
637
- } = a, a = `${null == r ? "" : "delta:"} ${JSON.stringify(r)} -> ` + JSON.stringify(e),
638
- 2 == t ? i + " " + a : i + ` ${a}. ` + (null != r ? "new: " + JSON.stringify(n) : "");
615
+ } = a, a = `${void 0 === r ? "" : "delta:"} ${JSON.stringify(r)} -> ` + JSON.stringify(e),
616
+ 2 === t ? i + " " + a : i + ` ${a}. ` + (void 0 !== r ? "new: " + JSON.stringify(n) : "");
639
617
  return i;
640
618
  })(t, i)), e.push(t);
641
619
  }
642
620
 
643
- function L(e, t, i, r, n = void 0, a = void 0) {
621
+ function q(e, t, i, r, n = void 0, a = void 0) {
644
622
  var {
645
623
  qyAclCmdGenerator: e,
646
624
  qyCache: o,
647
625
  syncList: s,
648
- changeId: l
626
+ changeId: h
649
627
  } = e;
650
- e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = l : r.startsWith("f") ? t.fChangeId = l : t.cChangeId = l,
628
+ e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = h : r.startsWith("f") ? t.fChangeId = h : t.cChangeId = h,
651
629
  o && o.qyKVData.removeKey(r) && s.push(r, t);
652
630
  }
653
631
 
654
- function q(e, t, i, r = void 0, n = void 0) {
632
+ function N(e, t, i, r = void 0, n = void 0) {
655
633
  if (!t.underHiddenFolder) {
656
634
  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);
635
+ if (void 0 !== a) {
636
+ a = a.getFile(x);
637
+ if (void 0 !== a) {
638
+ var o, s = t.name;
639
+ for (o of a.qyIndexPropTree.allLeafNodes) L(e, o.indexDir, o.indexPropPath, s, i, r, n);
662
640
  }
663
641
  }
664
642
  }
665
643
  }
666
644
 
667
- function N(t, e, i, r, n, a, o = void 0) {
668
- e = _(e, i, n, a, o);
669
- if (e) {
670
- var s, l, c, {
671
- toAddFileList: i,
672
- toDelFileList: n
673
- } = e;
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)) {
645
+ function L(t, e, i, r, n, a, o = void 0) {
646
+ e = C(e, i, n, a, o);
647
+ if (void 0 !== e) {
648
+ var s, h, [ i, n ] = e;
649
+ for (s of i) {
650
+ t._setProp(s, r, null);
651
+ var l = s.fileContent;
652
+ if (void 0 === l || c(l)) {
679
653
  t._action_delFile({
680
- item: c
654
+ item: s
681
655
  });
682
- let e = c.parentDir;
656
+ let e = s.parentDir;
683
657
  for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
684
658
  item: e
685
659
  }), e = e.parentDir;
686
660
  }
687
661
  }
662
+ for (h of n) t._setProp(h, r, 1);
688
663
  }
689
664
  }
690
665
 
691
- class I {
666
+ class b {
692
667
  maxLength;
693
668
  actionQueue;
694
669
  nextPos;
@@ -716,37 +691,37 @@ class I {
716
691
  }
717
692
  }
718
693
 
719
- function E(e, t = void 0, i = [], r = {}) {
720
- if (c(e)) {
694
+ function I(e, t = void 0, i = [], r = {}) {
695
+ if (l(e)) {
721
696
  var n = t ? t(e) : e;
722
697
  void 0 !== n && (r[JSON.stringify(i)] = n);
723
698
  } else {
724
699
  var a, o = i.length;
725
- for (a in e) i.push(a), E(e[a], t, i, r), i.length = o;
700
+ for (a in e) i.push(a), I(e[a], t, i, r), i.length = o;
726
701
  }
727
702
  return r;
728
703
  }
729
704
 
730
- function j(e, t, i) {
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;
705
+ function E(e, t, i) {
706
+ return r(e) ? (t ? e : 1e3 * e) + i : h(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !a(e) || (t = e.getTime()) <= i ? void 0 : t;
732
707
  }
733
708
 
734
709
  function S(e, t, i, r, n) {
735
- var a = e.qyCache, r = (l(t) && (t = o(t)), "f" == r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
736
- return b(e, e._action_expireItem, {
710
+ var a = e.qyCache, r = (h(t) && (t = o(t)), "f" === r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
711
+ return O(e, e._action_expireItem, {
737
712
  item: r,
738
713
  milliSecond: i
739
714
  });
740
715
  }
741
716
 
742
717
  function T(e, t, i, r, n) {
743
- var a = e.qyCache, i = (l(t) && (t = o(t)), "f" == i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
744
- return b(e, e._action_removeItemExpire, {
718
+ var a = e.qyCache, i = (h(t) && (t = o(t)), "f" === i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
719
+ return O(e, e._action_removeItemExpire, {
745
720
  item: i,
746
721
  infoFileOnly: r
747
722
  });
748
723
  }
749
724
 
750
725
  export {
751
- O as QyBatch
726
+ F as QyBatch
752
727
  };