datafolder 1.0.30 → 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.
- package/package.json +4 -4
- package/scripts/fastify.js +3 -2
- package/src/QyAcl.js +4 -4
- package/src/QyBatch.d.ts +6 -4
- package/src/QyBatch.js +158 -172
- package/src/QyBinWriter.js +6 -6
- package/src/QyCD.js +36 -36
- package/src/QyCache.js +1 -1
- package/src/QyDB.js +1 -1
- package/src/QyDir.js +4 -4
- package/src/QyEmbeddingWriter.js +1 -1
- package/src/QyEmbeddings.js +1 -1
- package/src/QyExpire.d.ts +1 -1
- package/src/QyExpire.js +3 -3
- package/src/QyExpire_Worker.js +37 -35
- package/src/QyFile.js +13 -13
- package/src/QyFileContentUtils.js +55 -55
- package/src/QyIndex.d.ts +1 -4
- package/src/QyIndex.js +119 -128
- package/src/QyIndexPropTree.d.ts +22 -9
- package/src/QyIndexPropTree.js +66 -70
- package/src/QyIntersectNode.js +3 -3
- package/src/QyKVData.js +14 -14
- package/src/QyKVDataCleaner_Worker.js +40 -40
- package/src/QyMessager.js +3 -3
- package/src/QyOpRunner.js +2 -2
- package/src/QySaver.js +2 -2
- package/src/QySnapshotCompactor_Worker.js +6 -6
- package/src/QySnapshotSaver_Worker.js +1 -1
- package/src/QySnapshots.js +1 -1
- package/src/QyStructure.js +6 -6
- package/src/QyTrigger.js +8 -8
- package/src/QyUnionNode.js +2 -2
- package/src/QyUtils.js +3 -3
- package/src/rpc/getFileContent.js +1 -1
- package/src/rpc/getSubItems.js +1 -1
- package/static/codemirror.bundle/editor.bundle.js +70 -37
package/src/QyBatch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
isDeepStrictEqual as
|
|
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
|
|
12
|
+
isString as h,
|
|
13
13
|
getSuffix as g,
|
|
14
14
|
SpecialFilePaths as e,
|
|
15
|
-
toSingleName as
|
|
16
|
-
isSimpleType as
|
|
17
|
-
isEmptyObj as
|
|
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
|
|
27
|
-
CmdNames as
|
|
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
|
|
35
|
+
getDefaultOptions as i
|
|
36
36
|
} from "./QyDefaultOptions.js";
|
|
37
37
|
|
|
38
38
|
import {
|
|
39
|
-
QyCD as
|
|
39
|
+
QyCD as v
|
|
40
40
|
} from "./QyCD.js";
|
|
41
41
|
|
|
42
42
|
import {
|
|
43
|
-
|
|
44
|
-
} from "./QyIndexPropTree.js";
|
|
45
|
-
|
|
46
|
-
import {
|
|
47
|
-
logger as x
|
|
43
|
+
logger as y
|
|
48
44
|
} from "./QyLogger.js";
|
|
49
45
|
|
|
50
|
-
let
|
|
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
|
|
53
|
+
class F extends v {
|
|
58
54
|
fileLogLevel;
|
|
59
|
-
actionQueue;
|
|
60
55
|
changeId;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
...
|
|
65
|
+
...i("QyBatch"),
|
|
69
66
|
...t
|
|
70
67
|
};
|
|
71
|
-
e =
|
|
72
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
}
|
|
@@ -103,18 +92,18 @@ class O extends t {
|
|
|
103
92
|
return this.expireFileM(e, 1e3 * t, i);
|
|
104
93
|
}
|
|
105
94
|
expireFileM(e, t, i = this.currentDir) {
|
|
106
|
-
return
|
|
95
|
+
return S(this, e, t, "f", i);
|
|
107
96
|
}
|
|
108
97
|
expireDir(e, t, i = this.currentDir) {
|
|
109
98
|
return this.expireDirM(e, 1e3 * t, i);
|
|
110
99
|
}
|
|
111
100
|
expireDirM(e, t, i = this.currentDir) {
|
|
112
|
-
return
|
|
101
|
+
return S(this, e, t, "d", i);
|
|
113
102
|
}
|
|
114
103
|
expireContent(e, t, i, r = this.currentDir) {
|
|
115
|
-
|
|
104
|
+
h(e) && (e = o(e));
|
|
116
105
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
117
|
-
return
|
|
106
|
+
return O(this, this._action_expireContent, {
|
|
118
107
|
item: e,
|
|
119
108
|
expireInfoObj: t,
|
|
120
109
|
isMilliSecond: i
|
|
@@ -124,56 +113,56 @@ class O extends t {
|
|
|
124
113
|
return this.expireContent(e, t, !0, i);
|
|
125
114
|
}
|
|
126
115
|
removeFileExpire(e, t = !1, i = this.currentDir) {
|
|
127
|
-
return
|
|
116
|
+
return T(this, e, "f", t, i);
|
|
128
117
|
}
|
|
129
118
|
removeDirExpire(e, t = !1, i = this.currentDir) {
|
|
130
|
-
return
|
|
119
|
+
return T(this, e, "d", t, i);
|
|
131
120
|
}
|
|
132
121
|
removeContentExpire(e, t, i = !1, r = this.currentDir) {
|
|
133
|
-
|
|
122
|
+
h(e) && (e = o(e));
|
|
134
123
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
135
|
-
return
|
|
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
|
-
|
|
131
|
+
h(e) && (e = o(e)), u(t) || (t = [ t ]);
|
|
143
132
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
144
|
-
return
|
|
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
|
-
|
|
139
|
+
h(e) && (e = o(e));
|
|
151
140
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
152
|
-
return
|
|
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
|
-
|
|
147
|
+
h(e) && (e = o(e));
|
|
159
148
|
e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
|
|
160
|
-
return t = i ||
|
|
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)),
|
|
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
|
|
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 = (
|
|
176
|
-
return
|
|
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
|
-
|
|
173
|
+
h(e) && (e = o(e));
|
|
185
174
|
e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
|
|
186
|
-
return
|
|
175
|
+
return O(this, this._action_delContent, {
|
|
187
176
|
item: e
|
|
188
177
|
});
|
|
189
178
|
}
|
|
190
179
|
insertTrigger(e, t, i, r) {
|
|
191
|
-
|
|
180
|
+
h(t) && (t = o(t)), i = n(i);
|
|
192
181
|
e = this.qyCache.getOrCreateTriggerFile(e);
|
|
193
|
-
return
|
|
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
|
|
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
|
|
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
|
|
202
|
+
return O(this, this._action_removeRpc, {
|
|
214
203
|
item: this.qyCache.getOrCreateRpcFile(e)
|
|
215
204
|
});
|
|
216
205
|
}
|
|
@@ -230,17 +219,17 @@ class O extends t {
|
|
|
230
219
|
changeList: i,
|
|
231
220
|
qyAclCmdGenerator: o,
|
|
232
221
|
qyCmdObjHistory: s,
|
|
233
|
-
syncList:
|
|
234
|
-
} = this,
|
|
235
|
-
if (0 ===
|
|
236
|
-
var
|
|
237
|
-
let
|
|
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"),
|
|
229
|
+
}) => e).join("\n"), c = new Date().toISOString() + `: ${l} change${d}:
|
|
241
230
|
${r}
|
|
242
231
|
`);
|
|
243
|
-
var m, u,
|
|
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),
|
|
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
|
|
260
|
-
return e ?
|
|
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 && !
|
|
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(
|
|
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),
|
|
306
|
+
}), n).qyIndexPropTree, o = [];
|
|
321
307
|
for (e of i) {
|
|
322
|
-
var
|
|
323
|
-
|
|
308
|
+
var s = a.insert(e);
|
|
309
|
+
void 0 !== s && o.push(s);
|
|
324
310
|
}
|
|
325
|
-
if (0 !==
|
|
326
|
-
|
|
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
|
|
320
|
+
var d, c = this, m = t, u = r;
|
|
332
321
|
let e;
|
|
333
|
-
for (
|
|
334
|
-
var f = u.searchOrCreateSubdir(
|
|
335
|
-
if (!
|
|
336
|
-
|
|
337
|
-
item:
|
|
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
|
|
328
|
+
for (var p of e = void 0 === e ? m.fileList : e) {
|
|
340
329
|
var {
|
|
341
|
-
fileContent:
|
|
330
|
+
fileContent: p,
|
|
342
331
|
name: C
|
|
343
|
-
} =
|
|
344
|
-
void 0 !==
|
|
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(
|
|
358
|
-
t.remove(r)
|
|
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
|
|
@@ -372,7 +361,7 @@ ${r}
|
|
|
372
361
|
parentDir: r,
|
|
373
362
|
name: n
|
|
374
363
|
} = i;
|
|
375
|
-
return i.created = !1,
|
|
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,33 +377,33 @@ ${r}
|
|
|
388
377
|
fileMapKey: s
|
|
389
378
|
} = t;
|
|
390
379
|
if (a) {
|
|
391
|
-
q(this, t,
|
|
392
|
-
for (var
|
|
393
|
-
item:
|
|
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
|
-
q(this, t,
|
|
398
|
-
for (var
|
|
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
|
-
} =
|
|
405
|
-
if (e && q(this,
|
|
406
|
-
q(this,
|
|
407
|
-
for (var
|
|
408
|
-
item:
|
|
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:
|
|
414
|
-
}),
|
|
402
|
+
item: l
|
|
403
|
+
}), l.created = !1;
|
|
415
404
|
}
|
|
416
405
|
}
|
|
417
|
-
return
|
|
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) {
|
|
@@ -423,28 +412,28 @@ ${r}
|
|
|
423
412
|
return void 0 !== i && (t.fileContent = void 0, e.content = i, e.delta = {
|
|
424
413
|
oldValue: i,
|
|
425
414
|
newValue: null
|
|
426
|
-
},
|
|
415
|
+
}, P(this, e), q(this, t, p.D, t.fileContentKey), N(this, t, i), !0);
|
|
427
416
|
}
|
|
428
417
|
_action_insertEmbedding(e) {
|
|
429
418
|
e.actionName = "insertEmbedding";
|
|
430
419
|
var t, i, r = this.qyCache, n = r.qyEmbeddings, {
|
|
431
420
|
item: a,
|
|
432
421
|
embedding: o
|
|
433
|
-
} = e, s = o.length, r = r.getOrCreateInfoFile(a),
|
|
434
|
-
let
|
|
435
|
-
return r.created &&
|
|
436
|
-
|
|
437
|
-
|
|
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)) : ({
|
|
438
427
|
fullPathHash: t,
|
|
439
|
-
namePath:
|
|
428
|
+
namePath: h
|
|
440
429
|
} = a, i = n.addEmbedding(t, o), this._action_insert({
|
|
441
430
|
item: r,
|
|
442
431
|
content: {
|
|
443
432
|
length: s,
|
|
444
433
|
idx: i,
|
|
445
|
-
namePath: r.created ? void 0 :
|
|
434
|
+
namePath: r.created ? void 0 : h
|
|
446
435
|
}
|
|
447
|
-
}),
|
|
436
|
+
}), l = !0), l && P(this, e), l;
|
|
448
437
|
}
|
|
449
438
|
_action_delEmbedding(e) {
|
|
450
439
|
e.actionName = "delEmbedding";
|
|
@@ -454,7 +443,7 @@ ${r}
|
|
|
454
443
|
if (t && (o = t.fileContent, o) && (n = o.length, a = o.idx), i.delEmbedding(r.fullPathHash, n, a),
|
|
455
444
|
t) return this._action_delFile({
|
|
456
445
|
item: t
|
|
457
|
-
}),
|
|
446
|
+
}), P(this, e), !0;
|
|
458
447
|
}
|
|
459
448
|
_action_put(e) {
|
|
460
449
|
e.actionName = "put";
|
|
@@ -462,13 +451,13 @@ ${r}
|
|
|
462
451
|
item: t,
|
|
463
452
|
content: i
|
|
464
453
|
} = e;
|
|
465
|
-
if (void 0 === i) return
|
|
454
|
+
if (void 0 === i) return y.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
|
|
466
455
|
!1;
|
|
467
456
|
t.created || this._action_createFile({
|
|
468
457
|
item: t
|
|
469
458
|
});
|
|
470
459
|
var r = t.fileContentKey;
|
|
471
|
-
return i.$rpl = 1, q(this, t,
|
|
460
|
+
return i.$rpl = 1, q(this, t, p.M, r, i), P(this, e), t.fileContent = i,
|
|
472
461
|
!0;
|
|
473
462
|
}
|
|
474
463
|
_setProp(e, t, i) {
|
|
@@ -481,7 +470,7 @@ ${r}
|
|
|
481
470
|
}), a ? a[t] : void 0);
|
|
482
471
|
return null === i ? void 0 !== a && delete a[t] : void 0 !== a ? a[t] = i : e.fileContent = {
|
|
483
472
|
[t]: i
|
|
484
|
-
}, q(this, e,
|
|
473
|
+
}, q(this, e, p.M, n, t, i), r;
|
|
485
474
|
}
|
|
486
475
|
_action_insert(e) {
|
|
487
476
|
e.actionName = "insert";
|
|
@@ -494,7 +483,7 @@ ${r}
|
|
|
494
483
|
merged: a,
|
|
495
484
|
delta: o
|
|
496
485
|
} = e;
|
|
497
|
-
if (void 0 === o && void 0 === r) return
|
|
486
|
+
if (void 0 === o && void 0 === r) return y.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
|
|
498
487
|
!1;
|
|
499
488
|
if (!i.created) {
|
|
500
489
|
if (n) return !1;
|
|
@@ -506,8 +495,8 @@ ${r}
|
|
|
506
495
|
o = n.delta), void 0 !== o && ({
|
|
507
496
|
oldValue: r,
|
|
508
497
|
newValue: n
|
|
509
|
-
} = o, t = i.fileContentKey, void 0 === a ? q(this, i,
|
|
510
|
-
e.merged = a, e.delta = o,
|
|
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),
|
|
511
500
|
!0);
|
|
512
501
|
}
|
|
513
502
|
_action_createFile(e) {
|
|
@@ -515,7 +504,7 @@ ${r}
|
|
|
515
504
|
var t, i = e.item;
|
|
516
505
|
return !i.created && (t = i.parentDir, this._action_createDir({
|
|
517
506
|
item: t
|
|
518
|
-
}), i.created = !0, i.fileContentLoaded = !0,
|
|
507
|
+
}), i.created = !0, i.fileContentLoaded = !0, P(this, e), q(this, t, p.A, t.fileMapKey, i.name),
|
|
519
508
|
!0);
|
|
520
509
|
}
|
|
521
510
|
_action_createDir(e) {
|
|
@@ -524,12 +513,12 @@ ${r}
|
|
|
524
513
|
if (t.created) return !1;
|
|
525
514
|
for (var i = []; !t.created; ) i.push(t), t = t.parentDir;
|
|
526
515
|
for (let e of i.reverse()) {
|
|
527
|
-
e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0,
|
|
516
|
+
e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0, P(this, {
|
|
528
517
|
actionName: "createDir",
|
|
529
518
|
item: e
|
|
530
519
|
});
|
|
531
520
|
var r = e.parentDir;
|
|
532
|
-
q(this, r,
|
|
521
|
+
q(this, r, p.A, r.subdirMapKey, e.name);
|
|
533
522
|
}
|
|
534
523
|
return !0;
|
|
535
524
|
}
|
|
@@ -542,8 +531,8 @@ ${r}
|
|
|
542
531
|
parentDir: r,
|
|
543
532
|
name: n
|
|
544
533
|
} = e;
|
|
545
|
-
return
|
|
546
|
-
(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({
|
|
547
536
|
item: r,
|
|
548
537
|
content: {
|
|
549
538
|
[n]: i
|
|
@@ -559,14 +548,14 @@ ${r}
|
|
|
559
548
|
parentDir: r,
|
|
560
549
|
name: n
|
|
561
550
|
} = e;
|
|
562
|
-
return
|
|
551
|
+
return void 0 !== r && (t = this.qyCache, void 0 !== (r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
|
|
563
552
|
item: r,
|
|
564
553
|
content: {
|
|
565
554
|
[n]: null
|
|
566
555
|
}
|
|
567
|
-
})) && (
|
|
556
|
+
})) && (c(r.fileContent) && this._action_delFile({
|
|
568
557
|
item: r
|
|
569
|
-
}), i
|
|
558
|
+
}), void 0 === i) && t.unmonitorItemExpire(e), n);
|
|
570
559
|
}
|
|
571
560
|
_action_expireContent(e) {
|
|
572
561
|
e.actionName = "expireContent";
|
|
@@ -575,7 +564,7 @@ ${r}
|
|
|
575
564
|
expireInfoObj: i,
|
|
576
565
|
isMilliSecond: r
|
|
577
566
|
} = e, n = m();
|
|
578
|
-
var e =
|
|
567
|
+
var e = I(i, e => E(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
|
|
579
568
|
item: o,
|
|
580
569
|
content: {
|
|
581
570
|
...e
|
|
@@ -590,22 +579,22 @@ ${r}
|
|
|
590
579
|
expireInfoObj: i,
|
|
591
580
|
infoFileOnly: r
|
|
592
581
|
} = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
|
|
593
|
-
return
|
|
582
|
+
return void 0 !== a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) : I(i, e => e ? null : void 0),
|
|
594
583
|
(t = this._action_insert({
|
|
595
584
|
item: a,
|
|
596
585
|
content: i
|
|
597
|
-
})) && (
|
|
586
|
+
})) && (c(a.fileContent, !0) && this._action_delFile({
|
|
598
587
|
item: a
|
|
599
588
|
}), r || n.unmonitorContentExpire(e, i)), t);
|
|
600
589
|
}
|
|
601
590
|
}
|
|
602
591
|
|
|
603
|
-
function
|
|
592
|
+
function O(e, t, i) {
|
|
604
593
|
return e.running ? t.call(e, i) : (i.actionFun = t, e.actionQueue.push(i)),
|
|
605
594
|
e;
|
|
606
595
|
}
|
|
607
596
|
|
|
608
|
-
function
|
|
597
|
+
function P(e, t) {
|
|
609
598
|
var {
|
|
610
599
|
changeList: e,
|
|
611
600
|
fileLogLevel: i
|
|
@@ -634,50 +623,47 @@ function q(e, t, i, r, n = void 0, a = void 0) {
|
|
|
634
623
|
qyAclCmdGenerator: e,
|
|
635
624
|
qyCache: o,
|
|
636
625
|
syncList: s,
|
|
637
|
-
changeId:
|
|
626
|
+
changeId: h
|
|
638
627
|
} = e;
|
|
639
|
-
e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId =
|
|
628
|
+
e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = h : r.startsWith("f") ? t.fChangeId = h : t.cChangeId = h,
|
|
640
629
|
o && o.qyKVData.removeKey(r) && s.push(r, t);
|
|
641
630
|
}
|
|
642
631
|
|
|
643
|
-
function
|
|
632
|
+
function N(e, t, i, r = void 0, n = void 0) {
|
|
644
633
|
if (!t.underHiddenFolder) {
|
|
645
634
|
var a = e.qyCache.getIndexDir(t.parentDir);
|
|
646
|
-
if (a) {
|
|
647
|
-
|
|
648
|
-
if (
|
|
649
|
-
var
|
|
650
|
-
for (
|
|
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);
|
|
651
640
|
}
|
|
652
641
|
}
|
|
653
642
|
}
|
|
654
643
|
}
|
|
655
644
|
|
|
656
|
-
function
|
|
657
|
-
e =
|
|
658
|
-
if (e) {
|
|
659
|
-
var s,
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
for (l of n) l.created && t._setProp(l, r, null);
|
|
665
|
-
for (h of n) if (h.created) {
|
|
666
|
-
var c = h.fileContent;
|
|
667
|
-
if (void 0 === c || d(c)) {
|
|
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)) {
|
|
668
653
|
t._action_delFile({
|
|
669
|
-
item:
|
|
654
|
+
item: s
|
|
670
655
|
});
|
|
671
|
-
let e =
|
|
656
|
+
let e = s.parentDir;
|
|
672
657
|
for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
|
|
673
658
|
item: e
|
|
674
659
|
}), e = e.parentDir;
|
|
675
660
|
}
|
|
676
661
|
}
|
|
662
|
+
for (h of n) t._setProp(h, r, 1);
|
|
677
663
|
}
|
|
678
664
|
}
|
|
679
665
|
|
|
680
|
-
class
|
|
666
|
+
class b {
|
|
681
667
|
maxLength;
|
|
682
668
|
actionQueue;
|
|
683
669
|
nextPos;
|
|
@@ -705,37 +691,37 @@ class I {
|
|
|
705
691
|
}
|
|
706
692
|
}
|
|
707
693
|
|
|
708
|
-
function
|
|
709
|
-
if (
|
|
694
|
+
function I(e, t = void 0, i = [], r = {}) {
|
|
695
|
+
if (l(e)) {
|
|
710
696
|
var n = t ? t(e) : e;
|
|
711
697
|
void 0 !== n && (r[JSON.stringify(i)] = n);
|
|
712
698
|
} else {
|
|
713
699
|
var a, o = i.length;
|
|
714
|
-
for (a in e) i.push(a),
|
|
700
|
+
for (a in e) i.push(a), I(e[a], t, i, r), i.length = o;
|
|
715
701
|
}
|
|
716
702
|
return r;
|
|
717
703
|
}
|
|
718
704
|
|
|
719
|
-
function
|
|
720
|
-
return r(e) ? (t ? e : 1e3 * e) + i :
|
|
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;
|
|
721
707
|
}
|
|
722
708
|
|
|
723
|
-
function
|
|
724
|
-
var a = e.qyCache, r = (
|
|
725
|
-
return
|
|
709
|
+
function S(e, t, i, r, n) {
|
|
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, {
|
|
726
712
|
item: r,
|
|
727
713
|
milliSecond: i
|
|
728
714
|
});
|
|
729
715
|
}
|
|
730
716
|
|
|
731
|
-
function
|
|
732
|
-
var a = e.qyCache, i = (
|
|
733
|
-
return
|
|
717
|
+
function T(e, t, i, r, n) {
|
|
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, {
|
|
734
720
|
item: i,
|
|
735
721
|
infoFileOnly: r
|
|
736
722
|
});
|
|
737
723
|
}
|
|
738
724
|
|
|
739
725
|
export {
|
|
740
|
-
|
|
726
|
+
F as QyBatch
|
|
741
727
|
};
|