datafolder 1.0.46 → 1.0.48

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