datafolder 1.0.35 → 1.0.37
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 +26 -26
- package/src/QyBatch.js +130 -132
- package/src/QyBinWriter.d.ts +1 -0
- package/src/QyBinWriter.js +1 -0
- package/src/QyCache.d.ts +9 -6
- package/src/QyCache.js +49 -63
- package/src/QyDB.d.ts +2 -1
- package/src/QyDB.js +14 -21
- package/src/QyDir.d.ts +8 -0
- package/src/QyDir.js +68 -39
- package/src/QyEmbeddings.d.ts +5 -3
- package/src/QyEmbeddings.js +11 -17
- package/src/QyFetch.d.ts +2 -2
- package/src/QyFile.d.ts +5 -1
- package/src/QyFile.js +57 -42
- package/src/QyFileLogger.d.ts +2 -1
- package/src/QyFileLogger.js +9 -12
- package/src/QyItem.d.ts +8 -15
- package/src/QyItem.js +18 -48
- package/src/QyKVData.d.ts +13 -7
- package/src/QyKVData.js +15 -29
- package/src/QyKVDataCleaner_Worker.js +41 -47
- package/src/QyKVDataLoader.d.ts +2 -1
- package/src/QyKVDataLoader.js +21 -26
- package/src/QyKVDataSaver_Worker.d.ts +2 -2
- package/src/QyKVDataSaver_Worker.js +9 -16
- package/src/QyLogFileSaver_Worker.js +1 -3
- 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 +5 -3
- package/src/QySnapshotSaver_Worker.js +4 -8
- package/src/QySnapshots.d.ts +4 -3
- package/src/QySnapshots.js +15 -19
- package/src/QyTrigger.js +15 -22
- package/src/QyUnionNode.js +1 -4
package/src/QyBinWriter.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare class QyBinWriter extends QyOpRunner {
|
|
|
3
3
|
filePath: any;
|
|
4
4
|
totalSavedSize: number;
|
|
5
5
|
fileHandle: any;
|
|
6
|
+
maxFileSizeEmitted: any;
|
|
6
7
|
constructor(options?: any, filePath?: any, callOpNameList?: any, castOpNameList?: any);
|
|
7
8
|
save(changeId: any, data?: any, needPromise?: any): any;
|
|
8
9
|
truncate(): any;
|
package/src/QyBinWriter.js
CHANGED
package/src/QyCache.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import EventEmitter from "node:events";
|
|
2
2
|
import { QyDir } from "./QyDir.ts";
|
|
3
|
+
import { QyFileLogger } from "./QyFileLogger.ts";
|
|
4
|
+
import { QyKVData } from "./QyKVData.ts";
|
|
5
|
+
import { QyEmbeddings } from "./QyEmbeddings.ts";
|
|
3
6
|
import type { QyFile } from "./QyFile.ts";
|
|
4
7
|
export declare class QyCache extends EventEmitter {
|
|
5
8
|
rootFolder: any;
|
|
@@ -16,16 +19,16 @@ export declare class QyCache extends EventEmitter {
|
|
|
16
19
|
infoRootDir: any;
|
|
17
20
|
recycleRootDir: any;
|
|
18
21
|
exclusiveFilePath: any;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
rpcFunMap: any;
|
|
23
|
+
qyKVData: QyKVData | undefined;
|
|
24
|
+
qyFileLogger: QyFileLogger | undefined;
|
|
25
|
+
qyEmbeddings: QyEmbeddings | undefined;
|
|
23
26
|
constructor(rootFolder: string, options?: any, qyDB?: any);
|
|
24
27
|
start(): Promise<this>;
|
|
25
28
|
stop(): Promise<this>;
|
|
26
|
-
increaseChangeId():
|
|
29
|
+
increaseChangeId(): number;
|
|
27
30
|
decreaseChangeId(): void;
|
|
28
|
-
save(changeId: any,
|
|
31
|
+
save(changeId: any, cmdArgAsListArray: any, logText: any, syncList: any, needPromise: any): any;
|
|
29
32
|
getFile(namePath: QyFile | string | string[], parentDir?: any): QyFile | undefined;
|
|
30
33
|
getOrCreateFile(namePath: QyFile | string | string[], parentDir?: any): QyFile;
|
|
31
34
|
getDir(namePath: QyDir | string | string[], parentDir?: any): QyDir | undefined;
|
package/src/QyCache.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
|
|
19
19
|
import {
|
|
20
20
|
QyTriggerNode as R,
|
|
21
|
-
updateTriggerNodes as
|
|
21
|
+
updateTriggerNodes as a
|
|
22
22
|
} from "./QyTrigger.js";
|
|
23
23
|
|
|
24
24
|
import {
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "./QyUtils.js";
|
|
31
31
|
|
|
32
32
|
import {
|
|
33
|
-
dumpStructure as
|
|
33
|
+
dumpStructure as P
|
|
34
34
|
} from "./QyStructure.js";
|
|
35
35
|
|
|
36
36
|
import {
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "./QyUnionNode.js";
|
|
47
47
|
|
|
48
48
|
import {
|
|
49
|
-
QyKVDataLoader as
|
|
49
|
+
QyKVDataLoader as w
|
|
50
50
|
} from "./QyKVDataLoader.js";
|
|
51
51
|
|
|
52
52
|
import {
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
} from "./QyMod.js";
|
|
55
55
|
|
|
56
56
|
import {
|
|
57
|
-
logger as
|
|
57
|
+
logger as O
|
|
58
58
|
} from "./QyLogger.js";
|
|
59
59
|
|
|
60
60
|
import {
|
|
@@ -64,7 +64,7 @@ import {
|
|
|
64
64
|
let {
|
|
65
65
|
HiddenFolderName: D,
|
|
66
66
|
IndexDirPath: F,
|
|
67
|
-
TriggerDirPath:
|
|
67
|
+
TriggerDirPath: b,
|
|
68
68
|
RpcDirPath: E,
|
|
69
69
|
ExpireDirPath: y,
|
|
70
70
|
MetaFilePath: t,
|
|
@@ -88,32 +88,27 @@ class i extends r {
|
|
|
88
88
|
infoRootDir;
|
|
89
89
|
recycleRootDir;
|
|
90
90
|
exclusiveFilePath;
|
|
91
|
+
rpcFunMap = {};
|
|
91
92
|
qyKVData;
|
|
92
93
|
qyFileLogger;
|
|
93
94
|
qyEmbeddings;
|
|
94
|
-
rpcFunMap = {};
|
|
95
95
|
constructor(r, e, t) {
|
|
96
96
|
super(), this.rootFolder = r, e = this.options = {
|
|
97
97
|
...d("QyCache"),
|
|
98
98
|
...e
|
|
99
99
|
}, this.qyDB = t;
|
|
100
|
-
var i, o = this, t = o.rootDir = new l("", !0, void 0, o),
|
|
100
|
+
var i, o = this, t = o.rootDir = new l("", !0, void 0, o), s = new l(D, !0, t);
|
|
101
101
|
t._subdirMap = {
|
|
102
|
-
[D]:
|
|
103
|
-
},
|
|
104
|
-
for ([
|
|
105
|
-
var
|
|
106
|
-
|
|
102
|
+
[D]: s
|
|
103
|
+
}, s._subdirMap = {};
|
|
104
|
+
for ([ a, i ] of [ [ F, "indexRootDir" ], [ y, "expireRootDir" ], [ m, "hnswRootDir" ], [ f, "infoRootDir" ], [ Q, "recycleRootDir" ] ]) {
|
|
105
|
+
var a = a.at(-1), n = new l(a, !0, s);
|
|
106
|
+
s._subdirMap[a] = n, o[i] = n;
|
|
107
107
|
}
|
|
108
108
|
t = v(r, "qykv");
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
exclusiveFilePath: v(r, ".opened"),
|
|
113
|
-
qyKVData: new h(t, e, this),
|
|
114
|
-
qyFileLogger: new g(v(r, "qylog"), e),
|
|
115
|
-
qyEmbeddings: new c(this, e)
|
|
116
|
-
});
|
|
109
|
+
this.kvFolder = t, this.rpcFolder = v(r, "rpc"), this.exclusiveFilePath = v(r, ".opened"),
|
|
110
|
+
this.qyKVData = new h(t, e, this), this.qyFileLogger = new g(v(r, "qylog"), e),
|
|
111
|
+
this.qyEmbeddings = new c(this, e);
|
|
117
112
|
}
|
|
118
113
|
async start() {
|
|
119
114
|
var {
|
|
@@ -122,14 +117,14 @@ class i extends r {
|
|
|
122
117
|
options: t,
|
|
123
118
|
qyKVData: i,
|
|
124
119
|
qyFileLogger: o,
|
|
125
|
-
exclusiveFilePath:
|
|
126
|
-
rootDir:
|
|
120
|
+
exclusiveFilePath: s,
|
|
121
|
+
rootDir: a,
|
|
127
122
|
qyEmbeddings: n
|
|
128
123
|
} = this;
|
|
129
|
-
|
|
124
|
+
O.log("Starting at " + r);
|
|
130
125
|
try {
|
|
131
126
|
await x(e);
|
|
132
|
-
var [ [ l, g, h, d ] ] = await Promise.all([ ((r, e) => (r = new
|
|
127
|
+
var [ [ l, g, h, d ] ] = await Promise.all([ ((r, e) => (r = new w(r, e)).load())(e, t), q(s) ]);
|
|
133
128
|
o.start(), i.start(l, g, h, d), await n.start();
|
|
134
129
|
} catch (r) {
|
|
135
130
|
throw o.stop(), n.stop(), r;
|
|
@@ -140,10 +135,10 @@ class i extends r {
|
|
|
140
135
|
fileMap: i
|
|
141
136
|
} = e;
|
|
142
137
|
for (var o of t) r(o);
|
|
143
|
-
}(
|
|
138
|
+
}(a);
|
|
144
139
|
var u = this, e = u.rootDir;
|
|
145
140
|
e.triggerNodes = [ new R() ];
|
|
146
|
-
for (p of (e = u.triggerRootDir = e.searchOrCreateSubdir(
|
|
141
|
+
for (p of (e = u.triggerRootDir = e.searchOrCreateSubdir(b)).fileList) {
|
|
147
142
|
var {
|
|
148
143
|
name: p,
|
|
149
144
|
fileContent: c
|
|
@@ -159,32 +154,23 @@ class i extends r {
|
|
|
159
154
|
} = m;
|
|
160
155
|
C(f) && y.insertRpc(m, f);
|
|
161
156
|
}
|
|
162
|
-
return t.dumpStructureAtStart && await
|
|
157
|
+
return t.dumpStructureAtStart && await P(v(r, "qystruct"), a), O.log("Started."),
|
|
163
158
|
this;
|
|
164
159
|
}
|
|
165
160
|
async stop() {
|
|
166
|
-
|
|
161
|
+
O.log("Stopping...");
|
|
167
162
|
var {
|
|
168
163
|
qyKVData: r,
|
|
169
164
|
qyEmbeddings: e,
|
|
170
165
|
qyFileLogger: t,
|
|
171
166
|
exclusiveFilePath: i
|
|
172
167
|
} = this;
|
|
173
|
-
return await r.stop(), await e.stop(),
|
|
174
|
-
o(i),
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
rpcRootDir: void 0,
|
|
180
|
-
hnswRootDir: void 0,
|
|
181
|
-
infoRootDir: void 0,
|
|
182
|
-
recycleRootDir: void 0,
|
|
183
|
-
qyKVData: void 0,
|
|
184
|
-
rpcFunMap: void 0,
|
|
185
|
-
qyDB: void 0,
|
|
186
|
-
qyFileLogger: void 0
|
|
187
|
-
}), P.log("Stopped."), this;
|
|
168
|
+
return await r.stop(), await e.stop(), O.log("QyFileLogger stopped."), await t.stop(),
|
|
169
|
+
o(i), this.rootDir = void 0, this.indexRootDir = void 0, this.expireRootDir = void 0,
|
|
170
|
+
this.triggerRootDir = void 0, this.rpcRootDir = void 0, this.hnswRootDir = void 0,
|
|
171
|
+
this.infoRootDir = void 0, this.recycleRootDir = void 0, this.qyKVData = void 0,
|
|
172
|
+
this.rpcFunMap = void 0, this.qyDB = void 0, this.qyFileLogger = void 0,
|
|
173
|
+
O.log("Stopped."), this;
|
|
188
174
|
}
|
|
189
175
|
increaseChangeId() {
|
|
190
176
|
return this.qyKVData.increaseChangeId();
|
|
@@ -194,10 +180,10 @@ class i extends r {
|
|
|
194
180
|
}
|
|
195
181
|
save(r, e, t, i, o) {
|
|
196
182
|
var {
|
|
197
|
-
qyKVData:
|
|
198
|
-
qyFileLogger:
|
|
183
|
+
qyKVData: s,
|
|
184
|
+
qyFileLogger: a
|
|
199
185
|
} = this;
|
|
200
|
-
return t &&
|
|
186
|
+
return t && a.save(r, t), s.save(r, e, i, o);
|
|
201
187
|
}
|
|
202
188
|
getFile(r, e = this.rootDir) {
|
|
203
189
|
return r.isFile ? r : C(r) ? e.getFile(r) : e.searchFile(r);
|
|
@@ -230,13 +216,13 @@ class i extends r {
|
|
|
230
216
|
return this.expireRootDir.searchOrCreateFile(S(r, e));
|
|
231
217
|
}
|
|
232
218
|
getInfoFile(r) {
|
|
233
|
-
return this.infoRootDir.searchFile(
|
|
219
|
+
return this.infoRootDir.searchFile(s(r.fullPathHash));
|
|
234
220
|
}
|
|
235
221
|
getOrCreateInfoFile(r) {
|
|
236
|
-
return this.infoRootDir.searchOrCreateFile(
|
|
222
|
+
return this.infoRootDir.searchOrCreateFile(s(r.fullPathHash));
|
|
237
223
|
}
|
|
238
224
|
hToSrcFile(r) {
|
|
239
|
-
r = this.infoRootDir.searchFile(
|
|
225
|
+
r = this.infoRootDir.searchFile(s(r));
|
|
240
226
|
if (r && r.fileContent) {
|
|
241
227
|
r = r.fileContent.namePath;
|
|
242
228
|
if (r) return this.getOrCreateFile(r);
|
|
@@ -273,13 +259,13 @@ class i extends r {
|
|
|
273
259
|
insertTriggerToTree(r, e, t, i) {
|
|
274
260
|
var {
|
|
275
261
|
rootDir: o,
|
|
276
|
-
qyDB:
|
|
277
|
-
} = this, i = p("trigger", r, i,
|
|
278
|
-
o.triggerNodes[0].insertTrigger(r, e, t, i),
|
|
262
|
+
qyDB: s
|
|
263
|
+
} = this, i = p("trigger", r, i, s);
|
|
264
|
+
o.triggerNodes[0].insertTrigger(r, e, t, i), a(o, e);
|
|
279
265
|
}
|
|
280
266
|
removeTriggerFromTree(r, e) {
|
|
281
267
|
var t = this.rootDir;
|
|
282
|
-
t.triggerNodes[0].removeTrigger(r, e) &&
|
|
268
|
+
t.triggerNodes[0].removeTrigger(r, e) && a(t, e);
|
|
283
269
|
}
|
|
284
270
|
insertRpc(r, e) {
|
|
285
271
|
var {
|
|
@@ -292,21 +278,21 @@ class i extends r {
|
|
|
292
278
|
delete this.rpcFunMap[r];
|
|
293
279
|
}
|
|
294
280
|
queryFiles(r, e, t, i, o = this.rootDir) {
|
|
295
|
-
var
|
|
296
|
-
return L(r, e,
|
|
281
|
+
var s = [], t = (C(e) && !t && (t = 1), new u(t, i)), i = this.options.queryAutoIndex;
|
|
282
|
+
return L(r, e, s, t, o, i), s;
|
|
297
283
|
}
|
|
298
284
|
queryFilesMulti(r, e, t, i = this.rootDir) {
|
|
299
|
-
var o,
|
|
300
|
-
for ([ o,
|
|
301
|
-
return
|
|
285
|
+
var o, s, a = [], n = new u(e, t), l = this.options.queryAutoIndex;
|
|
286
|
+
for ([ o, s ] of r) L(o, s, a, n, i, l);
|
|
287
|
+
return a;
|
|
302
288
|
}
|
|
303
289
|
async callRpc(e, r, t) {
|
|
304
290
|
var i, o = this.rpcFunMap[e];
|
|
305
|
-
if (!o) return
|
|
291
|
+
if (!o) return O.warn(i = `RPC ${e} not implemented.`), new Error(i);
|
|
306
292
|
try {
|
|
307
293
|
return await o(r, t);
|
|
308
294
|
} catch (r) {
|
|
309
|
-
return
|
|
295
|
+
return O.error(`Calling RPC ${e} failed:`, r), r;
|
|
310
296
|
}
|
|
311
297
|
}
|
|
312
298
|
monitorItemExpire(r, e) {
|
|
@@ -323,7 +309,7 @@ class i extends r {
|
|
|
323
309
|
}
|
|
324
310
|
}
|
|
325
311
|
|
|
326
|
-
function
|
|
312
|
+
function s(r) {
|
|
327
313
|
return [ r.substring(0, 2), r ];
|
|
328
314
|
}
|
|
329
315
|
|
|
@@ -335,8 +321,8 @@ function I(r) {
|
|
|
335
321
|
return [ r[0], r ];
|
|
336
322
|
}
|
|
337
323
|
|
|
338
|
-
function L(r, e, t, i, o,
|
|
339
|
-
void 0 !== e && n(r, o,
|
|
324
|
+
function L(r, e, t, i, o, s) {
|
|
325
|
+
void 0 !== e && n(r, o, s, e, t, i);
|
|
340
326
|
}
|
|
341
327
|
|
|
342
328
|
export {
|
package/src/QyDB.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { QyBatch } from "./QyBatch.ts";
|
|
1
2
|
import { QyCD } from "./QyCD.ts";
|
|
2
3
|
import type { QyDir } from "./QyDir.ts";
|
|
3
4
|
import type { QyFile } from "./QyFile.ts";
|
|
@@ -6,7 +7,7 @@ export declare class QyDB extends QyCD {
|
|
|
6
7
|
options: {};
|
|
7
8
|
fetch: any;
|
|
8
9
|
batch: any;
|
|
9
|
-
_immediate:
|
|
10
|
+
_immediate: QyBatch | undefined;
|
|
10
11
|
creationTime: any;
|
|
11
12
|
constructor(rootFolder?: string, options?: {});
|
|
12
13
|
start(options?: {}): Promise<this>;
|
package/src/QyDB.js
CHANGED
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
} from "./QyBatch.js";
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
-
QyCache as
|
|
14
|
+
QyCache as o
|
|
15
15
|
} from "./QyCache.js";
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
|
-
getDefaultOptions as
|
|
18
|
+
getDefaultOptions as a
|
|
19
19
|
} from "./QyDefaultOptions.js";
|
|
20
20
|
|
|
21
21
|
import {
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
isNotNullObj as s,
|
|
27
27
|
__dirname as n,
|
|
28
|
-
getNowTime as
|
|
29
|
-
getNowRounded as
|
|
28
|
+
getNowTime as h,
|
|
29
|
+
getNowRounded as c
|
|
30
30
|
} from "./QyUtils.js";
|
|
31
31
|
|
|
32
32
|
import {
|
|
@@ -44,7 +44,7 @@ class l extends t {
|
|
|
44
44
|
creationTime;
|
|
45
45
|
constructor(e = d, t) {
|
|
46
46
|
s(e) && (t = e, e = d), super(), this.options = {
|
|
47
|
-
...
|
|
47
|
+
...a("QyDB"),
|
|
48
48
|
...t
|
|
49
49
|
}, this.rootFolder = e;
|
|
50
50
|
for (let t of [ "createIndex", "createIndexFromQuery", "delContent", "delDir", "delEmbedding", "delFile", "delIndex", "expireContent", "expireContentM", "expireDir", "expireDirM", "expireFile", "expireFileM", "insert", "insertEmbedding", "insertRpc", "insertTrigger", "insertWithEmbedding", "removeContentExpire", "removeDirExpire", "removeFileExpire", "removeRpc", "removeTrigger" ]) this[t] = (...e) => this.currentBatch[t](...e).run();
|
|
@@ -54,13 +54,10 @@ class l extends t {
|
|
|
54
54
|
return void 0 === this.qyCache && (e = {
|
|
55
55
|
...this.options,
|
|
56
56
|
...e
|
|
57
|
-
}, t = new
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
_immediate: new r(t, e)
|
|
62
|
-
}), await t.start(), t).metaFile, e.created ? this.creationTime = e.fileContent.creationTime : this.insert(e, {
|
|
63
|
-
creationTime: this.creationTime = h()
|
|
57
|
+
}, t = this.qyCache = new o(this.rootFolder, e, this), e = (this.fetch = new i(t),
|
|
58
|
+
this.batch = new r(t, e), this._immediate = new r(t, e), await t.start(),
|
|
59
|
+
t).metaFile, e.created ? this.creationTime = e.fileContent.creationTime : this.insert(e, {
|
|
60
|
+
creationTime: this.creationTime = c()
|
|
64
61
|
}, !0), m.log("CreationTime:" + new Date(this.creationTime))), this;
|
|
65
62
|
}
|
|
66
63
|
async stop() {
|
|
@@ -71,15 +68,11 @@ class l extends t {
|
|
|
71
68
|
_immediate: r
|
|
72
69
|
} = this;
|
|
73
70
|
e && (await e.stop(), t && (t.qyCache = void 0), i && (i.qyCache = void 0),
|
|
74
|
-
r && (r.qyCache = void 0),
|
|
75
|
-
|
|
76
|
-
fetch: void 0,
|
|
77
|
-
batch: void 0,
|
|
78
|
-
_immediate: void 0
|
|
79
|
-
}));
|
|
71
|
+
r && (r.qyCache = void 0), this.qyCache = void 0, this.fetch = void 0, this.batch = void 0,
|
|
72
|
+
this._immediate = void 0);
|
|
80
73
|
}
|
|
81
74
|
get age() {
|
|
82
|
-
return
|
|
75
|
+
return h() - this.creationTime;
|
|
83
76
|
}
|
|
84
77
|
get ageSecond() {
|
|
85
78
|
return Math.floor(this.age / 1e3);
|
|
@@ -98,10 +91,10 @@ class l extends t {
|
|
|
98
91
|
return this.currentBatch.createFile(e).run(), this.file(e);
|
|
99
92
|
}
|
|
100
93
|
on(e, t) {
|
|
101
|
-
return this.qyCache
|
|
94
|
+
return this.qyCache.on(e, t);
|
|
102
95
|
}
|
|
103
96
|
callRpc(e, t, i = void 0) {
|
|
104
|
-
return this.qyCache
|
|
97
|
+
return this.qyCache.callRpc(e, t, i);
|
|
105
98
|
}
|
|
106
99
|
}
|
|
107
100
|
|
package/src/QyDir.d.ts
CHANGED
|
@@ -21,6 +21,14 @@ export declare class QyDir extends QyItem {
|
|
|
21
21
|
get fileMapKey(): string;
|
|
22
22
|
get subdirMap(): {};
|
|
23
23
|
get fileMap(): {};
|
|
24
|
+
get subdirMapLoaded(): boolean;
|
|
25
|
+
set subdirMapLoaded(val: boolean);
|
|
26
|
+
get fileMapLoaded(): boolean;
|
|
27
|
+
set fileMapLoaded(val: boolean);
|
|
28
|
+
get dExpireChecked(): boolean;
|
|
29
|
+
set dExpireChecked(val: boolean);
|
|
30
|
+
get fExpireChecked(): boolean;
|
|
31
|
+
set fExpireChecked(val: boolean);
|
|
24
32
|
getSubdir(name: string): QyDir | undefined;
|
|
25
33
|
getFile(fileName: string | number): QyFile | undefined;
|
|
26
34
|
getOrCreateSubdir(name: string, created?: boolean): QyDir;
|
package/src/QyDir.js
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Flag_Created as t,
|
|
3
|
+
Flag_DExpireChecked as i,
|
|
4
|
+
Flag_FExpireChecked as r,
|
|
5
|
+
Flag_FileMapLoaded as s,
|
|
6
|
+
Flag_SubdirMapLoaded as a,
|
|
2
7
|
QyItem as e
|
|
3
8
|
} from "./QyItem.js";
|
|
4
9
|
|
|
5
10
|
import {
|
|
6
|
-
getSubdirMapKey as
|
|
7
|
-
getFileMapKey as
|
|
8
|
-
SpecialFilePaths as
|
|
9
|
-
isString as
|
|
10
|
-
getNowTime as
|
|
11
|
+
getSubdirMapKey as d,
|
|
12
|
+
getFileMapKey as l,
|
|
13
|
+
SpecialFilePaths as u,
|
|
14
|
+
isString as n,
|
|
15
|
+
getNowTime as h
|
|
11
16
|
} from "./QyUtils.js";
|
|
12
17
|
|
|
13
18
|
import {
|
|
14
|
-
QyFile as
|
|
19
|
+
QyFile as o
|
|
15
20
|
} from "./QyFile.js";
|
|
16
21
|
|
|
17
22
|
import {
|
|
18
|
-
handleExpiredItem as
|
|
23
|
+
handleExpiredItem as f
|
|
19
24
|
} from "./QyExpire.js";
|
|
20
25
|
|
|
21
|
-
let
|
|
26
|
+
let g = u.HiddenFolderName;
|
|
22
27
|
|
|
23
|
-
class
|
|
28
|
+
class C extends e {
|
|
24
29
|
_subdirCount = 0;
|
|
25
30
|
_fileCount = 0;
|
|
26
31
|
subdirMapChangeCount = 0;
|
|
@@ -29,21 +34,21 @@ class d extends e {
|
|
|
29
34
|
fChangeId = 0;
|
|
30
35
|
valueCache = {};
|
|
31
36
|
constructor(e, i = !1, t = void 0, r = void 0) {
|
|
32
|
-
super(e,
|
|
37
|
+
super(e, t), this.created = i, r && (this._qyCache = r);
|
|
33
38
|
}
|
|
34
39
|
get created() {
|
|
35
|
-
return this.
|
|
40
|
+
return 0 != (this.flagInt & t);
|
|
36
41
|
}
|
|
37
42
|
set created(e) {
|
|
38
43
|
var i;
|
|
39
|
-
this.
|
|
40
|
-
++i.subdirMapChangeCount);
|
|
44
|
+
this.created !== e && (e ? this.flagInt |= t : this.flagInt &= ~t, i = this.parentDir,
|
|
45
|
+
void 0 !== i) && (i._subdirCount += e ? 1 : -1, ++i.subdirMapChangeCount);
|
|
41
46
|
}
|
|
42
47
|
get fileCount() {
|
|
43
|
-
return
|
|
48
|
+
return b(this), this._fileCount;
|
|
44
49
|
}
|
|
45
50
|
get subdirCount() {
|
|
46
|
-
return
|
|
51
|
+
return p(this), this._subdirCount;
|
|
47
52
|
}
|
|
48
53
|
get isDir() {
|
|
49
54
|
return !0;
|
|
@@ -52,19 +57,43 @@ class d extends e {
|
|
|
52
57
|
return 0 === this.fileCount && 0 === this.subdirCount;
|
|
53
58
|
}
|
|
54
59
|
get isHiddenFolder() {
|
|
55
|
-
return this.name ===
|
|
60
|
+
return this.name === g;
|
|
56
61
|
}
|
|
57
62
|
get subdirMapKey() {
|
|
58
|
-
return this._subdirMapKey || (this._subdirMapKey =
|
|
63
|
+
return this._subdirMapKey || (this._subdirMapKey = d(this.fullPathHash));
|
|
59
64
|
}
|
|
60
65
|
get fileMapKey() {
|
|
61
|
-
return this._fileMapKey || (this._fileMapKey =
|
|
66
|
+
return this._fileMapKey || (this._fileMapKey = l(this.fullPathHash));
|
|
62
67
|
}
|
|
63
68
|
get subdirMap() {
|
|
64
|
-
return
|
|
69
|
+
return p(this), this._subdirMap;
|
|
65
70
|
}
|
|
66
71
|
get fileMap() {
|
|
67
|
-
return
|
|
72
|
+
return b(this), this._fileMap;
|
|
73
|
+
}
|
|
74
|
+
get subdirMapLoaded() {
|
|
75
|
+
return 0 != (this.flagInt & a);
|
|
76
|
+
}
|
|
77
|
+
set subdirMapLoaded(e) {
|
|
78
|
+
e ? this.flagInt |= a : this.flagInt &= ~a;
|
|
79
|
+
}
|
|
80
|
+
get fileMapLoaded() {
|
|
81
|
+
return 0 != (this.flagInt & s);
|
|
82
|
+
}
|
|
83
|
+
set fileMapLoaded(e) {
|
|
84
|
+
e ? this.flagInt |= s : this.flagInt &= ~s;
|
|
85
|
+
}
|
|
86
|
+
get dExpireChecked() {
|
|
87
|
+
return 0 != (this.flagInt & i);
|
|
88
|
+
}
|
|
89
|
+
set dExpireChecked(e) {
|
|
90
|
+
e ? this.flagInt |= i : this.flagInt &= ~i;
|
|
91
|
+
}
|
|
92
|
+
get fExpireChecked() {
|
|
93
|
+
return 0 != (this.flagInt & r);
|
|
94
|
+
}
|
|
95
|
+
set fExpireChecked(e) {
|
|
96
|
+
e ? this.flagInt |= r : this.flagInt &= ~r;
|
|
68
97
|
}
|
|
69
98
|
getSubdir(e) {
|
|
70
99
|
var i;
|
|
@@ -84,13 +113,13 @@ class d extends e {
|
|
|
84
113
|
if ("/" === e) return this.qyCache?.rootDir || this;
|
|
85
114
|
let t = this.subdirMap;
|
|
86
115
|
var r = (t = void 0 === t ? this._subdirMap = {} : t)[e];
|
|
87
|
-
return r || (r = t[e] = new
|
|
116
|
+
return r || (r = t[e] = new C(e, i, this), this.setChildTriggerNodes(r)),
|
|
88
117
|
r;
|
|
89
118
|
}
|
|
90
119
|
getOrCreateFile(e, i = !1) {
|
|
91
120
|
let t = this.fileMap;
|
|
92
121
|
var r = (t = void 0 === t ? this._fileMap = {} : t)[e];
|
|
93
|
-
return r || (r = t[e] = new
|
|
122
|
+
return r || (r = t[e] = new o(e, i, this), this.setChildTriggerNodes(r)),
|
|
94
123
|
r;
|
|
95
124
|
}
|
|
96
125
|
searchSubdir(i, t = i.length) {
|
|
@@ -237,7 +266,7 @@ class d extends e {
|
|
|
237
266
|
"*": t,
|
|
238
267
|
[a]: r
|
|
239
268
|
}
|
|
240
|
-
} of i) t && s.push(t), r && s.push(r);
|
|
269
|
+
} of i) void 0 !== t && s.push(t), void 0 !== r && s.push(r);
|
|
241
270
|
e.triggerNodes = 0 < s.length ? s : void 0;
|
|
242
271
|
} else e.triggerNodes = void 0;
|
|
243
272
|
}
|
|
@@ -252,10 +281,10 @@ class d extends e {
|
|
|
252
281
|
let s = !1;
|
|
253
282
|
var a = r.length;
|
|
254
283
|
for (let e = t ? a - 1 : 0; t ? 0 <= e : e < a; t ? --e : ++e) {
|
|
255
|
-
var d = r[e],
|
|
256
|
-
if (l
|
|
284
|
+
var d = r[e], l = d.nameNum;
|
|
285
|
+
if (n(l)) {
|
|
257
286
|
if (s) return;
|
|
258
|
-
} else if (i(
|
|
287
|
+
} else if (i(l)) yield d, s = !0; else if (s) return;
|
|
259
288
|
}
|
|
260
289
|
}
|
|
261
290
|
ensureAllLoaded() {
|
|
@@ -264,37 +293,37 @@ class d extends e {
|
|
|
264
293
|
}
|
|
265
294
|
}
|
|
266
295
|
|
|
267
|
-
function
|
|
296
|
+
function p(e) {
|
|
268
297
|
if (e.created && !e.subdirMapLoaded) {
|
|
269
298
|
e.subdirMapLoaded = !0;
|
|
270
299
|
var i = e.qyCache;
|
|
271
300
|
if (i) {
|
|
272
301
|
var t = i.qyKVData.getValueSync(e.subdirMapKey);
|
|
273
|
-
if (t) {
|
|
302
|
+
if (void 0 !== t) {
|
|
274
303
|
var r, s = e._subdirMap || (e._subdirMap = {});
|
|
275
|
-
for (r in t) r in s || (s[r] = new
|
|
276
|
-
e.underHiddenFolder ||
|
|
304
|
+
for (r in t) r in s || (s[r] = new C(r, !0, e));
|
|
305
|
+
e.underHiddenFolder || v(e, i, "d");
|
|
277
306
|
}
|
|
278
307
|
}
|
|
279
308
|
}
|
|
280
309
|
}
|
|
281
310
|
|
|
282
|
-
function
|
|
311
|
+
function b(e) {
|
|
283
312
|
if (e.created && !e._fileMap && !e.fileMapLoaded) {
|
|
284
313
|
e.fileMapLoaded = !0;
|
|
285
314
|
var i = e.qyCache;
|
|
286
315
|
if (i) {
|
|
287
316
|
var t = i.qyKVData.getValueSync(e.fileMapKey);
|
|
288
|
-
if (t) {
|
|
317
|
+
if (void 0 !== t) {
|
|
289
318
|
var r, s = e._fileMap = {};
|
|
290
|
-
for (r in t) s[r] = new
|
|
291
|
-
e.underHiddenFolder ||
|
|
319
|
+
for (r in t) s[r] = new o(r, !0, e);
|
|
320
|
+
e.underHiddenFolder || v(e, i, "f");
|
|
292
321
|
}
|
|
293
322
|
}
|
|
294
323
|
}
|
|
295
324
|
}
|
|
296
325
|
|
|
297
|
-
function
|
|
326
|
+
function v(e, i, t) {
|
|
298
327
|
if ("d" === t) {
|
|
299
328
|
if (e.dExpireChecked) return;
|
|
300
329
|
e.dExpireChecked = !0;
|
|
@@ -304,14 +333,14 @@ function f(e, i, t) {
|
|
|
304
333
|
}
|
|
305
334
|
var r = i.getExpireInfoFile(e.fullPathHash, t);
|
|
306
335
|
if (void 0 !== r) {
|
|
307
|
-
var s, a = r.fileContent, d =
|
|
336
|
+
var s, a = r.fileContent, d = h(), l = i.qyDB;
|
|
308
337
|
for (s in a) {
|
|
309
|
-
var
|
|
310
|
-
n <= d ?
|
|
338
|
+
var u = "d" === t ? e.getOrCreateSubdir(s) : e.getOrCreateFile(s), n = a[s];
|
|
339
|
+
n <= d ? f(l, u) : i.monitorItemExpire(u, n);
|
|
311
340
|
}
|
|
312
341
|
}
|
|
313
342
|
}
|
|
314
343
|
|
|
315
344
|
export {
|
|
316
|
-
|
|
345
|
+
C as QyDir
|
|
317
346
|
};
|
package/src/QyEmbeddings.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import type { QyCache } from "./QyCache.ts";
|
|
2
|
+
import type { QyDB } from "./QyDB.ts";
|
|
1
3
|
export declare class QyEmbeddings {
|
|
2
|
-
qyCache: any;
|
|
3
4
|
embeddingFolder: any;
|
|
4
5
|
options: any;
|
|
5
|
-
qyDB: any;
|
|
6
6
|
qyEmbeddingWriters: any;
|
|
7
7
|
hashToEmbeddingMap: {};
|
|
8
|
-
|
|
8
|
+
qyCache: QyCache;
|
|
9
|
+
qyDB: QyDB;
|
|
10
|
+
constructor(qyCache: QyCache, options?: any);
|
|
9
11
|
start(): Promise<void>;
|
|
10
12
|
stop(): Promise<void>;
|
|
11
13
|
addEmbedding(fullPathHash: any, embedding: any): any;
|