diff --git a/Amplify.xcodeproj/project.pbxproj b/Amplify.xcodeproj/project.pbxproj index 154dd415af..d9b8c5daa0 100644 --- a/Amplify.xcodeproj/project.pbxproj +++ b/Amplify.xcodeproj/project.pbxproj @@ -34,7 +34,7 @@ 2129BE4423948951006363A1 /* MutationSyncMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE4323948951006363A1 /* MutationSyncMetadata.swift */; }; 2129BE48239489AC006363A1 /* MutationSyncMetadataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE47239489AC006363A1 /* MutationSyncMetadataTests.swift */; }; 2129BE4F23949F1B006363A1 /* MutationSyncMetadata+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE4B23948C54006363A1 /* MutationSyncMetadata+Schema.swift */; }; - 2129BE512395A66F006363A1 /* AmplifyModelRegistration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE502395A66F006363A1 /* AmplifyModelRegistration.swift */; }; + 2129BE512395A66F006363A1 /* ModelSchemaProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE502395A66F006363A1 /* ModelSchemaProvider.swift */; }; 2129BE552395CAEF006363A1 /* PaginatedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE542395CAEF006363A1 /* PaginatedList.swift */; }; 2129BE562395CAF9006363A1 /* PaginatedListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2129BE522395CA05006363A1 /* PaginatedListTests.swift */; }; 212CE6FC23E9E523007D8E71 /* SelectionSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 212CE6FB23E9E523007D8E71 /* SelectionSet.swift */; }; @@ -211,6 +211,7 @@ B98E9D142372236300934B51 /* QueryPredicate+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B98E9D0C2372236200934B51 /* QueryPredicate+Equatable.swift */; }; B996FC4423FF2FA8006D0F68 /* Encodable+AnyEncodable.swift in Sources */ = {isa = PBXBuildFile; fileRef = B996FC4323FF2FA8006D0F68 /* Encodable+AnyEncodable.swift */; }; B996FC4D24059918006D0F68 /* Model+Enum.swift in Sources */ = {isa = PBXBuildFile; fileRef = B996FC4C24059918006D0F68 /* Model+Enum.swift */; }; + B9A329CC243559BF00C5B80C /* TimeInterval+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9A329CB243559BF00C5B80C /* TimeInterval+Helper.swift */; }; B9B64A9F23FCBF7E00730B68 /* ModelValueConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9B64A9E23FCBF7E00730B68 /* ModelValueConverter.swift */; }; B9DCA263240F217C00075E22 /* AnyEncodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9DCA262240F217C00075E22 /* AnyEncodableTests.swift */; }; B9FAA10B23878122009414B4 /* ModelField+Association.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FAA10A23878122009414B4 /* ModelField+Association.swift */; }; @@ -559,7 +560,7 @@ 2129BE4323948951006363A1 /* MutationSyncMetadata.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutationSyncMetadata.swift; sourceTree = ""; }; 2129BE47239489AC006363A1 /* MutationSyncMetadataTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MutationSyncMetadataTests.swift; sourceTree = ""; }; 2129BE4B23948C54006363A1 /* MutationSyncMetadata+Schema.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MutationSyncMetadata+Schema.swift"; sourceTree = ""; }; - 2129BE502395A66F006363A1 /* AmplifyModelRegistration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AmplifyModelRegistration.swift; sourceTree = ""; }; + 2129BE502395A66F006363A1 /* ModelSchemaProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModelSchemaProvider.swift; sourceTree = ""; }; 2129BE522395CA05006363A1 /* PaginatedListTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginatedListTests.swift; sourceTree = ""; }; 2129BE542395CAEF006363A1 /* PaginatedList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginatedList.swift; sourceTree = ""; }; 212CE6FB23E9E523007D8E71 /* SelectionSet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionSet.swift; sourceTree = ""; }; @@ -846,6 +847,7 @@ B99209E22411E49D00F80010 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; B996FC4323FF2FA8006D0F68 /* Encodable+AnyEncodable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Encodable+AnyEncodable.swift"; sourceTree = ""; }; B996FC4C24059918006D0F68 /* Model+Enum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Model+Enum.swift"; sourceTree = ""; }; + B9A329CB243559BF00C5B80C /* TimeInterval+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TimeInterval+Helper.swift"; sourceTree = ""; }; B9B64A9E23FCBF7E00730B68 /* ModelValueConverter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelValueConverter.swift; sourceTree = ""; }; B9DCA262240F217C00075E22 /* AnyEncodableTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnyEncodableTests.swift; sourceTree = ""; }; B9FAA10A23878122009414B4 /* ModelField+Association.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ModelField+Association.swift"; sourceTree = ""; }; @@ -1740,7 +1742,6 @@ B92E03A62367CE7A006CEB8D /* Model */ = { isa = PBXGroup; children = ( - 2129BE502395A66F006363A1 /* AmplifyModelRegistration.swift */, B92E03A72367CE7A006CEB8D /* Model.swift */, B9FAA17F238FBB5D009414B4 /* Model+Array.swift */, B92E03AC2367CE7A006CEB8D /* Model+Codable.swift */, @@ -1750,6 +1751,7 @@ FA8EE77C238627350097E4F1 /* Model+Subscript.swift */, B92E03A92367CE7A006CEB8D /* ModelRegistry.swift */, FA5D4CF2238AFD7B00D2F54A /* ModelRegistry+Syncable.swift */, + 2129BE502395A66F006363A1 /* ModelSchemaProvider.swift */, FA8EE780238628490097E4F1 /* Persistable.swift */, FA8EE775238626C70097E4F1 /* AnyModel */, B9FAA1232388BE2B009414B4 /* Collection */, @@ -2090,6 +2092,7 @@ FAE4145E23999BC900CE94C2 /* Result+Void.swift */, FA56F72422B14B6A0039754A /* Resumable.swift */, B9FAA174238EFC59009414B4 /* String+Extensions.swift */, + B9A329CB243559BF00C5B80C /* TimeInterval+Helper.swift */, 219A88EC23F3309800BBC5F2 /* Tree.swift */, ); path = Support; @@ -3655,7 +3658,7 @@ FAF1B88623392F96007F1435 /* SerialDispatcher.swift in Sources */, FAAFAF2D23904ADF002CF932 /* AtomicValue+Numeric.swift in Sources */, FA09B94B2322CBEB000E064D /* LoggingCategoryConfiguration.swift in Sources */, - 2129BE512395A66F006363A1 /* AmplifyModelRegistration.swift in Sources */, + 2129BE512395A66F006363A1 /* ModelSchemaProvider.swift in Sources */, 210922572359693900CEC295 /* BasicAnalyticsEvent.swift in Sources */, FAC2353F227A055200424678 /* PluginError.swift in Sources */, FA76A2D32342B47100B91ADB /* HubPayloadEventName.swift in Sources */, @@ -3777,6 +3780,7 @@ FAC2351C227A053D00424678 /* APICategoryPlugin.swift in Sources */, FA176ED52385012000C5C5F9 /* DataStoreCategory+HubPayloadEventName.swift in Sources */, 210DBC162332B3CB009B9E51 /* StorageDownloadDataOperation.swift in Sources */, + B9A329CC243559BF00C5B80C /* TimeInterval+Helper.swift in Sources */, 950A26DC23D15D7E00D92B19 /* PredictionsTextToSpeechOperation.swift in Sources */, FAC235A3227A5ED000424678 /* HubChannel.swift in Sources */, FAA2E8CE23A02A8100E420EA /* PredictionsCategory+Resettable.swift in Sources */, diff --git a/Amplify/Categories/DataStore/Model/AmplifyModelRegistration.swift b/Amplify/Categories/DataStore/Model/ModelSchemaProvider.swift similarity index 93% rename from Amplify/Categories/DataStore/Model/AmplifyModelRegistration.swift rename to Amplify/Categories/DataStore/Model/ModelSchemaProvider.swift index 324c745fb1..7e3a100839 100644 --- a/Amplify/Categories/DataStore/Model/AmplifyModelRegistration.swift +++ b/Amplify/Categories/DataStore/Model/ModelSchemaProvider.swift @@ -9,7 +9,7 @@ import Foundation /// Protocol that defines a contract between the consumer and the DataStore plugin. /// All models have to be registered and have an associated `version`. -public protocol AmplifyModelRegistration { +public protocol ModelSchemaProvider { /// Function called during plugin initialization. Implementations must /// register all the available models here. diff --git a/Amplify/Core/Support/TimeInterval+Helper.swift b/Amplify/Core/Support/TimeInterval+Helper.swift new file mode 100644 index 0000000000..5d3b095b7a --- /dev/null +++ b/Amplify/Core/Support/TimeInterval+Helper.swift @@ -0,0 +1,28 @@ +// +// Copyright 2018-2020 Amazon.com, +// Inc. or its affiliates. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Foundation + +extension TimeInterval { + + public static func seconds(_ value: Double) -> TimeInterval { + return value + } + + public static func minutes(_ value: Double) -> TimeInterval { + return value * 60 + } + + public static func hours(_ value: Double) -> TimeInterval { + return value * 60 * 60 + } + + public static func days(_ value: Double) -> TimeInterval { + return value * 60 * 60 * 24 + } + +} diff --git a/AmplifyPlugins/API/AWSAPICategoryPlugin/AWSAPIPlugin.swift b/AmplifyPlugins/API/AWSAPICategoryPlugin/AWSAPIPlugin.swift index 8ad6f654a1..2d52ab6681 100644 --- a/AmplifyPlugins/API/AWSAPICategoryPlugin/AWSAPIPlugin.swift +++ b/AmplifyPlugins/API/AWSAPICategoryPlugin/AWSAPIPlugin.swift @@ -54,12 +54,12 @@ final public class AWSAPIPlugin: NSObject, APICategoryPlugin { } } - public init(modelRegistration: AmplifyModelRegistration? = nil, + public init(schema: ModelSchemaProvider? = nil, sessionFactory: URLSessionBehaviorFactory? = nil) { self.mapper = OperationTaskMapper() self.queue = OperationQueue() - modelRegistration?.registerModels(registry: ModelRegistry.self) + schema?.registerModels(registry: ModelRegistry.self) super.init() diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/AWSDataStorePlugin.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/AWSDataStorePlugin.swift index 64da11e423..5c0eef37d3 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/AWSDataStorePlugin.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/AWSDataStorePlugin.swift @@ -18,7 +18,11 @@ final public class AWSDataStorePlugin: DataStoreCategoryPlugin { /// The Publisher that sends mutation events to subscribers var dataStorePublisher: DataStoreSubscribeBehavior? - let modelRegistration: AmplifyModelRegistration + /// The schema that holds a reference to its version and all registered models + let schema: ModelSchemaProvider + + /// The DataStore configuration + let configuration: DataStoreConfiguration /// The local storage provider. Resolved during configuration phase var storageEngine: StorageEngineBehavior! @@ -38,8 +42,9 @@ final public class AWSDataStorePlugin: DataStoreCategoryPlugin { } /// No-argument init that uses defaults for all providers - public init(modelRegistration: AmplifyModelRegistration) { - self.modelRegistration = modelRegistration + public init(schema: ModelSchemaProvider, configuration: DataStoreConfiguration = .default) { + self.schema = schema + self.configuration = configuration self.isSyncEnabled = false if #available(iOS 13.0, *) { self.dataStorePublisher = DataStorePublisher() @@ -49,10 +54,12 @@ final public class AWSDataStorePlugin: DataStoreCategoryPlugin { } /// Internal initializer for testing - init(modelRegistration: AmplifyModelRegistration, + init(schema: ModelSchemaProvider, + configuration: DataStoreConfiguration = .default, storageEngine: StorageEngineBehavior, dataStorePublisher: DataStoreSubscribeBehavior) { - self.modelRegistration = modelRegistration + self.schema = schema + self.configuration = configuration self.isSyncEnabled = false self.storageEngine = storageEngine self.dataStorePublisher = dataStorePublisher @@ -62,7 +69,7 @@ final public class AWSDataStorePlugin: DataStoreCategoryPlugin { /// `AmplifyModelRegistration.registerModels`, so we can inspect those models to derive isSyncEnabled, and pass /// them to `StorageEngine.setUp(models:)` public func configure(using configuration: Any) throws { - modelRegistration.registerModels(registry: ModelRegistry.self) + schema.registerModels(registry: ModelRegistry.self) resolveSyncEnabled() try resolveStorageEngine() diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/DataStoreConfiguration.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/DataStoreConfiguration.swift new file mode 100644 index 0000000000..95ced20f84 --- /dev/null +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/DataStoreConfiguration.swift @@ -0,0 +1,112 @@ +// +// Copyright 2018-2020 Amazon.com, +// Inc. or its affiliates. All Rights Reserved. +// +// SPDX-License-Identifier: Apache-2.0 +// + +import Amplify +import Foundation + +/// Error Handler function typealias +public typealias DataStoreErrorHandler = (AmplifyError) -> Void + +/// Holds a reference to both the local `Model` and the remote one during a conflict +/// resolution. Implementations of the `DataStoreConflictHandler` use this to decide +/// what the outcome of a conflict should be. +public struct DataStoreConclictData { + public let local: Model + public let remote: Model +} + +/// Conflict Handler function typealias. The function is used during a conflict that +/// could not be resolved and requires a decision from the consumer. +public typealias DataStoreConflictHandler = (DataStoreConclictData, DataStoreConflictHandlerResolver) -> Void + +/// Callback for the `DataStoreConflictHandler`. +public typealias DataStoreConflictHandlerResolver = (DataStoreConflictHandlerResult) -> Void + +/// The conflict resolution result enum. +public enum DataStoreConflictHandlerResult { + + /// Discard the local changes in favor of the remote ones. + case discard + + /// Keep the local changes (semantic shortcut to `retry(local)`). + case keep + + /// Return a new `Model` instance that should used instead of the local and remote changes. + case retry(Model) +} + +/// The `DataStore` plugin configuration object. +public struct DataStoreConfiguration { + + /// A callback function called on unhandled errors + public let errorHandler: DataStoreErrorHandler + + /// A callback called when a conflict could not be resolved by the service + public let conflictHandler: DataStoreConflictHandler + + /// How often the sync engine will run (in seconds) + public let syncInterval: TimeInterval + + /// The number of records to sync per execution + public let syncMaxRecords: UInt + + /// The page size of each sync execution + public let syncPageSize: UInt + + init(errorHandler: @escaping DataStoreErrorHandler, + conflictHandler: @escaping DataStoreConflictHandler, + syncInterval: TimeInterval, + syncMaxRecords: UInt, + syncPageSize: UInt) { + self.errorHandler = errorHandler + self.conflictHandler = conflictHandler + self.syncInterval = syncInterval + self.syncMaxRecords = syncMaxRecords + self.syncPageSize = syncPageSize + } + +} + +extension DataStoreConfiguration { + + public static let defaultSyncInterval: TimeInterval = .hours(24) + public static let defaultSyncMaxRecords: UInt = 10_000 + public static let defaultSyncPageSize: UInt = 1_000 + + /// Creates a custom configuration. The only required property is `conflictHandler`. + /// + /// - Parameters: + /// - errorHandler: a callback function called on unhandled errors + /// - conflictHandler: a callback called when a conflict could not be resolved by the service + /// - syncInterval: how often the sync engine will run (in seconds) + /// - syncMaxRecords: the number of records to sync per execution + /// - syncPageSize: the page size of each sync execution + /// - Returns: an instance of `DataStoreConfiguration` with the passed parameters. + public static func custom( + errorHandler: @escaping DataStoreErrorHandler = { error in + Amplify.Logging.error(error: error) + }, + conflictHandler: @escaping DataStoreConflictHandler = { _, resolve in + resolve(.discard) + }, + syncInterval: TimeInterval = DataStoreConfiguration.defaultSyncInterval, + syncMaxRecords: UInt = DataStoreConfiguration.defaultSyncMaxRecords, + syncPageSize: UInt = DataStoreConfiguration.defaultSyncPageSize + ) -> DataStoreConfiguration { + return DataStoreConfiguration(errorHandler: errorHandler, + conflictHandler: conflictHandler, + syncInterval: syncInterval, + syncMaxRecords: syncMaxRecords, + syncPageSize: syncPageSize) + } + + /// The default configuration. + public static var `default`: DataStoreConfiguration { + .custom() + } + +} diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginIntegrationTests/TestSupport/SyncEngineIntegrationTestBase.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginIntegrationTests/TestSupport/SyncEngineIntegrationTestBase.swift index e204a58a79..1164c3a66b 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginIntegrationTests/TestSupport/SyncEngineIntegrationTestBase.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginIntegrationTests/TestSupport/SyncEngineIntegrationTestBase.swift @@ -41,8 +41,8 @@ class SyncEngineIntegrationTestBase: XCTestCase { Amplify.Logging.logLevel = .verbose do { - try Amplify.add(plugin: AWSAPIPlugin(modelRegistration: TestModelRegistration())) - try Amplify.add(plugin: AWSDataStorePlugin(modelRegistration: TestModelRegistration())) + try Amplify.add(plugin: AWSAPIPlugin()) + try Amplify.add(plugin: AWSDataStorePlugin(schema: TestSchemaProvider())) } catch { XCTFail(String(describing: error)) return diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/APICategoryDependencyTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/APICategoryDependencyTests.swift index d83db9a273..c8a9f679f5 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/APICategoryDependencyTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/APICategoryDependencyTests.swift @@ -72,9 +72,9 @@ extension APICategoryDependencyTests { syncEngine: syncEngine) let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), - storageEngine: storageEngine, - dataStorePublisher: dataStorePublisher) + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), + storageEngine: storageEngine, + dataStorePublisher: dataStorePublisher) try Amplify.add(plugin: dataStorePlugin) let dataStoreConfig = DataStoreCategoryConfiguration(plugins: [ diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/InitialSync/InitialSyncOrchestratorTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/InitialSync/InitialSyncOrchestratorTests.swift index 677060e8cf..adeafcda92 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/InitialSync/InitialSyncOrchestratorTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/InitialSync/InitialSyncOrchestratorTests.swift @@ -17,7 +17,7 @@ class InitialSyncOrchestratorTests: XCTestCase { override class func setUp() { Amplify.Logging.logLevel = .info ModelRegistry.reset() - PostCommentModelRegistration().registerModels(registry: ModelRegistry.self) + PostCommentSchemaProvider().registerModels(registry: ModelRegistry.self) } /// - Given: An InitialSyncOrchestrator with a model dependency graph diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/LocalSubscriptionTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/LocalSubscriptionTests.swift index 948e1b643b..63f44cb062 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/LocalSubscriptionTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/LocalSubscriptionTests.swift @@ -53,9 +53,9 @@ class LocalSubscriptionTests: XCTestCase { } let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), - storageEngine: storageEngine, - dataStorePublisher: dataStorePublisher) + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), + storageEngine: storageEngine, + dataStorePublisher: dataStorePublisher) let dataStoreConfig = DataStoreCategoryConfiguration(plugins: [ "awsDataStorePlugin": true diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/AWSMutationEventIngesterTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/AWSMutationEventIngesterTests.swift index 200be6856e..1054a5ad22 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/AWSMutationEventIngesterTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/AWSMutationEventIngesterTests.swift @@ -43,9 +43,9 @@ class AWSMutationEventIngesterTests: XCTestCase { syncEngine: syncEngine) let publisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), - storageEngine: storageEngine, - dataStorePublisher: publisher) + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), + storageEngine: storageEngine, + dataStorePublisher: publisher) try Amplify.add(plugin: apiPlugin) try Amplify.add(plugin: dataStorePlugin) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/OutgoingMutationQueueTestsWithMockStateMachine.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/OutgoingMutationQueueTestsWithMockStateMachine.swift index e008e28eb5..e3aa9fc23a 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/OutgoingMutationQueueTestsWithMockStateMachine.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/OutgoingMutationQueueTestsWithMockStateMachine.swift @@ -249,7 +249,7 @@ extension OutgoingMutationQueueMockStateTest { let storageEngine = MockStorageEngineBehavior() let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), storageEngine: storageEngine, dataStorePublisher: dataStorePublisher) try Amplify.add(plugin: dataStorePlugin) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/ProcessMutationErrorFromCloudOperationTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/ProcessMutationErrorFromCloudOperationTests.swift index 91f8e94184..a365b35622 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/ProcessMutationErrorFromCloudOperationTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/ProcessMutationErrorFromCloudOperationTests.swift @@ -67,7 +67,7 @@ extension ProcessMutationErrorFromCloudOperationTests { let storageEngine = MockStorageEngineBehavior() let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), storageEngine: storageEngine, dataStorePublisher: dataStorePublisher) try Amplify.add(plugin: dataStorePlugin) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/SyncMutationToCloudOperationTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/SyncMutationToCloudOperationTests.swift index 65d63540aa..866677cdc5 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/SyncMutationToCloudOperationTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/MutationQueue/SyncMutationToCloudOperationTests.swift @@ -238,7 +238,7 @@ extension SyncMutationToCloudOperationTests { let storageEngine = MockStorageEngineBehavior() let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), storageEngine: storageEngine, dataStorePublisher: dataStorePublisher) try Amplify.add(plugin: dataStorePlugin) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/RemoteSync/RemoteSyncAPIInvocationTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/RemoteSync/RemoteSyncAPIInvocationTests.swift index 750f6d651b..cd2960ecaf 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/RemoteSync/RemoteSyncAPIInvocationTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/RemoteSync/RemoteSyncAPIInvocationTests.swift @@ -49,9 +49,9 @@ class RemoteSyncAPIInvocationTests: XCTestCase { } let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), - storageEngine: storageEngine, - dataStorePublisher: dataStorePublisher) + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), + storageEngine: storageEngine, + dataStorePublisher: dataStorePublisher) let apiConfig = APICategoryConfiguration(plugins: [apiPlugin.key: true]) let dataStoreConfig = DataStoreCategoryConfiguration(plugins: [dataStorePlugin.key: true]) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ModelReconciliationDeleteTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ModelReconciliationDeleteTests.swift index f3fdbb2b64..3c797948da 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ModelReconciliationDeleteTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ModelReconciliationDeleteTests.swift @@ -51,7 +51,7 @@ class ModelReconciliationDeleteTests: SyncEngineTestBase { apiPlugin.responders[.subscribeRequestListener] = responder tryOrFail { - try setUpDataStore(modelRegistration: MockModelRegistration()) + try setUpDataStore(schema: MockModelSchemaProvider()) mockRemoteSyncEngineFor_testUpdateAfterDelete() try startAmplifyAndWaitForSync() } @@ -139,7 +139,7 @@ class ModelReconciliationDeleteTests: SyncEngineTestBase { apiPlugin.responders[.subscribeRequestListener] = responder tryOrFail { - try setUpDataStore(modelRegistration: MockModelRegistration()) + try setUpDataStore(schema: MockModelSchemaProvider()) mockRemoteSyncEngineFor_testDeleteWithNoLocalModel() try startAmplifyAndWaitForSync() } @@ -153,7 +153,7 @@ class ModelReconciliationDeleteTests: SyncEngineTestBase { let syncReceivedNotification = expectation(description: "Received 'syncReceived' update from Hub") let syncReceivedToken = Amplify.Hub.listen(to: .dataStore, eventName: HubPayload.EventName.DataStore.syncReceived) { _ in - syncReceivedNotification.fulfill() + syncReceivedNotification.fulfill() } guard try HubListenerTestUtilities.waitForListener(with: syncReceivedToken, timeout: 5.0) else { XCTFail("Sync listener never registered") diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ReconcileAndLocalSaveOperationTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ReconcileAndLocalSaveOperationTests.swift index 12576ecf89..2d96e53a69 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ReconcileAndLocalSaveOperationTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/SubscriptionSync/ReconcileAndLocalSaveOperationTests.swift @@ -280,7 +280,7 @@ extension ReconcileAndLocalSaveOperationTests { let storageEngine = MockStorageEngineBehavior() let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), + let dataStorePlugin = AWSDataStorePlugin(schema: TestSchemaProvider(), storageEngine: storageEngine, dataStorePublisher: dataStorePublisher) try Amplify.add(plugin: dataStorePlugin) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/BaseDataStoreTests.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/BaseDataStoreTests.swift index 3c3bf8a217..94730adb93 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/BaseDataStoreTests.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/BaseDataStoreTests.swift @@ -42,7 +42,7 @@ class BaseDataStoreTests: XCTestCase { } let dataStorePublisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: TestModelRegistration(), + let dataStorePlugin = AWSDataStorePlugin(schema: LocalTestSchemaProvider(), storageEngine: storageEngine, dataStorePublisher: dataStorePublisher) diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/Mocks/TestModelRegistration.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/Mocks/LocalTestDataStoreSchema.swift similarity index 92% rename from AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/Mocks/TestModelRegistration.swift rename to AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/Mocks/LocalTestDataStoreSchema.swift index 7439ef047e..f95b6793a3 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/Mocks/TestModelRegistration.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/Mocks/LocalTestDataStoreSchema.swift @@ -9,7 +9,7 @@ import Amplify import AmplifyTestCommon import Foundation -struct TestModelRegistration: AmplifyModelRegistration { +struct LocalTestSchemaProvider: ModelSchemaProvider { func registerModels(registry: ModelRegistry.Type) { // Post and Comment diff --git a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/SyncEngineTestBase.swift b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/SyncEngineTestBase.swift index 7f8a7d60b8..1ba1875efe 100644 --- a/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/SyncEngineTestBase.swift +++ b/AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/TestSupport/SyncEngineTestBase.swift @@ -72,7 +72,7 @@ class SyncEngineTestBase: XCTestCase { func setUpDataStore( mutationQueue: OutgoingMutationQueueBehavior = NoOpMutationQueue(), initialSyncOrchestratorFactory: @escaping InitialSyncOrchestratorFactory = NoOpInitialSyncOrchestrator.factory, - modelRegistration: AmplifyModelRegistration = TestModelRegistration() + schema: ModelSchemaProvider = TestSchemaProvider() ) throws { let mutationDatabaseAdapter = try AWSMutationDatabaseAdapter(storageAdapter: storageAdapter) let awsMutationEventPublisher = AWSMutationEventPublisher(eventSource: mutationDatabaseAdapter) @@ -107,7 +107,7 @@ class SyncEngineTestBase: XCTestCase { syncEngine: syncEngine) let publisher = DataStorePublisher() - let dataStorePlugin = AWSDataStorePlugin(modelRegistration: modelRegistration, + let dataStorePlugin = AWSDataStorePlugin(schema: schema, storageEngine: storageEngine, dataStorePublisher: publisher) diff --git a/AmplifyPlugins/DataStore/DataStoreCategoryPlugin.xcodeproj/project.pbxproj b/AmplifyPlugins/DataStore/DataStoreCategoryPlugin.xcodeproj/project.pbxproj index a1ba4a8e30..0fb80eefdf 100644 --- a/AmplifyPlugins/DataStore/DataStoreCategoryPlugin.xcodeproj/project.pbxproj +++ b/AmplifyPlugins/DataStore/DataStoreCategoryPlugin.xcodeproj/project.pbxproj @@ -74,11 +74,12 @@ 9BDB42C47E6D7F9A113AE558 /* Pods_HostApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C6448DF009E54C11ACE4515 /* Pods_HostApp.framework */; }; B912D1B824296F1E0028F05C /* QueryPaginationInput+SQLite.swift in Sources */ = {isa = PBXBuildFile; fileRef = B912D1B724296F1E0028F05C /* QueryPaginationInput+SQLite.swift */; }; B912D1BA242984D10028F05C /* QueryPaginationInputTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B912D1B9242984D10028F05C /* QueryPaginationInputTests.swift */; }; + B9334BA22433AF3E00C9F407 /* DataStoreConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9334BA12433AF3E00C9F407 /* DataStoreConfiguration.swift */; }; B996FC4723FF3C7C006D0F68 /* ExampleWithEveryType.swift in Sources */ = {isa = PBXBuildFile; fileRef = B996FC4623FF3C7C006D0F68 /* ExampleWithEveryType.swift */; }; B996FC4923FF3E92006D0F68 /* ExampleWithEveryType+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = B996FC4823FF3E92006D0F68 /* ExampleWithEveryType+Schema.swift */; }; B996FC4B23FF418C006D0F68 /* SQLModelValueConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B996FC4A23FF418C006D0F68 /* SQLModelValueConverterTests.swift */; }; B9B64AA123FD0A3C00730B68 /* ModelValueConverter+SQLite.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9B64AA023FD0A3C00730B68 /* ModelValueConverter+SQLite.swift */; }; - B9E010E4239167E000DCE8C8 /* TestModelRegistration.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9E010E3239167E000DCE8C8 /* TestModelRegistration.swift */; }; + B9E010E4239167E000DCE8C8 /* LocalTestDataStoreSchema.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9E010E3239167E000DCE8C8 /* LocalTestDataStoreSchema.swift */; }; B9FAA140238C600A009414B4 /* ListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FAA13F238C600A009414B4 /* ListTests.swift */; }; B9FAA142238C6082009414B4 /* BaseDataStoreTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B9FAA141238C6082009414B4 /* BaseDataStoreTests.swift */; }; E7B9BF8EC63BF1F1A6AB5F1A /* Pods_HostApp_AWSDataStoreCategoryPluginIntegrationTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F15A47E1AA494DF5B39514BC /* Pods_HostApp_AWSDataStoreCategoryPluginIntegrationTests.framework */; }; @@ -256,11 +257,12 @@ AA98AF8502498A6DD04B5B9D /* Pods-HostApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HostApp.release.xcconfig"; path = "Target Support Files/Pods-HostApp/Pods-HostApp.release.xcconfig"; sourceTree = ""; }; B912D1B724296F1E0028F05C /* QueryPaginationInput+SQLite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "QueryPaginationInput+SQLite.swift"; sourceTree = ""; }; B912D1B9242984D10028F05C /* QueryPaginationInputTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QueryPaginationInputTests.swift; sourceTree = ""; }; + B9334BA12433AF3E00C9F407 /* DataStoreConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DataStoreConfiguration.swift; sourceTree = ""; }; B996FC4623FF3C7C006D0F68 /* ExampleWithEveryType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWithEveryType.swift; sourceTree = ""; }; B996FC4823FF3E92006D0F68 /* ExampleWithEveryType+Schema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ExampleWithEveryType+Schema.swift"; sourceTree = ""; }; B996FC4A23FF418C006D0F68 /* SQLModelValueConverterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SQLModelValueConverterTests.swift; sourceTree = ""; }; B9B64AA023FD0A3C00730B68 /* ModelValueConverter+SQLite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ModelValueConverter+SQLite.swift"; sourceTree = ""; }; - B9E010E3239167E000DCE8C8 /* TestModelRegistration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestModelRegistration.swift; sourceTree = ""; }; + B9E010E3239167E000DCE8C8 /* LocalTestDataStoreSchema.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalTestDataStoreSchema.swift; sourceTree = ""; }; B9FAA13F238C600A009414B4 /* ListTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListTests.swift; sourceTree = ""; }; B9FAA141238C6082009414B4 /* BaseDataStoreTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseDataStoreTests.swift; sourceTree = ""; }; CD06D94E36718128AEAB1BAB /* Pods-AWSDataStoreCategoryPlugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AWSDataStoreCategoryPlugin.debug.xcconfig"; path = "Target Support Files/Pods-AWSDataStoreCategoryPlugin/Pods-AWSDataStoreCategoryPlugin.debug.xcconfig"; sourceTree = ""; }; @@ -402,11 +404,12 @@ 2149E5A62388684F00873955 /* AWSDataStoreCategoryPlugin */ = { isa = PBXGroup; children = ( - 2149E5C32388684F00873955 /* Info.plist */, 2149E5C42388684F00873955 /* AWSDataStorePlugin.swift */, FACBB2AD238AFAE800C29602 /* AWSDataStorePlugin+DataStoreBaseBehavior.swift */, FA5D4CEE238AFCBC00D2F54A /* AWSDataStorePlugin+DataStoreSubscribeBehavior.swift */, FA5D4CEC238AFC4D00D2F54A /* AWSDataStorePlugin+DefaultLogger.swift */, + B9334BA12433AF3E00C9F407 /* DataStoreConfiguration.swift */, + 2149E5C32388684F00873955 /* Info.plist */, 2149E5A72388684F00873955 /* Storage */, 2149E5B82388684F00873955 /* Subscribe */, 2149E5BA2388684F00873955 /* Sync */, @@ -778,15 +781,15 @@ FAF101A62398807100D5ECC9 /* Mocks */ = { isa = PBXGroup; children = ( - B9E010E3239167E000DCE8C8 /* TestModelRegistration.swift */, + B9E010E3239167E000DCE8C8 /* LocalTestDataStoreSchema.swift */, + 6B64027823E3584300001FD7 /* MockAWSIncomingEventReconciliationQueue.swift */, + 6BDC224123E27324007C8410 /* MockAWSInitialSyncOrchestrator.swift */, + 6B64027A23E38B9900001FD7 /* MockOutgoingMutationQueue.swift */, FAF5287A2399814F0053A717 /* MockReconciliationQueue.swift */, + 6BC4FDA923A899680027D20C /* MockRequestRetryablePolicy.swift */, 6B4E3DF52397327E00AD962B /* MockStateMachine.swift */, FA8D932E239EA5C4001ED336 /* NoOpInitialSyncOrchestrator.swift */, FA23345B23955CEF009BEFE9 /* NoOpMutationQueue.swift */, - 6BC4FDA923A899680027D20C /* MockRequestRetryablePolicy.swift */, - 6BDC224123E27324007C8410 /* MockAWSInitialSyncOrchestrator.swift */, - 6B64027823E3584300001FD7 /* MockAWSIncomingEventReconciliationQueue.swift */, - 6B64027A23E38B9900001FD7 /* MockOutgoingMutationQueue.swift */, ); path = Mocks; sourceTree = ""; @@ -1271,6 +1274,7 @@ 2149E5C72388684F00873955 /* StorageEngine.swift in Sources */, FA3B3F05238F22F5002EFDB3 /* OutgoingMutationQueue+Action.swift in Sources */, FAED573E238B4C2F008EBED8 /* StorageEngineAdapter+UntypedModel.swift in Sources */, + B9334BA22433AF3E00C9F407 /* DataStoreConfiguration.swift in Sources */, FA4A9559239ACC1B008E876E /* IncomingSubscriptionEventPublisher.swift in Sources */, FA8F4D222395B11700861D91 /* MutationEvent+Query.swift in Sources */, FAF7CECB238C72830095547B /* OutgoingMutationQueue.swift in Sources */, @@ -1311,7 +1315,7 @@ 6BDC224223E27324007C8410 /* MockAWSInitialSyncOrchestrator.swift in Sources */, 6B01B71D23A4615900AD0E97 /* SyncMutationToCloudOperationTests.swift in Sources */, FA3841ED23889D8F0070AD5B /* StateMachineTests.swift in Sources */, - B9E010E4239167E000DCE8C8 /* TestModelRegistration.swift in Sources */, + B9E010E4239167E000DCE8C8 /* LocalTestDataStoreSchema.swift in Sources */, 6B3381BC239778E90036F046 /* AWSMutationDatabaseAdapterTests.swift in Sources */, 2149E5FC238869CF00873955 /* LocalSubscriptionTests.swift in Sources */, FA23345C23955CEF009BEFE9 /* NoOpMutationQueue.swift in Sources */, diff --git a/AmplifyTestCommon/Models/AmplifyModels.swift b/AmplifyTestCommon/Models/AmplifyModels.swift index 33a7d0d8fc..7215eb6742 100644 --- a/AmplifyTestCommon/Models/AmplifyModels.swift +++ b/AmplifyTestCommon/Models/AmplifyModels.swift @@ -11,7 +11,7 @@ import Foundation // Contains the set of classes that conforms to the `Model` protocol. -final public class AmplifyModels: AmplifyModelRegistration { +final public class TestSchemaProvider: ModelSchemaProvider { public let version: String = "46369a50a95486d76713fd33833fb782" public func registerModels(registry: ModelRegistry.Type) { diff --git a/AmplifyTestCommon/Models/MockModels.swift b/AmplifyTestCommon/Models/MockModels.swift index f92403b404..981f09b5f0 100644 --- a/AmplifyTestCommon/Models/MockModels.swift +++ b/AmplifyTestCommon/Models/MockModels.swift @@ -60,7 +60,7 @@ public struct MockUnsynced: Model { } -struct MockModelRegistration: AmplifyModelRegistration { +struct MockModelSchemaProvider: ModelSchemaProvider { func registerModels(registry: ModelRegistry.Type) { registry.register(modelType: MockSynced.self) diff --git a/AmplifyTestCommon/Models/PostCommentModelRegistration.swift b/AmplifyTestCommon/Models/PostCommentModelRegistration.swift index 5a6100047d..c963aefcf2 100644 --- a/AmplifyTestCommon/Models/PostCommentModelRegistration.swift +++ b/AmplifyTestCommon/Models/PostCommentModelRegistration.swift @@ -8,7 +8,7 @@ import Amplify import Foundation -final public class PostCommentModelRegistration: AmplifyModelRegistration { +final public class PostCommentSchemaProvider: ModelSchemaProvider { public func registerModels(registry: ModelRegistry.Type) { ModelRegistry.register(modelType: Post.self) ModelRegistry.register(modelType: Comment.self) diff --git a/Podfile.lock b/Podfile.lock index 654454c505..0cd81e7788 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -23,7 +23,7 @@ DEPENDENCIES: - SwiftLint SPEC REPOS: - trunk: + https://cdn.cocoapods.org/: - AWSAuthCore - AWSCognitoIdentityProvider - AWSCognitoIdentityProviderASF diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock index 654454c505..0cd81e7788 100644 --- a/Pods/Manifest.lock +++ b/Pods/Manifest.lock @@ -23,7 +23,7 @@ DEPENDENCIES: - SwiftLint SPEC REPOS: - trunk: + https://cdn.cocoapods.org/: - AWSAuthCore - AWSCognitoIdentityProvider - AWSCognitoIdentityProviderASF diff --git a/Pods/Target Support Files/CwlCatchException/CwlCatchException.xcconfig b/Pods/Target Support Files/CwlCatchException/CwlCatchException.xcconfig deleted file mode 100644 index 33b051c822..0000000000 --- a/Pods/Target Support Files/CwlCatchException/CwlCatchException.xcconfig +++ /dev/null @@ -1,10 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlCatchException -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.xcconfig b/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.xcconfig deleted file mode 100644 index 9638f77f7e..0000000000 --- a/Pods/Target Support Files/CwlPreconditionTesting/CwlPreconditionTesting.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CwlPreconditionTesting -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CwlCatchException" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/CwlPreconditionTesting -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES