@dnax/core 0.77.9 → 0.78.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/index.ts CHANGED
@@ -6,13 +6,12 @@ import * as v from "joi";
6
6
  import { $ } from "bun";
7
7
  import define from "./define";
8
8
  import * as utils from "./utils";
9
- import { app } from "./app/hono";
10
9
  import { FilesystemSftpAdapter, MinioAdapter } from "./lib/media";
11
10
  import { crypt } from "./lib/crypto";
12
11
  import { plugins } from "./lib/plugins";
13
12
  import { contextStorage } from "./lib/asyncLocalStorage";
14
13
  import { Cron as Task } from "croner";
15
- import { serveStatic } from "hono/bun";
14
+ //import { serveStatic } from "hono/bun";
16
15
  import { useDatabaseTools } from "./driver/mongo/database";
17
16
  import { useCache } from "./lib/bento";
18
17
  // Adapter
@@ -129,16 +129,35 @@ const sessionStorage = () => ({
129
129
  });
130
130
 
131
131
  const requestStorage = () => ({
132
+ isSet(): boolean {
133
+ let store = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
134
+ return store ? true : false;
135
+ },
136
+ set(key: string, data: any): any {
137
+ let store = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
138
+ return store.set('request::::'+key, data);
139
+ },
140
+ get(key: string): any {
141
+ let store = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
142
+ return store.get('request::::'+key);
143
+ },
144
+ });
145
+
146
+ const restStorage = () => ({
147
+ isSet(): boolean {
148
+ let store = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
149
+ return store ? true : false;
150
+ },
132
151
  set(key: string, data: any): any {
133
152
  let store = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
134
- return store.set(key, data);
153
+ return store.set('rest::::'+key, data);
135
154
  },
136
155
  get(key: string): any {
137
156
  let store = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
138
- return store.get(key);
157
+ return store.get('rest::::'+key);
139
158
  },
140
159
  });
141
160
 
142
161
  const contextStorage = asyncLocalStorage.getStore() as InstanceType<typeof Map>;
143
162
 
144
- export { sessionStorage, asyncLocalStorage, requestStorage, contextStorage };
163
+ export { sessionStorage, asyncLocalStorage, requestStorage, contextStorage ,restStorage};