lakutata 2.0.54 → 2.0.56
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.d.ts +1 -1
- package/com/cacher.mjs +1 -1
- package/com/docker.d.ts +1 -1
- package/com/entrypoint.cjs +29 -11
- package/com/entrypoint.d.ts +11 -182
- package/com/entrypoint.mjs +12 -0
- package/decorator/asst.d.ts +1 -1
- package/decorator/ctrl.cjs +15 -5
- package/decorator/ctrl.d.ts +112 -10
- package/decorator/ctrl.mjs +11 -1
- package/decorator/di.d.ts +2 -2
- package/decorator/dto.d.ts +3 -3
- package/decorator/orm.d.ts +1 -1
- package/helper.cjs +13 -11
- package/helper.d.ts +1 -1
- package/helper.mjs +3 -1
- package/lakutata.cjs +18 -6
- package/lakutata.d.ts +7 -8
- package/lakutata.mjs +12 -0
- package/orm.d.ts +1 -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 +1074 -973
- package/src/components/entrypoint/Entrypoint.mjs +884 -781
- package/src/components/entrypoint/exceptions/AccessDenyException.cjs +35 -0
- package/src/components/entrypoint/exceptions/AccessDenyException.mjs +29 -0
- package/src/components/entrypoint/exceptions/DuplicateActionNameException.cjs +34 -0
- package/src/components/entrypoint/exceptions/DuplicateActionNameException.mjs +28 -0
- package/src/components/entrypoint/lib/AccessControl.cjs +247 -0
- package/src/components/entrypoint/lib/AccessControl.mjs +241 -0
- package/src/components/entrypoint/lib/AccessControlRule.cjs +163 -0
- package/src/components/entrypoint/lib/AccessControlRule.mjs +157 -0
- package/src/decorators/ctrl/CLIAction.cjs +17 -10
- package/src/decorators/ctrl/CLIAction.mjs +17 -10
- package/src/decorators/ctrl/HTTPAction.cjs +18 -11
- package/src/decorators/ctrl/HTTPAction.mjs +16 -9
- package/src/decorators/ctrl/ServiceAction.cjs +15 -8
- package/src/decorators/ctrl/ServiceAction.mjs +16 -9
- package/src/decorators/ctrl/http/DELETE.cjs +13 -3
- package/src/decorators/ctrl/http/DELETE.mjs +13 -3
- package/src/decorators/ctrl/http/GET.cjs +13 -3
- package/src/decorators/ctrl/http/GET.mjs +13 -3
- package/src/decorators/ctrl/http/HEAD.cjs +13 -3
- package/src/decorators/ctrl/http/HEAD.mjs +13 -3
- package/src/decorators/ctrl/http/OPTIONS.cjs +13 -3
- package/src/decorators/ctrl/http/OPTIONS.mjs +13 -3
- package/src/decorators/ctrl/http/PATCH.cjs +13 -3
- package/src/decorators/ctrl/http/PATCH.mjs +13 -3
- package/src/decorators/ctrl/http/POST.cjs +13 -3
- package/src/decorators/ctrl/http/POST.mjs +13 -3
- package/src/decorators/ctrl/http/PUT.cjs +13 -3
- package/src/decorators/ctrl/http/PUT.mjs +13 -3
- package/src/lib/base/internal/ActionOptions.cjs +79 -0
- package/src/lib/base/internal/ActionOptions.mjs +73 -0
- package/src/lib/base/internal/ControllerEntrypoint.cjs +625 -53
- package/src/lib/base/internal/ControllerEntrypoint.mjs +640 -68
- package/src/lib/base/internal/GetActionDTOAndOptions.cjs +89 -0
- package/src/lib/base/internal/GetActionDTOAndOptions.mjs +83 -0
- package/src/lib/base/internal/StringifyPattern.cjs +69 -0
- package/src/lib/base/internal/StringifyPattern.mjs +63 -0
- package/src/lib/core/Application.cjs +29 -17
- package/src/lib/core/Application.mjs +33 -21
- 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 +18 -201
- package/src/lib/helpers/SortArray.mjs +17 -200
- package/vendor/Package.19.cjs +85 -90
- package/vendor/Package.19.mjs +1 -1
- package/vendor/Package.3.cjs +1 -1
- package/vendor/Package.3.mjs +1 -1
- package/vendor/Package.610.cjs +85 -103
- package/vendor/Package.610.mjs +80 -98
- package/vendor/Package.611.cjs +100 -121
- package/vendor/Package.611.mjs +97 -120
- package/vendor/Package.612.cjs +196 -0
- package/vendor/Package.612.mjs +180 -0
- package/vendor/Package.64.cjs +140 -4118
- package/vendor/Package.64.mjs +140 -4126
- package/vendor/Package.65.cjs +4142 -692
- package/vendor/Package.65.mjs +4151 -689
- package/vendor/Package.66.cjs +571 -535
- package/vendor/Package.66.mjs +586 -528
- package/vendor/Package.67.cjs +633 -96
- package/vendor/Package.67.mjs +619 -94
- package/vendor/Package.68.cjs +96 -294
- package/vendor/Package.68.mjs +95 -295
- package/vendor/Package.69.cjs +297 -113
- package/vendor/Package.69.mjs +285 -97
- package/vendor/TypeDef.10.d.ts +13 -2
- package/vendor/TypeDef.11.d.ts +6 -5
- package/vendor/TypeDef.12.d.ts +104 -4
- package/vendor/TypeDef.13.d.ts +315 -62
- package/vendor/TypeDef.3.d.ts +2 -2
- package/vendor/TypeDef.5.d.ts +1 -1
- package/vendor/TypeDef.7.d.ts +19 -10
- package/vendor/TypeDef.8.d.ts +2 -20
- package/vendor/TypeDef.9.d.ts +5 -2
- package/vendor/TypeDef.14.d.ts +0 -72
package/vendor/Package.69.mjs
CHANGED
|
@@ -1,139 +1,327 @@
|
|
|
1
1
|
import t from "events";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Buffer as e } from "buffer";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { MongoClient as n, GridFSBucket as s, MongoServerError as a } from "mongodb";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
var o = new Set([ "url", "collection", "namespace", "serialize", "deserialize", "uri", "useGridFS", "dialect", "db" ]);
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var i = t => String(t).search(/^[a-zA-Z]+$/) < 0 ? "_" + t : t;
|
|
12
|
-
|
|
13
|
-
var n = class extends t {
|
|
14
|
-
ttlSupport;
|
|
9
|
+
var i = class extends t {
|
|
10
|
+
ttlSupport=false;
|
|
15
11
|
opts;
|
|
12
|
+
connect;
|
|
16
13
|
namespace;
|
|
17
|
-
|
|
18
|
-
query;
|
|
19
|
-
constructor(t) {
|
|
14
|
+
constructor(t, e) {
|
|
20
15
|
super();
|
|
21
|
-
|
|
22
|
-
let s = {
|
|
23
|
-
dialect: "sqlite",
|
|
24
|
-
uri: "sqlite://:memory:"
|
|
25
|
-
};
|
|
16
|
+
t ??= {};
|
|
26
17
|
if (typeof t === "string") {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
t = {
|
|
19
|
+
url: t
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (t.uri) {
|
|
23
|
+
t = {
|
|
24
|
+
url: t.uri,
|
|
31
25
|
...t
|
|
32
26
|
};
|
|
33
27
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
this.opts = {
|
|
29
|
+
url: "mongodb://127.0.0.1:27017",
|
|
30
|
+
collection: "keyv",
|
|
31
|
+
...t,
|
|
32
|
+
...e
|
|
33
|
+
};
|
|
34
|
+
delete this.opts.emitErrors;
|
|
35
|
+
const a = Object.fromEntries(Object.entries(this.opts).filter((([t]) => !o.has(t))));
|
|
36
|
+
this.opts = Object.fromEntries(Object.entries(this.opts).filter((([t]) => o.has(t))));
|
|
37
|
+
this.connect = new Promise((async (t, e) => {
|
|
38
|
+
try {
|
|
39
|
+
let e = "";
|
|
40
|
+
if (this.opts.url) {
|
|
41
|
+
e = this.opts.url;
|
|
42
|
+
}
|
|
43
|
+
const o = new n(e, a);
|
|
44
|
+
await o.connect();
|
|
45
|
+
const i = o.db(this.opts.db);
|
|
46
|
+
if (this.opts.useGridFS) {
|
|
47
|
+
const e = new s(i, {
|
|
48
|
+
readPreference: this.opts.readPreference,
|
|
49
|
+
bucketName: this.opts.collection
|
|
50
|
+
});
|
|
51
|
+
const n = i.collection(`${this.opts.collection}.files`);
|
|
52
|
+
await n.createIndex({
|
|
53
|
+
uploadDate: -1
|
|
54
|
+
});
|
|
55
|
+
await n.createIndex({
|
|
56
|
+
"metadata.expiresAt": 1
|
|
57
|
+
});
|
|
58
|
+
await n.createIndex({
|
|
59
|
+
"metadata.lastAccessed": 1
|
|
60
|
+
});
|
|
61
|
+
await n.createIndex({
|
|
62
|
+
"metadata.filename": 1
|
|
63
|
+
});
|
|
64
|
+
t({
|
|
65
|
+
bucket: e,
|
|
66
|
+
store: n,
|
|
67
|
+
db: i,
|
|
68
|
+
mongoClient: o
|
|
69
|
+
});
|
|
39
70
|
} else {
|
|
40
|
-
|
|
41
|
-
|
|
71
|
+
let e = "keyv";
|
|
72
|
+
if (this.opts.collection) {
|
|
73
|
+
e = this.opts.collection;
|
|
42
74
|
}
|
|
43
|
-
|
|
75
|
+
const n = i.collection(e);
|
|
76
|
+
await n.createIndex({
|
|
77
|
+
key: 1
|
|
78
|
+
}, {
|
|
79
|
+
unique: true,
|
|
80
|
+
background: true
|
|
81
|
+
});
|
|
82
|
+
await n.createIndex({
|
|
83
|
+
expiresAt: 1
|
|
84
|
+
}, {
|
|
85
|
+
expireAfterSeconds: 0,
|
|
86
|
+
background: true
|
|
87
|
+
});
|
|
88
|
+
t({
|
|
89
|
+
store: n,
|
|
90
|
+
mongoClient: o
|
|
91
|
+
});
|
|
44
92
|
}
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})));
|
|
50
|
-
this.opts = {
|
|
51
|
-
table: "keyv",
|
|
52
|
-
keySize: 255,
|
|
53
|
-
...s
|
|
54
|
-
};
|
|
55
|
-
this.opts.table = i(this.opts.table);
|
|
56
|
-
const n = `CREATE TABLE IF NOT EXISTS ${this.opts.table}(key VARCHAR(${Number(this.opts.keySize)}) PRIMARY KEY, value TEXT )`;
|
|
57
|
-
const o = this.opts.connect().then((async t => t.query(n).then((() => t)))).catch((t => this.emit("error", t)));
|
|
58
|
-
this.query = async (t, ...e) => o.then((async s => s.query(t, ...e)));
|
|
59
|
-
this.close = async () => o.then((t => t.close()));
|
|
93
|
+
} catch (t) {
|
|
94
|
+
this.emit("error", t);
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
60
97
|
}
|
|
61
98
|
async get(t) {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
99
|
+
const n = await this.connect;
|
|
100
|
+
if (this.opts.useGridFS) {
|
|
101
|
+
await n.store.updateOne({
|
|
102
|
+
filename: t
|
|
103
|
+
}, {
|
|
104
|
+
$set: {
|
|
105
|
+
"metadata.lastAccessed": new Date
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const s = n.bucket.openDownloadStreamByName(t);
|
|
109
|
+
return new Promise((t => {
|
|
110
|
+
const n = [];
|
|
111
|
+
s.on("error", (() => {
|
|
112
|
+
t(void 0);
|
|
113
|
+
}));
|
|
114
|
+
s.on("end", (() => {
|
|
115
|
+
const s = e.concat(n).toString("utf8");
|
|
116
|
+
t(s);
|
|
117
|
+
}));
|
|
118
|
+
s.on("data", (t => {
|
|
119
|
+
n.push(t);
|
|
120
|
+
}));
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
const s = await n.store.findOne({
|
|
124
|
+
key: {
|
|
125
|
+
$eq: t
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
if (!s) {
|
|
66
129
|
return void 0;
|
|
67
130
|
}
|
|
68
|
-
return
|
|
131
|
+
return s.value;
|
|
69
132
|
}
|
|
70
133
|
async getMany(t) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
134
|
+
if (this.opts.useGridFS) {
|
|
135
|
+
const e = [];
|
|
136
|
+
for (const n of t) {
|
|
137
|
+
e.push(this.get(n));
|
|
138
|
+
}
|
|
139
|
+
const n = await Promise.allSettled(e);
|
|
140
|
+
const s = [];
|
|
141
|
+
for (const t of n) {
|
|
142
|
+
s.push(t.value);
|
|
143
|
+
}
|
|
144
|
+
return s;
|
|
145
|
+
}
|
|
146
|
+
const e = await this.connect;
|
|
147
|
+
const n = await e.store.s.db.collection(this.opts.collection).find({
|
|
148
|
+
key: {
|
|
149
|
+
$in: t
|
|
150
|
+
}
|
|
151
|
+
}).project({
|
|
152
|
+
_id: 0,
|
|
153
|
+
value: 1,
|
|
154
|
+
key: 1
|
|
155
|
+
}).toArray();
|
|
156
|
+
const s = [ ...t ];
|
|
157
|
+
let a = 0;
|
|
158
|
+
for (const e of t) {
|
|
159
|
+
const t = n.findIndex((t => t.key === e));
|
|
160
|
+
s[a] = t > -1 ? n[t].value : void 0;
|
|
161
|
+
a++;
|
|
162
|
+
}
|
|
163
|
+
return s;
|
|
77
164
|
}
|
|
78
|
-
async set(t, e) {
|
|
79
|
-
const s =
|
|
80
|
-
|
|
165
|
+
async set(t, e, n) {
|
|
166
|
+
const s = typeof n === "number" ? new Date(Date.now() + n) : null;
|
|
167
|
+
if (this.opts.useGridFS) {
|
|
168
|
+
const n = await this.connect;
|
|
169
|
+
const a = n.bucket.openUploadStream(t, {
|
|
170
|
+
metadata: {
|
|
171
|
+
expiresAt: s,
|
|
172
|
+
lastAccessed: new Date
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return new Promise((t => {
|
|
176
|
+
a.on("finish", (() => {
|
|
177
|
+
t(a);
|
|
178
|
+
}));
|
|
179
|
+
a.end(e);
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
const a = await this.connect;
|
|
183
|
+
await a.store.updateOne({
|
|
184
|
+
key: {
|
|
185
|
+
$eq: t
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
$set: {
|
|
189
|
+
key: t,
|
|
190
|
+
value: e,
|
|
191
|
+
expiresAt: s
|
|
192
|
+
}
|
|
193
|
+
}, {
|
|
194
|
+
upsert: true
|
|
195
|
+
});
|
|
81
196
|
}
|
|
82
197
|
async delete(t) {
|
|
83
|
-
|
|
84
|
-
const s = `DELETE FROM ${this.opts.table} WHERE key = ?`;
|
|
85
|
-
const a = await this.query(e, t);
|
|
86
|
-
const i = a[0];
|
|
87
|
-
if (i === void 0) {
|
|
198
|
+
if (typeof t !== "string") {
|
|
88
199
|
return false;
|
|
89
200
|
}
|
|
90
|
-
await this.
|
|
91
|
-
|
|
201
|
+
const e = await this.connect;
|
|
202
|
+
if (this.opts.useGridFS) {
|
|
203
|
+
try {
|
|
204
|
+
const n = e.db;
|
|
205
|
+
const a = new s(n, {
|
|
206
|
+
bucketName: this.opts.collection
|
|
207
|
+
});
|
|
208
|
+
const o = await a.find({
|
|
209
|
+
filename: t
|
|
210
|
+
}).toArray();
|
|
211
|
+
await e.bucket.delete(o[0]._id);
|
|
212
|
+
return true;
|
|
213
|
+
} catch {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const n = await e.store.deleteOne({
|
|
218
|
+
key: {
|
|
219
|
+
$eq: t
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
return n.deletedCount > 0;
|
|
92
223
|
}
|
|
93
224
|
async deleteMany(t) {
|
|
94
|
-
const e =
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
225
|
+
const e = await this.connect;
|
|
226
|
+
if (this.opts.useGridFS) {
|
|
227
|
+
const n = e.db;
|
|
228
|
+
const a = new s(n, {
|
|
229
|
+
bucketName: this.opts.collection
|
|
230
|
+
});
|
|
231
|
+
const o = await a.find({
|
|
232
|
+
filename: {
|
|
233
|
+
$in: t
|
|
234
|
+
}
|
|
235
|
+
}).toArray();
|
|
236
|
+
if (o.length === 0) {
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
await Promise.all(o.map((async t => e.bucket.delete(t._id))));
|
|
240
|
+
return true;
|
|
98
241
|
}
|
|
99
|
-
await
|
|
100
|
-
|
|
242
|
+
const n = await e.store.deleteMany({
|
|
243
|
+
key: {
|
|
244
|
+
$in: t
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
return n.deletedCount > 0;
|
|
101
248
|
}
|
|
102
249
|
async clear() {
|
|
103
|
-
const t =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const c = [ ...r ];
|
|
112
|
-
if (c.length === 0) {
|
|
113
|
-
return;
|
|
250
|
+
const t = await this.connect;
|
|
251
|
+
if (this.opts.useGridFS) {
|
|
252
|
+
try {
|
|
253
|
+
await t.bucket.drop();
|
|
254
|
+
} catch (t) {
|
|
255
|
+
if (!(t instanceof a && t.code === 26)) {
|
|
256
|
+
throw t;
|
|
257
|
+
}
|
|
114
258
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
259
|
+
}
|
|
260
|
+
await t.store.deleteMany({
|
|
261
|
+
key: {
|
|
262
|
+
$regex: this.namespace ? `^${this.namespace}:*` : ""
|
|
118
263
|
}
|
|
119
|
-
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
async clearExpired() {
|
|
267
|
+
if (!this.opts.useGridFS) {
|
|
268
|
+
return false;
|
|
120
269
|
}
|
|
121
|
-
|
|
270
|
+
return this.connect.then((async t => {
|
|
271
|
+
const e = t.db;
|
|
272
|
+
const n = new s(e, {
|
|
273
|
+
bucketName: this.opts.collection
|
|
274
|
+
});
|
|
275
|
+
return n.find({
|
|
276
|
+
"metadata.expiresAt": {
|
|
277
|
+
$lte: new Date(Date.now())
|
|
278
|
+
}
|
|
279
|
+
}).toArray().then((async e => Promise.all(e.map((async e => t.bucket.delete(e._id)))).then((() => true))));
|
|
280
|
+
}));
|
|
281
|
+
}
|
|
282
|
+
async clearUnusedFor(t) {
|
|
283
|
+
if (!this.opts.useGridFS) {
|
|
284
|
+
return false;
|
|
285
|
+
}
|
|
286
|
+
const e = await this.connect;
|
|
287
|
+
const n = e.db;
|
|
288
|
+
const a = new s(n, {
|
|
289
|
+
bucketName: this.opts.collection
|
|
290
|
+
});
|
|
291
|
+
const o = await a.find({
|
|
292
|
+
"metadata.lastAccessed": {
|
|
293
|
+
$lte: new Date(Date.now() - t * 1e3)
|
|
294
|
+
}
|
|
295
|
+
}).toArray();
|
|
296
|
+
await Promise.all(o.map((async t => e.bucket.delete(t._id))));
|
|
297
|
+
return true;
|
|
298
|
+
}
|
|
299
|
+
async* iterator(t) {
|
|
300
|
+
const e = await this.connect;
|
|
301
|
+
const n = new RegExp(`^${t ? t + ":" : ".*"}`);
|
|
302
|
+
const s = this.opts.useGridFS ? e.store.find({
|
|
303
|
+
filename: n
|
|
304
|
+
}).map((async t => [ t.filename, await this.get(t.filename) ])) : e.store.find({
|
|
305
|
+
key: n
|
|
306
|
+
}).map((t => [ t.key, t.value ]));
|
|
307
|
+
yield* s;
|
|
122
308
|
}
|
|
123
309
|
async has(t) {
|
|
124
|
-
const e =
|
|
125
|
-
const
|
|
126
|
-
|
|
310
|
+
const e = await this.connect;
|
|
311
|
+
const n = {
|
|
312
|
+
[this.opts.useGridFS ? "filename" : "key"]: {
|
|
313
|
+
$eq: t
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
const s = await e.store.count(n);
|
|
317
|
+
return s !== 0;
|
|
127
318
|
}
|
|
128
319
|
async disconnect() {
|
|
129
|
-
await this.
|
|
320
|
+
const t = await this.connect;
|
|
321
|
+
await t.mongoClient.close();
|
|
130
322
|
}
|
|
131
323
|
};
|
|
132
324
|
|
|
133
|
-
var
|
|
134
|
-
store: new n(t)
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
var r = n;
|
|
325
|
+
var c = i;
|
|
138
326
|
|
|
139
|
-
export {
|
|
327
|
+
export { i as KeyvMongo, c as default };
|
package/vendor/TypeDef.10.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
type
|
|
1
|
+
type ActionPattern<T extends Record<string, any> = {}> = Record<string, any> & T;
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface IPatRun {
|
|
4
|
+
add(pattern: Record<string, any>, obj: any): void;
|
|
5
|
+
remove(pattern: Record<string, any>): void;
|
|
6
|
+
find(subject: Record<string, any>, exact?: boolean): any;
|
|
7
|
+
list(partialPattern?: Record<string, any>): {
|
|
8
|
+
match: Record<string, any>;
|
|
9
|
+
data: any;
|
|
10
|
+
}[];
|
|
11
|
+
toJSON(): string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type { ActionPattern as A, IPatRun as I };
|
package/vendor/TypeDef.11.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
new (...args: any[]): T;
|
|
3
|
-
[prop: string]: any;
|
|
4
|
-
}
|
|
1
|
+
import { I as IConstructor } from './TypeDef.9.js';
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
type ClassDecorator<Constructor extends IConstructor> = (target: Constructor) => Constructor | void;
|
|
4
|
+
|
|
5
|
+
type PropertyDecorator<ClassPrototype> = (target: ClassPrototype, propertyKey: string | symbol) => void;
|
|
6
|
+
|
|
7
|
+
export type { ClassDecorator as C, PropertyDecorator as P };
|
package/vendor/TypeDef.12.d.ts
CHANGED
|
@@ -1,7 +1,107 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as OrderByCondition } from './TypeDef.4.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Describes all index options.
|
|
5
|
+
*/
|
|
6
|
+
interface IndexOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Indicates if this composite index must be unique or not.
|
|
9
|
+
*/
|
|
10
|
+
unique?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* The SPATIAL modifier indexes the entire column and does not allow indexed columns to contain NULL values.
|
|
13
|
+
* Works only in MySQL and PostgreSQL.
|
|
14
|
+
*/
|
|
15
|
+
spatial?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The FULLTEXT modifier indexes the entire column and does not allow prefixing.
|
|
18
|
+
* Works only in MySQL.
|
|
19
|
+
*/
|
|
20
|
+
fulltext?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* NULL_FILTERED indexes are particularly useful for indexing sparse columns, where most rows contain a NULL value.
|
|
23
|
+
* In these cases, the NULL_FILTERED index can be considerably smaller and more efficient to maintain than
|
|
24
|
+
* a normal index that includes NULL values.
|
|
25
|
+
*
|
|
26
|
+
* Works only in Spanner.
|
|
27
|
+
*/
|
|
28
|
+
nullFiltered?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Fulltext parser.
|
|
31
|
+
* Works only in MySQL.
|
|
32
|
+
*/
|
|
33
|
+
parser?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Index filter condition.
|
|
36
|
+
*/
|
|
37
|
+
where?: string;
|
|
38
|
+
/**
|
|
39
|
+
* If true, the index only references documents with the specified field.
|
|
40
|
+
* These indexes use less space but behave differently in some situations (particularly sorts).
|
|
41
|
+
* This option is only supported for mongodb database.
|
|
42
|
+
*/
|
|
43
|
+
sparse?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Builds the index in the background so that building an index an does not block other database activities.
|
|
46
|
+
* This option is only supported for mongodb database.
|
|
47
|
+
*/
|
|
48
|
+
background?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Create the index using the CONCURRENTLY modifier
|
|
51
|
+
* Works only in postgres.
|
|
52
|
+
*/
|
|
53
|
+
concurrent?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Specifies a time to live, in seconds.
|
|
56
|
+
* This option is only supported for mongodb database.
|
|
57
|
+
*/
|
|
58
|
+
expireAfterSeconds?: number;
|
|
59
|
+
}
|
|
4
60
|
|
|
5
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Describes all entity's options.
|
|
63
|
+
*/
|
|
64
|
+
interface EntityOptions {
|
|
65
|
+
/**
|
|
66
|
+
* Table name.
|
|
67
|
+
* If not specified then naming strategy will generate table name from entity name.
|
|
68
|
+
*/
|
|
69
|
+
name?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Specifies a default order by used for queries from this table when no explicit order by is specified.
|
|
72
|
+
*/
|
|
73
|
+
orderBy?: OrderByCondition | ((object: any) => OrderByCondition | any);
|
|
74
|
+
/**
|
|
75
|
+
* Table's database engine type (like "InnoDB", "MyISAM", etc).
|
|
76
|
+
* It is used only during table creation.
|
|
77
|
+
* If you update this value and table is already created, it will not change table's engine type.
|
|
78
|
+
* Note that not all databases support this option.
|
|
79
|
+
*/
|
|
80
|
+
engine?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Database name. Used in Mysql and Sql Server.
|
|
83
|
+
*/
|
|
84
|
+
database?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Schema name. Used in Postgres and Sql Server.
|
|
87
|
+
*/
|
|
88
|
+
schema?: string;
|
|
89
|
+
/**
|
|
90
|
+
* Indicates if schema synchronization is enabled or disabled for this entity.
|
|
91
|
+
* If it will be set to false then schema sync will and migrations ignore this entity.
|
|
92
|
+
* By default schema synchronization is enabled for all entities.
|
|
93
|
+
*/
|
|
94
|
+
synchronize?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* If set to 'true' this option disables Sqlite's default behaviour of secretly creating
|
|
97
|
+
* an integer primary key column named 'rowid' on table creation.
|
|
98
|
+
* @see https://www.sqlite.org/withoutrowid.html.
|
|
99
|
+
*/
|
|
100
|
+
withoutRowid?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Table comment. Not supported by all database types.
|
|
103
|
+
*/
|
|
104
|
+
comment?: string;
|
|
105
|
+
}
|
|
6
106
|
|
|
7
|
-
export type {
|
|
107
|
+
export type { EntityOptions as E, IndexOptions as I };
|