Skip to content

Commit 0d6dd9d

Browse files
authored
Feat/2806 log sync catchup (#19)
* initial functions, still needs batching and tests * pagination * test coverage * migrations * fixed validation of user id * remove deserializing testing code * reorganize log-sync protocol to its own provider
1 parent 6bd683d commit 0d6dd9d

33 files changed

+1580
-695
lines changed

app/src/client/cli/prompts/community.prompt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type GetCommunity,
88
type GetCommunityResponse,
99
type GeneratePublicKeysMessage,
10-
} from '../../../nest/communities/websocket/types/index.js'
10+
} from '../../../nest/websocket/handlers/types/index.js'
1111
import { createLogger } from '../../../nest/app/logger/logger.js'
1212
import { isBase64, isHexadecimal } from 'class-validator'
1313
import { DateTime } from 'luxon'

app/src/client/client-auth-conn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import { Injectable } from '@nestjs/common'
1717
import { randomUUID } from 'crypto'
1818
import { createLogger } from '../nest/app/logger/logger.js'
1919
import { WebsocketClient } from './ws.client.js'
20-
import { AuthSyncMessage } from '../nest/communities/websocket/types/auth-sync.types.js'
21-
import { CommunityOperationStatus } from '../nest/communities/websocket/types/common.types.js'
20+
import { AuthSyncMessage } from '../nest/websocket/handlers/types/auth-sync.types.js'
21+
import { CommunityOperationStatus } from '../nest/websocket/handlers/types/common.types.js'
2222
import { WebsocketEvents } from '../nest/websocket/ws.types.js'
2323
import { ClientEvents } from './ws.client.events.js'
2424
import { QuietLogger } from '../nest/app/logger/types.js'

app/src/migrations/.snapshot-qss.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,16 @@
6666
"length": -1,
6767
"mappedType": "string"
6868
},
69+
"hashed_db_id": {
70+
"name": "hashed_db_id",
71+
"type": "varchar",
72+
"unsigned": false,
73+
"autoincrement": false,
74+
"primary": false,
75+
"nullable": true,
76+
"length": -1,
77+
"mappedType": "string"
78+
},
6979
"entry": {
7080
"name": "entry",
7181
"type": "bytea",
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Migration } from '@mikro-orm/migrations'
2+
3+
export class Migration20251223192036 extends Migration {
4+
override async up(): Promise<void> {
5+
this.addSql(
6+
`alter table "log_entry_sync" add column "hashed_db_id" varchar null;`,
7+
)
8+
}
9+
10+
override async down(): Promise<void> {
11+
this.addSql(`alter table "log_entry_sync" drop column "hashed_db_id";`)
12+
}
13+
}

app/src/nest/communities/auth/auth.connection.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import * as uint8arrays from 'uint8arrays'
1919
import {
2020
type AuthSyncMessage,
2121
CommunityOperationStatus,
22-
} from '../websocket/types/index.js'
22+
} from '../../websocket/handlers/types/index.js'
2323
import type { QuietLogger } from '../../app/logger/types.js'
2424
import { type AuthConnectionConfig, AuthStatus } from './types.js'
2525
import EventEmitter from 'events'
@@ -101,6 +101,10 @@ export class AuthConnection extends EventEmitter {
101101
return this._status
102102
}
103103

104+
public get socketId(): string {
105+
return this.config.socket.id
106+
}
107+
104108
/**
105109
* Start the auth sync connection and handle connection events
106110
*/

0 commit comments

Comments
 (0)