Skip to content

Commit

Permalink
Move AnyModel to AWSPluginsCore
Browse files Browse the repository at this point in the history
  • Loading branch information
lawmicha committed Jun 18, 2020
1 parent b5f0133 commit 4280acd
Showing 14 changed files with 27 additions and 22 deletions.
22 changes: 11 additions & 11 deletions Amplify.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -111,6 +111,11 @@
21A3FDB62464590600E76120 /* ModelMultipleOwnerAuthRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A3FDB52464590600E76120 /* ModelMultipleOwnerAuthRuleTests.swift */; };
21A3FDB9246494CD00E76120 /* GraphQLRequestAuthRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A3FDB8246494CD00E76120 /* GraphQLRequestAuthRuleTests.swift */; };
21A3FDBF2465FA1500E76120 /* AuthRule+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21A3FDBE2465FA1500E76120 /* AuthRule+Extension.swift */; };
21AD424B249BF0DA0016FE95 /* AnyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACBAD522386160100E29E56 /* AnyModel.swift */; };
21AD424C249BF0DE0016FE95 /* AnyModel+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE776238626D60097E4F1 /* AnyModel+Codable.swift */; };
21AD424D249BF0E50016FE95 /* AnyModel+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE78223862DDB0097E4F1 /* AnyModel+Schema.swift */; };
21AD424E249BF0E90016FE95 /* AnyModel+Subscript.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE77E2386274A0097E4F1 /* AnyModel+Subscript.swift */; };
21AD424F249BF0EC0016FE95 /* Model+AnyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE77A2386271A0097E4F1 /* Model+AnyModel.swift */; };
21C395B3245729EC00597EA2 /* AppSyncErrorType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21C395B2245729EC00597EA2 /* AppSyncErrorType.swift */; };
21D79FDA237617C60057D00D /* SubscriptionEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D79FD9237617C60057D00D /* SubscriptionEvent.swift */; };
21D79FE32377F4120057D00D /* SubscriptionConnectionState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21D79FE22377F4120057D00D /* SubscriptionConnectionState.swift */; };
@@ -408,13 +413,9 @@
FA76A2D12342B1A600B91ADB /* StorageCategory+HubPayloadEventName.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA76A2D02342B1A600B91ADB /* StorageCategory+HubPayloadEventName.swift */; };
FA76A2D32342B47100B91ADB /* HubPayloadEventName.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA76A2D22342B47100B91ADB /* HubPayloadEventName.swift */; };
FA8EE773238621320097E4F1 /* AnyModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE772238621320097E4F1 /* AnyModelTests.swift */; };
FA8EE777238626D60097E4F1 /* AnyModel+Codable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE776238626D60097E4F1 /* AnyModel+Codable.swift */; };
FA8EE779238627040097E4F1 /* Model+ModelName.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE778238627040097E4F1 /* Model+ModelName.swift */; };
FA8EE77B2386271A0097E4F1 /* Model+AnyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE77A2386271A0097E4F1 /* Model+AnyModel.swift */; };
FA8EE77D238627350097E4F1 /* Model+Subscript.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE77C238627350097E4F1 /* Model+Subscript.swift */; };
FA8EE77F2386274A0097E4F1 /* AnyModel+Subscript.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE77E2386274A0097E4F1 /* AnyModel+Subscript.swift */; };
FA8EE781238628490097E4F1 /* Persistable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE780238628490097E4F1 /* Persistable.swift */; };
FA8EE78323862DDB0097E4F1 /* AnyModel+Schema.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8EE78223862DDB0097E4F1 /* AnyModel+Schema.swift */; };
FA8F4D242395B1B600861D91 /* MutationEvent+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA8F4D232395B1B600861D91 /* MutationEvent+Model.swift */; };
FA9D6C1B238DEEEB00C7DD9F /* ConcurrentDispatcherPerformanceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1B8872339633C007F1435 /* ConcurrentDispatcherPerformanceTests.swift */; };
FA9D6C1E238DEF0E00C7DD9F /* DefaultHubPluginPerformanceTestHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF1B88A23397791007F1435 /* DefaultHubPluginPerformanceTestHelpers.swift */; };
@@ -521,7 +522,6 @@
FACA36222327FDD7000E74F6 /* amplifyconfiguration.json in Resources */ = {isa = PBXBuildFile; fileRef = FACA36212327FDD2000E74F6 /* amplifyconfiguration.json */; };
FACBA78D23949588006349C8 /* Model+DateFormatting.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACBA78C23949588006349C8 /* Model+DateFormatting.swift */; };
FACBAD512386101F00E29E56 /* MutationEvent+MutationType.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACBAD4F2386101100E29E56 /* MutationEvent+MutationType.swift */; };
FACBAD532386160100E29E56 /* AnyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACBAD522386160100E29E56 /* AnyModel.swift */; };
FACD264C2386E8F10068FBE6 /* JSONValue+SubscriptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACD264A2386E8F10068FBE6 /* JSONValue+SubscriptTests.swift */; };
FACD264D2386E8F10068FBE6 /* JSONValue+KeyPathTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACD264B2386E8F10068FBE6 /* JSONValue+KeyPathTests.swift */; };
FACD26502386E9410068FBE6 /* JSONValue+Subscript.swift in Sources */ = {isa = PBXBuildFile; fileRef = FACD264E2386E9410068FBE6 /* JSONValue+Subscript.swift */; };
@@ -1447,6 +1447,7 @@
2129BE0223947FA3006363A1 /* Model */ = {
isa = PBXGroup;
children = (
FA8EE775238626C70097E4F1 /* AnyModel */,
212CE6FF23E9E938007D8E71 /* Decorator */,
2129BE0523948005006363A1 /* GraphQLDocument */,
2129BE1423948065006363A1 /* GraphQLRequest */,
@@ -1673,7 +1674,6 @@
21AD424A249BEC440016FE95 /* Internal */ = {
isa = PBXGroup;
children = (
FA8EE775238626C70097E4F1 /* AnyModel */,
216E4619249189050035E3CE /* Embedded.swift */,
B92E03A72367CE7A006CEB8D /* Model.swift */,
B9FAA17F238FBB5D009414B4 /* Model+Array.swift */,
@@ -3965,6 +3965,7 @@
21420A8F237222A900FA140C /* AWSIAMConfiguration.swift in Sources */,
219A888523EB897700BBC5F2 /* GraphQLRequest+AnyModelWithSync.swift in Sources */,
219A88F123F3379900BBC5F2 /* GraphQLDocumentInput.swift in Sources */,
21AD424E249BF0E90016FE95 /* AnyModel+Subscript.swift in Sources */,
21420AA0237222A900FA140C /* AWSAuthorizationType.swift in Sources */,
B4EBEB64246204D000D06375 /* AuthAWSCredentialsProvider.swift in Sources */,
212CE6FC23E9E523007D8E71 /* SelectionSet.swift in Sources */,
@@ -3989,7 +3990,9 @@
21420A99237222A900FA140C /* APIKeyProvider.swift in Sources */,
21A3FDB224630D9F00E76120 /* AuthRuleDecorator.swift in Sources */,
6BBECD7123ADA7E100C8DFBE /* AmplifyAWSServiceConfiguration.swift in Sources */,
21AD424F249BF0EC0016FE95 /* Model+AnyModel.swift in Sources */,
B4EBEB682462050B00D06375 /* AuthCognitoIdentityProvider.swift in Sources */,
21AD424C249BF0DE0016FE95 /* AnyModel+Codable.swift in Sources */,
212CE6FE23E9E5A2007D8E71 /* GraphQLDocumentnputValue.swift in Sources */,
21420A90237222A900FA140C /* APIKeyConfiguration.swift in Sources */,
219A887F23EB627100BBC5F2 /* ModelBasedGraphQLDocumentBuilder.swift in Sources */,
@@ -4000,8 +4003,10 @@
212CE70B23E9E991007D8E71 /* ModelIdDecorator.swift in Sources */,
2129BE4223948924006363A1 /* MutationSync.swift in Sources */,
212CE70E23E9E991007D8E71 /* PaginationDecorator.swift in Sources */,
21AD424B249BF0DA0016FE95 /* AnyModel.swift in Sources */,
21420A9C237222A900FA140C /* AWSAuthService.swift in Sources */,
B4EBEB66246204E400D06375 /* AuthCognitoTokensProvider.swift in Sources */,
21AD424D249BF0E50016FE95 /* AnyModel+Schema.swift in Sources */,
2129BE4F23949F1B006363A1 /* MutationSyncMetadata+Schema.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -4055,7 +4060,6 @@
B4FEA92324635CA40009B47B /* AuthCategory+DeviceBehavior.swift in Sources */,
FAD2A1892374D5DC0005CD6B /* GraphQLResponse.swift in Sources */,
B4F7F3E624621E4F00544B04 /* AuthAttributeResendConfirmationCodeOperation.swift in Sources */,
FA8EE78323862DDB0097E4F1 /* AnyModel+Schema.swift in Sources */,
B92E03B22367CE7A006CEB8D /* DataStoreCategoryConfiguration.swift in Sources */,
B9B64A9F23FCBF7E00730B68 /* ModelValueConverter.swift in Sources */,
B92E03B82367CE7A006CEB8D /* ModelSchema+Definition.swift in Sources */,
@@ -4185,7 +4189,6 @@
FA5704C7245F368200392C19 /* ProgressListener.swift in Sources */,
FA76A2D32342B47100B91ADB /* HubPayloadEventName.swift in Sources */,
FA5704C9245F3C6900392C19 /* AmplifyInProcessReportingOperation.swift in Sources */,
FA8EE77F2386274A0097E4F1 /* AnyModel+Subscript.swift in Sources */,
FA09B9332321A305000E064D /* HubCategory+CategoryConfigurable.swift in Sources */,
B4B5CC9A2457B7FA0019C783 /* AuthUpdateUserAttributeOperation.swift in Sources */,
B92E03B02367CE7A006CEB8D /* DataStoreCallback.swift in Sources */,
@@ -4217,7 +4220,6 @@
FA09B9472322CBA7000E064D /* APICategoryConfiguration.swift in Sources */,
21FFF995230C96CB005878EA /* StorageListOperation.swift in Sources */,
95DAAB33237E63370028544F /* KeyPhrase.swift in Sources */,
FA8EE777238626D60097E4F1 /* AnyModel+Codable.swift in Sources */,
21409C552384C55D000A53C9 /* LabelType.swift in Sources */,
FA315295233D634900DE78E7 /* StorageDownloadFileRequest.swift in Sources */,
95DAAB26237E63370028544F /* Sentiment.swift in Sources */,
@@ -4328,7 +4330,6 @@
95DAAB31237E63370028544F /* PartOfSpeech.swift in Sources */,
B9FAA13A238BBADE009414B4 /* List+Combine.swift in Sources */,
B91A87A023D18A320049A12F /* Temporal.swift in Sources */,
FA8EE77B2386271A0097E4F1 /* Model+AnyModel.swift in Sources */,
FA56F72522B14B6A0039754A /* Resumable.swift in Sources */,
B4C498FA2415D24B00067992 /* AuthProvider.swift in Sources */,
FAA2E8C023A00C6500E420EA /* AmplifyAPICategory+APICategory.swift in Sources */,
@@ -4381,7 +4382,6 @@
B98E9D0F2372236300934B51 /* QueryOperator.swift in Sources */,
FAA64FC52397344D00B9C3C6 /* AtomicValue+RangeReplaceableCollection.swift in Sources */,
B9B50DC623D918020086F1E1 /* Date.swift in Sources */,
FACBAD532386160100E29E56 /* AnyModel.swift in Sources */,
B98E9D132372236300934B51 /* QueryOperator+Equatable.swift in Sources */,
21409C5A2384C57D000A53C9 /* GraphQLMutationType.swift in Sources */,
B493E69E245394E200D9E521 /* AuthSignUpStep.swift in Sources */,
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

import Foundation

/// Note that although this is public, it is intended for internal use and not consumed directly by host applications.
/// Types that conform to the `Persistable` protocol represent values that can be
/// persisted in a database.
///
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

import Foundation
import Amplify
import AWSPluginsCore

extension AnyModel {
/// Initializes an AnyModel instance from incoming JSONValue. The JSONValue is expected to be provided by the AWS
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@

import Foundation
import Amplify
import AWSPluginsCore

struct GraphQLResponseDecoder {

Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import XCTest
import Foundation
import AWSAPICategoryPlugin
import AWSPluginsCore

@testable import Amplify
@testable import AmplifyTestCommon
4 changes: 2 additions & 2 deletions AmplifyPlugins/API/Podfile.lock
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ DEPENDENCIES:
- SwiftLint

SPEC REPOS:
https://cdn.cocoapods.org/:
trunk:
- AppSyncRealTimeClient
- AWSAuthCore
- AWSCognitoIdentityProvider
@@ -106,6 +106,6 @@ SPEC CHECKSUMS:
SwiftFormat: 87e745cb2f6509894a44ac4f311a8722a9ebcb8b
SwiftLint: 22ccbbe3b8008684be5955693bab135e0ed6a447

PODFILE CHECKSUM: c5ca54ced4ba8835a7d63fc7d12880ae4532cb16
PODFILE CHECKSUM: 36210dbb4ee100c2203d947149c3f0c7628db7a3

COCOAPODS: 1.9.3
4 changes: 2 additions & 2 deletions AmplifyPlugins/Auth/Podfile.lock
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ DEPENDENCIES:
- SwiftLint

SPEC REPOS:
https://cdn.cocoapods.org/:
trunk:
- AWSAuthCore
- AWSCognitoIdentityProvider
- AWSCognitoIdentityProviderASF
@@ -85,6 +85,6 @@ SPEC CHECKSUMS:
SwiftFormat: 87e745cb2f6509894a44ac4f311a8722a9ebcb8b
SwiftLint: 22ccbbe3b8008684be5955693bab135e0ed6a447

PODFILE CHECKSUM: 8f8fc80cd855afcb3e7186a793ed5f1aabf51a53
PODFILE CHECKSUM: 371cf67fe35ebb5167d0880bad12b01618a0fb0e

COCOAPODS: 1.9.3
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
//

import Foundation
import Amplify

/// Note that although this is public, it is intended for internal use and not consumed directly by host applications.
/// Custom implementation of Codable for AnyModel stores the instance as its JSON string representation and uses the
/// ModelRegistry utilities to deserialize it
public extension AnyModel {
Original file line number Diff line number Diff line change
@@ -5,7 +5,8 @@
// SPDX-License-Identifier: Apache-2.0
//

/// Note that although this is public, it is intended for internal use and not consumed directly by host applications.
import Amplify

public extension AnyModel {
var schema: ModelSchema {
instance.schema
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
// SPDX-License-Identifier: Apache-2.0
//

/// Note that although this is public, it is intended for internal use and not consumed directly by host applications.
/// Implement dynamic access to properties of a `Model`.
///
/// ```swift
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
//

import Foundation
import Amplify

/// Note that although this is public, it is intended for internal use and not consumed directly by host applications.
public struct AnyModel: Model {
public let id: Identifier
public let instance: Model
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@
// SPDX-License-Identifier: Apache-2.0
//

import Amplify

/// Note that although this is public, it is intended for internal use and not consumed directly by host applications.
public extension Model {
func eraseToAnyModel() throws -> AnyModel {
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import Amplify
import Foundation
import SQLite
import AWSPluginsCore

typealias ModelValues = [String: Any?]

4 changes: 2 additions & 2 deletions AmplifyPlugins/DataStore/Podfile.lock
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ DEPENDENCIES:
- SwiftLint

SPEC REPOS:
https://cdn.cocoapods.org/:
trunk:
- AppSyncRealTimeClient
- AWSAuthCore
- AWSCognitoIdentityProvider
@@ -117,6 +117,6 @@ SPEC CHECKSUMS:
SwiftFormat: 87e745cb2f6509894a44ac4f311a8722a9ebcb8b
SwiftLint: 22ccbbe3b8008684be5955693bab135e0ed6a447

PODFILE CHECKSUM: f09bec747766b1b5e354a46fa79c439ec3d6b3a4
PODFILE CHECKSUM: 04860e414d616b67d24ed3346a60700f427764b9

COCOAPODS: 1.9.3

0 comments on commit 4280acd

Please sign in to comment.