@wxn0brp/db-core 0.3.0-alpha.0 → 0.3.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.
- package/dist/db/valthera.d.ts +5 -1
- package/dist/db/valthera.js +2 -3
- package/dist/utils/action.js +7 -2
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/db/valthera.d.ts
CHANGED
|
@@ -18,7 +18,11 @@ type DbActionsFns = keyof {
|
|
|
18
18
|
declare class ValtheraClass implements ValtheraCompatible {
|
|
19
19
|
dbAction: ActionsBase;
|
|
20
20
|
executor: executorC;
|
|
21
|
-
emiter: VEE
|
|
21
|
+
emiter: VEE<{
|
|
22
|
+
[K in Exclude<DbActionsFns, "init">]: (query: VQuery, result: Awaited<ReturnType<ValtheraCompatible[K]>>) => void;
|
|
23
|
+
} & {
|
|
24
|
+
"*": (name: DbActionsFns, query: VQuery, result: any) => void;
|
|
25
|
+
}>;
|
|
22
26
|
version: string;
|
|
23
27
|
constructor(options?: DbOpts);
|
|
24
28
|
init(...args: any[]): Promise<unknown>;
|
package/dist/db/valthera.js
CHANGED
|
@@ -33,9 +33,8 @@ class ValtheraClass {
|
|
|
33
33
|
async execute(name, query) {
|
|
34
34
|
await this.init();
|
|
35
35
|
const result = await this.executor.addOp(this.dbAction[name].bind(this.dbAction), query);
|
|
36
|
-
|
|
37
|
-
this.emiter.emit(name,
|
|
38
|
-
this.emiter.emit("*", name, emitArgs, result);
|
|
36
|
+
this.emiter.emit(name, query, result);
|
|
37
|
+
this.emiter.emit("*", name, query, result);
|
|
39
38
|
return result;
|
|
40
39
|
}
|
|
41
40
|
/**
|
package/dist/utils/action.js
CHANGED
|
@@ -40,8 +40,13 @@ export async function findUtil(query, fileCpu, files) {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
if (sortBy) {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if (sortBy === "random()") {
|
|
44
|
+
datas.sort(() => Math.random() - 0.5);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const dir = sortAsc ? 1 : -1;
|
|
48
|
+
datas.sort((a, b) => compareSafe(a[sortBy], b[sortBy]) * dir);
|
|
49
|
+
}
|
|
45
50
|
const start = offset;
|
|
46
51
|
const end = limit !== -1 ? offset + limit : undefined;
|
|
47
52
|
datas = datas.slice(start, end);
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "0.3.0
|
|
1
|
+
export const version = "0.3.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wxn0brp/db-core",
|
|
3
|
-
"version": "0.3.0
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"types": "dist/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "wxn0brP",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"homepage": "https://github.com/wxn0brP/ValtheraDB",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@wxn0brp/event-emitter": "^0.0.
|
|
16
|
+
"@wxn0brp/event-emitter": "^0.0.4"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/bun": "*",
|