import { SavedObjectsClientContract , SavedObject } from 'src/core/server' ; import { SavedObjectsClientCommon , SavedObjectsClientCommonFindArgs , } from '../../common/index_patterns' ; export class SavedObjectsClientServerToCommon implements SavedObjectsClientCommon { private savedObjectClient : SavedObjectsClientContract ; constructor ( savedObjectClient ) { this . savedObjectClient = savedObjectClient ; } async find < T = unknown > ( options ) { const result = await this . savedObjectClient . find < T > ( options ) ; return result . saved_objects ; } async get < T = unknown > ( type , id ) { return await this . savedObjectClient . get < T > ( type , id ) ; } async update < T = unknown > ( type , id , attributes , options ) { return ( await this . savedObjectClient . update ( type , id , attributes , options ) ) as SavedObject < T > ; } async create ( type , attributes , options ) { return await this . savedObjectClient . create ( type , attributes , options ) ; } delete ( type , id ) { return this . savedObjectClient . delete ( type , id ) ; } }