@k3000/store 1.7.0 → 1.9.0

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.
Files changed (58) hide show
  1. package/README.md +123 -1
  2. package/architect.mjs +54 -2
  3. package/generator.mjs +67 -55
  4. package/package.json +1 -1
  5. package/test/1/buffer/683 +1 -0
  6. package/test/1/buffer/684 +1 -0
  7. package/test/1/data +0 -0
  8. package/test/1/index +0 -0
  9. package/test/2/buffer/683 +1 -0
  10. package/test/2/buffer/684 +1 -0
  11. package/test/2/data +0 -0
  12. package/test/2/index +0 -0
  13. package/test/2/index.mjs +25 -25
  14. package/test/2/type.ts +33 -33
  15. package/test/3/buffer/683 +1 -0
  16. package/test/3/buffer/684 +1 -0
  17. package/test/3/data +0 -0
  18. package/test/3/index +0 -0
  19. package/test/3/index.mjs +26 -26
  20. package/test/3/type.ts +33 -33
  21. package/test/4/buffer/683 +1 -0
  22. package/test/4/buffer/684 +1 -0
  23. package/test/4/data +0 -0
  24. package/test/4/index +0 -0
  25. package/test/4/index.mjs +26 -26
  26. package/test/4/type.ts +33 -33
  27. package/test/5/buffer/683 +1 -0
  28. package/test/5/buffer/684 +1 -0
  29. package/test/5/data +0 -0
  30. package/test/5/index +0 -0
  31. package/test/5/index.mjs +26 -26
  32. package/test/5/type.ts +33 -33
  33. package/test/6/buffer/683 +1 -0
  34. package/test/6/buffer/684 +1 -0
  35. package/test/6/data +0 -0
  36. package/test/6/index +0 -0
  37. package/test/6/index.mjs +11 -11
  38. package/test/6/type.ts +23 -23
  39. package/test/7/buffer/683 +1 -0
  40. package/test/7/buffer/684 +1 -0
  41. package/test/7/data +0 -0
  42. package/test/7/index +0 -0
  43. package/test/7/index.mjs +12 -12
  44. package/test/7/type.ts +23 -23
  45. package/test/8/buffer/683 +1 -0
  46. package/test/8/buffer/684 +1 -0
  47. package/test/8/data +0 -0
  48. package/test/8/index +0 -0
  49. package/test/8/index.mjs +12 -12
  50. package/test/8/type.ts +23 -23
  51. package/test/9/buffer/683 +1 -0
  52. package/test/9/buffer/684 +1 -0
  53. package/test/9/data +0 -0
  54. package/test/9/index +0 -0
  55. package/test/9/index.mjs +390 -0
  56. package/test/9/type.ts +174 -0
  57. package/test/index.mjs +3 -3
  58. package/test.mjs +98 -10
package/test/4/type.ts CHANGED
@@ -5,22 +5,22 @@ interface Admin {
5
5
  *
6
6
  */
7
7
  id: Number
8
- /**
9
- * 账号
10
- */
11
- uid: String
12
8
  /**
13
9
  * 密码
14
10
  */
15
11
  pwd: String
16
- /**
17
- * 是否有效
18
- */
19
- valid: Number
20
12
  /**
21
13
  * 登录时间
22
14
  */
23
15
  time: Number | Date
16
+ /**
17
+ * 账号
18
+ */
19
+ uid: String
20
+ /**
21
+ * 是否有效
22
+ */
23
+ valid: Number
24
24
  }
25
25
 
26
26
  // @ts-ignore
@@ -58,26 +58,26 @@ interface AdminSet extends Array<Admin> {
58
58
 
59
59
  interface Log {
60
60
 
61
+ /**
62
+ * 内容
63
+ */
64
+ content: String
61
65
  /**
62
66
  *
63
67
  */
64
68
  id: Number
65
69
  /**
66
- * 账号
70
+ * 创建时间
67
71
  */
68
- uid: String
72
+ time: Number | Date
69
73
  /**
70
74
  * 类型
71
75
  */
72
76
  type: Number
73
77
  /**
74
- * 创建时间
75
- */
76
- time: Number | Date
77
- /**
78
- * 内容
78
+ * 账号
79
79
  */
80
- content: String
80
+ uid: String
81
81
  }
82
82
 
83
83
  // @ts-ignore
@@ -117,43 +117,43 @@ interface Test {
117
117
  /**
118
118
  *
119
119
  */
120
- id: Number
120
+ bigint: Number | BigInt
121
121
  /**
122
122
  *
123
123
  */
124
- uint: Number
124
+ bigUint: Number | BigInt
125
125
  /**
126
126
  *
127
127
  */
128
- int: Number
128
+ buffer: Buffer
129
129
  /**
130
130
  *
131
131
  */
132
- bigint: Number | BigInt
132
+ float: Number
133
133
  /**
134
134
  *
135
135
  */
136
- bigUint: Number | BigInt
136
+ id: Number
137
137
  /**
138
138
  *
139
139
  */
140
- time: Number | Date
140
+ int: Number
141
141
  /**
142
142
  *
143
143
  */
144
- float: Number
144
+ string: String
145
145
  /**
146
146
  *
147
147
  */
148
- string: String
148
+ text: String
149
149
  /**
150
150
  *
151
151
  */
152
- buffer: Buffer
152
+ time: Number | Date
153
153
  /**
154
154
  *
155
155
  */
156
- text: String
156
+ uint: Number
157
157
  }
158
158
 
159
159
  // @ts-ignore
@@ -189,14 +189,13 @@ interface TestSet extends Array<Test> {
189
189
  interface Test3 {
190
190
 
191
191
  /**
192
- *
193
- * 户
192
+ *
194
193
  */
195
- uid: String
194
+ pwd: String
196
195
  /**
197
196
  *
198
197
  */
199
- pwd: String
198
+ str: String
200
199
  /**
201
200
  *
202
201
  */
@@ -204,15 +203,16 @@ interface Test3 {
204
203
  /**
205
204
  *
206
205
  */
207
- str: String
206
+ test2: String
208
207
  /**
209
208
  *
210
209
  */
211
210
  test3: Number
212
211
  /**
213
- *
212
+ *
213
+ * 户
214
214
  */
215
- test2: String
215
+ uid: String
216
216
  }
217
217
 
218
218
  // @ts-ignore
@@ -0,0 +1 @@
1
+ abc
@@ -0,0 +1 @@
1
+ 你好😊
package/test/5/data CHANGED
Binary file
package/test/5/index CHANGED
Binary file
package/test/5/index.mjs CHANGED
@@ -5,25 +5,25 @@ import {struct} from '../../generator.mjs'
5
5
 
6
6
  const storage = new Storage(import.meta.url)
7
7
 
8
- const $id = 'id'
9
- const $uid = 'uid'
10
- const $pwd = 'pwd'
11
- const $valid = 'valid'
12
- const $time = 'time'
13
- const $type = 'type'
14
- const $content = 'content'
15
- const $uint = 'uint'
16
- const $int = 'int'
17
- const $bigint = 'bigint'
18
8
  const $bigUint = 'bigUint'
9
+ const $bigint = 'bigint'
10
+ const $buffer = 'buffer'
11
+ const $content = 'content'
19
12
  const $float = 'float'
13
+ const $id = 'id'
14
+ const $int = 'int'
15
+ const $pwd = 'pwd'
16
+ const $str = 'str'
20
17
  const $string = 'string'
21
- const $buffer = 'buffer'
22
- const $text = 'text'
23
18
  const $test = 'test'
24
- const $str = 'str'
25
- const $test3 = 'test3'
26
19
  const $test2 = 'test2'
20
+ const $test3 = 'test3'
21
+ const $text = 'text'
22
+ const $time = 'time'
23
+ const $type = 'type'
24
+ const $uid = 'uid'
25
+ const $uint = 'uint'
26
+ const $valid = 'valid'
27
27
 
28
28
  class Admin extends Entity {
29
29
 
@@ -173,18 +173,18 @@ class Test extends Entity {
173
173
  configurable: false,
174
174
  get: () => this[position],
175
175
  },
176
- bigUint: {
177
- enumerable: true,
178
- configurable: false,
179
- get: () => super.get($bigUint).readBigUInt64BE(0),
180
- set: value => super.set($bigUint, bigUint32BEToBuffer(value)),
181
- },
182
176
  bigint: {
183
177
  enumerable: true,
184
178
  configurable: false,
185
179
  get: () => super.get($bigint).readBigInt64BE(0),
186
180
  set: value => super.set($bigint, bigint32BEToBuffer(value)),
187
181
  },
182
+ bigUint: {
183
+ enumerable: true,
184
+ configurable: false,
185
+ get: () => super.get($bigUint).readBigUInt64BE(0),
186
+ set: value => super.set($bigUint, bigUint32BEToBuffer(value)),
187
+ },
188
188
  buffer: {
189
189
  enumerable: true,
190
190
  configurable: false,
@@ -336,21 +336,21 @@ class AdminSet extends Entities {
336
336
 
337
337
  indexById(id, id_2) {
338
338
 
339
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
339
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
340
340
 
341
341
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
342
342
  }
343
343
 
344
344
  indexByUid(uid, uid_2) {
345
345
 
346
- if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
346
+ if (uid_2 === undefined || uid == uid_2) return super.findByValue($uid, super.s2b(uid, $uid))
347
347
 
348
348
  return super.findByRange($uid, super.s2b(uid, $uid), super.s2b(uid_2, $uid))
349
349
  }
350
350
 
351
351
  indexByValid(valid, valid_2) {
352
352
 
353
- if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
353
+ if (valid_2 === undefined || valid == valid_2) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
354
354
 
355
355
  return super.findByRange($valid, super.uintToBuffer(valid, $valid), super.uintToBuffer(valid_2, $valid))
356
356
  }
@@ -404,14 +404,14 @@ class LogSet extends Entities {
404
404
 
405
405
  indexById(id, id_2) {
406
406
 
407
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
407
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
408
408
 
409
409
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
410
410
  }
411
411
 
412
412
  indexByUid(uid, uid_2) {
413
413
 
414
- if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
414
+ if (uid_2 === undefined || uid == uid_2) return super.findByValue($uid, super.s2b(uid, $uid))
415
415
 
416
416
  return super.findByRange($uid, super.s2b(uid, $uid), super.s2b(uid_2, $uid))
417
417
  }
@@ -465,7 +465,7 @@ class TestSet extends Entities {
465
465
 
466
466
  indexById(id, id_2) {
467
467
 
468
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
468
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
469
469
 
470
470
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
471
471
  }
package/test/5/type.ts CHANGED
@@ -5,22 +5,22 @@ interface Admin {
5
5
  *
6
6
  */
7
7
  id: Number
8
- /**
9
- * 账号
10
- */
11
- uid: String
12
8
  /**
13
9
  * 密码
14
10
  */
15
11
  pwd: String
16
- /**
17
- * 是否有效
18
- */
19
- valid: Number
20
12
  /**
21
13
  * 登录时间
22
14
  */
23
15
  time: Number | Date
16
+ /**
17
+ * 账号
18
+ */
19
+ uid: String
20
+ /**
21
+ * 是否有效
22
+ */
23
+ valid: Number
24
24
  }
25
25
 
26
26
  // @ts-ignore
@@ -58,26 +58,26 @@ interface AdminSet extends Array<Admin> {
58
58
 
59
59
  interface Log {
60
60
 
61
+ /**
62
+ * 内容
63
+ */
64
+ content: String
61
65
  /**
62
66
  *
63
67
  */
64
68
  id: Number
65
69
  /**
66
- * 账号
70
+ * 创建时间
67
71
  */
68
- uid: String
72
+ time: Number | Date
69
73
  /**
70
74
  * 类型
71
75
  */
72
76
  type: Number
73
77
  /**
74
- * 创建时间
75
- */
76
- time: Number | Date
77
- /**
78
- * 内容
78
+ * 账号
79
79
  */
80
- content: String
80
+ uid: String
81
81
  }
82
82
 
83
83
  // @ts-ignore
@@ -117,43 +117,43 @@ interface Test {
117
117
  /**
118
118
  *
119
119
  */
120
- id: Number
120
+ bigint: Number | BigInt
121
121
  /**
122
122
  *
123
123
  */
124
- uint: Number
124
+ bigUint: Number | BigInt
125
125
  /**
126
126
  *
127
127
  */
128
- int: Number
128
+ buffer: Buffer
129
129
  /**
130
130
  *
131
131
  */
132
- bigint: Number | BigInt
132
+ float: Number
133
133
  /**
134
134
  *
135
135
  */
136
- bigUint: Number | BigInt
136
+ id: Number
137
137
  /**
138
138
  *
139
139
  */
140
- time: Number | Date
140
+ int: Number
141
141
  /**
142
142
  *
143
143
  */
144
- float: Number
144
+ string: String
145
145
  /**
146
146
  *
147
147
  */
148
- string: String
148
+ text: String
149
149
  /**
150
150
  *
151
151
  */
152
- buffer: Buffer
152
+ time: Number | Date
153
153
  /**
154
154
  *
155
155
  */
156
- text: String
156
+ uint: Number
157
157
  }
158
158
 
159
159
  // @ts-ignore
@@ -189,14 +189,13 @@ interface TestSet extends Array<Test> {
189
189
  interface Test3 {
190
190
 
191
191
  /**
192
- *
193
- * 户
192
+ *
194
193
  */
195
- uid: String
194
+ pwd: String
196
195
  /**
197
196
  *
198
197
  */
199
- pwd: String
198
+ str: String
200
199
  /**
201
200
  *
202
201
  */
@@ -204,15 +203,16 @@ interface Test3 {
204
203
  /**
205
204
  *
206
205
  */
207
- str: String
206
+ test2: String
208
207
  /**
209
208
  *
210
209
  */
211
210
  test3: Number
212
211
  /**
213
- *
212
+ *
213
+ * 户
214
214
  */
215
- test2: String
215
+ uid: String
216
216
  }
217
217
 
218
218
  // @ts-ignore
@@ -0,0 +1 @@
1
+ abc
@@ -0,0 +1 @@
1
+ 你好😊
package/test/6/data CHANGED
Binary file
package/test/6/index CHANGED
Binary file
package/test/6/index.mjs CHANGED
@@ -5,16 +5,16 @@ import {struct} from '../../generator.mjs'
5
5
 
6
6
  const storage = new Storage(import.meta.url)
7
7
 
8
+ const $content = 'content'
8
9
  const $id = 'id'
9
- const $uid = 'uid'
10
10
  const $pwd = 'pwd'
11
- const $valid = 'valid'
12
- const $time = 'time'
13
- const $type = 'type'
14
- const $content = 'content'
15
- const $test = 'test'
16
11
  const $str = 'str'
12
+ const $test = 'test'
17
13
  const $test2 = 'test2'
14
+ const $time = 'time'
15
+ const $type = 'type'
16
+ const $uid = 'uid'
17
+ const $valid = 'valid'
18
18
 
19
19
  class Admin extends Entity {
20
20
 
@@ -237,21 +237,21 @@ class AdminSet extends Entities {
237
237
 
238
238
  indexById(id, id_2) {
239
239
 
240
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
240
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
241
241
 
242
242
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
243
243
  }
244
244
 
245
245
  indexByUid(uid, uid_2) {
246
246
 
247
- if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
247
+ if (uid_2 === undefined || uid == uid_2) return super.findByValue($uid, super.s2b(uid, $uid))
248
248
 
249
249
  return super.findByRange($uid, super.s2b(uid, $uid), super.s2b(uid_2, $uid))
250
250
  }
251
251
 
252
252
  indexByValid(valid, valid_2) {
253
253
 
254
- if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
254
+ if (valid_2 === undefined || valid == valid_2) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
255
255
 
256
256
  return super.findByRange($valid, super.uintToBuffer(valid, $valid), super.uintToBuffer(valid_2, $valid))
257
257
  }
@@ -305,14 +305,14 @@ class LogSet extends Entities {
305
305
 
306
306
  indexById(id, id_2) {
307
307
 
308
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
308
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
309
309
 
310
310
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
311
311
  }
312
312
 
313
313
  indexByUid(uid, uid_2) {
314
314
 
315
- if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
315
+ if (uid_2 === undefined || uid == uid_2) return super.findByValue($uid, super.s2b(uid, $uid))
316
316
 
317
317
  return super.findByRange($uid, super.s2b(uid, $uid), super.s2b(uid_2, $uid))
318
318
  }
package/test/6/type.ts CHANGED
@@ -5,22 +5,22 @@ interface Admin {
5
5
  *
6
6
  */
7
7
  id: Number
8
- /**
9
- * 账号
10
- */
11
- uid: String
12
8
  /**
13
9
  * 密码
14
10
  */
15
11
  pwd: String
16
- /**
17
- * 是否有效
18
- */
19
- valid: Number
20
12
  /**
21
13
  * 登录时间
22
14
  */
23
15
  time: Number | Date
16
+ /**
17
+ * 账号
18
+ */
19
+ uid: String
20
+ /**
21
+ * 是否有效
22
+ */
23
+ valid: Number
24
24
  }
25
25
 
26
26
  // @ts-ignore
@@ -58,26 +58,26 @@ interface AdminSet extends Array<Admin> {
58
58
 
59
59
  interface Log {
60
60
 
61
+ /**
62
+ * 内容
63
+ */
64
+ content: String
61
65
  /**
62
66
  *
63
67
  */
64
68
  id: Number
65
69
  /**
66
- * 账号
70
+ * 创建时间
67
71
  */
68
- uid: String
72
+ time: Number | Date
69
73
  /**
70
74
  * 类型
71
75
  */
72
76
  type: Number
73
77
  /**
74
- * 创建时间
75
- */
76
- time: Number | Date
77
- /**
78
- * 内容
78
+ * 账号
79
79
  */
80
- content: String
80
+ uid: String
81
81
  }
82
82
 
83
83
  // @ts-ignore
@@ -114,11 +114,6 @@ interface LogSet extends Array<Log> {
114
114
 
115
115
  interface Test3 {
116
116
 
117
- /**
118
- * 账
119
- * 户
120
- */
121
- uid: String
122
117
  /**
123
118
  *
124
119
  */
@@ -126,15 +121,20 @@ interface Test3 {
126
121
  /**
127
122
  *
128
123
  */
129
- test: String
124
+ str: String
130
125
  /**
131
126
  *
132
127
  */
133
- str: String
128
+ test: String
134
129
  /**
135
130
  *
136
131
  */
137
132
  test2: String
133
+ /**
134
+ * 账
135
+ * 户
136
+ */
137
+ uid: String
138
138
  }
139
139
 
140
140
  // @ts-ignore
@@ -0,0 +1 @@
1
+ abc
@@ -0,0 +1 @@
1
+ 你好😊
package/test/7/data CHANGED
Binary file
package/test/7/index CHANGED
Binary file
package/test/7/index.mjs CHANGED
@@ -5,16 +5,16 @@ import {struct} from '../../generator.mjs'
5
5
 
6
6
  const storage = new Storage(import.meta.url)
7
7
 
8
+ const $content = 'content'
8
9
  const $id = 'id'
9
- const $uid = 'uid'
10
10
  const $pwd = 'pwd'
11
- const $valid = 'valid'
12
- const $time = 'time'
13
- const $type = 'type'
14
- const $content = 'content'
15
- const $test = 'test'
16
11
  const $str = 'str'
12
+ const $test = 'test'
17
13
  const $test2 = 'test2'
14
+ const $time = 'time'
15
+ const $type = 'type'
16
+ const $uid = 'uid'
17
+ const $valid = 'valid'
18
18
 
19
19
  class Admin extends Entity {
20
20
 
@@ -237,21 +237,21 @@ class AdminSet extends Entities {
237
237
 
238
238
  indexById(id, id_2) {
239
239
 
240
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
240
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
241
241
 
242
242
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
243
243
  }
244
244
 
245
245
  indexByUid(uid, uid_2) {
246
246
 
247
- if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
247
+ if (uid_2 === undefined || uid == uid_2) return super.findByValue($uid, super.s2b(uid, $uid))
248
248
 
249
249
  return super.findByRange($uid, super.s2b(uid, $uid), super.s2b(uid_2, $uid))
250
250
  }
251
251
 
252
252
  indexByValid(valid, valid_2) {
253
253
 
254
- if (valid_2 === undefined) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
254
+ if (valid_2 === undefined || valid == valid_2) return super.findByValue($valid, super.uintToBuffer(valid, $valid))
255
255
 
256
256
  return super.findByRange($valid, super.uintToBuffer(valid, $valid), super.uintToBuffer(valid_2, $valid))
257
257
  }
@@ -305,21 +305,21 @@ class LogSet extends Entities {
305
305
 
306
306
  indexById(id, id_2) {
307
307
 
308
- if (id_2 === undefined) return super.findByValue($id, uInt32BEToBuffer(id, $id))
308
+ if (id_2 === undefined || id == id_2) return super.findByValue($id, uInt32BEToBuffer(id, $id))
309
309
 
310
310
  return super.findByRange($id, uInt32BEToBuffer(id, $id), uInt32BEToBuffer(id_2, $id))
311
311
  }
312
312
 
313
313
  indexByUid(uid, uid_2) {
314
314
 
315
- if (uid_2 === undefined) return super.findByValue($uid, super.s2b(uid, $uid))
315
+ if (uid_2 === undefined || uid == uid_2) return super.findByValue($uid, super.s2b(uid, $uid))
316
316
 
317
317
  return super.findByRange($uid, super.s2b(uid, $uid), super.s2b(uid_2, $uid))
318
318
  }
319
319
 
320
320
  indexByType(type, type_2) {
321
321
 
322
- if (type_2 === undefined) return super.findByValue($type, super.uintToBuffer(type, $type))
322
+ if (type_2 === undefined || type == type_2) return super.findByValue($type, super.uintToBuffer(type, $type))
323
323
 
324
324
  return super.findByRange($type, super.uintToBuffer(type, $type), super.uintToBuffer(type_2, $type))
325
325
  }