1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-06 12:02:40 +03:00

Update some more

This commit is contained in:
Michael Telatynski
2021-07-12 09:10:27 +01:00
parent b33429317c
commit c0e16ac98c
4 changed files with 11 additions and 12 deletions

View File

@@ -14,12 +14,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import { IPublicRoomsChunk } from "../client";
import { IPublicRoomsChunkRoom } from "../client";
// Types relating to Rooms of type `m.space` and related APIs
/* eslint-disable camelcase */
export interface ISpaceSummaryRoom extends IPublicRoomsChunk {
export interface ISpaceSummaryRoom extends IPublicRoomsChunkRoom {
num_refs: number;
room_type: string;
}

View File

@@ -21,7 +21,7 @@ limitations under the License.
import { EventEmitter } from "events";
import { ISyncStateData, SyncApi } from "./sync";
import { EventStatus, IContent, IDecryptOptions, MatrixEvent } from "./models/event";
import { EventStatus, IContent, IDecryptOptions, IEvent, MatrixEvent } from "./models/event";
import { StubStore } from "./store/stub";
import { createNewMatrixCall, MatrixCall } from "./webrtc/call";
import { Filter, IFilterDefinition } from "./filter";
@@ -556,7 +556,7 @@ interface IRoomInitialSyncResponse {
state?: IStateEventWithRoomId[];
visibility: Visibility;
account_data?: IMinimalEvent[];
presence: any; // undocumented
presence: Partial<IEvent>; // legacy and undocumented, api is deprecated so this won't get attention
}
interface IJoinedMembersResponse {
@@ -568,7 +568,7 @@ interface IJoinedMembersResponse {
};
}
export interface IPublicRoomsChunk {
export interface IPublicRoomsChunkRoom {
room_id: string;
name?: string;
avatar_url?: string;
@@ -581,7 +581,7 @@ export interface IPublicRoomsChunk {
}
interface IPublicRoomsResponse {
chunk: IPublicRoomsChunk[];
chunk: IPublicRoomsChunkRoom[];
next_batch?: string;
prev_batch?: string;
total_room_count_estimate?: number;
@@ -657,7 +657,7 @@ export interface IInstance {
icon?: string;
fields: object;
network_id: string;
// XXX: this is undocumented but we rely on it.
// XXX: this is undocumented but we rely on it: https://github.com/matrix-org/matrix-doc/issues/3203
instance_id: string;
}

View File

@@ -15,9 +15,9 @@ limitations under the License.
*/
import { MatrixClient } from "./client";
import { MatrixEvent } from "./models/event";
import { IEvent, MatrixEvent } from "./models/event";
export type EventMapper = (obj: any) => MatrixEvent;
export type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;
export interface MapperOpts {
preventReEmit?: boolean;
@@ -28,7 +28,7 @@ export function eventMapperFor(client: MatrixClient, options: MapperOpts): Event
const preventReEmit = Boolean(options.preventReEmit);
const decrypt = options.decrypt !== false;
function mapper(plainOldJsObject) {
function mapper(plainOldJsObject: Partial<IEvent>) {
const event = new MatrixEvent(plainOldJsObject);
if (event.isEncrypted()) {
if (!preventReEmit) {

View File

@@ -329,8 +329,7 @@ export class SyncApi {
const stateEvents = response.state.map(client.getEventMapper());
const messages = response.messages.chunk.map(client.getEventMapper());
// XXX: copypasted from /sync until we kill off this
// minging v1 API stuff)
// XXX: copypasted from /sync until we kill off this minging v1 API stuff)
// handle presence events (User objects)
if (response.presence && Array.isArray(response.presence)) {
response.presence.map(client.getEventMapper()).forEach(