26 lines
1.3 KiB
Swift
26 lines
1.3 KiB
Swift
import Foundation
|
|
import HelderCore
|
|
|
|
/// The Schema view's disk and process work for one project.
|
|
public protocol SchemaServicing: Sendable {
|
|
/// True when the project root holds an `artisan` file.
|
|
func isLaravelApp() async -> Bool
|
|
/// True when `app/Console/Commands/HelderSchemaCommand.php` exists.
|
|
func hasCommand() async -> Bool
|
|
/// The model from `database/helder/schema.json`, nil when the file is missing; throws `SchemaDumpError` when it is corrupt.
|
|
func readDump() async throws -> SchemaModel?
|
|
/// When the dump was last written, nil when it is missing.
|
|
func dumpModificationDate() async -> Date?
|
|
/// Runs `php artisan helder:schema` in the project and streams each line (`isError` for stderr); returns the exit code.
|
|
///
|
|
/// Never throws and never waits on input: a missing php, a launch failure or the timeout becomes one error line and code -1.
|
|
func runDump(onLine: @escaping @Sendable (_ line: String, _ isError: Bool) -> Void) async -> Int32
|
|
}
|
|
|
|
/// Card positions per project, kept in Helder's own settings rather than in the project folder.
|
|
public protocol SchemaLayoutPersisting: Sendable {
|
|
/// Empty when nothing was saved for `root`.
|
|
func loadPositions(root: String) -> [String: SchemaPoint]
|
|
func savePositions(_ positions: [String: SchemaPoint], root: String)
|
|
}
|