@dnax/core 0.69.4 → 0.69.6

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.
@@ -8,15 +8,23 @@ export type Lookup = {
8
8
  };
9
9
 
10
10
  export type findParam = {
11
- $match?: object;
12
- $sort?: object;
11
+ $match?: {
12
+ _id?: string;
13
+ [key: string]: any;
14
+ };
15
+ $sort?: {
16
+ [key: string]: 1 | -1;
17
+ };
13
18
  $skip?: number;
14
19
  $limit?: number;
15
20
  $include?: Array<string | Lookup>;
16
21
  $project?: object;
17
- $matchInclude?: object;
22
+ $matchInclude?: {
23
+ _id?: string;
24
+ [key: string]: any;
25
+ };
18
26
  $group?: {
19
- _id: any;
27
+ _id?: any;
20
28
  [key: string]: any;
21
29
  };
22
30
  $sample?: {
package/index.ts CHANGED
@@ -12,6 +12,7 @@ import { contextStorage } from "./lib/asyncLocalStorage";
12
12
  import { Cron as Task } from "croner";
13
13
  import { serveStatic } from "hono/bun";
14
14
  import { useDatabaseTools } from "./driver/mongo/database";
15
+ import { useCache } from "./lib/bento";
15
16
  // Adapter
16
17
 
17
18
  const Adapter = {
@@ -19,12 +20,6 @@ const Adapter = {
19
20
  MinioAdapter,
20
21
  };
21
22
 
22
- /**
23
- * v is internal data validation and based of Joi validation.
24
- * Note : v is an alias of Joi object API .
25
- * @see {@link https://joi.dev/api}
26
- */
27
-
28
23
  export {
29
24
  runApp,
30
25
  define,
@@ -33,6 +28,7 @@ export {
33
28
  v,
34
29
  Task,
35
30
  crypt,
31
+ useCache,
36
32
  $,
37
33
  contextStorage,
38
34
  Adapter,
@@ -19,4 +19,28 @@ if (!fs?.existsSync(path.resolve(cacheDirectoryData + "bentocache"))) {
19
19
  });
20
20
  }
21
21
 
22
- export {};
22
+ function useCache(
23
+ driver: "memory" = "memory",
24
+ options: {
25
+ maxSize?: string;
26
+ } = {
27
+ /**
28
+ * @default 200mb
29
+ */
30
+ maxSize: "200mb",
31
+ }
32
+ ): InstanceType<typeof BentoCache> {
33
+ const bento = new BentoCache({
34
+ default: "dataCache",
35
+ stores: {
36
+ dataCache: bentostore().useL1Layer(
37
+ memoryDriver({
38
+ maxSize: "100mb",
39
+ })
40
+ ),
41
+ },
42
+ });
43
+ return bento;
44
+ }
45
+
46
+ export { useCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.69.4",
3
+ "version": "0.69.6",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {},