@cedarjs/auth-clerk-setup 7.0.1-next.314 → 7.0.1-next.466
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AuthContextPayload, Decoded } from '@cedarjs/api'
|
|
1
2
|
import { AuthenticationError, ForbiddenError } from '@cedarjs/graphql-server'
|
|
2
3
|
|
|
3
4
|
import { logger } from 'src/lib/logger'
|
|
@@ -15,11 +16,11 @@ import { logger } from 'src/lib/logger'
|
|
|
15
16
|
* @see https://github.com/cedarjs/cedar/tree/main/packages/auth for examples
|
|
16
17
|
*/
|
|
17
18
|
export const getCurrentUser = async (
|
|
18
|
-
decoded,
|
|
19
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
20
|
-
{ token, type },
|
|
21
|
-
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
|
|
22
|
-
{ event, context }
|
|
19
|
+
decoded: Decoded,
|
|
20
|
+
/* eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars */
|
|
21
|
+
{ token, type }: AuthContextPayload[1],
|
|
22
|
+
/* eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars */
|
|
23
|
+
{ event, context }: Partial<AuthContextPayload[2]> = {}
|
|
23
24
|
) => {
|
|
24
25
|
if (!decoded) {
|
|
25
26
|
logger.warn('Missing decoded user')
|
|
@@ -49,6 +49,13 @@ const ClerkProviderWrapper = ({
|
|
|
49
49
|
export const AuthProvider = ({ children }: Props) => {
|
|
50
50
|
const publishableKey = process.env.CLERK_PUBLISHABLE_KEY
|
|
51
51
|
|
|
52
|
+
if (!publishableKey) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
'Missing CLERK_PUBLISHABLE_KEY. Set it in your .env file and add it to ' +
|
|
55
|
+
'`includeEnvironmentVariables` in cedar.toml'
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
52
59
|
return (
|
|
53
60
|
<ClerkRwAuthProvider>
|
|
54
61
|
<ClerkProviderWrapper clerkOptions={{ publishableKey }}>
|
|
@@ -47,6 +47,13 @@ const ClerkProviderWrapper = ({
|
|
|
47
47
|
export const AuthProvider = ({ children }: Props) => {
|
|
48
48
|
const publishableKey = process.env.CLERK_PUBLISHABLE_KEY
|
|
49
49
|
|
|
50
|
+
if (!publishableKey) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'Missing CLERK_PUBLISHABLE_KEY. Set it in your .env file and add it to ' +
|
|
53
|
+
'`includeEnvironmentVariables` in cedar.toml'
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
50
57
|
return (
|
|
51
58
|
<ClerkRwAuthProvider>
|
|
52
59
|
<ClerkProviderWrapper clerkOptions={{ publishableKey }}>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/auth-clerk-setup",
|
|
3
|
-
"version": "7.0.1-next.
|
|
3
|
+
"version": "7.0.1-next.466",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"prepublishOnly": "NODE_ENV=production yarn build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@cedarjs/cli-helpers": "7.0.1-next.
|
|
40
|
+
"@cedarjs/cli-helpers": "7.0.1-next.466"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@cedarjs/framework-tools": "7.0.1-next.
|
|
43
|
+
"@cedarjs/framework-tools": "7.0.1-next.466",
|
|
44
44
|
"@types/yargs": "17.0.35",
|
|
45
|
-
"concurrently": "9.2.
|
|
46
|
-
"publint": "0.3.
|
|
45
|
+
"concurrently": "9.2.5",
|
|
46
|
+
"publint": "0.3.25",
|
|
47
47
|
"typescript": "5.9.3"
|
|
48
48
|
},
|
|
49
49
|
"engines": {
|