import { schema } from '@osd/config-schema' ; import { IRouter } from '../../http' ; export const registerBulkUpdateRoute = ( router ) => { router . put ( { path : '/_bulk_update' , validate : { body : schema . arrayOf ( schema . object ( { type : schema . string ( ) , id : schema . string ( ) , attributes : schema . recordOf ( schema . string ( ) , schema . any ( ) ) , version : schema . maybe ( schema . string ( ) ) , references : schema . maybe ( schema . arrayOf ( schema . object ( { name : schema . string ( ) , type : schema . string ( ) , id : schema . string ( ) , } ) ) ) , namespace : schema . maybe ( schema . string ( { minLength : 1 } ) ) , } ) ) , } , } , router . handleLegacyErrors ( async ( context , req , res ) => { const savedObject = await context . core . savedObjects . client . bulkUpdate ( req . body ) ; return res . ok ( { body : savedObject } ) ; } ) ) ; } ;