// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors
// SPDX-License-Identifier: Apache-2.0
import type { Resource } from '@medplum/fhirtypes';
/**
* Cleans a resource of unwanted meta values.
* For most users, this will not matter, because meta values are set by the server.
* However, some administrative users are allowed to specify some meta values.
* The admin use case is special though, and unwanted here on the resource page.
* @param resource - The input resource.
* @returns The cleaned output resource.
*/
export function cleanResource(resource: Resource): Resource {
let meta = resource.meta;
if (meta) {
meta = {
...meta,
lastUpdated: undefined,
versionId: undefined,
author: undefined,
};
}
return {
...resource,
meta,
};
}