mirror of
https://github.com/strapi/strapi.git
synced 2025-08-13 19:27:34 +00:00
28 lines
656 B
TypeScript
28 lines
656 B
TypeScript
import type { Schema } from '@strapi/strapi';
|
|
import { mapValues, pick } from 'lodash/fp';
|
|
|
|
/**
|
|
* List of schema properties that should be kept when sanitizing schemas
|
|
*/
|
|
const VALID_SCHEMA_PROPERTIES = [
|
|
'collectionName',
|
|
'info',
|
|
'options',
|
|
'pluginOptions',
|
|
'attributes',
|
|
'kind',
|
|
'modelType',
|
|
'modelName',
|
|
'uid',
|
|
'plugin',
|
|
'globalId',
|
|
];
|
|
|
|
/**
|
|
* Sanitize a schemas dictionnary by omiting unwanted properties
|
|
* The list of allowed properties can be found here: {@link VALID_SCHEMA_PROPERTIES}
|
|
*/
|
|
export const mapSchemasValues = (schemas: Record<string, Schema>) => {
|
|
return mapValues(pick(VALID_SCHEMA_PROPERTIES), schemas);
|
|
};
|