datafolder 1.0.32 → 1.0.34
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/QyBatch.d.ts +1 -1
- package/src/QyBatch.js +96 -92
- package/src/QyCache.js +3 -3
- package/src/QyDir.d.ts +1 -1
- package/src/QyDir.js +97 -30
- package/src/QyFile.d.ts +3 -1
- package/src/QyFile.js +61 -53
- package/src/QyIndexPropTree.d.ts +4 -4
- package/src/QyIndexPropTree.js +57 -57
- package/src/QyIntersectNode.js +28 -26
- package/src/QyItem.js +4 -3
- package/src/QyLogger.d.ts +3 -0
- package/src/QyLogger.js +83 -52
- package/src/QyMessager.js +1 -1
- package/src/QyUnionNode.d.ts +1 -1
- package/src/QyUnionNode.js +4 -4
- package/src/QyUtils.d.ts +0 -2
- package/src/QyUtils.js +64 -74
package/ChangeLog.md
CHANGED
package/package.json
CHANGED
package/src/QyBatch.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export declare class QyBatch extends QyCD {
|
|
|
50
50
|
_action_insertEmbedding(action: any): boolean;
|
|
51
51
|
_action_delEmbedding(action: any): true | undefined;
|
|
52
52
|
_action_put(action: any): boolean;
|
|
53
|
-
|
|
53
|
+
_action_setProp(file: any, propName: any, value: any): any;
|
|
54
54
|
_action_insert(action: any): boolean;
|
|
55
55
|
_action_createFile(action: any): boolean;
|
|
56
56
|
_action_createDir(action: any): boolean;
|
package/src/QyBatch.js
CHANGED
|
@@ -12,19 +12,18 @@ import {
|
|
|
12
12
|
isString as h,
|
|
13
13
|
getSuffix as g,
|
|
14
14
|
SpecialFilePaths as e,
|
|
15
|
-
toSingleName as f,
|
|
16
15
|
isSimpleType as d,
|
|
17
|
-
isEmptyObj as
|
|
16
|
+
isEmptyObj as u,
|
|
18
17
|
isNumber as r,
|
|
19
|
-
getNowRounded as
|
|
18
|
+
getNowRounded as l,
|
|
20
19
|
isDate as a,
|
|
21
|
-
isArray as
|
|
22
|
-
isFloat32Array as
|
|
20
|
+
isArray as m,
|
|
21
|
+
isFloat32Array as f
|
|
23
22
|
} from "./QyUtils.js";
|
|
24
23
|
|
|
25
24
|
import {
|
|
26
25
|
QyAclCmdGenerator as t,
|
|
27
|
-
CmdNames as
|
|
26
|
+
CmdNames as p
|
|
28
27
|
} from "./QyAcl.js";
|
|
29
28
|
|
|
30
29
|
import {
|
|
@@ -36,21 +35,21 @@ import {
|
|
|
36
35
|
} from "./QyDefaultOptions.js";
|
|
37
36
|
|
|
38
37
|
import {
|
|
39
|
-
QyCD as
|
|
38
|
+
QyCD as C
|
|
40
39
|
} from "./QyCD.js";
|
|
41
40
|
|
|
42
41
|
import {
|
|
43
|
-
logger as
|
|
42
|
+
logger as v
|
|
44
43
|
} from "./QyLogger.js";
|
|
45
44
|
|
|
46
|
-
let
|
|
45
|
+
let y = e.IndexPropPathsFileName, x = {
|
|
47
46
|
none: 0,
|
|
48
47
|
basic: 1,
|
|
49
48
|
delta: 2,
|
|
50
49
|
all: 3
|
|
51
50
|
};
|
|
52
51
|
|
|
53
|
-
class
|
|
52
|
+
class D extends C {
|
|
54
53
|
fileLogLevel;
|
|
55
54
|
changeId;
|
|
56
55
|
actionQueue = [];
|
|
@@ -65,26 +64,26 @@ class F extends v {
|
|
|
65
64
|
...i("QyBatch"),
|
|
66
65
|
...t
|
|
67
66
|
};
|
|
68
|
-
e =
|
|
69
|
-
this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new
|
|
67
|
+
e = x[t.fileLogLevel.toLowerCase()];
|
|
68
|
+
this.options = t, this.fileLogLevel = e ?? 1, this.qyCmdObjHistory = new L(t.maxHistoryCmdObjCount);
|
|
70
69
|
}
|
|
71
70
|
createDir(e, t = this.currentDir) {
|
|
72
|
-
return h(e) && (e = o(e)),
|
|
71
|
+
return h(e) && (e = o(e)), F(this, this._action_createDir, {
|
|
73
72
|
item: this.qyCache.getOrCreateDir(e, t)
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
75
|
delDir(e, t = this.currentDir) {
|
|
77
|
-
return h(e) && (e = o(e)),
|
|
76
|
+
return h(e) && (e = o(e)), F(this, this._action_delDir, {
|
|
78
77
|
item: this.qyCache.getOrCreateDir(e, t).ensureAllLoaded()
|
|
79
78
|
});
|
|
80
79
|
}
|
|
81
80
|
createFile(e, t = this.currentDir) {
|
|
82
|
-
return h(e) && (e = o(e)),
|
|
81
|
+
return h(e) && (e = o(e)), F(this, this._action_createFile, {
|
|
83
82
|
item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
delFile(e, t = this.currentDir) {
|
|
87
|
-
return h(e) && (e = o(e)),
|
|
86
|
+
return h(e) && (e = o(e)), F(this, this._action_delFile, {
|
|
88
87
|
item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
|
|
89
88
|
});
|
|
90
89
|
}
|
|
@@ -92,18 +91,18 @@ class F extends v {
|
|
|
92
91
|
return this.expireFileM(e, 1e3 * t, i);
|
|
93
92
|
}
|
|
94
93
|
expireFileM(e, t, i = this.currentDir) {
|
|
95
|
-
return
|
|
94
|
+
return E(this, e, t, "f", i);
|
|
96
95
|
}
|
|
97
96
|
expireDir(e, t, i = this.currentDir) {
|
|
98
97
|
return this.expireDirM(e, 1e3 * t, i);
|
|
99
98
|
}
|
|
100
99
|
expireDirM(e, t, i = this.currentDir) {
|
|
101
|
-
return
|
|
100
|
+
return E(this, e, t, "d", i);
|
|
102
101
|
}
|
|
103
102
|
expireContent(e, t, i, r = this.currentDir) {
|
|
104
103
|
h(e) && (e = o(e));
|
|
105
104
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
106
|
-
return
|
|
105
|
+
return F(this, this._action_expireContent, {
|
|
107
106
|
item: e,
|
|
108
107
|
expireInfoObj: t,
|
|
109
108
|
isMilliSecond: i
|
|
@@ -113,24 +112,24 @@ class F extends v {
|
|
|
113
112
|
return this.expireContent(e, t, !0, i);
|
|
114
113
|
}
|
|
115
114
|
removeFileExpire(e, t = !1, i = this.currentDir) {
|
|
116
|
-
return
|
|
115
|
+
return j(this, e, "f", t, i);
|
|
117
116
|
}
|
|
118
117
|
removeDirExpire(e, t = !1, i = this.currentDir) {
|
|
119
|
-
return
|
|
118
|
+
return j(this, e, "d", t, i);
|
|
120
119
|
}
|
|
121
120
|
removeContentExpire(e, t, i = !1, r = this.currentDir) {
|
|
122
121
|
h(e) && (e = o(e));
|
|
123
122
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
124
|
-
return
|
|
123
|
+
return F(this, this._action_removeContentExpire, {
|
|
125
124
|
item: e,
|
|
126
125
|
expireInfoObj: t,
|
|
127
126
|
infoFileOnly: i
|
|
128
127
|
});
|
|
129
128
|
}
|
|
130
129
|
createIndex(e, t, i = this.currentDir) {
|
|
131
|
-
h(e) && (e = o(e)),
|
|
130
|
+
h(e) && (e = o(e)), m(t) || (t = [ t ]);
|
|
132
131
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
133
|
-
return
|
|
132
|
+
return F(this, this._action_createIndex, {
|
|
134
133
|
item: e,
|
|
135
134
|
indexPropPathList: t
|
|
136
135
|
});
|
|
@@ -138,7 +137,7 @@ class F extends v {
|
|
|
138
137
|
createIndexFromQuery(e, t, i = this.currentDir) {
|
|
139
138
|
h(e) && (e = o(e));
|
|
140
139
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
141
|
-
return
|
|
140
|
+
return F(this, this._action_createIndex, {
|
|
142
141
|
item: e,
|
|
143
142
|
queryObj: t
|
|
144
143
|
});
|
|
@@ -146,7 +145,7 @@ class F extends v {
|
|
|
146
145
|
delIndex(e, t, i = this.currentDir) {
|
|
147
146
|
h(e) && (e = o(e));
|
|
148
147
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
149
|
-
return
|
|
148
|
+
return F(this, this._action_delIndex, {
|
|
150
149
|
item: e,
|
|
151
150
|
indexPropPath: t
|
|
152
151
|
});
|
|
@@ -154,23 +153,23 @@ class F extends v {
|
|
|
154
153
|
insert(e, t, i = !0, r = !1, n = this.currentDir) {
|
|
155
154
|
h(e) && (e = o(e));
|
|
156
155
|
e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
|
|
157
|
-
return t = i || d(t) ? t : structuredClone(t),
|
|
156
|
+
return t = i || d(t) ? t : structuredClone(t), F(this, this._action_insert, {
|
|
158
157
|
item: e,
|
|
159
158
|
content: t,
|
|
160
159
|
noCreate: r
|
|
161
160
|
});
|
|
162
161
|
}
|
|
163
162
|
insertEmbedding(e, t, i = this.currentDir) {
|
|
164
|
-
var r = this.qyCache, r = (
|
|
163
|
+
var r = this.qyCache, r = (f(t) || (t = new Float32Array(t)), h(e) && (e = o(e)),
|
|
165
164
|
r.getOrCreateFile(e, i));
|
|
166
|
-
return
|
|
165
|
+
return F(this, this._action_insertEmbedding, {
|
|
167
166
|
item: r,
|
|
168
167
|
embedding: t
|
|
169
168
|
});
|
|
170
169
|
}
|
|
171
170
|
delEmbedding(e, t = this.currentDir) {
|
|
172
171
|
var i = this.qyCache, i = (h(e) && (e = o(e)), i.getOrCreateFile(e, t));
|
|
173
|
-
return
|
|
172
|
+
return F(this, this._action_delEmbedding, {
|
|
174
173
|
item: i
|
|
175
174
|
});
|
|
176
175
|
}
|
|
@@ -180,14 +179,14 @@ class F extends v {
|
|
|
180
179
|
delContent(e, t = this.currentDir) {
|
|
181
180
|
h(e) && (e = o(e));
|
|
182
181
|
e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
|
|
183
|
-
return
|
|
182
|
+
return F(this, this._action_delContent, {
|
|
184
183
|
item: e
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
186
|
insertTrigger(e, t, i, r) {
|
|
188
187
|
h(t) && (t = o(t)), i = n(i);
|
|
189
188
|
e = this.qyCache.getOrCreateTriggerFile(e);
|
|
190
|
-
return
|
|
189
|
+
return F(this, this._action_insertTrigger, {
|
|
191
190
|
item: e,
|
|
192
191
|
fileNamePath: t,
|
|
193
192
|
propNamePathList: i,
|
|
@@ -195,19 +194,19 @@ class F extends v {
|
|
|
195
194
|
});
|
|
196
195
|
}
|
|
197
196
|
removeTrigger(e) {
|
|
198
|
-
return
|
|
197
|
+
return F(this, this._action_removeTrigger, {
|
|
199
198
|
item: this.qyCache.getOrCreateTriggerFile(e)
|
|
200
199
|
});
|
|
201
200
|
}
|
|
202
201
|
insertRpc(e, t) {
|
|
203
202
|
e = this.qyCache.getOrCreateRpcFile(e);
|
|
204
|
-
return
|
|
203
|
+
return F(this, this._action_insertRpc, {
|
|
205
204
|
item: e,
|
|
206
205
|
modCode: t
|
|
207
206
|
});
|
|
208
207
|
}
|
|
209
208
|
removeRpc(e) {
|
|
210
|
-
return
|
|
209
|
+
return F(this, this._action_removeRpc, {
|
|
211
210
|
item: this.qyCache.getOrCreateRpcFile(e)
|
|
212
211
|
});
|
|
213
212
|
}
|
|
@@ -310,13 +309,13 @@ ${r}
|
|
|
310
309
|
item: t,
|
|
311
310
|
indexPropPathList: e,
|
|
312
311
|
queryObj: i
|
|
313
|
-
} = t, r = this.qyCache.getOrCreateIndexDir(t), r = r.getOrCreateFile(
|
|
312
|
+
} = t, r = this.qyCache.getOrCreateIndexDir(t), r = r.getOrCreateFile(y), n = (r.created || this._action_createFile({
|
|
314
313
|
item: r
|
|
315
314
|
}), r).qyIndexPropTree, i = void 0 !== i ? n.insertFromQueryObj(i) : n.insertPropPathList(e);
|
|
316
315
|
if (0 !== i.length) {
|
|
317
316
|
var a, o = {};
|
|
318
|
-
for (a of i) o[
|
|
319
|
-
|
|
317
|
+
for (a of i) o[JSON.stringify(a.indexPropPath)] = 1;
|
|
318
|
+
v.log(`Creating index ${JSON.stringify(o)} for ` + t.fullPath), this._action_insert({
|
|
320
319
|
item: r,
|
|
321
320
|
content: o
|
|
322
321
|
});
|
|
@@ -346,16 +345,16 @@ ${r}
|
|
|
346
345
|
}
|
|
347
346
|
_action_delIndex(e) {
|
|
348
347
|
e.actionName = "delIndex";
|
|
349
|
-
var t,
|
|
348
|
+
var t, {
|
|
350
349
|
item: e,
|
|
351
|
-
indexPropPath:
|
|
350
|
+
indexPropPath: i
|
|
352
351
|
} = e, e = this.qyCache.getIndexDir(e);
|
|
353
|
-
void 0 !== e && ((
|
|
354
|
-
t.remove(r)), i && !t && void 0 !== r && (i = r.indexPropDir, void 0 !== i) && this._action_delDir({
|
|
355
|
-
item: i
|
|
356
|
-
})) : this._action_delDir({
|
|
352
|
+
void 0 !== e && (void 0 === (t = e.getFile(y)) ? this._action_delDir({
|
|
357
353
|
item: e
|
|
358
|
-
}))
|
|
354
|
+
}) : (e = t.qyIndexPropTree, [ t, e, i ] = (this._action_setProp(t, JSON.stringify(i), null),
|
|
355
|
+
e.removePropPath(i)), t && !e && void 0 !== i && (t = i.indexPropDir, void 0 !== t) && this._action_delDir({
|
|
356
|
+
item: t
|
|
357
|
+
})));
|
|
359
358
|
}
|
|
360
359
|
_action_delFile(e, t = !1) {
|
|
361
360
|
e.actionName = "delFile";
|
|
@@ -368,7 +367,7 @@ ${r}
|
|
|
368
367
|
parentDir: r,
|
|
369
368
|
name: n
|
|
370
369
|
} = i;
|
|
371
|
-
return i.created = !1,
|
|
370
|
+
return i.created = !1, O(this, e), t || P(this, r, p.R, r.fileMapKey, n),
|
|
372
371
|
!0;
|
|
373
372
|
}
|
|
374
373
|
_action_delDir(e) {
|
|
@@ -384,13 +383,13 @@ ${r}
|
|
|
384
383
|
fileMapKey: s
|
|
385
384
|
} = t;
|
|
386
385
|
if (a) {
|
|
387
|
-
|
|
386
|
+
P(this, t, p.D, s);
|
|
388
387
|
for (var h of t.fileList) this._action_delFile({
|
|
389
388
|
item: h
|
|
390
389
|
}, !0);
|
|
391
390
|
}
|
|
392
391
|
if (n) {
|
|
393
|
-
|
|
392
|
+
P(this, t, p.D, o);
|
|
394
393
|
for (var d of t.allSubdirs()) {
|
|
395
394
|
let {
|
|
396
395
|
subdirMap: e,
|
|
@@ -398,26 +397,26 @@ ${r}
|
|
|
398
397
|
subdirMapKey: i,
|
|
399
398
|
fileMapKey: r
|
|
400
399
|
} = d;
|
|
401
|
-
if (e &&
|
|
402
|
-
|
|
400
|
+
if (e && P(this, d, p.D, i), t) {
|
|
401
|
+
P(this, d, p.D, r);
|
|
403
402
|
for (var c of d.fileList) this._action_delFile({
|
|
404
403
|
item: c
|
|
405
404
|
}, !0);
|
|
406
405
|
}
|
|
407
|
-
|
|
406
|
+
O(this, {
|
|
408
407
|
actionName: "delDir",
|
|
409
408
|
item: d
|
|
410
409
|
}), d.created = !1;
|
|
411
410
|
}
|
|
412
411
|
}
|
|
413
|
-
return void 0 !== i && (t.created = !1,
|
|
412
|
+
return void 0 !== i && (t.created = !1, O(this, e), P(this, i, p.R, i.subdirMapKey, r),
|
|
414
413
|
!0);
|
|
415
414
|
}
|
|
416
415
|
_action_delContent(e) {
|
|
417
416
|
e.actionName = "delContent";
|
|
418
417
|
var t = e.item, i = t.fileContent;
|
|
419
418
|
return void 0 !== i && (t.fileContent = void 0, e.content = i, e.delta = [ i, null ],
|
|
420
|
-
|
|
419
|
+
O(this, e), P(this, t, p.D, t.fileContentKey), q(this, t, i), !0);
|
|
421
420
|
}
|
|
422
421
|
_action_insertEmbedding(e) {
|
|
423
422
|
e.actionName = "insertEmbedding";
|
|
@@ -427,7 +426,7 @@ ${r}
|
|
|
427
426
|
} = e, s = o.length, r = r.getOrCreateInfoFile(a), h = r.fileContent;
|
|
428
427
|
let d = !1;
|
|
429
428
|
return r.created && h.length === s ? (t = a.fullPathHash, h = h.idx, i = n.getEmbedding(t, s, h),
|
|
430
|
-
c(o, i) || ((i = n.updateEmbedding(t, o, h)) !== h && this.
|
|
429
|
+
c(o, i) || ((i = n.updateEmbedding(t, o, h)) !== h && this._action_setProp(r, "idx", i),
|
|
431
430
|
d = !0)) : ({
|
|
432
431
|
fullPathHash: t,
|
|
433
432
|
namePath: h
|
|
@@ -438,7 +437,7 @@ ${r}
|
|
|
438
437
|
idx: i,
|
|
439
438
|
namePath: r.created ? void 0 : h
|
|
440
439
|
}
|
|
441
|
-
}), d = !0), d &&
|
|
440
|
+
}), d = !0), d && O(this, e), d;
|
|
442
441
|
}
|
|
443
442
|
_action_delEmbedding(e) {
|
|
444
443
|
e.actionName = "delEmbedding";
|
|
@@ -448,7 +447,7 @@ ${r}
|
|
|
448
447
|
if (t && (o = t.fileContent, o) && (n = o.length, a = o.idx), i.delEmbedding(r.fullPathHash, n, a),
|
|
449
448
|
t) return this._action_delFile({
|
|
450
449
|
item: t
|
|
451
|
-
}),
|
|
450
|
+
}), O(this, e), !0;
|
|
452
451
|
}
|
|
453
452
|
_action_put(e) {
|
|
454
453
|
e.actionName = "put";
|
|
@@ -456,16 +455,16 @@ ${r}
|
|
|
456
455
|
item: t,
|
|
457
456
|
content: i
|
|
458
457
|
} = e;
|
|
459
|
-
if (void 0 === i) return
|
|
458
|
+
if (void 0 === i) return v.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
|
|
460
459
|
!1;
|
|
461
460
|
t.created || this._action_createFile({
|
|
462
461
|
item: t
|
|
463
462
|
});
|
|
464
463
|
var r = t.fileContentKey;
|
|
465
|
-
return i.$rpl = 1,
|
|
464
|
+
return i.$rpl = 1, P(this, t, p.M, r, i), O(this, e), t.fileContent = i,
|
|
466
465
|
!0;
|
|
467
466
|
}
|
|
468
|
-
|
|
467
|
+
_action_setProp(e, t, i) {
|
|
469
468
|
var {
|
|
470
469
|
created: r,
|
|
471
470
|
fileContentKey: n,
|
|
@@ -475,7 +474,7 @@ ${r}
|
|
|
475
474
|
}), a ? a[t] : void 0);
|
|
476
475
|
return null === i ? void 0 !== a && delete a[t] : void 0 !== a ? a[t] = i : e.fileContent = {
|
|
477
476
|
[t]: i
|
|
478
|
-
},
|
|
477
|
+
}, P(this, e, p.M, n, t, i), r;
|
|
479
478
|
}
|
|
480
479
|
_action_insert(e) {
|
|
481
480
|
e.actionName = "insert";
|
|
@@ -488,7 +487,7 @@ ${r}
|
|
|
488
487
|
merged: a,
|
|
489
488
|
delta: o
|
|
490
489
|
} = e;
|
|
491
|
-
if (void 0 === o && void 0 === r) return
|
|
490
|
+
if (void 0 === o && void 0 === r) return v.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
|
|
492
491
|
!1;
|
|
493
492
|
if (!i.created) {
|
|
494
493
|
if (n) return !1;
|
|
@@ -497,8 +496,8 @@ ${r}
|
|
|
497
496
|
});
|
|
498
497
|
}
|
|
499
498
|
return void 0 === a && void 0 === o && ([ a, o ] = s(i.fileContent, r)),
|
|
500
|
-
void 0 !== o && ([ n, r ] = o, t = i.fileContentKey, void 0 === a ?
|
|
501
|
-
e.merged = a, e.delta = o,
|
|
499
|
+
void 0 !== o && ([ n, r ] = o, t = i.fileContentKey, void 0 === a ? P(this, i, p.D, t) : P(this, i, p.M, t, r),
|
|
500
|
+
e.merged = a, e.delta = o, O(this, e), i.fileContent = a, q(this, i, n, r, a),
|
|
502
501
|
!0);
|
|
503
502
|
}
|
|
504
503
|
_action_createFile(e) {
|
|
@@ -506,7 +505,7 @@ ${r}
|
|
|
506
505
|
var t, i = e.item;
|
|
507
506
|
return !i.created && (t = i.parentDir, this._action_createDir({
|
|
508
507
|
item: t
|
|
509
|
-
}), i.created = !0, i.fileContentLoaded = !0,
|
|
508
|
+
}), i.created = !0, i.fileContentLoaded = !0, O(this, e), P(this, t, p.A, t.fileMapKey, i.name),
|
|
510
509
|
!0);
|
|
511
510
|
}
|
|
512
511
|
_action_createDir(e) {
|
|
@@ -515,12 +514,12 @@ ${r}
|
|
|
515
514
|
if (t.created) return !1;
|
|
516
515
|
for (var i = []; !t.created; ) i.push(t), t = t.parentDir;
|
|
517
516
|
for (let e of i.reverse()) {
|
|
518
|
-
e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0,
|
|
517
|
+
e.created = !0, e.subdirMapLoaded = !0, e.fileMapLoaded = !0, O(this, {
|
|
519
518
|
actionName: "createDir",
|
|
520
519
|
item: e
|
|
521
520
|
});
|
|
522
521
|
var r = e.parentDir;
|
|
523
|
-
|
|
522
|
+
P(this, r, p.A, r.subdirMapKey, e.name);
|
|
524
523
|
}
|
|
525
524
|
return !0;
|
|
526
525
|
}
|
|
@@ -533,7 +532,7 @@ ${r}
|
|
|
533
532
|
parentDir: r,
|
|
534
533
|
name: n
|
|
535
534
|
} = e;
|
|
536
|
-
return void 0 !== r && void 0 !== (i =
|
|
535
|
+
return void 0 !== r && void 0 !== (i = I(i, !0, l())) && (t = this.qyCache,
|
|
537
536
|
r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"), (r = this._action_insert({
|
|
538
537
|
item: r,
|
|
539
538
|
content: {
|
|
@@ -555,7 +554,7 @@ ${r}
|
|
|
555
554
|
content: {
|
|
556
555
|
[n]: null
|
|
557
556
|
}
|
|
558
|
-
})) && (
|
|
557
|
+
})) && (u(r.fileContent) && this._action_delFile({
|
|
559
558
|
item: r
|
|
560
559
|
}), void 0 === i) && t.unmonitorItemExpire(e), n);
|
|
561
560
|
}
|
|
@@ -565,8 +564,8 @@ ${r}
|
|
|
565
564
|
item: t,
|
|
566
565
|
expireInfoObj: i,
|
|
567
566
|
isMilliSecond: r
|
|
568
|
-
} = e, n =
|
|
569
|
-
var e =
|
|
567
|
+
} = e, n = l();
|
|
568
|
+
var e = b(i, e => I(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
|
|
570
569
|
item: o,
|
|
571
570
|
content: {
|
|
572
571
|
...e
|
|
@@ -581,22 +580,22 @@ ${r}
|
|
|
581
580
|
expireInfoObj: i,
|
|
582
581
|
infoFileOnly: r
|
|
583
582
|
} = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
|
|
584
|
-
return void 0 !== a && (i =
|
|
583
|
+
return void 0 !== a && (i = m(i) ? Object.fromEntries(i.map(e => [ e, null ])) : b(i, e => e ? null : void 0),
|
|
585
584
|
(t = this._action_insert({
|
|
586
585
|
item: a,
|
|
587
586
|
content: i
|
|
588
|
-
})) && (
|
|
587
|
+
})) && (u(a.fileContent, !0) && this._action_delFile({
|
|
589
588
|
item: a
|
|
590
589
|
}), r || n.unmonitorContentExpire(e, i)), t);
|
|
591
590
|
}
|
|
592
591
|
}
|
|
593
592
|
|
|
594
|
-
function
|
|
593
|
+
function F(e, t, i) {
|
|
595
594
|
return e.running ? t.call(e, i) : (i.actionFun = t, e.actionQueue.push(i)),
|
|
596
595
|
e;
|
|
597
596
|
}
|
|
598
597
|
|
|
599
|
-
function
|
|
598
|
+
function O(e, t) {
|
|
600
599
|
var {
|
|
601
600
|
changeList: e,
|
|
602
601
|
fileLogLevel: i
|
|
@@ -617,7 +616,7 @@ function P(e, t) {
|
|
|
617
616
|
})(t, i)), e.push(t);
|
|
618
617
|
}
|
|
619
618
|
|
|
620
|
-
function
|
|
619
|
+
function P(e, t, i, r, n = void 0, a = void 0) {
|
|
621
620
|
var {
|
|
622
621
|
qyAclCmdGenerator: e,
|
|
623
622
|
qyCache: o,
|
|
@@ -625,14 +624,14 @@ function q(e, t, i, r, n = void 0, a = void 0) {
|
|
|
625
624
|
changeId: h
|
|
626
625
|
} = e;
|
|
627
626
|
e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = h : r.startsWith("f") ? t.fChangeId = h : t.cChangeId = h,
|
|
628
|
-
o && o.qyKVData.removeKey(r) && s.push(r, t);
|
|
627
|
+
void 0 !== o && o.qyKVData.removeKey(r) && s.push(r, t);
|
|
629
628
|
}
|
|
630
629
|
|
|
631
|
-
function
|
|
630
|
+
function q(e, t, i, r = void 0, n = void 0) {
|
|
632
631
|
if (!t.underHiddenFolder) {
|
|
633
632
|
var a = e.qyCache.getIndexDir(t.parentDir);
|
|
634
633
|
if (void 0 !== a) {
|
|
635
|
-
a = a.getFile(
|
|
634
|
+
a = a.getFile(y);
|
|
636
635
|
if (void 0 !== a) {
|
|
637
636
|
var o, s, h = t.name;
|
|
638
637
|
for ({
|
|
@@ -649,9 +648,11 @@ function N(t, e, i, r, n, a, o = void 0) {
|
|
|
649
648
|
if (void 0 !== e) {
|
|
650
649
|
var s, h, [ i, n ] = e;
|
|
651
650
|
for (s of i) {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
651
|
+
var {
|
|
652
|
+
fileContent: d,
|
|
653
|
+
indexCount: c
|
|
654
|
+
} = s, l = t._action_setProp(s, r, null);
|
|
655
|
+
if (void 0 === d || u(d)) {
|
|
655
656
|
t._action_delFile({
|
|
656
657
|
item: s
|
|
657
658
|
});
|
|
@@ -659,13 +660,16 @@ function N(t, e, i, r, n, a, o = void 0) {
|
|
|
659
660
|
for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
|
|
660
661
|
item: e
|
|
661
662
|
}), e = e.parentDir;
|
|
662
|
-
}
|
|
663
|
+
} else void 0 !== l && (s.indexCount = c - 1);
|
|
664
|
+
}
|
|
665
|
+
for (h of n) {
|
|
666
|
+
var m = h.indexCount;
|
|
667
|
+
1 !== t._action_setProp(h, r, 1) && (h.indexCount = m + 1);
|
|
663
668
|
}
|
|
664
|
-
for (h of n) t._setProp(h, r, 1);
|
|
665
669
|
}
|
|
666
670
|
}
|
|
667
671
|
|
|
668
|
-
class
|
|
672
|
+
class L {
|
|
669
673
|
maxLength;
|
|
670
674
|
actionQueue;
|
|
671
675
|
nextPos;
|
|
@@ -693,37 +697,37 @@ class b {
|
|
|
693
697
|
}
|
|
694
698
|
}
|
|
695
699
|
|
|
696
|
-
function
|
|
700
|
+
function b(e, t = void 0, i = [], r = {}) {
|
|
697
701
|
if (d(e)) {
|
|
698
702
|
var n = t ? t(e) : e;
|
|
699
703
|
void 0 !== n && (r[JSON.stringify(i)] = n);
|
|
700
704
|
} else {
|
|
701
705
|
var a, o = i.length;
|
|
702
|
-
for (a in e) i.push(a),
|
|
706
|
+
for (a in e) i.push(a), b(e[a], t, i, r), i.length = o;
|
|
703
707
|
}
|
|
704
708
|
return r;
|
|
705
709
|
}
|
|
706
710
|
|
|
707
|
-
function
|
|
711
|
+
function I(e, t, i) {
|
|
708
712
|
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;
|
|
709
713
|
}
|
|
710
714
|
|
|
711
|
-
function
|
|
715
|
+
function E(e, t, i, r, n) {
|
|
712
716
|
var a = e.qyCache, r = (h(t) && (t = o(t)), "f" === r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
|
|
713
|
-
return
|
|
717
|
+
return F(e, e._action_expireItem, {
|
|
714
718
|
item: r,
|
|
715
719
|
milliSecond: i
|
|
716
720
|
});
|
|
717
721
|
}
|
|
718
722
|
|
|
719
|
-
function
|
|
723
|
+
function j(e, t, i, r, n) {
|
|
720
724
|
var a = e.qyCache, i = (h(t) && (t = o(t)), "f" === i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
|
|
721
|
-
return
|
|
725
|
+
return F(e, e._action_removeItemExpire, {
|
|
722
726
|
item: i,
|
|
723
727
|
infoFileOnly: r
|
|
724
728
|
});
|
|
725
729
|
}
|
|
726
730
|
|
|
727
731
|
export {
|
|
728
|
-
|
|
732
|
+
D as QyBatch
|
|
729
733
|
};
|
package/src/QyCache.js
CHANGED
|
@@ -126,16 +126,16 @@ class i extends r {
|
|
|
126
126
|
rootDir: s,
|
|
127
127
|
qyEmbeddings: n
|
|
128
128
|
} = this;
|
|
129
|
-
P.log(
|
|
129
|
+
P.log("Starting at " + r);
|
|
130
130
|
try {
|
|
131
|
-
await q(e)
|
|
131
|
+
await q(e);
|
|
132
132
|
var [ {
|
|
133
133
|
maxChangeId: l,
|
|
134
134
|
loadedMaxAclNum: g,
|
|
135
135
|
qySnapshots: h,
|
|
136
136
|
aclKeyValueMap: d
|
|
137
137
|
} ] = await Promise.all([ ((r, e) => (r = new b(r, e)).load())(e, t), x(a) ]);
|
|
138
|
-
i.start(l, g, h, d), await n.start();
|
|
138
|
+
o.start(), i.start(l, g, h, d), await n.start();
|
|
139
139
|
} catch (r) {
|
|
140
140
|
throw o.stop(), n.stop(), r;
|
|
141
141
|
}
|
package/src/QyDir.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class QyDir extends QyItem {
|
|
|
8
8
|
fileMapChangeCount: number;
|
|
9
9
|
dChangeId: number;
|
|
10
10
|
fChangeId: number;
|
|
11
|
-
|
|
11
|
+
valueCache: {};
|
|
12
12
|
constructor(name: string | number, created?: boolean, parentDir?: QyDir | undefined, qyCache?: QyCache | undefined);
|
|
13
13
|
get created(): boolean;
|
|
14
14
|
set created(val: boolean);
|