diff --git a/.dotfiles b/.dotfiles index dfafa80f..ec9bc762 160000 --- a/.dotfiles +++ b/.dotfiles @@ -1 +1 @@ -Subproject commit dfafa80fb3289d55c5589c25bb6e29c0f01e49e6 +Subproject commit ec9bc762fe9f4a14eee111d5ae65f02dab540b0b diff --git a/Backend/Package.resolved b/Backend/Package.resolved index 0f19797f..50cfb276 100644 --- a/Backend/Package.resolved +++ b/Backend/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "6358cd7e5e3410ca6c9d19012b8158d9f3dc14e07492356093c18fab54de132e", + "originHash" : "fd696153ea81efb825467272117f6b70b5b5fa52dfde9a8035d412d86626d6d3", "pins" : [ { "identity" : "alamofire", @@ -447,8 +447,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/vapor.git", "state" : { - "revision" : "87b0edd2633c35de543cb7573efe5fbf456181bc", - "version" : "4.114.1" + "revision" : "3636f443474769147828a5863e81a31f6f30e92c", + "version" : "4.115.1" } }, { diff --git a/Backend/Package.swift b/Backend/Package.swift index 16efb00d..513ce437 100644 --- a/Backend/Package.swift +++ b/Backend/Package.swift @@ -31,6 +31,7 @@ public let package = Package( .package(url: "https://github.com/nmdias/FeedKit.git", from: "10.0.0-rc.3"), .package(url: "https://github.com/GetAutomaApp/swift-retry.git", branch: "main"), .package(url: "https://github.com/GetAutomaApp/Fakery", branch: "master"), + .package(name: "automa-utilities", path: "../../AutomaUtilities"), ], targets: [ .executableTarget( @@ -53,6 +54,7 @@ public let package = Package( .product(name: "SotoTextract", package: "soto"), .product(name: "FeedKit", package: "FeedKit"), .product(name: "DMRetry", package: "swift-retry"), + .product(name: "automa-utilities", package: "AutomaUtilities"), ], exclude: [ "Documentation.md", diff --git a/Backend/Sources/App/Clients/ChatCompletionClient/OpenAIChatCompletionClient/OpenAIChatCompletionClient.swift b/Backend/Sources/App/Clients/ChatCompletionClient/OpenAIChatCompletionClient/OpenAIChatCompletionClient.swift index 30a18d34..c26aae9a 100644 --- a/Backend/Sources/App/Clients/ChatCompletionClient/OpenAIChatCompletionClient/OpenAIChatCompletionClient.swift +++ b/Backend/Sources/App/Clients/ChatCompletionClient/OpenAIChatCompletionClient/OpenAIChatCompletionClient.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import OpenAI import Retry import Vapor diff --git a/Backend/Sources/App/Clients/FirecrawlClient/FirecrawlClient.swift b/Backend/Sources/App/Clients/FirecrawlClient/FirecrawlClient.swift index 902dc9be..b1c42460 100644 --- a/Backend/Sources/App/Clients/FirecrawlClient/FirecrawlClient.swift +++ b/Backend/Sources/App/Clients/FirecrawlClient/FirecrawlClient.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import DataTypes import Vapor diff --git a/Backend/Sources/App/Clients/TwitterClient/TwitterClient.swift b/Backend/Sources/App/Clients/TwitterClient/TwitterClient.swift index 8a074e57..c62dfa31 100644 --- a/Backend/Sources/App/Clients/TwitterClient/TwitterClient.swift +++ b/Backend/Sources/App/Clients/TwitterClient/TwitterClient.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import DataTypes import Fluent import Foundation diff --git a/Backend/Sources/App/Controllers/PrometheusController/PrometheusController.swift b/Backend/Sources/App/Controllers/PrometheusController/PrometheusController.swift index 46ce535e..44a0ce1f 100644 --- a/Backend/Sources/App/Controllers/PrometheusController/PrometheusController.swift +++ b/Backend/Sources/App/Controllers/PrometheusController/PrometheusController.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import Fluent import Prometheus import Vapor diff --git a/Backend/Sources/App/Extensions/Vapor/EnvironmentExtensions.swift b/Backend/Sources/App/Extensions/Vapor/EnvironmentExtensions.swift deleted file mode 100644 index 5174bd2d..00000000 --- a/Backend/Sources/App/Extensions/Vapor/EnvironmentExtensions.swift +++ /dev/null @@ -1,18 +0,0 @@ -// EnvironmentExtensions.swift -// Copyright (c) 2025 GetAutomaApp -// All source code and related assets are the property of GetAutomaApp. -// All rights reserved. - -import Vapor - -/// Extension to throw error if we can't find an env value -internal extension Environment { - /// Extension to throw error if we can't find an env value - static func getOrThrow(_ key: String) throws -> String { - guard let value = Environment.get(key) else { - throw Abort(.notFound, reason: "Value for key \(key) not found") - } - - return value - } -} diff --git a/Backend/Sources/App/Middleware/TestControllerMiddleware.swift b/Backend/Sources/App/Middleware/TestControllerMiddleware.swift index c6464122..b99fb3c6 100644 --- a/Backend/Sources/App/Middleware/TestControllerMiddleware.swift +++ b/Backend/Sources/App/Middleware/TestControllerMiddleware.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import DataTypes import Vapor diff --git a/Backend/Sources/App/Services/AuthenticationService/AuthenticationServiceHelper.swift b/Backend/Sources/App/Services/AuthenticationService/AuthenticationServiceHelper.swift index 36eb6305..571a9338 100644 --- a/Backend/Sources/App/Services/AuthenticationService/AuthenticationServiceHelper.swift +++ b/Backend/Sources/App/Services/AuthenticationService/AuthenticationServiceHelper.swift @@ -3,6 +3,7 @@ /// All source code and related assets are the property of GetAutomaApp. /// All rights reserved. +import AutomaUtilities import DataTypes import Fluent import JWT @@ -128,9 +129,9 @@ internal actor AuthenticationServiceHelper { internal struct AuthenticationServiceHelperConfig: AuthenticationServiceConfig { /// Db Connection w/ Write access public let writeDb: Database - /// Db Connection w/ Read-Only access + /// Db Connection w/ Read-Only access public let readDb: Database - /// Logger + /// Logger public let logger: Logger } @@ -406,7 +407,7 @@ internal struct DeleteOldAccessTokensPayload { /// ASC on date how many tokens to skip public let totalNewestTokensToSkip: Int? - /// init + /// init public init( userId: UUID, subject: JWTTokenSubject, diff --git a/Backend/Sources/App/Services/MessageService/MessageService.swift b/Backend/Sources/App/Services/MessageService/MessageService.swift index 66c39b77..dc271ad0 100644 --- a/Backend/Sources/App/Services/MessageService/MessageService.swift +++ b/Backend/Sources/App/Services/MessageService/MessageService.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import DataTypes import Fluent import Foundation diff --git a/Backend/Sources/App/Services/ProfilePictureService/ProfilePictureService.swift b/Backend/Sources/App/Services/ProfilePictureService/ProfilePictureService.swift index 14d5c072..b3dd726a 100644 --- a/Backend/Sources/App/Services/ProfilePictureService/ProfilePictureService.swift +++ b/Backend/Sources/App/Services/ProfilePictureService/ProfilePictureService.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import DataTypes import Fluent import OpenAI diff --git a/Backend/Sources/App/Services/TigrisService/TigrisService.swift b/Backend/Sources/App/Services/TigrisService/TigrisService.swift index c3fc0ea9..4298037b 100644 --- a/Backend/Sources/App/Services/TigrisService/TigrisService.swift +++ b/Backend/Sources/App/Services/TigrisService/TigrisService.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import DataTypes import Fluent import SotoS3 diff --git a/Backend/Sources/App/configure.swift b/Backend/Sources/App/configure.swift index 49e1f8b0..4fb9ab64 100644 --- a/Backend/Sources/App/configure.swift +++ b/Backend/Sources/App/configure.swift @@ -3,6 +3,7 @@ // All source code and related assets are the property of GetAutomaApp. // All rights reserved. +import AutomaUtilities import Fluent import FluentPostgresDriver import JWT @@ -202,8 +203,8 @@ public struct DatabaseSeeder { } internal enum DatabaseURLs { - /// primary database url has read & write access - public static let primary: Result = Result { try Environment.getOrThrow("PRIMARY_POSTGRES_URL") } - /// regional url most likely doesn't have write access, but allows for extremely fast reads - public static let regional: Result = Result { try Environment.getOrThrow("REGIONAL_POSTGRES_URL") } + /// primary database url has read & write access + public static let primary: Result = Result { try Environment.getOrThrow("PRIMARY_POSTGRES_URL") } + /// regional url most likely doesn't have write access, but allows for extremely fast reads + public static let regional: Result = Result { try Environment.getOrThrow("REGIONAL_POSTGRES_URL") } } diff --git a/Backend/Tests/AppTests/Clients/TwitterClientTests/TwitterAuthenticatedClientIntegrationTests.swift b/Backend/Tests/AppTests/Clients/TwitterClientTests/TwitterAuthenticatedClientIntegrationTests.swift index 9b17babc..5a56df27 100644 --- a/Backend/Tests/AppTests/Clients/TwitterClientTests/TwitterAuthenticatedClientIntegrationTests.swift +++ b/Backend/Tests/AppTests/Clients/TwitterClientTests/TwitterAuthenticatedClientIntegrationTests.swift @@ -4,6 +4,7 @@ // All rights reserved. @testable import App +import AutomaUtilities import Fakery import Fluent import Testing @@ -13,7 +14,7 @@ import VaporTesting /// These tests verify that operations requiring user authentication work correctly extension SerialDbTestSuites { @Suite("TwitterAuthenticatedClientIntegrationTests") - internal struct TwitterAuthenticatedClientIntegrationTests: TwitterClientTestSuite { + struct TwitterAuthenticatedClientIntegrationTests: TwitterClientTestSuite { /// Tests the ability to post a tweet using an authenticated Twitter client /// This test verifies that: /// - A valid Twitter user token can be retrieved from the database diff --git a/Backend/Tests/AppTests/Controllers/PrometheusControllerTests/PrometheusControllerIntegrationTests.swift b/Backend/Tests/AppTests/Controllers/PrometheusControllerTests/PrometheusControllerIntegrationTests.swift index 4d12327c..86504856 100644 --- a/Backend/Tests/AppTests/Controllers/PrometheusControllerTests/PrometheusControllerIntegrationTests.swift +++ b/Backend/Tests/AppTests/Controllers/PrometheusControllerTests/PrometheusControllerIntegrationTests.swift @@ -4,6 +4,7 @@ // All rights reserved. @testable import App +import AutomaUtilities import Testing import VaporTesting