diff --git a/waspc/data/Generator/templates/sdk/wasp/server/auth/hooks.ts b/waspc/data/Generator/templates/sdk/wasp/server/auth/hooks.ts index 7fdf1fba7c..fe458031ed 100644 --- a/waspc/data/Generator/templates/sdk/wasp/server/auth/hooks.ts +++ b/waspc/data/Generator/templates/sdk/wasp/server/auth/hooks.ts @@ -3,7 +3,6 @@ import type { Request as ExpressRequest } from 'express' import { type ProviderId, createUser, findAuthWithUserBy } from '../../auth/utils.js' import { prisma } from '../index.js' import { Expand } from '../../universal/types.js' -import { ProviderName } from '../_types/index.js'; // PUBLIC API export type OnBeforeSignupHook = ( @@ -71,7 +70,7 @@ type OnAfterSignupHookParams = { * OAuth flow data that was generated during the OAuth flow. This is only * available if the user signed up using OAuth. */ - oauth?: OAuthParams + oauth?: OAuthData /** * Request object that can be used to access the incoming request. */ @@ -86,7 +85,7 @@ type OnBeforeOAuthRedirectHookParams = { /** * Unique request ID that was generated during the OAuth flow. */ - uniqueRequestId: OAuthParams['uniqueRequestId'] + oauth: Pick /** * Request object that can be used to access the incoming request. */ @@ -117,7 +116,7 @@ type OnAfterLoginHookParams = { * OAuth flow data that was generated during the OAuth flow. This is only * available if the user logged in using OAuth. */ - oauth?: OAuthParams + oauth?: OAuthData /** * Request object that can be used to access the incoming request. */ @@ -125,7 +124,7 @@ type OnAfterLoginHookParams = { } & InternalAuthHookParams // PRIVATE API (server) -export type OAuthParams = { +export type OAuthData = { /** * Unique request ID that was generated during the OAuth flow. */ diff --git a/waspc/data/Generator/templates/sdk/wasp/server/auth/index.ts b/waspc/data/Generator/templates/sdk/wasp/server/auth/index.ts index 8dc77d8463..945793b0bc 100644 --- a/waspc/data/Generator/templates/sdk/wasp/server/auth/index.ts +++ b/waspc/data/Generator/templates/sdk/wasp/server/auth/index.ts @@ -30,7 +30,7 @@ export type { OnBeforeLoginHook, OnAfterLoginHook, InternalAuthHookParams, - OAuthParams, + OAuthData, } from './hooks.js' {=# isExternalAuthEnabled =} diff --git a/waspc/data/Generator/templates/server/src/auth/providers/oauth/handler.ts b/waspc/data/Generator/templates/server/src/auth/providers/oauth/handler.ts index f91c3695a9..ec02cf5a67 100644 --- a/waspc/data/Generator/templates/server/src/auth/providers/oauth/handler.ts +++ b/waspc/data/Generator/templates/server/src/auth/providers/oauth/handler.ts @@ -19,10 +19,10 @@ import { loginPath, handleOAuthErrorAndGetRedirectUri, } from 'wasp/server/auth' -import { OAuthParams } from 'wasp/server/auth' +import { OAuthData } from 'wasp/server/auth' import { onBeforeOAuthRedirectHook } from '../../hooks.js' -export function createOAuthProviderRouter({ +export function createOAuthProviderRouter({ provider, oAuthType, userSignupFields, @@ -75,7 +75,7 @@ export function createOAuthProviderRouter { const providerId = createProviderId(provider.id, providerUserId); @@ -63,7 +63,7 @@ async function getAuthIdFromProviderDetails({ providerProfile: any; userSignupFields: UserSignupFields | undefined; req: ExpressRequest; - oauth: OAuthParams; + oauth: OAuthData; }): Promise<{= authEntityUpper =}['id']> { const existingAuthIdentity = await prisma.{= authIdentityEntityLower =}.findUnique({ where: { diff --git a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/.waspchecksums b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/.waspchecksums index 951721abae..7de1607838 100644 --- a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/.waspchecksums +++ b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/.waspchecksums @@ -529,14 +529,14 @@ "file", "../out/sdk/wasp/server/auth/hooks.ts" ], - "a0d64ca16b768ecbb915f06b791c494a9394620d43b51d5e358f3360a70f4ca2" + "ef60380f5a4aaa61027f7836e90ea5d7f394dc450e284db59c068274ec1de2c9" ], [ [ "file", "../out/sdk/wasp/server/auth/index.ts" ], - "af90f3647b7cfb74723b47d41da102866de34d280b935bf0bde9f498118328f3" + "9f932aba0d2ca6d1d2ff6fd826d238da3719b7676e7b42e97430af6f86fd03e2" ], [ [ @@ -942,7 +942,7 @@ "file", "server/src/auth/providers/oauth/handler.ts" ], - "f3f87eee8a2b6bc3848443b0eb90e0248375020fa75274962fd3809cf75ccd20" + "a8ce8d2b140a59e07d767cc640b9a2b0116e2dafc3ef98ae67fa7cdab3527416" ], [ [ @@ -970,7 +970,7 @@ "file", "server/src/auth/providers/oauth/user.ts" ], - "34a95373e90a2c6c8bb8a90afc3073fdd530010b44c5103d322e70bb4929b578" + "088acfe21e47d5a4a68faefa898c0174529e1b5a76dd86d32a0fce7d2a781f44" ], [ [ diff --git a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/hooks.d.ts b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/hooks.d.ts index d9df8bc098..866269e469 100644 --- a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/hooks.d.ts +++ b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/hooks.d.ts @@ -43,7 +43,7 @@ type OnAfterSignupHookParams = { * OAuth flow data that was generated during the OAuth flow. This is only * available if the user signed up using OAuth. */ - oauth?: OAuthParams; + oauth?: OAuthData; /** * Request object that can be used to access the incoming request. */ @@ -57,7 +57,7 @@ type OnBeforeOAuthRedirectHookParams = { /** * Unique request ID that was generated during the OAuth flow. */ - uniqueRequestId: OAuthParams['uniqueRequestId']; + oauth: Pick; /** * Request object that can be used to access the incoming request. */ @@ -86,13 +86,13 @@ type OnAfterLoginHookParams = { * OAuth flow data that was generated during the OAuth flow. This is only * available if the user logged in using OAuth. */ - oauth?: OAuthParams; + oauth?: OAuthData; /** * Request object that can be used to access the incoming request. */ req: ExpressRequest; } & InternalAuthHookParams; -export type OAuthParams = { +export type OAuthData = { /** * Unique request ID that was generated during the OAuth flow. */ diff --git a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/index.d.ts b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/index.d.ts index fe05a3a84c..d387a6172f 100644 --- a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/index.d.ts +++ b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/dist/server/auth/index.d.ts @@ -1,5 +1,5 @@ export { defineUserSignupFields, } from '../../auth/providers/types.js'; export { createProviderId, sanitizeAndSerializeProviderData, updateAuthIdentityProviderData, deserializeAndSanitizeProviderData, findAuthIdentity, createUser, type ProviderId, type ProviderName, type EmailProviderData, type UsernameProviderData, type OAuthProviderData, } from '../../auth/utils.js'; export { ensurePasswordIsPresent, ensureValidPassword, ensureTokenIsPresent, } from '../../auth/validation.js'; -export type { OnBeforeSignupHook, OnAfterSignupHook, OnBeforeOAuthRedirectHook, OnBeforeLoginHook, OnAfterLoginHook, InternalAuthHookParams, OAuthParams, } from './hooks.js'; +export type { OnBeforeSignupHook, OnAfterSignupHook, OnBeforeOAuthRedirectHook, OnBeforeLoginHook, OnAfterLoginHook, InternalAuthHookParams, OAuthData, } from './hooks.js'; export * from './oauth/index.js'; diff --git a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/hooks.ts b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/hooks.ts index 1e162bc88d..fa0f4c4d9c 100644 --- a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/hooks.ts +++ b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/hooks.ts @@ -2,7 +2,6 @@ import type { Request as ExpressRequest } from 'express' import { type ProviderId, createUser, findAuthWithUserBy } from '../../auth/utils.js' import { prisma } from '../index.js' import { Expand } from '../../universal/types.js' -import { ProviderName } from '../_types/index.js'; // PUBLIC API export type OnBeforeSignupHook = ( @@ -70,7 +69,7 @@ type OnAfterSignupHookParams = { * OAuth flow data that was generated during the OAuth flow. This is only * available if the user signed up using OAuth. */ - oauth?: OAuthParams + oauth?: OAuthData /** * Request object that can be used to access the incoming request. */ @@ -85,7 +84,7 @@ type OnBeforeOAuthRedirectHookParams = { /** * Unique request ID that was generated during the OAuth flow. */ - uniqueRequestId: OAuthParams['uniqueRequestId'] + oauth: Pick /** * Request object that can be used to access the incoming request. */ @@ -116,7 +115,7 @@ type OnAfterLoginHookParams = { * OAuth flow data that was generated during the OAuth flow. This is only * available if the user logged in using OAuth. */ - oauth?: OAuthParams + oauth?: OAuthData /** * Request object that can be used to access the incoming request. */ @@ -124,7 +123,7 @@ type OnAfterLoginHookParams = { } & InternalAuthHookParams // PRIVATE API (server) -export type OAuthParams = { +export type OAuthData = { /** * Unique request ID that was generated during the OAuth flow. */ diff --git a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/index.ts b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/index.ts index 9765ca98ba..117225dae7 100644 --- a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/index.ts +++ b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/sdk/wasp/server/auth/index.ts @@ -29,7 +29,7 @@ export type { OnBeforeLoginHook, OnAfterLoginHook, InternalAuthHookParams, - OAuthParams, + OAuthData, } from './hooks.js' export * from './oauth/index.js' diff --git a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/server/src/auth/providers/oauth/handler.ts b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/server/src/auth/providers/oauth/handler.ts index f91c3695a9..ec02cf5a67 100644 --- a/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/server/src/auth/providers/oauth/handler.ts +++ b/waspc/e2e-test/test-outputs/waspComplexTest-golden/waspComplexTest/.wasp/out/server/src/auth/providers/oauth/handler.ts @@ -19,10 +19,10 @@ import { loginPath, handleOAuthErrorAndGetRedirectUri, } from 'wasp/server/auth' -import { OAuthParams } from 'wasp/server/auth' +import { OAuthData } from 'wasp/server/auth' import { onBeforeOAuthRedirectHook } from '../../hooks.js' -export function createOAuthProviderRouter({ +export function createOAuthProviderRouter({ provider, oAuthType, userSignupFields, @@ -75,7 +75,7 @@ export function createOAuthProviderRouter { const providerId = createProviderId(provider.id, providerUserId); @@ -62,7 +62,7 @@ async function getAuthIdFromProviderDetails({ providerProfile: any; userSignupFields: UserSignupFields | undefined; req: ExpressRequest; - oauth: OAuthParams; + oauth: OAuthData; }): Promise { const existingAuthIdentity = await prisma.authIdentity.findUnique({ where: { diff --git a/waspc/examples/todoApp/src/auth/hooks.ts b/waspc/examples/todoApp/src/auth/hooks.ts index e245940e32..8e4e6612a2 100644 --- a/waspc/examples/todoApp/src/auth/hooks.ts +++ b/waspc/examples/todoApp/src/auth/hooks.ts @@ -43,7 +43,7 @@ export const onBeforeOAuthRedirect: OnBeforeOAuthRedirectHook = async ( log('query params before oAuth redirect', args.req.query) // Saving query params for later use in onAfterSignup hook - const id = args.uniqueRequestId + const id = args.oauth.uniqueRequestId oAuthQueryStore.set(id, args.req.query) return { url: args.url }