Qualify CJS-only module imports

This commit is contained in:
Fedor Indutny
2025-09-19 13:05:51 -07:00
committed by GitHub
parent 140241b83f
commit 40eaf078cc
401 changed files with 1278 additions and 593 deletions

View File

@@ -2,10 +2,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { noop } from 'lodash';
import lodash from 'lodash';
import { cleanDataForIpc } from '../../sql/cleanDataForIpc.js';
const { noop } = lodash;
describe('cleanDataForIpc', () => {
it('does nothing to JSON primitives', () => {
['', 'foo bar', 0, 123, true, false, null].forEach(value => {

View File

@@ -1,7 +1,7 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { noop } from 'lodash';
import lodash from 'lodash';
import SQL from '@signalapp/sqlcipher';
import type { ReadableDB, WritableDB } from '../../sql/Interface.js';
@@ -9,6 +9,8 @@ import type { QueryTemplate } from '../../sql/util.js';
import { SCHEMA_VERSIONS } from '../../sql/migrations/index.js';
import { consoleLogger } from '../../util/consoleLogger.js';
const { noop } = lodash;
export function createDB(): WritableDB {
const db = new SQL(':memory:') as WritableDB;
db.initTokenizer();

View File

@@ -1,6 +1,6 @@
// Copyright 2024 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { omit } from 'lodash';
import lodash from 'lodash';
import { assert } from 'chai';
import type { ReadableDB, WritableDB } from '../../sql/Interface.js';
@@ -13,6 +13,8 @@ import type {
import type { AttachmentType } from '../../types/Attachment.js';
import { IMAGE_JPEG } from '../../types/MIME.js';
const { omit } = lodash;
function getAttachmentDownloadJobs(
db: ReadableDB
): Array<Record<string, unknown>> {

View File

@@ -2,7 +2,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { findLast } from 'lodash';
import lodash from 'lodash';
import type { WritableDB } from '../../sql/Interface.js';
import { markAllCallHistoryRead } from '../../sql/Server.js';
import { SeenStatus } from '../../MessageSeenStatus.js';
@@ -15,6 +15,8 @@ import {
import { strictAssert } from '../../util/assert.js';
import { createDB, insertData, updateToVersion } from './helpers.js';
const { findLast } = lodash;
describe('SQL/updateToSchemaVersion1100', () => {
let db: WritableDB;
beforeEach(() => {

View File

@@ -2,13 +2,15 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { omit } from 'lodash';
import lodash from 'lodash';
import type { WritableDB } from '../../sql/Interface.js';
import { createDB, updateToVersion, explain } from './helpers.js';
import { jsonToObject, objectToJSON, sql } from '../../sql/util.js';
import { IMAGE_BMP } from '../../types/MIME.js';
import type { _AttachmentDownloadJobTypeV1040 } from '../../sql/migrations/1040-undownloaded-backed-up-media.js';
const { omit } = lodash;
function insertOldJob(
db: WritableDB,
job: Omit<_AttachmentDownloadJobTypeV1040, 'source' | 'ciphertextSize'>,

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { v4 as generateGuid } from 'uuid';
import { range } from 'lodash';
import lodash from 'lodash';
import { createDB, insertData, updateToVersion } from './helpers.js';
import type {
@@ -20,6 +20,8 @@ import type {
SignedPreKeyType,
} from '../../sql/Interface.js';
const { range } = lodash;
type TestingKyberKey = Omit<
KyberPreKeyType,
'data' | 'isLastResort' | 'isConfirmed' | 'createdAt' | 'ourServiceId'

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { v4 as generateGuid } from 'uuid';
import { range } from 'lodash';
import lodash from 'lodash';
import {
createDB,
@@ -16,6 +16,8 @@ import { normalizePni } from '../../types/ServiceId.js';
import { normalizeAci } from '../../util/normalizeAci.js';
import type { WritableDB, PreKeyType } from '../../sql/Interface.js';
const { range } = lodash;
type TestingPreKey = Omit<
PreKeyType,
'privateKey' | 'publicKey' | 'createdAt'

View File

@@ -3,7 +3,7 @@
import { assert } from 'chai';
import { v4 as generateGuid } from 'uuid';
import { range } from 'lodash';
import lodash from 'lodash';
import { createDB, insertData, updateToVersion } from './helpers.js';
import type { ServiceIdString } from '../../types/ServiceId.js';
@@ -15,6 +15,8 @@ import type {
SignedPreKeyType,
} from '../../sql/Interface.js';
const { range } = lodash;
type TestingKyberKey = Omit<
KyberPreKeyType,
'data' | 'isLastResort' | 'isConfirmed' | 'createdAt'