-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Server saved objects client through request context #44143
Conversation
Pinging @elastic/kibana-platform |
💔 Build Failed |
💔 Build Failed |
69d32de
to
5747758
Compare
💚 Build Succeeded |
5747758
to
25e8fb3
Compare
💔 Build Failed |
25e8fb3
to
08e8a40
Compare
💔 Build Failed |
💚 Build Succeeded |
And use the saved objects mappings instead
💔 Build Failed |
💔 Build Failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits
src/core/server/saved_objects/migrations/kibana/__mocks__/kibana_migrator.ts
Outdated
Show resolved
Hide resolved
} as unknown) as SavedObjectsSetupDeps; | ||
|
||
const savedObjectsSetup = await soService.setup(coreSetup); | ||
expect(savedObjectsSetup.clientProvider).toBeInstanceOf(SavedObjectsClientProvider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript guarantees this. Doesn't it?
@@ -56,7 +56,7 @@ describe('Search service', () => { | |||
|
|||
registerSearchRoute(routerMock); | |||
const handler = routerMock.post.mock.calls[0][1]; | |||
await handler(mockContext, mockRequest, mockResponse); | |||
await handler((mockContext as unknown) as RequestHandlerContext, mockRequest, mockResponse); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we provide RequestHandlerContextMock
? can be done as a follow up
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppArch changes LGTM
💔 Build Failed |
💚 Build Succeeded |
* Expose Saved Objects client in request context * API Integration test for savedobjects in req context * SavedObjectsClient docs * SavedObjectsClient#find remove dependency on indexPatterns And use the saved objects mappings instead * Review comments * Review comments, fixes and tests * Use correct type for KQL syntax check
* Expose Saved Objects client in request context * API Integration test for savedobjects in req context * SavedObjectsClient docs * SavedObjectsClient#find remove dependency on indexPatterns And use the saved objects mappings instead * Review comments * Review comments, fixes and tests * Use correct type for KQL syntax check
Summary
Expose the Saved Objects client to server-side plugins through the request handler context.
Since this moves the Saved Objects Client Provider into Core I also had to fix #47012 as part of this work. SavedObjects#find with KQL filtering no longer depends on indexPatterns.
KQL uses indexPatterns only for creating queries against scripted fields or optimizing queries where all fields in the index should be returned. Neither of these are relevant to SavedObjects#find. In the future KQL is likely to become more dependant on indexPatterns but I'd rather wait till we have a valuable use case before introducing this dependency.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.For maintainers