From 58dedb5066c6213e27f81fae8335644cf6ee5252 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Sat, 17 Jan 2026 09:35:42 -0600 Subject: [PATCH] Signed-off-by: Matt Bruce --- .../Migrations/DefaultAggregatingMigration.swift | 4 ++-- .../Migrations/DefaultTransformingMigration.swift | 4 ++-- Sources/LocalData/Models/AnyStorageMigration.swift | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Sources/LocalData/Migrations/DefaultAggregatingMigration.swift b/Sources/LocalData/Migrations/DefaultAggregatingMigration.swift index 27b34dc..b83371b 100644 --- a/Sources/LocalData/Migrations/DefaultAggregatingMigration.swift +++ b/Sources/LocalData/Migrations/DefaultAggregatingMigration.swift @@ -3,12 +3,12 @@ import Foundation public struct DefaultAggregatingMigration: AggregatingMigration { public let destinationKey: StorageKey public let sourceKeys: [AnyStorageKey] - public let aggregateAction: ([AnyCodable]) async throws -> Value + public let aggregateAction: @Sendable ([AnyCodable]) async throws -> Value public init( destinationKey: StorageKey, sourceKeys: [AnyStorageKey], - aggregate: @escaping ([AnyCodable]) async throws -> Value + aggregate: @escaping @Sendable ([AnyCodable]) async throws -> Value ) { self.destinationKey = destinationKey self.sourceKeys = sourceKeys diff --git a/Sources/LocalData/Migrations/DefaultTransformingMigration.swift b/Sources/LocalData/Migrations/DefaultTransformingMigration.swift index 3ad8f44..dcdcbea 100644 --- a/Sources/LocalData/Migrations/DefaultTransformingMigration.swift +++ b/Sources/LocalData/Migrations/DefaultTransformingMigration.swift @@ -3,12 +3,12 @@ import Foundation public struct DefaultTransformingMigration: TransformingMigration { public let destinationKey: StorageKey public let sourceKey: StorageKey - public let transformAction: (SourceValue) async throws -> DestinationValue + public let transformAction: @Sendable (SourceValue) async throws -> DestinationValue public init( destinationKey: StorageKey, sourceKey: StorageKey, - transform: @escaping (SourceValue) async throws -> DestinationValue + transform: @escaping @Sendable (SourceValue) async throws -> DestinationValue ) { self.destinationKey = destinationKey self.sourceKey = sourceKey diff --git a/Sources/LocalData/Models/AnyStorageMigration.swift b/Sources/LocalData/Models/AnyStorageMigration.swift index c8f39f1..839d9a6 100644 --- a/Sources/LocalData/Models/AnyStorageMigration.swift +++ b/Sources/LocalData/Models/AnyStorageMigration.swift @@ -9,8 +9,12 @@ public struct AnyStorageMigration: Sendable { public init(_ migration: M) { self.destinationDescriptor = .from(migration.destinationKey) - self.shouldMigrateAction = migration.shouldMigrate - self.migrateAction = migration.migrate + self.shouldMigrateAction = { @Sendable router, context in + try await migration.shouldMigrate(using: router, context: context) + } + self.migrateAction = { @Sendable router, context in + try await migration.migrate(using: router, context: context) + } } public func shouldMigrate(using router: StorageRouter, context: MigrationContext) async throws -> Bool {