lakutata 2.0.66 → 2.0.68
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/com/cacher.cjs +1 -1
- package/com/cacher.mjs +1 -1
- package/com/entrypoint.cjs +3 -1
- package/com/entrypoint.mjs +3 -1
- package/decorator/ctrl.cjs +3 -1
- package/decorator/ctrl.mjs +3 -1
- package/helper.cjs +24 -18
- package/helper.d.ts +128 -2
- package/helper.mjs +6 -2
- package/lakutata.cjs +3 -1
- package/lakutata.d.ts +1 -1
- package/lakutata.mjs +3 -1
- package/package.json +1 -1
- package/src/components/cacher/Cacher.cjs +1 -1
- package/src/components/cacher/Cacher.mjs +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +1 -1
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateMemcacheCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateMongoCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateMysqlCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreatePostgresCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateRedisCacheAdapter.mjs +2 -2
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.cjs +2 -2
- package/src/components/cacher/adapters/CreateSqliteCacheAdapter.mjs +2 -2
- package/src/components/entrypoint/Entrypoint.cjs +6 -1
- package/src/components/entrypoint/Entrypoint.mjs +6 -1
- package/src/decorators/ctrl/CLIAction.cjs +7 -5
- package/src/decorators/ctrl/CLIAction.mjs +3 -1
- package/src/decorators/ctrl/HTTPAction.cjs +8 -6
- package/src/decorators/ctrl/HTTPAction.mjs +3 -1
- package/src/decorators/ctrl/ServiceAction.cjs +3 -1
- package/src/decorators/ctrl/ServiceAction.mjs +7 -5
- package/src/decorators/ctrl/http/DELETE.cjs +3 -1
- package/src/decorators/ctrl/http/DELETE.mjs +3 -1
- package/src/decorators/ctrl/http/GET.cjs +3 -1
- package/src/decorators/ctrl/http/GET.mjs +3 -1
- package/src/decorators/ctrl/http/HEAD.cjs +3 -1
- package/src/decorators/ctrl/http/HEAD.mjs +3 -1
- package/src/decorators/ctrl/http/OPTIONS.cjs +3 -1
- package/src/decorators/ctrl/http/OPTIONS.mjs +3 -1
- package/src/decorators/ctrl/http/PATCH.cjs +3 -1
- package/src/decorators/ctrl/http/PATCH.mjs +3 -1
- package/src/decorators/ctrl/http/POST.cjs +3 -1
- package/src/decorators/ctrl/http/POST.mjs +3 -1
- package/src/decorators/ctrl/http/PUT.cjs +3 -1
- package/src/decorators/ctrl/http/PUT.mjs +3 -1
- package/src/lib/base/internal/ControllerEntrypoint.cjs +70 -610
- package/src/lib/base/internal/ControllerEntrypoint.mjs +87 -627
- package/src/lib/base/internal/StringifyPattern.cjs +1 -1
- package/src/lib/base/internal/StringifyPattern.mjs +1 -1
- package/src/lib/core/Application.cjs +3 -1
- package/src/lib/core/Application.mjs +3 -1
- package/src/lib/helpers/MD5.cjs +1 -1
- package/src/lib/helpers/MD5.mjs +1 -1
- package/src/lib/helpers/SHA1.cjs +1 -1
- package/src/lib/helpers/SHA1.mjs +1 -1
- package/src/lib/helpers/SHA256.cjs +1 -1
- package/src/lib/helpers/SHA256.mjs +1 -1
- package/src/lib/helpers/SortArray.cjs +1 -1
- package/src/lib/helpers/SortArray.mjs +1 -1
- package/src/lib/helpers/UUID.cjs +45 -0
- package/src/lib/helpers/UUID.mjs +39 -0
- package/vendor/Package.19.cjs +1 -1
- package/vendor/Package.19.mjs +176 -187
- package/vendor/Package.610.cjs +297 -113
- package/vendor/Package.610.mjs +285 -97
- package/vendor/Package.611.cjs +85 -103
- package/vendor/Package.611.mjs +80 -98
- package/vendor/Package.612.cjs +100 -121
- package/vendor/Package.612.mjs +97 -120
- package/vendor/Package.613.cjs +196 -0
- package/vendor/Package.613.mjs +180 -0
- package/vendor/Package.64.cjs +511 -134
- package/vendor/Package.64.mjs +491 -134
- package/vendor/Package.65.cjs +140 -4118
- package/vendor/Package.65.mjs +140 -4126
- package/vendor/Package.66.cjs +4142 -692
- package/vendor/Package.66.mjs +4151 -689
- package/vendor/Package.67.cjs +571 -535
- package/vendor/Package.67.mjs +586 -528
- package/vendor/Package.68.cjs +633 -96
- package/vendor/Package.68.mjs +619 -94
- package/vendor/Package.69.cjs +96 -294
- package/vendor/Package.69.mjs +95 -295
- package/vendor/TypeDef.internal.13.d.ts +1 -0
- package/vendor/TypeDef.internal.5.d.ts +1 -1
package/vendor/Package.69.cjs
CHANGED
|
@@ -6,336 +6,138 @@ Object.defineProperty(exports, Symbol.toStringTag, {
|
|
|
6
6
|
|
|
7
7
|
const e = require("events");
|
|
8
8
|
|
|
9
|
-
const t = require("
|
|
9
|
+
const t = require("memjs");
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const s = require("./Package.67.cjs");
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
require("buffer");
|
|
14
|
+
|
|
15
|
+
const r = e => e && e.__esModule ? e : {
|
|
14
16
|
default: e
|
|
15
17
|
};
|
|
16
18
|
|
|
17
|
-
const
|
|
19
|
+
const i = r(e);
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
const a = r(t);
|
|
20
22
|
|
|
21
|
-
var
|
|
22
|
-
ttlSupport=
|
|
23
|
-
opts;
|
|
24
|
-
connect;
|
|
23
|
+
var n = class extends i.default {
|
|
24
|
+
ttlSupport=true;
|
|
25
25
|
namespace;
|
|
26
|
+
client;
|
|
27
|
+
opts;
|
|
26
28
|
constructor(e, t) {
|
|
27
29
|
super();
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
if (e.uri) {
|
|
35
|
-
e = {
|
|
36
|
-
url: e.uri,
|
|
37
|
-
...e
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
this.opts = {
|
|
41
|
-
url: "mongodb://127.0.0.1:27017",
|
|
42
|
-
collection: "keyv",
|
|
43
|
-
...e,
|
|
30
|
+
t = {
|
|
31
|
+
...typeof e === "string" ? {
|
|
32
|
+
uri: e
|
|
33
|
+
} : e,
|
|
44
34
|
...t
|
|
45
35
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (this.opts.useGridFS) {
|
|
59
|
-
const t = new n.GridFSBucket(a, {
|
|
60
|
-
readPreference: this.opts.readPreference,
|
|
61
|
-
bucketName: this.opts.collection
|
|
62
|
-
});
|
|
63
|
-
const s = a.collection(`${this.opts.collection}.files`);
|
|
64
|
-
await s.createIndex({
|
|
65
|
-
uploadDate: -1
|
|
66
|
-
});
|
|
67
|
-
await s.createIndex({
|
|
68
|
-
"metadata.expiresAt": 1
|
|
69
|
-
});
|
|
70
|
-
await s.createIndex({
|
|
71
|
-
"metadata.lastAccessed": 1
|
|
72
|
-
});
|
|
73
|
-
await s.createIndex({
|
|
74
|
-
"metadata.filename": 1
|
|
75
|
-
});
|
|
76
|
-
e({
|
|
77
|
-
bucket: t,
|
|
78
|
-
store: s,
|
|
79
|
-
db: a,
|
|
80
|
-
mongoClient: o
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
let t = "keyv";
|
|
84
|
-
if (this.opts.collection) {
|
|
85
|
-
t = this.opts.collection;
|
|
86
|
-
}
|
|
87
|
-
const n = a.collection(t);
|
|
88
|
-
await n.createIndex({
|
|
89
|
-
key: 1
|
|
90
|
-
}, {
|
|
91
|
-
unique: true,
|
|
92
|
-
background: true
|
|
93
|
-
});
|
|
94
|
-
await n.createIndex({
|
|
95
|
-
expiresAt: 1
|
|
96
|
-
}, {
|
|
97
|
-
expireAfterSeconds: 0,
|
|
98
|
-
background: true
|
|
99
|
-
});
|
|
100
|
-
e({
|
|
101
|
-
store: n,
|
|
102
|
-
mongoClient: o
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
} catch (e) {
|
|
106
|
-
this.emit("error", e);
|
|
107
|
-
}
|
|
108
|
-
}));
|
|
36
|
+
if (t.uri && t.url === void 0) {
|
|
37
|
+
t.url = t.uri;
|
|
38
|
+
}
|
|
39
|
+
if (e === void 0) {
|
|
40
|
+
e = "localhost:11211";
|
|
41
|
+
t.url = t.uri = e;
|
|
42
|
+
}
|
|
43
|
+
this.opts = t;
|
|
44
|
+
this.client = a.default.Client.create(e, t);
|
|
45
|
+
}
|
|
46
|
+
_getNamespace() {
|
|
47
|
+
return `namespace:${this.namespace}`;
|
|
109
48
|
}
|
|
110
49
|
async get(e) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
50
|
+
return new Promise(((t, r) => {
|
|
51
|
+
this.client.get(this.formatKey(e), ((e, i) => {
|
|
52
|
+
if (e) {
|
|
53
|
+
this.emit("error", e);
|
|
54
|
+
r(e);
|
|
55
|
+
} else {
|
|
56
|
+
let e;
|
|
57
|
+
if (i === null) {
|
|
58
|
+
e = {
|
|
59
|
+
value: void 0,
|
|
60
|
+
expires: 0
|
|
61
|
+
};
|
|
62
|
+
} else {
|
|
63
|
+
e = this.opts.deserialize ? this.opts.deserialize(i) : s.defaultDeserialize(i);
|
|
64
|
+
}
|
|
65
|
+
t(e);
|
|
118
66
|
}
|
|
119
|
-
});
|
|
120
|
-
const s = n.bucket.openDownloadStreamByName(e);
|
|
121
|
-
return new Promise((e => {
|
|
122
|
-
const n = [];
|
|
123
|
-
s.on("error", (() => {
|
|
124
|
-
e(void 0);
|
|
125
|
-
}));
|
|
126
|
-
s.on("end", (() => {
|
|
127
|
-
const s = t.Buffer.concat(n).toString("utf8");
|
|
128
|
-
e(s);
|
|
129
|
-
}));
|
|
130
|
-
s.on("data", (e => {
|
|
131
|
-
n.push(e);
|
|
132
|
-
}));
|
|
133
67
|
}));
|
|
134
|
-
}
|
|
135
|
-
const s = await n.store.findOne({
|
|
136
|
-
key: {
|
|
137
|
-
$eq: e
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
if (!s) {
|
|
141
|
-
return void 0;
|
|
142
|
-
}
|
|
143
|
-
return s.value;
|
|
68
|
+
}));
|
|
144
69
|
}
|
|
145
70
|
async getMany(e) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
t.push(this.get(n));
|
|
150
|
-
}
|
|
151
|
-
const n = await Promise.allSettled(t);
|
|
152
|
-
const s = [];
|
|
153
|
-
for (const e of n) {
|
|
154
|
-
s.push(e.value);
|
|
155
|
-
}
|
|
156
|
-
return s;
|
|
71
|
+
const t = [];
|
|
72
|
+
for (const s of e) {
|
|
73
|
+
t.push(this.get(s));
|
|
157
74
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
75
|
+
return Promise.allSettled(t).then((e => {
|
|
76
|
+
const t = [];
|
|
77
|
+
for (const s of e) {
|
|
78
|
+
t.push(s.value);
|
|
162
79
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
value: 1,
|
|
166
|
-
key: 1
|
|
167
|
-
}).toArray();
|
|
168
|
-
const s = [ ...e ];
|
|
169
|
-
let o = 0;
|
|
170
|
-
for (const t of e) {
|
|
171
|
-
const e = n.findIndex((e => e.key === t));
|
|
172
|
-
s[o] = e > -1 ? n[e].value : void 0;
|
|
173
|
-
o++;
|
|
174
|
-
}
|
|
175
|
-
return s;
|
|
80
|
+
return t;
|
|
81
|
+
}));
|
|
176
82
|
}
|
|
177
|
-
async set(e, t,
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
const o = n.bucket.openUploadStream(e, {
|
|
182
|
-
metadata: {
|
|
183
|
-
expiresAt: s,
|
|
184
|
-
lastAccessed: new Date
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
return new Promise((e => {
|
|
188
|
-
o.on("finish", (() => {
|
|
189
|
-
e(o);
|
|
190
|
-
}));
|
|
191
|
-
o.end(t);
|
|
192
|
-
}));
|
|
83
|
+
async set(e, t, s) {
|
|
84
|
+
const r = {};
|
|
85
|
+
if (s !== void 0) {
|
|
86
|
+
r.expires = r.ttl = Math.floor(s / 1e3);
|
|
193
87
|
}
|
|
194
|
-
|
|
195
|
-
await o.store.updateOne({
|
|
196
|
-
key: {
|
|
197
|
-
$eq: e
|
|
198
|
-
}
|
|
199
|
-
}, {
|
|
200
|
-
$set: {
|
|
201
|
-
key: e,
|
|
202
|
-
value: t,
|
|
203
|
-
expiresAt: s
|
|
204
|
-
}
|
|
205
|
-
}, {
|
|
206
|
-
upsert: true
|
|
207
|
-
});
|
|
88
|
+
await this.client.set(this.formatKey(e), t, r);
|
|
208
89
|
}
|
|
209
90
|
async delete(e) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const a = await o.find({
|
|
221
|
-
filename: e
|
|
222
|
-
}).toArray();
|
|
223
|
-
await t.bucket.delete(a[0]._id);
|
|
224
|
-
return true;
|
|
225
|
-
} catch {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
const s = await t.store.deleteOne({
|
|
230
|
-
key: {
|
|
231
|
-
$eq: e
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
return s.deletedCount > 0;
|
|
91
|
+
return new Promise(((t, s) => {
|
|
92
|
+
this.client.delete(this.formatKey(e), ((e, r) => {
|
|
93
|
+
if (e) {
|
|
94
|
+
this.emit("error", e);
|
|
95
|
+
s(e);
|
|
96
|
+
} else {
|
|
97
|
+
t(Boolean(r));
|
|
98
|
+
}
|
|
99
|
+
}));
|
|
100
|
+
}));
|
|
235
101
|
}
|
|
236
102
|
async deleteMany(e) {
|
|
237
|
-
const t =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
const o = new n.GridFSBucket(s, {
|
|
241
|
-
bucketName: this.opts.collection
|
|
242
|
-
});
|
|
243
|
-
const a = await o.find({
|
|
244
|
-
filename: {
|
|
245
|
-
$in: e
|
|
246
|
-
}
|
|
247
|
-
}).toArray();
|
|
248
|
-
if (a.length === 0) {
|
|
249
|
-
return false;
|
|
250
|
-
}
|
|
251
|
-
await Promise.all(a.map((async e => t.bucket.delete(e._id))));
|
|
252
|
-
return true;
|
|
253
|
-
}
|
|
254
|
-
const s = await t.store.deleteMany({
|
|
255
|
-
key: {
|
|
256
|
-
$in: e
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
return s.deletedCount > 0;
|
|
103
|
+
const t = e.map((async e => this.delete(e)));
|
|
104
|
+
const s = await Promise.allSettled(t);
|
|
105
|
+
return s.every((e => e.value === true));
|
|
260
106
|
}
|
|
261
107
|
async clear() {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
await e.store.deleteMany({
|
|
273
|
-
key: {
|
|
274
|
-
$regex: this.namespace ? `^${this.namespace}:*` : ""
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
async clearExpired() {
|
|
279
|
-
if (!this.opts.useGridFS) {
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
return this.connect.then((async e => {
|
|
283
|
-
const t = e.db;
|
|
284
|
-
const s = new n.GridFSBucket(t, {
|
|
285
|
-
bucketName: this.opts.collection
|
|
286
|
-
});
|
|
287
|
-
return s.find({
|
|
288
|
-
"metadata.expiresAt": {
|
|
289
|
-
$lte: new Date(Date.now())
|
|
108
|
+
return new Promise(((e, t) => {
|
|
109
|
+
this.client.flush((s => {
|
|
110
|
+
if (s) {
|
|
111
|
+
this.emit("error", s);
|
|
112
|
+
t(s);
|
|
113
|
+
} else {
|
|
114
|
+
e(void 0);
|
|
290
115
|
}
|
|
291
|
-
})
|
|
116
|
+
}));
|
|
292
117
|
}));
|
|
293
118
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
119
|
+
formatKey(e) {
|
|
120
|
+
let t = e;
|
|
121
|
+
if (this.namespace) {
|
|
122
|
+
t = this.namespace.trim() + ":" + e.trim();
|
|
297
123
|
}
|
|
298
|
-
|
|
299
|
-
const s = t.db;
|
|
300
|
-
const o = new n.GridFSBucket(s, {
|
|
301
|
-
bucketName: this.opts.collection
|
|
302
|
-
});
|
|
303
|
-
const a = await o.find({
|
|
304
|
-
"metadata.lastAccessed": {
|
|
305
|
-
$lte: new Date(Date.now() - e * 1e3)
|
|
306
|
-
}
|
|
307
|
-
}).toArray();
|
|
308
|
-
await Promise.all(a.map((async e => t.bucket.delete(e._id))));
|
|
309
|
-
return true;
|
|
310
|
-
}
|
|
311
|
-
async* iterator(e) {
|
|
312
|
-
const t = await this.connect;
|
|
313
|
-
const n = new RegExp(`^${e ? e + ":" : ".*"}`);
|
|
314
|
-
const s = this.opts.useGridFS ? t.store.find({
|
|
315
|
-
filename: n
|
|
316
|
-
}).map((async e => [ e.filename, await this.get(e.filename) ])) : t.store.find({
|
|
317
|
-
key: n
|
|
318
|
-
}).map((e => [ e.key, e.value ]));
|
|
319
|
-
yield* s;
|
|
124
|
+
return t;
|
|
320
125
|
}
|
|
321
126
|
async has(e) {
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
async disconnect() {
|
|
332
|
-
const e = await this.connect;
|
|
333
|
-
await e.mongoClient.close();
|
|
127
|
+
return new Promise((t => {
|
|
128
|
+
this.client.get(this.formatKey(e), ((e, s) => {
|
|
129
|
+
if (e) {
|
|
130
|
+
t(false);
|
|
131
|
+
} else {
|
|
132
|
+
t(s !== null);
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
}));
|
|
334
136
|
}
|
|
335
137
|
};
|
|
336
138
|
|
|
337
|
-
var
|
|
139
|
+
var o = n;
|
|
338
140
|
|
|
339
|
-
exports.
|
|
141
|
+
exports.KeyvMemcache = n;
|
|
340
142
|
|
|
341
|
-
exports.default =
|
|
143
|
+
exports.default = o;
|