Skip to content

Commit 957553c

Browse files
committed
Add more type fixes
1 parent 55bd425 commit 957553c

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Diff for: packages/base/matrix-event.gts

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export type IndexRealmEventContent =
287287
| CopiedIndexEventContent
288288
| IncrementalIndexInitiationContent;
289289

290-
interface IncrementalIndexEventContent {
290+
export interface IncrementalIndexEventContent {
291291
eventName: 'index';
292292
indexType: 'incremental';
293293
invalidations: string[];

Diff for: packages/realm-server/tests/realm-endpoints-test.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,15 @@ import {
7070
import { resetCatalogRealms } from '../handlers/handle-fetch-catalog-realms';
7171
import { APP_BOXEL_REALM_EVENT_EVENT_TYPE } from '@cardstack/runtime-common/matrix-constants';
7272
import type {
73+
IncrementalIndexEventContent,
7374
MatrixEvent,
7475
RealmEventEvent,
76+
RealmEventEventContent,
7577
} from 'https://cardstack.com/base/matrix-event';
7678
import isEqual from 'lodash/isEqual';
7779

80+
import wtfnode from 'wtfnode';
81+
7882
setGracefulCleanup();
7983
const testRealmURL = new URL('http://127.0.0.1:4444/');
8084
const testRealm2URL = new URL('http://127.0.0.1:4445/test/');
@@ -925,7 +929,7 @@ module(basename(__filename), function () {
925929
messages,
926930
'index',
927931
'incremental',
928-
);
932+
) as IncrementalIndexEventContent;
929933

930934
id = incrementalEvent!.content.invalidations[0].split('/').pop()!;
931935
assert.true(uuidValidate(id!), 'card identifier is a UUID');
@@ -4075,10 +4079,16 @@ function findRealmEvent(
40754079
(m) =>
40764080
m.type === APP_BOXEL_REALM_EVENT_EVENT_TYPE &&
40774081
m.content.eventName === eventName &&
4078-
m.content.indexType === indexType,
4082+
(realmEventIsIndex(m.content) ? m.content.indexType === indexType : true),
40794083
);
40804084
}
40814085

4086+
function realmEventIsIndex(
4087+
event: RealmEventEventContent,
4088+
): event is IncrementalIndexEventContent {
4089+
return event.eventName === 'index';
4090+
}
4091+
40824092
function matchRealmEvent(events: MatrixEvent[], event: any) {
40834093
return events.find(
40844094
(m) => m.type === event.type && isEqual(event.content, m.content),

0 commit comments

Comments
 (0)