From 405dfd778ab4fdcb00e619bdd4baec611536e3aa Mon Sep 17 00:00:00 2001 From: vnugent Date: Tue, 1 Aug 2023 18:39:02 -0400 Subject: Latest updates, build configurations, and native compression --- .gitignore | 9 +- Module.Taskfile.yaml | 68 +++++ README.md | 10 +- Taskfile.yaml | 75 +++++ emails.transactional.build.sln | 49 ++++ .../src/Emails.Transactional.Client.xml | 311 --------------------- .../src/Api Endpoints/SendEndpoint.cs | 2 +- 7 files changed, 202 insertions(+), 322 deletions(-) create mode 100644 Module.Taskfile.yaml create mode 100644 Taskfile.yaml create mode 100644 emails.transactional.build.sln delete mode 100644 lib/Emails.Transactional.Client/src/Emails.Transactional.Client.xml diff --git a/.gitignore b/.gitignore index 33f007f..63641d6 100644 --- a/.gitignore +++ b/.gitignore @@ -472,12 +472,5 @@ FodyWeavers.xsd # Additional files built by Visual Studio # End of https://www.toptal.com/developers/gitignore/api/c,c++,visualstudio -/VNLib.Utils -*.json -*.sln - -/.task/checksum -*[Tt]askfile.* - -*.ps1 \ No newline at end of file +*.json \ No newline at end of file diff --git a/Module.Taskfile.yaml b/Module.Taskfile.yaml new file mode 100644 index 0000000..d729ea3 --- /dev/null +++ b/Module.Taskfile.yaml @@ -0,0 +1,68 @@ +# https://taskfile.dev + +#Called by the vnbuild system to produce builds for my website +#https://www.vaughnnugent.com/resources/software + +#This taskfile performs the build operations for a module, it handles +#git code updates, msbuild on solutions, and sleet NuGet feed pushes. + +#this file must be in the same directory as the solution file + +version: '3' + +vars: + INT_DIR: '{{.SCRATCH_DIR}}/obj/{{.MODULE_NAME}}/' + MS_ARGS: '/p:RunAnalyzersDuringBuild=false /p:IntermediateOutputPath="{{.INT_DIR}}" /p:UseCommonOutputDirectory=true /p:BuildInParallel=true /p:MultiProcessorCompilation=true' + PACK_OUT: '{{.OUTPUT_DIR}}/{{.HEAD_SHA}}/pkg' + +tasks: + +#called by build pipeline to sync repo + update: + cmds: + - git remote update + - git reset --hard + - git pull origin {{.BRANCH_NAME}} --verify-signatures + +#called by build pipeline to build module + build: + cmds: + - echo "building module {{.MODULE_NAME}}" + + #re-write semver after hard reset, before build + - dotnet-gitversion.exe /updateprojectfiles + + #build debug mode first + - task: build_debug + - task: build_release + + postbuild_success: + cmds: + #push packages to the sleet feed (feed path is vnbuild global) + - sleet push "{{.PACK_OUT}}/debug/" --source debug --config "{{.SLEET_CONFIG_PATH}}" --force + - sleet push "{{.PACK_OUT}}/release/" --source release --config "{{.SLEET_CONFIG_PATH}}" --force + + postbuild_failed: + cmds: + - echo "postbuild failed {{.MODULE_NAME}}" + +#called by build pipeline to clean module + clean: + cmds: + #clean solution + - dotnet clean /p:BuildInParallel=true /p:MultiProcessorCompilation=true + + +#Internal tasks + build_debug: + internal: true + cmds: + - dotnet publish -c debug {{.MS_ARGS}} + - dotnet pack -c debug {{.MS_ARGS}} -o "{{.PACK_OUT}}/debug/" + + build_release: + internal: true + cmds: + - dotnet publish -c release {{.MS_ARGS}} + - dotnet pack -c release {{.MS_ARGS}} -o "{{.PACK_OUT}}/release/" + \ No newline at end of file diff --git a/README.md b/README.md index dae0c07..1051ca7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,14 @@ # Emails.Transactional *A collection of libraries for building and using a transactional email service, with OAuth2 authentication* -#### Builds -Debug build w/ symbols & xml docs, release builds, NuGet packages, and individually packaged source code are available on my [website](https://www.vaughnnugent.com/resources/software). All tar-gzip (.tgz) files will have an associated .sha384 appended checksum of the desired download file. +## Builds +Debug build w/ symbols & xml docs, release builds, NuGet packages, and individually packaged source code are available on my website (link below). All tar-gzip (.tgz) files will have an associated .sha256 appended checksum of the desired download file. + +## Docs and Guides +Documentation, specifications, and setup guides are available on my website. + +[Docs and Articles](https://www.vaughnnugent.com/resources/software/articles?tags=docs,_emails.transactional) +[Builds and Source](https://www.vaughnnugent.com/resources/software/modules/VNLib.Core) ## License All source files in this repository is licensed under the GNU Affero General Public License (or any later version). See the LICENSE files for more information. \ No newline at end of file diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..b16b082 --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,75 @@ +# https://taskfile.dev + +#Called by the vnbuild system to produce builds for my website +#https://www.vaughnnugent.com/resources/software + +#This taskfile is called from the root of a project that is being built +#and the purpose of this taskfile is to package up the output of a build +#from the solution file, and package it up into a tgz files for distribution + +version: '3' + +vars: + TARGET: '{{.USER_WORKING_DIR}}/bin' + RELEASE_DIR: "./bin/release/{{.TARGET_FRAMEWORK}}/publish" + SOURCE_OUT: "{{.USER_WORKING_DIR}}/bin/source" + +tasks: + + #when build succeeds, archive the output into a tgz + postbuild_success: + dir: '{{.USER_WORKING_DIR}}' + cmds: + #pack up source code + - task: packsource + + #run post in debug mode + - task: postbuild + vars: { BUILD_MODE: debug } + + #remove uncessary files from the release dir + - powershell -Command "Get-ChildItem -Recurse '{{.RELEASE_DIR}}/' -Include *.pdb,*.xml | Remove-Item" + + #run post in release mode + - task: postbuild + vars: { BUILD_MODE: release } + + + postbuild_failed: + dir: '{{.USER_WORKING_DIR}}' + cmds: + - echo "postbuild failed {{.PROJECT_NAME}}" + + + postbuild: + dir: '{{.USER_WORKING_DIR}}' + internal: true + vars: + #the build output directory + BUILD_OUT: "{{.USER_WORKING_DIR}}/bin/{{.BUILD_MODE}}/{{.TARGET_FRAMEWORK}}/publish" + + cmds: + + #copy license and readme to target + - cd .. && powershell -Command "Copy-Item -Path ./LICENSE.txt -Destination '{{.BUILD_OUT}}/license.txt'" + - cd .. && powershell -Command "Copy-Item -Path ./build.readme.md -Destination '{{.BUILD_OUT}}/readme.md'" + + #tar outputs + - cd "{{.BUILD_OUT}}" && tar -czf "{{.TARGET}}/{{.BUILD_MODE}}.tgz" . + + packsource: + dir: '{{.USER_WORKING_DIR}}' + internal: true + cmds: + #copy source code to target + - powershell -Command "Get-ChildItem -Include *.cs,*.csproj -Recurse | Where { \$_.FullName -notlike '*\obj\*' -and \$_.FullName -notlike '*\bin\*' } | Resolve-Path -Relative | tar --files-from - -czf '{{.TARGET}}/src.tgz'" + + +#Remove the output dirs on clean + clean: + dir: '{{.USER_WORKING_DIR}}' + cmds: + - cmd: powershell Remove-Item -Recurse './bin' + ignore_error: true + - cmd: powershell Remove-Item -Recurse './obj' + ignore_error: true diff --git a/emails.transactional.build.sln b/emails.transactional.build.sln new file mode 100644 index 0000000..3fd2b99 --- /dev/null +++ b/emails.transactional.build.sln @@ -0,0 +1,49 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emails.Transactional.Client", "lib\Emails.Transactional.Client\src\Emails.Transactional.Client.csproj", "{A13E6674-10A6-44FC-AEA2-A56A1ABBB3BF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Emails.Transactional.Client.Extensions", "lib\Emails.Transactional.Extensions\src\Emails.Transactional.Client.Extensions.csproj", "{260663D6-4BFA-40B3-9701-9F06DC1122D9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Transactional Emails", "lib\Emails.Transactional.Plugin\src\Transactional Emails.csproj", "{462870DE-6AAC-44D7-B236-8AB8880CA9E1}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2D8E6F6E-6E65-41FF-A556-A8BED246003C}" + ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + .onedev-buildspec.yml = .onedev-buildspec.yml + GitVersion.yml = GitVersion.yml + LICENSE.txt = LICENSE.txt + Module.Taskfile.yaml = Module.Taskfile.yaml + README.md = README.md + Taskfile.yaml = Taskfile.yaml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A13E6674-10A6-44FC-AEA2-A56A1ABBB3BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A13E6674-10A6-44FC-AEA2-A56A1ABBB3BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A13E6674-10A6-44FC-AEA2-A56A1ABBB3BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A13E6674-10A6-44FC-AEA2-A56A1ABBB3BF}.Release|Any CPU.Build.0 = Release|Any CPU + {260663D6-4BFA-40B3-9701-9F06DC1122D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {260663D6-4BFA-40B3-9701-9F06DC1122D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {260663D6-4BFA-40B3-9701-9F06DC1122D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {260663D6-4BFA-40B3-9701-9F06DC1122D9}.Release|Any CPU.Build.0 = Release|Any CPU + {462870DE-6AAC-44D7-B236-8AB8880CA9E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {462870DE-6AAC-44D7-B236-8AB8880CA9E1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {462870DE-6AAC-44D7-B236-8AB8880CA9E1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {462870DE-6AAC-44D7-B236-8AB8880CA9E1}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {139ECCF9-D50B-4AC3-88FD-664BCB3DBB86} + EndGlobalSection +EndGlobal diff --git a/lib/Emails.Transactional.Client/src/Emails.Transactional.Client.xml b/lib/Emails.Transactional.Client/src/Emails.Transactional.Client.xml deleted file mode 100644 index a69734e..0000000 --- a/lib/Emails.Transactional.Client/src/Emails.Transactional.Client.xml +++ /dev/null @@ -1,311 +0,0 @@ - - - - - Emails.Transactional.Client - - - - - Contains extension methods to send emails on remote transational email servers - - - - - Asynchronously begins an email transaction against the mail server with the specified - transaction request. - - - The to submit - A cancelaion token to cancel the operation - A task that represents the async send operation - - - - - - - - A transactional email request to send an email - template. - - - - - The transactional send endpoint address - - - - - A dictionary of email addresses/names of - users to send this email to - - - - - A dictionary of email addresses/names of - users to carbon copy this email to - - - - - A dictionary of email addresses/names of - users to blind carbon copy this email to - - - - - A dictionary of variables to substitute into the liquid - email template - - - - - The subject of the email to send - - - - - The unique id of the email template to send - - - - - The system from email name. NOTE: This is a protected value - - - - - The system from email address. NOTE: This is a protected value - - - - - Creates a new email transaction with the specified email template to send - - The id of the template to send - - - - - Creates a new email transaction with the specified email template - and a single recipient - - The id of the template to send - A singular recipient name - A singlular recipient email address - - - - - Adds a recipient to the To email address dictionary - - The name of the user to send the email to - The unique email address of the user to add to the recipient collection - - - - Adds a recipient to the To email address dictionary - - The unique email address of the user to add to the recipient collection - - - - Adds a carbon copy recipient to the current cc dictionary - - The name of the recipient - The unique email address of the bcc recipient - - - - Adds a blind carbon copy recipient to the current bcc dictionary - - The name of the recipient - The unique email address of the bcc recipient - - - - Adds a liquid template variable to be subsituted by the template - renderer. - - The unique name of the variable to add to the collection - The value if the variable that will be substituted into the template - - - - A excption raised when an Authorization error occured - during a request - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Raised when the results of an email transaction - failed. Inner exceptions may be set - - - - - An error message received from the client - - - - - - - - - - - - - - Initializes a new with - the response that contains the error - - The base exception message - The response that caused the error - - - - A base exception for all client transaction excepions - - - - - - - - - - - - - - - - - The response objec that caused the exception - - - - - The string represenation of the response body - - - - - Raised when server message validation failed - - - - - - - - - - - - - - - - - A collection of validaion error messages - - - - - - - - - - - A global configuration object for transactional email clients - - - - - The server transaction endpoint location - - - - - An email id template/translation table for email template-ids - - - - - Adds the mail service location to the current instance - - The address of the remote server transaction endpoint - A referrence to the current object (fluent api) - - - - - Sets the template lookup table for the current instance - - The template-id lookup table to referrence - A referrence to the current object (fluent api) - - - - - Gets a new from the specifed - template name. - - - - - - - - - A JSON serializable object that contains the results of the transaction - - - - - A json serializable server validaion error - - - - - The name of the propery that was invalid - - - - - The message that - - - - diff --git a/lib/Emails.Transactional.Plugin/src/Api Endpoints/SendEndpoint.cs b/lib/Emails.Transactional.Plugin/src/Api Endpoints/SendEndpoint.cs index 16c0d9a..1ce6acf 100644 --- a/lib/Emails.Transactional.Plugin/src/Api Endpoints/SendEndpoint.cs +++ b/lib/Emails.Transactional.Plugin/src/Api Endpoints/SendEndpoint.cs @@ -277,7 +277,7 @@ namespace Emails.Transactional.Endpoints transaction.Result = ex.Message; } //Write transaction to db (we need to return the transaction id) - _ = await Transactions.AddOrUpdateAsync(transaction); + _ = await Transactions.AddOrUpdateAsync(transaction, entity.EventCancellation); //Store the results object webm.SmtpStatus = transaction.Result; webm.TransactionId = transaction.Id; -- cgit