datafolder 1.0.40 → 1.0.42

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
@@ -3,14 +3,14 @@ import {
3
3
  } from "node:util";
4
4
 
5
5
  import {
6
- mergeContentAndGenDelta as s
6
+ mergeContentAndGenDelta as h
7
7
  } from "./QyFileContentUtils.js";
8
8
 
9
9
  import {
10
- pathSplit as o,
10
+ pathSplit as s,
11
11
  ensurePropNamePathList as n,
12
- isString as h,
13
- getSuffix as m,
12
+ isString as o,
13
+ getSuffix as v,
14
14
  SpecialFilePaths as e,
15
15
  isSimpleType as l,
16
16
  isEmptyObj as f,
@@ -22,15 +22,11 @@ import {
22
22
  } from "./QyUtils.js";
23
23
 
24
24
  import {
25
- CmdName_A as _,
26
- CmdName_D as C,
27
- CmdName_M as v,
28
- CmdName_R as p,
29
25
  QyAclCmdGenerator as t
30
26
  } from "./QyAcl.js";
31
27
 
32
28
  import {
33
- calDifferenceList as y
29
+ calDifferenceList as C
34
30
  } from "./QyIndex.js";
35
31
 
36
32
  import {
@@ -38,23 +34,24 @@ import {
38
34
  } from "./QyDefaultOptions.js";
39
35
 
40
36
  import {
41
- QyCD as x
37
+ QyCD as _
42
38
  } from "./QyCD.js";
43
39
 
44
40
  import {
45
- logger as D
41
+ logger as p
46
42
  } from "./QyLogger.js";
47
43
 
48
- let F = e.IndexPropPathsFileName, q = {
44
+ let m = e.IndexPropPathsFileName, y = {
49
45
  none: 0,
50
46
  basic: 1,
51
47
  delta: 2,
52
48
  all: 3
53
49
  };
54
50
 
55
- class j extends x {
51
+ class x extends _ {
56
52
  fileLogLevel;
57
53
  changeId;
54
+ aqIdx = 0;
58
55
  actionQueue = [];
59
56
  fileDeltaList = [];
60
57
  syncList = [];
@@ -68,135 +65,132 @@ class j extends x {
68
65
  ...i("QyBatch"),
69
66
  ...t
70
67
  };
71
- e = q[t.fileLogLevel.toLowerCase()];
72
- this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new H(t.maxHistoryCmdObjCount);
68
+ e = y[t.fileLogLevel.toLowerCase()];
69
+ this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new j(t.maxHistoryCmdObjCount);
73
70
  }
74
71
  createDir(e) {
75
- h(e) && (e = o(e));
72
+ o(e) && (e = s(e));
76
73
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
77
- return P(this, this._action_createDir, e);
74
+ return F(this, this._action_createDir, e);
78
75
  }
79
76
  delDir(e) {
80
- h(e) && (e = o(e));
77
+ o(e) && (e = s(e));
81
78
  e = this.qyCache.getOrCreateDir(e, this.currentDir).ensureAllLoaded();
82
- return P(this, this._action_delDir, e);
79
+ return F(this, this._action_delDir, e);
83
80
  }
84
81
  createFile(e) {
85
- h(e) && (e = o(e));
82
+ o(e) && (e = s(e));
86
83
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
87
- return P(this, this._action_createFile, e);
84
+ return F(this, this._action_createFile, e);
88
85
  }
89
86
  delFile(e) {
90
- h(e) && (e = o(e));
87
+ o(e) && (e = s(e));
91
88
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
92
- return P(this, this._action_delFile, e);
89
+ return F(this, this._action_delFile, e);
93
90
  }
94
91
  expireFile(e, t) {
95
92
  return this.expireFileM(e, 1e3 * t);
96
93
  }
97
94
  expireFileM(e, t) {
98
- return Q(this, e, t, "f");
95
+ return N(this, e, t, "f");
99
96
  }
100
97
  expireDir(e, t) {
101
98
  return this.expireDirM(e, 1e3 * t);
102
99
  }
103
100
  expireDirM(e, t) {
104
- return Q(this, e, t, "d");
101
+ return N(this, e, t, "d");
105
102
  }
106
103
  expireContent(e, t, i) {
107
- h(e) && (e = o(e));
104
+ o(e) && (e = s(e));
108
105
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
109
- return P(this, this._action_expireContent, e, t, i);
106
+ return F(this, this._action_expireContent, e, t, i);
110
107
  }
111
108
  expireContentM(e, t) {
112
109
  return this.expireContent(e, t, !0);
113
110
  }
114
111
  removeFileExpire(e, t = !1) {
115
- return S(this, e, "f", t);
112
+ return A(this, e, "f", t);
116
113
  }
117
114
  removeDirExpire(e, t = !1) {
118
- return S(this, e, "d", t);
115
+ return A(this, e, "d", t);
119
116
  }
120
117
  removeContentExpire(e, t, i = !1) {
121
- h(e) && (e = o(e));
118
+ o(e) && (e = s(e));
122
119
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
123
- return P(this, this._action_removeContentExpire, e, t, i);
120
+ return F(this, this._action_removeContentExpire, e, t, i);
124
121
  }
125
122
  createIndex(e, t) {
126
- h(e) && (e = o(e)), u(t) || (t = [ t ]);
123
+ o(e) && (e = s(e)), u(t) || (t = [ t ]);
127
124
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
128
- return P(this, this._action_createIndex, e, t);
125
+ return F(this, this._action_createIndex, e, t);
129
126
  }
130
127
  createIndexByQuery(e, t) {
131
- h(e) && (e = o(e));
128
+ o(e) && (e = s(e));
132
129
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
133
- return P(this, this._action_createIndexByQuery, e, t);
130
+ return F(this, this._action_createIndexByQuery, e, t);
134
131
  }
135
132
  delIndex(e, t) {
136
- h(e) && (e = o(e));
133
+ o(e) && (e = s(e));
137
134
  e = this.qyCache.getOrCreateDir(e, this.currentDir);
138
- return P(this, this._action_delIndex, e, t);
135
+ return F(this, this._action_delIndex, e, t);
139
136
  }
140
137
  insert(e, t) {
141
- h(e) && (e = o(e));
138
+ o(e) && (e = s(e));
142
139
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
143
- return P(this, this._action_insert, e, t);
140
+ return F(this, this._action_insert, e, t);
144
141
  }
145
142
  insertEmbedding(e, t) {
146
- var i = this.qyCache, i = (g(t) || (t = new Float32Array(t)), h(e) && (e = o(e)),
143
+ var i = this.qyCache, i = (g(t) || (t = new Float32Array(t)), o(e) && (e = s(e)),
147
144
  i.getOrCreateFile(e, this.currentDir));
148
- return P(this, this._action_insertEmbedding, i, t);
145
+ return F(this, this._action_insertEmbedding, i, t);
149
146
  }
150
147
  delEmbedding(e) {
151
- var t = this.qyCache, t = (h(e) && (e = o(e)), t.getOrCreateFile(e, this.currentDir));
152
- return P(this, this._action_delEmbedding, t);
148
+ var t = this.qyCache, t = (o(e) && (e = s(e)), t.getOrCreateFile(e, this.currentDir));
149
+ return F(this, this._action_delEmbedding, t);
153
150
  }
154
151
  insertWithEmbedding(e, t, i) {
155
152
  return this.insert(e, t), this.insertEmbedding(e, i);
156
153
  }
157
154
  delContent(e) {
158
- h(e) && (e = o(e));
155
+ o(e) && (e = s(e));
159
156
  e = this.qyCache.getOrCreateFile(e, this.currentDir).ensureLoaded();
160
- return P(this, this._action_delContent, e);
157
+ return F(this, this._action_delContent, e);
161
158
  }
162
159
  insertTrigger(e, t, i, r) {
163
- h(t) && (t = o(t)), i = n(i);
160
+ o(t) && (t = s(t)), i = n(i);
164
161
  e = this.qyCache.getOrCreateTriggerFile(e);
165
- return P(this, this._action_insertTrigger, e, t, i, r);
162
+ return F(this, this._action_insertTrigger, e, t, i, r);
166
163
  }
167
164
  removeTrigger(e) {
168
- return P(this, this._action_removeTrigger, this.qyCache.getOrCreateTriggerFile(e));
165
+ return F(this, this._action_removeTrigger, this.qyCache.getOrCreateTriggerFile(e));
169
166
  }
170
167
  insertRpc(e, t) {
171
168
  e = this.qyCache.getOrCreateRpcFile(e);
172
- return P(this, this._action_insertRpc, e, t);
169
+ return F(this, this._action_insertRpc, e, t);
173
170
  }
174
171
  removeRpc(e) {
175
- return P(this, this._action_removeRpc, this.qyCache.getOrCreateRpcFile(e));
172
+ return F(this, this._action_removeRpc, this.qyCache.getOrCreateRpcFile(e));
176
173
  }
177
174
  run(e = !1) {
178
- var {
179
- running: t,
180
- actionQueue: i
181
- } = this;
182
- if (t || 0 === i.length) return 0;
175
+ if (this.running || 0 === this.aqIdx) return 0;
183
176
  this.running = !0;
184
- var r, n, {
185
- qyCache: t,
186
- qyAclCmdGenerator: a
187
- } = this, s = this.changeId = t.increaseChangeId();
188
- for ([ r, n ] of i) r.apply(this, n);
189
- i.length = 0, this.running = !1, this.resetCurrentDir();
190
- i = a.cmdCount;
191
- if (0 === i) return t.decreaseChangeId(), 0;
192
177
  var {
193
- fileLogLevel: o,
194
- logList: h,
195
- qyCmdObjHistory: d,
196
- syncList: l
197
- } = this, c = m(i), a = a.takeCmdArgAsListArray(), o = 0 < o ? "" + new Date().toISOString() + `: ${i} change${c}:
198
- ${h.join("\n")}
199
- ` : void 0, i = (h.length = 0, t.save(s, a, o, (e => {
178
+ actionQueue: t,
179
+ qyCache: i,
180
+ qyAclCmdGenerator: r
181
+ } = this, n = this.changeId = i.increaseChangeId();
182
+ for (let e = 0; e < this.aqIdx; e += 2) t[e].apply(this, t[e + 1]), t[e] = t[e + 1] = void 0;
183
+ this.aqIdx = 0, this.running = !1, this.resetCurrentDir();
184
+ var a = r.cmdCount;
185
+ if (0 === a) return i.decreaseChangeId(), 0;
186
+ var {
187
+ fileLogLevel: s,
188
+ logList: o,
189
+ qyCmdObjHistory: h,
190
+ syncList: d
191
+ } = this, l = v(a), r = r.takeCmdArgAsListArray(), s = 0 < s ? "" + new Date().toISOString() + `: ${a} change${l}:
192
+ ${o.join("\n")}
193
+ ` : void 0, a = (o.length = 0, i.save(n, r, s, (e => {
200
194
  var t = e.syncList, i = t.length;
201
195
  for (let e = 0; e < i; e += 2) {
202
196
  var r, n = e + 1, a = t[e], s = t[n];
@@ -205,20 +199,20 @@ ${h.join("\n")}
205
199
  }
206
200
  if (0 < i) return t;
207
201
  })(this), e));
208
- l.length = 0, d.push(a);
209
- var u = this.fileDeltaList, f = u.length;
210
- if (0 < f) {
211
- var g = [];
212
- for (let e = 0; e < f; e += 2) {
213
- var _ = u[e];
214
- 0 < _.triggerNodes?.length && g.push(_, u[e + 1]);
202
+ d.length = 0, h.push(r);
203
+ var c = this.fileDeltaList, u = c.length;
204
+ if (0 < u) {
205
+ var f = [];
206
+ for (let e = 0; e < u; e += 2) {
207
+ var g = c[e];
208
+ 0 < g.triggerNodes?.length && f.push(g, c[e + 1]);
215
209
  }
216
- for (let e = u.length = 0; e < g.length; e += 2) {
217
- var C, v = g[e], p = g[e + 1];
218
- for (C of v.triggerNodes) C.checkTrigger(v, p);
210
+ for (let e = c.length = 0; e < f.length; e += 2) {
211
+ var C, _ = f[e], p = f[e + 1];
212
+ for (C of _.triggerNodes) C.checkTrigger(_, p);
219
213
  }
220
214
  }
221
- return e ? i : s;
215
+ return e ? a : n;
222
216
  }
223
217
  getTopHistoryCmdObj() {
224
218
  return this.qyCmdObjHistory.top();
@@ -246,16 +240,16 @@ ${h.join("\n")}
246
240
  return !!this._action_delFile(e) && (this.qyCache.removeRpc(e.name), !0);
247
241
  }
248
242
  _action_createIndex(e, t) {
249
- var i = this.qyCache.getOrCreateIndexDir(e), r = O(this, i), t = r.qyIndexPropTree.insertPropPathList(t);
250
- 0 < t.length && L(this, e, 0, r, t);
243
+ var i = this.qyCache.getOrCreateIndexDir(e), r = D(this, i), t = r.qyIndexPropTree.insertPropPathList(t);
244
+ 0 < t.length && q(this, e, 0, r, t);
251
245
  }
252
246
  _action_createIndexByQuery(e, t) {
253
- var i = this.qyCache.getOrCreateIndexDir(e), r = O(this, i), t = r.qyIndexPropTree.insertQueryObj(t);
254
- 0 < t.length && L(this, e, 0, r, t);
247
+ var i = this.qyCache.getOrCreateIndexDir(e), r = D(this, i), t = r.qyIndexPropTree.insertQueryObj(t);
248
+ 0 < t.length && q(this, e, 0, r, t);
255
249
  }
256
250
  _action_delIndex(e, t) {
257
251
  var i, e = this.qyCache.getIndexDir(e);
258
- void 0 !== e && (void 0 === (i = e.getFile(F)) ? this._action_delDir(e) : (e = i.qyIndexPropTree,
252
+ void 0 !== e && (void 0 === (i = e.getFile(m)) ? this._action_delDir(e) : (e = i.qyIndexPropTree,
259
253
  [ i, e, t ] = (this._action_setProp(i, JSON.stringify(t), null), e.removePropPath(t)),
260
254
  i && !e && void 0 !== t && (i = t.indexPropDir, void 0 !== i) && this._action_delDir(i)));
261
255
  }
@@ -265,7 +259,7 @@ ${h.join("\n")}
265
259
  e.created = !1, t || ({
266
260
  parentDir: t,
267
261
  name: i
268
- } = e, b(this, t, p, t.fileMapKey, i)), I(this, "delFile", e), !0);
262
+ } = e, P(this, t, t.fileMapKey, i)), I(this, "delFile", e), !0);
269
263
  }
270
264
  _action_delDir(e) {
271
265
  if (!e.created) return !1;
@@ -278,11 +272,11 @@ ${h.join("\n")}
278
272
  fileMapKey: s
279
273
  } = e;
280
274
  if (n) {
281
- b(this, e, C, s);
275
+ b(this, e, s);
282
276
  for (var o of e.fileList) this._action_delFile(o, !0);
283
277
  }
284
278
  if (r) {
285
- b(this, e, C, a);
279
+ b(this, e, a);
286
280
  for (var h of e.allSubdirs()) {
287
281
  let {
288
282
  subdirMap: e,
@@ -290,19 +284,19 @@ ${h.join("\n")}
290
284
  subdirMapKey: i,
291
285
  fileMapKey: r
292
286
  } = h;
293
- if (e && b(this, h, C, i), t) {
294
- b(this, h, C, r);
287
+ if (e && b(this, h, i), t) {
288
+ b(this, h, r);
295
289
  for (var d of h.fileList) this._action_delFile(d, !0);
296
290
  }
297
291
  I(this, "delDir", h), h.created = !1;
298
292
  }
299
293
  }
300
- return void 0 !== t && (e.created = !1, b(this, t, p, t.subdirMapKey, i),
301
- I(this, "delDir", e), !0);
294
+ return void 0 !== t && (e.created = !1, P(this, t, t.subdirMapKey, i), I(this, "delDir", e),
295
+ !0);
302
296
  }
303
297
  _action_delContent(e) {
304
298
  var t = e.fileContent;
305
- return void 0 !== t && (e.fileContent = void 0, b(this, e, C, e.fileContentKey),
299
+ return void 0 !== t && (e.fileContent = void 0, b(this, e, e.fileContentKey),
306
300
  I(this, "delContent", e, t, [ t, null ]), E(this, e, t), !0);
307
301
  }
308
302
  _action_insertEmbedding(e, t) {
@@ -334,23 +328,24 @@ ${h.join("\n")}
334
328
  } = e, r = (r || this._action_createFile(e), a ? a[t] : void 0);
335
329
  return null === i ? void 0 !== a && delete a[t] : void 0 !== a ? a[t] = i : e.fileContent = {
336
330
  [t]: i
337
- }, b(this, e, v, n, t, i), r;
331
+ }, a = e, e = n, (n = this).qyAclCmdGenerator.pushMPropCmd(e, t, i), L(n, a, e),
332
+ r;
338
333
  }
339
334
  _action_insert(e, t) {
340
- if (void 0 === t) return D.warn(`Saving undefined to ${e.fullPath}. Not making any change.`),
335
+ if (void 0 === t) return p.warn(`Saving undefined to ${e.fullPath}. Not making any change.`),
341
336
  !1;
342
337
  e.created || this._action_createFile(e);
343
- var [ t, i ] = s(e.fileContent, t);
338
+ var [ t, i ] = h(e.fileContent, t);
344
339
  if (void 0 === i) return !1;
345
340
  e.fileContent = t;
346
- var [ r, n ] = i, a = e.fileContentKey;
347
- return void 0 === t ? b(this, e, C, a) : b(this, e, v, a, n), I(this, "insert", e, t, i),
348
- E(this, e, r, n, t), !0;
341
+ var r, n, [ a, s ] = i, o = e.fileContentKey;
342
+ return void 0 === t ? b(this, e, o) : (n = e, o = o, (r = this).qyAclCmdGenerator.pushMCmd(o, s),
343
+ L(r, n, o)), I(this, "insert", e, t, i), E(this, e, a, s, t), !0;
349
344
  }
350
345
  _action_createFile(e) {
351
346
  var t;
352
347
  return !e.created && (t = e.parentDir, t.created || this._action_createDir(t),
353
- e.created = !0, e.fileContentLoaded = !0, b(this, t, _, t.fileMapKey, e.name),
348
+ e.created = !0, e.fileContentLoaded = !0, O(this, t, t.fileMapKey, e.name),
354
349
  I(this, "createFile", e), !0);
355
350
  }
356
351
  _action_createDir(e) {
@@ -359,7 +354,7 @@ ${h.join("\n")}
359
354
  for (let e of t.reverse()) {
360
355
  e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0;
361
356
  var i = e.parentDir;
362
- b(this, i, _, i.subdirMapKey, e.name), I(this, "createDir", e);
357
+ O(this, i, i.subdirMapKey, e.name), I(this, "createDir", e);
363
358
  }
364
359
  return !0;
365
360
  }
@@ -368,7 +363,7 @@ ${h.join("\n")}
368
363
  parentDir: r,
369
364
  name: n
370
365
  } = e;
371
- return void 0 !== r && void 0 !== (t = M(t, !0, c())) && (i = this.qyCache,
366
+ return void 0 !== r && void 0 !== (t = Q(t, !0, c())) && (i = this.qyCache,
372
367
  r = i.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"), (r = this._action_insert(r, {
373
368
  [n]: t
374
369
  })) && i.monitorItemExpire(e, t), r);
@@ -385,28 +380,28 @@ ${h.join("\n")}
385
380
  }
386
381
  _action_expireContent(e, t, i) {
387
382
  let r = c();
388
- var t = T(t, e => M(e, i, r)), n = this.qyCache, a = n.getOrCreateExpireInfoFile(e.fullPathHash, "c"), a = this._action_insert(a, {
383
+ var t = M(t, e => Q(e, i, r)), n = this.qyCache, a = n.getOrCreateExpireInfoFile(e.fullPathHash, "c"), a = this._action_insert(a, {
389
384
  ...t
390
385
  });
391
386
  return a && n.monitorContentExpire(e, t), a;
392
387
  }
393
388
  _action_removeContentExpire(e, t, i) {
394
389
  var r, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
395
- return void 0 !== a && (t = u(t) ? Object.fromEntries(t.map(e => [ e, null ])) : T(t, e => e ? null : void 0),
390
+ return void 0 !== a && (t = u(t) ? Object.fromEntries(t.map(e => [ e, null ])) : M(t, e => e ? null : void 0),
396
391
  (r = this._action_insert(a, t)) && (f(a.fileContent, !0) && this._action_delFile(a),
397
392
  i || n.unmonitorContentExpire(e, t)), r);
398
393
  }
399
394
  }
400
395
 
401
- function O(e, t) {
402
- t = t.getOrCreateFile(F);
396
+ function D(e, t) {
397
+ t = t.getOrCreateFile(m);
403
398
  return t.created || e._action_createFile(t), t;
404
399
  }
405
400
 
406
- function L(t, i, e, r, n) {
401
+ function q(t, i, e, r, n) {
407
402
  var a, s = {};
408
403
  for (a of n) s[JSON.stringify(a.indexPropPath)] = 1;
409
- D.log(`Creating index ${JSON.stringify(s)} for ` + i.fullPath), t._action_insert(r, s);
404
+ p.log(`Creating index ${n.map(e => e.indexPropPath)} for ` + i.fullPath), t._action_insert(r, s);
410
405
  {
411
406
  var o = t, h = i, d;
412
407
  let e;
@@ -422,62 +417,76 @@ function L(t, i, e, r, n) {
422
417
  fileContent: u,
423
418
  name: f
424
419
  } = u;
425
- void 0 !== u && N(o, c, l, f, void 0, u);
420
+ void 0 !== u && T(o, c, l, f, void 0, u);
426
421
  }
427
422
  }
428
423
  }
429
424
  }
430
425
  }
431
426
 
432
- function P(e, t, ...i) {
433
- return e.running ? t.apply(e, i) : e.actionQueue.push([ t, i ]), e;
427
+ function F(e, t, ...i) {
428
+ var r, n;
429
+ return e.running ? t.apply(e, i) : ({
430
+ aqIdx: r,
431
+ actionQueue: n
432
+ } = e, n[r] = t, n[r + 1] = i, e.aqIdx += 2), e;
434
433
  }
435
434
 
436
435
  function I(t, i, r, n = void 0, a = void 0) {
437
436
  var {
438
- fileLogLevel: t,
439
- logList: s,
437
+ fileLogLevel: s,
440
438
  fileDeltaList: o
441
439
  } = t;
442
- if (void 0 !== a && o.push(r, a), !(t <= 0)) {
440
+ if (void 0 !== a && o.push(r, a), !(s <= 0)) {
443
441
  o = i + ` "${r.fullPath ?? r}"`;
444
442
  let e = o;
445
- "delContent" === i ? 3 === t && (e = o + " " + JSON.stringify(n)) : "insert" === i && 2 <= t && ([ r, i ] = a,
443
+ "delContent" === i ? 3 === s && (e = o + " " + JSON.stringify(n)) : "insert" === i && 2 <= s && ([ r, i ] = a,
446
444
  a = `${void 0 === r ? "" : "delta:"} ${JSON.stringify(r)} -> ` + JSON.stringify(i),
447
- 2 === t && (e = o + " " + a), i = void 0 !== r ? "new: " + JSON.stringify(n) : "",
448
- e = o + ` ${a}. ` + i), s.push(e);
445
+ 2 === s && (e = o + " " + a), i = void 0 !== r ? "new: " + JSON.stringify(n) : "",
446
+ e = o + ` ${a}. ` + i), t.logList.push(e);
449
447
  }
450
448
  }
451
449
 
452
- function b(e, t, i, r, n = void 0, a = void 0) {
450
+ function L(e, t, i) {
453
451
  var {
454
- qyAclCmdGenerator: e,
455
- qyCache: s,
456
- syncList: o,
457
- changeId: h
452
+ qyCache: e,
453
+ syncList: r,
454
+ changeId: n
458
455
  } = e;
459
- e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = h : r.startsWith("f") ? t.fChangeId = h : t.cChangeId = h,
460
- void 0 !== s && s.qyKVData.removeKey(r) && o.push(r, t);
456
+ i.startsWith("d") ? t.dChangeId = n : i.startsWith("f") ? t.fChangeId = n : t.cChangeId = n,
457
+ void 0 !== e && e.qyKVData.removeKey(i) && r.push(i, t);
458
+ }
459
+
460
+ function O(e, t, i, r) {
461
+ e.qyAclCmdGenerator.pushACmd(i, r), L(e, t, i);
462
+ }
463
+
464
+ function P(e, t, i, r) {
465
+ e.qyAclCmdGenerator.pushRCmd(i, r), L(e, t, i);
466
+ }
467
+
468
+ function b(e, t, i) {
469
+ e.qyAclCmdGenerator.pushDCmd(i), L(e, t, i);
461
470
  }
462
471
 
463
472
  function E(e, t, i, r = void 0, n = void 0) {
464
473
  if (!t.underHiddenFolder) {
465
474
  var a = e.qyCache.getIndexDir(t.parentDir);
466
475
  if (void 0 !== a) {
467
- a = a.getFile(F);
476
+ a = a.getFile(m);
468
477
  if (void 0 !== a) {
469
478
  var s, o, h = t.name;
470
479
  for ({
471
480
  indexPropDir: s,
472
481
  indexPropPath: o
473
- } of a.qyIndexPropTree.allLeafNodes) N(e, s, o, h, i, r, n);
482
+ } of a.qyIndexPropTree.allLeafNodes) T(e, s, o, h, i, r, n);
474
483
  }
475
484
  }
476
485
  }
477
486
  }
478
487
 
479
- function N(t, e, i, r, n, a, s = void 0) {
480
- e = y(e, i, n, a, s);
488
+ function T(t, e, i, r, n, a, s = void 0) {
489
+ e = C(e, i, n, a, s);
481
490
  if (void 0 !== e) {
482
491
  var o, h, [ i, n ] = e;
483
492
  for (o of i) {
@@ -499,9 +508,9 @@ function N(t, e, i, r, n, a, s = void 0) {
499
508
  }
500
509
  }
501
510
 
502
- class H {
511
+ class j {
503
512
  maxLength;
504
- actionQueue = [];
513
+ historyQueue = [];
505
514
  nextPos = 0;
506
515
  constructor(e) {
507
516
  this.maxLength = e;
@@ -511,49 +520,45 @@ class H {
511
520
  maxLength: t,
512
521
  nextPos: i
513
522
  } = this;
514
- this.actionQueue[i] = e, this.nextPos = ((e, t) => (t += 1) < e ? t : 0)(t, i);
523
+ this.historyQueue[i] = e, this.nextPos = ((e, t) => (t += 1) < e ? t : 0)(t, i);
515
524
  }
516
525
  top() {
517
- var {
518
- actionQueue: e,
519
- maxLength: t,
520
- nextPos: i
521
- } = this;
522
- return e[e = t, (0 < (t = i) ? t : e) - 1];
526
+ return this.historyQueue[e = this.maxLength, (0 < (t = this.nextPos) ? t : e) - 1];
527
+ var e, t;
523
528
  }
524
529
  }
525
530
 
526
- function T(e, t = void 0, i = [], r = {}) {
531
+ function M(e, t = void 0, i = [], r = {}) {
527
532
  if (l(e)) {
528
533
  var n = t ? t(e) : e;
529
534
  void 0 !== n && (r[JSON.stringify(i)] = n);
530
535
  } else {
531
536
  var a, s = i.length;
532
- for (a in e) i.push(a), T(e[a], t, i, r), i.length = s;
537
+ for (a in e) i.push(a), M(e[a], t, i, r), i.length = s;
533
538
  }
534
539
  return r;
535
540
  }
536
541
 
537
- function M(e, t, i) {
538
- 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;
542
+ function Q(e, t, i) {
543
+ return r(e) ? (t ? e : 1e3 * e) + i : o(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !a(e) || (t = e.getTime()) <= i ? void 0 : t;
539
544
  }
540
545
 
541
- function Q(e, t, i, r) {
546
+ function N(e, t, i, r) {
542
547
  var {
543
548
  qyCache: n,
544
549
  currentDir: a
545
- } = e, r = (h(t) && (t = o(t)), "f" === r ? n.getOrCreateFile(t, a) : n.getOrCreateDir(t, a));
546
- return P(e, e._action_expireItem, r, i);
550
+ } = e, r = (o(t) && (t = s(t)), "f" === r ? n.getOrCreateFile(t, a) : n.getOrCreateDir(t, a));
551
+ return F(e, e._action_expireItem, r, i);
547
552
  }
548
553
 
549
- function S(e, t, i, r) {
554
+ function A(e, t, i, r) {
550
555
  var {
551
556
  qyCache: n,
552
557
  currentDir: a
553
- } = e, i = (h(t) && (t = o(t)), "f" === i ? n.getOrCreateFile(t, a) : n.getOrCreateDir(t, a));
554
- return P(e, e._action_removeItemExpire, i, r);
558
+ } = e, i = (o(t) && (t = s(t)), "f" === i ? n.getOrCreateFile(t, a) : n.getOrCreateDir(t, a));
559
+ return F(e, e._action_removeItemExpire, i, r);
555
560
  }
556
561
 
557
562
  export {
558
- j as QyBatch
563
+ x as QyBatch
559
564
  };
package/src/QyCD.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { QyCache } from "./QyCache.ts";
2
2
  import type { QyDir } from "./QyDir.ts";
3
3
  import type { QyFile } from "./QyFile.ts";
4
4
  export declare class QyCD {
5
- qyCache: any;
5
+ qyCache: QyCache | undefined;
6
6
  currentDir: any;
7
7
  constructor(qyCache?: QyCache);
8
8
  cd(namePath: string | string[] | QyDir, parentDir?: any): this;
@@ -22,8 +22,8 @@ export declare class QyCD {
22
22
  get rpcFileList(): any;
23
23
  view(namePath: any, spec?: any, parentDir?: any): any;
24
24
  viewP(namePath: any, spec: any, parentDir?: any): any;
25
- queryFiles(indexHostDirNamePath: any, queryObj: any, limit?: number | undefined, cursor?: number | undefined, parentDir?: any): any;
26
- queryFilesMulti(indexHostDirNamePathMulti: any, limit: any, cursor: any, parentDir?: any): any;
25
+ queryFiles(indexHostDirNamePath: any, queryObj: any, limit?: number | undefined, cursor?: number | undefined, parentDir?: any): never[];
26
+ queryFilesMulti(indexHostDirNamePathMulti: any, limit: any, cursor: any, parentDir?: any): never[];
27
27
  queryTree(indexHostDirNamePath: any, queryObj: any, view: any, limit: any, cursor: any, parentDir?: any): {
28
28
  tree: any;
29
29
  count: any;
package/src/QyCache.d.ts CHANGED
@@ -19,7 +19,7 @@ export declare class QyCache extends EventEmitter {
19
19
  infoRootDir: any;
20
20
  recycleRootDir: any;
21
21
  exclusiveFilePath: any;
22
- rpcFunMap: any;
22
+ rpcFunMap: Map<string, Function>;
23
23
  qyKVData: QyKVData | undefined;
24
24
  qyFileLogger: QyFileLogger | undefined;
25
25
  qyEmbeddings: QyEmbeddings | undefined;