@dnax/core 0.37.0 → 0.40.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/app/hono.ts +2 -0
- package/lib/asyncLocalStorage.ts +6 -1
- package/package.json +1 -1
- package/types/index.ts +8 -2
package/app/hono.ts
CHANGED
|
@@ -131,6 +131,7 @@ function HonoInstance(): typeof app {
|
|
|
131
131
|
state: sessionData?.state || {},
|
|
132
132
|
role: sessionData?.role || null,
|
|
133
133
|
_v: { ...(_v || {}) },
|
|
134
|
+
isAuth: valid ? true : false,
|
|
134
135
|
});
|
|
135
136
|
} else {
|
|
136
137
|
// no valid token
|
|
@@ -139,6 +140,7 @@ function HonoInstance(): typeof app {
|
|
|
139
140
|
state: {},
|
|
140
141
|
role: undefined,
|
|
141
142
|
_v: { ...(_v || {}) },
|
|
143
|
+
isAuth: false,
|
|
142
144
|
});
|
|
143
145
|
}
|
|
144
146
|
|
package/lib/asyncLocalStorage.ts
CHANGED
|
@@ -22,9 +22,14 @@ function isSetAsyncLocalStorage() {
|
|
|
22
22
|
const sessionStorage = () => ({
|
|
23
23
|
get(): {
|
|
24
24
|
state: object;
|
|
25
|
-
_v:
|
|
25
|
+
_v: {
|
|
26
|
+
isAuth: boolean;
|
|
27
|
+
reqAt?: string;
|
|
28
|
+
setAt?: string;
|
|
29
|
+
};
|
|
26
30
|
role: string | null | undefined;
|
|
27
31
|
token?: string;
|
|
32
|
+
isAuth?: boolean;
|
|
28
33
|
} {
|
|
29
34
|
if (!isSetAsyncLocalStorage()) return { state: {}, _v: {}, role: null };
|
|
30
35
|
let store = asyncLocalStorage?.getStore() as InstanceType<typeof Map>;
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -171,7 +171,6 @@ export type sessionCtx = {
|
|
|
171
171
|
user?: object;
|
|
172
172
|
};
|
|
173
173
|
token?: string;
|
|
174
|
-
_v?: object;
|
|
175
174
|
role?: string | null | undefined;
|
|
176
175
|
expiresIn?: string;
|
|
177
176
|
}) => void;
|
|
@@ -180,9 +179,16 @@ export type sessionCtx = {
|
|
|
180
179
|
[key: string]: any;
|
|
181
180
|
user?: object;
|
|
182
181
|
};
|
|
183
|
-
_v:
|
|
182
|
+
_v: {
|
|
183
|
+
ip: string;
|
|
184
|
+
isAuth: boolean;
|
|
185
|
+
reqAt?: string;
|
|
186
|
+
setAt?: string;
|
|
187
|
+
token?: string;
|
|
188
|
+
};
|
|
184
189
|
role: string | null | undefined;
|
|
185
190
|
token: string | null | undefined;
|
|
191
|
+
isAuth: boolean;
|
|
186
192
|
};
|
|
187
193
|
};
|
|
188
194
|
|