@interncom/diplomatic 0.0.63 → 0.0.65
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/entityDB.d.ts +2 -0
- package/dist/index.mjs +15 -2
- 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/entityDB.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type EntityID, type GroupID } from "./shared/types";
|
|
|
4
4
|
import { StateManager } from "./state";
|
|
5
5
|
export declare const entityTableName = "entities";
|
|
6
6
|
export declare const typeIndexName = "entity_type_created_at";
|
|
7
|
+
export declare const typeUpdatedAtIndexName = "entity_type_updated_at";
|
|
7
8
|
export declare const typeGroupIndexName = "entity_type_group_id";
|
|
8
9
|
export declare const typeParentIndexName = "entity_type_parent_id";
|
|
9
10
|
export interface IEntity<T> {
|
|
@@ -21,6 +22,7 @@ interface IEntityDB extends DBSchema {
|
|
|
21
22
|
value: IEntity<unknown>;
|
|
22
23
|
indexes: {
|
|
23
24
|
[typeIndexName]: [string, Date];
|
|
25
|
+
[typeUpdatedAtIndexName]: [string, Date];
|
|
24
26
|
[typeGroupIndexName]: [string, GroupID];
|
|
25
27
|
[typeParentIndexName]: [string, EntityID];
|
|
26
28
|
};
|
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);
|
|
@@ -11773,13 +11779,15 @@ __export(entityDB_exports, {
|
|
|
11773
11779
|
stateManager: () => stateManager,
|
|
11774
11780
|
typeGroupIndexName: () => typeGroupIndexName,
|
|
11775
11781
|
typeIndexName: () => typeIndexName,
|
|
11776
|
-
typeParentIndexName: () => typeParentIndexName
|
|
11782
|
+
typeParentIndexName: () => typeParentIndexName,
|
|
11783
|
+
typeUpdatedAtIndexName: () => typeUpdatedAtIndexName
|
|
11777
11784
|
});
|
|
11778
11785
|
var entityTableName = "entities";
|
|
11779
11786
|
var typeIndexName = "entity_type_created_at";
|
|
11787
|
+
var typeUpdatedAtIndexName = "entity_type_updated_at";
|
|
11780
11788
|
var typeGroupIndexName = "entity_type_group_id";
|
|
11781
11789
|
var typeParentIndexName = "entity_type_parent_id";
|
|
11782
|
-
var db2 = await openDB("db",
|
|
11790
|
+
var db2 = await openDB("db", 10, {
|
|
11783
11791
|
upgrade(db3, prevVersion, currVersion, tx) {
|
|
11784
11792
|
if (!db3.objectStoreNames.contains(entityTableName)) {
|
|
11785
11793
|
const store2 = db3.createObjectStore(entityTableName, {
|
|
@@ -11793,6 +11801,11 @@ var db2 = await openDB("db", 9, {
|
|
|
11793
11801
|
unique: false
|
|
11794
11802
|
});
|
|
11795
11803
|
}
|
|
11804
|
+
if (!store.indexNames.contains(typeUpdatedAtIndexName)) {
|
|
11805
|
+
store.createIndex(typeUpdatedAtIndexName, ["type", "updatedAt"], {
|
|
11806
|
+
unique: false
|
|
11807
|
+
});
|
|
11808
|
+
}
|
|
11796
11809
|
if (!store.indexNames.contains(typeGroupIndexName)) {
|
|
11797
11810
|
store.createIndex(typeGroupIndexName, ["type", "gid"], {
|
|
11798
11811
|
unique: false
|