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