datafolder 1.0.27 → 1.0.29
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/scripts/airbnb.js +2 -2
- package/scripts/airbnb2.js +1 -1
- package/scripts/flights2.js +4 -4
- package/src/QyAcl.d.ts +4 -3
- package/src/QyAcl.js +92 -90
- package/src/QyBatch.d.ts +1 -2
- package/src/QyBatch.js +164 -185
- package/src/QyCache.js +24 -27
- package/src/QyDB.js +1 -1
- package/src/QyEmbeddings.js +42 -45
- package/src/QyExpire.js +19 -25
- package/src/QyFileContentUtils.d.ts +1 -3
- package/src/QyFileContentUtils.js +112 -162
- package/src/QySnapshots.js +1 -1
- package/src/QyUtils.d.ts +1 -1
- package/src/QyUtils.js +7 -4
- package/static/codemirror.bundle/editor.bundle.js +348 -178
- package/test/testQyGraphQL.js +1 -1
- package/test/testQyNorthwind.js +4 -4
package/src/QyBatch.js
CHANGED
|
@@ -3,60 +3,58 @@ import {
|
|
|
3
3
|
} from "node:util";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
mergeContentAndGenDelta as s
|
|
7
|
-
objToDelMarks as r
|
|
6
|
+
mergeContentAndGenDelta as s
|
|
8
7
|
} from "./QyFileContentUtils.js";
|
|
9
8
|
|
|
10
9
|
import {
|
|
11
10
|
pathSplit as o,
|
|
12
11
|
ensurePropNamePathList as n,
|
|
13
12
|
isString as l,
|
|
14
|
-
SpecialOperators as e,
|
|
15
13
|
getSuffix as g,
|
|
16
|
-
SpecialFilePaths as
|
|
14
|
+
SpecialFilePaths as e,
|
|
17
15
|
toSingleName as p,
|
|
18
16
|
isSimpleType as c,
|
|
19
|
-
isEmptyObj as
|
|
20
|
-
isNumber as
|
|
21
|
-
getNowRounded as
|
|
22
|
-
isDate as
|
|
23
|
-
isArray as
|
|
24
|
-
isFloat32Array as
|
|
17
|
+
isEmptyObj as d,
|
|
18
|
+
isNumber as r,
|
|
19
|
+
getNowRounded as m,
|
|
20
|
+
isDate as a,
|
|
21
|
+
isArray as u,
|
|
22
|
+
isFloat32Array as f
|
|
25
23
|
} from "./QyUtils.js";
|
|
26
24
|
|
|
27
25
|
import {
|
|
28
26
|
QyAclCmdGenerator as i,
|
|
29
|
-
CmdNames as
|
|
27
|
+
CmdNames as C
|
|
30
28
|
} from "./QyAcl.js";
|
|
31
29
|
|
|
32
30
|
import {
|
|
33
|
-
calDifferenceList as
|
|
31
|
+
calDifferenceList as _
|
|
34
32
|
} from "./QyIndex.js";
|
|
35
33
|
|
|
36
34
|
import {
|
|
37
|
-
getDefaultOptions as
|
|
35
|
+
getDefaultOptions as v
|
|
38
36
|
} from "./QyDefaultOptions.js";
|
|
39
37
|
|
|
40
38
|
import {
|
|
41
|
-
QyCD as
|
|
39
|
+
QyCD as t
|
|
42
40
|
} from "./QyCD.js";
|
|
43
41
|
|
|
44
42
|
import {
|
|
45
|
-
getPrefixPropPaths as
|
|
43
|
+
getPrefixPropPaths as y
|
|
46
44
|
} from "./QyIndexPropTree.js";
|
|
47
45
|
|
|
48
46
|
import {
|
|
49
|
-
logger as
|
|
47
|
+
logger as x
|
|
50
48
|
} from "./QyLogger.js";
|
|
51
49
|
|
|
52
|
-
let
|
|
50
|
+
let D = e.IndexPropPathsFileName, F = {
|
|
53
51
|
none: 0,
|
|
54
52
|
basic: 1,
|
|
55
53
|
delta: 2,
|
|
56
54
|
all: 3
|
|
57
55
|
};
|
|
58
56
|
|
|
59
|
-
class
|
|
57
|
+
class O extends t {
|
|
60
58
|
fileLogLevel;
|
|
61
59
|
actionQueue;
|
|
62
60
|
changeId;
|
|
@@ -67,37 +65,37 @@ class Q extends D {
|
|
|
67
65
|
running;
|
|
68
66
|
constructor(e, t) {
|
|
69
67
|
super(e), t = {
|
|
70
|
-
...
|
|
68
|
+
...v("QyBatch"),
|
|
71
69
|
...t
|
|
72
70
|
};
|
|
73
|
-
e =
|
|
71
|
+
e = F[t.fileLogLevel.toLowerCase()];
|
|
74
72
|
Object.assign(this, {
|
|
75
73
|
options: t,
|
|
76
74
|
fileLogLevel: e ?? 1,
|
|
77
75
|
qyAclCmdGenerator: new i(),
|
|
78
|
-
qyCmdObjHistory: new
|
|
76
|
+
qyCmdObjHistory: new I(t.maxHistoryCmdObjCount),
|
|
79
77
|
actionQueue: [],
|
|
80
78
|
changeList: [],
|
|
81
79
|
syncList: []
|
|
82
80
|
});
|
|
83
81
|
}
|
|
84
82
|
createDir(e, t = this.currentDir) {
|
|
85
|
-
return l(e) && (e = o(e)),
|
|
83
|
+
return l(e) && (e = o(e)), b(this, this._action_createDir, {
|
|
86
84
|
item: this.qyCache.getOrCreateDir(e, t)
|
|
87
85
|
});
|
|
88
86
|
}
|
|
89
87
|
delDir(e, t = this.currentDir) {
|
|
90
|
-
return l(e) && (e = o(e)),
|
|
88
|
+
return l(e) && (e = o(e)), b(this, this._action_delDir, {
|
|
91
89
|
item: this.qyCache.getOrCreateDir(e, t).ensureAllLoaded()
|
|
92
90
|
});
|
|
93
91
|
}
|
|
94
92
|
createFile(e, t = this.currentDir) {
|
|
95
|
-
return l(e) && (e = o(e)),
|
|
93
|
+
return l(e) && (e = o(e)), b(this, this._action_createFile, {
|
|
96
94
|
item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
97
|
delFile(e, t = this.currentDir) {
|
|
100
|
-
return l(e) && (e = o(e)),
|
|
98
|
+
return l(e) && (e = o(e)), b(this, this._action_delFile, {
|
|
101
99
|
item: this.qyCache.getOrCreateFile(e, t).ensureLoaded()
|
|
102
100
|
});
|
|
103
101
|
}
|
|
@@ -105,18 +103,18 @@ class Q extends D {
|
|
|
105
103
|
return this.expireFileM(e, 1e3 * t, i);
|
|
106
104
|
}
|
|
107
105
|
expireFileM(e, t, i = this.currentDir) {
|
|
108
|
-
return
|
|
106
|
+
return S(this, e, t, "f", i);
|
|
109
107
|
}
|
|
110
108
|
expireDir(e, t, i = this.currentDir) {
|
|
111
109
|
return this.expireDirM(e, 1e3 * t, i);
|
|
112
110
|
}
|
|
113
111
|
expireDirM(e, t, i = this.currentDir) {
|
|
114
|
-
return
|
|
112
|
+
return S(this, e, t, "d", i);
|
|
115
113
|
}
|
|
116
114
|
expireContent(e, t, i, r = this.currentDir) {
|
|
117
115
|
l(e) && (e = o(e));
|
|
118
116
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
119
|
-
return
|
|
117
|
+
return b(this, this._action_expireContent, {
|
|
120
118
|
item: e,
|
|
121
119
|
expireInfoObj: t,
|
|
122
120
|
isMilliSecond: i
|
|
@@ -126,24 +124,24 @@ class Q extends D {
|
|
|
126
124
|
return this.expireContent(e, t, !0, i);
|
|
127
125
|
}
|
|
128
126
|
removeFileExpire(e, t = !1, i = this.currentDir) {
|
|
129
|
-
return
|
|
127
|
+
return T(this, e, "f", t, i);
|
|
130
128
|
}
|
|
131
129
|
removeDirExpire(e, t = !1, i = this.currentDir) {
|
|
132
|
-
return
|
|
130
|
+
return T(this, e, "d", t, i);
|
|
133
131
|
}
|
|
134
132
|
removeContentExpire(e, t, i = !1, r = this.currentDir) {
|
|
135
133
|
l(e) && (e = o(e));
|
|
136
134
|
e = this.qyCache.getOrCreateFile(e, r).ensureLoaded();
|
|
137
|
-
return
|
|
135
|
+
return b(this, this._action_removeContentExpire, {
|
|
138
136
|
item: e,
|
|
139
137
|
expireInfoObj: t,
|
|
140
138
|
infoFileOnly: i
|
|
141
139
|
});
|
|
142
140
|
}
|
|
143
141
|
createIndex(e, t, i = this.currentDir) {
|
|
144
|
-
l(e) && (e = o(e)),
|
|
142
|
+
l(e) && (e = o(e)), u(t) || (t = [ t ]);
|
|
145
143
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
146
|
-
return
|
|
144
|
+
return b(this, this._action_createIndex, {
|
|
147
145
|
item: e,
|
|
148
146
|
indexPropPathList: t
|
|
149
147
|
});
|
|
@@ -151,59 +149,48 @@ class Q extends D {
|
|
|
151
149
|
delIndex(e, t, i = this.currentDir) {
|
|
152
150
|
l(e) && (e = o(e));
|
|
153
151
|
e = this.qyCache.getOrCreateDir(e, i);
|
|
154
|
-
return
|
|
152
|
+
return b(this, this._action_delIndex, {
|
|
155
153
|
item: e,
|
|
156
154
|
indexPropPath: t
|
|
157
155
|
});
|
|
158
156
|
}
|
|
159
|
-
insert(e, t, i = !
|
|
157
|
+
insert(e, t, i = !0, r = !1, n = this.currentDir) {
|
|
160
158
|
l(e) && (e = o(e));
|
|
161
159
|
e = this.qyCache.getOrCreateFile(e, n).ensureLoaded();
|
|
162
|
-
return t = i || c(t) ? t : structuredClone(t),
|
|
160
|
+
return t = i || c(t) ? t : structuredClone(t), b(this, this._action_insert, {
|
|
163
161
|
item: e,
|
|
164
162
|
content: t,
|
|
165
163
|
noCreate: r
|
|
166
164
|
});
|
|
167
165
|
}
|
|
168
166
|
insertEmbedding(e, t, i = this.currentDir) {
|
|
169
|
-
var r = this.qyCache, r = (
|
|
167
|
+
var r = this.qyCache, r = (f(t) || (t = new Float32Array(t)), l(e) && (e = o(e)),
|
|
170
168
|
r.getOrCreateFile(e, i));
|
|
171
|
-
return
|
|
169
|
+
return b(this, this._action_insertEmbedding, {
|
|
172
170
|
item: r,
|
|
173
171
|
embedding: t
|
|
174
172
|
});
|
|
175
173
|
}
|
|
176
174
|
delEmbedding(e, t = this.currentDir) {
|
|
177
175
|
var i = this.qyCache, i = (l(e) && (e = o(e)), i.getOrCreateFile(e, t));
|
|
178
|
-
return
|
|
176
|
+
return b(this, this._action_delEmbedding, {
|
|
179
177
|
item: i
|
|
180
178
|
});
|
|
181
179
|
}
|
|
182
|
-
insertWithEmbedding(e, t, i, r = !
|
|
180
|
+
insertWithEmbedding(e, t, i, r = !0, n = !1, a = this.currentDir) {
|
|
183
181
|
return this.insert(e, t, r, n, a), this.insertEmbedding(e, i, a);
|
|
184
182
|
}
|
|
185
|
-
remove(e, t, i = this.currentDir) {
|
|
186
|
-
return this.insert(e, r(t), !0, !0, i);
|
|
187
|
-
}
|
|
188
|
-
put(e, t, i = this.currentDir) {
|
|
189
|
-
l(e) && (e = o(e));
|
|
190
|
-
e = this.qyCache.getOrCreateFile(e, i).ensureLoaded();
|
|
191
|
-
return q(this, this._action_put, {
|
|
192
|
-
item: e,
|
|
193
|
-
content: t
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
183
|
delContent(e, t = this.currentDir) {
|
|
197
184
|
l(e) && (e = o(e));
|
|
198
185
|
e = this.qyCache.getOrCreateFile(e, t).ensureLoaded();
|
|
199
|
-
return
|
|
186
|
+
return b(this, this._action_delContent, {
|
|
200
187
|
item: e
|
|
201
188
|
});
|
|
202
189
|
}
|
|
203
190
|
insertTrigger(e, t, i, r) {
|
|
204
191
|
l(t) && (t = o(t)), i = n(i);
|
|
205
192
|
e = this.qyCache.getOrCreateTriggerFile(e);
|
|
206
|
-
return
|
|
193
|
+
return b(this, this._action_insertTrigger, {
|
|
207
194
|
item: e,
|
|
208
195
|
fileNamePath: t,
|
|
209
196
|
propNamePathList: i,
|
|
@@ -211,19 +198,19 @@ class Q extends D {
|
|
|
211
198
|
});
|
|
212
199
|
}
|
|
213
200
|
removeTrigger(e) {
|
|
214
|
-
return
|
|
201
|
+
return b(this, this._action_removeTrigger, {
|
|
215
202
|
item: this.qyCache.getOrCreateTriggerFile(e)
|
|
216
203
|
});
|
|
217
204
|
}
|
|
218
205
|
insertRpc(e, t) {
|
|
219
206
|
e = this.qyCache.getOrCreateRpcFile(e);
|
|
220
|
-
return
|
|
207
|
+
return b(this, this._action_insertRpc, {
|
|
221
208
|
item: e,
|
|
222
209
|
modCode: t
|
|
223
210
|
});
|
|
224
211
|
}
|
|
225
212
|
removeRpc(e) {
|
|
226
|
-
return
|
|
213
|
+
return b(this, this._action_removeRpc, {
|
|
227
214
|
item: this.qyCache.getOrCreateRpcFile(e)
|
|
228
215
|
});
|
|
229
216
|
}
|
|
@@ -277,30 +264,30 @@ ${r}
|
|
|
277
264
|
}
|
|
278
265
|
_action_insertTrigger(e) {
|
|
279
266
|
e.actionName = "insertTrigger";
|
|
280
|
-
var
|
|
267
|
+
var {
|
|
281
268
|
item: e,
|
|
282
|
-
fileNamePath:
|
|
283
|
-
propNamePathList:
|
|
284
|
-
modCode:
|
|
269
|
+
fileNamePath: t,
|
|
270
|
+
propNamePathList: i,
|
|
271
|
+
modCode: r
|
|
285
272
|
} = e, {
|
|
286
|
-
name:
|
|
287
|
-
fileContent:
|
|
288
|
-
} = e,
|
|
273
|
+
name: n,
|
|
274
|
+
fileContent: a
|
|
275
|
+
} = e, a = a && a[0], o = [ t, i ], e = (r && o.push(r), this._action_insert({
|
|
289
276
|
item: e,
|
|
290
|
-
content:
|
|
291
|
-
});
|
|
292
|
-
return e && (
|
|
293
|
-
|
|
277
|
+
content: o
|
|
278
|
+
}));
|
|
279
|
+
return e && (o = this.qyCache, a && !h(a, t) && o.removeTriggerFromTree(n, a),
|
|
280
|
+
o.insertTriggerToTree(n, t, i, r)), e;
|
|
294
281
|
}
|
|
295
282
|
_action_removeTrigger(e) {
|
|
296
283
|
e.actionName = "removeTrigger";
|
|
297
284
|
var e = e.item, {
|
|
298
285
|
fileContent: t,
|
|
299
286
|
name: i
|
|
300
|
-
} = e
|
|
301
|
-
return !!this._action_delFile({
|
|
287
|
+
} = e, e = this._action_delFile({
|
|
302
288
|
item: e
|
|
303
|
-
})
|
|
289
|
+
});
|
|
290
|
+
return e && this.qyCache.removeTriggerFromTree(i, t[0]), e;
|
|
304
291
|
}
|
|
305
292
|
_action_insertRpc(e) {
|
|
306
293
|
e.actionName = "insertRpc";
|
|
@@ -325,7 +312,7 @@ ${r}
|
|
|
325
312
|
var e, {
|
|
326
313
|
item: t,
|
|
327
314
|
indexPropPathList: i
|
|
328
|
-
} = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(
|
|
315
|
+
} = t, r = this.qyCache.getOrCreateIndexDir(t), n = r.getOrCreateFile(D), {
|
|
329
316
|
fileContent: a,
|
|
330
317
|
qyIndexPropTree: o
|
|
331
318
|
} = (n.created || this._action_createFile({
|
|
@@ -336,12 +323,12 @@ ${r}
|
|
|
336
323
|
a && a[c] || (s.push(e), l[c] = 1, o.insert(e));
|
|
337
324
|
}
|
|
338
325
|
if (0 != s.length) {
|
|
339
|
-
|
|
326
|
+
x.log(`Creating index ${JSON.stringify(s)} for ` + t.fullPath), this._action_insert({
|
|
340
327
|
item: n,
|
|
341
328
|
content: l
|
|
342
329
|
});
|
|
343
330
|
{
|
|
344
|
-
var h, d = this, m = t, u = r, i =
|
|
331
|
+
var h, d = this, m = t, u = r, i = y(s);
|
|
345
332
|
let e;
|
|
346
333
|
for (h of i) {
|
|
347
334
|
var f = u.searchOrCreateSubdir(h);
|
|
@@ -354,7 +341,7 @@ ${r}
|
|
|
354
341
|
fileContent: g,
|
|
355
342
|
name: C
|
|
356
343
|
} = g;
|
|
357
|
-
null != g &&
|
|
344
|
+
null != g && N(d, f, h, C, void 0, g);
|
|
358
345
|
}
|
|
359
346
|
}
|
|
360
347
|
}
|
|
@@ -367,12 +354,8 @@ ${r}
|
|
|
367
354
|
item: e,
|
|
368
355
|
indexPropPath: r
|
|
369
356
|
} = e, e = this.qyCache.getIndexDir(e);
|
|
370
|
-
e && ((i = e.getFile(
|
|
371
|
-
|
|
372
|
-
content: {
|
|
373
|
-
[p(r)]: O
|
|
374
|
-
}
|
|
375
|
-
}), t.remove(r).hasPrefix || (i = e.getSubdir(r)) && this._action_delDir({
|
|
357
|
+
e && ((i = e.getFile(D)) ? (t = i.qyIndexPropTree, this._setProp(i, p(r), null),
|
|
358
|
+
t.remove(r).hasPrefix || (i = e.getSubdir(r)) && this._action_delDir({
|
|
376
359
|
item: i
|
|
377
360
|
})) : this._action_delDir({
|
|
378
361
|
item: e
|
|
@@ -389,7 +372,7 @@ ${r}
|
|
|
389
372
|
parentDir: r,
|
|
390
373
|
name: n
|
|
391
374
|
} = i;
|
|
392
|
-
return i.created = !1,
|
|
375
|
+
return i.created = !1, P(this, e), t || L(this, r, C.R, r.fileMapKey, n),
|
|
393
376
|
!0;
|
|
394
377
|
}
|
|
395
378
|
_action_delDir(e) {
|
|
@@ -405,13 +388,13 @@ ${r}
|
|
|
405
388
|
fileMapKey: s
|
|
406
389
|
} = t;
|
|
407
390
|
if (a) {
|
|
408
|
-
|
|
391
|
+
L(this, t, C.D, s);
|
|
409
392
|
for (var l of t.fileList) this._action_delFile({
|
|
410
393
|
item: l
|
|
411
394
|
}, !0);
|
|
412
395
|
}
|
|
413
396
|
if (n) {
|
|
414
|
-
|
|
397
|
+
L(this, t, C.D, o);
|
|
415
398
|
for (var c of t.allSubdirs()) {
|
|
416
399
|
let {
|
|
417
400
|
subdirMap: e,
|
|
@@ -419,19 +402,19 @@ ${r}
|
|
|
419
402
|
subdirMapKey: i,
|
|
420
403
|
fileMapKey: r
|
|
421
404
|
} = c;
|
|
422
|
-
if (e &&
|
|
423
|
-
|
|
405
|
+
if (e && L(this, c, C.D, i), t) {
|
|
406
|
+
L(this, c, C.D, r);
|
|
424
407
|
for (var h of c.fileList) this._action_delFile({
|
|
425
408
|
item: h
|
|
426
409
|
}, !0);
|
|
427
410
|
}
|
|
428
|
-
|
|
411
|
+
P(this, {
|
|
429
412
|
actionName: "delDir",
|
|
430
413
|
item: c
|
|
431
414
|
}), c.created = !1;
|
|
432
415
|
}
|
|
433
416
|
}
|
|
434
|
-
return !!i && (t.created = !1,
|
|
417
|
+
return !!i && (t.created = !1, P(this, e), L(this, i, C.R, i.subdirMapKey, r),
|
|
435
418
|
!0);
|
|
436
419
|
}
|
|
437
420
|
_action_delContent(e) {
|
|
@@ -441,9 +424,9 @@ ${r}
|
|
|
441
424
|
content: i,
|
|
442
425
|
delta: {
|
|
443
426
|
oldValue: i,
|
|
444
|
-
newValue:
|
|
427
|
+
newValue: null
|
|
445
428
|
}
|
|
446
|
-
}),
|
|
429
|
+
}), P(this, e), L(this, t, C.D, t.fileContentKey), q(this, t, i), !0);
|
|
447
430
|
}
|
|
448
431
|
_action_insertEmbedding(e) {
|
|
449
432
|
e.actionName = "insertEmbedding";
|
|
@@ -453,12 +436,8 @@ ${r}
|
|
|
453
436
|
} = e, s = o.length, r = r.getOrCreateInfoFile(a), l = r.fileContent;
|
|
454
437
|
let c = !1;
|
|
455
438
|
return r.created && l.length == s ? (t = a.fullPathHash, l = l.idx, i = n.getEmbedding(t, s, l),
|
|
456
|
-
h(o, i) || ((i = n.updateEmbedding(t, o, l)) != l && this.
|
|
457
|
-
|
|
458
|
-
content: {
|
|
459
|
-
idx: i
|
|
460
|
-
}
|
|
461
|
-
}), c = !0)) : ({
|
|
439
|
+
h(o, i) || ((i = n.updateEmbedding(t, o, l)) != l && this._setProp(r, "idx", i),
|
|
440
|
+
c = !0)) : ({
|
|
462
441
|
fullPathHash: t,
|
|
463
442
|
namePath: l
|
|
464
443
|
} = a, i = n.addEmbedding(t, o), this._action_insert({
|
|
@@ -468,7 +447,7 @@ ${r}
|
|
|
468
447
|
idx: i,
|
|
469
448
|
namePath: r.created ? void 0 : l
|
|
470
449
|
}
|
|
471
|
-
}), c = !0), c &&
|
|
450
|
+
}), c = !0), c && P(this, e), c;
|
|
472
451
|
}
|
|
473
452
|
_action_delEmbedding(e) {
|
|
474
453
|
e.actionName = "delEmbedding";
|
|
@@ -478,7 +457,7 @@ ${r}
|
|
|
478
457
|
if (t && (o = t.fileContent, o) && (n = o.length, a = o.idx), i.delEmbedding(r.fullPathHash, n, a),
|
|
479
458
|
t) return this._action_delFile({
|
|
480
459
|
item: t
|
|
481
|
-
}),
|
|
460
|
+
}), P(this, e), !0;
|
|
482
461
|
}
|
|
483
462
|
_action_put(e) {
|
|
484
463
|
e.actionName = "put";
|
|
@@ -486,44 +465,55 @@ ${r}
|
|
|
486
465
|
item: t,
|
|
487
466
|
content: i
|
|
488
467
|
} = e;
|
|
489
|
-
if (null == i) return
|
|
468
|
+
if (null == i) return x.warn(`Saving undefined to ${t.fullPath}. Not making any change.`),
|
|
490
469
|
!1;
|
|
491
470
|
t.created || this._action_createFile({
|
|
492
471
|
item: t
|
|
493
472
|
});
|
|
473
|
+
var r = t.fileContentKey;
|
|
474
|
+
return i.$rpl = 1, L(this, t, C.M, r, i), P(this, e), t.fileContent = i,
|
|
475
|
+
!0;
|
|
476
|
+
}
|
|
477
|
+
_setProp(e, t, i) {
|
|
494
478
|
var {
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
}),
|
|
479
|
+
created: r,
|
|
480
|
+
fileContentKey: n,
|
|
481
|
+
fileContent: a
|
|
482
|
+
} = e, r = (r || this._action_createFile({
|
|
483
|
+
item: e
|
|
484
|
+
}), a ? a[t] : void 0);
|
|
485
|
+
return null === i ? null != a && delete a[t] : null != a ? a[t] = i : e.fileContent = {
|
|
486
|
+
[t]: i
|
|
487
|
+
}, L(this, e, C.M, n, t, i), r;
|
|
501
488
|
}
|
|
502
489
|
_action_insert(e) {
|
|
503
490
|
e.actionName = "insert";
|
|
504
|
-
var {
|
|
505
|
-
item:
|
|
506
|
-
content:
|
|
507
|
-
noCreate:
|
|
491
|
+
var t, {
|
|
492
|
+
item: i,
|
|
493
|
+
content: r,
|
|
494
|
+
noCreate: n
|
|
508
495
|
} = e;
|
|
509
|
-
|
|
496
|
+
let {
|
|
497
|
+
merged: a,
|
|
498
|
+
delta: o
|
|
499
|
+
} = e;
|
|
500
|
+
if (null == o && void 0 === r) return x.warn(`Saving undefined to ${i.fullPath}. Not making any change.`),
|
|
510
501
|
!1;
|
|
511
|
-
if (!
|
|
512
|
-
if (
|
|
502
|
+
if (!i.created) {
|
|
503
|
+
if (n) return !1;
|
|
513
504
|
this._action_createFile({
|
|
514
|
-
item:
|
|
505
|
+
item: i
|
|
515
506
|
});
|
|
516
507
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
} = r;
|
|
521
|
-
return !!o && ({
|
|
522
|
-
oldValue: o,
|
|
508
|
+
return null == a && null == o && (n = s(i.fileContent, r), a = n.merged,
|
|
509
|
+
o = n.delta), null != o && ({
|
|
510
|
+
oldValue: r,
|
|
523
511
|
newValue: n
|
|
524
|
-
} = o,
|
|
525
|
-
Object.assign(e,
|
|
526
|
-
|
|
512
|
+
} = o, t = i.fileContentKey, null == a ? L(this, i, C.D, t) : L(this, i, C.M, t, n),
|
|
513
|
+
Object.assign(e, {
|
|
514
|
+
merged: a,
|
|
515
|
+
delta: o
|
|
516
|
+
}), P(this, e), i.fileContent = a, q(this, i, r, n, a), !0);
|
|
527
517
|
}
|
|
528
518
|
_action_createFile(e) {
|
|
529
519
|
e.actionName = "createFile";
|
|
@@ -533,7 +523,7 @@ ${r}
|
|
|
533
523
|
}), Object.assign(i, {
|
|
534
524
|
created: !0,
|
|
535
525
|
fileContentLoaded: !0
|
|
536
|
-
}),
|
|
526
|
+
}), P(this, e), L(this, t, C.A, t.fileMapKey, i.name), !0);
|
|
537
527
|
}
|
|
538
528
|
_action_createDir(e) {
|
|
539
529
|
e.actionName = "createDir";
|
|
@@ -545,12 +535,12 @@ ${r}
|
|
|
545
535
|
created: !0,
|
|
546
536
|
subdirMapLoaded: !0,
|
|
547
537
|
fileMapLoaded: !0
|
|
548
|
-
}),
|
|
538
|
+
}), P(this, {
|
|
549
539
|
actionName: "createDir",
|
|
550
540
|
item: e
|
|
551
541
|
});
|
|
552
542
|
var r = e.parentDir;
|
|
553
|
-
|
|
543
|
+
L(this, r, C.A, r.subdirMapKey, e.name);
|
|
554
544
|
}
|
|
555
545
|
return !0;
|
|
556
546
|
}
|
|
@@ -563,7 +553,7 @@ ${r}
|
|
|
563
553
|
parentDir: r,
|
|
564
554
|
name: n
|
|
565
555
|
} = e;
|
|
566
|
-
return !!r && null != (i =
|
|
556
|
+
return !!r && null != (i = j(i, !0, m())) && (t = this.qyCache, r = t.getOrCreateExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"),
|
|
567
557
|
(r = this._action_insert({
|
|
568
558
|
item: r,
|
|
569
559
|
content: {
|
|
@@ -583,9 +573,9 @@ ${r}
|
|
|
583
573
|
return !!r && (t = this.qyCache, !!(r = t.getExpireInfoFile(r.fullPathHash, e.isFile ? "f" : "d"))) && ((n = this._action_insert({
|
|
584
574
|
item: r,
|
|
585
575
|
content: {
|
|
586
|
-
[n]:
|
|
576
|
+
[n]: null
|
|
587
577
|
}
|
|
588
|
-
})) && (
|
|
578
|
+
})) && (d(r.fileContent) && this._action_delFile({
|
|
589
579
|
item: r
|
|
590
580
|
}), i || t.unmonitorItemExpire(e)), n);
|
|
591
581
|
}
|
|
@@ -595,8 +585,8 @@ ${r}
|
|
|
595
585
|
item: t,
|
|
596
586
|
expireInfoObj: i,
|
|
597
587
|
isMilliSecond: r
|
|
598
|
-
} = e, n =
|
|
599
|
-
var e =
|
|
588
|
+
} = e, n = m();
|
|
589
|
+
var e = E(i, e => j(e, r, n)), a = this.qyCache, o = a.getOrCreateExpireInfoFile(t.fullPathHash, "c"), o = this._action_insert({
|
|
600
590
|
item: o,
|
|
601
591
|
content: {
|
|
602
592
|
...e
|
|
@@ -611,22 +601,22 @@ ${r}
|
|
|
611
601
|
expireInfoObj: i,
|
|
612
602
|
infoFileOnly: r
|
|
613
603
|
} = e, n = this.qyCache, a = n.getExpireInfoFile(e.fullPathHash, "c");
|
|
614
|
-
return !!a && (i =
|
|
604
|
+
return !!a && (i = u(i) ? Object.fromEntries(i.map(e => [ e, null ])) : E(i, e => e ? null : void 0),
|
|
615
605
|
(t = this._action_insert({
|
|
616
606
|
item: a,
|
|
617
607
|
content: i
|
|
618
|
-
})) && (
|
|
608
|
+
})) && (d(a.fileContent, !0) && this._action_delFile({
|
|
619
609
|
item: a
|
|
620
610
|
}), r || n.unmonitorContentExpire(e, i)), t);
|
|
621
611
|
}
|
|
622
612
|
}
|
|
623
613
|
|
|
624
|
-
function
|
|
614
|
+
function b(e, t, i) {
|
|
625
615
|
return e.running ? t.call(e, i) : (i.actionFun = t, e.actionQueue.push(i)),
|
|
626
616
|
e;
|
|
627
617
|
}
|
|
628
618
|
|
|
629
|
-
function
|
|
619
|
+
function P(e, t) {
|
|
630
620
|
var {
|
|
631
621
|
changeList: e,
|
|
632
622
|
fileLogLevel: i
|
|
@@ -650,66 +640,55 @@ function N(e, t) {
|
|
|
650
640
|
})(t, i)), e.push(t);
|
|
651
641
|
}
|
|
652
642
|
|
|
653
|
-
function
|
|
643
|
+
function L(e, t, i, r, n = void 0, a = void 0) {
|
|
654
644
|
var {
|
|
655
645
|
qyAclCmdGenerator: e,
|
|
656
|
-
qyCache:
|
|
657
|
-
syncList:
|
|
658
|
-
changeId:
|
|
646
|
+
qyCache: o,
|
|
647
|
+
syncList: s,
|
|
648
|
+
changeId: l
|
|
659
649
|
} = e;
|
|
660
|
-
e.pushCmd(i, r, n), r.startsWith("d") ? t.dChangeId =
|
|
661
|
-
|
|
650
|
+
e.pushCmd(i, r, n, a), r.startsWith("d") ? t.dChangeId = l : r.startsWith("f") ? t.fChangeId = l : t.cChangeId = l,
|
|
651
|
+
o && o.qyKVData.removeKey(r) && s.push(r, t);
|
|
662
652
|
}
|
|
663
653
|
|
|
664
|
-
function
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
t = s.getFile(b);
|
|
674
|
-
if (t) for (var l of t.qyIndexPropTree.getAllIndexPropPaths()) E(e, s.searchOrCreateSubdir(l), l, a, i, r, n);
|
|
654
|
+
function q(e, t, i, r = void 0, n = void 0) {
|
|
655
|
+
if (!t.underHiddenFolder) {
|
|
656
|
+
var a = e.qyCache.getIndexDir(t.parentDir);
|
|
657
|
+
if (a) {
|
|
658
|
+
var o = a.getFile(D);
|
|
659
|
+
if (o) {
|
|
660
|
+
var s, l = t.name;
|
|
661
|
+
for (s of o.qyIndexPropTree.getAllIndexPropPaths()) N(e, a.searchOrCreateSubdir(s), s, l, i, r, n);
|
|
662
|
+
}
|
|
675
663
|
}
|
|
676
664
|
}
|
|
677
665
|
}
|
|
678
666
|
|
|
679
|
-
function
|
|
680
|
-
e =
|
|
667
|
+
function N(t, e, i, r, n, a, o = void 0) {
|
|
668
|
+
e = _(e, i, n, a, o);
|
|
681
669
|
if (e) {
|
|
682
670
|
var s, l, c, {
|
|
683
671
|
toAddFileList: i,
|
|
684
672
|
toDelFileList: n
|
|
685
673
|
} = e;
|
|
686
|
-
for (s of i)
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
for (c of n) if (m(c.fileContent)) {
|
|
701
|
-
t._action_delFile({
|
|
702
|
-
item: c
|
|
703
|
-
});
|
|
704
|
-
let e = c.parentDir;
|
|
705
|
-
for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
|
|
706
|
-
item: e
|
|
707
|
-
}), e = e.parentDir;
|
|
674
|
+
for (s of i) t._setProp(s, r, 1);
|
|
675
|
+
for (l of n) l.created && t._setProp(l, r, null);
|
|
676
|
+
for (c of n) if (c.created) {
|
|
677
|
+
var h = c.fileContent;
|
|
678
|
+
if (null == h || d(h)) {
|
|
679
|
+
t._action_delFile({
|
|
680
|
+
item: c
|
|
681
|
+
});
|
|
682
|
+
let e = c.parentDir;
|
|
683
|
+
for (;e.created && !e.isHiddenFolder && e.isEmpty; ) t._action_delDir({
|
|
684
|
+
item: e
|
|
685
|
+
}), e = e.parentDir;
|
|
686
|
+
}
|
|
708
687
|
}
|
|
709
688
|
}
|
|
710
689
|
}
|
|
711
690
|
|
|
712
|
-
class
|
|
691
|
+
class I {
|
|
713
692
|
maxLength;
|
|
714
693
|
actionQueue;
|
|
715
694
|
nextPos;
|
|
@@ -737,37 +716,37 @@ class A {
|
|
|
737
716
|
}
|
|
738
717
|
}
|
|
739
718
|
|
|
740
|
-
function
|
|
719
|
+
function E(e, t = void 0, i = [], r = {}) {
|
|
741
720
|
if (c(e)) {
|
|
742
721
|
var n = t ? t(e) : e;
|
|
743
|
-
|
|
722
|
+
void 0 !== n && (r[JSON.stringify(i)] = n);
|
|
744
723
|
} else {
|
|
745
724
|
var a, o = i.length;
|
|
746
|
-
for (a in e) i.push(a),
|
|
725
|
+
for (a in e) i.push(a), E(e[a], t, i, r), i.length = o;
|
|
747
726
|
}
|
|
748
727
|
return r;
|
|
749
728
|
}
|
|
750
729
|
|
|
751
|
-
function
|
|
752
|
-
return
|
|
730
|
+
function j(e, t, i) {
|
|
731
|
+
return r(e) ? (t ? e : 1e3 * e) + i : l(e) ? (t = new Date(e).getTime(), isNaN(t) || t <= i ? void 0 : t) : !a(e) || (t = e.getTime()) <= i ? void 0 : t;
|
|
753
732
|
}
|
|
754
733
|
|
|
755
|
-
function
|
|
734
|
+
function S(e, t, i, r, n) {
|
|
756
735
|
var a = e.qyCache, r = (l(t) && (t = o(t)), "f" == r ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
|
|
757
|
-
return
|
|
736
|
+
return b(e, e._action_expireItem, {
|
|
758
737
|
item: r,
|
|
759
738
|
milliSecond: i
|
|
760
739
|
});
|
|
761
740
|
}
|
|
762
741
|
|
|
763
|
-
function
|
|
742
|
+
function T(e, t, i, r, n) {
|
|
764
743
|
var a = e.qyCache, i = (l(t) && (t = o(t)), "f" == i ? a.getOrCreateFile(t, n) : a.getOrCreateDir(t, n));
|
|
765
|
-
return
|
|
744
|
+
return b(e, e._action_removeItemExpire, {
|
|
766
745
|
item: i,
|
|
767
746
|
infoFileOnly: r
|
|
768
747
|
});
|
|
769
748
|
}
|
|
770
749
|
|
|
771
750
|
export {
|
|
772
|
-
|
|
751
|
+
O as QyBatch
|
|
773
752
|
};
|