[CM] Setup client side content client#150171
Conversation
| @@ -0,0 +1,72 @@ | |||
| /* | |||
There was a problem hiding this comment.
This file is copy paste from the server-side POC #148791.
Assuming this won't change much when initial server-side is merged to main. Also won't be a problem if this is changed a lot
| import { API_ENDPOINT } from '../../common'; | ||
| import type { GetIn, CreateIn, ProcedureName } from '../../common'; | ||
|
|
||
| export class RpcClient { |
There was a problem hiding this comment.
This file is copy paste from the server-side POC #148791.
Assuming this won't change much when initial server-side is merged to main. Also won't be a problem if this is changed a lot
|
Pinging @elastic/appex-sharedux (Team:SharedUX) |
|
@elasticmachine merge upstream |
…na into d/2023-02-02-cm-setup-client
|
@elasticmachine merge upstream |
src/plugins/content_management/public/content_client/content_client.tsx
Outdated
Show resolved
Hide resolved
| it('calls rpcClient.get with input and returns output', async () => { | ||
| const input: GetIn = { id: 'test', contentType: 'testType' }; | ||
| const output = { test: 'test' }; | ||
| rpcClient.get.mockImplementation(() => Promise.resolve(output)); |
There was a problem hiding this comment.
nit: could be rpcClient.get.mockResolvedValueOnce(output);
| import { createRpcClientMock } from '../rpc_client/rpc_client.mock'; | ||
| import { ContentClient } from './content_client'; | ||
| import type { GetIn, CreateIn } from '../../common'; | ||
| import { lastValueFrom } from 'rxjs'; |
There was a problem hiding this comment.
nit: can we put absolute imports above relative ones?
There was a problem hiding this comment.
Was it supposed to be linted? 🤔
| ); | ||
|
|
||
| describe('useCreateContentMutation', () => { | ||
| test('should call rpcClient.get with input and resolve with output', async () => { |
There was a problem hiding this comment.
nit: ... "rpcClient.create"
| public start() { | ||
| return {}; | ||
| public start(core: CoreStart, deps: StartDependencies) { | ||
| // don't actually expose the client until it is used to avoid increasing bundle size |
|
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Public APIs missing exports
Page load bundle
History
To update your PR or re-run it, just comment with: |
…hods (#151041) Nothing to write home about - just a bit more boilerplate setup code. Method signatures and RPC related interfaces are expected to be changed later with an initial RPC layer implementation. - Follow-up to #150171, adding a dummy setup for `update` `delete` and `search` methods. **The `IN` and `OUT` args will be changes when we glue these to the rpc service and its types** - Also clean up unit tests a bit to have setup logic contained in a helper instead of scattered in global scope
…hods (elastic#151041) Nothing to write home about - just a bit more boilerplate setup code. Method signatures and RPC related interfaces are expected to be changed later with an initial RPC layer implementation. - Follow-up to elastic#150171, adding a dummy setup for `update` `delete` and `search` methods. **The `IN` and `OUT` args will be changes when we glue these to the rpc service and its types** - Also clean up unit tests a bit to have setup logic contained in a helper instead of scattered in global scope
Summary
Partially addresses #149216, #149939
Closes #149217
Setup basic client-side content client (client, cache, react content and hooks) based on the latest API from @sebelga's server-side and rpc POC. We assume that the POC isn't far from the initial version that we are going to merge to main
The client side content client is based on the proposal described in private doc
Initial content client implementation scope: