session-context
Advanced tools
Comparing version
@@ -14,3 +14,3 @@ "use strict"; | ||
const getSessionContext = () => { | ||
const store = global.__context.getStore(); | ||
const store = global.__context?.getStore(); | ||
if (!store) { | ||
@@ -31,3 +31,3 @@ throw new Error('Session context is not initialized'); | ||
const setProcessEnv = (env) => { | ||
const store = global.__context.getStore(); | ||
const store = global.__context?.getStore(); | ||
if (!store) { | ||
@@ -34,0 +34,0 @@ throw new Error('Session context is not initialized'); |
@@ -10,3 +10,3 @@ import { AsyncLocalStorage } from 'node:async_hooks'; | ||
export const getSessionContext = () => { | ||
const store = global.__context.getStore(); | ||
const store = global.__context?.getStore(); | ||
if (!store) { | ||
@@ -25,3 +25,3 @@ throw new Error('Session context is not initialized'); | ||
export const setProcessEnv = (env) => { | ||
const store = global.__context.getStore(); | ||
const store = global.__context?.getStore(); | ||
if (!store) { | ||
@@ -28,0 +28,0 @@ throw new Error('Session context is not initialized'); |
{ | ||
"name": "session-context", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "./dist/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./dist/cjs/index.d.ts", |
@@ -60,2 +60,5 @@ # session-context | ||
store.env = context.cloudflare.env; // Save the environment variables | ||
// Support `process.env` | ||
// setProcessEnv(context.cloudflare.env); | ||
return context; | ||
@@ -62,0 +65,0 @@ }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
162
1.89%16760
-5.12%15
-6.25%121
-26.67%