Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TelemetrySavedObjectsClient: Extend createPointInTimeFinder to request all namespaces by default #6

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
*/

import type { SavedObjectsFindOptions, SavedObjectsFindResponse } from 'src/core/server';
import { SavedObjectsClient } from '../../../core/server';
import {
ISavedObjectsPointInTimeFinder,
SavedObjectsClient,
SavedObjectsCreatePointInTimeFinderDependencies,
SavedObjectsCreatePointInTimeFinderOptions,
} from '../../../core/server';

/**
* Extends the SavedObjectsClient to fit the telemetry fetching requirements (i.e.: find objects from all namespaces by default)
Expand All @@ -22,4 +27,16 @@ export class TelemetrySavedObjectsClient extends SavedObjectsClient {
): Promise<SavedObjectsFindResponse<T, A>> {
return super.find({ namespaces: ['*'], ...options });
}

/**
* Extends {@link SavedObjectsClient.createPointInTimeFinder} by performing the request to all the Spaces by default
* @param findOptions
* @param dependencies
*/
createPointInTimeFinder(
findOptions: SavedObjectsCreatePointInTimeFinderOptions,
dependencies?: SavedObjectsCreatePointInTimeFinderDependencies
): ISavedObjectsPointInTimeFinder {
return super.createPointInTimeFinder({ namespaces: ['*'], ...findOptions }, dependencies);
}
}