-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement new wasp/server/email API #1701
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions
4
waspc/data/Generator/templates/sdk/server/auth/email/utils.ts
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,6 +1,7 @@ | ||
{{={= =}=}} | ||
import { EmailFromField } from "wasp/email/core/types"; | ||
import { EmailFromField } from "./types"; | ||
|
||
// PRIVATE API | ||
// Formats an email address and an optional name into a string that can be used | ||
// as the "from" field in an email. | ||
// { email: "test@test.com, name: "Test" } -> "Test <[email protected]>" | ||
|
@@ -18,6 +19,7 @@ export function formatFromField({ | |
} | ||
|
||
{=# isDefaultFromFieldDefined =} | ||
// PRIVATE API | ||
export function getDefaultFromField(): EmailFromField { | ||
return { | ||
email: "{= defaultFromField.email =}", | ||
|
@@ -28,6 +30,7 @@ export function getDefaultFromField(): EmailFromField { | |
} | ||
{=/ isDefaultFromFieldDefined =} | ||
{=^ isDefaultFromFieldDefined =} | ||
// PRIVATE API | ||
export function getDefaultFromField(): EmailFromField { | ||
return { | ||
email: "", | ||
|
4 changes: 4 additions & 0 deletions
4
...nerator/templates/sdk/email/core/index.ts → .../templates/sdk/server/email/core/index.ts
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,13 +1,17 @@ | ||
{{={= =}=}} | ||
{=# isSmtpProviderUsed =} | ||
// PRIVATE API | ||
export { initSmtpEmailSender as initEmailSender } from "./providers/smtp.js"; | ||
{=/ isSmtpProviderUsed =} | ||
{=# isSendGridProviderUsed =} | ||
// PRIVATE API | ||
export { initSendGridEmailSender as initEmailSender } from "./providers/sendgrid.js"; | ||
{=/ isSendGridProviderUsed =} | ||
{=# isMailgunProviderUsed =} | ||
// PRIVATE API | ||
export { initMailgunEmailSender as initEmailSender } from "./providers/mailgun.js"; | ||
{=/ isMailgunProviderUsed =} | ||
{=# isDummyProviderUsed =} | ||
// PRIVATE API | ||
export { initDummyEmailSender as initEmailSender } from "./providers/dummy.js"; | ||
{=/ isDummyProviderUsed =} |
3 changes: 2 additions & 1 deletion
3
...mplates/sdk/email/core/providers/dummy.ts → .../sdk/server/email/core/providers/dummy.ts
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
3 changes: 2 additions & 1 deletion
3
...lates/sdk/email/core/providers/mailgun.ts → ...dk/server/email/core/providers/mailgun.ts
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
3 changes: 2 additions & 1 deletion
3
...ates/sdk/email/core/providers/sendgrid.ts → ...k/server/email/core/providers/sendgrid.ts
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
3 changes: 2 additions & 1 deletion
3
...emplates/sdk/email/core/providers/smtp.ts → ...s/sdk/server/email/core/providers/smtp.ts
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
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
2 changes: 1 addition & 1 deletion
2
waspc/data/Generator/templates/server/src/auth/providers/email/signup.ts
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
4 changes: 1 addition & 3 deletions
4
waspc/examples/todo-typescript/.wasp/out/sdk/wasp/auth/utils.ts
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
2 changes: 1 addition & 1 deletion
2
waspc/examples/todo-typescript/.wasp/out/sdk/wasp/auth/validation.ts
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
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
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,4 +1,4 @@ | ||
module Wasp.Generator.SdkGenerator.EmailSenderG where | ||
module Wasp.Generator.SdkGenerator.Server.EmailSenderG where | ||
|
||
import Data.Aeson (object, (.=)) | ||
import qualified Data.Aeson as Aeson | ||
|
@@ -17,8 +17,8 @@ import qualified Wasp.Generator.SdkGenerator.Common as C | |
import qualified Wasp.Generator.SdkGenerator.EmailSender.Providers as Providers | ||
import Wasp.Util ((<++>)) | ||
|
||
genEmailSender :: AppSpec -> Generator [FileDraft] | ||
genEmailSender spec = case maybeEmailSender of | ||
genNewEmailSenderApi :: AppSpec -> Generator [FileDraft] | ||
genNewEmailSenderApi spec = case maybeEmailSender of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why |
||
Just emailSender -> | ||
sequence | ||
[ genIndex emailSender | ||
|
@@ -31,7 +31,7 @@ genEmailSender spec = case maybeEmailSender of | |
genIndex :: EmailSender -> Generator FileDraft | ||
genIndex email = return $ C.mkTmplFdWithData tmplPath tmplData | ||
where | ||
tmplPath = [relfile|email/index.ts|] | ||
tmplPath = [relfile|server/email/index.ts|] | ||
tmplData = getEmailProvidersJson email | ||
|
||
genCore :: EmailSender -> Generator [FileDraft] | ||
|
@@ -46,13 +46,13 @@ genCore email = | |
genCoreIndex :: EmailSender -> Generator FileDraft | ||
genCoreIndex email = return $ C.mkTmplFdWithData tmplPath tmplData | ||
where | ||
tmplPath = [relfile|email/core/index.ts|] | ||
tmplPath = [relfile|server/email/core/index.ts|] | ||
tmplData = getEmailProvidersJson email | ||
|
||
genCoreTypes :: EmailSender -> Generator FileDraft | ||
genCoreTypes email = return $ C.mkTmplFdWithData tmplPath tmplData | ||
where | ||
tmplPath = [relfile|email/core/types.ts|] | ||
tmplPath = [relfile|server/email/core/types.ts|] | ||
tmplData = | ||
object ["isDefaultFromFieldDefined" .= isDefaultFromFieldDefined] | ||
isDefaultFromFieldDefined = isJust defaultFromField | ||
|
@@ -61,7 +61,7 @@ genCoreTypes email = return $ C.mkTmplFdWithData tmplPath tmplData | |
genCoreHelpers :: EmailSender -> Generator FileDraft | ||
genCoreHelpers email = return $ C.mkTmplFdWithData tmplPath tmplData | ||
where | ||
tmplPath = [relfile|email/core/helpers.ts|] | ||
tmplPath = [relfile|server/email/core/helpers.ts|] | ||
tmplData = | ||
object | ||
[ "defaultFromField" | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you know we still need these, it is maybe best if you move it below to section "still needed, reconsider during refactoring."? No need to do it now, just idea for future PRs.