Skip to content

Commit

Permalink
wip: creating additional tests for auditeventsget
Browse files Browse the repository at this point in the history
  • Loading branch information
CDeltakai committed Feb 14, 2025
1 parent c733337 commit 14f63d7
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 234 deletions.
6 changes: 3 additions & 3 deletions src/nodes/agent/handlers/NodesAuditEventsGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import type {
AgentAuditMessage,
} from '../types';
import type Audit from '../../../audit/Audit';
import type { AuditEvent } from '@/audit/types';
import { ServerHandler } from '@matrixai/rpc';
import * as auditUtils from '../../../audit/utils'
import { AuditEvent } from '@/audit/types';
import * as auditUtils from '../../../audit/utils';

/**
* Gets audit events from a node
Expand Down Expand Up @@ -48,7 +48,7 @@ class NodesAuditEventsGet extends ServerHandler<
yield {
id: auditUtils.encodeAuditEventId(auditEvent.id),
path: auditEvent.path,
data: auditEvent.data
data: auditEvent.data,
};
}
});
Expand Down
5 changes: 2 additions & 3 deletions src/nodes/agent/handlers/NodesClaimsGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { ServerHandler } from '@matrixai/rpc';
import * as claimsUtils from '../../../claims/utils';
import * as ids from '../../../ids';


/**
* Gets the sigchain claims of a node
*/
Expand All @@ -39,11 +38,11 @@ class NodesClaimsGet extends ServerHandler<
AgentRPCResponseResult<AgentClaimMessage>
> {
for await (const [claimId, signedClaim] of sigchain.getSignedClaims(
{
{
seek: decodedClaimId,
order: order,
limit: limit,
},
},
tran,
)) {
ctx.signal.throwIfAborted();
Expand Down
11 changes: 5 additions & 6 deletions src/nodes/agent/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { VaultAction, VaultName } from '../../vaults/types';
import type { SignedNotification } from '../../notifications/types';
import type { Host, Hostname, Port } from '../../network/types';
import type { NodeContact } from '../../nodes/types';
import { AuditEvent } from '@/audit/types';
import type { AuditEvent } from '@/audit/types';

type AgentRPCRequestParams<T extends JSONObject = JSONObject> =
JSONRPCRequestParams<T>;
Expand All @@ -30,21 +30,20 @@ type AuditIdMessage = {
limit?: number;
};

type AgentAuditMessage<T extends AuditEvent> = Omit<T, 'id'> & {
id: AuditEventIdEncoded
type AgentAuditMessage<T extends AuditEvent> = Omit<T, 'id'> & {
id: AuditEventIdEncoded;
};

type NodesClaimsGetMessage = {
seek?: ClaimIdEncoded | number;
order?: 'asc' | 'desc';
limit?: number;
}
limit?: number;
};

type ClaimIdMessage = {
claimIdEncoded: ClaimIdEncoded;
};


type AgentClaimMessage = Partial<ClaimIdMessage> & {
signedTokenEncoded: SignedTokenEncoded;
};
Expand Down
Loading

0 comments on commit 14f63d7

Please sign in to comment.