Skip to content

Commit

Permalink
Remove gqlSuffix from creatAuth (#4968)
Browse files Browse the repository at this point in the history
  • Loading branch information
timleslie authored Mar 1, 2021
1 parent 0d0649d commit 9ea0328
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .changeset/green-cooks-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@keystone-next/auth': major
---

Removed `gqlSuffix` config option from `createAuth()`.
37 changes: 18 additions & 19 deletions packages-next/auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,30 @@ export function createAuth<GeneratedListTypes extends BaseGeneratedListTypes>({
listKey,
secretField,
protectIdentities = true,
gqlSuffix = '',
initFirstItem,
identityField,
magicAuthLink,
passwordResetLink,
}: AuthConfig<GeneratedListTypes>): Auth {
const gqlNames: AuthGqlNames = {
CreateInitialInput: `CreateInitial${listKey}Input${gqlSuffix}`,
createInitialItem: `createInitial${listKey}${gqlSuffix}`,
authenticateItemWithPassword: `authenticate${listKey}WithPassword${gqlSuffix}`,
ItemAuthenticationWithPasswordResult: `${listKey}AuthenticationWithPasswordResult${gqlSuffix}`,
ItemAuthenticationWithPasswordSuccess: `${listKey}AuthenticationWithPasswordSuccess${gqlSuffix}`,
ItemAuthenticationWithPasswordFailure: `${listKey}AuthenticationWithPasswordFailure${gqlSuffix}`,
sendItemPasswordResetLink: `send${listKey}PasswordResetLink${gqlSuffix}`,
SendItemPasswordResetLinkResult: `Send${listKey}PasswordResetLinkResult${gqlSuffix}`,
validateItemPasswordResetToken: `validate${listKey}PasswordResetToken${gqlSuffix}`,
ValidateItemPasswordResetTokenResult: `Validate${listKey}PasswordResetTokenResult${gqlSuffix}`,
redeemItemPasswordResetToken: `redeem${listKey}PasswordResetToken${gqlSuffix}`,
RedeemItemPasswordResetTokenResult: `Redeem${listKey}PasswordResetTokenResult${gqlSuffix}`,
sendItemMagicAuthLink: `send${listKey}MagicAuthLink${gqlSuffix}`,
SendItemMagicAuthLinkResult: `Send${listKey}MagicAuthLinkResult${gqlSuffix}`,
redeemItemMagicAuthToken: `redeem${listKey}MagicAuthToken${gqlSuffix}`,
RedeemItemMagicAuthTokenResult: `Redeem${listKey}MagicAuthTokenResult${gqlSuffix}`,
RedeemItemMagicAuthTokenSuccess: `Redeem${listKey}MagicAuthTokenSuccess${gqlSuffix}`,
RedeemItemMagicAuthTokenFailure: `Redeem${listKey}MagicAuthTokenFailure${gqlSuffix}`,
CreateInitialInput: `CreateInitial${listKey}Input`,
createInitialItem: `createInitial${listKey}`,
authenticateItemWithPassword: `authenticate${listKey}WithPassword`,
ItemAuthenticationWithPasswordResult: `${listKey}AuthenticationWithPasswordResult`,
ItemAuthenticationWithPasswordSuccess: `${listKey}AuthenticationWithPasswordSuccess`,
ItemAuthenticationWithPasswordFailure: `${listKey}AuthenticationWithPasswordFailure`,
sendItemPasswordResetLink: `send${listKey}PasswordResetLink`,
SendItemPasswordResetLinkResult: `Send${listKey}PasswordResetLinkResult`,
validateItemPasswordResetToken: `validate${listKey}PasswordResetToken`,
ValidateItemPasswordResetTokenResult: `Validate${listKey}PasswordResetTokenResult`,
redeemItemPasswordResetToken: `redeem${listKey}PasswordResetToken`,
RedeemItemPasswordResetTokenResult: `Redeem${listKey}PasswordResetTokenResult`,
sendItemMagicAuthLink: `send${listKey}MagicAuthLink`,
SendItemMagicAuthLinkResult: `Send${listKey}MagicAuthLinkResult`,
redeemItemMagicAuthToken: `redeem${listKey}MagicAuthToken`,
RedeemItemMagicAuthTokenResult: `Redeem${listKey}MagicAuthTokenResult`,
RedeemItemMagicAuthTokenSuccess: `Redeem${listKey}MagicAuthTokenSuccess`,
RedeemItemMagicAuthTokenFailure: `Redeem${listKey}MagicAuthTokenFailure`,
};

// Fields added to the auth list
Expand Down
2 changes: 0 additions & 2 deletions packages-next/auth/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ export type AuthConfig<GeneratedListTypes extends BaseGeneratedListTypes> = {
/** Extra input to add for the create mutation */
itemData?: Partial<GeneratedListTypes['inputs']['create']>;
};
/** A string added GraphQL names created by this package; can be used to support multiple sets of auth functionality */
gqlSuffix?: string;
};

export type Auth = {
Expand Down

1 comment on commit 9ea0328

@vercel
Copy link

@vercel vercel bot commented on 9ea0328 Mar 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.