@supabase/auth-helpers-react
Advanced tools
Comparing version 0.3.1 to 0.4.0-next.0
# @supabase/auth-helpers-react | ||
## 0.4.0-next.0 | ||
### Minor Changes | ||
- 65bf8d4: Add cookie storage adapter per library following a shared storage adapter | ||
- 65bf8d4: Add full server side support to auth helpers through PKCE | ||
## 0.3.1 | ||
@@ -4,0 +11,0 @@ |
@@ -7,3 +7,3 @@ import * as _supabase_supabase_js from '@supabase/supabase-js'; | ||
declare type SessionContext = { | ||
type SessionContext = { | ||
isLoading: true; | ||
@@ -10,0 +10,0 @@ session: null; |
@@ -1,6 +0,5 @@ | ||
var __create = Object.create; | ||
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -19,4 +18,23 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var __async = (__this, __arguments, generator) => { | ||
return new Promise((resolve, reject) => { | ||
var fulfilled = (value) => { | ||
try { | ||
step(generator.next(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}; | ||
var rejected = (value) => { | ||
try { | ||
step(generator.throw(value)); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}; | ||
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); | ||
step((generator = generator.apply(__this, __arguments)).next()); | ||
}); | ||
}; | ||
@@ -35,3 +53,4 @@ // src/index.tsx | ||
// src/components/SessionContext.tsx | ||
var import_react = __toESM(require("react")); | ||
var import_react = require("react"); | ||
var import_jsx_runtime = require("react/jsx-runtime"); | ||
var SessionContext = (0, import_react.createContext)({ | ||
@@ -53,18 +72,23 @@ isLoading: true, | ||
let mounted = true; | ||
async function getSession() { | ||
const { | ||
data: { session: session2 }, | ||
error: error2 | ||
} = await supabaseClient.auth.getSession(); | ||
if (mounted) { | ||
if (error2) { | ||
setError(error2); | ||
function getSession() { | ||
return __async(this, null, function* () { | ||
const { | ||
data: { session: session2 }, | ||
error: error2 | ||
} = yield supabaseClient.auth.getSession(); | ||
if (mounted) { | ||
if (error2) { | ||
setError(error2); | ||
setIsLoading(false); | ||
return; | ||
} | ||
setSession(session2); | ||
setIsLoading(false); | ||
return; | ||
} | ||
setSession(session2); | ||
setIsLoading(false); | ||
} | ||
}); | ||
} | ||
getSession(); | ||
return () => { | ||
mounted = false; | ||
}; | ||
}, []); | ||
@@ -110,5 +134,6 @@ (0, import_react.useEffect)(() => { | ||
}, [isLoading, session, error]); | ||
return /* @__PURE__ */ import_react.default.createElement(SessionContext.Provider, { | ||
value | ||
}, children); | ||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SessionContext.Provider, { | ||
value, | ||
children | ||
}); | ||
}; | ||
@@ -118,3 +143,5 @@ var useSessionContext = () => { | ||
if (context === void 0) { | ||
throw new Error(`useSessionContext must be used within a SessionContextProvider.`); | ||
throw new Error( | ||
`useSessionContext must be used within a SessionContextProvider.` | ||
); | ||
} | ||
@@ -126,3 +153,5 @@ return context; | ||
if (context === void 0) { | ||
throw new Error(`useSupabaseClient must be used within a SessionContextProvider.`); | ||
throw new Error( | ||
`useSupabaseClient must be used within a SessionContextProvider.` | ||
); | ||
} | ||
@@ -129,0 +158,0 @@ return context.supabaseClient; |
{ | ||
"name": "@supabase/auth-helpers-react", | ||
"version": "0.3.1", | ||
"version": "0.4.0-next.0", | ||
"main": "dist/index.js", | ||
@@ -21,21 +21,20 @@ "types": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@supabase/supabase-js": "2.0.4", | ||
"@supabase/supabase-js": "2.19.0", | ||
"@types/react": "^17.0.20", | ||
"@types/react-dom": "^17.0.9", | ||
"config": "0.1.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"rimraf": "^3.0.2", | ||
"tsconfig": "0.1.0", | ||
"tsup": "^5.12.5", | ||
"typescript": "^4.5.3" | ||
"rimraf": "^4.1.1", | ||
"tsup": "^6.5.0", | ||
"typescript": "^4.9.4", | ||
"config": "0.1.0", | ||
"tsconfig": "0.1.1" | ||
}, | ||
"peerDependencies": { | ||
"@supabase/supabase-js": "^2.0.4" | ||
"@supabase/supabase-js": "^2.19.0" | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"clean": "rimraf dist", | ||
"clean:all": "rimraf dist node_modules" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22773
393