datafolder 1.0.31 → 1.0.33
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/ChangeLog.md +4 -0
- package/package.json +1 -1
- package/scripts/fastify.js +2 -2
- package/scripts/flights2.js +31 -13
- package/src/QyBatch.d.ts +2 -1
- package/src/QyBatch.js +144 -143
- package/src/QyCache.js +40 -41
- package/src/QyDB.js +1 -1
- package/src/QyDefaultOptions.js +1 -1
- package/src/QyFile.js +23 -25
- package/src/QyFileContentUtils.d.ts +1 -4
- package/src/QyFileContentUtils.js +87 -105
- package/src/QyIndex.d.ts +1 -2
- package/src/QyIndex.js +105 -126
- package/src/QyIndexPropTree.d.ts +9 -6
- package/src/QyIndexPropTree.js +85 -50
- package/src/QyItem.d.ts +1 -1
- package/src/QyItem.js +2 -2
- package/src/QyLogger.d.ts +3 -0
- package/src/QyLogger.js +80 -52
- package/src/QyMessager.js +1 -1
- package/src/QyTrigger.js +27 -27
- package/src/QyUtils.d.ts +0 -2
- package/src/QyUtils.js +64 -74
package/src/QyBatch.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
isDeepStrictEqual as
|
|
2
|
+
isDeepStrictEqual as c
|
|
3
3
|
} from "node:util";
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -12,9 +12,8 @@ import {
|
|
|
12
12
|
isString as h,
|
|
13
13
|
getSuffix as g,
|
|
14
14
|
SpecialFilePaths as e,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
isEmptyObj as c,
|
|
15
|
+
isSimpleType as d,
|
|
16
|
+
isEmptyObj as l,
|
|
18
17
|
isNumber as r,
|
|
19
18
|
getNowRounded as m,
|
|
20
19
|
isDate as a,
|
|
@@ -28,7 +27,7 @@ import {
|
|
|
28
27
|
} from "./QyAcl.js";
|
|
29
28
|
|
|
30
29
|
import {
|
|
31
|
-
calDifferenceList as
|
|
30
|
+
calDifferenceList as _
|
|
32
31
|
} from "./QyIndex.js";
|
|
33
32
|
|
|
34
33
|
import {
|
|
@@ -40,17 +39,17 @@ import {
|
|
|
40
39
|
} from "./QyCD.js";
|
|
41
40
|
|
|
42
41
|
import {
|
|
43
|
-
logger as
|
|
42
|
+
logger as C
|
|
44
43
|
} from "./QyLogger.js";
|
|
45
44
|
|
|
46
|
-
let
|
|
45
|
+
let y = e.IndexPropPathsFileName, x = {
|
|
47
46
|
none: 0,
|
|
48
47
|
basic: 1,
|
|
49
48
|
delta: 2,
|
|
50
49
|
all: 3
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
class
|
|
52
|
+
class D extends v {
|
|
54
53
|
fileLogLevel;
|
|
55
54
|
changeId;
|
|
56
55
|
actionQueue = [];
|
|
@@ -65,26 +64,26 @@ class F extends v {
|
|
|
65
64
|
...i("QyBatch"),
|
|
66
65
|
...t
|
|
67
66
|
};
|
|
68
|
-
e =
|
|
69
|
-
this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new
|
|
67
|
+
e = x[t.fileLogLevel.toLowerCase()];
|
|
68
|
+
this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new L(t.maxHistoryCmdObjCount);
|
|
70
69
|
}
|
|
71
70
|
createDir(e, t = this.currentDir) {
|
|
72
|
-
return h(e) && (e = o(e)),
|
|
71
|
+
return h(e) && (e = o(e)), F(this, this._action_createDir, {
|
|
73
72
|
item: this.qyCache.getOrCreateDir(e, t)
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
75
|
delDir(e, t = this.currentDir) {
|
|
77
|
-
return h(e) && (e = o(e)),
|
|
76
|
+
return h(e) && (e = o(e)), F(this, this._action_delDir, {
|
|
78
77
|
item: this.qyCache.getOrCreateDir(e, t).ensureAllLoaded()
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
createFile(e, t = this.currentDir) {
|
|
82
|
-
return h(e) && (e = o(e)),
|
|
81
|
+
return h(e) && (e = o(e)), F(this, this._action_createFile, {
|
|
83
82
|
item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
delFile(e, t = this.currentDir) {
|
|
87
|
-
return h(e) && (e = o(e)),
|
|
86
|
+
return h(e) && (e = o(e)), F(this, this._action_delFile, {
|
|
88
87
|
item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
|
|
89
88
|
});
|
|
90
89
|
}
|
|
@@ -92,18 +91,18 @@ class F extends v {
|
|
|
92
91
|
return this.expireFileM(e, 1e3 * t, i);
|
|
93
92
|
}
|
|
94
93
|
expireFileM(e, t, i = this.currentDir) {
|
|
95
|
-
return
|
|
94
|
+
return E(this, e, t, "f", i);
|
|
96
95
|
}
|
|
97
96
|
expireDir(e, t, i = this.currentDir) {
|
|
98
97
|
return this.expireDirM(e, 1e3 * t, i);
|
|
99
98
|
}
|
|
100
99
|
expireDirM(e, t, i = this.currentDir) {
|
|
101
|
-
return
|
|
100
|
+
return E(this, e, t, "d", i);
|
|
102
101
|
}
|
|
103
102
|
expireContent(e, t, i, r = this.currentDir) {
|
|
104
103
|
h(e) && (e = o(e));
|
|
105
104
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
106
|
-
return
|
|
105
|
+
return F(this, this._action_expireContent, {
|
|
107
106
|
item: e,
|
|
108
107
|
expireInfoObj: t,
|
|
109
108
|
isMilliSecond: i
|
|
@@ -113,15 +112,15 @@ class F extends v {
|
|
|
113
112
|
return this.expireContent(e, t, !0, i);
|
|
114
113
|
}
|
|
115
114
|
removeFileExpire(e, t = !1, i = this.currentDir) {
|
|
116
|
-
return
|
|
115
|
+
return j(this, e, "f", t, i);
|
|
117
116
|
}
|
|
118
117
|
removeDirExpire(e, t = !1, i = this.currentDir) {
|
|
119
|
-
return
|
|
118
|
+
return j(this, e, "d", t, i);
|
|
120
119
|
}
|
|
121
120
|
removeContentExpire(e, t, i = !1, r = this.currentDir) {
|
|
122
121
|
h(e) && (e = o(e));
|
|
123
122
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
124
|
-
return
|
|
123
|
+
return F(this, this._action_removeContentExpire, {
|
|
125
124
|
item: e,
|
|
126
125
|
expireInfoObj: t,
|
|
127
126
|
infoFileOnly: i
|
|
@@ -130,15 +129,23 @@ class F extends v {
|
|
|
130
129
|
createIndex(e, t, i = this.currentDir) {
|
|
131
130
|
h(e) && (e = o(e)), u(t) || (t = [ t ]);
|
|
132
131
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
133
|
-
return
|
|
132
|
+
return F(this, this._action_createIndex, {
|
|
134
133
|
item: e,
|
|
135
134
|
indexPropPathList: t
|
|
136
135
|
});
|
|
137
136
|
}
|
|
137
|
+
createIndexFromQuery(e, t, i = this.currentDir) {
|
|
138
|
+
h(e) && (e = o(e));
|
|
139
|
+
e = this.qyCache.getOrCreateDir(e, i);
|
|
140
|
+
return F(this, this._action_createIndex, {
|
|
141
|
+
item: e,
|
|
142
|
+
queryObj: t
|
|
143
|
+
});
|
|
144
|
+
}
|
|
138
145
|
delIndex(e, t, i = this.currentDir) {
|
|
139
146
|
h(e) && (e = o(e));
|
|
140
147
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
141
|
-
return
|
|
148
|
+
return F(this, this._action_delIndex, {
|
|
142
149
|
item: e,
|
|
143
150
|
indexPropPath: t
|
|
144
151
|
});
|
|
@@ -146,7 +153,7 @@ class F extends v {
|
|
|
146
153
|
insert(e, t, i = !0, r = !1, n = this.currentDir) {
|
|
147
154
|
h(e) && (e = o(e));
|
|
148
155
|
e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
|
|
149
|
-
return t = i ||
|
|
156
|
+
return t = i || d(t) ? t : structuredClone(t), F(this, this._action_insert, {
|
|
150
157
|
item: e,
|
|
151
158
|
content: t,
|
|
152
159
|
noCreate: r
|
|
@@ -155,14 +162,14 @@ class F extends v {
|
|
|
155
162
|
insertEmbedding(e, t, i = this.currentDir) {
|
|
156
163
|
var r = this.qyCache, r = (f(t) || (t = new Float32Array(t)), h(e) && (e = o(e)),
|
|
157
164
|
r.getOrCreateFile(e, i));
|
|
158
|
-
return
|
|
165
|
+
return F(this, this._action_insertEmbedding, {
|
|
159
166
|
item: r,
|
|
160
167
|
embedding: t
|
|
161
168
|
});
|
|
162
169
|
}
|
|
163
170
|
delEmbedding(e, t = this.currentDir) {
|
|
164
171
|
var i = this.qyCache, i = (h(e) && (e = o(e)), i.getOrCreateFile(e, t));
|
|
165
|
-
return
|
|
172
|
+
return F(this, this._action_delEmbedding, {
|
|
166
173
|
item: i
|
|
167
174
|
});
|
|
168
175
|
}
|
|
@@ -172,14 +179,14 @@ class F extends v {
|
|
|
172
179
|
delContent(e, t = this.currentDir) {
|
|
173
180
|
h(e) && (e = o(e));
|
|
174
181
|
e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
|
|
175
|
-
return
|
|
182
|
+
return F(this, this._action_delContent, {
|
|
176
183
|
item: e
|
|
177
184
|
});
|
|
178
185
|
}
|
|
179
186
|
insertTrigger(e, t, i, r) {
|
|
180
187
|
h(t) && (t = o(t)), i = n(i);
|
|
181
188
|
e = this.qyCache.getOrCreateTriggerFile(e);
|
|
182
|
-
return
|
|
189
|
+
return F(this, this._action_insertTrigger, {
|
|
183
190
|
item: e,
|
|
184
191
|
fileNamePath: t,
|
|
185
192
|
propNamePathList: i,
|
|
@@ -187,19 +194,19 @@ class F extends v {
|
|
|
187
194
|
});
|
|
188
195
|
}
|
|
189
196
|
removeTrigger(e) {
|
|
190
|
-
return
|
|
197
|
+
return F(this, this._action_removeTrigger, {
|
|
191
198
|
item: this.qyCache.getOrCreateTriggerFile(e)
|
|
192
199
|
});
|
|
193
200
|
}
|
|
194
201
|
insertRpc(e, t) {
|
|
195
202
|
e = this.qyCache.getOrCreateRpcFile(e);
|
|
196
|
-
return
|
|
203
|
+
return F(this, this._action_insertRpc, {
|
|
197
204
|
item: e,
|
|
198
205
|
modCode: t
|
|
199
206
|
});
|
|
200
207
|
}
|
|
201
208
|
removeRpc(e) {
|
|
202
|
-
return
|
|
209
|
+
return F(this, this._action_removeRpc, {
|
|
203
210
|
item: this.qyCache.getOrCreateRpcFile(e)
|
|
204
211
|
});
|
|
205
212
|
}
|
|
@@ -220,16 +227,16 @@ class F extends v {
|
|
|
220
227
|
qyAclCmdGenerator: o,
|
|
221
228
|
qyCmdObjHistory: s,
|
|
222
229
|
syncList: h
|
|
223
|
-
} = this,
|
|
224
|
-
if (0 ===
|
|
225
|
-
var
|
|
226
|
-
let
|
|
230
|
+
} = this, d = i.length;
|
|
231
|
+
if (0 === d) return n.decreaseChangeId(), 0;
|
|
232
|
+
var c = g(d), o = o.takeCmdArgAsListObj();
|
|
233
|
+
let l;
|
|
227
234
|
0 < r && (r = i.map(({
|
|
228
235
|
logStr: e
|
|
229
|
-
}) => e).join("\n"),
|
|
236
|
+
}) => e).join("\n"), l = new Date().toISOString() + `: ${d} change${c}:
|
|
230
237
|
${r}
|
|
231
238
|
`);
|
|
232
|
-
var m, u,
|
|
239
|
+
var m, u, d = n.save(t, o, l, (e => {
|
|
233
240
|
var t = e.syncList, i = t.length;
|
|
234
241
|
for (let e = 0; e < i; e += 2) {
|
|
235
242
|
var r, n = e + 1, a = t[e], o = t[n];
|
|
@@ -237,16 +244,16 @@ ${r}
|
|
|
237
244
|
t[n] = 0 < r.length ? r : void 0) : t[n] = o.fileContent;
|
|
238
245
|
}
|
|
239
246
|
if (0 < i) return t;
|
|
240
|
-
})(this), e),
|
|
247
|
+
})(this), e), c = (h.length = 0, s.push(o), i.filter(({
|
|
241
248
|
item: e,
|
|
242
249
|
delta: t
|
|
243
|
-
}) => t && 0 < e.triggerNodes?.length));
|
|
250
|
+
}) => void 0 !== t && 0 < e.triggerNodes?.length));
|
|
244
251
|
i.length = 0;
|
|
245
252
|
for ({
|
|
246
253
|
item: m,
|
|
247
254
|
delta: u
|
|
248
|
-
} of
|
|
249
|
-
return e ?
|
|
255
|
+
} of c) for (var f of m.triggerNodes) f.checkTrigger(m, u);
|
|
256
|
+
return e ? d : t;
|
|
250
257
|
}
|
|
251
258
|
getTopHistoryCmdObj() {
|
|
252
259
|
return this.qyCmdObjHistory.top();
|
|
@@ -265,7 +272,7 @@ ${r}
|
|
|
265
272
|
item: e,
|
|
266
273
|
content: o
|
|
267
274
|
}));
|
|
268
|
-
return e && (o = this.qyCache, a && !
|
|
275
|
+
return e && (o = this.qyCache, a && !c(a, t) && o.removeTriggerFromTree(n, a),
|
|
269
276
|
o.insertTriggerToTree(n, t, i, r)), e;
|
|
270
277
|
}
|
|
271
278
|
_action_removeTrigger(e) {
|
|
@@ -298,39 +305,38 @@ ${r}
|
|
|
298
305
|
}
|
|
299
306
|
_action_createIndex(t) {
|
|
300
307
|
t.actionName = "createIndex";
|
|
301
|
-
var
|
|
308
|
+
var {
|
|
302
309
|
item: t,
|
|
303
|
-
indexPropPathList:
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
y.log(`Creating index ${JSON.stringify(o.map(e => e.indexPropPath))} for ` + t.fullPath),
|
|
315
|
-
this._action_insert({
|
|
316
|
-
item: n,
|
|
317
|
-
content: l
|
|
310
|
+
indexPropPathList: e,
|
|
311
|
+
queryObj: i
|
|
312
|
+
} = t, r = this.qyCache.getOrCreateIndexDir(t), r = r.getOrCreateFile(y), n = (r.created || this._action_createFile({
|
|
313
|
+
item: r
|
|
314
|
+
}), r).qyIndexPropTree, i = void 0 !== i ? n.insertFromQueryObj(i) : n.insertPropPathList(e);
|
|
315
|
+
if (0 !== i.length) {
|
|
316
|
+
var a, o = {};
|
|
317
|
+
for (a of i) o[JSON.stringify(a.indexPropPath)] = 1;
|
|
318
|
+
C.log(`Creating index ${JSON.stringify(o)} for ` + t.fullPath), this._action_insert({
|
|
319
|
+
item: r,
|
|
320
|
+
content: o
|
|
318
321
|
});
|
|
319
322
|
{
|
|
320
|
-
var
|
|
323
|
+
var s, h = this, d = t;
|
|
321
324
|
let e;
|
|
322
|
-
for (
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
for (s of i) {
|
|
326
|
+
var {
|
|
327
|
+
indexPropPath: c,
|
|
328
|
+
indexPropDir: l
|
|
329
|
+
} = s;
|
|
330
|
+
if (!l.created) {
|
|
331
|
+
h._action_createDir({
|
|
332
|
+
item: l
|
|
327
333
|
});
|
|
328
|
-
for (var
|
|
334
|
+
for (var m of e = void 0 === e ? d.fileList : e) {
|
|
329
335
|
var {
|
|
330
|
-
fileContent:
|
|
331
|
-
name:
|
|
332
|
-
} =
|
|
333
|
-
void 0 !==
|
|
336
|
+
fileContent: m,
|
|
337
|
+
name: u
|
|
338
|
+
} = m;
|
|
339
|
+
void 0 !== m && N(h, l, c, u, void 0, m);
|
|
334
340
|
}
|
|
335
341
|
}
|
|
336
342
|
}
|
|
@@ -339,16 +345,16 @@ ${r}
|
|
|
339
345
|
}
|
|
340
346
|
_action_delIndex(e) {
|
|
341
347
|
e.actionName = "delIndex";
|
|
342
|
-
var t,
|
|
348
|
+
var t, {
|
|
343
349
|
item: e,
|
|
344
|
-
indexPropPath:
|
|
350
|
+
indexPropPath: i
|
|
345
351
|
} = e, e = this.qyCache.getIndexDir(e);
|
|
346
|
-
e && ((
|
|
347
|
-
t.remove(r)[1] || (i = e.getSubdir(r)) && this._action_delDir({
|
|
348
|
-
item: i
|
|
349
|
-
})) : this._action_delDir({
|
|
352
|
+
void 0 !== e && (void 0 === (t = e.getFile(y)) ? this._action_delDir({
|
|
350
353
|
item: e
|
|
351
|
-
}))
|
|
354
|
+
}) : (e = t.qyIndexPropTree, [ t, e, i ] = (this._action_setProp(t, JSON.stringify(i), null),
|
|
355
|
+
e.removePropPath(i)), t && !e && void 0 !== i && (t = i.indexPropDir, void 0 !== t) && this._action_delDir({
|
|
356
|
+
item: t
|
|
357
|
+
})));
|
|
352
358
|
}
|
|
353
359
|
_action_delFile(e, t = !1) {
|
|
354
360
|
e.actionName = "delFile";
|
|
@@ -361,7 +367,7 @@ ${r}
|
|
|
361
367
|
parentDir: r,
|
|
362
368
|
name: n
|
|
363
369
|
} = i;
|
|
364
|
-
return i.created = !1,
|
|
370
|
+
return i.created = !1, O(this, e), t || P(this, r, p.R, r.fileMapKey, n),
|
|
365
371
|
!0;
|
|
366
372
|
}
|
|
367
373
|
_action_delDir(e) {
|
|
@@ -377,42 +383,40 @@ ${r}
|
|
|
377
383
|
fileMapKey: s
|
|
378
384
|
} = t;
|
|
379
385
|
if (a) {
|
|
380
|
-
|
|
386
|
+
P(this, t, p.D, s);
|
|
381
387
|
for (var h of t.fileList) this._action_delFile({
|
|
382
388
|
item: h
|
|
383
389
|
}, !0);
|
|
384
390
|
}
|
|
385
391
|
if (n) {
|
|
386
|
-
|
|
387
|
-
for (var
|
|
392
|
+
P(this, t, p.D, o);
|
|
393
|
+
for (var d of t.allSubdirs()) {
|
|
388
394
|
let {
|
|
389
395
|
subdirMap: e,
|
|
390
396
|
fileMap: t,
|
|
391
397
|
subdirMapKey: i,
|
|
392
398
|
fileMapKey: r
|
|
393
|
-
} =
|
|
394
|
-
if (e &&
|
|
395
|
-
|
|
396
|
-
for (var
|
|
397
|
-
item:
|
|
399
|
+
} = d;
|
|
400
|
+
if (e && P(this, d, p.D, i), t) {
|
|
401
|
+
P(this, d, p.D, r);
|
|
402
|
+
for (var c of d.fileList) this._action_delFile({
|
|
403
|
+
item: c
|
|
398
404
|
}, !0);
|
|
399
405
|
}
|
|
400
|
-
|
|
406
|
+
O(this, {
|
|
401
407
|
actionName: "delDir",
|
|
402
|
-
item:
|
|
403
|
-
}),
|
|
408
|
+
item: d
|
|
409
|
+
}), d.created = !1;
|
|
404
410
|
}
|
|
405
411
|
}
|
|
406
|
-
return void 0 !== i && (t.created = !1,
|
|
412
|
+
return void 0 !== i && (t.created = !1, O(this, e), P(this, i, p.R, i.subdirMapKey, r),
|
|
407
413
|
!0);
|
|
408
414
|
}
|
|
409
415
|
_action_delContent(e) {
|
|
410
416
|
e.actionName = "delContent";
|
|
411
417
|
var t = e.item, i = t.fileContent;
|
|
412
|
-
return void 0 !== i && (t.fileContent = void 0, e.content = i, e.delta =
|
|
413
|
-
|
|
414
|
-
newValue: null
|
|
415
|
-
}, P(this, e), q(this, t, p.D, t.fileContentKey), N(this, t, i), !0);
|
|
418
|
+
return void 0 !== i && (t.fileContent = void 0, e.content = i, e.delta = [ i, null ],
|
|
419
|
+
O(this, e), P(this, t, p.D, t.fileContentKey), q(this, t, i), !0);
|
|
416
420
|
}
|
|
417
421
|
_action_insertEmbedding(e) {
|
|
418
422
|
e.actionName = "insertEmbedding";
|
|
@@ -420,10 +424,10 @@ ${r}
|
|
|
420
424
|
item: a,
|
|
421
425
|
embedding: o
|
|
422
426
|
} = e, s = o.length, r = r.getOrCreateInfoFile(a), h = r.fileContent;
|
|
423
|
-
let
|
|
427
|
+
let d = !1;
|
|
424
428
|
return r.created && h.length === s ? (t = a.fullPathHash, h = h.idx, i = n.getEmbedding(t, s, h),
|
|
425
|
-
|
|
426
|
-
|
|
429
|
+
c(o, i) || ((i = n.updateEmbedding(t, o, h)) !== h && this._action_setProp(r, "idx", i),
|
|
430
|
+
d = !0)) : ({
|
|
427
431
|
fullPathHash: t,
|
|
428
432
|
namePath: h
|
|
429
433
|
} = a, i = n.addEmbedding(t, o), this._action_insert({
|
|
@@ -433,7 +437,7 @@ ${r}
|
|
|
433
437
|
idx: i,
|
|
434
438
|
namePath: r.created ? void 0 : h
|
|
435
439
|
}
|
|
436
|
-
}),
|
|
440
|
+
}), d = !0), d && O(this, e), d;
|
|
437
441
|
}
|
|
438
442
|
_action_delEmbedding(e) {
|
|
439
443
|
e.actionName = "delEmbedding";
|
|
@@ -443,7 +447,7 @@ ${r}
|
|
|
443
447
|
if (t && (o = t.fileContent, o) && (n = o.length, a = o.idx), i.delEmbedding(r.fullPathHash, n, a),
|
|
444
448
|
t) return this._action_delFile({
|
|
445
449
|
item: t
|
|
446
|
-
}),
|
|
450
|
+
}), O(this, e), !0;
|
|
447
451
|
}
|
|
448
452
|
_action_put(e) {
|
|
449
453
|
e.actionName = "put";
|
|
@@ -451,16 +455,16 @@ ${r}
|
|
|
451
455
|
item: t,
|
|
452
456
|
content: i
|
|
453
457
|
} = e;
|
|
454
|
-
if (void 0 === i) return
|
|
458
|
+
if (void 0 === i) return C.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
|
|
455
459
|
!1;
|
|
456
460
|
t.created || this._action_createFile({
|
|
457
461
|
item: t
|
|
458
462
|
});
|
|
459
463
|
var r = t.fileContentKey;
|
|
460
|
-
return i.$rpl = 1,
|
|
464
|
+
return i.$rpl = 1, P(this, t, p.M, r, i), O(this, e), t.fileContent = i,
|
|
461
465
|
!0;
|
|
462
466
|
}
|
|
463
|
-
|
|
467
|
+
_action_setProp(e, t, i) {
|
|
464
468
|
var {
|
|
465
469
|
created: r,
|
|
466
470
|
fileContentKey: n,
|
|
@@ -470,7 +474,7 @@ ${r}
|
|
|
470
474
|
}), a ? a[t] : void 0);
|
|
471
475
|
return null === i ? void 0 !== a && delete a[t] : void 0 !== a ? a[t] = i : e.fileContent = {
|
|
472
476
|
[t]: i
|
|
473
|
-
},
|
|
477
|
+
}, P(this, e, p.M, n, t, i), r;
|
|
474
478
|
}
|
|
475
479
|
_action_insert(e) {
|
|
476
480
|
e.actionName = "insert";
|
|
@@ -483,7 +487,7 @@ ${r}
|
|
|
483
487
|
merged: a,
|
|
484
488
|
delta: o
|
|
485
489
|
} = e;
|
|
486
|
-
if (void 0 === o && void 0 === r) return
|
|
490
|
+
if (void 0 === o && void 0 === r) return C.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
|
|
487
491
|
!1;
|
|
488
492
|
if (!i.created) {
|
|
489
493
|
if (n) return !1;
|
|
@@ -491,12 +495,9 @@ ${r}
|
|
|
491
495
|
item: i
|
|
492
496
|
});
|
|
493
497
|
}
|
|
494
|
-
return void 0 === a && void 0 === o && (
|
|
495
|
-
o =
|
|
496
|
-
|
|
497
|
-
newValue: n
|
|
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),
|
|
498
|
+
return void 0 === a && void 0 === o && ([ a, o ] = s(i.fileContent, r)),
|
|
499
|
+
void 0 !== o && ([ n, r ] = o, t = i.fileContentKey, void 0 === a ? P(this, i, p.D, t) : P(this, i, p.M, t, r),
|
|
500
|
+
e.merged = a, e.delta = o, O(this, e), i.fileContent = a, q(this, i, n, r, a),
|
|
500
501
|
!0);
|
|
501
502
|
}
|
|
502
503
|
_action_createFile(e) {
|
|
@@ -504,7 +505,7 @@ ${r}
|
|
|
504
505
|
var t, i = e.item;
|
|
505
506
|
return !i.created && (t = i.parentDir, this._action_createDir({
|
|
506
507
|
item: t
|
|
507
|
-
}), i.created = !0, i.fileContentLoaded = !0,
|
|
508
|
+
}), i.created = !0, i.fileContentLoaded = !0, O(this, e), P(this, t, p.A, t.fileMapKey, i.name),
|
|
508
509
|
!0);
|
|
509
510
|
}
|
|
510
511
|
_action_createDir(e) {
|
|
@@ -513,12 +514,12 @@ ${r}
|
|
|
513
514
|
if (t.created) return !1;
|
|
514
515
|
for (var i = []; !t.created; ) i.push(t), t = t.parentDir;
|
|
515
516
|
for (let e of i.reverse()) {
|
|
516
|
-
e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0,
|
|
517
|
+
e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0, O(this, {
|
|
517
518
|
actionName: "createDir",
|
|
518
519
|
item: e
|
|
519
520
|
});
|
|
520
521
|
var r = e.parentDir;
|
|
521
|
-
|
|
522
|
+
P(this, r, p.A, r.subdirMapKey, e.name);
|
|
522
523
|
}
|
|
523
524
|
return !0;
|
|
524
525
|
}
|
|
@@ -531,7 +532,7 @@ ${r}
|
|
|
531
532
|
parentDir: r,
|
|
532
533
|
name: n
|
|
533
534
|
} = e;
|
|
534
|
-
return void 0 !== r && void 0 !== (i =
|
|
535
|
+
return void 0 !== r && void 0 !== (i = I(i, !0, m())) && (t = this.qyCache,
|
|
535
536
|
r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"), (r = this._action_insert({
|
|
536
537
|
item: r,
|
|
537
538
|
content: {
|
|
@@ -553,7 +554,7 @@ ${r}
|
|
|
553
554
|
content: {
|
|
554
555
|
[n]: null
|
|
555
556
|
}
|
|
556
|
-
})) && (
|
|
557
|
+
})) && (l(r.fileContent) && this._action_delFile({
|
|
557
558
|
item: r
|
|
558
559
|
}), void 0 === i) && t.unmonitorItemExpire(e), n);
|
|
559
560
|
}
|
|
@@ -564,7 +565,7 @@ ${r}
|
|
|
564
565
|
expireInfoObj: i,
|
|
565
566
|
isMilliSecond: r
|
|
566
567
|
} = e, n = m();
|
|
567
|
-
var e =
|
|
568
|
+
var e = b(i, e => I(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
|
|
568
569
|
item: o,
|
|
569
570
|
content: {
|
|
570
571
|
...e
|
|
@@ -579,22 +580,22 @@ ${r}
|
|
|
579
580
|
expireInfoObj: i,
|
|
580
581
|
infoFileOnly: r
|
|
581
582
|
} = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
|
|
582
|
-
return void 0 !== a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) :
|
|
583
|
+
return void 0 !== a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) : b(i, e => e ? null : void 0),
|
|
583
584
|
(t = this._action_insert({
|
|
584
585
|
item: a,
|
|
585
586
|
content: i
|
|
586
|
-
})) && (
|
|
587
|
+
})) && (l(a.fileContent, !0) && this._action_delFile({
|
|
587
588
|
item: a
|
|
588
589
|
}), r || n.unmonitorContentExpire(e, i)), t);
|
|
589
590
|
}
|
|
590
591
|
}
|
|
591
592
|
|
|
592
|
-
function
|
|
593
|
+
function F(e, t, i) {
|
|
593
594
|
return e.running ? t.call(e, i) : (i.actionFun = t, e.actionQueue.push(i)),
|
|
594
595
|
e;
|
|
595
596
|
}
|
|
596
597
|
|
|
597
|
-
function
|
|
598
|
+
function O(e, t) {
|
|
598
599
|
var {
|
|
599
600
|
changeList: e,
|
|
600
601
|
fileLogLevel: i
|
|
@@ -609,16 +610,13 @@ function P(e, t) {
|
|
|
609
610
|
} = e, i = e + ` "${i.fullPath ?? i}"`;
|
|
610
611
|
if ("delContent" === e) {
|
|
611
612
|
if (3 === t) return i + " " + JSON.stringify(r);
|
|
612
|
-
} else if ("insert" === e && 2 <= t) return {
|
|
613
|
-
oldValue: r,
|
|
614
|
-
newValue: e
|
|
615
|
-
} = a, a = `${void 0 === r ? "" : "delta:"} ${JSON.stringify(r)} -> ` + JSON.stringify(e),
|
|
613
|
+
} else if ("insert" === e && 2 <= t) return [ r, e ] = a, a = `${void 0 === r ? "" : "delta:"} ${JSON.stringify(r)} -> ` + JSON.stringify(e),
|
|
616
614
|
2 === t ? i + " " + a : i + ` ${a}. ` + (void 0 !== r ? "new: " + JSON.stringify(n) : "");
|
|
617
615
|
return i;
|
|
618
616
|
})(t, i)), e.push(t);
|
|
619
617
|
}
|
|
620
618
|
|
|
621
|
-
function
|
|
619
|
+
function P(e, t, i, r, n = void 0, a = void 0) {
|
|
622
620
|
var {
|
|
623
621
|
qyAclCmdGenerator: e,
|
|
624
622
|
qyCache: o,
|
|
@@ -629,27 +627,30 @@ function q(e, t, i, r, n = void 0, a = void 0) {
|
|
|
629
627
|
o && o.qyKVData.removeKey(r) && s.push(r, t);
|
|
630
628
|
}
|
|
631
629
|
|
|
632
|
-
function
|
|
630
|
+
function q(e, t, i, r = void 0, n = void 0) {
|
|
633
631
|
if (!t.underHiddenFolder) {
|
|
634
632
|
var a = e.qyCache.getIndexDir(t.parentDir);
|
|
635
633
|
if (void 0 !== a) {
|
|
636
|
-
a = a.getFile(
|
|
634
|
+
a = a.getFile(y);
|
|
637
635
|
if (void 0 !== a) {
|
|
638
|
-
var o, s = t.name;
|
|
639
|
-
for (
|
|
636
|
+
var o, s, h = t.name;
|
|
637
|
+
for ({
|
|
638
|
+
indexPropDir: o,
|
|
639
|
+
indexPropPath: s
|
|
640
|
+
} of a.qyIndexPropTree.allLeafNodes) N(e, o, s, h, i, r, n);
|
|
640
641
|
}
|
|
641
642
|
}
|
|
642
643
|
}
|
|
643
644
|
}
|
|
644
645
|
|
|
645
|
-
function
|
|
646
|
-
e =
|
|
646
|
+
function N(t, e, i, r, n, a, o = void 0) {
|
|
647
|
+
e = _(e, i, n, a, o);
|
|
647
648
|
if (void 0 !== e) {
|
|
648
649
|
var s, h, [ i, n ] = e;
|
|
649
650
|
for (s of i) {
|
|
650
|
-
t.
|
|
651
|
-
var
|
|
652
|
-
if (void 0 ===
|
|
651
|
+
t._action_setProp(s, r, null);
|
|
652
|
+
var d = s.fileContent;
|
|
653
|
+
if (void 0 === d || l(d)) {
|
|
653
654
|
t._action_delFile({
|
|
654
655
|
item: s
|
|
655
656
|
});
|
|
@@ -659,11 +660,11 @@ function L(t, e, i, r, n, a, o = void 0) {
|
|
|
659
660
|
}), e = e.parentDir;
|
|
660
661
|
}
|
|
661
662
|
}
|
|
662
|
-
for (h of n) t.
|
|
663
|
+
for (h of n) t._action_setProp(h, r, 1);
|
|
663
664
|
}
|
|
664
665
|
}
|
|
665
666
|
|
|
666
|
-
class
|
|
667
|
+
class L {
|
|
667
668
|
maxLength;
|
|
668
669
|
actionQueue;
|
|
669
670
|
nextPos;
|
|
@@ -691,37 +692,37 @@ class b {
|
|
|
691
692
|
}
|
|
692
693
|
}
|
|
693
694
|
|
|
694
|
-
function
|
|
695
|
-
if (
|
|
695
|
+
function b(e, t = void 0, i = [], r = {}) {
|
|
696
|
+
if (d(e)) {
|
|
696
697
|
var n = t ? t(e) : e;
|
|
697
698
|
void 0 !== n && (r[JSON.stringify(i)] = n);
|
|
698
699
|
} else {
|
|
699
700
|
var a, o = i.length;
|
|
700
|
-
for (a in e) i.push(a),
|
|
701
|
+
for (a in e) i.push(a), b(e[a], t, i, r), i.length = o;
|
|
701
702
|
}
|
|
702
703
|
return r;
|
|
703
704
|
}
|
|
704
705
|
|
|
705
|
-
function
|
|
706
|
+
function I(e, t, i) {
|
|
706
707
|
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;
|
|
707
708
|
}
|
|
708
709
|
|
|
709
|
-
function
|
|
710
|
+
function E(e, t, i, r, n) {
|
|
710
711
|
var a = e.qyCache, r = (h(t) && (t = o(t)), "f" === r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
|
|
711
|
-
return
|
|
712
|
+
return F(e, e._action_expireItem, {
|
|
712
713
|
item: r,
|
|
713
714
|
milliSecond: i
|
|
714
715
|
});
|
|
715
716
|
}
|
|
716
717
|
|
|
717
|
-
function
|
|
718
|
+
function j(e, t, i, r, n) {
|
|
718
719
|
var a = e.qyCache, i = (h(t) && (t = o(t)), "f" === i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
|
|
719
|
-
return
|
|
720
|
+
return F(e, e._action_removeItemExpire, {
|
|
720
721
|
item: i,
|
|
721
722
|
infoFileOnly: r
|
|
722
723
|
});
|
|
723
724
|
}
|
|
724
725
|
|
|
725
726
|
export {
|
|
726
|
-
|
|
727
|
+
D as QyBatch
|
|
727
728
|
};
|