mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-28 04:13:18 +01:00
Prepare for adding file suffixes
This commit is contained in:
@@ -9,28 +9,33 @@ import type { ReadonlyDeep } from 'type-fest';
|
||||
// Note: nothing imported here can come back and require Client.ts, and that includes
|
||||
// their imports too. That circularity causes problems. Anything that would do that needs
|
||||
// to be passed in, like cleanupMessages below.
|
||||
import * as Bytes from '../Bytes.js';
|
||||
import { createLogger } from '../logging/log.js';
|
||||
import * as Errors from '../types/errors.js';
|
||||
import * as Bytes from '../Bytes.std.js';
|
||||
import { createLogger } from '../logging/log.std.js';
|
||||
import * as Errors from '../types/errors.std.js';
|
||||
|
||||
import { deleteExternalFiles } from '../types/Conversation.js';
|
||||
import { createBatcher } from '../util/batcher.js';
|
||||
import { assertDev, softAssert } from '../util/assert.js';
|
||||
import { mapObjectWithSpec } from '../util/mapObjectWithSpec.js';
|
||||
import { deleteAttachmentData } from '../util/migrations.js';
|
||||
import { cleanDataForIpc } from './cleanDataForIpc.js';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.js';
|
||||
import { isValidUuid, isValidUuidV7 } from '../util/isValidUuid.js';
|
||||
import { formatJobForInsert } from '../jobs/formatJobForInsert.js';
|
||||
import { AccessType, ipcInvoke, doShutdown, removeDB } from './channels.js';
|
||||
import { getMessageIdForLogging } from '../util/idForLogging.js';
|
||||
import { incrementMessageCounter } from '../util/incrementMessageCounter.js';
|
||||
import { generateSnippetAroundMention } from '../util/search.js';
|
||||
import { drop } from '../util/drop.js';
|
||||
import { deleteExternalFiles } from '../types/Conversation.node.js';
|
||||
import { createBatcher } from '../util/batcher.std.js';
|
||||
import { assertDev, softAssert } from '../util/assert.std.js';
|
||||
import { mapObjectWithSpec } from '../util/mapObjectWithSpec.std.js';
|
||||
import { deleteAttachmentData } from '../util/migrations.preload.js';
|
||||
import { cleanDataForIpc } from './cleanDataForIpc.std.js';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.std.js';
|
||||
import { isValidUuid, isValidUuidV7 } from '../util/isValidUuid.std.js';
|
||||
import { formatJobForInsert } from '../jobs/formatJobForInsert.std.js';
|
||||
import {
|
||||
AccessType,
|
||||
ipcInvoke,
|
||||
doShutdown,
|
||||
removeDB,
|
||||
} from './channels.preload.js';
|
||||
import { getMessageIdForLogging } from '../util/idForLogging.preload.js';
|
||||
import { incrementMessageCounter } from '../util/incrementMessageCounter.preload.js';
|
||||
import { generateSnippetAroundMention } from '../util/search.std.js';
|
||||
import { drop } from '../util/drop.std.js';
|
||||
|
||||
import type { ObjectMappingSpecType } from '../util/mapObjectWithSpec.js';
|
||||
import type { AciString, ServiceIdString } from '../types/ServiceId.js';
|
||||
import type { StoredJob } from '../jobs/types.js';
|
||||
import type { ObjectMappingSpecType } from '../util/mapObjectWithSpec.std.js';
|
||||
import type { AciString, ServiceIdString } from '../types/ServiceId.std.js';
|
||||
import type { StoredJob } from '../jobs/types.std.js';
|
||||
import type {
|
||||
ClientInterfaceWrap,
|
||||
AdjacentMessagesByConversationOptionsType,
|
||||
@@ -61,14 +66,14 @@ import type {
|
||||
StoredKyberPreKeyType,
|
||||
ClientOnlyReadableInterface,
|
||||
ClientOnlyWritableInterface,
|
||||
} from './Interface.js';
|
||||
import { AttachmentDownloadSource } from './Interface.js';
|
||||
import type { MessageAttributesType } from '../model-types.js';
|
||||
import type { AttachmentDownloadJobType } from '../types/AttachmentDownload.js';
|
||||
} from './Interface.std.js';
|
||||
import { AttachmentDownloadSource } from './Interface.std.js';
|
||||
import type { MessageAttributesType } from '../model-types.d.ts';
|
||||
import type { AttachmentDownloadJobType } from '../types/AttachmentDownload.std.js';
|
||||
import {
|
||||
throttledUpdateBackupMediaDownloadProgress,
|
||||
updateBackupMediaDownloadProgress,
|
||||
} from '../util/updateBackupMediaDownloadProgress.js';
|
||||
} from '../util/updateBackupMediaDownloadProgress.preload.js';
|
||||
|
||||
const { groupBy, isTypedArray, last, map, omit } = lodash;
|
||||
|
||||
|
||||
@@ -4,63 +4,66 @@
|
||||
import type { Database, RowType } from '@signalapp/sqlcipher';
|
||||
import type { ReadonlyDeep } from 'type-fest';
|
||||
|
||||
import { strictAssert } from '../util/assert.js';
|
||||
import { strictAssert } from '../util/assert.std.js';
|
||||
|
||||
import type {
|
||||
ConversationAttributesType,
|
||||
MessageAttributesType,
|
||||
SenderKeyInfoType,
|
||||
} from '../model-types.d.ts';
|
||||
import type { StoredJob } from '../jobs/types.js';
|
||||
import type { ReactionType, ReactionReadStatus } from '../types/Reactions.js';
|
||||
import type { StoredJob } from '../jobs/types.std.js';
|
||||
import type {
|
||||
ReactionType,
|
||||
ReactionReadStatus,
|
||||
} from '../types/Reactions.std.js';
|
||||
import type {
|
||||
ConversationColorType,
|
||||
CustomColorType,
|
||||
} from '../types/Colors.js';
|
||||
} from '../types/Colors.std.js';
|
||||
import type { StorageAccessType } from '../types/Storage.d.ts';
|
||||
import type { BytesToStrings } from '../types/Util.js';
|
||||
import type { QualifiedAddressStringType } from '../types/QualifiedAddress.js';
|
||||
import type { StoryDistributionIdString } from '../types/StoryDistributionId.js';
|
||||
import type { BytesToStrings } from '../types/Util.std.js';
|
||||
import type { QualifiedAddressStringType } from '../types/QualifiedAddress.std.js';
|
||||
import type { StoryDistributionIdString } from '../types/StoryDistributionId.std.js';
|
||||
import type {
|
||||
AciString,
|
||||
PniString,
|
||||
ServiceIdString,
|
||||
} from '../types/ServiceId.js';
|
||||
import type { BadgeType } from '../badges/types.js';
|
||||
import type { ReadStatus } from '../messages/MessageReadStatus.js';
|
||||
import type { RawBodyRange } from '../types/BodyRange.js';
|
||||
import type { MessageTimestamps } from '../state/ducks/conversations.js';
|
||||
} from '../types/ServiceId.std.js';
|
||||
import type { BadgeType } from '../badges/types.std.js';
|
||||
import type { ReadStatus } from '../messages/MessageReadStatus.std.js';
|
||||
import type { RawBodyRange } from '../types/BodyRange.std.js';
|
||||
import type { MessageTimestamps } from '../state/ducks/conversations.preload.js';
|
||||
import type {
|
||||
CallHistoryDetails,
|
||||
CallHistoryFilter,
|
||||
CallHistoryGroup,
|
||||
CallHistoryPagination,
|
||||
CallLogEventTarget,
|
||||
} from '../types/CallDisposition.js';
|
||||
} from '../types/CallDisposition.std.js';
|
||||
import type {
|
||||
CallLinkRecord,
|
||||
CallLinkStateType,
|
||||
CallLinkType,
|
||||
DefunctCallLinkType,
|
||||
} from '../types/CallLink.js';
|
||||
} from '../types/CallLink.std.js';
|
||||
import type {
|
||||
AttachmentDownloadJobType,
|
||||
MessageAttachmentType,
|
||||
} from '../types/AttachmentDownload.js';
|
||||
} from '../types/AttachmentDownload.std.js';
|
||||
import type {
|
||||
GroupSendEndorsementsData,
|
||||
GroupSendMemberEndorsementRecord,
|
||||
} from '../types/GroupSendEndorsements.js';
|
||||
import type { SyncTaskType } from '../util/syncTasks.js';
|
||||
import type { AttachmentBackupJobType } from '../types/AttachmentBackup.js';
|
||||
import type { AttachmentType } from '../types/Attachment.js';
|
||||
import type { MediaItemMessageType } from '../types/MediaItem.js';
|
||||
import type { GifType } from '../components/fun/panels/FunPanelGifs.js';
|
||||
import type { NotificationProfileType } from '../types/NotificationProfile.js';
|
||||
import type { DonationReceipt } from '../types/Donations.js';
|
||||
import type { InsertOrUpdateCallLinkFromSyncResult } from './server/callLinks.js';
|
||||
import type { ChatFolderId, ChatFolder } from '../types/ChatFolder.js';
|
||||
import type { CurrentChatFolder } from '../types/CurrentChatFolders.js';
|
||||
} from '../types/GroupSendEndorsements.std.js';
|
||||
import type { SyncTaskType } from '../util/syncTasks.preload.js';
|
||||
import type { AttachmentBackupJobType } from '../types/AttachmentBackup.std.js';
|
||||
import type { AttachmentType } from '../types/Attachment.std.js';
|
||||
import type { MediaItemMessageType } from '../types/MediaItem.std.js';
|
||||
import type { GifType } from '../components/fun/panels/FunPanelGifs.dom.js';
|
||||
import type { NotificationProfileType } from '../types/NotificationProfile.std.js';
|
||||
import type { DonationReceipt } from '../types/Donations.std.js';
|
||||
import type { InsertOrUpdateCallLinkFromSyncResult } from './server/callLinks.node.js';
|
||||
import type { ChatFolderId, ChatFolder } from '../types/ChatFolder.std.js';
|
||||
import type { CurrentChatFolder } from '../types/CurrentChatFolders.std.js';
|
||||
|
||||
export type ReadableDB = Database & { __readable_db: never };
|
||||
export type WritableDB = ReadableDB & { __writable_db: never };
|
||||
|
||||
104
ts/sql/Server.ts
104
ts/sql/Server.ts
@@ -15,41 +15,41 @@ import { z } from 'zod';
|
||||
import type { Dictionary } from 'lodash';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import { parseBadgeCategory } from '../badges/BadgeCategory.js';
|
||||
import { parseBadgeCategory } from '../badges/BadgeCategory.std.js';
|
||||
import {
|
||||
parseBadgeImageTheme,
|
||||
type BadgeImageTheme,
|
||||
} from '../badges/BadgeImageTheme.js';
|
||||
import type { BadgeImageType, BadgeType } from '../badges/types.js';
|
||||
import type { StoredJob } from '../jobs/types.js';
|
||||
import { formatCountForLogging } from '../logging/formatCountForLogging.js';
|
||||
import { ReadStatus } from '../messages/MessageReadStatus.js';
|
||||
} from '../badges/BadgeImageTheme.std.js';
|
||||
import type { BadgeImageType, BadgeType } from '../badges/types.std.js';
|
||||
import type { StoredJob } from '../jobs/types.std.js';
|
||||
import { formatCountForLogging } from '../logging/formatCountForLogging.std.js';
|
||||
import { ReadStatus } from '../messages/MessageReadStatus.std.js';
|
||||
import type {
|
||||
GroupV2MemberType,
|
||||
MessageAttributesType,
|
||||
} from '../model-types.d.ts';
|
||||
import type { ReactionType } from '../types/Reactions.js';
|
||||
import { ReactionReadStatus } from '../types/Reactions.js';
|
||||
import type { AciString, ServiceIdString } from '../types/ServiceId.js';
|
||||
import { isServiceIdString } from '../types/ServiceId.js';
|
||||
import { STORAGE_UI_KEYS } from '../types/StorageUIKeys.js';
|
||||
import type { StoryDistributionIdString } from '../types/StoryDistributionId.js';
|
||||
import * as Errors from '../types/errors.js';
|
||||
import { assertDev, strictAssert } from '../util/assert.js';
|
||||
import { missingCaseError } from '../util/missingCaseError.js';
|
||||
import { combineNames } from '../util/combineNames.js';
|
||||
import { consoleLogger } from '../util/consoleLogger.js';
|
||||
import type { ReactionType } from '../types/Reactions.std.js';
|
||||
import { ReactionReadStatus } from '../types/Reactions.std.js';
|
||||
import type { AciString, ServiceIdString } from '../types/ServiceId.std.js';
|
||||
import { isServiceIdString } from '../types/ServiceId.std.js';
|
||||
import { STORAGE_UI_KEYS } from '../types/StorageUIKeys.std.js';
|
||||
import type { StoryDistributionIdString } from '../types/StoryDistributionId.std.js';
|
||||
import * as Errors from '../types/errors.std.js';
|
||||
import { assertDev, strictAssert } from '../util/assert.std.js';
|
||||
import { missingCaseError } from '../util/missingCaseError.std.js';
|
||||
import { combineNames } from '../util/combineNames.std.js';
|
||||
import { consoleLogger } from '../util/consoleLogger.std.js';
|
||||
import {
|
||||
dropNull,
|
||||
shallowConvertUndefinedToNull,
|
||||
type ShallowNullToUndefined,
|
||||
type ShallowUndefinedToNull,
|
||||
} from '../util/dropNull.js';
|
||||
import { isNormalNumber } from '../util/isNormalNumber.js';
|
||||
import { isNotNil } from '../util/isNotNil.js';
|
||||
import { parseIntOrThrow } from '../util/parseIntOrThrow.js';
|
||||
import { updateSchema } from './migrations/index.js';
|
||||
import type { JSONRows } from './util.js';
|
||||
} from '../util/dropNull.std.js';
|
||||
import { isNormalNumber } from '../util/isNormalNumber.std.js';
|
||||
import { isNotNil } from '../util/isNotNil.std.js';
|
||||
import { parseIntOrThrow } from '../util/parseIntOrThrow.std.js';
|
||||
import { updateSchema } from './migrations/index.node.js';
|
||||
import type { JSONRows } from './util.std.js';
|
||||
import {
|
||||
batchMultiVarQuery,
|
||||
bulkAdd,
|
||||
@@ -70,32 +70,32 @@ import {
|
||||
sqlJoin,
|
||||
QueryFragment,
|
||||
convertOptionalBooleanToInteger,
|
||||
} from './util.js';
|
||||
} from './util.std.js';
|
||||
import {
|
||||
hydrateMessage,
|
||||
hydrateMessages,
|
||||
convertAttachmentDBFieldsToAttachmentType,
|
||||
getAttachmentReferencesForMessages,
|
||||
ROOT_MESSAGE_ATTACHMENT_EDIT_HISTORY_INDEX,
|
||||
} from './hydration.js';
|
||||
} from './hydration.std.js';
|
||||
|
||||
import { SeenStatus } from '../MessageSeenStatus.js';
|
||||
import { SeenStatus } from '../MessageSeenStatus.std.js';
|
||||
import {
|
||||
attachmentBackupJobSchema,
|
||||
type AttachmentBackupJobType,
|
||||
} from '../types/AttachmentBackup.js';
|
||||
} from '../types/AttachmentBackup.std.js';
|
||||
import {
|
||||
attachmentDownloadJobSchema,
|
||||
type MessageAttachmentType,
|
||||
type AttachmentDownloadJobType,
|
||||
} from '../types/AttachmentDownload.js';
|
||||
} from '../types/AttachmentDownload.std.js';
|
||||
import type {
|
||||
CallHistoryDetails,
|
||||
CallHistoryFilter,
|
||||
CallHistoryGroup,
|
||||
CallHistoryPagination,
|
||||
CallLogEventTarget,
|
||||
} from '../types/CallDisposition.js';
|
||||
} from '../types/CallDisposition.std.js';
|
||||
import {
|
||||
CallDirection,
|
||||
CallHistoryFilterStatus,
|
||||
@@ -106,21 +106,21 @@ import {
|
||||
GroupCallStatus,
|
||||
callHistoryDetailsSchema,
|
||||
callHistoryGroupSchema,
|
||||
} from '../types/CallDisposition.js';
|
||||
import { redactGenericText } from '../util/privacy.js';
|
||||
} from '../types/CallDisposition.std.js';
|
||||
import { redactGenericText } from '../util/privacy.node.js';
|
||||
import {
|
||||
parseLoose,
|
||||
parseStrict,
|
||||
parseUnknown,
|
||||
safeParseUnknown,
|
||||
} from '../util/schemas.js';
|
||||
} from '../util/schemas.std.js';
|
||||
import {
|
||||
SNIPPET_LEFT_PLACEHOLDER,
|
||||
SNIPPET_RIGHT_PLACEHOLDER,
|
||||
SNIPPET_TRUNCATION_PLACEHOLDER,
|
||||
} from '../util/search.js';
|
||||
import type { SyncTaskType } from '../util/syncTasks.js';
|
||||
import { MAX_SYNC_TASK_ATTEMPTS } from '../util/syncTasks.types.js';
|
||||
} from '../util/search.std.js';
|
||||
import type { SyncTaskType } from '../util/syncTasks.preload.js';
|
||||
import { MAX_SYNC_TASK_ATTEMPTS } from '../util/syncTasks.types.std.js';
|
||||
import type {
|
||||
AdjacentMessagesByConversationOptionsType,
|
||||
BackupCdnMediaObjectType,
|
||||
@@ -191,13 +191,13 @@ import type {
|
||||
BackupAttachmentDownloadProgress,
|
||||
GetMessagesBetweenOptions,
|
||||
MaybeStaleCallHistory,
|
||||
} from './Interface.js';
|
||||
} from './Interface.std.js';
|
||||
import {
|
||||
AttachmentDownloadSource,
|
||||
MESSAGE_COLUMNS,
|
||||
MESSAGE_ATTACHMENT_COLUMNS,
|
||||
MESSAGE_NON_PRIMARY_KEY_COLUMNS,
|
||||
} from './Interface.js';
|
||||
} from './Interface.std.js';
|
||||
import {
|
||||
_removeAllCallLinks,
|
||||
beginDeleteAllCallLinks,
|
||||
@@ -222,21 +222,21 @@ import {
|
||||
updateCallLinkState,
|
||||
updateCallLinkStateAndEpoch,
|
||||
updateDefunctCallLink,
|
||||
} from './server/callLinks.js';
|
||||
} from './server/callLinks.node.js';
|
||||
import {
|
||||
_deleteAllDonationReceipts,
|
||||
createDonationReceipt,
|
||||
deleteDonationReceiptById,
|
||||
getAllDonationReceipts,
|
||||
getDonationReceiptById,
|
||||
} from './server/donationReceipts.js';
|
||||
} from './server/donationReceipts.std.js';
|
||||
import {
|
||||
deleteAllEndorsementsForGroup,
|
||||
getGroupSendCombinedEndorsementExpiration,
|
||||
getGroupSendEndorsementsData,
|
||||
getGroupSendMemberEndorsement,
|
||||
replaceAllEndorsementsForGroup,
|
||||
} from './server/groupSendEndorsements.js';
|
||||
} from './server/groupSendEndorsements.std.js';
|
||||
import {
|
||||
getAllChatFolders,
|
||||
getCurrentChatFolders,
|
||||
@@ -251,21 +251,21 @@ import {
|
||||
updateChatFolderPositions,
|
||||
updateChatFolderDeletedAtTimestampMsFromSync,
|
||||
deleteExpiredChatFolders,
|
||||
} from './server/chatFolders.js';
|
||||
import { INITIAL_EXPIRE_TIMER_VERSION } from '../util/expirationTimer.js';
|
||||
import type { GifType } from '../components/fun/panels/FunPanelGifs.js';
|
||||
import type { NotificationProfileType } from '../types/NotificationProfile.js';
|
||||
import * as durations from '../util/durations/index.js';
|
||||
import type { AttachmentType } from '../types/Attachment.js';
|
||||
import { isFile, isVisualMedia } from '../util/Attachment.js';
|
||||
import { generateMessageId } from '../util/generateMessageId.js';
|
||||
} from './server/chatFolders.std.js';
|
||||
import { INITIAL_EXPIRE_TIMER_VERSION } from '../util/expirationTimer.std.js';
|
||||
import type { GifType } from '../components/fun/panels/FunPanelGifs.dom.js';
|
||||
import type { NotificationProfileType } from '../types/NotificationProfile.std.js';
|
||||
import * as durations from '../util/durations/index.std.js';
|
||||
import type { AttachmentType } from '../types/Attachment.std.js';
|
||||
import { isFile, isVisualMedia } from '../util/Attachment.std.js';
|
||||
import { generateMessageId } from '../util/generateMessageId.node.js';
|
||||
import type {
|
||||
ConversationColorType,
|
||||
CustomColorType,
|
||||
} from '../types/Colors.js';
|
||||
import { sqlLogger } from './sqlLogger.js';
|
||||
import { permissiveMessageAttachmentSchema } from './server/messageAttachments.js';
|
||||
import { getFilePathsOwnedByMessage } from '../util/messageFilePaths.js';
|
||||
} from '../types/Colors.std.js';
|
||||
import { sqlLogger } from './sqlLogger.node.js';
|
||||
import { permissiveMessageAttachmentSchema } from './server/messageAttachments.std.js';
|
||||
import { getFilePathsOwnedByMessage } from '../util/messageFilePaths.std.js';
|
||||
|
||||
const {
|
||||
forEach,
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
import { createLogger } from '../logging/log.js';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.js';
|
||||
import { explodePromise } from '../util/explodePromise.js';
|
||||
import { missingCaseError } from '../util/missingCaseError.js';
|
||||
import { createLogger } from '../logging/log.std.js';
|
||||
import createTaskWithTimeout from '../textsecure/TaskWithTimeout.std.js';
|
||||
import { explodePromise } from '../util/explodePromise.std.js';
|
||||
import { missingCaseError } from '../util/missingCaseError.std.js';
|
||||
|
||||
const log = createLogger('channels');
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import lodash from 'lodash';
|
||||
import { createLogger } from '../logging/log.js';
|
||||
import { createLogger } from '../logging/log.std.js';
|
||||
|
||||
import { isIterable } from '../util/iterables.js';
|
||||
import { isIterable } from '../util/iterables.std.js';
|
||||
|
||||
const { isPlainObject } = lodash;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import lodash from 'lodash';
|
||||
import type { ReadStatus } from '../messages/MessageReadStatus.js';
|
||||
import type { SeenStatus } from '../MessageSeenStatus.js';
|
||||
import type { ServiceIdString } from '../types/ServiceId.js';
|
||||
import { dropNull, shallowDropNull } from '../util/dropNull.js';
|
||||
import type { ReadStatus } from '../messages/MessageReadStatus.std.js';
|
||||
import type { SeenStatus } from '../MessageSeenStatus.std.js';
|
||||
import type { ServiceIdString } from '../types/ServiceId.std.js';
|
||||
import { dropNull, shallowDropNull } from '../util/dropNull.std.js';
|
||||
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
@@ -15,24 +15,24 @@ import type {
|
||||
MESSAGE_COLUMNS,
|
||||
ReadableDB,
|
||||
MessageAttachmentDBType,
|
||||
} from './Interface.js';
|
||||
} from './Interface.std.js';
|
||||
import {
|
||||
batchMultiVarQuery,
|
||||
convertOptionalIntegerToBoolean,
|
||||
jsonToObject,
|
||||
sql,
|
||||
sqlJoin,
|
||||
} from './util.js';
|
||||
import type { AttachmentType } from '../types/Attachment.js';
|
||||
} from './util.std.js';
|
||||
import type { AttachmentType } from '../types/Attachment.std.js';
|
||||
import {
|
||||
APPLICATION_OCTET_STREAM,
|
||||
IMAGE_JPEG,
|
||||
IMAGE_PNG,
|
||||
stringToMIMEType,
|
||||
} from '../types/MIME.js';
|
||||
import { strictAssert } from '../util/assert.js';
|
||||
import type { MessageAttributesType } from '../model-types.js';
|
||||
import { createLogger } from '../logging/log.js';
|
||||
} from '../types/MIME.std.js';
|
||||
import { strictAssert } from '../util/assert.std.js';
|
||||
import type { MessageAttributesType } from '../model-types.d.ts';
|
||||
import { createLogger } from '../logging/log.std.js';
|
||||
|
||||
const { groupBy } = lodash;
|
||||
|
||||
|
||||
@@ -6,15 +6,15 @@ import { Worker } from 'node:worker_threads';
|
||||
import { format } from 'node:util';
|
||||
import { app } from 'electron';
|
||||
|
||||
import { strictAssert } from '../util/assert.js';
|
||||
import { explodePromise } from '../util/explodePromise.js';
|
||||
import type { LoggerType } from '../types/Logging.js';
|
||||
import * as Errors from '../types/errors.js';
|
||||
import { SqliteErrorKind } from './errors.js';
|
||||
import { strictAssert } from '../util/assert.std.js';
|
||||
import { explodePromise } from '../util/explodePromise.std.js';
|
||||
import type { LoggerType } from '../types/Logging.std.js';
|
||||
import * as Errors from '../types/errors.std.js';
|
||||
import { SqliteErrorKind } from './errors.std.js';
|
||||
import type {
|
||||
ServerReadableDirectInterface,
|
||||
ServerWritableDirectInterface,
|
||||
} from './Interface.js';
|
||||
} from './Interface.std.js';
|
||||
|
||||
const MIN_TRACE_DURATION = 40;
|
||||
|
||||
|
||||
@@ -3,11 +3,14 @@
|
||||
|
||||
import { parentPort } from 'node:worker_threads';
|
||||
|
||||
import type { WrappedWorkerRequest, WrappedWorkerResponse } from './main.js';
|
||||
import type { WritableDB } from './Interface.js';
|
||||
import { initialize, DataReader, DataWriter, removeDB } from './Server.js';
|
||||
import { SqliteErrorKind, parseSqliteError } from './errors.js';
|
||||
import { sqlLogger as logger } from './sqlLogger.js';
|
||||
import type {
|
||||
WrappedWorkerRequest,
|
||||
WrappedWorkerResponse,
|
||||
} from './main.main.js';
|
||||
import type { WritableDB } from './Interface.std.js';
|
||||
import { initialize, DataReader, DataWriter, removeDB } from './Server.node.js';
|
||||
import { SqliteErrorKind, parseSqliteError } from './errors.std.js';
|
||||
import { sqlLogger as logger } from './sqlLogger.node.js';
|
||||
|
||||
if (!parentPort) {
|
||||
throw new Error('Must run as a worker thread');
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus.js';
|
||||
import { SeenStatus } from '../../MessageSeenStatus.js';
|
||||
import { strictAssert } from '../../util/assert.js';
|
||||
import { sql, sqlConstant } from '../util.js';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus.std.js';
|
||||
import { SeenStatus } from '../../MessageSeenStatus.std.js';
|
||||
import { strictAssert } from '../../util/assert.std.js';
|
||||
import { sql, sqlConstant } from '../util.std.js';
|
||||
|
||||
const READ_STATUS_UNREAD = sqlConstant(ReadStatus.Unread);
|
||||
const READ_STATUS_READ = sqlConstant(ReadStatus.Read);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1010(db: Database): void {
|
||||
const [createTable] = sql`
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { getOurUuid } from './41-uuid-keys.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { getOurUuid } from './41-uuid-keys.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1020(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import { sql, sqlFragment } from '../util.js';
|
||||
import { sql, sqlFragment } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1030(db: Database): void {
|
||||
// From migration 81
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import * as z from 'zod';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import {
|
||||
messageAttachmentTypeSchema,
|
||||
type AttachmentDownloadJobType,
|
||||
type MessageAttachmentType,
|
||||
} from '../../types/AttachmentDownload.js';
|
||||
import type { AttachmentType } from '../../types/Attachment.js';
|
||||
import { jsonToObject, objectToJSON, sql } from '../util.js';
|
||||
import { AttachmentDownloadSource } from '../Interface.js';
|
||||
import { parsePartial } from '../../util/schemas.js';
|
||||
import { MIMETypeSchema } from '../../types/MIME.js';
|
||||
} from '../../types/AttachmentDownload.std.js';
|
||||
import type { AttachmentType } from '../../types/Attachment.std.js';
|
||||
import { jsonToObject, objectToJSON, sql } from '../util.std.js';
|
||||
import { AttachmentDownloadSource } from '../Interface.std.js';
|
||||
import { parsePartial } from '../../util/schemas.std.js';
|
||||
import { MIMETypeSchema } from '../../types/MIME.std.js';
|
||||
import {
|
||||
jobManagerJobSchema,
|
||||
type JobManagerJobType,
|
||||
} from '../../jobs/JobManager.js';
|
||||
} from '../../jobs/JobManager.std.js';
|
||||
|
||||
export type _AttachmentDownloadJobTypeV1030 = {
|
||||
attachment: AttachmentType;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1050(db: Database): void {
|
||||
const [createTables] = sql`
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1100(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql, sqlConstant } from '../util.js';
|
||||
import { CallDirection, CallStatusValue } from '../../types/CallDisposition.js';
|
||||
import { sql, sqlConstant } from '../util.std.js';
|
||||
import {
|
||||
CallDirection,
|
||||
CallStatusValue,
|
||||
} from '../../types/CallDisposition.std.js';
|
||||
|
||||
const CALL_STATUS_MISSED = sqlConstant(CallStatusValue.Missed);
|
||||
const CALL_DIRECTION_INCOMING = sqlConstant(CallDirection.Incoming);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1170(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { AttachmentDownloadSource } from '../Interface.js';
|
||||
import { AttachmentDownloadSource } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1180(db: Database): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
import assert from 'node:assert';
|
||||
import z from 'zod';
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import * as Errors from '../../types/errors.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import * as Errors from '../../types/errors.std.js';
|
||||
import {
|
||||
sessionRecordToProtobuf,
|
||||
sessionStructureToBytes,
|
||||
} from '../../util/sessionTranslation.js';
|
||||
import { getOwn } from '../../util/getOwn.js';
|
||||
import { missingCaseError } from '../../util/missingCaseError.js';
|
||||
} from '../../util/sessionTranslation.node.js';
|
||||
import { getOwn } from '../../util/getOwn.std.js';
|
||||
import { missingCaseError } from '../../util/missingCaseError.std.js';
|
||||
|
||||
export const version = 1220;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1240(db: Database): void {
|
||||
const [createTable] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1260(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1270(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { v7 as getGuid } from 'uuid';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import {
|
||||
normalizePni,
|
||||
normalizeServiceId,
|
||||
toTaggedPni,
|
||||
isUntaggedPniString,
|
||||
} from '../../types/ServiceId.js';
|
||||
import { Migrations as Proto } from '../../protobuf/index.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { getOurUuid } from './41-uuid-keys.js';
|
||||
} from '../../types/ServiceId.std.js';
|
||||
import { Migrations as Proto } from '../../protobuf/index.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { getOurUuid } from './41-uuid-keys.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1280(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1290(db: WritableDB): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1300(db: WritableDB): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
// Value from ts/util/timestamp.ts at the time of creation of this migration
|
||||
const MAX_SAFE_DATE = 8640000000000000;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1320(db: WritableDB): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1330(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1340(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1350(db: Database): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1360(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1370(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1380(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { type WritableDB } from '../Interface.js';
|
||||
import { type WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1390(db: WritableDB): void {
|
||||
// TODO: DESKTOP-8879 Digest column is only used for deduplication purposes; here we
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1400(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { type WritableDB } from '../Interface.js';
|
||||
import { type WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1410(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { AttachmentDownloadSource, type WritableDB } from '../Interface.js';
|
||||
import { AttachmentDownloadSource, type WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1420(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { type WritableDB } from '../Interface.js';
|
||||
import { type WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1430(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1440(db: WritableDB): void {
|
||||
const [query] = sql`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1450(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1460(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1460(db: WritableDB): void {
|
||||
db.exec(`
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion1480(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { isValidUuid } from '../../util/isValidUuid.js';
|
||||
import Helpers from '../../textsecure/Helpers.js';
|
||||
import { createOrUpdate, getById, removeById } from '../util.js';
|
||||
import type { ItemKeyType, ReadableDB, WritableDB } from '../Interface.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { isValidUuid } from '../../util/isValidUuid.std.js';
|
||||
import Helpers from '../../textsecure/Helpers.std.js';
|
||||
import { createOrUpdate, getById, removeById } from '../util.std.js';
|
||||
import type { ItemKeyType, ReadableDB, WritableDB } from '../Interface.std.js';
|
||||
|
||||
export function getOurUuid(db: ReadableDB): string | undefined {
|
||||
const UUID_ID: ItemKeyType = 'uuid_id';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { batchMultiVarQuery } from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { batchMultiVarQuery } from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
|
||||
export default function updateToSchemaVersion42(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
|
||||
import lodash from 'lodash';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { AciString, ServiceIdString } from '../../types/ServiceId.js';
|
||||
import { normalizeAci } from '../../util/normalizeAci.js';
|
||||
import { isNotNil } from '../../util/isNotNil.js';
|
||||
import { assertDev } from '../../util/assert.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type { AciString, ServiceIdString } from '../../types/ServiceId.std.js';
|
||||
import { normalizeAci } from '../../util/normalizeAci.std.js';
|
||||
import { isNotNil } from '../../util/isNotNil.std.js';
|
||||
import { assertDev } from '../../util/assert.std.js';
|
||||
import {
|
||||
TableIterator,
|
||||
getCountFromTable,
|
||||
jsonToObject,
|
||||
objectToJSON,
|
||||
} from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
} from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
const { omit } = lodash;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { getOurUuid } from './41-uuid-keys.js';
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { getOurUuid } from './41-uuid-keys.std.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
export default function updateToSchemaVersion47(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { isRecord } from '../../util/isRecord.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { getJobsInQueue, insertJob } from '../Server.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { isRecord } from '../../util/isRecord.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { getJobsInQueue, insertJob } from '../Server.node.js';
|
||||
|
||||
export default function updateToSchemaVersion51(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { jsonToObject } from '../util.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { jsonToObject } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion53(
|
||||
db: Database,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { getJobsInQueue, insertJob } from '../Server.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { isRecord } from '../../util/isRecord.js';
|
||||
import { isIterable } from '../../util/iterables.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { getJobsInQueue, insertJob } from '../Server.node.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { isRecord } from '../../util/isRecord.std.js';
|
||||
import { isIterable } from '../../util/iterables.std.js';
|
||||
|
||||
export default function updateToSchemaVersion55(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus.js';
|
||||
import { SeenStatus } from '../../MessageSeenStatus.js';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus.std.js';
|
||||
import { SeenStatus } from '../../MessageSeenStatus.std.js';
|
||||
|
||||
export default function updateToSchemaVersion56(db: Database): void {
|
||||
db.exec(
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus.js';
|
||||
import { SeenStatus } from '../../MessageSeenStatus.js';
|
||||
import { ReadStatus } from '../../messages/MessageReadStatus.std.js';
|
||||
import { SeenStatus } from '../../MessageSeenStatus.std.js';
|
||||
|
||||
export default function updateToSchemaVersion58(db: Database): void {
|
||||
db.exec(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { isRecord } from '../../util/isRecord.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
import { getJobsInQueue, insertJob } from '../Server.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { isRecord } from '../../util/isRecord.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
import { getJobsInQueue, insertJob } from '../Server.node.js';
|
||||
|
||||
export default function updateToSchemaVersion78(
|
||||
db: WritableDB,
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import { cleanKeys } from './920-clean-more-keys.js';
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { sqlFragment } from '../util.js';
|
||||
import { cleanKeys } from './920-clean-more-keys.std.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { sqlFragment } from '../util.std.js';
|
||||
|
||||
// Note: for many users, this is not what ran for them as migration 87. You can see that
|
||||
// migration here: https://github.com/signalapp/Signal-Desktop/commit/671e16ae1f869627f355113d6397ccb62d5461d2
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type {
|
||||
ServiceIdString,
|
||||
AciString,
|
||||
PniString,
|
||||
} from '../../types/ServiceId.js';
|
||||
import { normalizeServiceId, normalizePni } from '../../types/ServiceId.js';
|
||||
import { normalizeAci } from '../../util/normalizeAci.js';
|
||||
import type { JSONWithUnknownFields } from '../../types/Util.js';
|
||||
import { isNotNil } from '../../util/isNotNil.js';
|
||||
} from '../../types/ServiceId.std.js';
|
||||
import { normalizeServiceId, normalizePni } from '../../types/ServiceId.std.js';
|
||||
import { normalizeAci } from '../../util/normalizeAci.std.js';
|
||||
import type { JSONWithUnknownFields } from '../../types/Util.std.js';
|
||||
import { isNotNil } from '../../util/isNotNil.std.js';
|
||||
|
||||
const { omit } = lodash;
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import { v4 as generateUuid } from 'uuid';
|
||||
import lodash from 'lodash';
|
||||
|
||||
import type { SetOptional } from 'type-fest';
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { jsonToObject, sql } from '../util.js';
|
||||
import { getOurUuid } from './41-uuid-keys.js';
|
||||
import type { CallHistoryDetails } from '../../types/CallDisposition.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { jsonToObject, sql } from '../util.std.js';
|
||||
import { getOurUuid } from './41-uuid-keys.std.js';
|
||||
import type { CallHistoryDetails } from '../../types/CallDisposition.std.js';
|
||||
import {
|
||||
DirectCallStatus,
|
||||
CallDirection,
|
||||
@@ -18,16 +18,16 @@ import {
|
||||
GroupCallStatus,
|
||||
callHistoryDetailsSchema,
|
||||
CallMode,
|
||||
} from '../../types/CallDisposition.js';
|
||||
} from '../../types/CallDisposition.std.js';
|
||||
import type {
|
||||
WritableDB,
|
||||
MessageType,
|
||||
ConversationType,
|
||||
} from '../Interface.js';
|
||||
import { strictAssert } from '../../util/assert.js';
|
||||
import { missingCaseError } from '../../util/missingCaseError.js';
|
||||
import { isAciString } from '../../util/isAciString.js';
|
||||
import { safeParseStrict } from '../../util/schemas.js';
|
||||
} from '../Interface.std.js';
|
||||
import { strictAssert } from '../../util/assert.std.js';
|
||||
import { missingCaseError } from '../../util/missingCaseError.std.js';
|
||||
import { isAciString } from '../../util/isAciString.std.js';
|
||||
import { safeParseStrict } from '../../util/schemas.std.js';
|
||||
|
||||
const { isObject } = lodash;
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion90(
|
||||
db: Database,
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
import type { Database, RunResult } from '@signalapp/sqlcipher';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { PniString } from '../../types/ServiceId.js';
|
||||
import { normalizePni } from '../../types/ServiceId.js';
|
||||
import * as Errors from '../../types/errors.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { PniString } from '../../types/ServiceId.std.js';
|
||||
import { normalizePni } from '../../types/ServiceId.std.js';
|
||||
import * as Errors from '../../types/errors.std.js';
|
||||
|
||||
export default function updateToSchemaVersion91(
|
||||
db: Database,
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
import type { Database, RunResult } from '@signalapp/sqlcipher';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { QueryFragment } from '../util.js';
|
||||
import type { PniString } from '../../types/ServiceId.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type { QueryFragment } from '../util.std.js';
|
||||
import type { PniString } from '../../types/ServiceId.std.js';
|
||||
|
||||
import { sql, sqlFragment } from '../util.js';
|
||||
import { normalizePni } from '../../types/ServiceId.js';
|
||||
import * as Errors from '../../types/errors.js';
|
||||
import { sql, sqlFragment } from '../util.std.js';
|
||||
import { normalizePni } from '../../types/ServiceId.std.js';
|
||||
import * as Errors from '../../types/errors.std.js';
|
||||
|
||||
export default function updateToSchemaVersion920(
|
||||
db: Database,
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
|
||||
import type { Database } from '@signalapp/sqlcipher';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import type {
|
||||
ServiceIdString,
|
||||
AciString,
|
||||
PniString,
|
||||
} from '../../types/ServiceId.js';
|
||||
import { normalizePni } from '../../types/ServiceId.js';
|
||||
import { normalizeAci } from '../../util/normalizeAci.js';
|
||||
import type { JSONWithUnknownFields } from '../../types/Util.js';
|
||||
} from '../../types/ServiceId.std.js';
|
||||
import { normalizePni } from '../../types/ServiceId.std.js';
|
||||
import { normalizeAci } from '../../util/normalizeAci.std.js';
|
||||
import type { JSONWithUnknownFields } from '../../types/Util.std.js';
|
||||
|
||||
export default function updateToSchemaVersion960(
|
||||
db: Database,
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Database } from '@signalapp/sqlcipher';
|
||||
import lodash from 'lodash';
|
||||
import { v4 as generateUuid } from 'uuid';
|
||||
|
||||
import type { LoggerType } from '../../types/Logging.js';
|
||||
import type { LoggerType } from '../../types/Logging.std.js';
|
||||
import {
|
||||
getSchemaVersion,
|
||||
getUserVersion,
|
||||
@@ -13,119 +13,119 @@ import {
|
||||
getSQLiteVersion,
|
||||
objectToJSON,
|
||||
jsonToObject,
|
||||
} from '../util.js';
|
||||
import type { WritableDB } from '../Interface.js';
|
||||
} from '../util.std.js';
|
||||
import type { WritableDB } from '../Interface.std.js';
|
||||
|
||||
import updateToSchemaVersion41 from './41-uuid-keys.js';
|
||||
import updateToSchemaVersion42 from './42-stale-reactions.js';
|
||||
import updateToSchemaVersion43 from './43-gv2-uuid.js';
|
||||
import updateToSchemaVersion44 from './44-badges.js';
|
||||
import updateToSchemaVersion45 from './45-stories.js';
|
||||
import updateToSchemaVersion46 from './46-optimize-stories.js';
|
||||
import updateToSchemaVersion47 from './47-further-optimize.js';
|
||||
import updateToSchemaVersion48 from './48-fix-user-initiated-index.js';
|
||||
import updateToSchemaVersion49 from './49-fix-preview-index.js';
|
||||
import updateToSchemaVersion50 from './50-fix-messages-unread-index.js';
|
||||
import updateToSchemaVersion51 from './51-centralize-conversation-jobs.js';
|
||||
import updateToSchemaVersion52 from './52-optimize-stories.js';
|
||||
import updateToSchemaVersion53 from './53-gv2-banned-members.js';
|
||||
import updateToSchemaVersion54 from './54-unprocessed-received-at-counter.js';
|
||||
import updateToSchemaVersion55 from './55-report-message-aci.js';
|
||||
import updateToSchemaVersion56 from './56-add-unseen-to-message.js';
|
||||
import updateToSchemaVersion57 from './57-rm-message-history-unsynced.js';
|
||||
import updateToSchemaVersion58 from './58-update-unread.js';
|
||||
import updateToSchemaVersion59 from './59-unprocessed-received-at-counter-index.js';
|
||||
import updateToSchemaVersion60 from './60-update-expiring-index.js';
|
||||
import updateToSchemaVersion61 from './61-distribution-list-storage.js';
|
||||
import updateToSchemaVersion62 from './62-add-urgent-to-send-log.js';
|
||||
import updateToSchemaVersion63 from './63-add-urgent-to-unprocessed.js';
|
||||
import updateToSchemaVersion64 from './64-uuid-column-for-pre-keys.js';
|
||||
import updateToSchemaVersion65 from './65-add-storage-id-to-stickers.js';
|
||||
import updateToSchemaVersion66 from './66-add-pni-signature-to-sent-protos.js';
|
||||
import updateToSchemaVersion67 from './67-add-story-to-unprocessed.js';
|
||||
import updateToSchemaVersion68 from './68-drop-deprecated-columns.js';
|
||||
import updateToSchemaVersion69 from './69-group-call-ring-cancellations.js';
|
||||
import updateToSchemaVersion70 from './70-story-reply-index.js';
|
||||
import updateToSchemaVersion71 from './71-merge-notifications.js';
|
||||
import updateToSchemaVersion72 from './72-optimize-call-id-message-lookup.js';
|
||||
import updateToSchemaVersion73 from './73-remove-phone-number-discovery.js';
|
||||
import updateToSchemaVersion74 from './74-optimize-convo-open.js';
|
||||
import updateToSchemaVersion75 from './75-noop.js';
|
||||
import updateToSchemaVersion76 from './76-optimize-convo-open-2.js';
|
||||
import updateToSchemaVersion77 from './77-signal-tokenizer.js';
|
||||
import updateToSchemaVersion78 from './78-merge-receipt-jobs.js';
|
||||
import updateToSchemaVersion79 from './79-paging-lightbox.js';
|
||||
import updateToSchemaVersion80 from './80-edited-messages.js';
|
||||
import updateToSchemaVersion81 from './81-contact-removed-notification.js';
|
||||
import updateToSchemaVersion82 from './82-edited-messages-read-index.js';
|
||||
import updateToSchemaVersion83 from './83-mentions.js';
|
||||
import updateToSchemaVersion84 from './84-all-mentions.js';
|
||||
import updateToSchemaVersion85 from './85-add-kyber-keys.js';
|
||||
import updateToSchemaVersion86 from './86-story-replies-index.js';
|
||||
import updateToSchemaVersion87 from './87-cleanup.js';
|
||||
import updateToSchemaVersion88 from './88-service-ids.js';
|
||||
import updateToSchemaVersion89 from './89-call-history.js';
|
||||
import updateToSchemaVersion90 from './90-delete-story-reply-screenshot.js';
|
||||
import updateToSchemaVersion91 from './91-clean-keys.js';
|
||||
import updateToSchemaVersion920 from './920-clean-more-keys.js';
|
||||
import updateToSchemaVersion930 from './930-fts5-secure-delete.js';
|
||||
import updateToSchemaVersion940 from './940-fts5-revert.js';
|
||||
import updateToSchemaVersion950 from './950-fts5-secure-delete.js';
|
||||
import updateToSchemaVersion960 from './960-untag-pni.js';
|
||||
import updateToSchemaVersion970 from './970-fts5-optimize.js';
|
||||
import updateToSchemaVersion980 from './980-reaction-timestamp.js';
|
||||
import updateToSchemaVersion990 from './990-phone-number-sharing.js';
|
||||
import updateToSchemaVersion1000 from './1000-mark-unread-call-history-messages-as-unseen.js';
|
||||
import updateToSchemaVersion1010 from './1010-call-links-table.js';
|
||||
import updateToSchemaVersion1020 from './1020-self-merges.js';
|
||||
import updateToSchemaVersion1030 from './1030-unblock-event.js';
|
||||
import updateToSchemaVersion1040 from './1040-undownloaded-backed-up-media.js';
|
||||
import updateToSchemaVersion1050 from './1050-group-send-endorsements.js';
|
||||
import updateToSchemaVersion1060 from './1060-addressable-messages-and-sync-tasks.js';
|
||||
import updateToSchemaVersion1070 from './1070-attachment-backup.js';
|
||||
import updateToSchemaVersion1080 from './1080-nondisappearing-addressable.js';
|
||||
import updateToSchemaVersion1090 from './1090-message-delete-indexes.js';
|
||||
import updateToSchemaVersion1100 from './1100-optimize-mark-call-history-read-in-conversation.js';
|
||||
import updateToSchemaVersion1110 from './1110-sticker-local-key.js';
|
||||
import updateToSchemaVersion1120 from './1120-messages-foreign-keys-indexes.js';
|
||||
import updateToSchemaVersion1130 from './1130-isStory-index.js';
|
||||
import updateToSchemaVersion1140 from './1140-call-links-deleted-column.js';
|
||||
import updateToSchemaVersion1150 from './1150-expire-timer-version.js';
|
||||
import updateToSchemaVersion1160 from './1160-optimize-calls-unread-count.js';
|
||||
import updateToSchemaVersion1170 from './1170-update-call-history-unread-index.js';
|
||||
import updateToSchemaVersion1180 from './1180-add-attachment-download-source.js';
|
||||
import updateToSchemaVersion1190 from './1190-call-links-storage.js';
|
||||
import updateToSchemaVersion1200 from './1200-attachment-download-source-index.js';
|
||||
import updateToSchemaVersion1210 from './1210-call-history-started-id.js';
|
||||
import updateToSchemaVersion1220 from './1220-blob-sessions.js';
|
||||
import updateToSchemaVersion1230 from './1230-call-links-admin-key-index.js';
|
||||
import updateToSchemaVersion1240 from './1240-defunct-call-links-table.js';
|
||||
import updateToSchemaVersion1250 from './1250-defunct-call-links-storage.js';
|
||||
import updateToSchemaVersion1260 from './1260-sync-tasks-rowid.js';
|
||||
import updateToSchemaVersion1270 from './1270-normalize-messages.js';
|
||||
import updateToSchemaVersion1280 from './1280-blob-unprocessed.js';
|
||||
import updateToSchemaVersion1290 from './1290-int-unprocessed-source-device.js';
|
||||
import updateToSchemaVersion1300 from './1300-sticker-pack-refs.js';
|
||||
import updateToSchemaVersion1310 from './1310-muted-fixup.js';
|
||||
import updateToSchemaVersion1320 from './1320-unprocessed-received-at-date.js';
|
||||
import updateToSchemaVersion1330 from './1330-sync-tasks-type-index.js';
|
||||
import updateToSchemaVersion1340 from './1340-recent-gifs.js';
|
||||
import updateToSchemaVersion1350 from './1350-notification-profiles.js';
|
||||
import updateToSchemaVersion1360 from './1360-attachments.js';
|
||||
import updateToSchemaVersion1370 from './1370-message-attachment-indexes.js';
|
||||
import updateToSchemaVersion1380 from './1380-donation-receipts.js';
|
||||
import updateToSchemaVersion1390 from './1390-attachment-download-keys.js';
|
||||
import updateToSchemaVersion1400 from './1400-simplify-receipts.js';
|
||||
import updateToSchemaVersion1410 from './1410-remove-wallpaper.js';
|
||||
import updateToSchemaVersion1420 from './1420-backup-downloads.js';
|
||||
import updateToSchemaVersion1430 from './1430-call-links-epoch-id.js';
|
||||
import updateToSchemaVersion1440 from './1440-chat-folders.js';
|
||||
import updateToSchemaVersion1450 from './1450-all-media.js';
|
||||
import updateToSchemaVersion1460 from './1460-attachment-duration.js';
|
||||
import updateToSchemaVersion1470 from './1470-kyber-triple.js';
|
||||
import updateToSchemaVersion1480 from './1480-chat-folders-remove-duplicates.js';
|
||||
import updateToSchemaVersion41 from './41-uuid-keys.std.js';
|
||||
import updateToSchemaVersion42 from './42-stale-reactions.std.js';
|
||||
import updateToSchemaVersion43 from './43-gv2-uuid.std.js';
|
||||
import updateToSchemaVersion44 from './44-badges.std.js';
|
||||
import updateToSchemaVersion45 from './45-stories.std.js';
|
||||
import updateToSchemaVersion46 from './46-optimize-stories.std.js';
|
||||
import updateToSchemaVersion47 from './47-further-optimize.std.js';
|
||||
import updateToSchemaVersion48 from './48-fix-user-initiated-index.std.js';
|
||||
import updateToSchemaVersion49 from './49-fix-preview-index.std.js';
|
||||
import updateToSchemaVersion50 from './50-fix-messages-unread-index.std.js';
|
||||
import updateToSchemaVersion51 from './51-centralize-conversation-jobs.node.js';
|
||||
import updateToSchemaVersion52 from './52-optimize-stories.std.js';
|
||||
import updateToSchemaVersion53 from './53-gv2-banned-members.std.js';
|
||||
import updateToSchemaVersion54 from './54-unprocessed-received-at-counter.std.js';
|
||||
import updateToSchemaVersion55 from './55-report-message-aci.node.js';
|
||||
import updateToSchemaVersion56 from './56-add-unseen-to-message.std.js';
|
||||
import updateToSchemaVersion57 from './57-rm-message-history-unsynced.std.js';
|
||||
import updateToSchemaVersion58 from './58-update-unread.std.js';
|
||||
import updateToSchemaVersion59 from './59-unprocessed-received-at-counter-index.std.js';
|
||||
import updateToSchemaVersion60 from './60-update-expiring-index.std.js';
|
||||
import updateToSchemaVersion61 from './61-distribution-list-storage.std.js';
|
||||
import updateToSchemaVersion62 from './62-add-urgent-to-send-log.std.js';
|
||||
import updateToSchemaVersion63 from './63-add-urgent-to-unprocessed.std.js';
|
||||
import updateToSchemaVersion64 from './64-uuid-column-for-pre-keys.std.js';
|
||||
import updateToSchemaVersion65 from './65-add-storage-id-to-stickers.std.js';
|
||||
import updateToSchemaVersion66 from './66-add-pni-signature-to-sent-protos.std.js';
|
||||
import updateToSchemaVersion67 from './67-add-story-to-unprocessed.std.js';
|
||||
import updateToSchemaVersion68 from './68-drop-deprecated-columns.std.js';
|
||||
import updateToSchemaVersion69 from './69-group-call-ring-cancellations.std.js';
|
||||
import updateToSchemaVersion70 from './70-story-reply-index.std.js';
|
||||
import updateToSchemaVersion71 from './71-merge-notifications.std.js';
|
||||
import updateToSchemaVersion72 from './72-optimize-call-id-message-lookup.std.js';
|
||||
import updateToSchemaVersion73 from './73-remove-phone-number-discovery.std.js';
|
||||
import updateToSchemaVersion74 from './74-optimize-convo-open.std.js';
|
||||
import updateToSchemaVersion75 from './75-noop.std.js';
|
||||
import updateToSchemaVersion76 from './76-optimize-convo-open-2.std.js';
|
||||
import updateToSchemaVersion77 from './77-signal-tokenizer.std.js';
|
||||
import updateToSchemaVersion78 from './78-merge-receipt-jobs.node.js';
|
||||
import updateToSchemaVersion79 from './79-paging-lightbox.std.js';
|
||||
import updateToSchemaVersion80 from './80-edited-messages.std.js';
|
||||
import updateToSchemaVersion81 from './81-contact-removed-notification.std.js';
|
||||
import updateToSchemaVersion82 from './82-edited-messages-read-index.std.js';
|
||||
import updateToSchemaVersion83 from './83-mentions.std.js';
|
||||
import updateToSchemaVersion84 from './84-all-mentions.std.js';
|
||||
import updateToSchemaVersion85 from './85-add-kyber-keys.std.js';
|
||||
import updateToSchemaVersion86 from './86-story-replies-index.std.js';
|
||||
import updateToSchemaVersion87 from './87-cleanup.std.js';
|
||||
import updateToSchemaVersion88 from './88-service-ids.std.js';
|
||||
import updateToSchemaVersion89 from './89-call-history.node.js';
|
||||
import updateToSchemaVersion90 from './90-delete-story-reply-screenshot.std.js';
|
||||
import updateToSchemaVersion91 from './91-clean-keys.std.js';
|
||||
import updateToSchemaVersion920 from './920-clean-more-keys.std.js';
|
||||
import updateToSchemaVersion930 from './930-fts5-secure-delete.std.js';
|
||||
import updateToSchemaVersion940 from './940-fts5-revert.std.js';
|
||||
import updateToSchemaVersion950 from './950-fts5-secure-delete.std.js';
|
||||
import updateToSchemaVersion960 from './960-untag-pni.std.js';
|
||||
import updateToSchemaVersion970 from './970-fts5-optimize.std.js';
|
||||
import updateToSchemaVersion980 from './980-reaction-timestamp.std.js';
|
||||
import updateToSchemaVersion990 from './990-phone-number-sharing.std.js';
|
||||
import updateToSchemaVersion1000 from './1000-mark-unread-call-history-messages-as-unseen.std.js';
|
||||
import updateToSchemaVersion1010 from './1010-call-links-table.std.js';
|
||||
import updateToSchemaVersion1020 from './1020-self-merges.std.js';
|
||||
import updateToSchemaVersion1030 from './1030-unblock-event.std.js';
|
||||
import updateToSchemaVersion1040 from './1040-undownloaded-backed-up-media.std.js';
|
||||
import updateToSchemaVersion1050 from './1050-group-send-endorsements.std.js';
|
||||
import updateToSchemaVersion1060 from './1060-addressable-messages-and-sync-tasks.std.js';
|
||||
import updateToSchemaVersion1070 from './1070-attachment-backup.std.js';
|
||||
import updateToSchemaVersion1080 from './1080-nondisappearing-addressable.std.js';
|
||||
import updateToSchemaVersion1090 from './1090-message-delete-indexes.std.js';
|
||||
import updateToSchemaVersion1100 from './1100-optimize-mark-call-history-read-in-conversation.std.js';
|
||||
import updateToSchemaVersion1110 from './1110-sticker-local-key.std.js';
|
||||
import updateToSchemaVersion1120 from './1120-messages-foreign-keys-indexes.std.js';
|
||||
import updateToSchemaVersion1130 from './1130-isStory-index.std.js';
|
||||
import updateToSchemaVersion1140 from './1140-call-links-deleted-column.std.js';
|
||||
import updateToSchemaVersion1150 from './1150-expire-timer-version.std.js';
|
||||
import updateToSchemaVersion1160 from './1160-optimize-calls-unread-count.std.js';
|
||||
import updateToSchemaVersion1170 from './1170-update-call-history-unread-index.std.js';
|
||||
import updateToSchemaVersion1180 from './1180-add-attachment-download-source.std.js';
|
||||
import updateToSchemaVersion1190 from './1190-call-links-storage.std.js';
|
||||
import updateToSchemaVersion1200 from './1200-attachment-download-source-index.std.js';
|
||||
import updateToSchemaVersion1210 from './1210-call-history-started-id.std.js';
|
||||
import updateToSchemaVersion1220 from './1220-blob-sessions.node.js';
|
||||
import updateToSchemaVersion1230 from './1230-call-links-admin-key-index.std.js';
|
||||
import updateToSchemaVersion1240 from './1240-defunct-call-links-table.std.js';
|
||||
import updateToSchemaVersion1250 from './1250-defunct-call-links-storage.std.js';
|
||||
import updateToSchemaVersion1260 from './1260-sync-tasks-rowid.std.js';
|
||||
import updateToSchemaVersion1270 from './1270-normalize-messages.std.js';
|
||||
import updateToSchemaVersion1280 from './1280-blob-unprocessed.std.js';
|
||||
import updateToSchemaVersion1290 from './1290-int-unprocessed-source-device.std.js';
|
||||
import updateToSchemaVersion1300 from './1300-sticker-pack-refs.std.js';
|
||||
import updateToSchemaVersion1310 from './1310-muted-fixup.std.js';
|
||||
import updateToSchemaVersion1320 from './1320-unprocessed-received-at-date.std.js';
|
||||
import updateToSchemaVersion1330 from './1330-sync-tasks-type-index.std.js';
|
||||
import updateToSchemaVersion1340 from './1340-recent-gifs.std.js';
|
||||
import updateToSchemaVersion1350 from './1350-notification-profiles.std.js';
|
||||
import updateToSchemaVersion1360 from './1360-attachments.std.js';
|
||||
import updateToSchemaVersion1370 from './1370-message-attachment-indexes.std.js';
|
||||
import updateToSchemaVersion1380 from './1380-donation-receipts.std.js';
|
||||
import updateToSchemaVersion1390 from './1390-attachment-download-keys.std.js';
|
||||
import updateToSchemaVersion1400 from './1400-simplify-receipts.std.js';
|
||||
import updateToSchemaVersion1410 from './1410-remove-wallpaper.std.js';
|
||||
import updateToSchemaVersion1420 from './1420-backup-downloads.std.js';
|
||||
import updateToSchemaVersion1430 from './1430-call-links-epoch-id.std.js';
|
||||
import updateToSchemaVersion1440 from './1440-chat-folders.std.js';
|
||||
import updateToSchemaVersion1450 from './1450-all-media.std.js';
|
||||
import updateToSchemaVersion1460 from './1460-attachment-duration.std.js';
|
||||
import updateToSchemaVersion1470 from './1470-kyber-triple.std.js';
|
||||
import updateToSchemaVersion1480 from './1480-chat-folders-remove-duplicates.std.js';
|
||||
|
||||
import { DataWriter } from '../Server.js';
|
||||
import { DataWriter } from '../Server.node.js';
|
||||
|
||||
const { keyBy } = lodash;
|
||||
|
||||
|
||||
@@ -2,34 +2,34 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { CallLinkRootKey } from '@signalapp/ringrtc';
|
||||
import * as Bytes from '../../Bytes.js';
|
||||
import * as Bytes from '../../Bytes.std.js';
|
||||
import type {
|
||||
CallLinkRecord,
|
||||
CallLinkStateType,
|
||||
CallLinkType,
|
||||
DefunctCallLinkType,
|
||||
} from '../../types/CallLink.js';
|
||||
} from '../../types/CallLink.std.js';
|
||||
import {
|
||||
callLinkRestrictionsSchema,
|
||||
callLinkRecordSchema,
|
||||
defunctCallLinkRecordSchema,
|
||||
} from '../../types/CallLink.js';
|
||||
import { toAdminKeyBytes } from '../../util/callLinks.js';
|
||||
} from '../../types/CallLink.std.js';
|
||||
import { toAdminKeyBytes } from '../../util/callLinks.std.js';
|
||||
import {
|
||||
callLinkToRecord,
|
||||
callLinkFromRecord,
|
||||
defunctCallLinkToRecord,
|
||||
defunctCallLinkFromRecord,
|
||||
toEpochBytes,
|
||||
} from '../../util/callLinksRingrtc.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.js';
|
||||
import { strictAssert } from '../../util/assert.js';
|
||||
} from '../../util/callLinksRingrtc.node.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import { strictAssert } from '../../util/assert.std.js';
|
||||
import {
|
||||
CallStatusValue,
|
||||
DirectCallStatus,
|
||||
} from '../../types/CallDisposition.js';
|
||||
import { parseStrict, parseUnknown } from '../../util/schemas.js';
|
||||
} from '../../types/CallDisposition.std.js';
|
||||
import { parseStrict, parseUnknown } from '../../util/schemas.std.js';
|
||||
|
||||
export function callLinkExists(db: ReadableDB, roomId: string): boolean {
|
||||
const [query, params] = sql`
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
CHAT_FOLDER_DELETED_POSITION,
|
||||
CHAT_FOLDER_DEFAULTS,
|
||||
ChatFolderType,
|
||||
} from '../../types/ChatFolder.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.js';
|
||||
import { strictAssert } from '../../util/assert.js';
|
||||
import type { CurrentChatFolder } from '../../types/CurrentChatFolders.js';
|
||||
import { isCurrentChatFolder } from '../../types/CurrentChatFolders.js';
|
||||
} from '../../types/ChatFolder.std.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import { strictAssert } from '../../util/assert.std.js';
|
||||
import type { CurrentChatFolder } from '../../types/CurrentChatFolders.std.js';
|
||||
import { isCurrentChatFolder } from '../../types/CurrentChatFolders.std.js';
|
||||
|
||||
export type ChatFolderRow = Readonly<
|
||||
Omit<
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { sql } from '../util.js';
|
||||
import { sql } from '../util.std.js';
|
||||
|
||||
import type { DonationReceipt } from '../../types/Donations.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.js';
|
||||
import type { DonationReceipt } from '../../types/Donations.std.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.std.js';
|
||||
|
||||
export function getAllDonationReceipts(db: ReadableDB): Array<DonationReceipt> {
|
||||
const donationReceipts = db
|
||||
|
||||
@@ -5,17 +5,17 @@ import type {
|
||||
GroupSendCombinedEndorsementRecord,
|
||||
GroupSendEndorsementsData,
|
||||
GroupSendMemberEndorsementRecord,
|
||||
} from '../../types/GroupSendEndorsements.js';
|
||||
} from '../../types/GroupSendEndorsements.std.js';
|
||||
import {
|
||||
groupSendEndorsementExpirationSchema,
|
||||
groupSendMemberEndorsementSchema,
|
||||
groupSendEndorsementsDataSchema,
|
||||
} from '../../types/GroupSendEndorsements.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.js';
|
||||
import { sql } from '../util.js';
|
||||
import type { AciString } from '../../types/ServiceId.js';
|
||||
import { strictAssert } from '../../util/assert.js';
|
||||
import { parseLoose, parseUnknown } from '../../util/schemas.js';
|
||||
} from '../../types/GroupSendEndorsements.std.js';
|
||||
import type { ReadableDB, WritableDB } from '../Interface.std.js';
|
||||
import { sql } from '../util.std.js';
|
||||
import type { AciString } from '../../types/ServiceId.std.js';
|
||||
import { strictAssert } from '../../util/assert.std.js';
|
||||
import { parseLoose, parseUnknown } from '../../util/schemas.std.js';
|
||||
|
||||
/**
|
||||
* We don't need to store more than one endorsement per group or per member.
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { z } from 'zod';
|
||||
import { convertUndefinedToNull } from '../../util/dropNull.js';
|
||||
import { messageAttachmentTypeSchema } from '../../types/AttachmentDownload.js';
|
||||
import { APPLICATION_OCTET_STREAM } from '../../types/MIME.js';
|
||||
import type { MessageAttachmentDBType } from '../Interface.js';
|
||||
import { convertUndefinedToNull } from '../../util/dropNull.std.js';
|
||||
import { messageAttachmentTypeSchema } from '../../types/AttachmentDownload.std.js';
|
||||
import { APPLICATION_OCTET_STREAM } from '../../types/MIME.std.js';
|
||||
import type { MessageAttachmentDBType } from '../Interface.std.js';
|
||||
|
||||
const permissiveStringOrNull = z
|
||||
.string()
|
||||
|
||||
@@ -3,10 +3,13 @@
|
||||
import { parentPort } from 'node:worker_threads';
|
||||
import { format } from 'node:util';
|
||||
|
||||
import type { LoggerType } from '../types/Logging.js';
|
||||
import type { WrappedWorkerLogEntry, WrappedWorkerResponse } from './main.js';
|
||||
import { consoleLogger } from '../util/consoleLogger.js';
|
||||
import { strictAssert } from '../util/assert.js';
|
||||
import type { LoggerType } from '../types/Logging.std.js';
|
||||
import type {
|
||||
WrappedWorkerLogEntry,
|
||||
WrappedWorkerResponse,
|
||||
} from './main.main.js';
|
||||
import { consoleLogger } from '../util/consoleLogger.std.js';
|
||||
import { strictAssert } from '../util/assert.std.js';
|
||||
|
||||
class SQLLogger {
|
||||
#msgPrefix: string;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
import lodash from 'lodash';
|
||||
|
||||
import type { ReadableDB, WritableDB } from './Interface.js';
|
||||
import type { LoggerType } from '../types/Logging.js';
|
||||
import type { ReadableDB, WritableDB } from './Interface.std.js';
|
||||
import type { LoggerType } from '../types/Logging.std.js';
|
||||
|
||||
const { isNumber, last } = lodash;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user