From ec7994e1497c432de766b833ac7691e80d2f7bf7 Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Tue, 10 Dec 2024 12:17:09 +0000 Subject: [PATCH] Linting, ts types, general tidy --- biome.json | 4 +- examples/auth-basic.json5 | 104 --------------------------------- examples/basic-fork.json | 9 --- examples/simple.json | 9 --- src/graph.ts | 4 +- src/index.ts | 2 +- src/state_resolver.test.ts | 2 +- src/state_resolver.ts | 10 ++-- style.css | 23 ++++---- tsconfig,json => tsconfig.json | 15 ++--- 10 files changed, 28 insertions(+), 154 deletions(-) delete mode 100644 examples/auth-basic.json5 delete mode 100644 examples/basic-fork.json delete mode 100644 examples/simple.json rename tsconfig,json => tsconfig.json (73%) diff --git a/biome.json b/biome.json index 992efbc..3a1e5df 100644 --- a/biome.json +++ b/biome.json @@ -24,7 +24,9 @@ } }, "files": { - "maxSize": 2097152 + "maxSize": 2097152, + "ignoreUnknown": true, + "ignore": ["shims/*", "public/*"] }, "json": { "formatter": { diff --git a/examples/auth-basic.json5 b/examples/auth-basic.json5 deleted file mode 100644 index 2e35b4b..0000000 --- a/examples/auth-basic.json5 +++ /dev/null @@ -1,104 +0,0 @@ -{ - "tardis_version": 1, - "calculate_event_ids": true, - "room_version": "10", - "room_id": "!basic-example:matrix.org", - "annotations": { - "title": " This is a basic example of a linear DAG, used to illustrate the main features of tardis.\n\ - State events have larger nodes than messages.\n\ - Use the arrow buttons or click on an event number to jump to that event as the 'current' event.\n\ - \n\ - Resolving State:\n\ - Click the 'Resolve State' button to calculate what the state after the current event is. This requires a shim URL.\n\ - The state events marked in green are part of the current state at that event.", - "events": { - "$BOB_JOIN": "Bob joins the room. He will leave later on.", - "$BOB_KICK": "Bob is kicked by Kegan." - } - }, - "precalculated_state_after": { - "$BOB_JOIN": ["$CREATE", "$PL"] - }, - "events": [ - { - "event_id": "$CREATE", - "depth": 1, - "type": "m.room.create", "state_key":"", - "sender": "@kegan:matrix.org", - "content": {"creator": "@kegan:matrix.org", "room_version": "10"}, - "auth_events": [], - "prev_events": [], - "origin_server_ts": 1728652174091 - }, - { - "event_id": "$JOIN", - "depth": 2, - "type": "m.room.member", "state_key":"@kegan:matrix.org", - "sender": "@kegan:matrix.org", - "content": {"membership": "join"}, - "auth_events": [], - "prev_events": ["$CREATE"], - "origin_server_ts": 1728652174092 - }, - { - "event_id": "$PL", - "depth": 3, - "type": "m.room.power_levels", "state_key":"", - "sender": "@kegan:matrix.org", - "content": {"ban": 50, "kick": 50, "users": {"@kegan:matrix.org": 100}, "events": {"m.room.name": 50, "m.room.avatar": 50, "m.room.tombstone": 100, "m.room.encryption": 100, "m.room.server_acl": 100, "m.room.power_levels": 100, "m.room.canonical_alias": 50, "m.room.history_visibility": 100}, "invite": 50, "redact": 50, "historical": 100, "m.call.invite": 50, "state_default": 50, "users_default": 0, "events_default": 0}, - "prev_events": ["$JOIN"], - "auth_events": ["$CREATE","$JOIN"], - "origin_server_ts": 1728652174096 - }, - { - "event_id": "$JR", - "depth": 4, - "type": "m.room.join_rules", "state_key": "", - "sender": "@kegan:matrix.org", - "content": {"join_rule": "public"}, - "prev_events": ["$PL"], - "auth_events": ["$CREATE","$JOIN","$PL"], - "origin_server_ts": 1728652174545 - }, - { - "event_id": "$MSG", - "depth": 5, - "type": "m.room.message", - "sender": "@kegan:matrix.org", - "content": {"body": "this is the first message in the room.", "msgtype": "m.text", "m.mentions": {}}, - "auth_events": ["$CREATE", "$JOIN", "$PL"], - "prev_events": ["$JR"], - "origin_server_ts": 1728652182530 - }, - { - "event_id": "$BOB_JOIN", - "depth": 6, - "type": "m.room.member", "state_key":"@bob:matrix.org", - "sender": "@bob:matrix.org", - "content": {"membership": "join"}, - "auth_events": ["$CREATE","$JR","$PL"], - "prev_events": ["$MSG"], - "origin_server_ts": 1728652174092 - }, - { - "event_id": "$MSG_BOB", - "depth": 7, - "type": "m.room.message", - "sender": "@bob:matrix.org", - "content": {"body": "bob saying something.", "msgtype": "m.text", "m.mentions": {}}, - "auth_events": ["$CREATE", "$BOB_JOIN", "$PL"], - "prev_events": ["$BOB_JOIN"], - "origin_server_ts": 1728652182530 - }, - { - "event_id": "$BOB_KICK", - "depth": 8, - "type": "m.room.member", "state_key":"@bob:matrix.org", - "sender": "@kegan:matrix.org", - "content": {"membership": "leave"}, - "auth_events": ["$CREATE","$JR","$PL", "$JOIN", "$BOB_JOIN"], - "prev_events": ["$MSG_BOB"], - "origin_server_ts": 1728652174092 - }, - ], -} \ No newline at end of file diff --git a/examples/basic-fork.json b/examples/basic-fork.json deleted file mode 100644 index 38e96d1..0000000 --- a/examples/basic-fork.json +++ /dev/null @@ -1,9 +0,0 @@ -{"type": "m.room.create", "depth": 1, "hashes": {"sha256": "3zF8Kk+J/ZGrfUjfgg3OjtzMVsvOVDIC+Ew0BS3L4gY"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"creator": "@kegan:matrix.org", "room_version": "10"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY", "unsigned": {"age_ts": 1728652174091}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "4/m8rQEZupyPn+SyNMesB5BqNux66Tyyl/bmBKVQay3jsNZuhUdelN056kQJUhIg7HPRes17ghKifHOvaOvvAw"}}, "auth_events": [], "prev_events": [], "origin_server_ts": 1728652174091} -{"type": "m.room.member", "depth": 2, "hashes": {"sha256": "VVIP2Wxb+nyzhgcvrJD82nNQYb3Vd5ZbOOIRbu8YGP8"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"avatar_url": "mxc://matrix.org/gImPYMAYQWpffViAorQsjbIs", "membership": "join", "displayname": "Kegan"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "unsigned": {"age_ts": 1728652174308}, "state_key": "@kegan:matrix.org", "signatures": {"matrix.org": {"ed25519:a_RXGa": "c01Fydab2/KdQ+EqVouiii+W1YGxHD4PmNn/U3A4qsF9Bwc9Y0A9iyTXMvUR4Nsz/1YfkDgchkj0/2qBJZ9ECQ"}}, "auth_events": ["$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "origin_server_ts": 1728652174308} -{"type": "m.room.power_levels", "depth": 3, "hashes": {"sha256": "mQxzMn0yPhfD+KxoQFIDQVQvMWX9I3ujaTShRSYYKk8"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"ban": 50, "kick": 50, "users": {"@kegan:matrix.org": 100}, "events": {"m.room.name": 50, "m.room.avatar": 50, "m.room.tombstone": 100, "m.room.encryption": 100, "m.room.server_acl": 100, "m.room.power_levels": 100, "m.room.canonical_alias": 50, "m.room.history_visibility": 100}, "invite": 50, "redact": 50, "historical": 100, "m.call.invite": 50, "state_default": 50, "users_default": 0, "events_default": 0}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "unsigned": {"age_ts": 1728652174519}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "ZHbQCeWaaHl249hlVpzm2UU8/1SWtAxDa6Z/ge5Mk3NHalC4WfbWtzjLzXrhfVYkhSTG0lfV6/EDao7bPuEjBQ"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo"], "origin_server_ts": 1728652174519} -{"type": "m.room.canonical_alias", "depth": 4, "hashes": {"sha256": "WWyr4BL6gRVn2PWjSQ2wYWO6hVF3OQ/vM89QxpFMRnk"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"alias": "#test-resolve-room:matrix.org"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$aCToy0aQOfhURh5jsakQ9Ovk6fMGbWnmnGh7gkZUiFI", "unsigned": {"age_ts": 1728652174544}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "eji69yq5bybnpE9m5OZh2sFeaB7MZKolMhDqlunnpyegPI9VgUtPSZF4kcXZ9ZczBoLA7eC4/HbhwpCQ7c1aAg"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg"], "origin_server_ts": 1728652174544} -{"type": "m.room.join_rules", "depth": 5, "hashes": {"sha256": "HSYkwp9nfNTJX8zMJt+s6Q96oapIDRHyfcuVs71P58M"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"join_rule": "public"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$HLdW9q8VIIPTpyKfF85fDYrEu8UAp861wdpUZVzYgJQ", "unsigned": {"age_ts": 1728652174545}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "MDPlgzj97v5QwP60fzui6il5NHGU3BbUfm/BBxeLp79/HpPD6hYlkYYeLXoqI4N1AxtbLa3XtldGPU6vzR3HCw"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$aCToy0aQOfhURh5jsakQ9Ovk6fMGbWnmnGh7gkZUiFI"], "origin_server_ts": 1728652174545} -{"type": "m.room.history_visibility", "depth": 6, "hashes": {"sha256": "7jjPzCZW37vDlpTVHhpNdt2a8ZEITtR8PrduIVAFOcw"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"history_visibility": "shared"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$iojoMzC2XDpR0YHDdmQD1p0E9S1YCj4GsC63QWIUyJY", "unsigned": {"age_ts": 1728652174545}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "F9yzfRxG54oiWrYVW+G0Q7SuAhK42XAIUVizd/yLRbXG91uS/SSH7ZAA4OAAah8afmWYuzWXvUgImCqziQ+KBg"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$HLdW9q8VIIPTpyKfF85fDYrEu8UAp861wdpUZVzYgJQ"], "origin_server_ts": 1728652174545} -{"type": "m.room.name", "depth": 7, "hashes": {"sha256": "Cd6glFNK04BzaNqHCaL/fKqSby3oMeEYIAKD3sxa8ok"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"name": "test resolve room"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$A5z9GLL8ABCYg4SKujf_ehtW52yGoGhZuQGc0nspEeU", "unsigned": {"age_ts": 1728652174546}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "ypYzuw8nG+38o6WM4OrFeEI+xwk1QvIxZBRB3RtZGtf2y6Z3VgliO7hbsYx/AjbRCstMsrme1DEV8OiMeWIYDw"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$iojoMzC2XDpR0YHDdmQD1p0E9S1YCj4GsC63QWIUyJY"], "origin_server_ts": 1728652174546} -{"type": "m.room.name", "depth": 7, "hashes": {"sha256": "Cd6glFNK04BzaNqHCaL/fKqSby3oMeEYIAKD3sxa8ok"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"name": "test resolve room forked"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$A5z9GLL8ABCYg4SKujf_ehtW52yGoGhZuQGc0nspEeU-fork", "unsigned": {"age_ts": 1728652174546}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "ypYzuw8nG+38o6WM4OrFeEI+xwk1QvIxZBRB3RtZGtf2y6Z3VgliO7hbsYx/AjbRCstMsrme1DEV8OiMeWIYDw"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$iojoMzC2XDpR0YHDdmQD1p0E9S1YCj4GsC63QWIUyJY"], "origin_server_ts": 1728652174546} - diff --git a/examples/simple.json b/examples/simple.json deleted file mode 100644 index c157d7b..0000000 --- a/examples/simple.json +++ /dev/null @@ -1,9 +0,0 @@ -{"type": "m.room.create", "depth": 1, "hashes": {"sha256": "3zF8Kk+J/ZGrfUjfgg3OjtzMVsvOVDIC+Ew0BS3L4gY"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"creator": "@kegan:matrix.org", "room_version": "10"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY", "unsigned": {"age_ts": 1728652174091}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "4/m8rQEZupyPn+SyNMesB5BqNux66Tyyl/bmBKVQay3jsNZuhUdelN056kQJUhIg7HPRes17ghKifHOvaOvvAw"}}, "auth_events": [], "prev_events": [], "origin_server_ts": 1728652174091} -{"type": "m.room.member", "depth": 2, "hashes": {"sha256": "VVIP2Wxb+nyzhgcvrJD82nNQYb3Vd5ZbOOIRbu8YGP8"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"avatar_url": "mxc://matrix.org/gImPYMAYQWpffViAorQsjbIs", "membership": "join", "displayname": "Kegan"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "unsigned": {"age_ts": 1728652174308}, "state_key": "@kegan:matrix.org", "signatures": {"matrix.org": {"ed25519:a_RXGa": "c01Fydab2/KdQ+EqVouiii+W1YGxHD4PmNn/U3A4qsF9Bwc9Y0A9iyTXMvUR4Nsz/1YfkDgchkj0/2qBJZ9ECQ"}}, "auth_events": ["$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "origin_server_ts": 1728652174308} -{"type": "m.room.power_levels", "depth": 3, "hashes": {"sha256": "mQxzMn0yPhfD+KxoQFIDQVQvMWX9I3ujaTShRSYYKk8"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"ban": 50, "kick": 50, "users": {"@kegan:matrix.org": 100}, "events": {"m.room.name": 50, "m.room.avatar": 50, "m.room.tombstone": 100, "m.room.encryption": 100, "m.room.server_acl": 100, "m.room.power_levels": 100, "m.room.canonical_alias": 50, "m.room.history_visibility": 100}, "invite": 50, "redact": 50, "historical": 100, "m.call.invite": 50, "state_default": 50, "users_default": 0, "events_default": 0}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "unsigned": {"age_ts": 1728652174519}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "ZHbQCeWaaHl249hlVpzm2UU8/1SWtAxDa6Z/ge5Mk3NHalC4WfbWtzjLzXrhfVYkhSTG0lfV6/EDao7bPuEjBQ"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo"], "origin_server_ts": 1728652174519} -{"type": "m.room.canonical_alias", "depth": 4, "hashes": {"sha256": "WWyr4BL6gRVn2PWjSQ2wYWO6hVF3OQ/vM89QxpFMRnk"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"alias": "#test-resolve-room:matrix.org"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$aCToy0aQOfhURh5jsakQ9Ovk6fMGbWnmnGh7gkZUiFI", "unsigned": {"age_ts": 1728652174544}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "eji69yq5bybnpE9m5OZh2sFeaB7MZKolMhDqlunnpyegPI9VgUtPSZF4kcXZ9ZczBoLA7eC4/HbhwpCQ7c1aAg"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg"], "origin_server_ts": 1728652174544} -{"type": "m.room.join_rules", "depth": 5, "hashes": {"sha256": "HSYkwp9nfNTJX8zMJt+s6Q96oapIDRHyfcuVs71P58M"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"join_rule": "public"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$HLdW9q8VIIPTpyKfF85fDYrEu8UAp861wdpUZVzYgJQ", "unsigned": {"age_ts": 1728652174545}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "MDPlgzj97v5QwP60fzui6il5NHGU3BbUfm/BBxeLp79/HpPD6hYlkYYeLXoqI4N1AxtbLa3XtldGPU6vzR3HCw"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$aCToy0aQOfhURh5jsakQ9Ovk6fMGbWnmnGh7gkZUiFI"], "origin_server_ts": 1728652174545} -{"type": "m.room.history_visibility", "depth": 6, "hashes": {"sha256": "7jjPzCZW37vDlpTVHhpNdt2a8ZEITtR8PrduIVAFOcw"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"history_visibility": "shared"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$iojoMzC2XDpR0YHDdmQD1p0E9S1YCj4GsC63QWIUyJY", "unsigned": {"age_ts": 1728652174545}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "F9yzfRxG54oiWrYVW+G0Q7SuAhK42XAIUVizd/yLRbXG91uS/SSH7ZAA4OAAah8afmWYuzWXvUgImCqziQ+KBg"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$HLdW9q8VIIPTpyKfF85fDYrEu8UAp861wdpUZVzYgJQ"], "origin_server_ts": 1728652174545} -{"type": "m.room.name", "depth": 7, "hashes": {"sha256": "Cd6glFNK04BzaNqHCaL/fKqSby3oMeEYIAKD3sxa8ok"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"name": "test resolve room"}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$A5z9GLL8ABCYg4SKujf_ehtW52yGoGhZuQGc0nspEeU", "unsigned": {"age_ts": 1728652174546}, "state_key": "", "signatures": {"matrix.org": {"ed25519:a_RXGa": "ypYzuw8nG+38o6WM4OrFeEI+xwk1QvIxZBRB3RtZGtf2y6Z3VgliO7hbsYx/AjbRCstMsrme1DEV8OiMeWIYDw"}}, "auth_events": ["$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$iojoMzC2XDpR0YHDdmQD1p0E9S1YCj4GsC63QWIUyJY"], "origin_server_ts": 1728652174546} -{"type": "m.room.message", "depth": 8, "hashes": {"sha256": "l02uJl91yHpVopMkChN4gCJIy4zFf4Go/iICtr0VKNk"}, "origin": "matrix.org", "sender": "@kegan:matrix.org", "content": {"body": "this is the first message in the room.", "msgtype": "m.text", "m.mentions": {}}, "room_id": "!jpViMZBlnuKxAKpsem:matrix.org", "event_id": "$_-YRKNmQfY6o9ibTvOPlHFVxkHvh1k3avAPUn49w9nE", "unsigned": {"age_ts": 1728652182530}, "signatures": {"matrix.org": {"ed25519:a_RXGa": "kjHV6A//PNmAmdz16MbhgqPi8/5BujXLTwcRcz1aPejZvWIg85NBWwqQpfy1jFIct4lMhADVEu4Ebjr8Odn/DQ"}}, "auth_events": ["$OaedSihFH9ThMiJsVKDIatVL5CAgtETWGuUUVgAjOAg", "$dVlIkqbTnz6_RRggTuTxuYNLdAtbkVSY47Lb-1rUWIo", "$ayBJ5cK-zydid3RXCV7OaqK-Wh9NZcpBwSqK0H5O1NY"], "prev_events": ["$A5z9GLL8ABCYg4SKujf_ehtW52yGoGhZuQGc0nspEeU"], "origin_server_ts": 1728652182530} - diff --git a/src/graph.ts b/src/graph.ts index af18ba1..3018909 100644 --- a/src/graph.ts +++ b/src/graph.ts @@ -1,7 +1,7 @@ import * as d3 from "d3"; -import type { EventID, MatrixEvent } from "./state_resolver"; -import type { Scenario } from "./scenario"; import { textRepresentation } from "./event_list"; +import type { Scenario } from "./scenario"; +import type { EventID, MatrixEvent } from "./state_resolver"; export interface RenderOptions { currentEventId: string; diff --git a/src/index.ts b/src/index.ts index 69d4d61..c20c2e7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -372,7 +372,7 @@ const setLoaderMessage = (text: string) => { loaderMsgElement.innerText = text; }; -document.getElementById("resolve")!.addEventListener("click", async (ev) => { +document.getElementById("resolve")!.addEventListener("click", async (_) => { if (!dag.shimUrl) { console.error("you need to set a shim url to resolve state!"); return {}; diff --git a/src/state_resolver.test.ts b/src/state_resolver.test.ts index 7c40ade..f3be2c8 100644 --- a/src/state_resolver.test.ts +++ b/src/state_resolver.test.ts @@ -66,7 +66,7 @@ describe("StateResolver", () => { const outstandingRequests: Array<{ id: string; data: DataResolveState }> = []; const sr = new StateResolver( { - sendResolveState: (id: string, data: DataResolveState) => { + sendResolveState: async (id: string, data: DataResolveState) => { outstandingRequests.push({ id: id, data: data, diff --git a/src/state_resolver.ts b/src/state_resolver.ts index d745aba..b1f2fc0 100644 --- a/src/state_resolver.ts +++ b/src/state_resolver.ts @@ -45,11 +45,11 @@ interface DataGetEvent { interface StateResolverReceiver { onGetEventRequest(data: DataGetEvent): MatrixEvent; - onResolveStateResponse(id: string, data: DataResolveState); + onResolveStateResponse(id: string, data: DataResolveState): void; } interface StateResolverSender { - sendResolveState(id: string, data: DataResolveState); + sendResolveState(id: string, data: DataResolveState): Promise; } interface ResolvedState { @@ -57,7 +57,7 @@ interface ResolvedState { } class StateResolver implements StateResolverReceiver { - inflightRequests: Map void>; + inflightRequests: Map void>; constructor( readonly sender: StateResolverSender, readonly getEvent: (data: DataGetEvent) => MatrixEvent, @@ -160,8 +160,8 @@ class StateResolverTransport implements StateResolverSender { this.ws.send(JSON.stringify(msg)); } - onWsClose(ev: CloseEvent) {} - onWsError(ev: Event) {} + onWsClose(_: CloseEvent) {} + onWsError(_: Event) {} onWsMessage(ev: MessageEvent) { // biome-ignore lint/suspicious/noExplicitAny: const msg = JSON.parse(ev.data) as WebSocketMessage; diff --git a/style.css b/style.css index 5d800d0..afad6fa 100644 --- a/style.css +++ b/style.css @@ -12,8 +12,7 @@ body { left: 0; padding: 8px; background-color: #a6b8c7; - border-color: #00060b; - border: 1px solid; + border: 1px solid #00060b; margin: 5px; display: flex; } @@ -94,27 +93,27 @@ body { display: none; } -.loader-status { - -} - @keyframes spin { - 0% { transform: rotate(0deg); } - 100% { transform: rotate(360deg); } + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } } .node-text { - font-family: Gill Sans,Gill Sans MT,Calibri,sans-serif; + font-family: Gill Sans, Calibri, sans-serif; } input { - font-family: Gill Sans,Gill Sans MT,Calibri,sans-serif; + font-family: Gill Sans, Calibri, sans-serif; } div { - font-family: Gill Sans,Gill Sans MT,Calibri,sans-serif; + font-family: Gill Sans, Calibri, sans-serif; } body { height: 100%; } .monospace { font-family: "Lucida Console", Courier, monospace; -} \ No newline at end of file +} diff --git a/tsconfig,json b/tsconfig.json similarity index 73% rename from tsconfig,json rename to tsconfig.json index e13d7f8..9eb5f91 100644 --- a/tsconfig,json +++ b/tsconfig.json @@ -3,11 +3,7 @@ "target": "ES2020", "useDefineForClassFields": true, "module": "ESNext", - "lib": [ - "ES2020", - "DOM", - "DOM.Iterable" - ], + "lib": ["ES2020", "DOM", "DOM.Iterable"], "skipLibCheck": true, /* Bundler mode */ "moduleResolution": "bundler", @@ -19,9 +15,8 @@ "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "strictPropertyInitialization": false }, - "include": [ - "src" - ] -} \ No newline at end of file + "include": ["src"] +}