Use protopiler for protocol buffers

Co-authored-by: Jamie Kyle <jamie@signal.org>
This commit is contained in:
Fedor Indutny
2026-03-10 15:31:29 -07:00
committed by GitHub
parent b0e19f334e
commit c4ee32e9ee
97 changed files with 6197 additions and 6362 deletions

View File

@@ -6,6 +6,8 @@ import { createLogger } from '../logging/log.std.js';
import { isIterable } from '../util/iterables.std.js';
import { toNumber } from '../util/toNumber.std.js';
const { isPlainObject } = lodash;
const log = createLogger('cleanDataForIpc');
@@ -133,13 +135,10 @@ function cleanDataInner(
const dataAsRecord = data as Record<string, unknown>;
if (
'toNumber' in dataAsRecord &&
typeof dataAsRecord.toNumber === 'function'
) {
if (typeof dataAsRecord === 'bigint') {
// We clean this just in case `toNumber` returns something bogus.
return cleanDataInner(
dataAsRecord.toNumber(),
toNumber(dataAsRecord),
path,
pathsChanged,
depth + 1

View File

@@ -9,6 +9,7 @@ import {
toTaggedPni,
isUntaggedPniString,
} from '../../types/ServiceId.std.js';
import { isKnownProtoEnumMember } from '../../util/isKnownProtoEnumMember.std.js';
import { Migrations as Proto } from '../../protobuf/index.std.js';
import { sql } from '../util.std.js';
import type { WritableDB } from '../Interface.std.js';
@@ -120,7 +121,9 @@ export default function updateToSchemaVersion1280(
insertStmt.run({
...rest,
id,
type: decoded.type ?? Proto.Envelope.Type.UNKNOWN,
type: isKnownProtoEnumMember(Proto.Envelope.Type, decoded.type)
? decoded.type
: Proto.Envelope.Type.UNKNOWN,
content: content ?? null,
isEncrypted: decrypted ? 0 : 1,
timestamp: timestamp || Date.now(),

View File

@@ -2,7 +2,6 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { callIdFromEra } from '@signalapp/ringrtc';
import Long from 'long';
import { v4 as generateUuid } from 'uuid';
import lodash from 'lodash';
@@ -156,7 +155,8 @@ function convertLegacyCallDetails(
}
timestamp = details.acceptedTime ?? details.endedTime ?? fallbackTimestamp;
} else if (mode === CallMode.Group) {
callId = Long.fromValue(callIdFromEra(details.eraId)).toString();
const callIdBigInt: bigint = callIdFromEra(details.eraId);
callId = callIdBigInt.toString();
type = CallType.Group;
direction =
details.creatorUuid === ourUuid