From 578c6114b1c158b7a425605122d4148ba1b24078 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 00:45:41 -0300 Subject: [PATCH 1/9] refactor: move declaration --- .../definition/externals/{ => meteor}/service-configuration.d.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apps/meteor/definition/externals/{ => meteor}/service-configuration.d.ts (100%) diff --git a/apps/meteor/definition/externals/service-configuration.d.ts b/apps/meteor/definition/externals/meteor/service-configuration.d.ts similarity index 100% rename from apps/meteor/definition/externals/service-configuration.d.ts rename to apps/meteor/definition/externals/meteor/service-configuration.d.ts From e2f75aa1571a0a5e67ea3b19aaf8e01a1bb968ca Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 00:45:59 -0300 Subject: [PATCH 2/9] refactor: remove unused declarations --- apps/meteor/definition/externals/asterisk-manager.d.ts | 3 --- .../definition/externals/less-plugin-autoprefixer.d.ts | 7 ------- apps/meteor/definition/externals/less/browser.d.ts | 5 ----- apps/meteor/definition/externals/mongodb.d.ts | 8 -------- 4 files changed, 23 deletions(-) delete mode 100644 apps/meteor/definition/externals/asterisk-manager.d.ts delete mode 100644 apps/meteor/definition/externals/less-plugin-autoprefixer.d.ts delete mode 100644 apps/meteor/definition/externals/less/browser.d.ts delete mode 100644 apps/meteor/definition/externals/mongodb.d.ts diff --git a/apps/meteor/definition/externals/asterisk-manager.d.ts b/apps/meteor/definition/externals/asterisk-manager.d.ts deleted file mode 100644 index 144b6055589c0..0000000000000 --- a/apps/meteor/definition/externals/asterisk-manager.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'asterisk-manager' { - export = any; // TODO -} diff --git a/apps/meteor/definition/externals/less-plugin-autoprefixer.d.ts b/apps/meteor/definition/externals/less-plugin-autoprefixer.d.ts deleted file mode 100644 index 5cd8f747c87e2..0000000000000 --- a/apps/meteor/definition/externals/less-plugin-autoprefixer.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module 'less-plugin-autoprefixer' { - import type { Plugin } from 'less'; - - const AutoPrefixerLessPlugin: Plugin; - - export = AutoPrefixerLessPlugin; -} diff --git a/apps/meteor/definition/externals/less/browser.d.ts b/apps/meteor/definition/externals/less/browser.d.ts deleted file mode 100644 index 4ecf43374df93..0000000000000 --- a/apps/meteor/definition/externals/less/browser.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare module 'less/lib/less-browser' { - function createLess(window: Window, options: Less.Options): LessStatic; - - export = createLess; -} diff --git a/apps/meteor/definition/externals/mongodb.d.ts b/apps/meteor/definition/externals/mongodb.d.ts deleted file mode 100644 index b3805e05dca4b..0000000000000 --- a/apps/meteor/definition/externals/mongodb.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import 'mongodb'; - -declare module 'mongodb' { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - interface FindOneOptions { - awaitData?: boolean; - } -} From 934d6bfef0016238c369ff3e0641413877dc5357 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 00:46:14 -0300 Subject: [PATCH 3/9] refactor: remove unused dependency --- apps/meteor/package.json | 1 - yarn.lock | 8 -------- 2 files changed, 9 deletions(-) diff --git a/apps/meteor/package.json b/apps/meteor/package.json index 4d36af88ea3c2..2fd2d6a8497ee 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -170,7 +170,6 @@ "ajv": "^8.20.0", "ajv-formats": "~3.0.1", "archiver": "^7.0.1", - "asterisk-manager": "^0.2.0", "atlassian-crowd-patched": "^0.5.1", "bad-words": "^3.0.4", "bcrypt": "^6.0.0", diff --git a/yarn.lock b/yarn.lock index bbd37c3a3d191..f26aeb490c183 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10260,7 +10260,6 @@ __metadata: ajv: "npm:^8.20.0" ajv-formats: "npm:~3.0.1" archiver: "npm:^7.0.1" - asterisk-manager: "npm:^0.2.0" atlassian-crowd-patched: "npm:^0.5.1" autoprefixer: "npm:^10.5.4" babel-loader: "npm:~10.0.0" @@ -17413,13 +17412,6 @@ __metadata: languageName: node linkType: hard -"asterisk-manager@npm:^0.2.0": - version: 0.2.0 - resolution: "asterisk-manager@npm:0.2.0" - checksum: 10/79922b9066bb77b39ed452f0c21eb15aaae2b3cbe7fc79eb798f7ad5aeb8e0510b050bb743e463d0124391dfaf907dc9552405be62616b88bd0700887f76a6f6 - languageName: node - linkType: hard - "astral-regex@npm:^2.0.0": version: 2.0.0 resolution: "astral-regex@npm:2.0.0" From 1d777043841015c360ac56fcd2bee39f681021e6 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 00:50:02 -0300 Subject: [PATCH 4/9] refactor: remove unreferenced globals --- apps/meteor/definition/externals/global.d.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/apps/meteor/definition/externals/global.d.ts b/apps/meteor/definition/externals/global.d.ts index 4d04816a0ac1e..c903c6f671174 100644 --- a/apps/meteor/definition/externals/global.d.ts +++ b/apps/meteor/definition/externals/global.d.ts @@ -12,12 +12,8 @@ declare global { }; interface Window { - setLanguage?: (language: string) => void; defaultUserLanguage?: () => string; DISABLE_ANIMATION?: boolean; - lastMessageWindow?: Record; - lastMessageWindowHistory?: Record; - favico?: any; ServiceConfiguration?: unknown; __meteor_runtime_config__: { ROOT_URL_PATH_PREFIX: string; @@ -25,11 +21,6 @@ declare global { }; } - interface PromiseConstructor { - await(promise: Promise): T; - await(value: T): T; - } - namespace NodeJS { interface Process { emit(event: 'message', message: any, sendHandle?: Server | Socket): boolean; From 091bd100a702af6547ec0714b64c88c72344d0d0 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 00:51:42 -0300 Subject: [PATCH 5/9] refactor: move type --- .../server/lib/omnichannel/routing}/IRoutingManagerConfig.ts | 0 apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts | 2 +- apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename apps/meteor/{definition => ee/server/lib/omnichannel/routing}/IRoutingManagerConfig.ts (100%) diff --git a/apps/meteor/definition/IRoutingManagerConfig.ts b/apps/meteor/ee/server/lib/omnichannel/routing/IRoutingManagerConfig.ts similarity index 100% rename from apps/meteor/definition/IRoutingManagerConfig.ts rename to apps/meteor/ee/server/lib/omnichannel/routing/IRoutingManagerConfig.ts diff --git a/apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts b/apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts index adc4fd3f58338..71644b4e1d872 100644 --- a/apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts +++ b/apps/meteor/ee/server/lib/omnichannel/routing/LoadBalancing.ts @@ -1,6 +1,6 @@ import { Users } from '@rocket.chat/models'; -import type { IRoutingManagerConfig } from '../../../../../definition/IRoutingManagerConfig'; +import type { IRoutingManagerConfig } from './IRoutingManagerConfig'; import { RoutingManager } from '../../../../../server/lib/omnichannel/RoutingManager'; import { settings } from '../../../../../server/settings'; import { getChatLimitsQuery } from '../../../hooks/omnichannel/applySimultaneousChatsRestrictions'; diff --git a/apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts b/apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts index f31f3646ee235..4ab778021a2a8 100644 --- a/apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts +++ b/apps/meteor/ee/server/lib/omnichannel/routing/LoadRotation.ts @@ -1,7 +1,7 @@ import type { IOmnichannelCustomAgent } from '@rocket.chat/core-typings'; import { Users } from '@rocket.chat/models'; -import type { IRoutingManagerConfig } from '../../../../../definition/IRoutingManagerConfig'; +import type { IRoutingManagerConfig } from './IRoutingManagerConfig'; import { RoutingManager } from '../../../../../server/lib/omnichannel/RoutingManager'; import { settings } from '../../../../../server/settings'; import { getChatLimitsQuery } from '../../../hooks/omnichannel/applySimultaneousChatsRestrictions'; From 85b6b0fd444688d9ecd5642f91020150a9fbd749 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 01:00:33 -0300 Subject: [PATCH 6/9] refactor: colocate some types --- .../meteor/client/apps/@types/IOrchestrator.ts | 18 ------------------ apps/meteor/client/apps/orchestrator.ts | 9 +++++---- apps/meteor/client/contexts/AppsContext.tsx | 3 ++- .../client/definitions/IAppExternalURL.ts | 3 +++ apps/meteor/client/definitions/ICategory.ts | 8 ++++++++ .../AppDetailsPage/AppDetailsPageTabs.tsx | 2 +- .../tabs/AppSettings/AppSettings.tsx | 2 +- .../views/marketplace/definitions/AppInfo.ts | 2 +- .../views/marketplace/definitions/ISettings.ts | 5 +++++ .../views/marketplace/hooks/useAppInfo.ts | 6 +++--- 10 files changed, 29 insertions(+), 29 deletions(-) delete mode 100644 apps/meteor/client/apps/@types/IOrchestrator.ts create mode 100644 apps/meteor/client/definitions/IAppExternalURL.ts create mode 100644 apps/meteor/client/definitions/ICategory.ts create mode 100644 apps/meteor/client/views/marketplace/definitions/ISettings.ts diff --git a/apps/meteor/client/apps/@types/IOrchestrator.ts b/apps/meteor/client/apps/@types/IOrchestrator.ts deleted file mode 100644 index 7d73f6afb71b6..0000000000000 --- a/apps/meteor/client/apps/@types/IOrchestrator.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { ISetting } from '@rocket.chat/apps-engine/definition/settings/ISetting'; - -export interface IAppExternalURL { - url: string; -} - -export interface ICategory { - createdDate: Date; - description: string; - hidden: boolean; - id: string; - modifiedDate: Date; - title: string; -} - -export interface ISettings { - [key: string]: ISetting; -} diff --git a/apps/meteor/client/apps/orchestrator.ts b/apps/meteor/client/apps/orchestrator.ts index e376211b8260a..6a6b22c412d69 100644 --- a/apps/meteor/client/apps/orchestrator.ts +++ b/apps/meteor/client/apps/orchestrator.ts @@ -4,10 +4,11 @@ import type { IPermission } from '@rocket.chat/apps-engine/definition/permission import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; import type { Serialized } from '@rocket.chat/core-typings'; -import type { IAppExternalURL, ICategory } from './@types/IOrchestrator'; import { RealAppsEngineUIHost } from './RealAppsEngineUIHost'; import { hasAtLeastOnePermission } from '../../app/authorization/client'; import { sdk } from '../../app/utils/client/lib/SDKClient'; +import type { IAppExternalURL } from '../definitions/IAppExternalURL'; +import type { ICategory } from '../definitions/ICategory'; import { dispatchToastMessage } from '../lib/toast'; import type { App } from '../views/marketplace/types'; @@ -51,7 +52,7 @@ class AppClientOrchestrator { if ('apps' in result) { // TODO: chapter day: multiple results are returned, but we only need one - return result.apps as App[]; + return result.apps; } throw new Error('Invalid response from API'); } @@ -74,7 +75,7 @@ class AppClientOrchestrator { return { apps: [], error: 'Invalid response from API' }; } - const apps = (result as App[]).map((app: App) => { + const apps = result.map((app: App) => { const { latest, appRequestStats, price, pricingPlans, purchaseType, isEnterpriseOnly, modifiedAt, bundledIn, requestedEndUser } = app; return { ...latest, @@ -174,7 +175,7 @@ class AppClientOrchestrator { if (Array.isArray(result)) { // TODO: chapter day: multiple results are returned, but we only need one - return result as Serialized[]; + return result; } throw new Error('Failed to get categories'); } diff --git a/apps/meteor/client/contexts/AppsContext.tsx b/apps/meteor/client/contexts/AppsContext.tsx index 38eda15a7ab98..3a50dfbb09e1c 100644 --- a/apps/meteor/client/contexts/AppsContext.tsx +++ b/apps/meteor/client/contexts/AppsContext.tsx @@ -4,7 +4,8 @@ import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; import type { Serialized } from '@rocket.chat/core-typings'; import { createContext } from 'react'; -import type { IAppExternalURL, ICategory } from '../apps/@types/IOrchestrator'; +import type { IAppExternalURL } from '../definitions/IAppExternalURL'; +import type { ICategory } from '../definitions/ICategory'; import type { App } from '../views/marketplace/types'; export interface IAppsOrchestrator { diff --git a/apps/meteor/client/definitions/IAppExternalURL.ts b/apps/meteor/client/definitions/IAppExternalURL.ts new file mode 100644 index 0000000000000..a8e4e72479c59 --- /dev/null +++ b/apps/meteor/client/definitions/IAppExternalURL.ts @@ -0,0 +1,3 @@ +export interface IAppExternalURL { + url: string; +} diff --git a/apps/meteor/client/definitions/ICategory.ts b/apps/meteor/client/definitions/ICategory.ts new file mode 100644 index 0000000000000..44aeca12c75c4 --- /dev/null +++ b/apps/meteor/client/definitions/ICategory.ts @@ -0,0 +1,8 @@ +export interface ICategory { + createdDate: Date; + description: string; + hidden: boolean; + id: string; + modifiedDate: Date; + title: string; +} diff --git a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx index 295d67f166e16..51fd747a3ca89 100644 --- a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx +++ b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPageTabs.tsx @@ -2,7 +2,7 @@ import { Tabs, TabsItem } from '@rocket.chat/fuselage'; import { usePermission, useRouter } from '@rocket.chat/ui-contexts'; import { useTranslation } from 'react-i18next'; -import type { ISettings } from '../../../apps/@types/IOrchestrator'; +import type { ISettings } from '../definitions/ISettings'; export type AppDetailsPageTabsProps = { context: string; diff --git a/apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppSettings/AppSettings.tsx b/apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppSettings/AppSettings.tsx index ff039e172cdf2..e0e1a71d537b6 100644 --- a/apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppSettings/AppSettings.tsx +++ b/apps/meteor/client/views/marketplace/AppDetailsPage/tabs/AppSettings/AppSettings.tsx @@ -3,7 +3,7 @@ import { useRouteParameter } from '@rocket.chat/ui-contexts'; import { useMemo } from 'react'; import AppSetting from './AppSetting'; -import type { ISettings } from '../../../../../apps/@types/IOrchestrator'; +import type { ISettings } from '../../../definitions/ISettings'; import { useAppTranslation } from '../../../hooks/useAppTranslation'; export type AppSettingsProps = { settings: ISettings }; diff --git a/apps/meteor/client/views/marketplace/definitions/AppInfo.ts b/apps/meteor/client/views/marketplace/definitions/AppInfo.ts index 87d1d7e10d23a..0ef85d595e765 100644 --- a/apps/meteor/client/views/marketplace/definitions/AppInfo.ts +++ b/apps/meteor/client/views/marketplace/definitions/AppInfo.ts @@ -1,7 +1,7 @@ import type { IApiEndpointMetadata } from '@rocket.chat/apps-engine/definition/api'; import type { AppScreenshot } from '@rocket.chat/core-typings'; -import type { ISettings } from '../../../apps/@types/IOrchestrator'; +import type { ISettings } from './ISettings'; import type { App } from '../types'; export type AppInfo = App & { diff --git a/apps/meteor/client/views/marketplace/definitions/ISettings.ts b/apps/meteor/client/views/marketplace/definitions/ISettings.ts new file mode 100644 index 0000000000000..ce370ca12c2bc --- /dev/null +++ b/apps/meteor/client/views/marketplace/definitions/ISettings.ts @@ -0,0 +1,5 @@ +import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; + +export interface ISettings { + [key: string]: ISetting; +} diff --git a/apps/meteor/client/views/marketplace/hooks/useAppInfo.ts b/apps/meteor/client/views/marketplace/hooks/useAppInfo.ts index c562017ef1899..4fd4ea6a7949c 100644 --- a/apps/meteor/client/views/marketplace/hooks/useAppInfo.ts +++ b/apps/meteor/client/views/marketplace/hooks/useAppInfo.ts @@ -3,9 +3,9 @@ import { useEndpoint } from '@rocket.chat/ui-contexts'; import { useState, useEffect } from 'react'; import { useApps } from './useApps'; -import type { ISettings } from '../../../apps/@types/IOrchestrator'; import { AppClientOrchestratorInstance } from '../../../apps/orchestrator'; import type { AppInfo } from '../definitions/AppInfo'; +import type { ISettings } from '../definitions/ISettings'; const getBundledInApp = async (app: App): Promise => { const { bundledIn = [] } = app; @@ -64,8 +64,8 @@ export const useAppInfo = (appId: string, context: string): AppInfo | undefined appVersion: appId, }) .then(({ app }: any) => { - (appResult as App).tosLink = app.tosLink; - (appResult as App).privacyLink = app.privacyLink; + appResult.tosLink = app.tosLink; + appResult.privacyLink = app.privacyLink; return getBundledInApp(app); }) .catch(() => ({ From 4d65c222f6f96cbbfc8783d72b10027e7143e6aa Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 01:13:16 -0300 Subject: [PATCH 7/9] refactor: remove some unreferenced types on client-side code --- apps/meteor/client/definitions/global.d.ts | 51 ++-------------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/apps/meteor/client/definitions/global.d.ts b/apps/meteor/client/definitions/global.d.ts index 1f1072ec6313b..16442d1aabfaf 100644 --- a/apps/meteor/client/definitions/global.d.ts +++ b/apps/meteor/client/definitions/global.d.ts @@ -3,54 +3,32 @@ import type { IRocketChatDesktop } from '@rocket.chat/desktop-api'; declare global { interface Window { RocketChatDesktop?: IRocketChatDesktop; - - /** @deprecated use `window.RTCPeerConnection` */ - mozRTCPeerConnection?: RTCPeerConnection; - /** @deprecated use `window.RTCPeerConnection` */ - webkitRTCPeerConnection?: RTCPeerConnection; - - /** @deprecated use `window.RTCSessionDescription` */ - mozRTCSessionDescription?: RTCSessionDescription; - /** @deprecated use `window.RTCSessionDescription` */ - webkitRTCSessionDescription?: RTCSessionDescription; - /** @deprecated use `window.RTCIceCandidate` */ - mozRTCIceCandidate?: RTCIceCandidate; - /** @deprecated use `window.RTCIceCandidate` */ - webkitRTCIceCandidate?: RTCIceCandidate; - /** @deprecated use `window.RTCSessionDescription` */ - mozRTCSessionDescription?: RTCSessionDescription; - /** @deprecated use `window.RTCSessionDescription` */ - webkitRTCSessionDescription?: RTCSessionDescription; - /** @deprecated use `window.AudioContext` */ - mozAudioContext?: AudioContext; - /** @deprecated use `window.AudioContext` */ - webkitAudioContext?: AudioContext; opera?: string; } interface Navigator { - /** @deprecated */ + /** @deprecated use the newer `navigator.mediaDevices.getUserMedia()` instead */ getUserMedia?: ( this: Navigator, constraints?: MediaStreamConstraints | undefined, onSuccess?: (stream: MediaStream) => void, onError?: (error: any) => void, ) => void; - /** @deprecated */ + /** @deprecated use the newer `navigator.mediaDevices.getUserMedia()` instead */ webkitGetUserMedia?: ( this: Navigator, constraints?: MediaStreamConstraints | undefined, onSuccess?: (stream: MediaStream) => void, onError?: (error: any) => void, ) => void; - /** @deprecated */ + /** @deprecated use the newer `navigator.mediaDevices.getUserMedia()` instead */ mozGetUserMedia?: ( this: Navigator, constraints?: MediaStreamConstraints | undefined, onSuccess?: (stream: MediaStream) => void, onError?: (error: any) => void, ) => void; - /** @deprecated */ + /** @deprecated use the newer `navigator.mediaDevices.getUserMedia()` instead */ msGetUserMedia?: ( this: Navigator, constraints?: MediaStreamConstraints | undefined, @@ -62,27 +40,6 @@ declare global { }; } - interface RTCPeerConnection { - /** @deprecated use `getReceivers() */ - getRemoteStreams(): MediaStream[]; - /** @deprecated */ - addStream(stream: MediaStream): void; - } - - interface MediaTrackConstraints { - /** @deprecated */ - mozMediaSource?: string; - /** @deprecated */ - mediaSource?: string; - /** @deprecated */ - mandatory?: { - chromeMediaSource: string; - chromeMediaSourceId: string; - maxWidth: number; - maxHeight: number; - }; - } - interface NotificationEventMap { reply: { response: string }; } From 83630eb1553693589d6f4ed9c97f20b13977f295 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 01:40:36 -0300 Subject: [PATCH 8/9] refactor: remove unreferenced meteor declarations --- .../externals/meteor/accounts-base.d.ts | 19 ------ .../externals/meteor/babel-compiler.d.ts | 6 -- .../definition/externals/meteor/base64.d.ts | 6 -- .../externals/meteor/ddp-common.d.ts | 58 ------------------- .../definition/externals/meteor/htmljs.d.ts | 7 --- .../externals/meteor/jalik-ufs-methods.d.ts | 7 --- .../definition/externals/meteor/logging.d.ts | 22 ------- .../definition/externals/meteor/meteor.d.ts | 3 +- .../meteor/mystor-device-detection.d.ts | 10 ---- .../externals/meteor/ostrio-cookies.d.ts | 2 - .../definition/externals/meteor/url.d.ts | 1 - .../externals/meteor/webapp-hashing.d.ts | 11 ---- apps/meteor/server/lib/http/call.ts | 4 +- 13 files changed, 4 insertions(+), 152 deletions(-) delete mode 100644 apps/meteor/definition/externals/meteor/babel-compiler.d.ts delete mode 100644 apps/meteor/definition/externals/meteor/base64.d.ts delete mode 100644 apps/meteor/definition/externals/meteor/htmljs.d.ts delete mode 100644 apps/meteor/definition/externals/meteor/jalik-ufs-methods.d.ts delete mode 100644 apps/meteor/definition/externals/meteor/logging.d.ts delete mode 100644 apps/meteor/definition/externals/meteor/mystor-device-detection.d.ts delete mode 100644 apps/meteor/definition/externals/meteor/webapp-hashing.d.ts diff --git a/apps/meteor/definition/externals/meteor/accounts-base.d.ts b/apps/meteor/definition/externals/meteor/accounts-base.d.ts index aa630621e809d..b927b1b67ac08 100644 --- a/apps/meteor/definition/externals/meteor/accounts-base.d.ts +++ b/apps/meteor/definition/externals/meteor/accounts-base.d.ts @@ -3,17 +3,6 @@ declare module 'meteor/accounts-base' { namespace Accounts { const storageLocation: Window['localStorage']; - function createUser( - options: { - username?: string; - email?: string; - password?: string; - profile?: Record; - joinDefaultChannelsSilenced?: boolean; - skipEmailValidation?: boolean; - }, - callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void, - ): string; function _expireTokens(oldestValidDate?: Date, userId?: string): Promise; @@ -31,10 +20,6 @@ declare module 'meteor/accounts-base' { function registerLoginHandler(name: string, handler: (options: any) => undefined | object): void; - function _storedLoginToken(): unknown; - - function _unstoreLoginToken(): void; - function _setAccountData(connectionId: string, key: string, token: string): void; function _checkPasswordAsync(user: Meteor.User, password: Password): Promise<{ userId: string; error?: any }>; @@ -57,10 +42,6 @@ declare module 'meteor/accounts-base' { public static readonly numericError: number; } - const USER_ID_KEY: string; - - const LOGIN_TOKEN_KEY: string; - const _accountData: Record; interface AccountsServerOptions { diff --git a/apps/meteor/definition/externals/meteor/babel-compiler.d.ts b/apps/meteor/definition/externals/meteor/babel-compiler.d.ts deleted file mode 100644 index ea6353d596c26..0000000000000 --- a/apps/meteor/definition/externals/meteor/babel-compiler.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module 'meteor/babel-compiler' { - namespace Babel { - function getDefaultOptions(options: Record): Record; - function compile(script: string, options: Record): { code: string }; - } -} diff --git a/apps/meteor/definition/externals/meteor/base64.d.ts b/apps/meteor/definition/externals/meteor/base64.d.ts deleted file mode 100644 index ea29d86632fb2..0000000000000 --- a/apps/meteor/definition/externals/meteor/base64.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -declare module 'meteor/base64' { - export const Base64: { - encode: (value: string) => string; - decode: (value: string) => string; - }; -} diff --git a/apps/meteor/definition/externals/meteor/ddp-common.d.ts b/apps/meteor/definition/externals/meteor/ddp-common.d.ts index cbe96a9722968..a3858730ac94d 100644 --- a/apps/meteor/definition/externals/meteor/ddp-common.d.ts +++ b/apps/meteor/definition/externals/meteor/ddp-common.d.ts @@ -15,67 +15,9 @@ declare module 'meteor/ddp-common' { }); } - /** - * Heartbeat options - */ - type HeartbeatOptions = { - /** - * interval to send pings, in milliseconds - */ - heartbeatInterval: number; - /** - * timeout to close the connection if a reply isn't received, in milliseconds. - */ - heartbeatTimeout: number; - /** - * function to call to send a ping on the connection. - */ - sendPing: () => void; - /** - * function to call to close the connection - */ - onTimeout: () => void; - }; - class Heartbeat { - heartbeatInterval: number; - - heartbeatTimeout: number; - - _sendPing: () => void; - - _onTimeout: () => void; - _seenPacket: boolean; - _heartbeatIntervalHandle: ReturnType | null; - - _heartbeatTimeoutHandle: ReturnType | null; - - constructor(options: HeartbeatOptions); - - stop(): void; - - start(): void; - - _startHeartbeatIntervalTimer(): void; - - _startHeartbeatTimeoutTimer(): void; - - _clearHeartbeatIntervalTimer(): void; - - _clearHeartbeatTimeoutTimer(): void; - - /** - * The heartbeat interval timer is fired when we should send a ping. - */ - _heartbeatIntervalFired(): void; - - /** - * The heartbeat timeout timer is fired when we sent a ping, but we timed out waiting for the pong. - */ - _heartbeatTimeoutFired(): void; - messageReceived(): void; } } diff --git a/apps/meteor/definition/externals/meteor/htmljs.d.ts b/apps/meteor/definition/externals/meteor/htmljs.d.ts deleted file mode 100644 index 8e8429770742d..0000000000000 --- a/apps/meteor/definition/externals/meteor/htmljs.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare module 'meteor/htmljs' { - namespace HTML { - function Comment(value: string): unknown; - function Raw(value: string): unknown; - function DIV(attributes?: Record): unknown; - } -} diff --git a/apps/meteor/definition/externals/meteor/jalik-ufs-methods.d.ts b/apps/meteor/definition/externals/meteor/jalik-ufs-methods.d.ts deleted file mode 100644 index cf5182758d411..0000000000000 --- a/apps/meteor/definition/externals/meteor/jalik-ufs-methods.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import '@rocket.chat/ui-contexts'; - -declare module '@rocket.chat/ui-contexts' { - interface ServerMethods { - ufsComplete(fileId: string, storeName: string, token: string): void; - } -} diff --git a/apps/meteor/definition/externals/meteor/logging.d.ts b/apps/meteor/definition/externals/meteor/logging.d.ts deleted file mode 100644 index 7d3c132e5c2b3..0000000000000 --- a/apps/meteor/definition/externals/meteor/logging.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -declare module 'meteor/logging' { - namespace Log { - function format( - obj: { - time?: Date; - timeInexact?: boolean; - level?: 'debug' | 'info' | 'warn' | 'error'; - file?: string; - line?: number; - app?: string; - originApp?: string; - message?: string; - program?: string; - satellite?: string; - stderr?: string; - }, - options: { - color?: boolean; - }, - ): string; - } -} diff --git a/apps/meteor/definition/externals/meteor/meteor.d.ts b/apps/meteor/definition/externals/meteor/meteor.d.ts index 269415d711895..18bb6bab0d7ca 100644 --- a/apps/meteor/definition/externals/meteor/meteor.d.ts +++ b/apps/meteor/definition/externals/meteor/meteor.d.ts @@ -37,7 +37,8 @@ declare module 'meteor/meteor' { } interface Device { - isDesktop: () => boolean; + isDesktop(): boolean; + isPhone(): boolean; } const server: { diff --git a/apps/meteor/definition/externals/meteor/mystor-device-detection.d.ts b/apps/meteor/definition/externals/meteor/mystor-device-detection.d.ts deleted file mode 100644 index be1dab657bbd3..0000000000000 --- a/apps/meteor/definition/externals/meteor/mystor-device-detection.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import 'meteor/meteor'; - -declare module 'meteor/meteor' { - namespace Meteor { - namespace Device { - export function isPhone(): boolean; - export function isDesktop(): boolean; - } - } -} diff --git a/apps/meteor/definition/externals/meteor/ostrio-cookies.d.ts b/apps/meteor/definition/externals/meteor/ostrio-cookies.d.ts index e766e78c4ec14..2cbd6e7d1962b 100644 --- a/apps/meteor/definition/externals/meteor/ostrio-cookies.d.ts +++ b/apps/meteor/definition/externals/meteor/ostrio-cookies.d.ts @@ -9,8 +9,6 @@ declare module 'meteor/ostrio:cookies' { allowedCordovaOrigins?: RegExp | boolean; }); - middleware(): (req: Request, res: Response, next: () => void) => void; - get(key: string, _tmp?: string): string | undefined; } } diff --git a/apps/meteor/definition/externals/meteor/url.d.ts b/apps/meteor/definition/externals/meteor/url.d.ts index e26bcfc6dab8b..6ae177bc0d65d 100644 --- a/apps/meteor/definition/externals/meteor/url.d.ts +++ b/apps/meteor/definition/externals/meteor/url.d.ts @@ -2,5 +2,4 @@ declare module 'meteor/url' { const URL: typeof window.URL & { _constructUrl(url: string, query?: string, paramsForUrl?: Record): string; }; - const URLSearchParams: typeof window.URLSearchParams; } diff --git a/apps/meteor/definition/externals/meteor/webapp-hashing.d.ts b/apps/meteor/definition/externals/meteor/webapp-hashing.d.ts deleted file mode 100644 index c411144e452fc..0000000000000 --- a/apps/meteor/definition/externals/meteor/webapp-hashing.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -declare module 'meteor/webapp-hashing' { - import type { IRocketChatAssetCache } from '@rocket.chat/core-typings'; - - namespace WebAppHashing { - function calculateClientHash( - manifest: IRocketChatAssetCache[], - includeFilter?: (type: IRocketChatAssetCache['type'], replaceable: boolean) => boolean, - runtimeConfigOverride?: unknown, - ): string; - } -} diff --git a/apps/meteor/server/lib/http/call.ts b/apps/meteor/server/lib/http/call.ts index bf03cb449506f..95da4c43c1344 100644 --- a/apps/meteor/server/lib/http/call.ts +++ b/apps/meteor/server/lib/http/call.ts @@ -1,6 +1,6 @@ import { serverFetch as fetch } from '@rocket.chat/server-fetch'; import { HTTP } from 'meteor/http'; -import { URL, URLSearchParams } from 'meteor/url'; +import { URL } from 'meteor/url'; import { truncate } from '../../../lib/utils/stringUtils'; @@ -187,7 +187,7 @@ function httpCallAsync(httpMethod: string, url: string, callback: callbackFn): v function httpCallAsync(httpMethod: string, url: string, optionsOrCallback: HttpCallOptions | callbackFn = {}, callback?: callbackFn): void { // If the options argument was omitted, adjust the arguments: if (!callback && typeof optionsOrCallback === 'function') { - return _call(httpMethod, url, {}, optionsOrCallback as callbackFn); + return _call(httpMethod, url, {}, optionsOrCallback); } return _call(httpMethod, url, optionsOrCallback as HttpCallOptions, callback as callbackFn); From b18e0f2f6470a7e3a7aed7581ac2cc67b47cbdd9 Mon Sep 17 00:00:00 2001 From: Tasso Evangelista Date: Tue, 18 Aug 2026 01:54:30 -0300 Subject: [PATCH 9/9] refactor: absorb more meteor declarations --- .../client/meteor/overrides/oauthRedirectUri.ts | 9 +-------- .../definition/externals/meteor/meteor.d.ts | 9 +++++++++ .../definition/externals/meteor/webapp.d.ts | 7 +++++++ .../server/lib/2fa/definitions/MeteorUser.d.ts | 12 ------------ apps/meteor/server/lib/cors/cors.ts | 16 ---------------- 5 files changed, 17 insertions(+), 36 deletions(-) delete mode 100644 apps/meteor/server/lib/2fa/definitions/MeteorUser.d.ts diff --git a/apps/meteor/client/meteor/overrides/oauthRedirectUri.ts b/apps/meteor/client/meteor/overrides/oauthRedirectUri.ts index c9900ff69a417..eb7a4fa47d58b 100644 --- a/apps/meteor/client/meteor/overrides/oauthRedirectUri.ts +++ b/apps/meteor/client/meteor/overrides/oauthRedirectUri.ts @@ -3,16 +3,9 @@ // clients. Once Meteor's OAuth stack is gone, this file goes with it. import { OAuth } from 'meteor/oauth'; -declare module 'meteor/oauth' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace OAuth { - function _redirectUri(serviceName: string, config: any, params: any, absoluteUrlOptions: any): string; - } -} - const { _redirectUri } = OAuth; -OAuth._redirectUri = (serviceName: string, config: any, params: unknown, absoluteUrlOptions: unknown): string => { +OAuth._redirectUri = (serviceName: string, config: any, params?: Record, absoluteUrlOptions?: Record): string => { const ret = _redirectUri(serviceName, config, params, absoluteUrlOptions); // DEPRECATED: Remove in v5.0.0 diff --git a/apps/meteor/definition/externals/meteor/meteor.d.ts b/apps/meteor/definition/externals/meteor/meteor.d.ts index 18bb6bab0d7ca..c0b9454a08e87 100644 --- a/apps/meteor/definition/externals/meteor/meteor.d.ts +++ b/apps/meteor/definition/externals/meteor/meteor.d.ts @@ -179,6 +179,15 @@ declare module 'meteor/meteor' { drain(): unknown; } + + interface UserServices { + totp?: { + enabled: boolean; + hashedBackup: string[]; + secret: string; + tempSecret?: string; + }; + } } // eslint-disable-next-line no-var diff --git a/apps/meteor/definition/externals/meteor/webapp.d.ts b/apps/meteor/definition/externals/meteor/webapp.d.ts index fe8f354154222..b192f8fde038a 100644 --- a/apps/meteor/definition/externals/meteor/webapp.d.ts +++ b/apps/meteor/definition/externals/meteor/webapp.d.ts @@ -1,8 +1,15 @@ declare module 'meteor/webapp' { + import type { IncomingMessage } from 'node:http'; + import type { UrlWithParsedQuery } from 'node:url'; + import type * as express from 'express'; namespace WebApp { // Present in Meteor 3's generated types but missing from @types/meteor. const rawHandlers: express.Application; + + function setInlineScriptsAllowed(allowed: boolean): Promise; + + function categorizeRequest(req: IncomingMessage): { arch: string; path: string; url: UrlWithParsedQuery } & Record; } } diff --git a/apps/meteor/server/lib/2fa/definitions/MeteorUser.d.ts b/apps/meteor/server/lib/2fa/definitions/MeteorUser.d.ts deleted file mode 100644 index 5c7d97a212306..0000000000000 --- a/apps/meteor/server/lib/2fa/definitions/MeteorUser.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare module 'meteor/meteor' { - namespace Meteor { - interface UserServices { - totp?: { - enabled: boolean; - hashedBackup: string[]; - secret: string; - tempSecret?: string; - }; - } - } -} diff --git a/apps/meteor/server/lib/cors/cors.ts b/apps/meteor/server/lib/cors/cors.ts index a727d658c79b0..30ea26adf1dff 100644 --- a/apps/meteor/server/lib/cors/cors.ts +++ b/apps/meteor/server/lib/cors/cors.ts @@ -1,5 +1,4 @@ import type http from 'node:http'; -import type { UrlWithParsedQuery } from 'node:url'; import url from 'node:url'; import { Logger } from '@rocket.chat/logger'; @@ -15,13 +14,6 @@ type NextFunction = (err?: any) => void; const logger = new Logger('CORS'); -declare module 'meteor/webapp' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace WebApp { - function setInlineScriptsAllowed(allowed: boolean): Promise; - } -} - let templatePromise: Promise | void; export async function setInlineScriptsAllowed(allowed: boolean): Promise { templatePromise = WebAppInternals.setInlineScriptsAllowed(allowed); @@ -92,14 +84,6 @@ WebApp.rawConnectHandlers.use(async (_req: http.IncomingMessage, res: http.Serve }); const _staticFilesMiddleware = WebAppInternals.staticFilesMiddleware; -declare module 'meteor/webapp' { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace WebApp { - function categorizeRequest( - req: http.IncomingMessage, - ): { arch: string; path: string; url: UrlWithParsedQuery } & Record; - } -} let cachingVersion = ''; export function setCachingVersion(value: string): void {