Files
Desktop/ts/jobs/formatJobForInsert.std.ts
Fedor Indutny 44076ece79 Rename files
2025-10-16 23:45:44 -07:00

20 lines
552 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ParsedJob, StoredJob } from './types.std.js';
/**
* Format a job to be inserted into the database.
*
* Notably, `Job` instances (which have a promise attached) cannot be serialized without
* some cleanup. That's what this function is most useful for.
*/
export const formatJobForInsert = (
job: Readonly<StoredJob | ParsedJob<unknown>>
): StoredJob => ({
id: job.id,
timestamp: job.timestamp,
queueType: job.queueType,
data: job.data,
});