@dnax/core 0.69.3 → 0.69.5

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/app/index.ts CHANGED
@@ -115,31 +115,6 @@ async function runApp(config?: configRunApp, clb?: Function): Promise<Server> {
115
115
  })
116
116
  );
117
117
 
118
- console.log(
119
- "\n---------------------------------------".gray +
120
- "\n✨ Your server is up and running\n".green.bold +
121
- "---------------------------------------\n".gray +
122
- `🌐 Pid : ${process.pid}`.gray.bold +
123
- `\n` +
124
- `🟢 Version : ${pkg.version}`.gray.bold +
125
- `\n\n` +
126
- `āš™ļø Environment : ${
127
- process.env.NODE_ENV || envName || "development"
128
- }\n`.gray.bold +
129
- `šŸ•’ Started at : ${new Date().toLocaleString()}\n`.gray.bold +
130
- `\n` +
131
- `🌐 Server : ${serverName}`.gray.bold +
132
- `\n` +
133
- `šŸš€ Url : http://localhost:${PORT}\n\n`.gray.bold +
134
- `Tenants :`.gray.underline.bold +
135
- `\n` +
136
- Cfg.tenants?.map((t: any) => {
137
- return `\n${t?.name?.blue || "_"} : ${t?.id?.green}`.bold;
138
- }) +
139
- `\n\n` +
140
- `---------------------------------------\n`.gray
141
- );
142
-
143
118
  if (clb) clb();
144
119
 
145
120
  //AfterStart
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.3",
3
+ "version": "0.69.5",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {},