Skip to content

Commit

Permalink
Adds info about accessing hidden SO types
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaHeiligers committed Nov 5, 2024
1 parent b5c8ed7 commit 1b7f4c6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dev_docs/tutorials/saved_objects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { SavedObjectsType } from 'src/core/server';

export const dashboardVisualization: SavedObjectsType = {
name: 'dashboard_visualization', [1]
hidden: true,
hidden: true, [3]
switchToModelVersionAt: '8.10.0', // this is the default, feel free to omit it unless you intend to switch to using model versions before 8.10.0
namespaceType: 'multiple-isolated', [2]
mappings: {
Expand Down Expand Up @@ -46,6 +46,9 @@ these should follow our API URL path convention and always be written in snake c
that objects of this type can only exist in a single space. See
<DocLink id="kibDevDocsSavedObjectsIntro" section="sharing-saved-objects" text="Sharing Saved Objects"/> for more information.

[3] This field determines whether repositories have access to the type by default. he hidden types will not be automatically exposed via the HTTP API.
Access a hidden type with a client that explicitly includes a list of hidden types `SavedObjectsClientProviderOptions[includedHiddenTypes]`.

**src/plugins/my_plugin/server/saved_objects/index.ts**

```ts
Expand Down Expand Up @@ -301,4 +304,4 @@ export const foo: SavedObjectsType = {

[1] Needs to be `false` to use the `hiddenFromHttpApis` option

[2] Set this to `true` to build your own HTTP API and have complete control over the route handler.
[2] Set this to `true` to build your own HTTP API and have complete control over the route handler.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ export interface SavedObjectsType<Attributes = any> {
* The hidden types will not be automatically exposed via the HTTP API.
* Therefore, that should prevent unexpected behavior in the client code, as all the interactions will be done via the plugin API.
*
* Access a hidden type with a client that explicitly includes a list of hidden types
*
* (await context.core).savedObjects.getClient({ includeHiddenTypes: [MY_PLUGIN_HIDDEN_SAVED_OBJECT_TYPE] })
*
* See {@link SavedObjectsServiceStart.createInternalRepository | createInternalRepository}.
*
*/
hidden: boolean;
/**
Expand Down

0 comments on commit 1b7f4c6

Please sign in to comment.