Enforce node: schema for builtins, import extensions

This commit is contained in:
Fedor Indutny 2025-09-16 17:39:03 -07:00 committed by GitHub
commit c02565eaa8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2096 changed files with 14955 additions and 14023 deletions

View file

@ -23,6 +23,7 @@ js/WebAudioRecorderMp3.js
js/calling-tools/**
# TypeScript generated files
build/**/*.js
app/**/*.js
ts/**/*.js

View file

@ -100,6 +100,14 @@ const rules = {
// We prefer named exports
'import/prefer-default-export': 'off',
'import/enforce-node-protocol-usage': ['error', 'always'],
'import/extensions': [
'error',
'ignorePackages',
{
checkTypeImports: true,
},
],
// Prefer functional components with default params
'react/require-default-props': 'off',

1
.gitignore vendored
View file

@ -36,6 +36,7 @@ ts/sql/mainWorker.bundle.js.LICENSE.txt
build/ICUMessageParams.d.ts
# React / TypeScript
build/**/*.js
app/*.js
ts/**/*.js
ts/protobuf/*.d.ts

View file

@ -2,6 +2,7 @@
# supports `.gitignore`: https://github.com/prettier/prettier/issues/2294
# Generated files
build/**/*.js
app/**/*.js
config/local-*.json
config/local.json

View file

@ -51,7 +51,9 @@ const config: StorybookConfig = {
type: 'filesystem',
};
config.resolve!.extensions = ['.tsx', '.ts', '...'];
config.resolve!.extensionAlias = {
'.js': ['.tsx', '.ts', '.js'],
};
config.module!.rules!.unshift({
test: /\.scss$/,
@ -88,33 +90,12 @@ const config: StorybookConfig = {
config.node = { global: true };
config.externals = {
net: 'commonjs net',
vm: 'commonjs vm',
fs: 'commonjs fs',
async_hooks: 'commonjs async_hooks',
module: 'commonjs module',
stream: 'commonjs stream',
tls: 'commonjs tls',
dns: 'commonjs dns',
http: 'commonjs http',
https: 'commonjs https',
os: 'commonjs os',
constants: 'commonjs constants',
zlib: 'commonjs zlib',
'@signalapp/libsignal-client': 'commonjs @signalapp/libsignal-client',
'@signalapp/libsignal-client/zkgroup':
'commonjs @signalapp/libsignal-client/zkgroup',
'@signalapp/ringrtc': 'commonjs @signalapp/ringrtc',
'@signalapp/better-sqlite3': 'commonjs @signalapp/better-sqlite3',
electron: 'commonjs electron',
'fs-xattr': 'commonjs fs-xattr',
fsevents: 'commonjs fsevents',
'mac-screen-capture-permissions':
'commonjs mac-screen-capture-permissions',
sass: 'commonjs sass',
bufferutil: 'commonjs bufferutil',
'utf-8-validate': 'commonjs utf-8-validate',
config.externals = ({ request }, callback) => {
if (/^node:/.test(request) && request !== 'node:buffer') {
// Keep Node.js imports unchanged
return callback(null, 'commonjs ' + request);
}
callback();
};
config.plugins!.push(

View file

@ -7,9 +7,9 @@ import * as z from 'zod';
import { protocol } from 'electron';
import { LRUCache } from 'lru-cache';
import type { OptionalResourceService } from './OptionalResourceService';
import { SignalService as Proto } from '../ts/protobuf';
import { parseUnknown } from '../ts/util/schemas';
import type { OptionalResourceService } from './OptionalResourceService.js';
import { SignalService as Proto } from '../ts/protobuf/index.js';
import { parseUnknown } from '../ts/util/schemas.js';
const MANIFEST_PATH = join(__dirname, '..', 'build', 'jumbomoji.json');

View file

@ -12,12 +12,12 @@ import PQueue from 'p-queue';
import type {
OptionalResourceType,
OptionalResourcesDictType,
} from '../ts/types/OptionalResource';
import { OptionalResourcesDictSchema } from '../ts/types/OptionalResource';
import { createLogger } from '../ts/logging/log';
import { getGotOptions } from '../ts/updater/got';
import { drop } from '../ts/util/drop';
import { parseUnknown } from '../ts/util/schemas';
} from '../ts/types/OptionalResource.js';
import { OptionalResourcesDictSchema } from '../ts/types/OptionalResource.js';
import { createLogger } from '../ts/logging/log.js';
import { getGotOptions } from '../ts/updater/got.js';
import { drop } from '../ts/util/drop.js';
import { parseUnknown } from '../ts/util/schemas.js';
const log = createLogger('OptionalResourceService');

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { PowerSaveBlocker } from 'electron';
import { createLogger } from '../ts/logging/log';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('PreventDisplaySleepService');

View file

@ -6,8 +6,8 @@ import { Menu, Tray, app, nativeImage, nativeTheme, screen } from 'electron';
import os from 'node:os';
import { join } from 'node:path';
import { readFileSync } from 'node:fs';
import { createLogger } from '../ts/logging/log';
import type { LocalizerType } from '../ts/types/I18N';
import { createLogger } from '../ts/logging/log.js';
import type { LocalizerType } from '../ts/types/I18N.js';
const log = createLogger('SystemTrayService');

View file

@ -1,14 +1,14 @@
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { createLogger } from '../ts/logging/log';
import OS from '../ts/util/os/osMain';
import { createLogger } from '../ts/logging/log.js';
import OS from '../ts/util/os/osMain.js';
import {
parseSystemTraySetting,
SystemTraySetting,
} from '../ts/types/SystemTraySetting';
import { isSystemTraySupported } from '../ts/types/Settings';
import type { ConfigType } from './base_config';
} from '../ts/types/SystemTraySetting.js';
import { isSystemTraySupported } from '../ts/types/Settings.js';
import type { ConfigType } from './base_config.js';
const log = createLogger('SystemTraySettingCache');

View file

@ -9,10 +9,10 @@ import {
sendDummyKeystroke,
} from '@indutny/simple-windows-notifications';
import { createLogger } from '../ts/logging/log';
import { AUMID } from './startup_config';
import type { WindowsNotificationData } from '../ts/services/notifications';
import { renderWindowsToast } from './renderWindowsToast';
import { createLogger } from '../ts/logging/log.js';
import { AUMID } from './startup_config.js';
import type { WindowsNotificationData } from '../ts/services/notifications.js';
import { renderWindowsToast } from './renderWindowsToast.js';
const log = createLogger('WindowsNotifications');

View file

@ -22,30 +22,30 @@ import { isNumber } from 'lodash';
import {
type DecryptAttachmentToSinkOptionsType,
decryptAttachmentV2ToSink,
} from '../ts/AttachmentCrypto';
import * as Bytes from '../ts/Bytes';
import type { MessageAttachmentsCursorType } from '../ts/sql/Interface';
import type { MainSQL } from '../ts/sql/main';
} from '../ts/AttachmentCrypto.js';
import * as Bytes from '../ts/Bytes.js';
import type { MessageAttachmentsCursorType } from '../ts/sql/Interface.js';
import type { MainSQL } from '../ts/sql/main.js';
import {
APPLICATION_OCTET_STREAM,
MIMETypeToString,
stringToMIMEType,
} from '../ts/types/MIME';
import * as Errors from '../ts/types/errors';
} from '../ts/types/MIME.js';
import * as Errors from '../ts/types/errors.js';
import {
isImageTypeSupported,
isVideoTypeSupported,
} from '../ts/util/GoogleChrome';
import { strictAssert } from '../ts/util/assert';
import { drop } from '../ts/util/drop';
import { SECOND } from '../ts/util/durations';
import { isPathInside } from '../ts/util/isPathInside';
import { missingCaseError } from '../ts/util/missingCaseError';
import { safeParseInteger } from '../ts/util/numbers';
import { parseLoose } from '../ts/util/schemas';
import { sleep } from '../ts/util/sleep';
import { toWebStream } from '../ts/util/toWebStream';
import { createLogger } from '../ts/logging/log';
} from '../ts/util/GoogleChrome.js';
import { strictAssert } from '../ts/util/assert.js';
import { drop } from '../ts/util/drop.js';
import { SECOND } from '../ts/util/durations/index.js';
import { isPathInside } from '../ts/util/isPathInside.js';
import { missingCaseError } from '../ts/util/missingCaseError.js';
import { safeParseInteger } from '../ts/util/numbers.js';
import { parseLoose } from '../ts/util/schemas.js';
import { sleep } from '../ts/util/sleep.js';
import { toWebStream } from '../ts/util/toWebStream.js';
import { createLogger } from '../ts/logging/log.js';
import {
deleteAll as deleteAllAttachments,
deleteAllBadges,
@ -63,7 +63,7 @@ import {
getPath,
getStickersPath,
getTempPath,
} from './attachments';
} from './attachments.js';
const log = createLogger('attachment_channel');

View file

@ -3,24 +3,24 @@
import { PassThrough } from 'node:stream';
import { stat } from 'node:fs/promises';
import { join, relative, normalize } from 'path';
import { join, relative, normalize } from 'node:path';
import pMap from 'p-map';
import fastGlob from 'fast-glob';
import fse from 'fs-extra';
import { map, isString } from 'lodash';
import normalizePath from 'normalize-path';
import { isPathInside } from '../ts/util/isPathInside';
import { DAY } from '../ts/util/durations';
import { isOlderThan } from '../ts/util/timestamp';
import { isNotNil } from '../ts/util/isNotNil';
import { isPathInside } from '../ts/util/isPathInside.js';
import { DAY } from '../ts/util/durations/index.js';
import { isOlderThan } from '../ts/util/timestamp.js';
import { isNotNil } from '../ts/util/isNotNil.js';
import {
generateKeys,
decryptAttachmentV2ToSink,
encryptAttachmentV2ToDisk,
} from '../ts/AttachmentCrypto';
import type { LocalAttachmentV2Type } from '../ts/types/Attachment';
import * as Errors from '../ts/types/errors';
import { createLogger } from '../ts/logging/log';
} from '../ts/AttachmentCrypto.js';
import type { LocalAttachmentV2Type } from '../ts/types/Attachment.js';
import * as Errors from '../ts/types/errors.js';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('attachments');

View file

@ -1,13 +1,13 @@
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { readFileSync, unlinkSync } from 'fs';
import { readFileSync, unlinkSync } from 'node:fs';
import { sync as writeFileSync } from 'write-file-atomic';
import { get } from 'lodash';
import { set } from 'lodash/fp';
import { strictAssert } from '../ts/util/assert';
import { createLogger } from '../ts/logging/log';
import { strictAssert } from '../ts/util/assert.js';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('base_config');

View file

@ -1,7 +1,7 @@
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join, basename } from 'path';
import { join, basename } from 'node:path';
import { app } from 'electron';
import type { IConfig } from 'config';
@ -11,8 +11,8 @@ import {
getEnvironment,
setEnvironment,
parseEnvironment,
} from '../ts/environment';
import { createLogger } from '../ts/logging/log';
} from '../ts/environment.js';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('config');

View file

@ -3,16 +3,16 @@
import { app, crashReporter, ipcMain as ipc } from 'electron';
import { realpath, readdir, readFile, unlink, stat } from 'fs-extra';
import { basename, join } from 'path';
import { basename, join } from 'node:path';
import { toJSONString as dumpToJSONString } from '@signalapp/libsignal-client/dist/Minidump';
import z from 'zod';
import type { LoggerType } from '../ts/types/Logging';
import * as Errors from '../ts/types/errors';
import { isProduction } from '../ts/util/version';
import { isNotNil } from '../ts/util/isNotNil';
import OS from '../ts/util/os/osMain';
import { parseUnknown } from '../ts/util/schemas';
import type { LoggerType } from '../ts/types/Logging.js';
import * as Errors from '../ts/types/errors.js';
import { isProduction } from '../ts/util/version.js';
import { isNotNil } from '../ts/util/isNotNil.js';
import OS from '../ts/util/os/osMain.js';
import { parseUnknown } from '../ts/util/schemas.js';
// See https://github.com/rust-minidump/rust-minidump/blob/main/minidump-processor/json-schema.md
const dumpString = z.string().or(z.null()).optional();

View file

@ -1,12 +1,12 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'path';
import { readFile } from 'fs/promises';
import { DNSFallbackSchema } from '../ts/types/DNSFallback';
import type { DNSFallbackType } from '../ts/types/DNSFallback';
import { parseUnknown } from '../ts/util/schemas';
import { createLogger } from '../ts/logging/log';
import { join } from 'node:path';
import { readFile } from 'node:fs/promises';
import { DNSFallbackSchema } from '../ts/types/DNSFallback.js';
import type { DNSFallbackType } from '../ts/types/DNSFallback.js';
import { parseUnknown } from '../ts/util/schemas.js';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('dns-fallback');

View file

@ -1,11 +1,11 @@
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'path';
import { join } from 'node:path';
import { app } from 'electron';
import { start } from './base_config';
import { start } from './base_config.js';
const userDataPath = app.getPath('userData');
const targetPath = join(userDataPath, 'ephemeral.json');

View file

@ -4,11 +4,11 @@
import { app, dialog, clipboard } from 'electron';
import os from 'node:os';
import * as Errors from '../ts/types/errors';
import { redactAll } from '../ts/util/privacy';
import { createLogger } from '../ts/logging/log';
import { reallyJsonStringify } from '../ts/util/reallyJsonStringify';
import type { LocaleType } from './locale';
import * as Errors from '../ts/types/errors.js';
import { redactAll } from '../ts/util/privacy.js';
import { createLogger } from '../ts/logging/log.js';
import { reallyJsonStringify } from '../ts/util/reallyJsonStringify.js';
import type { LocaleType } from './locale.js';
const log = createLogger('global_errors');

View file

@ -7,14 +7,17 @@ import { app } from 'electron';
import { merge } from 'lodash';
import * as LocaleMatcher from '@formatjs/intl-localematcher';
import { z } from 'zod';
import { setupI18n } from '../ts/util/setupI18nMain';
import { shouldNeverBeCalled } from '../ts/util/shouldNeverBeCalled';
import { setupI18n } from '../ts/util/setupI18nMain.js';
import { shouldNeverBeCalled } from '../ts/util/shouldNeverBeCalled.js';
import type { LoggerType } from '../ts/types/Logging';
import type { HourCyclePreference, LocaleMessagesType } from '../ts/types/I18N';
import type { LocalizerType } from '../ts/types/Util';
import * as Errors from '../ts/types/errors';
import { parseUnknown } from '../ts/util/schemas';
import type { LoggerType } from '../ts/types/Logging.js';
import type {
HourCyclePreference,
LocaleMessagesType,
} from '../ts/types/I18N.js';
import type { LocalizerType } from '../ts/types/Util.js';
import * as Errors from '../ts/types/errors.js';
import { parseUnknown } from '../ts/util/schemas.js';
type CompactLocaleMessagesType = ReadonlyArray<string | null>;
type CompactLocaleKeysType = ReadonlyArray<string>;

View file

@ -1,11 +1,11 @@
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join, normalize, extname, dirname, basename } from 'path';
import { pathToFileURL } from 'url';
import * as os from 'os';
import { join, normalize, extname, dirname, basename } from 'node:path';
import { pathToFileURL } from 'node:url';
import * as os from 'node:os';
import { chmod, realpath, writeFile } from 'fs-extra';
import { randomBytes } from 'crypto';
import { randomBytes } from 'node:crypto';
import { createParser } from 'dashdash';
import fastGlob from 'fast-glob';
@ -33,98 +33,98 @@ import type { MenuItemConstructorOptions, Settings } from 'electron';
import { z } from 'zod';
import packageJson from '../package.json';
import * as GlobalErrors from './global_errors';
import { setup as setupCrashReports } from './crashReports';
import { setup as setupSpellChecker } from './spell_check';
import { getDNSFallback } from './dns-fallback';
import { redactAll, addSensitivePath } from '../ts/util/privacy';
import { createSupportUrl } from '../ts/util/createSupportUrl';
import { missingCaseError } from '../ts/util/missingCaseError';
import { strictAssert } from '../ts/util/assert';
import { drop } from '../ts/util/drop';
import type { ThemeSettingType } from '../ts/types/StorageUIKeys';
import { ThemeType } from '../ts/types/Util';
import * as Errors from '../ts/types/errors';
import { resolveCanonicalLocales } from '../ts/util/resolveCanonicalLocales';
import { createLogger } from '../ts/logging/log';
import * as debugLog from '../ts/logging/debuglogs';
import * as uploadDebugLog from '../ts/logging/uploadDebugLog';
import { explodePromise } from '../ts/util/explodePromise';
import * as GlobalErrors from './global_errors.js';
import { setup as setupCrashReports } from './crashReports.js';
import { setup as setupSpellChecker } from './spell_check.js';
import { getDNSFallback } from './dns-fallback.js';
import { redactAll, addSensitivePath } from '../ts/util/privacy.js';
import { createSupportUrl } from '../ts/util/createSupportUrl.js';
import { missingCaseError } from '../ts/util/missingCaseError.js';
import { strictAssert } from '../ts/util/assert.js';
import { drop } from '../ts/util/drop.js';
import type { ThemeSettingType } from '../ts/types/StorageUIKeys.js';
import { ThemeType } from '../ts/types/Util.js';
import * as Errors from '../ts/types/errors.js';
import { resolveCanonicalLocales } from '../ts/util/resolveCanonicalLocales.js';
import { createLogger } from '../ts/logging/log.js';
import * as debugLog from '../ts/logging/debuglogs.js';
import * as uploadDebugLog from '../ts/logging/uploadDebugLog.js';
import { explodePromise } from '../ts/util/explodePromise.js';
import './startup_config';
import './startup_config.js';
import type { RendererConfigType } from '../ts/types/RendererConfig';
import type { RendererConfigType } from '../ts/types/RendererConfig.js';
import {
directoryConfigSchema,
rendererConfigSchema,
} from '../ts/types/RendererConfig';
import config from './config';
} from '../ts/types/RendererConfig.js';
import config from './config.js';
import {
Environment,
getEnvironment,
isTestEnvironment,
} from '../ts/environment';
} from '../ts/environment.js';
// Very important to put before the single instance check, since it is based on the
// userData directory. (see requestSingleInstanceLock below)
import * as userConfig from './user_config';
import * as userConfig from './user_config.js';
// We generally want to pull in our own modules after this point, after the user
// data directory has been set.
import * as attachments from './attachments';
import * as attachmentChannel from './attachment_channel';
import * as bounce from '../ts/services/bounce';
import * as updater from '../ts/updater/index';
import { updateDefaultSession } from './updateDefaultSession';
import { PreventDisplaySleepService } from './PreventDisplaySleepService';
import { SystemTrayService, focusAndForceToTop } from './SystemTrayService';
import { SystemTraySettingCache } from './SystemTraySettingCache';
import { OptionalResourceService } from './OptionalResourceService';
import { EmojiService } from './EmojiService';
import * as attachments from './attachments.js';
import * as attachmentChannel from './attachment_channel.js';
import * as bounce from '../ts/services/bounce.js';
import * as updater from '../ts/updater/index.js';
import { updateDefaultSession } from './updateDefaultSession.js';
import { PreventDisplaySleepService } from './PreventDisplaySleepService.js';
import { SystemTrayService, focusAndForceToTop } from './SystemTrayService.js';
import { SystemTraySettingCache } from './SystemTraySettingCache.js';
import { OptionalResourceService } from './OptionalResourceService.js';
import { EmojiService } from './EmojiService.js';
import {
SystemTraySetting,
shouldMinimizeToSystemTray,
parseSystemTraySetting,
} from '../ts/types/SystemTraySetting';
} from '../ts/types/SystemTraySetting.js';
import {
getDefaultSystemTraySetting,
isSystemTraySupported,
isContentProtectionEnabledByDefault,
} from '../ts/types/Settings';
import * as ephemeralConfig from './ephemeral_config';
import * as mainProcessLogging from '../ts/logging/main_process_logging';
import { MainSQL } from '../ts/sql/main';
import * as sqlChannels from './sql_channel';
import * as windowState from './window_state';
import type { CreateTemplateOptionsType } from './menu';
import { createTemplate } from './menu';
import { installFileHandler, installWebHandler } from './protocol_filter';
import OS from '../ts/util/os/osMain';
import { isNightly, isProduction } from '../ts/util/version';
import { clearTimeoutIfNecessary } from '../ts/util/clearTimeoutIfNecessary';
import { toggleMaximizedBrowserWindow } from '../ts/util/toggleMaximizedBrowserWindow';
import { ChallengeMainHandler } from '../ts/main/challengeMain';
import { NativeThemeNotifier } from '../ts/main/NativeThemeNotifier';
import { PowerChannel } from '../ts/main/powerChannel';
import { SettingsChannel } from '../ts/main/settingsChannel';
import { maybeParseUrl, setUrlSearchParams } from '../ts/util/url';
import { getHeicConverter } from '../ts/workers/heicConverterMain';
} from '../ts/types/Settings.js';
import * as ephemeralConfig from './ephemeral_config.js';
import * as mainProcessLogging from '../ts/logging/main_process_logging.js';
import { MainSQL } from '../ts/sql/main.js';
import * as sqlChannels from './sql_channel.js';
import * as windowState from './window_state.js';
import type { CreateTemplateOptionsType } from './menu.js';
import { createTemplate } from './menu.js';
import { installFileHandler, installWebHandler } from './protocol_filter.js';
import OS from '../ts/util/os/osMain.js';
import { isNightly, isProduction } from '../ts/util/version.js';
import { clearTimeoutIfNecessary } from '../ts/util/clearTimeoutIfNecessary.js';
import { toggleMaximizedBrowserWindow } from '../ts/util/toggleMaximizedBrowserWindow.js';
import { ChallengeMainHandler } from '../ts/main/challengeMain.js';
import { NativeThemeNotifier } from '../ts/main/NativeThemeNotifier.js';
import { PowerChannel } from '../ts/main/powerChannel.js';
import { SettingsChannel } from '../ts/main/settingsChannel.js';
import { maybeParseUrl, setUrlSearchParams } from '../ts/util/url.js';
import { getHeicConverter } from '../ts/workers/heicConverterMain.js';
import type { LocaleDirection, LocaleType } from './locale';
import { load as loadLocale } from './locale';
import type { LocaleDirection, LocaleType } from './locale.js';
import { load as loadLocale } from './locale.js';
import { HourCyclePreference } from '../ts/types/I18N';
import { ScreenShareStatus } from '../ts/types/Calling';
import type { ParsedSignalRoute } from '../ts/util/signalRoutes';
import { parseSignalRoute } from '../ts/util/signalRoutes';
import * as dns from '../ts/util/dns';
import { ZoomFactorService } from '../ts/services/ZoomFactorService';
import { SafeStorageBackendChangeError } from '../ts/types/SafeStorageBackendChangeError';
import { LINUX_PASSWORD_STORE_FLAGS } from '../ts/util/linuxPasswordStoreFlags';
import { getOwn } from '../ts/util/getOwn';
import { safeParseLoose, safeParseUnknown } from '../ts/util/schemas';
import { getAppErrorIcon } from '../ts/util/getAppErrorIcon';
import { promptOSAuth } from '../ts/util/os/promptOSAuthMain';
import { HourCyclePreference } from '../ts/types/I18N.js';
import { ScreenShareStatus } from '../ts/types/Calling.js';
import type { ParsedSignalRoute } from '../ts/util/signalRoutes.js';
import { parseSignalRoute } from '../ts/util/signalRoutes.js';
import * as dns from '../ts/util/dns.js';
import { ZoomFactorService } from '../ts/services/ZoomFactorService.js';
import { SafeStorageBackendChangeError } from '../ts/types/SafeStorageBackendChangeError.js';
import { LINUX_PASSWORD_STORE_FLAGS } from '../ts/util/linuxPasswordStoreFlags.js';
import { getOwn } from '../ts/util/getOwn.js';
import { safeParseLoose, safeParseUnknown } from '../ts/util/schemas.js';
import { getAppErrorIcon } from '../ts/util/getAppErrorIcon.js';
import { promptOSAuth } from '../ts/util/os/promptOSAuthMain.js';
const log = createLogger('app/main');
const updaterLog = log.child('updater');
@ -221,7 +221,7 @@ let sendDummyKeystroke: undefined | (() => void);
if (OS.isWindows()) {
try {
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
const windowsNotifications = require('./WindowsNotifications');
const windowsNotifications = require('./WindowsNotifications.js');
sendDummyKeystroke = windowsNotifications.sendDummyKeystroke;
} catch (error) {
log.error('Failed to initialize Windows Notifications:', error.stack);

View file

@ -3,12 +3,12 @@
import { isString } from 'lodash';
import type { LocalizerType } from '../ts/types/I18N';
import type { LocalizerType } from '../ts/types/I18N.js';
import type {
MenuListType,
MenuOptionsType,
MenuActionsType,
} from '../ts/types/menu';
} from '../ts/types/menu.js';
export type CreateTemplateOptionsType = MenuOptionsType & MenuActionsType;

View file

@ -6,8 +6,8 @@
import type { session as ElectronSession, Session } from 'electron';
import type { ConfigType } from './base_config';
import { createLogger } from '../ts/logging/log';
import type { ConfigType } from './base_config.js';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('permissions');

View file

@ -3,8 +3,8 @@
import type { ProtocolRequest, ProtocolResponse, Session } from 'electron';
import { isAbsolute, normalize } from 'path';
import { existsSync, realpathSync } from 'fs';
import { isAbsolute, normalize } from 'node:path';
import { existsSync, realpathSync } from 'node:fs';
import {
getAvatarsPath,
getBadgesPath,
@ -14,8 +14,8 @@ import {
getStickersPath,
getTempPath,
getUpdateCachePath,
} from './attachments';
import { createLogger } from '../ts/logging/log';
} from './attachments.js';
import { createLogger } from '../ts/logging/log.js';
const log = createLogger('protocol_filter');

View file

@ -5,14 +5,14 @@ import type { BrowserWindow } from 'electron';
import { Menu, clipboard, nativeImage } from 'electron';
import * as LocaleMatcher from '@formatjs/intl-localematcher';
import { maybeParseUrl } from '../ts/util/url';
import { maybeParseUrl } from '../ts/util/url.js';
import type { MenuListType } from '../ts/types/menu';
import type { LocalizerType } from '../ts/types/Util';
import { strictAssert } from '../ts/util/assert';
import type { LoggerType } from '../ts/types/Logging';
import { createLogger } from '../ts/logging/log';
import { handleAttachmentRequest } from './attachment_channel';
import type { MenuListType } from '../ts/types/menu.js';
import type { LocalizerType } from '../ts/types/Util.js';
import { strictAssert } from '../ts/util/assert.js';
import type { LoggerType } from '../ts/types/Logging.js';
import { createLogger } from '../ts/logging/log.js';
import { handleAttachmentRequest } from './attachment_channel.js';
const log = createLogger('spell_check');

View file

@ -3,9 +3,9 @@
import { ipcMain } from 'electron';
import type { MainSQL } from '../ts/sql/main';
import { remove as removeUserConfig } from './user_config';
import { remove as removeEphemeralConfig } from './ephemeral_config';
import type { MainSQL } from '../ts/sql/main.js';
import { remove as removeUserConfig } from './user_config.js';
import { remove as removeEphemeralConfig } from './ephemeral_config.js';
let sql:
| Pick<

View file

@ -4,8 +4,8 @@
import { app } from 'electron';
import packageJson from '../package.json';
import { createLogger } from '../ts/logging/log';
import * as GlobalErrors from './global_errors';
import { createLogger } from '../ts/logging/log.js';
import * as GlobalErrors from './global_errors.js';
const log = createLogger('startup_config');

View file

@ -5,10 +5,10 @@ import type { Session, DesktopCapturerSource, IpcMainEvent } from 'electron';
import { desktopCapturer, ipcMain, systemPreferences } from 'electron';
import { v4 as generateUuid } from 'uuid';
import OS from '../ts/util/os/osMain';
import type { LoggerType } from '../ts/types/Logging';
import { strictAssert } from '../ts/util/assert';
import { type IpcResponseType } from '../ts/util/desktopCapturer';
import OS from '../ts/util/os/osMain.js';
import type { LoggerType } from '../ts/types/Logging.js';
import { strictAssert } from '../ts/util/assert.js';
import { type IpcResponseType } from '../ts/util/desktopCapturer.js';
const SPELL_CHECKER_DICTIONARY_DOWNLOAD_URL = `https://updates.signal.org/desktop/hunspell_dictionaries/${process.versions.electron}/`;

View file

@ -1,13 +1,13 @@
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'path';
import { mkdirSync } from 'fs';
import { join } from 'node:path';
import { mkdirSync } from 'node:fs';
import { app } from 'electron';
import { start } from './base_config';
import config from './config';
import * as Errors from '../ts/types/errors';
import { start } from './base_config.js';
import config from './config.js';
import * as Errors from '../ts/types/errors.js';
let userData: string | undefined;
// Use separate data directory for benchmarks & development

View file

@ -7,21 +7,21 @@ import type {
Location,
} from '@formatjs/icu-messageformat-parser';
import parseJsonToAst from 'json-to-ast';
import { readFile } from 'fs/promises';
import { join as pathJoin, relative as pathRelative } from 'path';
import { readFile } from 'node:fs/promises';
import { join as pathJoin, relative as pathRelative } from 'node:path';
import chalk from 'chalk';
import { deepEqual } from 'assert';
import type { Rule } from './utils/rule';
import { deepEqual } from 'node:assert';
import type { Rule } from './utils/rule.js';
import icuPrefix from './rules/icuPrefix';
import wrapEmoji from './rules/wrapEmoji';
import onePlural from './rules/onePlural';
import noLegacyVariables from './rules/noLegacyVariables';
import noNestedChoice from './rules/noNestedChoice';
import noOffset from './rules/noOffset';
import noOneChoice from './rules/noOneChoice';
import noOrdinal from './rules/noOrdinal';
import pluralPound from './rules/pluralPound';
import icuPrefix from './rules/icuPrefix.js';
import wrapEmoji from './rules/wrapEmoji.js';
import onePlural from './rules/onePlural.js';
import noLegacyVariables from './rules/noLegacyVariables.js';
import noNestedChoice from './rules/noNestedChoice.js';
import noOffset from './rules/noOffset.js';
import noOneChoice from './rules/noOneChoice.js';
import noOrdinal from './rules/noOrdinal.js';
import pluralPound from './rules/pluralPound.js';
const RULES = [
icuPrefix,

View file

@ -1,7 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('icuPrefix', context => {
if (!context.messageId.startsWith('icu:')) {

View file

@ -1,7 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('noLegacyVariables', context => {
return {

View file

@ -1,8 +1,8 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { Element } from '../utils/rule';
import { rule } from '../utils/rule';
import type { Element } from '../utils/rule.js';
import { rule } from '../utils/rule.js';
export default rule('noNestedChoice', context => {
let insideChoice = false;

View file

@ -1,7 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('noOffset', context => {
return {

View file

@ -1,7 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('noOneChoice', context => {
return {

View file

@ -1,7 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('noOrdinal', context => {
return {

View file

@ -1,7 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('onePlural', context => {
let plurals = 0;

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import type { PluralElement } from '@formatjs/icu-messageformat-parser';
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
export default rule('pluralPound', context => {
const stack: Array<PluralElement> = [];

View file

@ -10,7 +10,7 @@ import {
isTagElement,
isLiteralElement,
} from '@formatjs/icu-messageformat-parser';
import { rule } from '../utils/rule';
import { rule } from '../utils/rule.js';
function isEmojifyTag(
element: MessageFormatElement | null

View file

@ -5,8 +5,8 @@ import type {
MessageFormatElement,
Location,
} from '@formatjs/icu-messageformat-parser';
import type { Visitor } from './traverse';
import { traverse } from './traverse';
import type { Visitor } from './traverse.js';
import { traverse } from './traverse.js';
export type Element = MessageFormatElement;
export type { Location };

View file

@ -313,12 +313,12 @@
"endanger": "7.0.4",
"enhanced-resolve": "5.18.3",
"enquirer": "2.4.1",
"esbuild": "0.24.0",
"esbuild": "0.25.9",
"eslint": "8.56.0",
"eslint-config-airbnb-typescript-prettier": "5.0.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-better-tailwindcss": "3.7.2",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-import": "2.32.0",
"eslint-plugin-local-rules": "1.3.2",
"eslint-plugin-mocha": "10.1.0",
"eslint-plugin-more": "1.0.5",

576
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -2,11 +2,13 @@
// SPDX-License-Identifier: AGPL-3.0-only
const esbuild = require('esbuild');
const path = require('path');
const path = require('node:path');
const fs = require('node:fs');
const fastGlob = require('fast-glob');
const ROOT_DIR = path.join(__dirname, '..');
const BUNDLES_DIR = 'bundles';
const NODE_MODULES_DIR = path.join(ROOT_DIR, 'node_modules');
const watch = process.argv.some(argv => argv === '-w' || argv === '--watch');
const isProd = process.argv.some(argv => argv === '-prod' || argv === '--prod');
@ -22,6 +24,33 @@ const nodeDefaults = {
// See: https://github.com/evanw/esbuild/issues/1147
keepNames: true,
logLevel: 'info',
plugins: [
{
name: 'resolve-ts',
setup(b) {
b.onResolve({ filter: /\.js$/ }, args => {
if (!args.path.startsWith('.')) {
return undefined;
}
const targetPath = path.join(args.resolveDir, args.path);
if (targetPath.startsWith(NODE_MODULES_DIR)) {
return undefined;
}
const tsPath = targetPath.replace(/\.js$/, '.ts');
const tsxPath = targetPath.replace(/\.js$/, '.tsx');
if (fs.existsSync(tsPath)) {
return { path: tsPath };
}
if (fs.existsSync(tsxPath)) {
return { path: tsxPath };
}
return undefined;
});
},
},
],
};
const bundleDefaults = {
@ -61,8 +90,11 @@ const bundleDefaults = {
'moment',
'quill',
// Imported, but not used in production builds
'mocha',
// Uses fast-glob and dynamic requires
'./preload_test',
'./preload_test.js',
],
};
@ -119,7 +151,7 @@ async function main() {
entryPoints: [
'preload.wrapper.ts',
...fastGlob
.sync('{app,ts}/**/*.{ts,tsx}', {
.sync('{app,ts,build}/**/*.{ts,tsx}', {
onlyFiles: true,
cwd: ROOT_DIR,
})

View file

@ -1,9 +1,9 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const assert = require('assert');
const fs = require('fs');
const { join } = require('path');
const assert = require('node:assert');
const fs = require('node:fs');
const { join } = require('node:path');
const pMap = require('p-map');
const prettier = require('prettier');

View file

@ -1,12 +1,12 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const fs = require('fs');
const fs = require('node:fs');
const _ = require('lodash');
const { execSync } = require('child_process');
const { execSync } = require('node:child_process');
const packageJson = require('../package.json');
const { isAdhoc } = require('../ts/util/version');
const { isAdhoc } = require('../ts/util/version.js');
const { version } = packageJson;

View file

@ -1,11 +1,11 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const fs = require('fs');
const fs = require('node:fs');
const _ = require('lodash');
const packageJson = require('../package.json');
const { isAlpha } = require('../ts/util/version');
const { isAlpha } = require('../ts/util/version.js');
const { version } = packageJson;

View file

@ -1,11 +1,11 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const fs = require('fs');
const fs = require('node:fs');
const _ = require('lodash');
const packageJson = require('../package.json');
const { isAxolotl } = require('../ts/util/version');
const { isAxolotl } = require('../ts/util/version.js');
const { version } = packageJson;

View file

@ -1,11 +1,11 @@
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const fs = require('fs');
const fs = require('node:fs');
const _ = require('lodash');
const packageJson = require('../package.json');
const { isBeta } = require('../ts/util/version');
const { isBeta } = require('../ts/util/version.js');
const { version } = packageJson;

View file

@ -1,11 +1,11 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const fs = require('fs');
const fs = require('node:fs');
const _ = require('lodash');
const packageJson = require('../package.json');
const { isAlpha } = require('../ts/util/version');
const { isAlpha } = require('../ts/util/version.js');
const { version } = packageJson;

View file

@ -1,8 +1,8 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
const fs = require('fs');
const { execSync } = require('child_process');
const fs = require('node:fs');
const { execSync } = require('node:child_process');
const _ = require('lodash');
@ -12,7 +12,7 @@ if (release !== 'alpha' && release !== 'axolotl' && release !== 'adhoc') {
process.exit(1);
}
const { generateTaggedVersion } = require('../ts/util/version');
const { generateTaggedVersion } = require('../ts/util/version.js');
const packageJson = require('../package.json');

View file

@ -1,13 +1,18 @@
// Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { createReadStream, createWriteStream } from 'fs';
import { open, unlink, stat } from 'fs/promises';
import type { FileHandle } from 'fs/promises';
import { createCipheriv, createHash, createHmac, randomBytes } from 'crypto';
import type { Hash } from 'crypto';
import { PassThrough, Transform, type Writable, Readable } from 'stream';
import { pipeline } from 'stream/promises';
import { createReadStream, createWriteStream } from 'node:fs';
import { open, unlink, stat } from 'node:fs/promises';
import type { FileHandle } from 'node:fs/promises';
import {
createCipheriv,
createHash,
createHmac,
randomBytes,
} from 'node:crypto';
import type { Hash } from 'node:crypto';
import { PassThrough, Transform, type Writable, Readable } from 'node:stream';
import { pipeline } from 'node:stream/promises';
import { isNumber } from 'lodash';
import { ensureFile } from 'fs-extra';
@ -19,9 +24,9 @@ import {
ValidatingPassThrough,
} from '@signalapp/libsignal-client/dist/incremental_mac';
import type { ChunkSizeChoice } from '@signalapp/libsignal-client/dist/incremental_mac';
import { isAbsolute } from 'path';
import { isAbsolute } from 'node:path';
import { createLogger } from './logging/log';
import { createLogger } from './logging/log.js';
import {
HashType,
CipherType,
@ -31,22 +36,22 @@ import {
DIGEST_LENGTH,
ATTACHMENT_MAC_LENGTH,
AES_KEY_LENGTH,
} from './types/Crypto';
import { constantTimeEqual } from './Crypto';
import { createName, getRelativePath } from './util/attachmentPath';
import { appendPaddingStream, logPadSize } from './util/logPadding';
import { prependStream } from './util/prependStream';
import { appendMacStream } from './util/appendMacStream';
import { finalStream } from './util/finalStream';
import { getMacAndUpdateHmac } from './util/getMacAndUpdateHmac';
import { trimPadding } from './util/trimPadding';
import { assertDev, strictAssert } from './util/assert';
import * as Errors from './types/errors';
import { isNotNil } from './util/isNotNil';
import { missingCaseError } from './util/missingCaseError';
import { getEnvironment, Environment } from './environment';
import { isNotEmpty, toBase64, toHex } from './Bytes';
import { decipherWithAesKey } from './util/decipherWithAesKey';
} from './types/Crypto.js';
import { constantTimeEqual } from './Crypto.js';
import { createName, getRelativePath } from './util/attachmentPath.js';
import { appendPaddingStream, logPadSize } from './util/logPadding.js';
import { prependStream } from './util/prependStream.js';
import { appendMacStream } from './util/appendMacStream.js';
import { finalStream } from './util/finalStream.js';
import { getMacAndUpdateHmac } from './util/getMacAndUpdateHmac.js';
import { trimPadding } from './util/trimPadding.js';
import { assertDev, strictAssert } from './util/assert.js';
import * as Errors from './types/errors.js';
import { isNotNil } from './util/isNotNil.js';
import { missingCaseError } from './util/missingCaseError.js';
import { getEnvironment, Environment } from './environment.js';
import { isNotEmpty, toBase64, toHex } from './Bytes.js';
import { decipherWithAesKey } from './util/decipherWithAesKey.js';
const log = createLogger('AttachmentCrypto');

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { Bytes } from './context/Bytes';
import { Bytes } from './context/Bytes.js';
const bytes = globalThis.window?.SignalContext?.bytes || new Bytes();

View file

@ -4,20 +4,20 @@
import { format } from 'node:util';
import { ipcRenderer } from 'electron';
import type { IPCResponse as ChallengeResponseType } from './challenge';
import type { MessageAttributesType } from './model-types.d';
import { createLogger } from './logging/log';
import { explodePromise } from './util/explodePromise';
import { AccessType, ipcInvoke } from './sql/channels';
import { backupsService } from './services/backups';
import { notificationService } from './services/notifications';
import { AttachmentBackupManager } from './jobs/AttachmentBackupManager';
import { migrateAllMessages } from './messages/migrateMessageData';
import { SECOND } from './util/durations';
import { isSignalRoute } from './util/signalRoutes';
import { strictAssert } from './util/assert';
import { MessageModel } from './models/messages';
import type { SocketStatuses } from './textsecure/SocketManager';
import type { IPCResponse as ChallengeResponseType } from './challenge.js';
import type { MessageAttributesType } from './model-types.d.ts';
import { createLogger } from './logging/log.js';
import { explodePromise } from './util/explodePromise.js';
import { AccessType, ipcInvoke } from './sql/channels.js';
import { backupsService } from './services/backups/index.js';
import { notificationService } from './services/notifications.js';
import { AttachmentBackupManager } from './jobs/AttachmentBackupManager.js';
import { migrateAllMessages } from './messages/migrateMessageData.js';
import { SECOND } from './util/durations/index.js';
import { isSignalRoute } from './util/signalRoutes.js';
import { strictAssert } from './util/assert.js';
import { MessageModel } from './models/messages.js';
import type { SocketStatuses } from './textsecure/SocketManager.js';
const log = createLogger('CI');

View file

@ -3,20 +3,20 @@
import { v4 as uuid } from 'uuid';
import { incrementMessageCounter } from '../util/incrementMessageCounter';
import { ReadStatus } from '../messages/MessageReadStatus';
import { SendStatus } from '../messages/MessageSendState';
import { DataWriter } from '../sql/Client';
import { BodyRange } from '../types/BodyRange';
import { strictAssert } from '../util/assert';
import { MINUTE } from '../util/durations';
import { isOlderThan } from '../util/timestamp';
import { sleep } from '../util/sleep';
import { stats } from '../util/benchmark/stats';
import type { StatsType } from '../util/benchmark/stats';
import type { MessageAttributesType } from '../model-types.d';
import { createLogger } from '../logging/log';
import { postSaveUpdates } from '../util/cleanup';
import { incrementMessageCounter } from '../util/incrementMessageCounter.js';
import { ReadStatus } from '../messages/MessageReadStatus.js';
import { SendStatus } from '../messages/MessageSendState.js';
import { DataWriter } from '../sql/Client.js';
import { BodyRange } from '../types/BodyRange.js';
import { strictAssert } from '../util/assert.js';
import { MINUTE } from '../util/durations/index.js';
import { isOlderThan } from '../util/timestamp.js';
import { sleep } from '../util/sleep.js';
import { stats } from '../util/benchmark/stats.js';
import type { StatsType } from '../util/benchmark/stats.js';
import type { MessageAttributesType } from '../model-types.d.ts';
import { createLogger } from '../logging/log.js';
import { postSaveUpdates } from '../util/cleanup.js';
const log = createLogger('benchmarkConversationOpen');

View file

@ -5,50 +5,54 @@ import { debounce, pick, uniq, without } from 'lodash';
import PQueue from 'p-queue';
import { v4 as generateUuid } from 'uuid';
import { DataReader, DataWriter } from './sql/Client';
import { createLogger } from './logging/log';
import * as Errors from './types/errors';
import { getAuthorId } from './messages/helpers';
import { maybeDeriveGroupV2Id } from './groups';
import { assertDev, strictAssert } from './util/assert';
import { drop } from './util/drop';
import { DataReader, DataWriter } from './sql/Client.js';
import { createLogger } from './logging/log.js';
import * as Errors from './types/errors.js';
import { getAuthorId } from './messages/helpers.js';
import { maybeDeriveGroupV2Id } from './groups.js';
import { assertDev, strictAssert } from './util/assert.js';
import { drop } from './util/drop.js';
import {
isDirectConversation,
isGroup,
isGroupV1,
isGroupV2,
} from './util/whatTypeOfConversation';
} from './util/whatTypeOfConversation.js';
import {
isServiceIdString,
normalizePni,
normalizeServiceId,
} from './types/ServiceId';
import { normalizeAci } from './util/normalizeAci';
import { sleep } from './util/sleep';
import { isNotNil } from './util/isNotNil';
import { MINUTE, SECOND } from './util/durations';
import { getServiceIdsForE164s } from './util/getServiceIdsForE164s';
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation';
import { getTitleNoDefault } from './util/getTitle';
import * as StorageService from './services/storage';
import type { ConversationPropsForUnreadStats } from './util/countUnreadStats';
import { countAllConversationsUnreadStats } from './util/countUnreadStats';
import { isTestOrMockEnvironment } from './environment';
import { isConversationAccepted } from './util/isConversationAccepted';
import { areWePending } from './util/groupMembershipUtils';
import { conversationJobQueue } from './jobs/conversationJobQueue';
import { createBatcher } from './util/batcher';
import { validateConversation } from './util/validateConversation';
import { ConversationModel } from './models/conversations';
import { INITIAL_EXPIRE_TIMER_VERSION } from './util/expirationTimer';
import { missingCaseError } from './util/missingCaseError';
} from './types/ServiceId.js';
import { normalizeAci } from './util/normalizeAci.js';
import { sleep } from './util/sleep.js';
import { isNotNil } from './util/isNotNil.js';
import { MINUTE, SECOND } from './util/durations/index.js';
import { getServiceIdsForE164s } from './util/getServiceIdsForE164s.js';
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation.js';
import { getTitleNoDefault } from './util/getTitle.js';
import * as StorageService from './services/storage.js';
import type { ConversationPropsForUnreadStats } from './util/countUnreadStats.js';
import { countAllConversationsUnreadStats } from './util/countUnreadStats.js';
import { isTestOrMockEnvironment } from './environment.js';
import { isConversationAccepted } from './util/isConversationAccepted.js';
import { areWePending } from './util/groupMembershipUtils.js';
import { conversationJobQueue } from './jobs/conversationJobQueue.js';
import { createBatcher } from './util/batcher.js';
import { validateConversation } from './util/validateConversation.js';
import { ConversationModel } from './models/conversations.js';
import { INITIAL_EXPIRE_TIMER_VERSION } from './util/expirationTimer.js';
import { missingCaseError } from './util/missingCaseError.js';
import type {
ConversationAttributesType,
ConversationAttributesTypeType,
ConversationRenderInfoType,
} from './model-types.d';
import type { ServiceIdString, AciString, PniString } from './types/ServiceId';
} from './model-types.d.ts';
import type {
ServiceIdString,
AciString,
PniString,
} from './types/ServiceId.js';
const log = createLogger('ConversationController');

View file

@ -7,18 +7,18 @@ import { Aci, Pni, hkdf } from '@signalapp/libsignal-client';
import type { PublicKey, PrivateKey } from '@signalapp/libsignal-client';
import { AccountEntropyPool } from '@signalapp/libsignal-client/dist/AccountKeys';
import * as Bytes from './Bytes';
import { Crypto } from './context/Crypto';
import { calculateAgreement, generateKeyPair } from './Curve';
import { HashType, CipherType } from './types/Crypto';
import { AVATAR_COLOR_COUNT, AvatarColors } from './types/Colors';
import { ProfileDecryptError } from './types/errors';
import { getBytesSubarray } from './util/uuidToBytes';
import { logPadSize } from './util/logPadding';
import { Environment, getEnvironment } from './environment';
import { toWebSafeBase64 } from './util/webSafeBase64';
import * as Bytes from './Bytes.js';
import { Crypto } from './context/Crypto.js';
import { calculateAgreement, generateKeyPair } from './Curve.js';
import { HashType, CipherType } from './types/Crypto.js';
import { AVATAR_COLOR_COUNT, AvatarColors } from './types/Colors.js';
import { ProfileDecryptError } from './types/errors.js';
import { getBytesSubarray } from './util/uuidToBytes.js';
import { logPadSize } from './util/logPadding.js';
import { Environment, getEnvironment } from './environment.js';
import { toWebSafeBase64 } from './util/webSafeBase64.js';
import type { AciString, PniString } from './types/ServiceId';
import type { AciString, PniString } from './types/ServiceId.js';
export { HashType, CipherType };

View file

@ -4,14 +4,14 @@
import * as client from '@signalapp/libsignal-client';
import type { KyberPreKeyRecord } from '@signalapp/libsignal-client';
import * as Bytes from './Bytes';
import { constantTimeEqual } from './Crypto';
import * as Bytes from './Bytes.js';
import { constantTimeEqual } from './Crypto.js';
import type {
KeyPairType,
CompatPreKeyType,
CompatSignedPreKeyType,
} from './textsecure/Types.d';
import { createLogger } from './logging/log';
} from './textsecure/Types.d.ts';
import { createLogger } from './logging/log.js';
const log = createLogger('Curve');

View file

@ -1,9 +1,9 @@
// Copyright 2018 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import EventEmitter from 'events';
import { createLogger } from './logging/log';
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary';
import EventEmitter from 'node:events';
import { createLogger } from './logging/log.js';
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary.js';
const log = createLogger('IdleDetector');

View file

@ -26,12 +26,12 @@ import {
SessionStore,
SignedPreKeyStore,
} from '@signalapp/libsignal-client';
import { Address } from './types/Address';
import { QualifiedAddress } from './types/QualifiedAddress';
import type { ServiceIdString } from './types/ServiceId';
import { normalizeServiceId } from './types/ServiceId';
import { Address } from './types/Address.js';
import { QualifiedAddress } from './types/QualifiedAddress.js';
import type { ServiceIdString } from './types/ServiceId.js';
import { normalizeServiceId } from './types/ServiceId.js';
import type { Zone } from './util/Zone';
import type { Zone } from './util/Zone.js';
function encodeAddress(address: ProtocolAddress): Address {
const name = address.name();

View file

@ -3,16 +3,16 @@
import { get, throttle } from 'lodash';
import type { WebAPIType } from './textsecure/WebAPI';
import { createLogger } from './logging/log';
import type { AciString } from './types/ServiceId';
import { parseIntOrThrow } from './util/parseIntOrThrow';
import { HOUR } from './util/durations';
import * as Bytes from './Bytes';
import { uuidToBytes } from './util/uuidToBytes';
import { HashType } from './types/Crypto';
import { getCountryCode } from './types/PhoneNumber';
import { parseRemoteClientExpiration } from './util/parseRemoteClientExpiration';
import type { WebAPIType } from './textsecure/WebAPI.js';
import { createLogger } from './logging/log.js';
import type { AciString } from './types/ServiceId.js';
import { parseIntOrThrow } from './util/parseIntOrThrow.js';
import { HOUR } from './util/durations/index.js';
import * as Bytes from './Bytes.js';
import { uuidToBytes } from './util/uuidToBytes.js';
import { HashType } from './types/Crypto.js';
import { getCountryCode } from './types/PhoneNumber.js';
import { parseRemoteClientExpiration } from './util/parseRemoteClientExpiration.js';
const log = createLogger('RemoteConfig');

View file

@ -4,7 +4,7 @@
import PQueue from 'p-queue';
import { omit } from 'lodash';
import { z } from 'zod';
import { EventEmitter } from 'events';
import { EventEmitter } from 'node:events';
import {
Direction,
@ -19,15 +19,15 @@ import {
SignedPreKeyRecord,
} from '@signalapp/libsignal-client';
import { DataReader, DataWriter } from './sql/Client';
import type { ItemType } from './sql/Interface';
import * as Bytes from './Bytes';
import { constantTimeEqual, sha256 } from './Crypto';
import { assertDev, strictAssert } from './util/assert';
import { isNotNil } from './util/isNotNil';
import { drop } from './util/drop';
import { Zone } from './util/Zone';
import { isMoreRecentThan } from './util/timestamp';
import { DataReader, DataWriter } from './sql/Client.js';
import type { ItemType } from './sql/Interface.js';
import * as Bytes from './Bytes.js';
import { constantTimeEqual, sha256 } from './Crypto.js';
import { assertDev, strictAssert } from './util/assert.js';
import { isNotNil } from './util/isNotNil.js';
import { drop } from './util/drop.js';
import { Zone } from './util/Zone.js';
import { isMoreRecentThan } from './util/timestamp.js';
import type {
DeviceType,
IdentityKeyType,
@ -48,22 +48,26 @@ import type {
SignedPreKeyType,
UnprocessedType,
CompatPreKeyType,
} from './textsecure/Types.d';
import type { ServiceIdString, PniString, AciString } from './types/ServiceId';
import { isServiceIdString, ServiceIdKind } from './types/ServiceId';
import type { Address } from './types/Address';
import type { QualifiedAddressStringType } from './types/QualifiedAddress';
import { QualifiedAddress } from './types/QualifiedAddress';
import { createLogger } from './logging/log';
import * as Errors from './types/errors';
import { MINUTE } from './util/durations';
import { conversationJobQueue } from './jobs/conversationJobQueue';
} from './textsecure/Types.d.ts';
import type {
ServiceIdString,
PniString,
AciString,
} from './types/ServiceId.js';
import { isServiceIdString, ServiceIdKind } from './types/ServiceId.js';
import type { Address } from './types/Address.js';
import type { QualifiedAddressStringType } from './types/QualifiedAddress.js';
import { QualifiedAddress } from './types/QualifiedAddress.js';
import { createLogger } from './logging/log.js';
import * as Errors from './types/errors.js';
import { MINUTE } from './util/durations/index.js';
import { conversationJobQueue } from './jobs/conversationJobQueue.js';
import {
KYBER_KEY_ID_KEY,
SIGNED_PRE_KEY_ID_KEY,
} from './textsecure/AccountManager';
import { formatGroups, groupWhile } from './util/groupWhile';
import { parseUnknown } from './util/schemas';
} from './textsecure/AccountManager.js';
import { formatGroups, groupWhile } from './util/groupWhile.js';
import { parseUnknown } from './util/schemas.js';
const log = createLogger('SignalProtocolStore');

View file

@ -3,7 +3,7 @@
const { timers } = window.SignalContext;
export type { Timeout } from './context/Timers';
export type { Timeout } from './context/Timers.js';
export function setTimeout(
...args: Parameters<typeof timers.setTimeout>

View file

@ -4,9 +4,9 @@ import type { ReactNode } from 'react';
import React, { useId } from 'react';
import type { Meta } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { AriaClickable } from './AriaClickable';
import { AxoButton } from './AxoButton';
import { tw } from './tw';
import { AriaClickable } from './AriaClickable.js';
import { AxoButton } from './AxoButton.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AriaClickable',

View file

@ -10,8 +10,8 @@ import React, {
} from 'react';
import type { ReactNode, MouseEvent, FC } from 'react';
import { useLayoutEffect } from '@react-aria/utils';
import { tw } from './tw';
import { assert } from './_internal/assert';
import { tw } from './tw.js';
import { assert } from './_internal/assert.js';
const Namespace = 'AriaClickable';

View file

@ -7,8 +7,8 @@ import {
_getAllAxoButtonVariants,
_getAllAxoButtonSizes,
AxoButton,
} from './AxoButton';
import { tw } from './tw';
} from './AxoButton.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoButton',

View file

@ -2,10 +2,10 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { memo, forwardRef } from 'react';
import type { ButtonHTMLAttributes, FC, ForwardedRef, ReactNode } from 'react';
import type { TailwindStyles } from './tw';
import { tw } from './tw';
import { AxoSymbol, type AxoSymbolName } from './AxoSymbol';
import { assert } from './_internal/assert';
import type { TailwindStyles } from './tw.js';
import { tw } from './tw.js';
import { AxoSymbol, type AxoSymbolName } from './AxoSymbol.js';
import { assert } from './_internal/assert.js';
const Namespace = 'AxoButton';

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { AxoCheckbox } from './AxoCheckbox';
import { tw } from './tw';
import { AxoCheckbox } from './AxoCheckbox.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoCheckbox',

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { memo } from 'react';
import { Checkbox } from 'radix-ui';
import { AxoSymbol } from './AxoSymbol';
import { tw } from './tw';
import { AxoSymbol } from './AxoSymbol.js';
import { tw } from './tw.js';
const Namespace = 'AxoCheckbox';

View file

@ -3,8 +3,8 @@
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { AxoContextMenu } from './AxoContextMenu';
import { tw } from './tw';
import { AxoContextMenu } from './AxoContextMenu.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoContextMenu',

View file

@ -3,9 +3,9 @@
import React, { memo } from 'react';
import { ContextMenu } from 'radix-ui';
import type { FC } from 'react';
import { AxoSymbol } from './AxoSymbol';
import { AxoBaseMenu } from './_internal/AxoBaseMenu';
import { tw } from './tw';
import { AxoSymbol } from './AxoSymbol.js';
import { AxoBaseMenu } from './_internal/AxoBaseMenu.js';
import { tw } from './tw.js';
const Namespace = 'AxoContextMenu';

View file

@ -3,9 +3,9 @@
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { AxoDropdownMenu } from './AxoDropdownMenu';
import { AxoButton } from './AxoButton';
import { tw } from './tw';
import { AxoDropdownMenu } from './AxoDropdownMenu.js';
import { AxoButton } from './AxoButton.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoDropdownMenu',

View file

@ -3,9 +3,9 @@
import React, { memo } from 'react';
import { DropdownMenu } from 'radix-ui';
import type { FC } from 'react';
import { AxoSymbol } from './AxoSymbol';
import { AxoBaseMenu } from './_internal/AxoBaseMenu';
import { tw } from './tw';
import { AxoSymbol } from './AxoSymbol.js';
import { AxoBaseMenu } from './_internal/AxoBaseMenu.js';
import { tw } from './tw.js';
const Namespace = 'AxoDropdownMenu';

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { AxoSelect } from './AxoSelect';
import { tw } from './tw';
import { AxoSelect } from './AxoSelect.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoSelect',

View file

@ -3,10 +3,10 @@
import React, { memo } from 'react';
import type { FC, ReactNode } from 'react';
import { Select } from 'radix-ui';
import { AxoBaseMenu } from './_internal/AxoBaseMenu';
import { AxoSymbol } from './AxoSymbol';
import type { TailwindStyles } from './tw';
import { tw } from './tw';
import { AxoBaseMenu } from './_internal/AxoBaseMenu.js';
import { AxoSymbol } from './AxoSymbol.js';
import type { TailwindStyles } from './tw.js';
import { tw } from './tw.js';
const Namespace = 'AxoSelect';

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
import type { Meta } from '@storybook/react';
import { AxoSwitch } from './AxoSwitch';
import { tw } from './tw';
import { AxoSwitch } from './AxoSwitch.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoSwitch',

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React, { memo } from 'react';
import { Switch } from 'radix-ui';
import { tw } from './tw';
import { AxoSymbol } from './AxoSymbol';
import { tw } from './tw.js';
import { AxoSymbol } from './AxoSymbol.js';
const Namespace = 'AxoSwitch';

View file

@ -4,9 +4,13 @@ import React, { memo, useMemo, useState } from 'react';
import type { Meta } from '@storybook/react';
import { Direction } from 'radix-ui';
import Fuse from 'fuse.js';
import type { AxoSymbolName } from './AxoSymbol';
import { AxoSymbol, _getAllAxoSymbolNames, _getAxoSymbol } from './AxoSymbol';
import { tw } from './tw';
import type { AxoSymbolName } from './AxoSymbol.js';
import {
AxoSymbol,
_getAllAxoSymbolNames,
_getAxoSymbol,
} from './AxoSymbol.js';
import { tw } from './tw.js';
export default {
title: 'Axo/AxoSymbol',

View file

@ -4,8 +4,8 @@ import type { FC } from 'react';
import React, { memo } from 'react';
import { Direction } from 'radix-ui';
import { VisuallyHidden } from 'react-aria';
import { assert } from './_internal/assert';
import { tw } from './tw';
import { assert } from './_internal/assert.js';
import { tw } from './tw.js';
const { useDirection } = Direction;

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import type { ReactNode } from 'react';
import { tw } from '../tw';
import { AxoSymbol, type AxoSymbolName } from '../AxoSymbol';
import { tw } from '../tw.js';
import { AxoSymbol, type AxoSymbolName } from '../AxoSymbol.js';
// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace AxoBaseMenu {

View file

@ -7,75 +7,78 @@ import PQueue from 'p-queue';
import pMap from 'p-map';
import { v7 as generateUuid } from 'uuid';
import * as Registration from './util/registration';
import MessageReceiver from './textsecure/MessageReceiver';
import * as Registration from './util/registration.js';
import MessageReceiver from './textsecure/MessageReceiver.js';
import type {
SessionResetsType,
ProcessedDataMessage,
} from './textsecure/Types.d';
import { HTTPError } from './textsecure/Errors';
} from './textsecure/Types.d.ts';
import { HTTPError } from './textsecure/Errors.js';
import createTaskWithTimeout, {
suspendTasksWithTimeout,
resumeTasksWithTimeout,
reportLongRunningTasks,
} from './textsecure/TaskWithTimeout';
import type { MessageAttributesType } from './model-types.d';
import * as Bytes from './Bytes';
import * as Timers from './Timers';
import * as indexedDb from './indexeddb';
import type { MenuOptionsType } from './types/menu';
import { SocketStatus } from './types/SocketStatus';
import { DEFAULT_CONVERSATION_COLOR } from './types/Colors';
import { ThemeType } from './types/Util';
import { ToastType } from './types/Toast';
import { ChallengeHandler } from './challenge';
import * as durations from './util/durations';
import { drop } from './util/drop';
import { explodePromise } from './util/explodePromise';
import type { ExplodePromiseResultType } from './util/explodePromise';
import { isWindowDragElement } from './util/isWindowDragElement';
import { assertDev, strictAssert } from './util/assert';
import { filter } from './util/iterables';
import { isNotNil } from './util/isNotNil';
import { areRemoteBackupsTurnedOn } from './util/isBackupEnabled';
import { setAppLoadingScreenMessage } from './setAppLoadingScreenMessage';
import { IdleDetector } from './IdleDetector';
} from './textsecure/TaskWithTimeout.js';
import type { MessageAttributesType } from './model-types.d.ts';
import * as Bytes from './Bytes.js';
import * as Timers from './Timers.js';
import * as indexedDb from './indexeddb.js';
import type { MenuOptionsType } from './types/menu.js';
import { SocketStatus } from './types/SocketStatus.js';
import { DEFAULT_CONVERSATION_COLOR } from './types/Colors.js';
import { ThemeType } from './types/Util.js';
import { ToastType } from './types/Toast.js';
import { ChallengeHandler } from './challenge.js';
import * as durations from './util/durations/index.js';
import { drop } from './util/drop.js';
import { explodePromise } from './util/explodePromise.js';
import type { ExplodePromiseResultType } from './util/explodePromise.js';
import { isWindowDragElement } from './util/isWindowDragElement.js';
import { assertDev, strictAssert } from './util/assert.js';
import { filter } from './util/iterables.js';
import { isNotNil } from './util/isNotNil.js';
import { areRemoteBackupsTurnedOn } from './util/isBackupEnabled.js';
import { setAppLoadingScreenMessage } from './setAppLoadingScreenMessage.js';
import { IdleDetector } from './IdleDetector.js';
import {
initialize as initializeExpiringMessageService,
update as updateExpiringMessagesService,
} from './services/expiringMessagesDeletion';
} from './services/expiringMessagesDeletion.js';
import {
initialize as initializeNotificationProfilesService,
update as updateNotificationProfileService,
} from './services/notificationProfilesService';
import { tapToViewMessagesDeletionService } from './services/tapToViewMessagesDeletionService';
import { senderCertificateService } from './services/senderCertificate';
import { GROUP_CREDENTIALS_KEY } from './services/groupCredentialFetcher';
import * as KeyboardLayout from './services/keyboardLayout';
import * as StorageService from './services/storage';
import { usernameIntegrity } from './services/usernameIntegrity';
import { updateIdentityKey } from './services/profiles';
import { RoutineProfileRefresher } from './routineProfileRefresh';
import { isOlderThan } from './util/timestamp';
import { isValidReactionEmoji } from './reactions/isValidReactionEmoji';
import type { ConversationModel } from './models/conversations';
import { getAuthor, isIncoming } from './messages/helpers';
import { migrateBatchOfMessages } from './messages/migrateMessageData';
import { createBatcher } from './util/batcher';
} from './services/notificationProfilesService.js';
import { tapToViewMessagesDeletionService } from './services/tapToViewMessagesDeletionService.js';
import { senderCertificateService } from './services/senderCertificate.js';
import { GROUP_CREDENTIALS_KEY } from './services/groupCredentialFetcher.js';
import * as KeyboardLayout from './services/keyboardLayout.js';
import * as StorageService from './services/storage.js';
import { usernameIntegrity } from './services/usernameIntegrity.js';
import { updateIdentityKey } from './services/profiles.js';
import { RoutineProfileRefresher } from './routineProfileRefresh.js';
import { isOlderThan } from './util/timestamp.js';
import { isValidReactionEmoji } from './reactions/isValidReactionEmoji.js';
import type { ConversationModel } from './models/conversations.js';
import { getAuthor, isIncoming } from './messages/helpers.js';
import { migrateBatchOfMessages } from './messages/migrateMessageData.js';
import { createBatcher } from './util/batcher.js';
import {
initializeAllJobQueues,
shutdownAllJobQueues,
} from './jobs/initializeAllJobQueues';
import { removeStorageKeyJobQueue } from './jobs/removeStorageKeyJobQueue';
import { ourProfileKeyService } from './services/ourProfileKey';
import { notificationService } from './services/notifications';
import { areWeASubscriberService } from './services/areWeASubscriber';
import { onContactSync, setIsInitialContactSync } from './services/contactSync';
import { startTimeTravelDetector } from './util/startTimeTravelDetector';
import { shouldRespondWithProfileKey } from './util/shouldRespondWithProfileKey';
import { LatestQueue } from './util/LatestQueue';
import { parseIntOrThrow } from './util/parseIntOrThrow';
import { getProfile } from './util/getProfile';
} from './jobs/initializeAllJobQueues.js';
import { removeStorageKeyJobQueue } from './jobs/removeStorageKeyJobQueue.js';
import { ourProfileKeyService } from './services/ourProfileKey.js';
import { notificationService } from './services/notifications.js';
import { areWeASubscriberService } from './services/areWeASubscriber.js';
import {
onContactSync,
setIsInitialContactSync,
} from './services/contactSync.js';
import { startTimeTravelDetector } from './util/startTimeTravelDetector.js';
import { shouldRespondWithProfileKey } from './util/shouldRespondWithProfileKey.js';
import { LatestQueue } from './util/LatestQueue.js';
import { parseIntOrThrow } from './util/parseIntOrThrow.js';
import { getProfile } from './util/getProfile.js';
import type {
AttachmentBackfillResponseSyncEvent,
ConfigurationEvent,
@ -101,118 +104,118 @@ import type {
ViewEvent,
ViewOnceOpenSyncEvent,
ViewSyncEvent,
} from './textsecure/messageReceiverEvents';
import type { WebAPIType } from './textsecure/WebAPI';
import * as KeyChangeListener from './textsecure/KeyChangeListener';
import { UpdateKeysListener } from './textsecure/UpdateKeysListener';
import { isDirectConversation } from './util/whatTypeOfConversation';
import { BackOff, FIBONACCI_TIMEOUTS } from './util/BackOff';
import { AppViewType } from './state/ducks/app';
import { areAnyCallsActiveOrRinging } from './state/selectors/calling';
import { badgeImageFileDownloader } from './badges/badgeImageFileDownloader';
import * as Deletes from './messageModifiers/Deletes';
import * as Edits from './messageModifiers/Edits';
import * as MessageReceipts from './messageModifiers/MessageReceipts';
import * as MessageRequests from './messageModifiers/MessageRequests';
import * as Reactions from './messageModifiers/Reactions';
import * as ViewOnceOpenSyncs from './messageModifiers/ViewOnceOpenSyncs';
import type { DeleteAttributesType } from './messageModifiers/Deletes';
import type { EditAttributesType } from './messageModifiers/Edits';
import type { MessageRequestAttributesType } from './messageModifiers/MessageRequests';
import type { ReactionAttributesType } from './messageModifiers/Reactions';
import type { ViewOnceOpenSyncAttributesType } from './messageModifiers/ViewOnceOpenSyncs';
import { ReadStatus } from './messages/MessageReadStatus';
import type { SendStateByConversationId } from './messages/MessageSendState';
import { SendStatus } from './messages/MessageSendState';
import * as Stickers from './types/Stickers';
import * as Errors from './types/errors';
import { InstallScreenStep } from './types/InstallScreen';
import { getEnvironment } from './environment';
import { SignalService as Proto } from './protobuf';
} from './textsecure/messageReceiverEvents.js';
import type { WebAPIType } from './textsecure/WebAPI.js';
import * as KeyChangeListener from './textsecure/KeyChangeListener.js';
import { UpdateKeysListener } from './textsecure/UpdateKeysListener.js';
import { isDirectConversation } from './util/whatTypeOfConversation.js';
import { BackOff, FIBONACCI_TIMEOUTS } from './util/BackOff.js';
import { AppViewType } from './state/ducks/app.js';
import { areAnyCallsActiveOrRinging } from './state/selectors/calling.js';
import { badgeImageFileDownloader } from './badges/badgeImageFileDownloader.js';
import * as Deletes from './messageModifiers/Deletes.js';
import * as Edits from './messageModifiers/Edits.js';
import * as MessageReceipts from './messageModifiers/MessageReceipts.js';
import * as MessageRequests from './messageModifiers/MessageRequests.js';
import * as Reactions from './messageModifiers/Reactions.js';
import * as ViewOnceOpenSyncs from './messageModifiers/ViewOnceOpenSyncs.js';
import type { DeleteAttributesType } from './messageModifiers/Deletes.js';
import type { EditAttributesType } from './messageModifiers/Edits.js';
import type { MessageRequestAttributesType } from './messageModifiers/MessageRequests.js';
import type { ReactionAttributesType } from './messageModifiers/Reactions.js';
import type { ViewOnceOpenSyncAttributesType } from './messageModifiers/ViewOnceOpenSyncs.js';
import { ReadStatus } from './messages/MessageReadStatus.js';
import type { SendStateByConversationId } from './messages/MessageSendState.js';
import { SendStatus } from './messages/MessageSendState.js';
import * as Stickers from './types/Stickers.js';
import * as Errors from './types/errors.js';
import { InstallScreenStep } from './types/InstallScreen.js';
import { getEnvironment } from './environment.js';
import { SignalService as Proto } from './protobuf/index.js';
import {
getOnDecryptionError,
onRetryRequest,
onInvalidPlaintextMessage,
onSuccessfulDecrypt,
} from './util/handleRetry';
import { themeChanged } from './shims/themeChanged';
import { createIPCEvents } from './util/createIPCEvents';
import type { ServiceIdString } from './types/ServiceId';
} from './util/handleRetry.js';
import { themeChanged } from './shims/themeChanged.js';
import { createIPCEvents } from './util/createIPCEvents.js';
import type { ServiceIdString } from './types/ServiceId.js';
import {
ServiceIdKind,
isPniString,
isServiceIdString,
} from './types/ServiceId';
import { isAciString } from './util/isAciString';
import { normalizeAci } from './util/normalizeAci';
import { createLogger } from './logging/log';
import { deleteAllLogs } from './util/deleteAllLogs';
import { startInteractionMode } from './services/InteractionMode';
import { ReactionSource } from './reactions/ReactionSource';
import { singleProtoJobQueue } from './jobs/singleProtoJobQueue';
import { conversationJobQueue } from './jobs/conversationJobQueue';
import { SeenStatus } from './MessageSeenStatus';
import MessageSender from './textsecure/SendMessage';
import type AccountManager from './textsecure/AccountManager';
import { onStoryRecipientUpdate } from './util/onStoryRecipientUpdate';
import { flushAttachmentDownloadQueue } from './util/attachmentDownloadQueue';
import { initializeRedux } from './state/initializeRedux';
import { StartupQueue } from './util/StartupQueue';
import { showConfirmationDialog } from './util/showConfirmationDialog';
import { onCallEventSync } from './util/onCallEventSync';
import { sleeper } from './util/sleeper';
import { DAY, HOUR, SECOND } from './util/durations';
import { copyDataMessageIntoMessage } from './util/copyDataMessageIntoMessage';
} from './types/ServiceId.js';
import { isAciString } from './util/isAciString.js';
import { normalizeAci } from './util/normalizeAci.js';
import { createLogger } from './logging/log.js';
import { deleteAllLogs } from './util/deleteAllLogs.js';
import { startInteractionMode } from './services/InteractionMode.js';
import { ReactionSource } from './reactions/ReactionSource.js';
import { singleProtoJobQueue } from './jobs/singleProtoJobQueue.js';
import { conversationJobQueue } from './jobs/conversationJobQueue.js';
import { SeenStatus } from './MessageSeenStatus.js';
import MessageSender from './textsecure/SendMessage.js';
import type AccountManager from './textsecure/AccountManager.js';
import { onStoryRecipientUpdate } from './util/onStoryRecipientUpdate.js';
import { flushAttachmentDownloadQueue } from './util/attachmentDownloadQueue.js';
import { initializeRedux } from './state/initializeRedux.js';
import { StartupQueue } from './util/StartupQueue.js';
import { showConfirmationDialog } from './util/showConfirmationDialog.js';
import { onCallEventSync } from './util/onCallEventSync.js';
import { sleeper } from './util/sleeper.js';
import { DAY, HOUR, SECOND } from './util/durations/index.js';
import { copyDataMessageIntoMessage } from './util/copyDataMessageIntoMessage.js';
import {
flushMessageCounter,
incrementMessageCounter,
initializeMessageCounter,
} from './util/incrementMessageCounter';
import { generateMessageId } from './util/generateMessageId';
import { RetryPlaceholders } from './util/retryPlaceholders';
import { setBatchingStrategy } from './util/messageBatcher';
import { parseRemoteClientExpiration } from './util/parseRemoteClientExpiration';
import { addGlobalKeyboardShortcuts } from './services/addGlobalKeyboardShortcuts';
import { createEventHandler } from './quill/signal-clipboard/util';
import { onCallLogEventSync } from './util/onCallLogEventSync';
import { backupsService } from './services/backups';
} from './util/incrementMessageCounter.js';
import { generateMessageId } from './util/generateMessageId.js';
import { RetryPlaceholders } from './util/retryPlaceholders.js';
import { setBatchingStrategy } from './util/messageBatcher.js';
import { parseRemoteClientExpiration } from './util/parseRemoteClientExpiration.js';
import { addGlobalKeyboardShortcuts } from './services/addGlobalKeyboardShortcuts.js';
import { createEventHandler } from './quill/signal-clipboard/util.js';
import { onCallLogEventSync } from './util/onCallLogEventSync.js';
import { backupsService } from './services/backups/index.js';
import {
getCallIdFromEra,
updateLocalGroupCallHistoryTimestamp,
} from './util/callDisposition';
import { deriveStorageServiceKey, deriveMasterKey } from './Crypto';
import { AttachmentDownloadManager } from './jobs/AttachmentDownloadManager';
import { onCallLinkUpdateSync } from './util/onCallLinkUpdateSync';
import { CallMode } from './types/CallDisposition';
import type { SyncTaskType } from './util/syncTasks';
import { queueSyncTasks, runAllSyncTasks } from './util/syncTasks';
import type { ViewSyncTaskType } from './messageModifiers/ViewSyncs';
import type { ReceiptSyncTaskType } from './messageModifiers/MessageReceipts';
import type { ReadSyncTaskType } from './messageModifiers/ReadSyncs';
import { AttachmentBackupManager } from './jobs/AttachmentBackupManager';
import { getConversationIdForLogging } from './util/idForLogging';
import { encryptConversationAttachments } from './util/encryptConversationAttachments';
import { DataReader, DataWriter } from './sql/Client';
import { restoreRemoteConfigFromStorage } from './RemoteConfig';
import { getParametersForRedux, loadAll } from './services/allLoaders';
import { checkFirstEnvelope } from './util/checkFirstEnvelope';
import { BLOCKED_UUIDS_ID } from './textsecure/storage/Blocked';
import { ReleaseNotesFetcher } from './services/releaseNotesFetcher';
import { BuildExpirationService } from './services/buildExpiration';
} from './util/callDisposition.js';
import { deriveStorageServiceKey, deriveMasterKey } from './Crypto.js';
import { AttachmentDownloadManager } from './jobs/AttachmentDownloadManager.js';
import { onCallLinkUpdateSync } from './util/onCallLinkUpdateSync.js';
import { CallMode } from './types/CallDisposition.js';
import type { SyncTaskType } from './util/syncTasks.js';
import { queueSyncTasks, runAllSyncTasks } from './util/syncTasks.js';
import type { ViewSyncTaskType } from './messageModifiers/ViewSyncs.js';
import type { ReceiptSyncTaskType } from './messageModifiers/MessageReceipts.js';
import type { ReadSyncTaskType } from './messageModifiers/ReadSyncs.js';
import { AttachmentBackupManager } from './jobs/AttachmentBackupManager.js';
import { getConversationIdForLogging } from './util/idForLogging.js';
import { encryptConversationAttachments } from './util/encryptConversationAttachments.js';
import { DataReader, DataWriter } from './sql/Client.js';
import { restoreRemoteConfigFromStorage } from './RemoteConfig.js';
import { getParametersForRedux, loadAll } from './services/allLoaders.js';
import { checkFirstEnvelope } from './util/checkFirstEnvelope.js';
import { BLOCKED_UUIDS_ID } from './textsecure/storage/Blocked.js';
import { ReleaseNotesFetcher } from './services/releaseNotesFetcher.js';
import { BuildExpirationService } from './services/buildExpiration.js';
import {
maybeQueueDeviceNameFetch,
onDeviceNameChangeSync,
} from './util/onDeviceNameChangeSync';
import { postSaveUpdates } from './util/cleanup';
import { handleDataMessage } from './messages/handleDataMessage';
import { MessageModel } from './models/messages';
import { waitForEvent } from './shims/events';
import { sendSyncRequests } from './textsecure/syncRequests';
import { handleServerAlerts } from './util/handleServerAlerts';
import { isLocalBackupsEnabled } from './util/isLocalBackupsEnabled';
import { NavTab, SettingsPage, ProfileEditorPage } from './types/Nav';
import { initialize as initializeDonationService } from './services/donations';
import { MessageRequestResponseSource } from './types/MessageRequestResponseEvent';
} from './util/onDeviceNameChangeSync.js';
import { postSaveUpdates } from './util/cleanup.js';
import { handleDataMessage } from './messages/handleDataMessage.js';
import { MessageModel } from './models/messages.js';
import { waitForEvent } from './shims/events.js';
import { sendSyncRequests } from './textsecure/syncRequests.js';
import { handleServerAlerts } from './util/handleServerAlerts.js';
import { isLocalBackupsEnabled } from './util/isLocalBackupsEnabled.js';
import { NavTab, SettingsPage, ProfileEditorPage } from './types/Nav.js';
import { initialize as initializeDonationService } from './services/donations.js';
import { MessageRequestResponseSource } from './types/MessageRequestResponseEvent.js';
const log = createLogger('background');

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { makeEnumParser } from '../util/enum';
import { makeEnumParser } from '../util/enum.js';
// The server may return "testing", which we should parse as "other".
export enum BadgeCategory {

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { makeEnumParser } from '../util/enum';
import { makeEnumParser } from '../util/enum.js';
export enum BadgeImageTheme {
Light = 'light',

View file

@ -2,11 +2,11 @@
// SPDX-License-Identifier: AGPL-3.0-only
import PQueue from 'p-queue';
import { DataWriter } from '../sql/Client';
import { createLogger } from '../logging/log';
import { MINUTE } from '../util/durations';
import { missingCaseError } from '../util/missingCaseError';
import { waitForOnline } from '../util/waitForOnline';
import { DataWriter } from '../sql/Client.js';
import { createLogger } from '../logging/log.js';
import { MINUTE } from '../util/durations/index.js';
import { missingCaseError } from '../util/missingCaseError.js';
import { waitForOnline } from '../util/waitForOnline.js';
const log = createLogger('badgeImageFileDownloader');

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { find, findLast, first, last } from 'lodash';
import type { BadgeType } from './types';
import { BadgeImageTheme } from './BadgeImageTheme';
import type { BadgeType } from './types.js';
import { BadgeImageTheme } from './BadgeImageTheme.js';
export function getBadgeImageFileLocalPath(
badge: Readonly<undefined | BadgeType>,

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { maybeParseUrl } from '../util/url';
import { maybeParseUrl } from '../util/url.js';
export function isBadgeImageFileUrlValid(
url: string,

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { BadgeType } from './types';
import type { BadgeType } from './types.js';
export const isBadgeVisible = (badge: Readonly<BadgeType>): boolean =>
'isVisible' in badge ? badge.isVisible : true;

View file

@ -3,13 +3,13 @@
import * as z from 'zod';
import { isEmpty } from 'lodash';
import { isRecord } from '../util/isRecord';
import { isNormalNumber } from '../util/isNormalNumber';
import { createLogger } from '../logging/log';
import type { BadgeType, BadgeImageType } from './types';
import { parseBadgeCategory } from './BadgeCategory';
import { BadgeImageTheme, parseBadgeImageTheme } from './BadgeImageTheme';
import { safeParseUnknown } from '../util/schemas';
import { isRecord } from '../util/isRecord.js';
import { isNormalNumber } from '../util/isNormalNumber.js';
import { createLogger } from '../logging/log.js';
import type { BadgeType, BadgeImageType } from './types.js';
import { parseBadgeCategory } from './BadgeCategory.js';
import { BadgeImageTheme, parseBadgeImageTheme } from './BadgeImageTheme.js';
import { safeParseUnknown } from '../util/schemas.js';
const log = createLogger('parseBadgesFromServer');

View file

@ -1,8 +1,8 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { BadgeCategory } from './BadgeCategory';
import type { BadgeImageTheme } from './BadgeImageTheme';
import type { BadgeCategory } from './BadgeCategory.js';
import type { BadgeImageTheme } from './BadgeImageTheme.js';
type SomeoneElsesBadgeType = Readonly<{
category: BadgeCategory;

View file

@ -9,7 +9,7 @@
import { videoPixelFormatToEnum } from '@signalapp/ringrtc';
import type { VideoFrameSender, VideoFrameSource } from '@signalapp/ringrtc';
import type { RefObject } from 'react';
import { createLogger } from '../logging/log';
import { createLogger } from '../logging/log.js';
const log = createLogger('VideoSupport');

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { useRef, useCallback } from 'react';
import { FRAME_BUFFER_SIZE } from './constants';
import { FRAME_BUFFER_SIZE } from './constants.js';
/**
* A hook that returns a function. This function returns a "singleton" `ArrayBuffer` to be

View file

@ -12,17 +12,20 @@
// are not immediately retried, however, until `.onOnline()` is called from
// when we are actually online.
import { assertDev } from './util/assert';
import { isOlderThan } from './util/timestamp';
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary';
import { missingCaseError } from './util/missingCaseError';
import type { StorageInterface } from './types/Storage.d';
import * as Errors from './types/errors';
import { HTTPError, type SendMessageChallengeData } from './textsecure/Errors';
import { createLogger } from './logging/log';
import { drop } from './util/drop';
import { findRetryAfterTimeFromError } from './jobs/helpers/findRetryAfterTimeFromError';
import { MINUTE } from './util/durations';
import { assertDev } from './util/assert.js';
import { isOlderThan } from './util/timestamp.js';
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary.js';
import { missingCaseError } from './util/missingCaseError.js';
import type { StorageInterface } from './types/Storage.d.ts';
import * as Errors from './types/errors.js';
import {
HTTPError,
type SendMessageChallengeData,
} from './textsecure/Errors.js';
import { createLogger } from './logging/log.js';
import { drop } from './util/drop.js';
import { findRetryAfterTimeFromError } from './jobs/helpers/findRetryAfterTimeFromError.js';
import { MINUTE } from './util/durations/index.js';
const log = createLogger('challenge');

View file

@ -3,9 +3,9 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { ComponentMeta } from '../storybook/types';
import type { AboutProps } from './About';
import { About } from './About';
import type { ComponentMeta } from '../storybook/types.js';
import type { AboutProps } from './About.js';
import { About } from './About.js';
const { i18n } = window.SignalContext;

View file

@ -3,8 +3,8 @@
import React from 'react';
import type { LocalizerType } from '../types/Util';
import { useEscapeHandling } from '../hooks/useEscapeHandling';
import type { LocalizerType } from '../types/Util.js';
import { useEscapeHandling } from '../hooks/useEscapeHandling.js';
export type AboutProps = Readonly<{
closeAbout: () => unknown;

View file

@ -6,11 +6,11 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './AddGroupMemberErrorDialog';
import type { PropsType } from './AddGroupMemberErrorDialog.js';
import {
AddGroupMemberErrorDialog,
AddGroupMemberErrorDialogMode,
} from './AddGroupMemberErrorDialog';
} from './AddGroupMemberErrorDialog.js';
const { i18n } = window.SignalContext;

View file

@ -4,9 +4,9 @@
import type { ReactNode } from 'react';
import React from 'react';
import type { LocalizerType } from '../types/Util';
import { Alert } from './Alert';
import { missingCaseError } from '../util/missingCaseError';
import type { LocalizerType } from '../types/Util.js';
import { Alert } from './Alert.js';
import { missingCaseError } from '../util/missingCaseError.js';
export enum AddGroupMemberErrorDialogMode {
MaximumGroupSize,

View file

@ -5,12 +5,12 @@ import React from 'react';
import type { Meta, StoryFn } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import type { Props } from './AddUserToAnotherGroupModal';
import type { Props } from './AddUserToAnotherGroupModal.js';
import {
getDefaultConversation,
getDefaultGroup,
} from '../test-helpers/getDefaultConversation';
import { AddUserToAnotherGroupModal } from './AddUserToAnotherGroupModal';
} from '../test-helpers/getDefaultConversation.js';
import { AddUserToAnotherGroupModal } from './AddUserToAnotherGroupModal.js';
const { i18n } = window.SignalContext;

View file

@ -5,23 +5,23 @@ import { pick } from 'lodash';
import React, { useCallback } from 'react';
import type { ListRowProps } from 'react-virtualized';
import type { ConversationType } from '../state/ducks/conversations';
import type { LocalizerType } from '../types/Util';
import { ToastType } from '../types/Toast';
import { filterAndSortConversations } from '../util/filterAndSortConversations';
import { ConfirmationDialog } from './ConfirmationDialog';
import type { GroupListItemConversationType } from './conversationList/GroupListItem';
import type { ConversationType } from '../state/ducks/conversations.js';
import type { LocalizerType } from '../types/Util.js';
import { ToastType } from '../types/Toast.js';
import { filterAndSortConversations } from '../util/filterAndSortConversations.js';
import { ConfirmationDialog } from './ConfirmationDialog.js';
import type { GroupListItemConversationType } from './conversationList/GroupListItem.js';
import {
DisabledReason,
GroupListItem,
} from './conversationList/GroupListItem';
import { Modal } from './Modal';
import { SearchInput } from './SearchInput';
import { useRestoreFocus } from '../hooks/useRestoreFocus';
import { ListView } from './ListView';
import { ListTile } from './ListTile';
import type { ShowToastAction } from '../state/ducks/toast';
import { SizeObserver } from '../hooks/useSizeObserver';
} from './conversationList/GroupListItem.js';
import { Modal } from './Modal.js';
import { SearchInput } from './SearchInput.js';
import { useRestoreFocus } from '../hooks/useRestoreFocus.js';
import { ListView } from './ListView.js';
import { ListTile } from './ListTile.js';
import type { ShowToastAction } from '../state/ducks/toast.js';
import { SizeObserver } from '../hooks/useSizeObserver.js';
type OwnProps = {
i18n: LocalizerType;

View file

@ -4,8 +4,8 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './Alert';
import { Alert } from './Alert';
import type { PropsType } from './Alert.js';
import { Alert } from './Alert.js';
const { i18n } = window.SignalContext;

View file

@ -4,10 +4,10 @@
import type { ReactNode } from 'react';
import React from 'react';
import type { LocalizerType } from '../types/Util';
import type { Theme } from '../util/theme';
import { Button } from './Button';
import { Modal } from './Modal';
import type { LocalizerType } from '../types/Util.js';
import type { Theme } from '../util/theme.js';
import { Button } from './Button.js';
import { Modal } from './Modal.js';
export type PropsType = {
body: ReactNode;

View file

@ -5,8 +5,8 @@ import React from 'react';
import { action } from '@storybook/addon-actions';
import type { Meta } from '@storybook/react';
import type { PropsType } from './AnimatedEmojiGalore';
import { AnimatedEmojiGalore } from './AnimatedEmojiGalore';
import type { PropsType } from './AnimatedEmojiGalore.js';
import { AnimatedEmojiGalore } from './AnimatedEmojiGalore.js';
export default {
title: 'Components/AnimatedEmojiGalore',

Some files were not shown because too many files have changed in this diff Show more