datafolder 1.0.44 → 1.0.46

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 (75) hide show
  1. package/ChangeLog.md +4 -0
  2. package/data/sampleDataFolder/qyembedding/3.bin +1 -0
  3. package/data/sampleDataFolder/qykv/history/acl/1_acl.txt +0 -0
  4. package/data/sampleDataFolder/qykv/history/acl/2_acl.txt +0 -0
  5. package/data/sampleDataFolder/qykv/history/acl/3_acl.txt +0 -0
  6. package/data/sampleDataFolder/qykv/history/acl/4_acl.txt +0 -0
  7. package/data/sampleDataFolder/qykv/history/acl/5_acl.txt +0 -0
  8. package/data/sampleDataFolder/qykv/history/acl/6_acl.txt +0 -0
  9. package/data/sampleDataFolder/qykv/snapshot/1/1_pM.txt +0 -0
  10. package/data/sampleDataFolder/qykv/snapshot/1/1_prefixPM.txt +0 -0
  11. package/data/sampleDataFolder/qykv/snapshot/1/1_vL.txt +19 -0
  12. package/data/sampleDataFolder/qykv/snapshot/2/1_pM.txt +0 -0
  13. package/data/sampleDataFolder/qykv/snapshot/2/1_prefixPM.txt +0 -0
  14. package/data/sampleDataFolder/qykv/snapshot/2/1_vL.txt +1 -0
  15. package/data/sampleDataFolder/qykv/snapshot/3/1_pM.txt +0 -0
  16. package/data/sampleDataFolder/qykv/snapshot/3/1_prefixPM.txt +0 -0
  17. package/data/sampleDataFolder/qykv/snapshot/3/1_vL.txt +1 -0
  18. package/data/sampleDataFolder/qykv/snapshot/4/1_pM.txt +0 -0
  19. package/data/sampleDataFolder/qykv/snapshot/4/1_prefixPM.txt +0 -0
  20. package/data/sampleDataFolder/qykv/snapshot/4/1_vL.txt +1 -0
  21. package/data/sampleDataFolder/qykv/snapshot/5/1_pM.txt +0 -0
  22. package/data/sampleDataFolder/qykv/snapshot/5/1_prefixPM.txt +0 -0
  23. package/data/sampleDataFolder/qykv/snapshot/5/1_vL.txt +1 -0
  24. package/data/sampleDataFolder/qykv/snapshot/6/1_pM.txt +0 -0
  25. package/data/sampleDataFolder/qykv/snapshot/6/1_prefixPM.txt +0 -0
  26. package/data/sampleDataFolder/qykv/snapshot/6/1_vL.txt +1 -0
  27. package/data/sampleDataFolder/qykv/snapshot/info/1.json +1 -0
  28. package/data/sampleDataFolder/qykv/snapshot/info/2.json +1 -0
  29. package/data/sampleDataFolder/qykv/snapshot/info/3.json +1 -0
  30. package/data/sampleDataFolder/qykv/snapshot/info/4.json +1 -0
  31. package/data/sampleDataFolder/qykv/snapshot/info/5.json +1 -0
  32. package/data/sampleDataFolder/qykv/snapshot/info/6.json +1 -0
  33. package/data/sampleDataFolder/qylog/2026/11/14/13/stderr.txt +406 -0
  34. package/data/sampleDataFolder/qylog/2026/11/14/13/stdout.txt +108 -0
  35. package/data/sampleDataFolder/qylog/2026/11/14/14/change.txt +43 -0
  36. package/data/sampleDataFolder/qylog/2026/11/14/14/stderr.txt +95 -0
  37. package/data/sampleDataFolder/qylog/2026/11/14/14/stdout.txt +201 -0
  38. package/package.json +1 -1
  39. package/scripts/fastify.js +2 -2
  40. package/src/QyAclSaver.js +8 -8
  41. package/src/QyBatch.d.ts +19 -15
  42. package/src/QyBatch.js +190 -181
  43. package/src/QyCache.d.ts +13 -13
  44. package/src/QyCache.js +107 -122
  45. package/src/QyDB.js +6 -6
  46. package/src/QyDir.d.ts +5 -3
  47. package/src/QyDir.js +136 -156
  48. package/src/QyEmbeddings.d.ts +1 -1
  49. package/src/QyEmbeddings.js +4 -13
  50. package/src/QyExpireInfo.d.ts +5 -3
  51. package/src/QyExpireInfo.js +59 -60
  52. package/src/{QyExpire.d.ts → QyExpireMonitor.d.ts} +7 -7
  53. package/src/{QyExpire.js → QyExpireMonitor.js} +32 -35
  54. package/src/QyExpireProcessor.js +1 -1
  55. package/src/QyExpireProcessor_Worker.d.ts +1 -1
  56. package/src/QyExpireProcessor_Worker.js +43 -47
  57. package/src/QyFile.d.ts +4 -0
  58. package/src/QyFile.js +60 -46
  59. package/src/QyIndex.js +17 -17
  60. package/src/QyItem.d.ts +1 -1
  61. package/src/QyItem.js +32 -34
  62. package/src/QyKVData.d.ts +3 -3
  63. package/src/QyKVData.js +10 -10
  64. package/src/QyKVDataCleaner.js +4 -4
  65. package/src/QyKVDataCleaner_Worker.js +13 -13
  66. package/src/QyKVDataSaver.js +12 -12
  67. package/src/QyLogFileSaver.js +4 -4
  68. package/src/QyMessager.d.ts +1 -1
  69. package/src/QyMessager.js +9 -9
  70. package/src/QySnapshotCompactor.js +9 -9
  71. package/src/QySnapshotSaver.js +10 -10
  72. package/src/QySnapshots.d.ts +1 -1
  73. package/src/QySnapshots.js +1 -1
  74. package/src/QyUtils.d.ts +5 -12
  75. package/src/QyUtils.js +101 -108
package/src/QyBatch.js CHANGED
@@ -1,32 +1,32 @@
1
1
  import {
2
- isDeepStrictEqual as d
2
+ isDeepStrictEqual as c
3
3
  } from "node:util";
4
4
 
5
5
  import {
6
- mergeContentAndGenDelta as h
6
+ mergeContentAndGenDelta as d
7
7
  } from "./QyFileContentUtils.js";
8
8
 
9
9
  import {
10
- pathSplit as o,
11
- ensurePropNamePathList as n,
12
- isString as s,
13
- getSuffix as p,
14
- SpecialFilePaths as e,
15
- isSimpleType as l,
16
- isEmptyObj as f,
10
+ pathSplit as n,
11
+ ensurePropNamePathList as a,
12
+ isString as o,
13
+ getSuffix as C,
14
+ IndexPropPathsFileName as h,
15
+ isSimpleType as s,
16
+ isEmptyObj as g,
17
17
  isNumber as r,
18
- getNowRounded as c,
19
- isDate as a,
20
- isArray as u,
21
- isFloat32Array as g
18
+ getNowRounded as l,
19
+ isDate as u,
20
+ isArray as _,
21
+ isFloat32Array as f
22
22
  } from "./QyUtils.js";
23
23
 
24
24
  import {
25
- QyAclCmdGenerator as t
25
+ QyAclCmdGenerator as e
26
26
  } from "./QyAcl.js";
27
27
 
28
28
  import {
29
- calDifferenceList as _
29
+ calDifferenceList as p
30
30
  } from "./QyIndex.js";
31
31
 
32
32
  import {
@@ -34,56 +34,56 @@ import {
34
34
  } from "./QyDefaultOptions.js";
35
35
 
36
36
  import {
37
- QyCD as C
37
+ QyCD as t
38
38
  } from "./QyCD.js";
39
39
 
40
40
  import {
41
41
  logger as v
42
42
  } from "./QyLogger.js";
43
43
 
44
- let m = e.IndexPropPathsFileName, y = {
44
+ let m = {
45
45
  none: 0,
46
46
  basic: 1,
47
47
  delta: 2,
48
48
  all: 3
49
49
  };
50
50
 
51
- class D extends C {
51
+ class y extends t {
52
+ options;
52
53
  fileLogLevel;
53
- changeId;
54
+ changeId = 0;
54
55
  aqIdx = 0;
56
+ running = !1;
55
57
  actionQueue = [];
56
58
  fileDeltaList = [];
57
59
  syncList = [];
58
60
  logList = [];
59
- running;
60
- options;
61
- qyAclCmdGenerator = new t();
61
+ qyAclCmdGenerator = new e();
62
62
  constructor(e, t) {
63
63
  super(e), t = {
64
64
  ...i("QyBatch"),
65
65
  ...t
66
66
  };
67
- e = y[t.fileLogLevel.toLowerCase()];
67
+ e = m[t.fileLogLevel.toLowerCase()];
68
68
  this.options = t, this.fileLogLevel = e ?? 1;
69
69
  }
70
70
  createDir(e) {
71
- s(e) && (e = o(e));
71
+ o(e) && (e = n(e));
72
72
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
73
73
  return q(this, this._action_createDir, e);
74
74
  }
75
75
  delDir(e) {
76
- s(e) && (e = o(e));
76
+ o(e) && (e = n(e));
77
77
  e = this.qyCache.getOrCreateDir(e, this.currentDir).ensureAllLoaded();
78
78
  return q(this, this._action_delDir, e);
79
79
  }
80
80
  createFile(e) {
81
- s(e) && (e = o(e));
81
+ o(e) && (e = n(e));
82
82
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
83
83
  return q(this, this._action_createFile, e);
84
84
  }
85
85
  delFile(e) {
86
- s(e) && (e = o(e));
86
+ o(e) && (e = n(e));
87
87
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
88
88
  return q(this, this._action_delFile, e);
89
89
  }
@@ -91,72 +91,85 @@ class D extends C {
91
91
  return this.expireFileM(e, 1e3 * t);
92
92
  }
93
93
  expireFileM(e, t) {
94
- return A(this, e, t, "f");
94
+ o(e) && (e = n(e));
95
+ e = this.qyCache.getOrCreateFile(e, this.currentDir);
96
+ return q(this, this._action_expireItem, e, t);
95
97
  }
96
98
  expireDir(e, t) {
97
99
  return this.expireDirM(e, 1e3 * t);
98
100
  }
99
101
  expireDirM(e, t) {
100
- return A(this, e, t, "d");
102
+ o(e) && (e = n(e));
103
+ e = this.qyCache.getOrCreateDir(e, this.currentDir);
104
+ return q(this, this._action_expireItem, e, t);
101
105
  }
102
106
  expireContent(e, t, i) {
103
- s(e) && (e = o(e));
107
+ o(e) && (e = n(e));
104
108
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
105
109
  return q(this, this._action_expireContent, e, t, i);
106
110
  }
107
111
  expireContentM(e, t) {
108
112
  return this.expireContent(e, t, !0);
109
113
  }
110
- removeFileExpire(e, t = !1) {
111
- return Q(this, e, "f", t);
114
+ removeFileExpire(e) {
115
+ o(e) && (e = n(e));
116
+ e = this.qyCache.getOrCreateFile(e, this.currentDir);
117
+ return q(this, this._action_removeItemExpire, e);
112
118
  }
113
- removeDirExpire(e, t = !1) {
114
- return Q(this, e, "d", t);
119
+ removeDirExpire(e) {
120
+ o(e) && (e = n(e));
121
+ e = this.qyCache.getOrCreateDir(e, this.currentDir);
122
+ return q(this, this._action_removeItemExpire, e);
115
123
  }
116
- removeContentExpire(e, t, i = !1) {
117
- s(e) && (e = o(e));
124
+ removeContentExpire(e, t = void 0, i = !1) {
125
+ o(e) && (e = n(e));
118
126
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
119
127
  return q(this, this._action_removeContentExpire, e, t, i);
120
128
  }
121
129
  createIndex(e, t) {
122
- s(e) && (e = o(e)), u(t) || (t = [ t ]);
130
+ o(e) && (e = n(e)), _(t) || (t = [ t ]);
123
131
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
124
132
  return q(this, this._action_createIndex, e, t);
125
133
  }
126
134
  createIndexByQuery(e, t) {
127
- s(e) && (e = o(e));
135
+ o(e) && (e = n(e));
128
136
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
129
137
  return q(this, this._action_createIndexByQuery, e, t);
130
138
  }
131
139
  delIndex(e, t) {
132
- s(e) && (e = o(e));
140
+ o(e) && (e = n(e));
133
141
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
134
142
  return q(this, this._action_delIndex, e, t);
135
143
  }
136
144
  insert(e, t) {
137
- s(e) && (e = o(e));
145
+ o(e) && (e = n(e));
138
146
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
139
147
  return q(this, this._action_insert, e, t);
140
148
  }
149
+ setProp(e, t, i) {
150
+ o(e) && (e = n(e));
151
+ e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
152
+ return q(this, this._action_setProp, e, t, i);
153
+ }
141
154
  insertEmbedding(e, t) {
142
- var i = this.qyCache, i = (g(t) || (t = new Float32Array(t)), s(e) && (e = o(e)),
155
+ var i = this.qyCache, i = (f(t) || (t = new Float32Array(t)), o(e) && (e = n(e)),
143
156
  i.getOrCreateFile(e, this.currentDir));
144
157
  return q(this, this._action_insertEmbedding, i, t);
145
158
  }
146
159
  delEmbedding(e) {
147
- var t = this.qyCache, t = (s(e) && (e = o(e)), t.getOrCreateFile(e, this.currentDir));
160
+ var t = this.qyCache, t = (o(e) && (e = n(e)), t.getOrCreateFile(e, this.currentDir));
148
161
  return q(this, this._action_delEmbedding, t);
149
162
  }
150
163
  insertWithEmbedding(e, t, i) {
151
164
  return this.insert(e, t), this.insertEmbedding(e, i);
152
165
  }
153
166
  delContent(e) {
154
- s(e) && (e = o(e));
167
+ o(e) && (e = n(e));
155
168
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
156
169
  return q(this, this._action_delContent, e);
157
170
  }
158
171
  insertTrigger(e, t, i, r) {
159
- s(t) && (t = o(t)), i = n(i);
172
+ o(t) && (t = n(t)), i = a(i);
160
173
  e = this.qyCache.getOrCreateTriggerFile(e);
161
174
  return q(this, this._action_insertTrigger, e, t, i, r);
162
175
  }
@@ -185,10 +198,10 @@ class D extends C {
185
198
  var {
186
199
  fileLogLevel: o,
187
200
  logList: s,
188
- syncList: h
189
- } = this, d = p(a), l = r.takeCmdArgAsListArray(), o = 0 < o ? "" + new Date().toISOString() + `: ${a} change${d}:
201
+ syncList: d
202
+ } = this, h = C(a), c = r.takeCmdArgAsListArray(), o = 0 < o ? "" + new Date().toISOString() + `: ${a} change${h}:
190
203
  ${s.join("\n")}
191
- ` : void 0, a = (s.length = 0, i.save(n, l, o, (e => {
204
+ ` : void 0, a = (s.length = 0, i.save(n, c, o, (e => {
192
205
  var t = e.syncList, i = t.length;
193
206
  for (let e = 0; e < i; e += 2) {
194
207
  var r, n = e + 1, a = t[e], o = t[n];
@@ -197,17 +210,17 @@ ${s.join("\n")}
197
210
  }
198
211
  if (0 < i) return t;
199
212
  })(this), e));
200
- h.length = 0, r.clear();
201
- var c = this.fileDeltaList, u = c.length;
213
+ d.length = 0, r.clear();
214
+ var l = this.fileDeltaList, u = l.length;
202
215
  if (0 < u) {
203
- var f = [];
216
+ var g = [];
204
217
  for (let e = 0; e < u; e += 2) {
205
- var g = c[e];
206
- 0 < g.triggerNodes?.length && f.push(g, c[e + 1]);
218
+ var _ = l[e];
219
+ 0 < _.triggerNodes?.length && g.push(_, l[e + 1]);
207
220
  }
208
- for (let e = c.length = 0; e < f.length; e += 2) {
209
- var _, C = f[e], v = f[e + 1];
210
- for (_ of C.triggerNodes) _.checkTrigger(C, v);
221
+ for (let e = l.length = 0; e < g.length; e += 2) {
222
+ var f, p = g[e], v = g[e + 1];
223
+ for (f of p.triggerNodes) f.checkTrigger(p, v);
211
224
  }
212
225
  }
213
226
  return e ? a : n;
@@ -217,7 +230,7 @@ ${s.join("\n")}
217
230
  name: n,
218
231
  fileContent: a
219
232
  } = e, a = a && a[0], o = [ t, i ], e = (r && o.push(r), this._action_insert(e, o));
220
- return e && (o = this.qyCache, a && !d(a, t) && o.removeTriggerFromTree(n, a),
233
+ return e && (o = this.qyCache, a && !c(a, t) && o.removeTriggerFromTree(n, a),
221
234
  o.insertTriggerToTree(n, t, i, r)), e;
222
235
  }
223
236
  _action_removeTrigger(e) {
@@ -235,16 +248,16 @@ ${s.join("\n")}
235
248
  return !!this._action_delFile(e) && (this.qyCache.removeRpc(e.name), !0);
236
249
  }
237
250
  _action_createIndex(e, t) {
238
- var i = this.qyCache.getOrCreateIndexDir(e), r = x(this, i), t = r.qyIndexPropTree.insertPropPathList(t);
239
- 0 < t.length && F(this, e, 0, r, t);
251
+ var i = this.qyCache.getOrCreateIndexDir(e), r = D(this, i), t = r.qyIndexPropTree.insertPropPathList(t);
252
+ 0 < t.length && x(this, e, 0, r, t);
240
253
  }
241
254
  _action_createIndexByQuery(e, t) {
242
- var i = this.qyCache.getOrCreateIndexDir(e), r = x(this, i), t = r.qyIndexPropTree.insertQueryObj(t);
243
- 0 < t.length && F(this, e, 0, r, t);
255
+ var i = this.qyCache.getOrCreateIndexDir(e), r = D(this, i), t = r.qyIndexPropTree.insertQueryObj(t);
256
+ 0 < t.length && x(this, e, 0, r, t);
244
257
  }
245
258
  _action_delIndex(e, t) {
246
259
  var i, e = this.qyCache.getIndexDir(e);
247
- void 0 !== e && (void 0 === (i = e.getFile(m)) ? this._action_delDir(e) : (e = i.qyIndexPropTree,
260
+ void 0 !== e && (void 0 === (i = e.getFile(h)) ? this._action_delDir(e) : (e = i.qyIndexPropTree,
248
261
  [ i, e, t ] = (this._action_setProp(i, JSON.stringify(t), null), e.removePropPath(t)),
249
262
  i && !e && void 0 !== t && (i = t.indexPropDir, void 0 !== i) && this._action_delDir(i)));
250
263
  }
@@ -254,7 +267,8 @@ ${s.join("\n")}
254
267
  e.created = !1, t || ({
255
268
  parentDir: t,
256
269
  name: i
257
- } = e, O(this, t, t.fileMapKey, i)), I(this, "delFile", e), !0);
270
+ } = e, L(this, t, t.fileMapKey, i)), I(this, "delFile", e), this._action_removeItemExpire(e),
271
+ !0);
258
272
  }
259
273
  _action_delDir(e) {
260
274
  if (!e.created) return !1;
@@ -267,152 +281,159 @@ ${s.join("\n")}
267
281
  fileMapKey: o
268
282
  } = e;
269
283
  if (n) {
270
- E(this, e, o);
284
+ O(this, e, o);
271
285
  for (var s of e.fileList) this._action_delFile(s, !0);
272
286
  }
273
287
  if (r) {
274
- E(this, e, a);
275
- for (var h of e.allSubdirs()) {
288
+ O(this, e, a);
289
+ for (var d of e.allSubdirs()) {
276
290
  let {
277
291
  subdirMap: e,
278
292
  fileMap: t,
279
293
  subdirMapKey: i,
280
294
  fileMapKey: r
281
- } = h;
282
- if (e && E(this, h, i), t) {
283
- E(this, h, r);
284
- for (var d of h.fileList) this._action_delFile(d, !0);
295
+ } = d;
296
+ if (e && O(this, d, i), t) {
297
+ O(this, d, r);
298
+ for (var h of d.fileList) this._action_delFile(h, !0);
285
299
  }
286
- I(this, "delDir", h), h.created = !1;
300
+ d.created = !1, I(this, "delDir", d), this._action_removeItemExpire(d);
287
301
  }
288
302
  }
289
- return void 0 !== t && (e.created = !1, O(this, t, t.subdirMapKey, i), I(this, "delDir", e),
290
- !0);
303
+ return void 0 !== t && (e.created = !1, L(this, t, t.subdirMapKey, i), I(this, "delDir", e),
304
+ this._action_removeItemExpire(e), !0);
291
305
  }
292
306
  _action_delContent(e) {
293
307
  var t = e.fileContent;
294
- return void 0 !== t && (e.fileContent = void 0, E(this, e, e.fileContentKey),
295
- I(this, "delContent", e, t, [ t, null ]), b(this, e, t), !0);
308
+ return void 0 !== t && (e.fileContent = void 0, O(this, e, e.fileContentKey),
309
+ I(this, "delContent", e, t, [ t, null ]), E(this, e, t), this._action_removeContentExpire(e, void 0, !1),
310
+ !0);
296
311
  }
297
312
  _action_insertEmbedding(e, t) {
298
- var i, r, n = this.qyCache, a = n.qyEmbeddings, o = t.length, n = n.getOrCreateInfoFile(e), s = n.fileContent;
313
+ var i, r, n, a = this.qyCache, o = a.qyEmbeddings, s = t.length, a = a.getOrCreateInfoFile(e), d = a.fileContent;
299
314
  let h = !1;
300
- return n.created && s.length === o ? (i = e.fullPathHash, s = s.idx, r = a.getEmbedding(i, o, s),
301
- d(t, r) || ((r = a.updateEmbedding(i, t, s)) !== s && this._action_setProp(n, "idx", r),
315
+ return a.created && d.embeddingLength === s ? (i = e.fullPathHash, r = d.embeddingIdx,
316
+ n = o.getEmbedding(i, s, r), c(t, n) || ((n = o.updateEmbedding(i, t, r)) !== r && this._action_setProp(a, "embeddingIdx", n),
302
317
  h = !0)) : ({
303
318
  fullPathHash: i,
304
- namePath: s
305
- } = e, r = a.addEmbedding(i, t), this._action_insert(n, {
306
- length: o,
307
- idx: r,
308
- namePath: n.created ? void 0 : s
309
- }), h = !0), h && I(this, "insertEmbedding", e), h;
319
+ namePath: r
320
+ } = e, n = o.addEmbedding(i, t), this._action_setProp(a, "embeddingLength", s),
321
+ this._action_setProp(a, "embeddingIdx", n), void 0 === d?.namePath && this._action_setProp(a, "namePath", r),
322
+ h = !0), h && I(this, "insertEmbedding", e), h;
310
323
  }
311
324
  _action_delEmbedding(e) {
312
- var t = this.qyCache, i = t.qyEmbeddings;
313
- let r, n;
314
- var a, t = t.getInfoFile(e);
315
- if (t && (a = t.fileContent, a) && (r = a.length, n = a.idx), i.delEmbedding(e.fullPathHash, r, n),
316
- t) return this._action_delFile(t), I(this, "delEmbedding", e), !0;
325
+ var t, i = this.qyCache, r = (i.qyEmbeddings.delEmbedding(e.fullPathHash),
326
+ i.getInfoFile(e));
327
+ if (void 0 !== r) {
328
+ var n = r.fileContent;
329
+ if (void 0 !== n && (t = n.embeddingLength, n = n.embeddingIdx, void 0 !== t) && void 0 !== n) return this._action_setProp(i.getOrCreateEmbeddingRecycleFile(t), n, 1),
330
+ this._action_setProp(r, "embeddingLength", null), this._action_setProp(r, "embeddingIdx", null),
331
+ I(this, "delEmbedding", e), !0;
332
+ }
317
333
  }
318
334
  _action_setProp(e, t, i) {
319
335
  var {
320
336
  created: r,
321
337
  fileContentKey: n,
322
338
  fileContent: a
323
- } = e, r = (r || this._action_createFile(e), a ? a[t] : void 0);
324
- return null === i ? void 0 !== a && delete a[t] : void 0 !== a ? a[t] = i : e.fileContent = {
339
+ } = e;
340
+ r || this._action_createFile(e);
341
+ let o;
342
+ return void 0 !== a ? (o = a[t], null === i ? delete a[t] : a[t] = i) : null !== i && (e.fileContent = {
325
343
  [t]: i
326
- }, a = e, e = n, (n = this).qyAclCmdGenerator.pushMPropCmd(e, t, i), L(n, a, e),
327
- r;
344
+ }), r = e, a = n, (e = this).qyAclCmdGenerator.pushMPropCmd(a, t, i), F(e, r, a),
345
+ o;
328
346
  }
329
347
  _action_insert(e, t) {
330
348
  if (void 0 === t) return v.warn(`Saving undefined to ${e.fullPath}. Not making any change.`),
331
349
  !1;
332
350
  e.created || this._action_createFile(e);
333
- var [ t, i ] = h(e.fileContent, t);
351
+ var [ t, i ] = d(e.fileContent, t);
334
352
  if (void 0 === i) return !1;
335
353
  e.fileContent = t;
336
354
  var r, n, [ a, o ] = i, s = e.fileContentKey;
337
- return void 0 === t ? E(this, e, s) : (n = e, s = s, (r = this).qyAclCmdGenerator.pushMCmd(s, o),
338
- L(r, n, s)), I(this, "insert", e, t, i), b(this, e, a, o, t), !0;
355
+ return void 0 === t ? O(this, e, s) : (n = e, s = s, (r = this).qyAclCmdGenerator.pushMCmd(s, o),
356
+ F(r, n, s)), I(this, "insert", e, t, i), E(this, e, a, o, t), !0;
339
357
  }
340
358
  _action_createFile(e) {
341
359
  var t;
342
360
  return !e.created && (t = e.parentDir, t.created || this._action_createDir(t),
343
- e.created = !0, e.fileContentLoaded = !0, P(this, t, t.fileMapKey, e.name),
361
+ e.fileContentLoaded = !0, e.created = !0, P(this, t, t.fileMapKey, e.name),
344
362
  I(this, "createFile", e), !0);
345
363
  }
346
364
  _action_createDir(e) {
347
365
  if (e.created) return !1;
348
366
  for (var t = []; !e.created; ) t.push(e), e = e.parentDir;
349
367
  for (let e of t.reverse()) {
350
- e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0;
368
+ e.subdirMapLoaded = !0, e.fileMapLoaded = !0, e.created = !0;
351
369
  var i = e.parentDir;
352
370
  P(this, i, i.subdirMapKey, e.name), I(this, "createDir", e);
353
371
  }
354
372
  return !0;
355
373
  }
356
374
  _action_expireItem(e, t) {
357
- var i, {
358
- parentDir: r,
359
- name: n
375
+ var {
376
+ parentDir: i,
377
+ underHiddenDir: r
360
378
  } = e;
361
- return void 0 !== r && void 0 !== (t = N(t, !0, c())) && (i = this.qyCache,
362
- r = i.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"), (r = this._action_insert(r, {
363
- [n]: t
364
- })) && i.monitorItemExpire(e, t), r);
365
- }
366
- _action_removeItemExpire(e, t) {
367
- var i, {
368
- parentDir: r,
369
- name: n
379
+ return void 0 !== i && !r && void 0 !== (i = M(t, !0)) && (r = this.qyCache,
380
+ t = r.getOrCreateInfoFile(e), this._action_setProp(t, N(e), i) !== i) && (r.monitorItemExpire(e, i),
381
+ !0);
382
+ }
383
+ _action_removeItemExpire(e) {
384
+ var {
385
+ parentDir: t,
386
+ underHiddenDir: i
370
387
  } = e;
371
- return void 0 !== r && (i = this.qyCache, void 0 !== (r = i.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert(r, {
372
- [n]: null
373
- })) && (f(r.fileContent) && this._action_delFile(r), void 0 === t) && i.unmonitorItemExpire(e),
374
- n);
375
- }
376
- _action_expireContent(e, t, i) {
377
- let r = c();
378
- var t = M(t, e => N(e, i, r)), n = this.qyCache, a = n.getOrCreateExpireInfoFile(e.fullPathHash, "c"), a = this._action_insert(a, {
379
- ...t
380
- });
381
- return a && n.monitorContentExpire(e, t), a;
388
+ return void 0 !== t && !i && (t = this.qyCache, void 0 !== (i = t.getInfoFile(e))) && void 0 !== this._action_setProp(i, N(e), null) && (t.unmonitorItemExpire(e),
389
+ !0);
390
+ }
391
+ _action_expireContent(e, i, r) {
392
+ if (!e.underHiddenDir) {
393
+ let t = l();
394
+ var i = T(i, e => M(e, r, t)), n = this.qyCache, a = n.getOrCreateInfoFile(e), a = this._action_insert(a, {
395
+ cExpire: {
396
+ ...i
397
+ }
398
+ });
399
+ return a && n.monitorContentExpire(e, i), a;
400
+ }
382
401
  }
383
- _action_removeContentExpire(e, t, i) {
384
- var r, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
385
- return void 0 !== a && (t = u(t) ? Object.fromEntries(t.map(e => [ e, null ])) : M(t, e => e ? null : void 0),
386
- (r = this._action_insert(a, t)) && (f(a.fileContent, !0) && this._action_delFile(a),
387
- i || n.unmonitorContentExpire(e, t)), r);
402
+ _action_removeContentExpire(e, t = void 0, i) {
403
+ var r, n;
404
+ if (!e.underHiddenDir) return r = this.qyCache, void 0 !== (n = r.getInfoFile(e)) && (void 0 === t ? void 0 !== this._action_setProp(n, "cExpire", null) && (r.unmonitorContentExpire(e),
405
+ !0) : (t = _(t) ? Object.fromEntries(t.map(e => [ e, null ])) : T(t, e => e ? null : void 0),
406
+ !!this._action_insert(n, {
407
+ cExpire: t
408
+ }) && (i || r.unmonitorContentExpire(e, Object.keys(t)), !0)));
388
409
  }
389
410
  }
390
411
 
391
- function x(e, t) {
392
- t = t.getOrCreateFile(m);
412
+ function D(e, t) {
413
+ t = t.getOrCreateFile(h);
393
414
  return t.created || e._action_createFile(t), t;
394
415
  }
395
416
 
396
- function F(t, i, e, r, n) {
417
+ function x(t, i, e, r, n) {
397
418
  var a, o = {};
398
419
  for (a of n) o[JSON.stringify(a.indexPropPath)] = 1;
399
420
  v.log(`Creating index ${n.map(e => e.indexPropPath)} for ` + i.fullPath), t._action_insert(r, o);
400
421
  {
401
- var s = t, h = i, d;
422
+ var s = t, d = i, h;
402
423
  let e;
403
- for (d of r = n) {
424
+ for (h of r = n) {
404
425
  var {
405
- indexPropPath: l,
406
- indexPropDir: c
407
- } = d;
408
- if (!c.created) {
409
- s._action_createDir(c);
410
- for (var u of e = void 0 === e ? h.fileList : e) {
426
+ indexPropPath: c,
427
+ indexPropDir: l
428
+ } = h;
429
+ if (!l.created) {
430
+ s._action_createDir(l);
431
+ for (var u of e = void 0 === e ? d.fileList : e) {
411
432
  var {
412
433
  fileContent: u,
413
- name: f
434
+ name: g
414
435
  } = u;
415
- void 0 !== u && T(s, c, l, f, void 0, u);
436
+ void 0 !== u && b(s, l, c, g, void 0, u);
416
437
  }
417
438
  }
418
439
  }
@@ -442,7 +463,7 @@ function I(t, i, r, n = void 0, a = void 0) {
442
463
  }
443
464
  }
444
465
 
445
- function L(e, t, i) {
466
+ function F(e, t, i) {
446
467
  var {
447
468
  qyCache: e,
448
469
  syncList: r,
@@ -453,87 +474,75 @@ function L(e, t, i) {
453
474
  }
454
475
 
455
476
  function P(e, t, i, r) {
456
- e.qyAclCmdGenerator.pushACmd(i, r), L(e, t, i);
477
+ e.qyAclCmdGenerator.pushACmd(i, r), F(e, t, i);
457
478
  }
458
479
 
459
- function O(e, t, i, r) {
460
- e.qyAclCmdGenerator.pushRCmd(i, r), L(e, t, i);
480
+ function L(e, t, i, r) {
481
+ e.qyAclCmdGenerator.pushRCmd(i, r), F(e, t, i);
461
482
  }
462
483
 
463
- function E(e, t, i) {
464
- e.qyAclCmdGenerator.pushDCmd(i), L(e, t, i);
484
+ function O(e, t, i) {
485
+ e.qyAclCmdGenerator.pushDCmd(i), F(e, t, i);
465
486
  }
466
487
 
467
- function b(e, t, i, r = void 0, n = void 0) {
468
- if (!t.underHiddenFolder) {
488
+ function E(e, t, i, r = void 0, n = void 0) {
489
+ if (!t.underHiddenDir) {
469
490
  var a = e.qyCache.getIndexDir(t.parentDir);
470
491
  if (void 0 !== a) {
471
- a = a.getFile(m);
492
+ a = a.getFile(h);
472
493
  if (void 0 !== a) {
473
- var o, s, h = t.name;
494
+ var o, s, d = t.name;
474
495
  for ({
475
496
  indexPropDir: o,
476
497
  indexPropPath: s
477
- } of a.qyIndexPropTree.allLeafNodes) T(e, o, s, h, i, r, n);
498
+ } of a.qyIndexPropTree.allLeafNodes) b(e, o, s, d, i, r, n);
478
499
  }
479
500
  }
480
501
  }
481
502
  }
482
503
 
483
- function T(t, e, i, r, n, a, o = void 0) {
484
- e = _(e, i, n, a, o);
504
+ function b(t, e, i, r, n, a, o = void 0) {
505
+ e = p(e, i, n, a, o);
485
506
  if (void 0 !== e) {
486
- var s, h, [ i, n ] = e;
507
+ var s, d, [ i, n ] = e;
487
508
  for (s of i) {
488
509
  var {
489
- fileContent: d,
490
- indexCount: l
491
- } = s, c = t._action_setProp(s, r, null);
492
- if (void 0 === d || f(d)) {
510
+ fileContent: h,
511
+ indexCount: c
512
+ } = s, l = t._action_setProp(s, r, null);
513
+ if (void 0 === h || g(h)) {
493
514
  t._action_delFile(s);
494
515
  let e = s.parentDir;
495
- for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir(e),
516
+ for (;e.created && !e.isHiddenDir && e.isEmpty; ) t._action_delDir(e),
496
517
  e = e.parentDir;
497
- } else void 0 !== c && (s.indexCount = l - 1);
518
+ } else void 0 !== l && (s.indexCount = c - 1);
498
519
  }
499
- for (h of n) {
500
- var u = h.indexCount;
501
- 1 !== t._action_setProp(h, r, 1) && (h.indexCount = u + 1);
520
+ for (d of n) {
521
+ var u = d.indexCount;
522
+ 1 !== t._action_setProp(d, r, 1) && (d.indexCount = u + 1);
502
523
  }
503
524
  }
504
525
  }
505
526
 
506
- function M(e, t = void 0, i = [], r = {}) {
507
- if (l(e)) {
527
+ function T(e, t = void 0, i = [], r = {}) {
528
+ if (s(e)) {
508
529
  var n = t ? t(e) : e;
509
530
  void 0 !== n && (r[JSON.stringify(i)] = n);
510
531
  } else {
511
532
  var a, o = i.length;
512
- for (a in e) i.push(a), M(e[a], t, i, r), i.length = o;
533
+ for (a in e) i.push(a), T(e[a], t, i, r), i.length = o;
513
534
  }
514
535
  return r;
515
536
  }
516
537
 
517
- function N(e, t, i) {
518
- return r(e) ? (t ? e : 1e3 * e) + i : s(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !a(e) || (t = e.getTime()) <= i ? void 0 : t;
519
- }
520
-
521
- function A(e, t, i, r) {
522
- var {
523
- qyCache: n,
524
- currentDir: a
525
- } = e, r = (s(t) && (t = o(t)), "f" === r ? n.getOrCreateFile(t, a) : n.getOrCreateDir(t, a));
526
- return q(e, e._action_expireItem, r, i);
538
+ function M(e, t, i = l()) {
539
+ return r(e) ? (t ? e : 1e3 * e) + i : o(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !u(e) || (t = e.getTime()) <= i ? void 0 : t;
527
540
  }
528
541
 
529
- function Q(e, t, i, r) {
530
- var {
531
- qyCache: n,
532
- currentDir: a
533
- } = e, i = (s(t) && (t = o(t)), "f" === i ? n.getOrCreateFile(t, a) : n.getOrCreateDir(t, a));
534
- return q(e, e._action_removeItemExpire, i, r);
542
+ function N(e) {
543
+ return (e.isFile ? "f" : "d") + "Expire";
535
544
  }
536
545
 
537
546
  export {
538
- D as QyBatch
547
+ y as QyBatch
539
548
  };