-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/playground-workspace
- Loading branch information
Showing
95 changed files
with
1,485 additions
and
847 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@clerk/expo-passkeys': patch | ||
'@clerk/clerk-expo': patch | ||
--- | ||
- Replaced import { Buffer } from 'node:buffer' with import { Buffer } from 'buffer'. | ||
- Moved @clerk/expo-passkeys to a devDependency in @clerk/clerk-expo. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@clerk/clerk-js": patch | ||
"@clerk/types": patch | ||
--- | ||
|
||
Inject captcha token into every X heartbeats |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@clerk/dev-cli': patch | ||
--- | ||
|
||
Fix framework detection for Next.js. `clerk-dev` will now check for `next` as a dependency. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@clerk/shared': minor | ||
--- | ||
|
||
Change `useReverification` to handle error in a callback, but still allow an error to be thrown via options. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
engine-strict=false | ||
legacy-peer-deps=false | ||
link-workspace-packages=true | ||
legacy-peer-deps=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"arcanis.vscode-zipfs", | ||
"dbaeumer.vscode-eslint", | ||
"esbenp.prettier-vscode" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { applicationConfig } from '../models/applicationConfig'; | ||
import { templates } from '../templates'; | ||
|
||
const nuxtNode = applicationConfig() | ||
.setName('nuxt-node') | ||
.useTemplate(templates['nuxt-node']) | ||
.setEnvFormatter('public', key => `NUXT_PUBLIC_${key}`) | ||
.setEnvFormatter('private', key => `NUXT_${key}`) | ||
.addScript('setup', 'pnpm install') | ||
.addScript('dev', 'pnpm dev') | ||
.addScript('build', 'pnpm build') | ||
.addScript('serve', 'pnpm preview') | ||
.addDependency('@clerk/nuxt', '*'); | ||
|
||
export const nuxt = { | ||
node: nuxtNode, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<NuxtPage /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default defineNuxtRouteMiddleware((to, from) => { | ||
const { userId } = useAuth(); | ||
|
||
const isPublicPage = ['/sign-in'].includes(to.path); | ||
const isProtectedPage = ['/user'].includes(to.path); | ||
|
||
// Is authenticated and trying to access a public page | ||
if (userId.value && isPublicPage) { | ||
return navigateTo('/user'); | ||
} | ||
|
||
// Is not authenticated and trying to access a protected page | ||
if (!userId.value && isProtectedPage) { | ||
return navigateTo('/sign-in'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default defineNuxtConfig({ | ||
modules: ['@clerk/nuxt'], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "nuxt-clerk-integration-template", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
"build": "nuxt build", | ||
"dev": "nuxt dev --port $PORT", | ||
"generate": "nuxt generate", | ||
"postinstall": "nuxt prepare", | ||
"preview": "nuxt preview --port $PORT" | ||
}, | ||
"dependencies": { | ||
"nuxt": "^3.14.159", | ||
"vue": "^3.5.12", | ||
"vue-router": "^4.4.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<template> | ||
<div> | ||
<h1>Index Route</h1> | ||
<SignedIn> | ||
<p>You are signed in!</p> | ||
<div> | ||
<p>View your profile here</p> | ||
<UserButton /> | ||
<OrganizationSwitcher /> | ||
</div> | ||
<div> | ||
<SignOutButton /> | ||
</div> | ||
</SignedIn> | ||
<SignedOut> | ||
<p>You are signed out</p> | ||
|
||
<SignIn /> | ||
</SignedOut> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<template> | ||
<Protect> | ||
<p>I am an admin</p> | ||
<template #fallback> | ||
<p>Not an admin</p> | ||
</template> | ||
</Protect> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<SignIn /> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup> | ||
const { data: user } = await useFetch('/api/me'); | ||
</script> | ||
|
||
<template> | ||
<UserProfile /> | ||
<ul> | ||
<li>First name: {{ user.firstName }}</li> | ||
<li>Email: {{ user.emailAddresses[0].emailAddress }}</li> | ||
</ul> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { clerkClient } from '@clerk/nuxt/server'; | ||
|
||
export default eventHandler(async event => { | ||
const { userId } = event.context.auth; | ||
|
||
if (!userId) { | ||
throw createError({ | ||
statusCode: 401, | ||
statusMessage: 'Unauthorized', | ||
}); | ||
} | ||
|
||
const user = await clerkClient(event).users.getUser(userId); | ||
|
||
return user; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
import { appConfigs } from '../../presets'; | ||
import type { FakeOrganization, FakeUser } from '../../testUtils'; | ||
import { createTestUtils, testAgainstRunningApps } from '../../testUtils'; | ||
|
||
testAgainstRunningApps({ withEnv: [appConfigs.envs.withCustomRoles] })('basic tests for @nuxt', ({ app }) => { | ||
test.describe.configure({ mode: 'parallel' }); | ||
|
||
let fakeUser: FakeUser; | ||
let fakeOrganization: FakeOrganization; | ||
|
||
test.beforeAll(async () => { | ||
const u = createTestUtils({ app }); | ||
fakeUser = u.services.users.createFakeUser(); | ||
const user = await u.services.users.createBapiUser(fakeUser); | ||
fakeOrganization = await u.services.users.createFakeOrganization(user.id); | ||
}); | ||
|
||
test.afterAll(async () => { | ||
await fakeOrganization.delete(); | ||
await fakeUser.deleteIfExists(); | ||
|
||
await app.teardown(); | ||
}); | ||
|
||
test.afterEach(async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
await u.page.signOut(); | ||
await u.page.context().clearCookies(); | ||
}); | ||
|
||
test('sign in with hash routing', async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
|
||
await u.page.goToRelative('/sign-in'); | ||
await u.po.signIn.waitForMounted(); | ||
|
||
await u.po.signIn.setIdentifier(fakeUser.email); | ||
await u.po.signIn.continue(); | ||
await u.page.waitForURL(`${app.serverUrl}/sign-in#/factor-one`); | ||
|
||
await u.po.signIn.setPassword(fakeUser.password); | ||
await u.po.signIn.continue(); | ||
await u.po.expect.toBeSignedIn(); | ||
}); | ||
|
||
test('render user profile with SSR data', async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
|
||
await u.page.goToRelative('/sign-in'); | ||
await u.po.signIn.waitForMounted(); | ||
await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password }); | ||
await u.po.expect.toBeSignedIn(); | ||
|
||
await u.po.userButton.waitForMounted(); | ||
await u.page.goToRelative('/user'); | ||
await u.po.userProfile.waitForMounted(); | ||
|
||
// Fetched from an API endpoint (/api/me), which is server-rendered. | ||
// This also verifies that the server middleware is working. | ||
await expect(u.page.getByText(`First name: ${fakeUser.firstName}`)).toBeVisible(); | ||
await expect(u.page.getByText(`Email: ${fakeUser.email}`)).toBeVisible(); | ||
}); | ||
|
||
test('redirects to sign-in when unauthenticated', async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
|
||
await u.page.goToRelative('/user'); | ||
await u.page.waitForURL(`${app.serverUrl}/sign-in`); | ||
await u.po.signIn.waitForMounted(); | ||
}); | ||
|
||
test('renders control components contents in SSR', async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
|
||
await u.page.goToAppHome(); | ||
await expect(u.page.getByText('You are signed out')).toBeVisible(); | ||
|
||
await u.page.goToRelative('/sign-in'); | ||
await u.po.signIn.waitForMounted(); | ||
await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password }); | ||
await u.po.expect.toBeSignedIn(); | ||
await expect(u.page.getByText('You are signed in!')).toBeVisible(); | ||
}); | ||
|
||
test('renders <Protect /> component contents to admin', async ({ page, context }) => { | ||
const u = createTestUtils({ app, page, context }); | ||
|
||
await u.page.goToRelative('/sign-in'); | ||
await u.po.signIn.waitForMounted(); | ||
await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password }); | ||
await u.po.expect.toBeSignedIn(); | ||
|
||
await u.page.waitForAppUrl('/'); | ||
await u.po.organizationSwitcher.waitForMounted(); | ||
await u.po.organizationSwitcher.waitForAnOrganizationToSelected(); | ||
await u.page.goToRelative('/only-admin'); | ||
await expect(u.page.getByText('I am an admin')).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.