You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import {
|
|
AsyncObjectWrapper,
|
|
ConfigDumpDataNode,
|
|
ConfigDumpRow,
|
|
ConfigDumpRowWithoutData,
|
|
} from '../../types/sqlSharedTypes';
|
|
import { ConfigWrapperObjectTypes } from '../../webworker/workers/browser/libsession_worker_functions';
|
|
import { channels } from '../channels';
|
|
|
|
export const ConfigDumpData: AsyncObjectWrapper<ConfigDumpDataNode> = {
|
|
getByVariantAndPubkey: (variant: ConfigWrapperObjectTypes, pubkey: string) => {
|
|
return channels.getByVariantAndPubkey(variant, pubkey);
|
|
},
|
|
getMessageHashesByVariantAndPubkey: (variant: ConfigWrapperObjectTypes, pubkey: string) => {
|
|
return channels.getMessageHashesByVariantAndPubkey(variant, pubkey);
|
|
},
|
|
saveConfigDump: (dump: ConfigDumpRow) => {
|
|
console.warn('saveConfigDump', dump);
|
|
if (dump.combinedMessageHashes.some(m => Boolean(m && m.length < 5))) {
|
|
throw new Error('saveConfigDump combinedMessageHashes have invalid size');
|
|
}
|
|
return channels.saveConfigDump(dump);
|
|
},
|
|
saveCombinedMessageHashesForMatching: (dump: ConfigDumpRowWithoutData) => {
|
|
console.warn('saveCombinedMessageHashesForMatching', dump);
|
|
return channels.saveCombinedMessageHashesForMatching(dump);
|
|
},
|
|
getAllDumpsWithData: () => {
|
|
return channels.getAllDumpsWithData();
|
|
},
|
|
getAllDumpsWithoutData: () => {
|
|
return channels.getAllDumpsWithoutData();
|
|
},
|
|
getCombinedHashesByVariantAndPubkey: (variant: ConfigWrapperObjectTypes, pubkey: string) => {
|
|
return channels.getCombinedHashesByVariantAndPubkey(variant, pubkey);
|
|
},
|
|
};
|