fix: additional backwards compat

This commit is contained in:
David Nguyen
2025-10-14 15:19:09 +11:00
parent bddaa5ec66
commit 0eef4cd7e6
32 changed files with 288 additions and 92 deletions

View File

@ -1,4 +1,6 @@
import type { Field } from '@prisma/client';
import { type Envelope, type Field } from '@prisma/client';
import { extractLegacyIds } from '../universal/id';
/**
* Sort the fields by the Y position on the document.
@ -63,3 +65,15 @@ export const validateFieldsUninserted = (): boolean => {
return errorElements.length === 0;
};
export const mapFieldToLegacyField = (
field: Field,
envelope: Pick<Envelope, 'type' | 'secondaryId'>,
) => {
const legacyId = extractLegacyIds(envelope);
return {
...field,
...legacyId,
};
};