astro-tokenkit 1.0.13 → 1.0.14
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/README.md +1 -0
- package/dist/index.cjs +11 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -15
- package/dist/index.js.map +1 -1
- package/dist/middleware.js +11 -15
- package/package.json +1 -1
package/dist/middleware.js
CHANGED
|
@@ -15,7 +15,6 @@ import { getConfig, getTokenManager } from './config';
|
|
|
15
15
|
*/
|
|
16
16
|
export function createMiddleware() {
|
|
17
17
|
return (ctx, next) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
var _a;
|
|
19
18
|
const tokenManager = getTokenManager();
|
|
20
19
|
const config = getConfig();
|
|
21
20
|
const runLogic = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -32,21 +31,18 @@ export function createMiddleware() {
|
|
|
32
31
|
}
|
|
33
32
|
return next();
|
|
34
33
|
});
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let storage = config.getContextStore();
|
|
40
|
-
if (storage)
|
|
41
|
-
// Update existing reference
|
|
42
|
-
storage.cookies = ctx.cookies;
|
|
43
|
-
else if (config.setContextStore)
|
|
44
|
-
config.setContextStore({ cookies: ctx.cookies });
|
|
45
|
-
else
|
|
46
|
-
console.error("[TokenKit] getContextStore returned null or undefined and no setter was found");
|
|
34
|
+
const setupAndRun = () => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
if (config.setContextStore) {
|
|
36
|
+
config.setContextStore(ctx);
|
|
37
|
+
}
|
|
47
38
|
return runLogic();
|
|
39
|
+
});
|
|
40
|
+
if (config.runWithContext) {
|
|
41
|
+
return config.runWithContext(ctx, setupAndRun);
|
|
42
|
+
}
|
|
43
|
+
if (config.setContextStore) {
|
|
44
|
+
return setupAndRun();
|
|
48
45
|
}
|
|
49
|
-
|
|
50
|
-
return runner(ctx, runLogic);
|
|
46
|
+
return defaultRunWithContext(ctx, runLogic);
|
|
51
47
|
});
|
|
52
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-tokenkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "A powerful API client for Astro with automatic token rotation, session management, and seamless context integration.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|