datafolder 1.0.16 → 1.0.18

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.
@@ -6,47 +6,49 @@ import {
6
6
 
7
7
  import {
8
8
  readdir as l,
9
- readFile as r
9
+ readFile as n
10
10
  } from "node:fs/promises";
11
11
 
12
12
  import {
13
- join as n
13
+ join as s
14
14
  } from "node:path";
15
15
 
16
- import d from "node:zlib";
16
+ import m from "node:zlib";
17
17
 
18
18
  import {
19
- getDefaultOptions as s
19
+ getDefaultOptions as r
20
20
  } from "./QyDefaultOptions.js";
21
21
 
22
22
  import {
23
- Hash_Key_Length as u,
24
- folderOrFileExists as m,
25
- listToMap as f,
23
+ Hash_Key_Length as f,
24
+ folderOrFileExists as d,
25
+ listToMap as u,
26
26
  isEmptyObj as h,
27
- isString as v
27
+ isString as v,
28
+ isArray as M,
29
+ isFloat32Array as y
28
30
  } from "./QyUtils.js";
29
31
 
30
32
  import {
31
- QyBinWriter as M
33
+ QyBinWriter as g
32
34
  } from "./QyBinWriter.js";
33
35
 
34
36
  import {
35
- bufferToNums as y,
36
- numsToBuffer as c,
37
- applyAclChange as g,
38
- iterCmdKeys as S
37
+ bufferToNums as c,
38
+ numsToBuffer as S,
39
+ applyAclChange as C,
40
+ iterCmdKeys as P
39
41
  } from "./QyAcl.js";
40
42
 
41
43
  import {
42
- QyJsonSaver as C
44
+ QyJsonSaver as x
43
45
  } from "./QyJsonSaver.js";
44
46
 
45
47
  import {
46
- logger as P
48
+ logger as F
47
49
  } from "./QyLogger.js";
48
50
 
49
- let x = Array.isArray, F = Buffer.from("\n"), L = Buffer.from("'"), O = Buffer.from("z"), j = L[0], J = O[0];
51
+ let D = Buffer.from("\n"), L = Buffer.from("'"), O = Buffer.from("z"), b = Buffer.from("vect"), E = L[0], J = O[0], K = b[0];
50
52
 
51
53
  class t {
52
54
  snapshotFolder;
@@ -60,329 +62,330 @@ class t {
60
62
  snapshotMaxChangeId = 0;
61
63
  maxSnapshotNum = 0;
62
64
  snapshotCount = 0;
63
- constructor(t, o = void 0) {
64
- (o = {
65
- ...s("QySnapshots"),
66
- ...o
67
- }).vLOutdatedPercent = 2 * o.pMOutdatedPercent;
68
- var a = n(t, "info");
65
+ constructor(t, a = void 0) {
66
+ (a = {
67
+ ...r("QySnapshots"),
68
+ ...a
69
+ }).vLOutdatedPercent = 2 * a.pMOutdatedPercent;
70
+ var o = s(t, "info");
69
71
  Object.assign(this, {
70
72
  snapshotFolder: t,
71
- snapshotInfoFolder: a,
72
- options: o,
73
- qyJsonSaver: new C(a, o)
73
+ snapshotInfoFolder: o,
74
+ options: a,
75
+ qyJsonSaver: new x(o, a)
74
76
  });
75
77
  }
76
78
  async loadSnapshotInfos() {
77
79
  let {
78
80
  snapshotInfoFolder: t,
79
- qyJsonSaver: s,
80
- numToSnapshotMap: r
81
+ qyJsonSaver: r,
82
+ numToSnapshotMap: n
81
83
  } = this;
82
- if (await m(t)) {
83
- var o = await (async (t, o) => {
84
- var a = {};
85
- for (s of await l(o)) {
86
- var e, n, s = /^([1-9][0-9]*)(_([0-9]+))*\.json/.exec(s);
87
- s && (e = +s[1], s = s[3], s = s ? +s : 2, null == (n = a[e]) ? a[e] = s : (t.removeFile(D(e, Math.min(n, s))),
88
- a[e] = Math.max(n, s)));
84
+ if (await d(t)) {
85
+ var a = await (async (t, a) => {
86
+ var o = {};
87
+ for (r of await l(a)) {
88
+ var e, s, r = /^([1-9][0-9]*)(_([0-9]+))*\.json/.exec(r);
89
+ r && (e = +r[1], r = r[3], r = r ? +r : 2, null == (s = o[e]) ? o[e] = r : (t.removeFile(_(e, Math.min(s, r))),
90
+ o[e] = Math.max(s, r)));
89
91
  }
90
- return Object.entries(a).map(([ t, o ]) => [ +t, o ]).sort((t, o) => t[0] - o[0]);
91
- })(s, t);
92
- let e = 0, n = 0;
93
- await Promise.all(o.map(async ([ t, o ]) => {
94
- var a = await s.loadFromFile(D(t, o)), o = (a.verList = [ o ], r[t] = {
92
+ return Object.entries(o).map(([ t, a ]) => [ +t, a ]).sort((t, a) => t[0] - a[0]);
93
+ })(r, t);
94
+ let e = 0, s = 0;
95
+ await Promise.all(a.map(async ([ t, a ]) => {
96
+ var o = await r.loadFromFile(_(t, a)), a = (o.verList = [ a ], n[t] = {
95
97
  snapshotNum: t,
96
- info: a,
98
+ info: o,
97
99
  posMap: {},
98
100
  outdatedCount: 0
99
- }), t = (++this.snapshotCount, t > e && (e = t, n = a.maxChangeId),
100
- this), a = o;
101
- t = N(t, a), P.info("Loading " + t), a.prefixPM = await b(t);
101
+ }), t = (++this.snapshotCount, t > e && (e = t, s = o.maxChangeId),
102
+ this), o = a;
103
+ t = N(t, o), F.info("Loading " + t), o.prefixPM = await V(t);
102
104
  })), Object.assign(this, {
103
105
  maxSnapshotNum: e,
104
- snapshotMaxChangeId: n
106
+ snapshotMaxChangeId: s
105
107
  });
106
108
  var {
107
- numToSnapshotMap: a,
109
+ numToSnapshotMap: o,
108
110
  prefixMap: i
109
111
  } = this;
110
- for ([ f ] of o) {
111
- var p, u = a[f], f = u.prefixPM;
112
- for (p in f) {
112
+ for ([ u ] of a) {
113
+ var p, f = o[u], u = f.prefixPM;
114
+ for (p in u) {
113
115
  var h = i[p];
114
- h ? h.push(u) : i[p] = [ u ];
116
+ h ? h.push(f) : i[p] = [ f ];
115
117
  }
116
118
  }
117
119
  }
118
120
  }
119
121
  closeAllFDs() {
120
- var t, o = this.fDMap;
121
- for (t in o) e(o[t]), delete o[t];
122
+ var t, a = this.fDMap;
123
+ for (t in a) e(a[t]), delete a[t];
122
124
  }
123
125
  saveKeyValueMap(t) {
124
- var o, a = this.options.minLenToCompress, {
126
+ var a, o = this.options.minLenToCompress, {
125
127
  keyValueMap: e,
126
- info: n
127
- } = t, s = (++n.vLVersion, new M()), r = (s.start(this.getVLFilePath(t)),
128
+ info: s
129
+ } = t, r = (++s.vLVersion, new g()), n = (r.start(this.getVLFilePath(t)),
128
130
  Object.keys(e).sort()), i = {};
129
- let p = 0, u = 0, f, h;
130
- for (o of r) {
131
- var l = e[o];
131
+ let p = 0, f = 0, u, h;
132
+ for (a of n) {
133
+ var l = e[a];
132
134
  let t;
133
- null == l ? t = K : (h = Buffer.isBuffer(l) ? (f = l, 0) : v(l) ? (f = l.length >= a ? (s.save(O),
134
- d.zstdCompressSync(l)) : (s.save(L), Buffer.from(l)), 1) : (f = Buffer.from(JSON.stringify(I(o) && !x(l) ? Object.keys(l) : l)),
135
- 0), s.save([ f, F ]), l = h + f.length, t = [ p, l ], p += l + 1), i[o] = t,
136
- ++u;
135
+ null == l ? t = A : (h = Buffer.isBuffer(l) ? (u = l, 0) : v(l) ? (u = l.length >= o ? (r.save(O),
136
+ m.zstdCompressSync(l)) : (r.save(L), Buffer.from(l)), 1) : y(l) ? (r.save(b),
137
+ u = Buffer.from(l.buffer, l.byteOffset, l.byteLength), 4) : (u = Buffer.from(JSON.stringify(I(a) && !M(l) ? Object.keys(l) : l)),
138
+ 0), r.save([ u, D ]), l = h + u.length, t = [ p, l ], p += l + 1), i[a] = t,
139
+ ++f;
137
140
  }
138
141
  return Object.assign(t, {
139
142
  posMap: i,
140
143
  outdatedCount: 0
141
- }), Object.assign(n, {
142
- totalCount: u,
144
+ }), Object.assign(s, {
145
+ totalCount: f,
143
146
  outdatedCount: 0
144
- }), Promise.all([ this.savePosMap(t, r), s.stop() ]);
147
+ }), Promise.all([ this.savePosMap(t, n), r.stop() ]);
145
148
  }
146
149
  addMaxSnapshot(t) {
147
- var o, {
148
- numToSnapshotMap: a,
150
+ var a, {
151
+ numToSnapshotMap: o,
149
152
  keyToSnapshotMap: e
150
153
  } = this, {
151
- posMap: n,
152
- keyValueMap: s,
153
- snapshotNum: r,
154
+ posMap: s,
155
+ keyValueMap: r,
156
+ snapshotNum: n,
154
157
  info: i
155
158
  } = t, i = i.maxChangeId, i = (Object.assign(this, {
156
- maxSnapshotNum: r,
159
+ maxSnapshotNum: n,
157
160
  snapshotMaxChangeId: i
158
- }), s || n);
159
- for (o in i) e[o] = t;
160
- a[r] = t, ++this.snapshotCount;
161
+ }), r || s);
162
+ for (a in i) e[a] = t;
163
+ o[n] = t, ++this.snapshotCount;
161
164
  }
162
165
  removeKey(t) {
163
- var o = this.keyToSnapshotMap, a = o[t];
164
- if (a) return this.removeKeyFromSnapshot(a, t), delete o[t], !0;
166
+ var a = this.keyToSnapshotMap, o = a[t];
167
+ if (o) return this.removeKeyFromSnapshot(o, t), delete a[t], !0;
165
168
  }
166
- applyCmdObj(t, o, a) {
167
- if (null != a) {
168
- var e = a.length;
169
+ applyCmdObj(t, a, o) {
170
+ if (null != o) {
171
+ var e = o.length;
169
172
  for (let t = 0; t < e; t += 2) {
170
- var n = a[t], s = a[t + 1];
171
- o[n] = null != s && I(n) ? f(s) : s;
173
+ var s = o[t], r = o[t + 1];
174
+ a[s] = null != r && I(s) ? u(r) : r;
172
175
  }
173
176
  }
174
- S(t, t => {
175
- t in o || (o[t] = this.getValueSync(t)), this.removeKey(t);
176
- }), g(o, t);
177
+ P(t, t => {
178
+ t in a || (a[t] = this.getValueSync(t)), this.removeKey(t);
179
+ }), C(a, t);
177
180
  }
178
181
  getValueSync(t) {
179
- var o = ((t, o) => {
182
+ var a = ((t, a) => {
180
183
  let {
181
- keyToSnapshotMap: a,
184
+ keyToSnapshotMap: o,
182
185
  prefixMap: e
183
- } = t, n = a[o];
184
- if (n) return n;
185
- var s = w(o), r = e[s];
186
- if (r) for (;0 < r.length; ) {
187
- n = r.pop();
188
- var i = ((t, o, a) => {
186
+ } = t, s = o[a];
187
+ if (s) return s;
188
+ var r = k(a), n = e[r];
189
+ if (n) for (;0 < n.length; ) {
190
+ s = n.pop();
191
+ var i = ((t, a, o) => {
189
192
  var e, {
190
- posMap: n,
191
- prefixPM: s
192
- } = o;
193
- if (s = s[a]) return [ s, e ] = s, s = T(t, t.getPMFilePath(o), s, e),
194
- t.loadPartialPosMapBuffer(o, a, s), n;
195
- })(t, n, s);
196
- if (i && o in i) return n;
193
+ posMap: s,
194
+ prefixPM: r
195
+ } = a;
196
+ if (r = r[o]) return [ r, e ] = r, r = B(t, t.getPMFilePath(a), r, e),
197
+ t.loadPartialPosMapBuffer(a, o, r), s;
198
+ })(t, s, r);
199
+ if (i && a in i) return s;
197
200
  }
198
201
  })(this, t);
199
- if (o) {
202
+ if (a) {
200
203
  var {
201
- keyValueMap: a,
204
+ keyValueMap: o,
202
205
  posMap: e
203
- } = o;
204
- if (a) return a[t];
205
- a = e[t];
206
- if (a) {
207
- var [ e, a ] = a;
208
- if (0 != a) {
209
- var n = this;
210
- if (o = n.getVLFilePath(o), n = T(n, o, e, a)) return (o = n[0]) == j ? n.toString("utf8", 1) : o == J ? d.zstdDecompressSync(n.subarray(1)).toString() : (e = JSON.parse(n),
211
- I(t) ? f(e) : e);
206
+ } = a;
207
+ if (o) return o[t];
208
+ o = e[t];
209
+ if (o) {
210
+ var [ e, o ] = o;
211
+ if (0 != o) {
212
+ var s = this;
213
+ if (a = s.getVLFilePath(a), s = B(s, a, e, o)) return (a = s[0]) == E ? s.toString("utf8", 1) : a == J ? m.zstdDecompressSync(s.subarray(1)).toString() : a == K ? new Float32Array(s.buffer, s.byteOffset + 4, s.byteLength / Float32Array.BYTES_PER_ELEMENT - 1) : (e = JSON.parse(s),
214
+ I(t) ? u(e) : e);
212
215
  }
213
216
  }
214
217
  }
215
218
  }
216
- loadPartialPosMapBuffer(a, t, o) {
219
+ loadPartialPosMapBuffer(o, t, a) {
217
220
  let {
218
221
  posMap: e,
219
- prefixPM: n
220
- } = a, s = (delete n[t], this).keyToSnapshotMap;
221
- V(o, (t, o) => {
222
- t in s ? ++a.outdatedCount : (e[t] = o, s[t] = a);
222
+ prefixPM: s
223
+ } = o, r = (delete s[t], this).keyToSnapshotMap;
224
+ j(a, (t, a) => {
225
+ t in r ? ++o.outdatedCount : (e[t] = a, r[t] = o);
223
226
  });
224
227
  }
225
228
  delSnapshot(t) {
226
- delete this.numToSnapshotMap[t.snapshotNum], --this.snapshotCount, o(this, this.getVLFilePath(t)),
227
- o(this, this.getPMFilePath(t));
229
+ delete this.numToSnapshotMap[t.snapshotNum], --this.snapshotCount, a(this, this.getVLFilePath(t)),
230
+ a(this, this.getPMFilePath(t));
228
231
  }
229
232
  calOutdates() {
230
- var t, o, a, e = [], n = [], s = [], r = [], {
233
+ var t, a, o, e = [], s = [], r = [], n = [], {
231
234
  options: i,
232
235
  numToSnapshotMap: p
233
236
  } = this, {
234
- pMOutdatedPercent: u,
235
- vLOutdatedPercent: f
237
+ pMOutdatedPercent: f,
238
+ vLOutdatedPercent: u
236
239
  } = i;
237
240
  for (t in p) {
238
241
  var h, l = p[t];
239
- l.isOut || (100 == (h = Q(l)) ? (this.delSnapshot(l), e.push([ t, l.info.verList[0] ])) : f < h ? (B(l) ? n : r).push(l) : Math.floor(l.outdatedCount / l.info.totalCount * 100) > u ? s.push(l) : (h = this,
240
- l.info.totalCount < h.options.minSnapshotKeyCount && B(l) && n.push(l)));
242
+ l.isOut || (100 == (h = Q(l)) ? (this.delSnapshot(l), e.push([ t, l.info.verList[0] ])) : u < h ? (T(l) ? s : n).push(l) : Math.floor(l.outdatedCount / l.info.totalCount * 100) > f ? r.push(l) : (h = this,
243
+ l.info.totalCount < h.options.minSnapshotKeyCount && T(l) && s.push(l)));
241
244
  }
242
- 1 == n.length && Q(n[0]) < f && (n.length = 0);
243
- for ([ o, a ] of [ [ "pMCompacts", s ], [ "vLCompacts", r ], [ "combiningSnapshots", n ] ]) 0 < a.length && P.log(o + ":" + a.map(t => t.snapshotNum + "." + t.info.verList[0]));
245
+ 1 == s.length && Q(s[0]) < u && (s.length = 0);
246
+ for ([ a, o ] of [ [ "pMCompacts", r ], [ "vLCompacts", n ], [ "combiningSnapshots", s ] ]) 0 < o.length && F.log(a + ":" + o.map(t => t.snapshotNum + "." + t.info.verList[0]));
244
247
  return {
245
248
  emptySnapshotNumVerList: e,
246
- combiningSnapshotList: n,
247
- pMCompactSnapshotList: s,
248
- vLCompactSnapshotList: r
249
+ combiningSnapshotList: s,
250
+ pMCompactSnapshotList: r,
251
+ vLCompactSnapshotList: n
249
252
  };
250
253
  }
251
254
  getMaxCombinedSnapshot(t) {
252
- let o, a;
255
+ let a, o;
253
256
  for (var e of t) {
254
- var n = e.snapshotNum;
255
- (!a || a < n) && (o = e, a = n);
257
+ var s = e.snapshotNum;
258
+ (!o || o < s) && (a = e, o = s);
256
259
  }
257
- return o;
260
+ return a;
258
261
  }
259
262
  getPMFilePath(t) {
260
263
  var {
261
264
  snapshotNum: t,
262
- info: o
265
+ info: a
263
266
  } = t;
264
- return n(this.snapshotFolder, "" + t, o.pMVersion + "_pM.txt");
267
+ return s(this.snapshotFolder, "" + t, a.pMVersion + "_pM.txt");
265
268
  }
266
269
  getVLFilePath(t) {
267
270
  var {
268
271
  snapshotNum: t,
269
- info: o
272
+ info: a
270
273
  } = t;
271
- return n(this.snapshotFolder, "" + t, o.vLVersion + "_vL.txt");
274
+ return s(this.snapshotFolder, "" + t, a.vLVersion + "_vL.txt");
272
275
  }
273
- async saveSnapshotInfo(t, o) {
274
- var a = this.qyJsonSaver, {
276
+ async saveSnapshotInfo(t, a) {
277
+ var o = this.qyJsonSaver, {
275
278
  pMVersion: e,
276
- vLVersion: n,
277
- verList: s,
278
- outdatedCount: r,
279
+ vLVersion: s,
280
+ verList: r,
281
+ outdatedCount: n,
279
282
  totalCount: i
280
- } = o, p = s[0], s = s[0] = e + n;
281
- return o.outdated = Math.floor(100 * r / i) + "%", P.log(`Saving snapshotInfo:${p ? t + `.${p}->` : ""}${t}.` + s),
282
- !!await a.saveToFile({
283
- ...o,
283
+ } = a, p = r[0], r = r[0] = e + s;
284
+ return a.outdated = Math.floor(100 * n / i) + "%", F.log(`Saving snapshotInfo:${p ? t + `.${p}->` : ""}${t}.` + r),
285
+ !!await o.saveToFile({
286
+ ...a,
284
287
  verList: void 0
285
- }, D(t, s), !0) && (null != p && a.removeFile(D(t, p)), !0);
288
+ }, _(t, r), !0) && (null != p && o.removeFile(_(t, p)), !0);
286
289
  }
287
- savePosMap(t, o) {
288
- var a, {
290
+ savePosMap(t, a) {
291
+ var o, {
289
292
  outdatedCount: e,
290
- info: n,
291
- posMap: s
292
- } = t, r = (n.outdatedCount += e, t.outdatedCount = 0, ++n.pMVersion, new M()), i = (r.start(this.getPMFilePath(t)),
293
+ info: s,
294
+ posMap: r
295
+ } = t, n = (s.outdatedCount += e, t.outdatedCount = 0, ++s.pMVersion, new g()), i = (n.start(this.getPMFilePath(t)),
293
296
  t.prefixPM = {});
294
- let p = 0, u = 0, f;
295
- for (a of o = o || Object.keys(s).sort()) {
296
- null == f ? f = w(a) : a.startsWith(f) || (i[f] = [ p, u ], f = w(a),
297
- p += u, u = 0);
298
- var h = Buffer.from(a), l = c(s[a]);
299
- r.save([ h, l ]), u += h.length + l.length;
297
+ let p = 0, f = 0, u;
298
+ for (o of a = a || Object.keys(r).sort()) {
299
+ null == u ? u = k(o) : o.startsWith(u) || (i[u] = [ p, f ], u = k(o),
300
+ p += f, f = 0);
301
+ var h = Buffer.from(o), l = S(r[o]);
302
+ n.save([ h, l ]), f += h.length + l.length;
300
303
  }
301
- return null != f && (i[f] = [ p, u ]), Promise.all([ r.stop(), ((t, o) => {
302
- var a, e = new M(), n = (e.start(N(t, o)), o).prefixPM;
303
- for (a in n) e.save([ Buffer.from(a), c(n[a]) ]);
304
+ return null != u && (i[u] = [ p, f ]), Promise.all([ n.stop(), ((t, a) => {
305
+ var o, e = new g(), s = (e.start(N(t, a)), a).prefixPM;
306
+ for (o in s) e.save([ Buffer.from(o), S(s[o]) ]);
304
307
  return e.stop();
305
308
  })(this, t) ]);
306
309
  }
307
310
  isEmptySnapshot(t) {
308
311
  var {
309
312
  info: t,
310
- outdatedCount: o
313
+ outdatedCount: a
311
314
  } = t;
312
- return o + t.outdatedCount == t.totalCount;
315
+ return a + t.outdatedCount == t.totalCount;
313
316
  }
314
- removeKeyFromSnapshot(t, o) {
317
+ removeKeyFromSnapshot(t, a) {
315
318
  var {
316
- posMap: a,
319
+ posMap: o,
317
320
  keyValueMap: e
318
321
  } = t;
319
- e && delete e[o], a && delete a[o], ++t.outdatedCount;
322
+ e && delete e[a], o && delete o[a], ++t.outdatedCount;
320
323
  }
321
324
  }
322
325
 
323
- function V(o, a) {
324
- var e = o.length;
326
+ function j(a, o) {
327
+ var e = a.length;
325
328
  for (let t = 0; t < e; ) {
326
- var n = t + u, s = o.toString("latin1", t, n), r = [];
327
- t = y(o, n, r), a(s, r);
329
+ var s = t + f, r = a.toString("latin1", t, s), n = [];
330
+ t = c(a, s, n), o(r, n);
328
331
  }
329
332
  }
330
333
 
331
- async function b(t) {
332
- var o = await r(t), a = o.length, e = {};
333
- for (let t = 0; t < a; ) {
334
- var n = t + k, s = e[o.toString("latin1", t, n)] = [];
335
- t = y(o, n, s);
334
+ async function V(t) {
335
+ var a = await n(t), o = a.length, e = {};
336
+ for (let t = 0; t < o; ) {
337
+ var s = t + w, r = e[a.toString("latin1", t, s)] = [];
338
+ t = c(a, s, r);
336
339
  }
337
340
  return e;
338
341
  }
339
342
 
340
- function T(t, o, a, e) {
341
- var n = ((t, o) => {
342
- let a = t.fDMap, e = a[o];
343
+ function B(t, a, o, e) {
344
+ var s = ((t, a) => {
345
+ let o = t.fDMap, e = o[a];
343
346
  if (!e) {
344
- P.info("Opening " + o);
347
+ F.info("Opening " + a);
345
348
  try {
346
- e = a[o] = p(o, "r");
349
+ e = o[a] = p(a, "r");
347
350
  } catch (t) {
348
- throw P.error(`Opening ${o} failed:`, t), t;
351
+ throw F.error(`Opening ${a} failed:`, t), t;
349
352
  }
350
353
  }
351
354
  return e;
352
- })(t, o), s = Buffer.allocUnsafe(e);
355
+ })(t, a), r = Buffer.allocUnsafe(e);
353
356
  for (let t = 0; t < e; ) {
354
- var r = i(n, s, t, e - t, a + t);
355
- if (0 == r) return void P.error(`readSync ${o} at ${a + t} returning 0 byte`);
356
- t += r;
357
+ var n = i(s, r, t, e - t, o + t);
358
+ if (0 == n) return void F.error(`readSync ${a} at ${o + t} returning 0 byte`);
359
+ t += n;
357
360
  }
358
- return s;
361
+ return r;
359
362
  }
360
363
 
361
- function B(t) {
364
+ function T(t) {
362
365
  var {
363
- keyValueMap: o,
364
- prefixPM: a
366
+ keyValueMap: a,
367
+ prefixPM: o
365
368
  } = t;
366
- return o || null == a || h(t.prefixPM);
369
+ return a || null == o || h(t.prefixPM);
367
370
  }
368
371
 
369
- function N(t, o) {
372
+ function N(t, a) {
370
373
  var {
371
- snapshotNum: o,
372
- info: a
373
- } = o;
374
- return n(t.snapshotFolder, "" + o, a.pMVersion + "_prefixPM.txt");
374
+ snapshotNum: a,
375
+ info: o
376
+ } = a;
377
+ return s(t.snapshotFolder, "" + a, o.pMVersion + "_prefixPM.txt");
375
378
  }
376
379
 
377
- function o(t, o) {
378
- var t = t.fDMap, a = t[o];
379
- null != a && (e(a), delete t[o]);
380
+ function a(t, a) {
381
+ var t = t.fDMap, o = t[a];
382
+ null != o && (e(o), delete t[a]);
380
383
  }
381
384
 
382
- let K = [ 0, 0 ], k = 3;
385
+ let A = [ 0, 0 ], w = 3;
383
386
 
384
- function w(t) {
385
- return t.substring(0, k);
387
+ function k(t) {
388
+ return t.substring(0, w);
386
389
  }
387
390
 
388
391
  function I(t) {
@@ -392,18 +395,18 @@ function I(t) {
392
395
  function Q(t) {
393
396
  var {
394
397
  outdatedCount: t,
395
- info: o
396
- } = t, a = o.totalCount, t = t + o.outdatedCount;
397
- return t == a ? 100 : Math.floor(t / a * 100);
398
+ info: a
399
+ } = t, o = a.totalCount, t = t + a.outdatedCount;
400
+ return t == o ? 100 : Math.floor(t / o * 100);
398
401
  }
399
402
 
400
- function D(t, o) {
401
- return t + (2 < o ? "_" + o : "") + ".json";
403
+ function _(t, a) {
404
+ return t + (2 < a ? "_" + a : "") + ".json";
402
405
  }
403
406
 
404
407
  export {
405
408
  t as QySnapshots,
406
- V as iterPMBuffer,
407
- b as loadPrefixPMFile,
408
- D as getInfoFileName
409
+ j as iterPMBuffer,
410
+ V as loadPrefixPMFile,
411
+ _ as getInfoFileName
409
412
  };
package/src/QyTrigger.js CHANGED
@@ -11,15 +11,14 @@ import {
11
11
  isEmptyObj as e,
12
12
  isMatchName as l,
13
13
  getMatchParam as d,
14
- propNameJoin as v
14
+ propNameJoin as v,
15
+ isArray as N
15
16
  } from "./QyUtils.js";
16
17
 
17
18
  import {
18
- logger as N
19
+ logger as y
19
20
  } from "./QyLogger.js";
20
21
 
21
- let y = Array.isArray;
22
-
23
22
  class f {
24
23
  name;
25
24
  parent;
@@ -99,7 +98,7 @@ class h {
99
98
  p(l, f) || (l = {
100
99
  oldValue: l,
101
100
  newValue: f
102
- }, (y(f) || y(c(n, t))) && (l.isArrayDelta = !0), (g = g || {
101
+ }, (N(f) || N(c(n, t))) && (l.isArrayDelta = !0), (g = g || {
103
102
  _file: e,
104
103
  _fileContent: n
105
104
  })[v(t)] = l, u(g, t, l));
@@ -116,7 +115,7 @@ class h {
116
115
  try {
117
116
  s && s(g), o.emit(a, g);
118
117
  } catch (e) {
119
- N.error(`Running trigger ${a} failed:`, g, e);
118
+ y.error(`Running trigger ${a} failed:`, g, e);
120
119
  }
121
120
  }
122
121
  }