-
-
Notifications
You must be signed in to change notification settings - Fork 176
refactor: audit phase 0, 1, 2, 3, 5, 6 foundations #1117
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1ff9774
refactor: phase 0+1 audit fixes — regex safety, dynamic type, a11y
datlechin 95bb688
fix: persist before sync notify in SSHProfileStorage and TagStorage
datlechin 7a01406
refactor: typed AppEvents publishers replace 2 NotificationCenter bro…
datlechin 9408747
refactor: AppServices DI container with QuickSwitcherViewModel exemplar
datlechin b129c42
refactor: introduce PluginCapabilities and PluginProcedureFunctionSup…
datlechin 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import Foundation | ||
|
|
||
| public struct PluginCapabilities: OptionSet, Sendable { | ||
| public let rawValue: UInt32 | ||
|
|
||
| public init(rawValue: UInt32) { | ||
| self.rawValue = rawValue | ||
| } | ||
|
|
||
| public static let materializedViews = PluginCapabilities(rawValue: 1 << 0) | ||
| public static let foreignTables = PluginCapabilities(rawValue: 1 << 1) | ||
| public static let storedProcedures = PluginCapabilities(rawValue: 1 << 2) | ||
| public static let userFunctions = PluginCapabilities(rawValue: 1 << 3) | ||
| public static let alterTableDDL = PluginCapabilities(rawValue: 1 << 4) | ||
| public static let foreignKeyToggle = PluginCapabilities(rawValue: 1 << 5) | ||
| public static let truncateTable = PluginCapabilities(rawValue: 1 << 6) | ||
| public static let multiSchema = PluginCapabilities(rawValue: 1 << 7) | ||
| public static let parameterizedQueries = PluginCapabilities(rawValue: 1 << 8) | ||
| public static let cancelQuery = PluginCapabilities(rawValue: 1 << 9) | ||
| public static let batchExecute = PluginCapabilities(rawValue: 1 << 10) | ||
| public static let transactions = PluginCapabilities(rawValue: 1 << 11) | ||
| } |
This file contains hidden or 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
20 changes: 20 additions & 0 deletions
20
Plugins/TableProPluginKit/PluginProcedureFunctionSupport.swift
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import Foundation | ||
|
|
||
| public protocol PluginProcedureFunctionSupport { | ||
| func fetchProcedures(schema: String?) async throws -> [PluginRoutineInfo] | ||
| func fetchFunctions(schema: String?) async throws -> [PluginRoutineInfo] | ||
| func fetchProcedureDDL(name: String, schema: String?) async throws -> String | ||
| func fetchFunctionDDL(name: String, schema: String?) async throws -> String | ||
| } | ||
|
|
||
| public struct PluginRoutineInfo: Codable, Sendable { | ||
| public let name: String | ||
| public let returnType: String? | ||
| public let language: String? | ||
|
|
||
| public init(name: String, returnType: String? = nil, language: String? = nil) { | ||
| self.name = name | ||
| self.returnType = returnType | ||
| self.language = language | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // | ||
| // AppEvents.swift | ||
| // TablePro | ||
| // | ||
|
|
||
| import Combine | ||
| import Foundation | ||
|
|
||
| @MainActor | ||
| final class AppEvents { | ||
| static let shared = AppEvents() | ||
|
|
||
| let themeChanged = PassthroughSubject<Void, Never>() | ||
|
|
||
| let connectionStatusChanged = PassthroughSubject<ConnectionStatusChange, Never>() | ||
|
|
||
| private init() {} | ||
| } | ||
|
|
||
| struct ConnectionStatusChange: Sendable { | ||
| let connectionId: UUID | ||
| let status: ConnectionStatus | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // | ||
| // AppServices.swift | ||
| // TablePro | ||
| // | ||
|
|
||
| import SwiftUI | ||
|
|
||
| @MainActor | ||
| struct AppServices { | ||
| let appEvents: AppEvents | ||
| let appSettings: AppSettingsManager | ||
| let connectionStorage: ConnectionStorage | ||
| let databaseManager: DatabaseManager | ||
| let pluginManager: PluginManager | ||
| let schemaService: SchemaService | ||
| let queryHistoryStorage: QueryHistoryStorage | ||
| let sqlFavoriteManager: SQLFavoriteManager | ||
| let aiChatStorage: AIChatStorage | ||
| let syncTracker: SyncChangeTracker | ||
| let themeEngine: ThemeEngine | ||
|
|
||
| static let live = AppServices( | ||
| appEvents: .shared, | ||
| appSettings: .shared, | ||
| connectionStorage: .shared, | ||
| databaseManager: .shared, | ||
| pluginManager: .shared, | ||
| schemaService: .shared, | ||
| queryHistoryStorage: .shared, | ||
| sqlFavoriteManager: .shared, | ||
| aiChatStorage: .shared, | ||
| syncTracker: .shared, | ||
| themeEngine: .shared | ||
| ) | ||
| } | ||
|
|
||
| private struct AppServicesEnvironmentKey: EnvironmentKey { | ||
| @MainActor static var defaultValue: AppServices { .live } | ||
| } | ||
|
|
||
| extension EnvironmentValues { | ||
| var appServices: AppServices { | ||
| get { self[AppServicesEnvironmentKey.self] } | ||
| set { self[AppServicesEnvironmentKey.self] = newValue } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
This fallback calls
NSRegularExpression()with no arguments, but Foundation does not provide a parameterless initializer forNSRegularExpressionin Swift, so the target will fail to compile whenever this file is built. Use a valid pattern such as(?!)for the fallback instead of constructing an empty regex.Useful? React with 👍 / 👎.