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/** js/calling-tools/**
# TypeScript generated files # TypeScript generated files
build/**/*.js
app/**/*.js app/**/*.js
ts/**/*.js ts/**/*.js

View file

@ -100,6 +100,14 @@ const rules = {
// We prefer named exports // We prefer named exports
'import/prefer-default-export': 'off', 'import/prefer-default-export': 'off',
'import/enforce-node-protocol-usage': ['error', 'always'],
'import/extensions': [
'error',
'ignorePackages',
{
checkTypeImports: true,
},
],
// Prefer functional components with default params // Prefer functional components with default params
'react/require-default-props': 'off', '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 build/ICUMessageParams.d.ts
# React / TypeScript # React / TypeScript
build/**/*.js
app/*.js app/*.js
ts/**/*.js ts/**/*.js
ts/protobuf/*.d.ts ts/protobuf/*.d.ts

View file

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

View file

@ -51,7 +51,9 @@ const config: StorybookConfig = {
type: 'filesystem', type: 'filesystem',
}; };
config.resolve!.extensions = ['.tsx', '.ts', '...']; config.resolve!.extensionAlias = {
'.js': ['.tsx', '.ts', '.js'],
};
config.module!.rules!.unshift({ config.module!.rules!.unshift({
test: /\.scss$/, test: /\.scss$/,
@ -88,33 +90,12 @@ const config: StorybookConfig = {
config.node = { global: true }; config.node = { global: true };
config.externals = { config.externals = ({ request }, callback) => {
net: 'commonjs net', if (/^node:/.test(request) && request !== 'node:buffer') {
vm: 'commonjs vm', // Keep Node.js imports unchanged
fs: 'commonjs fs', return callback(null, 'commonjs ' + request);
async_hooks: 'commonjs async_hooks', }
module: 'commonjs module', callback();
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.plugins!.push( config.plugins!.push(

View file

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

View file

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

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import type { PowerSaveBlocker } from 'electron'; import type { PowerSaveBlocker } from 'electron';
import { createLogger } from '../ts/logging/log'; import { createLogger } from '../ts/logging/log.js';
const log = createLogger('PreventDisplaySleepService'); 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 os from 'node:os';
import { join } from 'node:path'; import { join } from 'node:path';
import { readFileSync } from 'node:fs'; import { readFileSync } from 'node:fs';
import { createLogger } from '../ts/logging/log'; import { createLogger } from '../ts/logging/log.js';
import type { LocalizerType } from '../ts/types/I18N'; import type { LocalizerType } from '../ts/types/I18N.js';
const log = createLogger('SystemTrayService'); const log = createLogger('SystemTrayService');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,8 +4,8 @@
import { app } from 'electron'; import { app } from 'electron';
import packageJson from '../package.json'; import packageJson from '../package.json';
import { createLogger } from '../ts/logging/log'; import { createLogger } from '../ts/logging/log.js';
import * as GlobalErrors from './global_errors'; import * as GlobalErrors from './global_errors.js';
const log = createLogger('startup_config'); 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 { desktopCapturer, ipcMain, systemPreferences } from 'electron';
import { v4 as generateUuid } from 'uuid'; import { v4 as generateUuid } from 'uuid';
import OS from '../ts/util/os/osMain'; import OS from '../ts/util/os/osMain.js';
import type { LoggerType } from '../ts/types/Logging'; import type { LoggerType } from '../ts/types/Logging.js';
import { strictAssert } from '../ts/util/assert'; import { strictAssert } from '../ts/util/assert.js';
import { type IpcResponseType } from '../ts/util/desktopCapturer'; import { type IpcResponseType } from '../ts/util/desktopCapturer.js';
const SPELL_CHECKER_DICTIONARY_DOWNLOAD_URL = `https://updates.signal.org/desktop/hunspell_dictionaries/${process.versions.electron}/`; 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 // Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { join } from 'path'; import { join } from 'node:path';
import { mkdirSync } from 'fs'; import { mkdirSync } from 'node:fs';
import { app } from 'electron'; import { app } from 'electron';
import { start } from './base_config'; import { start } from './base_config.js';
import config from './config'; import config from './config.js';
import * as Errors from '../ts/types/errors'; import * as Errors from '../ts/types/errors.js';
let userData: string | undefined; let userData: string | undefined;
// Use separate data directory for benchmarks & development // Use separate data directory for benchmarks & development

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -313,12 +313,12 @@
"endanger": "7.0.4", "endanger": "7.0.4",
"enhanced-resolve": "5.18.3", "enhanced-resolve": "5.18.3",
"enquirer": "2.4.1", "enquirer": "2.4.1",
"esbuild": "0.24.0", "esbuild": "0.25.9",
"eslint": "8.56.0", "eslint": "8.56.0",
"eslint-config-airbnb-typescript-prettier": "5.0.0", "eslint-config-airbnb-typescript-prettier": "5.0.0",
"eslint-config-prettier": "8.5.0", "eslint-config-prettier": "8.5.0",
"eslint-plugin-better-tailwindcss": "3.7.2", "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-local-rules": "1.3.2",
"eslint-plugin-mocha": "10.1.0", "eslint-plugin-mocha": "10.1.0",
"eslint-plugin-more": "1.0.5", "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 // SPDX-License-Identifier: AGPL-3.0-only
const esbuild = require('esbuild'); const esbuild = require('esbuild');
const path = require('path'); const path = require('node:path');
const fs = require('node:fs');
const fastGlob = require('fast-glob'); const fastGlob = require('fast-glob');
const ROOT_DIR = path.join(__dirname, '..'); const ROOT_DIR = path.join(__dirname, '..');
const BUNDLES_DIR = 'bundles'; 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 watch = process.argv.some(argv => argv === '-w' || argv === '--watch');
const isProd = process.argv.some(argv => argv === '-prod' || argv === '--prod'); const isProd = process.argv.some(argv => argv === '-prod' || argv === '--prod');
@ -22,6 +24,33 @@ const nodeDefaults = {
// See: https://github.com/evanw/esbuild/issues/1147 // See: https://github.com/evanw/esbuild/issues/1147
keepNames: true, keepNames: true,
logLevel: 'info', 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 = { const bundleDefaults = {
@ -61,8 +90,11 @@ const bundleDefaults = {
'moment', 'moment',
'quill', 'quill',
// Imported, but not used in production builds
'mocha',
// Uses fast-glob and dynamic requires // Uses fast-glob and dynamic requires
'./preload_test', './preload_test.js',
], ],
}; };
@ -119,7 +151,7 @@ async function main() {
entryPoints: [ entryPoints: [
'preload.wrapper.ts', 'preload.wrapper.ts',
...fastGlob ...fastGlob
.sync('{app,ts}/**/*.{ts,tsx}', { .sync('{app,ts,build}/**/*.{ts,tsx}', {
onlyFiles: true, onlyFiles: true,
cwd: ROOT_DIR, cwd: ROOT_DIR,
}) })

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // 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(); const bytes = globalThis.window?.SignalContext?.bytes || new Bytes();

View file

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

View file

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

View file

@ -5,50 +5,54 @@ import { debounce, pick, uniq, without } from 'lodash';
import PQueue from 'p-queue'; import PQueue from 'p-queue';
import { v4 as generateUuid } from 'uuid'; import { v4 as generateUuid } from 'uuid';
import { DataReader, DataWriter } from './sql/Client'; import { DataReader, DataWriter } from './sql/Client.js';
import { createLogger } from './logging/log'; import { createLogger } from './logging/log.js';
import * as Errors from './types/errors'; import * as Errors from './types/errors.js';
import { getAuthorId } from './messages/helpers'; import { getAuthorId } from './messages/helpers.js';
import { maybeDeriveGroupV2Id } from './groups'; import { maybeDeriveGroupV2Id } from './groups.js';
import { assertDev, strictAssert } from './util/assert'; import { assertDev, strictAssert } from './util/assert.js';
import { drop } from './util/drop'; import { drop } from './util/drop.js';
import { import {
isDirectConversation, isDirectConversation,
isGroup, isGroup,
isGroupV1, isGroupV1,
isGroupV2, isGroupV2,
} from './util/whatTypeOfConversation'; } from './util/whatTypeOfConversation.js';
import { import {
isServiceIdString, isServiceIdString,
normalizePni, normalizePni,
normalizeServiceId, normalizeServiceId,
} from './types/ServiceId'; } from './types/ServiceId.js';
import { normalizeAci } from './util/normalizeAci'; import { normalizeAci } from './util/normalizeAci.js';
import { sleep } from './util/sleep'; import { sleep } from './util/sleep.js';
import { isNotNil } from './util/isNotNil'; import { isNotNil } from './util/isNotNil.js';
import { MINUTE, SECOND } from './util/durations'; import { MINUTE, SECOND } from './util/durations/index.js';
import { getServiceIdsForE164s } from './util/getServiceIdsForE164s'; import { getServiceIdsForE164s } from './util/getServiceIdsForE164s.js';
import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation'; import { SIGNAL_ACI, SIGNAL_AVATAR_PATH } from './types/SignalConversation.js';
import { getTitleNoDefault } from './util/getTitle'; import { getTitleNoDefault } from './util/getTitle.js';
import * as StorageService from './services/storage'; import * as StorageService from './services/storage.js';
import type { ConversationPropsForUnreadStats } from './util/countUnreadStats'; import type { ConversationPropsForUnreadStats } from './util/countUnreadStats.js';
import { countAllConversationsUnreadStats } from './util/countUnreadStats'; import { countAllConversationsUnreadStats } from './util/countUnreadStats.js';
import { isTestOrMockEnvironment } from './environment'; import { isTestOrMockEnvironment } from './environment.js';
import { isConversationAccepted } from './util/isConversationAccepted'; import { isConversationAccepted } from './util/isConversationAccepted.js';
import { areWePending } from './util/groupMembershipUtils'; import { areWePending } from './util/groupMembershipUtils.js';
import { conversationJobQueue } from './jobs/conversationJobQueue'; import { conversationJobQueue } from './jobs/conversationJobQueue.js';
import { createBatcher } from './util/batcher'; import { createBatcher } from './util/batcher.js';
import { validateConversation } from './util/validateConversation'; import { validateConversation } from './util/validateConversation.js';
import { ConversationModel } from './models/conversations'; import { ConversationModel } from './models/conversations.js';
import { INITIAL_EXPIRE_TIMER_VERSION } from './util/expirationTimer'; import { INITIAL_EXPIRE_TIMER_VERSION } from './util/expirationTimer.js';
import { missingCaseError } from './util/missingCaseError'; import { missingCaseError } from './util/missingCaseError.js';
import type { import type {
ConversationAttributesType, ConversationAttributesType,
ConversationAttributesTypeType, ConversationAttributesTypeType,
ConversationRenderInfoType, ConversationRenderInfoType,
} from './model-types.d'; } from './model-types.d.ts';
import type { ServiceIdString, AciString, PniString } from './types/ServiceId'; import type {
ServiceIdString,
AciString,
PniString,
} from './types/ServiceId.js';
const log = createLogger('ConversationController'); 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 type { PublicKey, PrivateKey } from '@signalapp/libsignal-client';
import { AccountEntropyPool } from '@signalapp/libsignal-client/dist/AccountKeys'; import { AccountEntropyPool } from '@signalapp/libsignal-client/dist/AccountKeys';
import * as Bytes from './Bytes'; import * as Bytes from './Bytes.js';
import { Crypto } from './context/Crypto'; import { Crypto } from './context/Crypto.js';
import { calculateAgreement, generateKeyPair } from './Curve'; import { calculateAgreement, generateKeyPair } from './Curve.js';
import { HashType, CipherType } from './types/Crypto'; import { HashType, CipherType } from './types/Crypto.js';
import { AVATAR_COLOR_COUNT, AvatarColors } from './types/Colors'; import { AVATAR_COLOR_COUNT, AvatarColors } from './types/Colors.js';
import { ProfileDecryptError } from './types/errors'; import { ProfileDecryptError } from './types/errors.js';
import { getBytesSubarray } from './util/uuidToBytes'; import { getBytesSubarray } from './util/uuidToBytes.js';
import { logPadSize } from './util/logPadding'; import { logPadSize } from './util/logPadding.js';
import { Environment, getEnvironment } from './environment'; import { Environment, getEnvironment } from './environment.js';
import { toWebSafeBase64 } from './util/webSafeBase64'; import { toWebSafeBase64 } from './util/webSafeBase64.js';
import type { AciString, PniString } from './types/ServiceId'; import type { AciString, PniString } from './types/ServiceId.js';
export { HashType, CipherType }; export { HashType, CipherType };

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // 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". // The server may return "testing", which we should parse as "other".
export enum BadgeCategory { export enum BadgeCategory {

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC // Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // 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 => export const isBadgeVisible = (badge: Readonly<BadgeType>): boolean =>
'isVisible' in badge ? badge.isVisible : true; 'isVisible' in badge ? badge.isVisible : true;

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import { useRef, useCallback } from 'react'; 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 * 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 // are not immediately retried, however, until `.onOnline()` is called from
// when we are actually online. // when we are actually online.
import { assertDev } from './util/assert'; import { assertDev } from './util/assert.js';
import { isOlderThan } from './util/timestamp'; import { isOlderThan } from './util/timestamp.js';
import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary'; import { clearTimeoutIfNecessary } from './util/clearTimeoutIfNecessary.js';
import { missingCaseError } from './util/missingCaseError'; import { missingCaseError } from './util/missingCaseError.js';
import type { StorageInterface } from './types/Storage.d'; import type { StorageInterface } from './types/Storage.d.ts';
import * as Errors from './types/errors'; import * as Errors from './types/errors.js';
import { HTTPError, type SendMessageChallengeData } from './textsecure/Errors'; import {
import { createLogger } from './logging/log'; HTTPError,
import { drop } from './util/drop'; type SendMessageChallengeData,
import { findRetryAfterTimeFromError } from './jobs/helpers/findRetryAfterTimeFromError'; } from './textsecure/Errors.js';
import { MINUTE } from './util/durations'; 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'); const log = createLogger('challenge');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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