You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
import type { ExportMaskPolicy } from "../../constants/export";
|
|
|
|
type ExportManifestStats = {
|
|
dataRows: number;
|
|
files: number;
|
|
bytes: number;
|
|
};
|
|
|
|
export type ExportManifest = {
|
|
schemaVersion: number;
|
|
exportedAt: string;
|
|
exportCutoffAt: string;
|
|
userId: number;
|
|
maskPolicy: ExportMaskPolicy;
|
|
stats: ExportManifestStats;
|
|
checksums: {
|
|
data: Array<{ file: string; sha256: string }>;
|
|
files: Array<{ file: string; sha256: string }>;
|
|
};
|
|
};
|
|
|
|
export function buildExportManifest(params: {
|
|
schemaVersion: number;
|
|
userId: number;
|
|
maskPolicy: ExportMaskPolicy;
|
|
exportedAt: Date;
|
|
exportCutoffAt: Date;
|
|
stats: ExportManifestStats;
|
|
dataChecksums: Array<{ file: string; sha256: string }>;
|
|
fileChecksums: Array<{ file: string; sha256: string }>;
|
|
}): ExportManifest {
|
|
return {
|
|
schemaVersion: params.schemaVersion,
|
|
exportedAt: params.exportedAt.toISOString(),
|
|
exportCutoffAt: params.exportCutoffAt.toISOString(),
|
|
userId: params.userId,
|
|
maskPolicy: params.maskPolicy,
|
|
stats: params.stats,
|
|
checksums: {
|
|
data: params.dataChecksums,
|
|
files: params.fileChecksums,
|
|
},
|
|
};
|
|
}
|
|
|