kibana/examples/content_management_examples
Anton Dosov 0936601686
[Content Management] Cross Type Search (savedObjects.find() based) (#154464)
## Summary

Partially addresses https://github.com/elastic/kibana/issues/152224
[Tech Doc
(private)](https://docs.google.com/document/d/1ssYmqSEUPrsuCR4iz8DohkEWekoYrm2yL4QR_fVxXLg/edit#heading=h.6sj4n6bjcgp5)

Introduce `mSearch` - temporary cross-content type search layer for
content management backed by `savedObjects.find`

Until we have [a dedicated search layer in CM
services](https://docs.google.com/document/d/1mTa1xJIr8ttRnhkHcbdyLSpNJDL1FPJ3OyK4xnOsmnQ/edit),
we want to provide a temporary solution to replace client-side or naive
server proxy usages of `savedObjects.find()` across multiple types with
Content Management API to prepare these places for backward
compatibility compliance.

Later we plan to use the new API together with shared components that
work across multiple types like `SavedObjectFinder` or `TableListView`

The api would only work with content types that use saved objects as a
backend.

To opt-in a saved object backed content type to `mSearch` need to
provide `MSearchConfig` on `ContentStorage`:

```
export class MapsStorage implements ContentStorage<Map> {
  // ... 
  mSearch: {
          savedObjectType: 'maps',
          toItemResult: (ctx: StorageContext, mapsSavedObject: SavedObject<MapsAttributes>) => toMap(ctx,mapsSavedObject), // transform, validate, version
          additionalSearchFields: ['something-maps-specific'],
        }
}
```


*Out of scope of this PR:*

- tags search (will follow up shortly)
- pagination (as described in [the doc]([Tech
Doc](https://docs.google.com/document/d/1ssYmqSEUPrsuCR4iz8DohkEWekoYrm2yL4QR_fVxXLg/edit#heading=h.6sj4n6bjcgp5))
server-side pagination is not needed for the first consumers, but will
follow up shortly)
- end-to-end / integration testing (don't want to introduce a dummy
saved object for testing this, instead plan to wait for maps CM onboard
and test using maps https://github.com/elastic/kibana/pull/153304)
- Documentation (will add into
https://github.com/elastic/kibana/pull/154453)
- Add rxjs and hook method
2023-04-06 17:15:56 +02:00
..
.storybook [CM] Example plugin with server-side registry usage (#151885) 2023-02-28 14:57:57 +01:00
common/examples/todos [CM] Improve CRUD & RPC interfaces (#154150) 2023-04-04 08:20:11 -07:00
public [Content Management] Cross Type Search (savedObjects.find() based) (#154464) 2023-04-06 17:15:56 +02:00
server [CM] Improve CRUD & RPC interfaces (#154150) 2023-04-04 08:20:11 -07:00
jest.config.js [CM] Example plugin with server-side registry usage (#151885) 2023-02-28 14:57:57 +01:00
kibana.jsonc [CM] Example plugin with server-side registry usage (#151885) 2023-02-28 14:57:57 +01:00
README.md [CM] Example plugin with server-side registry usage (#151885) 2023-02-28 14:57:57 +01:00
tsconfig.json [CM] Improve CRUD & RPC interfaces (#154150) 2023-04-04 08:20:11 -07:00

Content Management Examples

An example plugin that shows how to integrate with the Kibana "content management" plugin.