Skip to content

Commit a04adea

Browse files
committed
fix: fixed type issue with rpc handler preventing building
1 parent 364237b commit a04adea

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/nodes/agent/handlers/NodesAuditEventsGet.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import type Audit from '../../../audit/Audit';
1111
import type { AuditEvent } from '../../../audit/types';
1212
import { ServerHandler } from '@matrixai/rpc';
1313
import * as auditUtils from '../../../audit/utils';
14+
import { AuditEventId } from '@/ids';
1415

1516
/**
1617
* Gets audit events from a node
@@ -29,12 +30,16 @@ class NodesAuditEventsGet extends ServerHandler<
2930
_meta: Record<string, JSONValue> | undefined,
3031
ctx: ContextTimed,
3132
): AsyncGenerator<AgentRPCResponseResult<AgentAuditMessage<AuditEvent>>> {
32-
let { seek, seekEnd, limit } = input;
33+
let seek_: AuditEventId | number | undefined;
34+
let seekEnd_: AuditEventId | number | undefined;
35+
36+
const { seek, seekEnd, limit } = input;
37+
3338
if (typeof seek !== 'number') {
34-
seek = auditUtils.decodeAuditEventId(seek);
39+
seek_ = auditUtils.decodeAuditEventId(seek);
3540
}
3641
if (typeof seekEnd !== 'number') {
37-
seekEnd = auditUtils.decodeAuditEventId(seekEnd);
42+
seekEnd_ = auditUtils.decodeAuditEventId(seekEnd);
3843
}
3944

4045
const { audit, db }: { audit: Audit; db: DB } = this.container;
@@ -45,17 +50,17 @@ class NodesAuditEventsGet extends ServerHandler<
4550
for await (const auditEvent of audit.getAuditEvents(
4651
[],
4752
{
48-
seek,
49-
seekEnd,
53+
seek : seek_,
54+
seekEnd : seekEnd_,
5055
limit,
5156
},
5257
tran,
5358
)) {
5459
ctx.signal.throwIfAborted();
5560
// Skip the seek event to ensure exclusivity if given an AuditEventId
5661
// This assumes that ids are unique
57-
if (seek !== undefined) {
58-
if (typeof seek !== 'number' && auditEvent.id.equals(seek)) {
62+
if (seek_ !== undefined) {
63+
if (typeof seek_ !== 'number' && auditEvent.id.equals(seek_)) {
5964
continue;
6065
}
6166
}

0 commit comments

Comments
 (0)