Skip to content

Commit

Permalink
Regenerate types and fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbrand committed Sep 4, 2024
1 parent f91d5e2 commit ace2fe4
Show file tree
Hide file tree
Showing 208 changed files with 565 additions and 574 deletions.
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/headless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"pluggable.js": "3.0.1",
"sizzle": "^2.3.5",
"sprintf-js": "^1.1.2",
"strophe.js": "strophe/strophejs#120807d90c881a5e351e3129e9a4985a7d699628",
"strophe.js": "strophe/strophejs#4a77b265c3b5da882b8f805016a0c587dbd63e3c",
"urijs": "^1.19.10"
},
"devDependencies": {}
Expand Down
1 change: 0 additions & 1 deletion src/headless/plugins/muc/muc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2352,7 +2352,6 @@ class MUC extends ChatBox {
async onMessage (attrs) {
attrs = await attrs;
if (isErrorObject(attrs)) {
attrs.stanza && log.error(attrs.stanza);
return log.error(attrs.message);
} else if (attrs.type === 'error' && !(await this.shouldShowErrorMessage(attrs))) {
return;
Expand Down
6 changes: 5 additions & 1 deletion src/headless/shared/connection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,10 @@ export class Connection extends Strophe.Connection {
*/
export class MockConnection extends Connection {

/**
* @param {string} service - The BOSH or WebSocket service URL.
* @param {import('strophe.js/src/types/connection').ConnectionOptions} options - The configuration options
*/
constructor (service, options) {
super(service, options);

Expand All @@ -466,7 +470,7 @@ export class MockConnection extends Connection {
'</session>'+
'</stream:features>').firstElementChild;

// eslint-disable-next-line @typescript-eslint/no-empty-function
// @ts-ignore
this._proto._processRequest = () => {};
this._proto._disconnect = () => this._onDisconnectTimeout();
// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand Down
18 changes: 9 additions & 9 deletions src/headless/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ export { EmojiPicker } from "./plugins/emoji/index.js";
export { MAMPlaceholderMessage } from "./plugins/mam/index.js";
export { XMPPStatus } from "./plugins/status/index.js";
export default converse;
import { api } from "./shared/index.js";
import converse from "./shared/api/public.js";
import { _converse } from "./shared/index.js";
import { i18n } from "./shared/index.js";
import log from "./log.js";
import u from "./utils/index.js";
import { api } from './shared/index.js';
import converse from './shared/api/public.js';
import { _converse } from './shared/index.js';
import { i18n } from './shared/index.js';
import log from './log.js';
import u from './utils/index.js';
export const constants: typeof shared_constants & typeof muc_constants;
import { parsers } from "./shared/index.js";
import { constants as shared_constants } from "./shared/index.js";
import * as muc_constants from "./plugins/muc/constants.js";
import { parsers } from './shared/index.js';
import { constants as shared_constants } from './shared/index.js';
import * as muc_constants from './plugins/muc/constants.js';
export { api, converse, _converse, i18n, log, u, parsers };
export { Bookmark, Bookmarks } from "./plugins/bookmarks/index.js";
export { ChatBox, Message, Messages } from "./plugins/chat/index.js";
Expand Down
10 changes: 5 additions & 5 deletions src/headless/types/log.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export namespace LEVELS {
const debug: number;
const info: number;
const warn: number;
const error: number;
const fatal: number;
let debug: number;
let info: number;
let warn: number;
let error: number;
let fatal: number;
}
declare namespace _default {
/**
Expand Down
12 changes: 6 additions & 6 deletions src/headless/types/plugins/adhoc/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ declare namespace _default {
* @param {string} node
* @returns {Promise<AdHocCommandResult>}
*/
function fetchCommandForm(jid: string, node: string): Promise<import("./utils.js").AdHocCommandResult>;
function fetchCommandForm(jid: string, node: string): Promise<AdHocCommandResult>;
/**
* @method api.adhoc.runCommand
* @param {String} jid
Expand All @@ -20,9 +20,9 @@ declare namespace _default {
* @param {String} node
* @param {Array<{ [k:string]: string }>} inputs
*/
function runCommand(jid: string, sessionid: string, node: string, action: AdHocCommandAction, inputs: {
function runCommand(jid: string, sessionid: string, node: string, action: AdHocCommandAction, inputs: Array<{
[k: string]: string;
}[]): Promise<{
}>): Promise<{
note: any;
type?: import("../../shared/parsers.js").XFormResponseType;
title?: string;
Expand All @@ -37,7 +37,7 @@ declare namespace _default {
}
}
export default _default;
export type AdHocCommand = import('./utils').AdHocCommand;
export type AdHocCommandResult = import('./utils').AdHocCommandResult;
export type AdHocCommandAction = 'execute' | 'cancel' | 'prev' | 'next' | 'complete';
export type AdHocCommand = import("./utils").AdHocCommand;
export type AdHocCommandResult = import("./utils").AdHocCommandResult;
export type AdHocCommandAction = "execute" | "cancel" | "prev" | "next" | "complete";
//# sourceMappingURL=api.d.ts.map
6 changes: 3 additions & 3 deletions src/headless/types/plugins/adhoc/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ export type AdHocCommand = {
};
export type AdHocCommandResultNote = {
text: string;
type: 'info' | 'warn' | 'error';
type: "info" | "warn" | "error";
};
export type AdHocCommandAttrs = {
sessionid: string;
actions?: string[];
note?: AdHocCommandResultNote;
};
export type AdHocCommandResult = XForm & AdHocCommandAttrs;
export type TemplateResult = import('lit').TemplateResult;
export type XForm = import('../../shared/parsers').XForm;
export type TemplateResult = import("lit").TemplateResult;
export type XForm = import("../../shared/parsers").XForm;
//# sourceMappingURL=utils.d.ts.map
4 changes: 2 additions & 2 deletions src/headless/types/plugins/bookmarks/collection.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default Bookmarks;
export type MUC = import('../muc/muc.js').default;
export type MUC = import("../muc/muc.js").default;
declare class Bookmarks extends Collection {
static checkBookmarksSupport(): Promise<any>;
constructor();
Expand Down Expand Up @@ -32,5 +32,5 @@ declare class Bookmarks extends Collection {
getUnopenedBookmarks(): Promise<any>;
}
import { Collection } from "@converse/skeletor";
import Bookmark from "./model.js";
import Bookmark from './model.js';
//# sourceMappingURL=collection.d.ts.map
4 changes: 2 additions & 2 deletions src/headless/types/plugins/bookmarks/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Bookmark from "./model.js";
import Bookmarks from "./collection.js";
import Bookmark from './model.js';
import Bookmarks from './collection.js';
export { Bookmark, Bookmarks };
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion src/headless/types/plugins/bookmarks/model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export default Bookmark;
declare class Bookmark extends Model {
getDisplayName(): any;
}
import { Model } from "@converse/skeletor";
import { Model } from '@converse/skeletor';
//# sourceMappingURL=model.d.ts.map
2 changes: 1 addition & 1 deletion src/headless/types/plugins/bosh/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function startNewPreboundBOSHSession(): void;
* @param {unknown} _
* @param {LoginHookPayload} payload
*/
export function attemptPrebind(_: unknown, payload: any): Promise<any>;
export function attemptPrebind(_: unknown, payload: LoginHookPayload): Promise<any>;
export function saveJIDToSession(): void;
export function clearSession(): void;
export function restoreBOSHSession(): Promise<boolean>;
Expand Down
2 changes: 1 addition & 1 deletion src/headless/types/plugins/caps/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Given a stanza, adds a XEP-0115 CAPS element
* @param {Strophe.Builder} stanza
*/
export function addCapsNode(stanza: any): Promise<any>;
export function addCapsNode(stanza: Strophe.Builder): Promise<any>;
export namespace Strophe {
type Builder = any;
}
Expand Down
6 changes: 3 additions & 3 deletions src/headless/types/plugins/chat/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ declare namespace _default {
* @param {object} [attrs] An object containing configuration attributes.
* @returns {Promise<ChatBox|ChatBox[]>}
*/
function create(jids: string | string[], attrs?: any): Promise<import("./model.js").default | import("./model.js").default[]>;
function create(jids: string | string[], attrs?: object): Promise<ChatBox | ChatBox[]>;
/**
* Opens a new one-on-one chat.
*
Expand Down Expand Up @@ -72,9 +72,9 @@ declare namespace _default {
* const models = await api.chats.get();
*
*/
function get(jids: string | string[], attrs?: any, create?: boolean): Promise<import("./model.js").default[]>;
function get(jids: string | string[], attrs?: any, create?: boolean): Promise<ChatBox[]>;
}
}
export default _default;
export type ChatBox = import('./model.js').default;
export type ChatBox = import("./model.js").default;
//# sourceMappingURL=api.d.ts.map
6 changes: 3 additions & 3 deletions src/headless/types/plugins/chat/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ChatBox from "./model.js";
import Message from "./message.js";
import Messages from "./messages.js";
import ChatBox from './model.js';
import Message from './message.js';
import Messages from './messages.js';
export { ChatBox, Message, Messages };
//# sourceMappingURL=index.d.ts.map
4 changes: 2 additions & 2 deletions src/headless/types/plugins/chat/message.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default Message;
export type Model = import('@converse/skeletor').Model;
export type Model = import("@converse/skeletor").Model;
/**
* Represents a (non-MUC) message.
* These can be either `chat`, `normal` or `headline` messages.
Expand Down Expand Up @@ -74,5 +74,5 @@ declare class Message extends ModelWithContact {
};
uploadFile(): void;
}
import ModelWithContact from "./model-with-contact.js";
import ModelWithContact from './model-with-contact.js';
//# sourceMappingURL=message.d.ts.map
4 changes: 2 additions & 2 deletions src/headless/types/plugins/chat/messages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ declare class Messages extends Collection {
fetched: any;
chatbox: any;
}
import { Collection } from "@converse/skeletor";
import Message from "./message.js";
import { Collection } from '@converse/skeletor';
import Message from './message.js';
//# sourceMappingURL=messages.d.ts.map
4 changes: 2 additions & 2 deletions src/headless/types/plugins/chat/model-with-contact.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ declare class ModelWithContact extends ColorAwareModel {
* @public
* @type {RosterContact|XMPPStatus}
*/
public contact: import("../status/status.js").default | import("../roster/contact").default;
public contact: import("../roster/contact").default | import("../status/status.js").default;
/**
* @public
* @type {VCard}
Expand All @@ -16,5 +16,5 @@ declare class ModelWithContact extends ColorAwareModel {
*/
setModelContact(jid: string): Promise<void>;
}
import { ColorAwareModel } from "../../shared/color.js";
import { ColorAwareModel } from '../../shared/color.js';
//# sourceMappingURL=model-with-contact.d.ts.map
12 changes: 6 additions & 6 deletions src/headless/types/plugins/chat/model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ declare class ChatBox extends ModelWithContact {
* @method ChatBox#setChatState
* @param { string } state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)
*/
setChatState(state: string, options: any): ChatBox;
setChatState(state: string, options: any): this;
chat_state_timeout: NodeJS.Timeout;
/**
* Given an error `<message>` stanza's attributes, find the saved message model which is
Expand Down Expand Up @@ -161,15 +161,15 @@ declare class ChatBox extends ModelWithContact {
* @param { Boolean } force - Whether a marker should be sent for the
* message, even if it didn't include a `markable` element.
*/
sendMarkerForLastMessage(type?: ('received' | 'displayed' | 'acknowledged'), force?: boolean): void;
sendMarkerForLastMessage(type?: ("received" | "displayed" | "acknowledged"), force?: boolean): void;
/**
* Given the passed in message object, send a XEP-0333 chat marker.
* @param { Message } msg
* @param { ('received'|'displayed'|'acknowledged') } [type='displayed']
* @param { Boolean } force - Whether a marker should be sent for the
* message, even if it didn't include a `markable` element.
*/
sendMarkerForMessage(msg: import("./message.js").default, type?: ('received' | 'displayed' | 'acknowledged'), force?: boolean): void;
sendMarkerForMessage(msg: import("./message.js").default, type?: ("received" | "displayed" | "acknowledged"), force?: boolean): void;
handleChatMarker(attrs: any): boolean;
sendReceiptStanza(to_jid: any, id: any): void;
handleReceipt(attrs: any): boolean;
Expand Down Expand Up @@ -224,7 +224,7 @@ declare class ChatBox extends ModelWithContact {
/**
* @param {boolean} force
*/
maybeShow(force: boolean): ChatBox;
maybeShow(force: boolean): this;
/**
* Indicates whether the chat is hidden and therefore
* whether a newly received message will be visible
Expand All @@ -247,6 +247,6 @@ declare class ChatBox extends ModelWithContact {
isScrolledUp(): any;
canPostMessages(): boolean;
}
import ModelWithContact from "./model-with-contact.js";
import { Model } from "@converse/skeletor";
import ModelWithContact from './model-with-contact.js';
import { Model } from '@converse/skeletor';
//# sourceMappingURL=model.d.ts.map
6 changes: 3 additions & 3 deletions src/headless/types/plugins/chat/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export function handleMessageStanza(stanza: Element | Builder): Promise<void>;
* See [XEP-0280](https://xmpp.org/extensions/xep-0280.html#enabling)
*/
export function enableCarbons(): Promise<void>;
export type ChatBox = import('./model.js').default;
export type ChatBox = import("./model.js").default;
export type MessageAttributes = any;
export type Builder = import('strophe.js').Builder;
import { Model } from "@converse/skeletor";
export type Builder = import("strophe.js").Builder;
import { Model } from '@converse/skeletor';
//# sourceMappingURL=utils.d.ts.map
10 changes: 5 additions & 5 deletions src/headless/types/plugins/chatboxes/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ declare namespace _default {
* @param {Object} attrs An object containing configuration attributes
* @param {ModelClass} model - The type of chatbox that should be created
*/
function create(jids: string | string[], attrs: any, model: new (attrs: any, options: any) => import("../chat/model.js").default): Promise<import("../chat/model.js").default | import("../chat/model.js").default[]>;
function create(jids: string | string[], attrs: any, model: new (attrs: object, options: object) => ChatBox): Promise<import("../chat/model.js").default | import("../chat/model.js").default[]>;
/**
* @method api.chatboxes.get
* @param {string|string[]} [jids] - A JID or array of JIDs
Expand All @@ -24,16 +24,16 @@ declare namespace _default {
* @param {string} type - The type name
* @param {ModelClass} model - The model which will be instantiated for the given type name.
*/
function add(type: string, model: new (attrs: any, options: any) => import("../chat/model.js").default): void;
function add(type: string, model: new (attrs: object, options: object) => ChatBox): void;
/**
* @method api.chatboxes.registry.get
* @param {string} type - The type name
* @return {ModelClass} model - The model which will be instantiated for the given type name.
*/
function get(type: string): new (attrs: any, options: any) => import("../chat/model.js").default;
function get(type: string): new (attrs: object, options: object) => ChatBox;
}
}
export default _default;
export type Model = import('@converse/skeletor').Model;
export type ChatBox = import('../chat/model.js').default;
export type Model = import("@converse/skeletor").Model;
export type ChatBox = import("../chat/model.js").default;
//# sourceMappingURL=api.d.ts.map
6 changes: 3 additions & 3 deletions src/headless/types/plugins/chatboxes/chatboxes.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default ChatBoxes;
export type ChatBox = import('../../plugins/chat/model.js').default;
export type MUC = import('../../plugins/muc/muc').default;
export type Model = import('@converse/skeletor').Model;
export type ChatBox = import("../../plugins/chat/model.js").default;
export type MUC = import("../../plugins/muc/muc").default;
export type Model = import("@converse/skeletor").Model;
declare class ChatBoxes extends Collection {
/**
* @param {Model[]} models
Expand Down
Loading

0 comments on commit ace2fe4

Please sign in to comment.