@cedarjs/auth-clerk-setup 7.1.0-rc.34 → 7.1.1-next.468

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 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAIjC,eAAO,MAAM,OAAO,UAAU,CAAA;AAC9B,eAAO,MAAM,WAAW,8BAA8B,CAAA;AAEtD,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI;;;;GAElC;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,IAAI,iBAG1C"}
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAGjC,eAAO,MAAM,OAAO,UAAU,CAAA;AAC9B,eAAO,MAAM,WAAW,8BAA8B,CAAA;AAEtD,wBAAgB,OAAO,CAAC,KAAK,EAAE,IAAI;;;;GAElC;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,OAAO,CAAA;CACf;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,IAAI,iBAG1C"}
package/dist/setup.js CHANGED
@@ -1,4 +1,4 @@
1
- import { standardAuthBuilder } from "@cedarjs/cli-helpers";
1
+ import { standardAuthBuilder } from "@cedarjs/cli-helpers/auth/setupHelpers";
2
2
  const command = "clerk";
3
3
  const description = "Set up auth for for Clerk";
4
4
  function builder(yargs) {
@@ -1,6 +1,6 @@
1
1
  import fs from "node:fs";
2
2
  import path from "path";
3
- import { standardAuthHandler } from "@cedarjs/cli-helpers";
3
+ import { standardAuthHandler } from "@cedarjs/cli-helpers/auth/setupHelpers";
4
4
  const { version } = JSON.parse(
5
5
  fs.readFileSync(
6
6
  path.resolve(import.meta.dirname, "../package.json"),
@@ -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.1.0-rc.34",
3
+ "version": "7.1.1-next.468",
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.1.0-rc.34"
40
+ "@cedarjs/cli-helpers": "7.1.1-next.468"
41
41
  },
42
42
  "devDependencies": {
43
- "@cedarjs/framework-tools": "7.1.0-rc.34",
43
+ "@cedarjs/framework-tools": "7.1.1-next.468",
44
44
  "@types/yargs": "17.0.35",
45
- "concurrently": "9.2.4",
46
- "publint": "0.3.24",
45
+ "concurrently": "9.2.5",
46
+ "publint": "0.3.25",
47
47
  "typescript": "5.9.3"
48
48
  },
49
49
  "engines": {