@dnax/core 0.30.0 → 0.30.2
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/config/index.ts +2 -1
- package/driver/mongo/rest.ts +14 -11
- package/lib/bento/index.ts +1 -0
- package/package.json +1 -1
- package/types/index.ts +1 -0
package/config/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cors } from "hono/cors";
|
|
2
2
|
import { Config } from "./../types/index";
|
|
3
3
|
import type { Config } from "../types";
|
|
4
|
-
|
|
4
|
+
import fs from "fs-extra";
|
|
5
5
|
import { systemCache } from "../lib/bento";
|
|
6
6
|
import { Glob } from "bun";
|
|
7
7
|
import path from "path";
|
|
@@ -58,6 +58,7 @@ async function setCfg(config: Config) {
|
|
|
58
58
|
await systemCache.set({
|
|
59
59
|
key: ".jwt.json",
|
|
60
60
|
value: jwtSecret,
|
|
61
|
+
ttl: "2y",
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
Cfg.server.jwt.secret = jwtSecret;
|
package/driver/mongo/rest.ts
CHANGED
|
@@ -631,6 +631,19 @@ class useRest {
|
|
|
631
631
|
|
|
632
632
|
result.docs = toJson(result.docs);
|
|
633
633
|
|
|
634
|
+
if (options?.withMeta) {
|
|
635
|
+
meta.count = await this.#tenant.database.db
|
|
636
|
+
?.collection(collection)
|
|
637
|
+
.countDocuments({
|
|
638
|
+
...(params?.$match || {}),
|
|
639
|
+
})
|
|
640
|
+
.then((e) => e || 0)
|
|
641
|
+
.catch((err) => 0);
|
|
642
|
+
meta.total = await this.#tenant.database.db
|
|
643
|
+
?.collection(collection)
|
|
644
|
+
.estimatedDocumentCount();
|
|
645
|
+
}
|
|
646
|
+
|
|
634
647
|
if (col?.hooks?.afterFind && useHook) {
|
|
635
648
|
await col.hooks.afterFind({
|
|
636
649
|
sharedData: sharedData,
|
|
@@ -638,6 +651,7 @@ class useRest {
|
|
|
638
651
|
io: Cfg.io,
|
|
639
652
|
driver: "mongodb",
|
|
640
653
|
action: "find",
|
|
654
|
+
meta: meta,
|
|
641
655
|
count: result?.docs?.length || 0,
|
|
642
656
|
params: params,
|
|
643
657
|
session: sessionStorage(),
|
|
@@ -656,17 +670,6 @@ class useRest {
|
|
|
656
670
|
}
|
|
657
671
|
|
|
658
672
|
if (options?.withMeta) {
|
|
659
|
-
meta.count = await this.#tenant.database.db
|
|
660
|
-
?.collection(collection)
|
|
661
|
-
.countDocuments({
|
|
662
|
-
...(params?.$match || {}),
|
|
663
|
-
})
|
|
664
|
-
.then((e) => e || 0)
|
|
665
|
-
.catch((err) => 0);
|
|
666
|
-
meta.total = await this.#tenant.database.db
|
|
667
|
-
?.collection(collection)
|
|
668
|
-
.estimatedDocumentCount();
|
|
669
|
-
|
|
670
673
|
return resolve({
|
|
671
674
|
data: resultDocs,
|
|
672
675
|
meta: meta,
|
package/lib/bento/index.ts
CHANGED
package/package.json
CHANGED
package/types/index.ts
CHANGED