chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import { isDeepStrictEqual } from 'node:util';
|
||||
|
||||
const TRACKED_FIELDS = [
|
||||
'code',
|
||||
'name',
|
||||
'commonName',
|
||||
'description',
|
||||
'type',
|
||||
'parent',
|
||||
'operationalArea',
|
||||
'operatorCompany',
|
||||
'informationStatus',
|
||||
'operationalStatus',
|
||||
'organizationProfile',
|
||||
'organizationMemberships',
|
||||
'externalIdentifiers',
|
||||
'sourceDocuments',
|
||||
'legalRights',
|
||||
'attributes',
|
||||
'geometry',
|
||||
'media',
|
||||
'provenance',
|
||||
] as const;
|
||||
|
||||
export function changedSnapshotFields(
|
||||
previous: Record<string, unknown> | null,
|
||||
current: Record<string, unknown>,
|
||||
): string[] {
|
||||
if (!previous) {
|
||||
return TRACKED_FIELDS.filter((field) => {
|
||||
const value = current[field];
|
||||
return value !== null && value !== undefined && !(
|
||||
Array.isArray(value) && value.length === 0
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
return TRACKED_FIELDS.filter(
|
||||
(field) => !isDeepStrictEqual(previous[field], current[field]),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user