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