@interncom/diplomatic 0.0.64 → 0.0.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +1 -0
- package/dist/index.mjs +7 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export default class DiplomaticClient {
|
|
|
28
28
|
register(hostURL: string): Promise<void>;
|
|
29
29
|
disconnect: () => void;
|
|
30
30
|
registerAndConnect(hostURL: string): Promise<void>;
|
|
31
|
+
requeueAllOpsForUpload(): Promise<void>;
|
|
31
32
|
emitUpdate(): Promise<void>;
|
|
32
33
|
emitXferUpdate(): Promise<void>;
|
|
33
34
|
getState(): Promise<IDiplomaticClientState>;
|
package/dist/index.mjs
CHANGED
|
@@ -11503,8 +11503,14 @@ var DiplomaticClient = class {
|
|
|
11503
11503
|
async registerAndConnect(hostURL) {
|
|
11504
11504
|
await this.register(hostURL);
|
|
11505
11505
|
await this.connect(new URL(hostURL));
|
|
11506
|
+
await this.requeueAllOpsForUpload();
|
|
11506
11507
|
await this.sync();
|
|
11507
11508
|
}
|
|
11509
|
+
async requeueAllOpsForUpload() {
|
|
11510
|
+
for (const op of await this.store.listOps()) {
|
|
11511
|
+
await this.store.enqueueUpload(htob(op.sha256), op.cipherOp);
|
|
11512
|
+
}
|
|
11513
|
+
}
|
|
11508
11514
|
async emitUpdate() {
|
|
11509
11515
|
const state = await this.getState();
|
|
11510
11516
|
this.listener?.(state);
|
|
@@ -11541,6 +11547,7 @@ var DiplomaticClient = class {
|
|
|
11541
11547
|
continue;
|
|
11542
11548
|
}
|
|
11543
11549
|
await this.store.enqueueDownload(item.sha256, item.recordedAt);
|
|
11550
|
+
await this.store.dequeueUpload(item.sha256);
|
|
11544
11551
|
this.emitXferUpdate();
|
|
11545
11552
|
}
|
|
11546
11553
|
await this.store.setLastFetchedAt(new Date(resp.fetchedAt));
|