datafolder 1.0.12 → 1.0.13
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/README.md +6 -2
- package/package.json +1 -1
- package/scripts/airbnb.js +1 -1
- package/scripts/airbnb2.js +1 -1
- package/scripts/flights.js +2 -2
- package/scripts/flights2.js +2 -2
- package/src/QyBatch.d.ts +13 -6
- package/src/QyBatch.js +209 -126
- package/src/QyCache.d.ts +6 -3
- package/src/QyCache.js +86 -68
- package/src/QyDB.d.ts +3 -0
- package/src/QyDB.js +36 -21
- package/src/QyDefaultOptions.js +0 -3
- package/src/QyDir.d.ts +1 -0
- package/src/QyDir.js +49 -20
- package/src/QyExpire.d.ts +9 -15
- package/src/QyExpire.js +60 -68
- package/src/QyExpireInfo.d.ts +10 -0
- package/src/QyExpireInfo.js +92 -0
- package/src/QyExpire_Worker.d.ts +13 -14
- package/src/QyExpire_Worker.js +74 -89
- package/src/QyFile.d.ts +1 -1
- package/src/QyFile.js +58 -43
- package/src/QyFileContentUtils.d.ts +1 -0
- package/src/QyFileContentUtils.js +107 -93
- package/src/QyItem.d.ts +6 -0
- package/src/QyItem.js +25 -7
- package/src/QyKVData.d.ts +3 -1
- package/src/QyKVData.js +70 -63
- package/src/QyUtils.d.ts +3 -1
- package/src/QyUtils.js +41 -34
- package/static/codemirror.bundle/editor.bundle.js +6 -1
- package/src/QyExpireClock.d.ts +0 -15
- package/src/QyExpireClock.js +0 -53
- package/src/rpc/evalCode.js +0 -9
- package/src/rpc/getFileContent.js +0 -16
- package/src/rpc/getRpcFiles.js +0 -1
- package/src/rpc/getSubItems.js +0 -16
- package/src/rpc/getTriggerFiles.js +0 -1
- package/src/rpc/queryFiles.js +0 -10
- package/src/rpc/reloadRpc.js +0 -1
package/src/QyKVData.js
CHANGED
|
@@ -15,16 +15,16 @@ import {
|
|
|
15
15
|
} from "./QyKVDataSaver.js";
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
|
-
QySnapshotCompactor as
|
|
18
|
+
QySnapshotCompactor as r
|
|
19
19
|
} from "./QySnapshotCompactor.js";
|
|
20
20
|
|
|
21
21
|
import {
|
|
22
|
-
QyKVDataCleaner as
|
|
22
|
+
QyKVDataCleaner as p
|
|
23
23
|
} from "./QyKVDataCleaner.js";
|
|
24
24
|
|
|
25
25
|
import {
|
|
26
26
|
readBufferAsync as y,
|
|
27
|
-
sleep as
|
|
27
|
+
sleep as l
|
|
28
28
|
} from "./QyUtils.js";
|
|
29
29
|
|
|
30
30
|
import {
|
|
@@ -66,8 +66,8 @@ class t {
|
|
|
66
66
|
kvFolder: t,
|
|
67
67
|
snapshotFolder: e,
|
|
68
68
|
qyKVDataSaver: new i(this, t, a),
|
|
69
|
-
qySnapshotCompactor: new
|
|
70
|
-
qyKVDataCleaner: new
|
|
69
|
+
qySnapshotCompactor: new r(this, t, a),
|
|
70
|
+
qyKVDataCleaner: new p(this, t, a),
|
|
71
71
|
qyExpire: new h(o, a)
|
|
72
72
|
});
|
|
73
73
|
}
|
|
@@ -76,12 +76,12 @@ class t {
|
|
|
76
76
|
options: n,
|
|
77
77
|
qyKVDataSaver: s,
|
|
78
78
|
qySnapshotCompactor: i,
|
|
79
|
-
qyKVDataCleaner:
|
|
79
|
+
qyKVDataCleaner: r,
|
|
80
|
+
qyExpire: p
|
|
80
81
|
} = this, {
|
|
81
|
-
maxSnapshotNum:
|
|
82
|
-
snapshotMaxChangeId:
|
|
83
|
-
} = o, s = (s.start(t,
|
|
84
|
-
setInterval(() => l(this), n.compactSnapshotsInterval)), r = setInterval(() => (async o => {
|
|
82
|
+
maxSnapshotNum: h,
|
|
83
|
+
snapshotMaxChangeId: c
|
|
84
|
+
} = o, s = (s.start(t, h, a, e), i.start(), r.start(), p.start(), setInterval(() => m(this), n.compactSnapshotsInterval)), h = setInterval(() => (async o => {
|
|
85
85
|
if (!o.unloadingMemory) {
|
|
86
86
|
o.unloadingMemory = !0;
|
|
87
87
|
var {
|
|
@@ -93,18 +93,18 @@ class t {
|
|
|
93
93
|
var s, i = n.maxFileCountToUnload, n = e.rootDir;
|
|
94
94
|
a = d(o, n), t = a;
|
|
95
95
|
for (s of n.allLoadedSubdirs()) if ((a += d(o, s)) > i && (t += a,
|
|
96
|
-
a = 0, await
|
|
96
|
+
a = 0, await l(0), o.isStopping)) break;
|
|
97
97
|
}
|
|
98
98
|
t += a, global.gc && global.gc(), o.unloadingMemory = !1;
|
|
99
99
|
}
|
|
100
100
|
})(this), n.unloadMemInterval);
|
|
101
101
|
return Object.assign(this, {
|
|
102
102
|
maxChangeId: t,
|
|
103
|
-
snapshotSavedChangeId:
|
|
103
|
+
snapshotSavedChangeId: c,
|
|
104
104
|
qySnapshots: o,
|
|
105
105
|
aclKeyValueMap: e,
|
|
106
106
|
compactInterval: s,
|
|
107
|
-
unloadInterval:
|
|
107
|
+
unloadInterval: h
|
|
108
108
|
}), n.bgLoadPosMaps ? (async t => {
|
|
109
109
|
var a, {
|
|
110
110
|
qySnapshots: o,
|
|
@@ -112,37 +112,37 @@ class t {
|
|
|
112
112
|
} = t;
|
|
113
113
|
console.time("bgLoadPosMaps");
|
|
114
114
|
for (a of Object.keys(o.numToSnapshotMap).sort((t, a) => a - t)) {
|
|
115
|
-
if (await async function s(i,
|
|
115
|
+
if (await async function s(i, r, p = void 0, h = void 0, c = void 0, l = void 0) {
|
|
116
116
|
if (i.isStopping) return void (l && l.close());
|
|
117
|
-
let
|
|
118
|
-
let
|
|
119
|
-
let u =
|
|
117
|
+
let m = i.qySnapshots;
|
|
118
|
+
let d = m.numToSnapshotMap;
|
|
119
|
+
let u = d[r];
|
|
120
120
|
if (!u) return void (l && l.close());
|
|
121
121
|
let {
|
|
122
122
|
info: S,
|
|
123
123
|
prefixPM: v
|
|
124
124
|
} = u;
|
|
125
|
-
|
|
126
|
-
if (0 ==
|
|
127
|
-
if (null == h || h != S.pMVersion) return l && l.close(), c =
|
|
128
|
-
s(i,
|
|
129
|
-
for (;0 <
|
|
130
|
-
let e =
|
|
125
|
+
p = p || Object.keys(v).sort().reverse();
|
|
126
|
+
if (0 == p.length) return void (l && l.close());
|
|
127
|
+
if (null == h || h != S.pMVersion) return l && l.close(), c = m.getPMFilePath(u),
|
|
128
|
+
s(i, r, p, S.pMVersion, c, await f(c));
|
|
129
|
+
for (;0 < p.length; ) {
|
|
130
|
+
let e = p.at(-1), n = v[e];
|
|
131
131
|
if (n) {
|
|
132
132
|
let [ t, a ] = n, o = await y(c, l, t, a);
|
|
133
|
-
if (i.isStopping || !
|
|
134
|
-
if (h != S.pMVersion) return l.close(), s(i,
|
|
135
|
-
e in v &&
|
|
133
|
+
if (i.isStopping || !d[r]) return void l.close();
|
|
134
|
+
if (h != S.pMVersion) return l.close(), s(i, r, p);
|
|
135
|
+
e in v && m.loadPartialPosMapBuffer(u, e, o);
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
p.pop();
|
|
138
138
|
}
|
|
139
139
|
l.close();
|
|
140
|
-
C.info("bgLoadPosMap:" +
|
|
140
|
+
C.info("bgLoadPosMap:" + r);
|
|
141
141
|
}(t, a), t.isStopping) break;
|
|
142
|
-
if (await
|
|
142
|
+
if (await l(0), t.isStopping) break;
|
|
143
143
|
}
|
|
144
|
-
console.timeEnd("bgLoadPosMaps"), !t.isStopping && e.compactAtStart &&
|
|
145
|
-
})(this) : n.compactAtStart &&
|
|
144
|
+
console.timeEnd("bgLoadPosMaps"), !t.isStopping && e.compactAtStart && m(t);
|
|
145
|
+
})(this) : n.compactAtStart && m(this), this;
|
|
146
146
|
}
|
|
147
147
|
async stop() {
|
|
148
148
|
this.isStopping = !0;
|
|
@@ -152,10 +152,11 @@ class t {
|
|
|
152
152
|
qySnapshots: o,
|
|
153
153
|
compactInterval: e,
|
|
154
154
|
unloadInterval: n,
|
|
155
|
-
qyKVDataCleaner: s
|
|
155
|
+
qyKVDataCleaner: s,
|
|
156
|
+
qyExpire: i
|
|
156
157
|
} = this;
|
|
157
|
-
clearInterval(e), clearInterval(n), this.onSnapshotSavedChangeId(await t.stop()),
|
|
158
|
-
o && o.closeAllFDs(), await a.stop(), await s.stop()
|
|
158
|
+
clearInterval(e), clearInterval(n), await i.stop(), this.onSnapshotSavedChangeId(await t.stop()),
|
|
159
|
+
o && o.closeAllFDs(), await a.stop(), await s.stop();
|
|
159
160
|
}
|
|
160
161
|
save(t, a, o, e) {
|
|
161
162
|
var n = this.qyKVDataSaver;
|
|
@@ -191,10 +192,10 @@ class t {
|
|
|
191
192
|
qyKVDataSaver: n
|
|
192
193
|
} = this;
|
|
193
194
|
if (3 == o && e <= t && (x(this), this.compactState = 1), a) {
|
|
194
|
-
var s, o = a, i = this.qySnapshots,
|
|
195
|
+
var s, o = a, i = this.qySnapshots, r = i.keyToSnapshotMap;
|
|
195
196
|
for (s in o.posMap) {
|
|
196
|
-
var
|
|
197
|
-
|
|
197
|
+
var p = r[s];
|
|
198
|
+
p && i.removeKeyFromSnapshot(p, s);
|
|
198
199
|
}
|
|
199
200
|
i.addMaxSnapshot(o), C.info("addPMOnlySnapshot: " + i.snapshotMaxChangeId),
|
|
200
201
|
n.releaseSnapshot(a.snapshotNum);
|
|
@@ -204,17 +205,17 @@ class t {
|
|
|
204
205
|
if (2 == this.compactState) {
|
|
205
206
|
var l = this, {
|
|
206
207
|
pMUpdates: t,
|
|
207
|
-
vLUpdates:
|
|
208
|
-
combinationUpdate:
|
|
208
|
+
vLUpdates: m,
|
|
209
|
+
combinationUpdate: d
|
|
209
210
|
} = t = t;
|
|
210
211
|
if (t) {
|
|
211
212
|
var a = t, o = l.qySnapshots.numToSnapshotMap;
|
|
212
213
|
for (s in a) {
|
|
213
214
|
var e, n = a[s], s = o[s], {
|
|
214
215
|
prefixPM: i,
|
|
215
|
-
info:
|
|
216
|
+
info: r
|
|
216
217
|
} = s;
|
|
217
|
-
for (e in ++
|
|
218
|
+
for (e in ++r.pMVersion, r.verList[0] = r.pMVersion + r.vLVersion,
|
|
218
219
|
i) i[e] = n[e];
|
|
219
220
|
(t => {
|
|
220
221
|
var {
|
|
@@ -225,13 +226,13 @@ class t {
|
|
|
225
226
|
})(s);
|
|
226
227
|
}
|
|
227
228
|
}
|
|
228
|
-
if (
|
|
229
|
-
var
|
|
230
|
-
for (f in
|
|
229
|
+
if (m) {
|
|
230
|
+
var p = m, h = (t = l).qySnapshots.numToSnapshotMap;
|
|
231
|
+
for (f in p) {
|
|
231
232
|
var c, u, {
|
|
232
233
|
posMap: S,
|
|
233
234
|
prefixPM: v
|
|
234
|
-
} =
|
|
235
|
+
} = p[f], f = h[f], {
|
|
235
236
|
posMap: y,
|
|
236
237
|
prefixPM: C,
|
|
237
238
|
info: g
|
|
@@ -242,8 +243,8 @@ class t {
|
|
|
242
243
|
I(f);
|
|
243
244
|
}
|
|
244
245
|
}
|
|
245
|
-
if (
|
|
246
|
-
var M,
|
|
246
|
+
if (d) {
|
|
247
|
+
var M, m = d;
|
|
247
248
|
let e = l.qySnapshots, {
|
|
248
249
|
numToSnapshotMap: n,
|
|
249
250
|
keyToSnapshotMap: s
|
|
@@ -251,24 +252,24 @@ class t {
|
|
|
251
252
|
snapshotNum: t,
|
|
252
253
|
combinedSnapshotNumVerList: a,
|
|
253
254
|
posMap: i
|
|
254
|
-
} =
|
|
255
|
-
posMap:
|
|
255
|
+
} = m, r = n[t], {
|
|
256
|
+
posMap: p,
|
|
256
257
|
info: o
|
|
257
|
-
} =
|
|
258
|
+
} = r;
|
|
258
259
|
for (M in ++o.pMVersion, ++o.vLVersion, o.verList[0] = o.pMVersion + o.vLVersion,
|
|
259
|
-
|
|
260
|
-
I(
|
|
261
|
-
let h = o.totalCount, c =
|
|
260
|
+
p) p[M] = i[M];
|
|
261
|
+
I(r);
|
|
262
|
+
let h = o.totalCount, c = r.outdatedCount;
|
|
262
263
|
for (let [ o ] of a) {
|
|
263
|
-
var
|
|
264
|
+
var q, V = n[o];
|
|
264
265
|
let {
|
|
265
266
|
posMap: t,
|
|
266
267
|
info: a
|
|
267
|
-
} =
|
|
268
|
-
for (
|
|
269
|
-
I(
|
|
268
|
+
} = V;
|
|
269
|
+
for (q in t) p[q] = i[q], s[q] = r;
|
|
270
|
+
I(V), h += a.totalCount, c += V.outdatedCount, e.delSnapshot(V);
|
|
270
271
|
}
|
|
271
|
-
o.totalCount = h,
|
|
272
|
+
o.totalCount = h, r.outdatedCount = c;
|
|
272
273
|
}
|
|
273
274
|
this.snapshotSavedChangeId >= this.compactMaxChangeId ? (x(this), this.compactState = 1) : this.compactState = 3;
|
|
274
275
|
}
|
|
@@ -279,6 +280,12 @@ class t {
|
|
|
279
280
|
unmonitorContentExpire(t, a) {
|
|
280
281
|
this.qyExpire.unmonitorContentExpire(t, a);
|
|
281
282
|
}
|
|
283
|
+
monitorItemExpire(t, a) {
|
|
284
|
+
this.qyExpire.monitorItemExpire(t, a);
|
|
285
|
+
}
|
|
286
|
+
unmonitorItemExpire(t) {
|
|
287
|
+
this.qyExpire.unmonitorItemExpire(t);
|
|
288
|
+
}
|
|
282
289
|
}
|
|
283
290
|
|
|
284
291
|
function I(t) {
|
|
@@ -290,7 +297,7 @@ function I(t) {
|
|
|
290
297
|
t.compactOutedCount = 0;
|
|
291
298
|
}
|
|
292
299
|
|
|
293
|
-
function
|
|
300
|
+
function m(t) {
|
|
294
301
|
if (1 == t.compactState) {
|
|
295
302
|
var {
|
|
296
303
|
maxChangeId: a,
|
|
@@ -307,10 +314,10 @@ function l(t) {
|
|
|
307
314
|
compactState: 2,
|
|
308
315
|
compactMaxChangeId: a
|
|
309
316
|
});
|
|
310
|
-
for (var
|
|
317
|
+
for (var r of [ n, s, i ]) for (var p of r) p.compactOutedCount = p.outdatedCount;
|
|
311
318
|
e.compactSnapshots(n, s, i);
|
|
312
319
|
}
|
|
313
|
-
0 < o.length && (t.emptySnapshotNumVerList.push(...o), t.snapshotSavedChangeId >= a ?
|
|
320
|
+
0 < o.length && (t.emptySnapshotNumVerList.push(...o), t.snapshotSavedChangeId >= a ? c(t) : 1 == t.compactState && Object.assign(t, {
|
|
314
321
|
compactState: 3,
|
|
315
322
|
compactMaxChangeId: a
|
|
316
323
|
}));
|
|
@@ -324,7 +331,7 @@ function d(t, a) {
|
|
|
324
331
|
return e;
|
|
325
332
|
}
|
|
326
333
|
|
|
327
|
-
function
|
|
334
|
+
function c(t) {
|
|
328
335
|
var {
|
|
329
336
|
qyKVDataCleaner: t,
|
|
330
337
|
emptySnapshotNumVerList: a
|
|
@@ -333,7 +340,7 @@ function m(t) {
|
|
|
333
340
|
}
|
|
334
341
|
|
|
335
342
|
function x(t) {
|
|
336
|
-
t.qySnapshotCompactor.saveSnapshotInfos(),
|
|
343
|
+
t.qySnapshotCompactor.saveSnapshotInfos(), c(t);
|
|
337
344
|
}
|
|
338
345
|
|
|
339
346
|
export {
|
package/src/QyUtils.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare const SpecialFilePaths: {
|
|
|
8
8
|
RpcDirPath: string[];
|
|
9
9
|
IndexDirPath: string[];
|
|
10
10
|
ExpireDirPath: string[];
|
|
11
|
+
MetaFilePath: string[];
|
|
11
12
|
IndexPropPathsFileName: string;
|
|
12
13
|
};
|
|
13
14
|
export declare function isMatchName(name: any): any;
|
|
@@ -50,5 +51,6 @@ export declare function loadFileList(fileList: any, preloadCount?: number): Asyn
|
|
|
50
51
|
filePath: any;
|
|
51
52
|
bin: any;
|
|
52
53
|
}, void, unknown>;
|
|
53
|
-
export declare function
|
|
54
|
+
export declare function getNowTime(now?: Date): number;
|
|
55
|
+
export declare function getNowRounded(now?: Date): number;
|
|
54
56
|
export * as default from "./QyUtils.ts";
|
package/src/QyUtils.js
CHANGED
|
@@ -6,9 +6,9 @@ import e from "node:process";
|
|
|
6
6
|
|
|
7
7
|
import l from "node:fs/promises";
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import i from "node:fs";
|
|
10
10
|
|
|
11
|
-
import
|
|
11
|
+
import o from "node:timers/promises";
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
14
|
fileURLToPath as r
|
|
@@ -26,15 +26,16 @@ var f = t.dirname(r(import.meta.url)), c = Object.fromEntries([ "$del", "$link",
|
|
|
26
26
|
RpcDirPath: [ s, "rpc" ],
|
|
27
27
|
IndexDirPath: [ s, "index" ],
|
|
28
28
|
ExpireDirPath: [ s, "expire" ],
|
|
29
|
+
MetaFilePath: [ s, "meta" ],
|
|
29
30
|
IndexPropPathsFileName: "propPaths"
|
|
30
31
|
};
|
|
31
32
|
|
|
32
|
-
function
|
|
33
|
+
function m(r) {
|
|
33
34
|
return r.startsWith("{") && r.endsWith("}");
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
function
|
|
37
|
-
return
|
|
37
|
+
function d(r) {
|
|
38
|
+
return m(r) && r.substring(1, r.length - 1);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
function p(r) {
|
|
@@ -59,11 +60,11 @@ function b(r) {
|
|
|
59
60
|
return "c" + r;
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
function
|
|
63
|
+
function w(r = 8) {
|
|
63
64
|
return n.randomBytes(r).toString("hex");
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
function
|
|
67
|
+
function $(r) {
|
|
67
68
|
if (null != r) for (var t in r) if (null != r[t]) return !1;
|
|
68
69
|
return !0;
|
|
69
70
|
}
|
|
@@ -114,17 +115,17 @@ function E(r) {
|
|
|
114
115
|
return 1 < r ? "s" : "";
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
function
|
|
118
|
+
function F(r) {
|
|
118
119
|
return l.mkdir(r, {
|
|
119
120
|
recursive: !0
|
|
120
121
|
});
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
function
|
|
124
|
-
return
|
|
124
|
+
function O(r) {
|
|
125
|
+
return F(t.dirname(r));
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
async function
|
|
128
|
+
async function k(r) {
|
|
128
129
|
try {
|
|
129
130
|
return (await l.stat(r)).size;
|
|
130
131
|
} catch (r) {
|
|
@@ -133,21 +134,21 @@ async function F(r) {
|
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
async function W(r) {
|
|
136
|
-
return !1 !== await
|
|
137
|
+
return !1 !== await k(r);
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
function L(r, t = void 0) {
|
|
140
141
|
r *= 1e3;
|
|
141
|
-
return t ?
|
|
142
|
+
return t ? o.setTimeout(r, !0, {
|
|
142
143
|
signal: t
|
|
143
|
-
}) :
|
|
144
|
+
}) : o.setTimeout(r);
|
|
144
145
|
}
|
|
145
146
|
|
|
146
147
|
let I;
|
|
147
148
|
|
|
148
149
|
async function R(t) {
|
|
149
150
|
try {
|
|
150
|
-
await
|
|
151
|
+
await O(t);
|
|
151
152
|
var r = new Date().toISOString() + ": " + e.argv.join(" ");
|
|
152
153
|
function n() {
|
|
153
154
|
for (var r of Object.keys(I)) N(r);
|
|
@@ -166,7 +167,7 @@ async function R(t) {
|
|
|
166
167
|
|
|
167
168
|
function N(r) {
|
|
168
169
|
try {
|
|
169
|
-
|
|
170
|
+
i.unlinkSync(r), u.info("Unlocked " + r);
|
|
170
171
|
} catch (r) {}
|
|
171
172
|
}
|
|
172
173
|
|
|
@@ -205,14 +206,14 @@ function X(r) {
|
|
|
205
206
|
return n;
|
|
206
207
|
}
|
|
207
208
|
|
|
208
|
-
async function q(t, n, e,
|
|
209
|
-
var
|
|
210
|
-
for (let r = 0; r <
|
|
211
|
-
var a = (await n.read(
|
|
209
|
+
async function q(t, n, e, i) {
|
|
210
|
+
var o = Buffer.allocUnsafe(i);
|
|
211
|
+
for (let r = 0; r < i; ) {
|
|
212
|
+
var a = (await n.read(o, r, i - r, e + r)).bytesRead;
|
|
212
213
|
if (0 == a) return void u.error(`read ${t} at ${e + r} returning 0 byte`);
|
|
213
214
|
r += a;
|
|
214
215
|
}
|
|
215
|
-
return
|
|
216
|
+
return o;
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
function C() {
|
|
@@ -221,13 +222,13 @@ function C() {
|
|
|
221
222
|
}
|
|
222
223
|
|
|
223
224
|
async function* V(e, t = 3) {
|
|
224
|
-
var n = e.length,
|
|
225
|
+
var n = e.length, i = (n < t && (t = n), new Array(n));
|
|
225
226
|
for (let r = 0; r < t; ++r) {
|
|
226
|
-
var
|
|
227
|
-
s(r,
|
|
227
|
+
var o = i[r] = {};
|
|
228
|
+
s(r, o);
|
|
228
229
|
}
|
|
229
230
|
for (let r = 0; r < n; ++r) {
|
|
230
|
-
var a =
|
|
231
|
+
var a = i[r % t], {
|
|
231
232
|
filePath: u,
|
|
232
233
|
bin: f
|
|
233
234
|
} = (a.bin || await a.promise, a), c = r + t;
|
|
@@ -247,7 +248,12 @@ async function* V(e, t = 3) {
|
|
|
247
248
|
}
|
|
248
249
|
|
|
249
250
|
function Y(r = new Date()) {
|
|
250
|
-
return
|
|
251
|
+
return r.getTime();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function Z(r = new Date()) {
|
|
255
|
+
r = r.getTime();
|
|
256
|
+
return r - r % 1e3;
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
export * as default from "./QyUtils.js";
|
|
@@ -256,16 +262,16 @@ export {
|
|
|
256
262
|
f as __dirname,
|
|
257
263
|
c as SpecialOperators,
|
|
258
264
|
s as SpecialFilePaths,
|
|
259
|
-
|
|
260
|
-
|
|
265
|
+
m as isMatchName,
|
|
266
|
+
d as getMatchParam,
|
|
261
267
|
p as getSizeStr,
|
|
262
268
|
h as calHash,
|
|
263
269
|
g as Hash_Key_Length,
|
|
264
270
|
y as getSubdirMapKey,
|
|
265
271
|
v as getFileMapKey,
|
|
266
272
|
b as getContentKey,
|
|
267
|
-
|
|
268
|
-
|
|
273
|
+
w as getRandomStr,
|
|
274
|
+
$ as isEmptyObj,
|
|
269
275
|
P as isNotNullObj,
|
|
270
276
|
x as isString,
|
|
271
277
|
S as isNumber,
|
|
@@ -276,9 +282,9 @@ export {
|
|
|
276
282
|
T as setPromise,
|
|
277
283
|
A as toBuffer,
|
|
278
284
|
E as getSuffix,
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
285
|
+
F as ensureDir,
|
|
286
|
+
O as ensureParentDir,
|
|
287
|
+
k as getSize,
|
|
282
288
|
W as folderOrFileExists,
|
|
283
289
|
L as sleep,
|
|
284
290
|
R as lockExclusiveFilePath,
|
|
@@ -293,5 +299,6 @@ export {
|
|
|
293
299
|
q as readBufferAsync,
|
|
294
300
|
C as memoryPercent,
|
|
295
301
|
V as loadFileList,
|
|
296
|
-
Y as
|
|
302
|
+
Y as getNowTime,
|
|
303
|
+
Z as getNowRounded
|
|
297
304
|
};
|
|
@@ -25815,6 +25815,8 @@
|
|
|
25815
25815
|
if (dPrec)
|
|
25816
25816
|
this.score += dPrec;
|
|
25817
25817
|
if (depth == 0) {
|
|
25818
|
+
if (type < parser.minRepeatTerm && this.reducePos < this.pos)
|
|
25819
|
+
this.reducePos = this.pos;
|
|
25818
25820
|
this.pushState(parser.getGoto(this.state, type, true), this.reducePos);
|
|
25819
25821
|
// Zero-depth reductions are a special case—they add stuff to
|
|
25820
25822
|
// the stack without popping anything off.
|
|
@@ -25829,7 +25831,10 @@
|
|
|
25829
25831
|
// expression and the state that we'll be staying in, which should
|
|
25830
25832
|
// be moved to `this.state`).
|
|
25831
25833
|
let base = this.stack.length - ((depth - 1) * 3) - (action & 262144 /* Action.StayFlag */ ? 6 : 0);
|
|
25832
|
-
let start = base ? this.stack[base - 2] : this.p.ranges[0].from
|
|
25834
|
+
let start = base ? this.stack[base - 2] : this.p.ranges[0].from;
|
|
25835
|
+
if (type < parser.minRepeatTerm && start == this.reducePos && this.reducePos < this.pos)
|
|
25836
|
+
this.reducePos = this.pos;
|
|
25837
|
+
let size = this.reducePos - start;
|
|
25833
25838
|
// This is a kludge to try and detect overly deep left-associative
|
|
25834
25839
|
// trees, which will not increase the parse stack depth and thus
|
|
25835
25840
|
// won't be caught by the regular stack-depth limit check.
|
package/src/QyExpireClock.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import EventEmitter from "node:events";
|
|
2
|
-
export declare const ExpiredEventName = "expired";
|
|
3
|
-
export declare class QyExpireClock extends EventEmitter {
|
|
4
|
-
startTime: number;
|
|
5
|
-
seconds: number;
|
|
6
|
-
expireMap: {};
|
|
7
|
-
interval: any;
|
|
8
|
-
options: any;
|
|
9
|
-
constructor(options?: any);
|
|
10
|
-
start(): void;
|
|
11
|
-
stop(): void;
|
|
12
|
-
get currentTime(): number;
|
|
13
|
-
addExpire(expireSeconds: any): void;
|
|
14
|
-
inc(deltaSeconds?: number): void;
|
|
15
|
-
}
|
package/src/QyExpireClock.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import t from "node:events";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
getDefaultOptions as e
|
|
5
|
-
} from "./QyDefaultOptions.js";
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
getNowSeconds as s
|
|
9
|
-
} from "./QyUtils.js";
|
|
10
|
-
|
|
11
|
-
let i = "expired";
|
|
12
|
-
|
|
13
|
-
class r extends t {
|
|
14
|
-
startTime = 0;
|
|
15
|
-
seconds = 0;
|
|
16
|
-
expireMap = {};
|
|
17
|
-
interval;
|
|
18
|
-
options;
|
|
19
|
-
constructor(t = void 0) {
|
|
20
|
-
super(), this.options = {
|
|
21
|
-
...e("QyExpireClock"),
|
|
22
|
-
...t
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
start() {
|
|
26
|
-
this.startTime = s(), this.interval = setInterval(this.inc.bind(this), this.options.expireInterval);
|
|
27
|
-
}
|
|
28
|
-
stop() {
|
|
29
|
-
var t = this.interval;
|
|
30
|
-
t && (clearInterval(t), this.interval = void 0);
|
|
31
|
-
}
|
|
32
|
-
get currentTime() {
|
|
33
|
-
return this.startTime + this.seconds;
|
|
34
|
-
}
|
|
35
|
-
addExpire(t) {
|
|
36
|
-
var {
|
|
37
|
-
startTime: e,
|
|
38
|
-
currentTime: i,
|
|
39
|
-
expireMap: s
|
|
40
|
-
} = this;
|
|
41
|
-
t <= i ? this.emit("expired", t) : s[t - e] = 1;
|
|
42
|
-
}
|
|
43
|
-
inc(e = s() - this.currentTime) {
|
|
44
|
-
var i = this.expireMap;
|
|
45
|
-
for (let t = 0; t < e; ++t) i[++this.seconds] && (this.emit("expired", this.currentTime),
|
|
46
|
-
delete i[this.seconds]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
i as ExpiredEventName,
|
|
52
|
-
r as QyExpireClock
|
|
53
|
-
};
|
package/src/rpc/evalCode.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
let a = new Error("No such file");
|
|
2
|
-
|
|
3
|
-
module.exports = ({
|
|
4
|
-
filePath: e,
|
|
5
|
-
cChangeId: n
|
|
6
|
-
}) => {
|
|
7
|
-
var t, l, o, e = dataFolder.fileP(e);
|
|
8
|
-
return e ? ({
|
|
9
|
-
fileContent: e,
|
|
10
|
-
cChangeId: t,
|
|
11
|
-
fileContentKey: l
|
|
12
|
-
} = e, o = {}, n != t && (Object.assign(o, {
|
|
13
|
-
fileContent: e,
|
|
14
|
-
cChangeId: t
|
|
15
|
-
}), null == n) && (o.fileContentKey = l), o) : a;
|
|
16
|
-
};
|
package/src/rpc/getRpcFiles.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = () => dataFolder.fileListToTree(dataFolder.rpcFileList);
|
package/src/rpc/getSubItems.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
let s = new Error("No such dir");
|
|
2
|
-
|
|
3
|
-
module.exports = ({
|
|
4
|
-
dirPath: a,
|
|
5
|
-
dChangeId: d,
|
|
6
|
-
fChangeId: e
|
|
7
|
-
}) => {
|
|
8
|
-
var r, a = dataFolder.dirP(a);
|
|
9
|
-
return a ? (r = {}, d || e || (r.fullPathHash = a.fullPathHash), d != a.dChangeId && Object.assign(r, {
|
|
10
|
-
subdirList: a.sortedSubdirList.map(a => a.name),
|
|
11
|
-
dChangeId: a.dChangeId
|
|
12
|
-
}), e != a.fChangeId && Object.assign(r, {
|
|
13
|
-
fileList: a.sortedFileList.map(a => a.name),
|
|
14
|
-
fChangeId: a.fChangeId
|
|
15
|
-
}), r) : s;
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = () => dataFolder.fileListToTree(dataFolder.triggerFileList);
|
package/src/rpc/queryFiles.js
DELETED
package/src/rpc/reloadRpc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = () => {};
|