Skip to content

Commit c0f4e56

Browse files
committed
updated to fix replication for document change
1 parent 8633894 commit c0f4e56

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

CbliteSwiftJsLib/Classes/ReplicatorHelper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public struct ReplicatorHelper {
144144
if document.flags.contains(.accessRemoved) {
145145
flags.append("ACCESS_REMOVED")
146146
}
147-
var documentDictionary: [String: Any] = ["id": document.id, "flags": flags]
147+
var documentDictionary: [String: Any] = ["id": document.id, "flags": flags, "scopeName": document.scope, "collectionName": document.collection]
148148

149149
if let error = document.error {
150150
documentDictionary["error"] = [
@@ -156,7 +156,7 @@ public struct ReplicatorHelper {
156156
}
157157

158158
return [
159-
"direction": isPush ? "PUSH" : "PULL",
159+
"isPush": isPush ? true : false,
160160
"documents": docs
161161
]
162162
}

CbliteSwiftJsLib/Classes/ReplicatorManager.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,19 @@ public class ReplicatorManager {
8787
throw ReplicatorError.unableToFindReplicator(replicatorId: replicatorId)
8888
}
8989
}
90+
91+
public func getPendingDocumentIds(_ replicatorId: String, collection: Collection) throws -> [String:Any] {
92+
if let replicator = getReplicator(replicatorId: replicatorId) {
93+
do {
94+
let documentIds = try replicator.pendingDocumentIds(collection: collection)
95+
return ["documentIds": documentIds];
96+
} catch {
97+
throw error
98+
}
99+
} else {
100+
throw ReplicatorError.unableToFindReplicator(replicatorId: replicatorId)
101+
}
102+
}
90103

91104
public func cleanUp(_ replicatorId: String) throws {
92105
if let replicator = getReplicator(replicatorId: replicatorId) {

0 commit comments

Comments
 (0)