Open afharo opened 1 year ago
nit: Potential improvement: Probably using the repository is good enough (no need to instantiate the client).
_Originally posted by @afharo in https://github.com/elastic/kibana/pull/147631#discussion_r1049898673_
It feels like we are only creating the client to make TS happy. We should change the types of the helpers to expect SavedObjectsClientContract instead of SavedObjectsClient and we can use the repository then :)
SavedObjectsClientContract
SavedObjectsClient
Relevant lines of code: https://github.com/elastic/kibana/blob/0b87e90c1889c8318c3a08b401e063318d5f0585/src/plugins/telemetry/server/fetcher.ts#L90-L92
The idea is that we can use the SO repository straight away:
- this.internalRepository = new SavedObjectsClient( - savedObjects.createInternalRepository([TELEMETRY_SAVED_OBJECT_TYPE]) - ); + this.internalRepository = savedObjects.createInternalRepository([TELEMETRY_SAVED_OBJECT_TYPE]);
Pinging @elastic/kibana-core (Team:Core)
_Originally posted by @afharo in https://github.com/elastic/kibana/pull/147631#discussion_r1049898673_
It feels like we are only creating the client to make TS happy. We should change the types of the helpers to expect
SavedObjectsClientContract
instead ofSavedObjectsClient
and we can use the repository then :)Relevant lines of code: https://github.com/elastic/kibana/blob/0b87e90c1889c8318c3a08b401e063318d5f0585/src/plugins/telemetry/server/fetcher.ts#L90-L92
The idea is that we can use the SO repository straight away: