Skip to content

Commit 128c012

Browse files
committed
feat: 🎸 add ability to iterate through dirty items
1 parent bae7b77 commit 128c012

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"@jsonjoy.com/json-pack": "^1.0.2",
7676
"@jsonjoy.com/util": "^1.0.0",
7777
"json-joy": "^15.4.1",
78-
"memfs": "^4.8.1",
78+
"memfs": "^4.9.1",
7979
"sonic-forest": "^1.0.0",
8080
"thingies": "^2.1.0"
8181
},

src/json-crdt-repo/local/server-crud/ServerCrudLocalHistorySync.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,11 @@ export class ServerCrudLocalHistorySync {
145145
throw error;
146146
}
147147
}
148+
149+
public async * listDirty(collection: string[] = ['sync', 'dirty']): AsyncIterableIterator<{collection: string[]; id: string}> {
150+
for await (const entry of this.core.crud.scan(collection)) {
151+
if (entry.type === 'collection') yield* this.listDirty([...collection, entry.id]);
152+
else yield {collection, id: entry.id};
153+
}
154+
}
148155
}

yarn.lock

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,11 +2034,14 @@ marked@^4.3.0:
20342034
resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3"
20352035
integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==
20362036

2037-
memfs@^4.8.1:
2038-
version "4.8.1"
2039-
resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.8.1.tgz#1e02c15c4397212a9a1b037fa4324c6f7dd45b47"
2040-
integrity sha512-7q/AdPzf2WpwPlPL4v1kE2KsJsHl7EF4+hAeVzlyanr2+YnR21NVn9mDqo+7DEaKDRsQy8nvxPlKH4WqMtiO0w==
2037+
memfs@^4.9.1:
2038+
version "4.9.1"
2039+
resolved "https://registry.yarnpkg.com/memfs/-/memfs-4.9.1.tgz#cd0b94987c365298a6e57b4beb98c658008d7ff1"
2040+
integrity sha512-36cVYFMaa9HNEYyvkyKCwker8DBmOdjWLrfekE/cHEKJ806fCfKNVhOJNvoyV/CrGSZDtfQPbhn0Zid0gbH0Hw==
20412041
dependencies:
2042+
"@jsonjoy.com/json-pack" "^1.0.2"
2043+
"@jsonjoy.com/util" "^1.1.0"
2044+
sonic-forest "^1.0.0"
20422045
tslib "^2.0.0"
20432046

20442047
merge-stream@^2.0.0:

0 commit comments

Comments
 (0)