@dnax/core 0.37.0 → 0.38.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 +14 -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,18 +171,30 @@ export type sessionCtx = {
|
|
|
171
171
|
user?: object;
|
|
172
172
|
};
|
|
173
173
|
token?: string;
|
|
174
|
-
_v?:
|
|
174
|
+
_v?: {
|
|
175
|
+
ip: string;
|
|
176
|
+
isAuth: boolean;
|
|
177
|
+
reqAt?: string;
|
|
178
|
+
setAt?: string;
|
|
179
|
+
};
|
|
175
180
|
role?: string | null | undefined;
|
|
176
181
|
expiresIn?: string;
|
|
182
|
+
isAuth?: boolean;
|
|
177
183
|
}) => void;
|
|
178
184
|
get: () => {
|
|
179
185
|
state: {
|
|
180
186
|
[key: string]: any;
|
|
181
187
|
user?: object;
|
|
182
188
|
};
|
|
183
|
-
_v:
|
|
189
|
+
_v: {
|
|
190
|
+
ip: string;
|
|
191
|
+
isAuth: boolean;
|
|
192
|
+
reqAt?: string;
|
|
193
|
+
setAt?: string;
|
|
194
|
+
};
|
|
184
195
|
role: string | null | undefined;
|
|
185
196
|
token: string | null | undefined;
|
|
197
|
+
isAuth: boolean;
|
|
186
198
|
};
|
|
187
199
|
};
|
|
188
200
|
|