Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mshustov committed Mar 4, 2021
1 parent e59c56e commit 156ac91
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 83 deletions.
127 changes: 81 additions & 46 deletions api_docs/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -7985,22 +7985,11 @@
"id": "def-server.IContextContainer",
"type": "Interface",
"label": "IContextContainer",
"signature": [
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.IContextContainer",
"text": "IContextContainer"
},
"<THandler>"
],
"description": [
"\nAn object that handles registration of context providers and configuring handlers with context.\n"
],
"tags": [
"remarks",
"typeParam",
"public"
],
"children": [
Expand Down Expand Up @@ -8043,8 +8032,8 @@
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 154,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L154"
"lineNumber": 151,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L151"
}
},
{
Expand All @@ -8059,8 +8048,8 @@
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 155,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L155"
"lineNumber": 152,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L152"
}
},
{
Expand All @@ -8082,8 +8071,8 @@
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 156,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L156"
"lineNumber": 153,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L153"
}
}
],
Expand All @@ -8095,26 +8084,49 @@
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 153,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L153"
"lineNumber": 150,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L150"
}
},
{
"id": "def-server.IContextContainer.createHandler",
"type": "Function",
"label": "createHandler",
"signature": [
"(pluginOpaqueId: symbol, handler: THandler) => (...rest: ",
"(pluginOpaqueId: symbol, handler: ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.RequestHandler",
"text": "RequestHandler"
},
"<unknown, unknown, unknown, ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.HandlerParameters",
"text": "HandlerParameters"
"section": "def-server.RequestHandlerContext",
"text": "RequestHandlerContext"
},
", any, { custom: <T extends string | Record<string, any> | Error | { message: string | Error; attributes?: Record<string, any> | undefined; } | Buffer | ",
"Stream",
" | undefined>(options: ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.CustomHttpResponseOptions",
"text": "CustomHttpResponseOptions"
},
"<THandler>) => ",
"ShallowPromise",
"<ReturnType<THandler>>"
"<T>) => ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.KibanaResponse",
"text": "KibanaResponse"
}
],
"description": [
"\nCreate a new handler function pre-wired to context for the plugin.\n"
Expand All @@ -8132,42 +8144,74 @@
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 168,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L168"
"lineNumber": 165,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L165"
}
},
{
"type": "Function",
"label": "handler",
"isRequired": true,
"signature": [
"THandler"
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.RequestHandler",
"text": "RequestHandler"
},
"<unknown, unknown, unknown, ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.RequestHandlerContext",
"text": "RequestHandlerContext"
},
", any, { custom: <T extends string | Record<string, any> | Error | { message: string | Error; attributes?: Record<string, any> | undefined; } | Buffer | ",
"Stream",
" | undefined>(options: ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.CustomHttpResponseOptions",
"text": "CustomHttpResponseOptions"
},
"<T>) => ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.KibanaResponse",
"text": "KibanaResponse"
}
],
"description": [
"- Handler function to pass context object to."
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 169,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L169"
"lineNumber": 166,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L166"
}
}
],
"tags": [],
"returnComment": [
"A function that takes `THandlerParameters`, calls `handler` with a new context, and returns a Promise of\nthe `handler` return value."
"A function that takes `RequestHandler` parameters, calls `handler` with a new context, and returns a Promise of\nthe `handler` return value."
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 167,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L167"
"lineNumber": 164,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L164"
}
}
],
"source": {
"path": "src/core/server/context/container/context.ts",
"lineNumber": 138,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L138"
"lineNumber": 135,
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/context/container/context.ts#L135"
},
"initialIsOpen": false
},
Expand Down Expand Up @@ -16631,23 +16675,14 @@
"type": "Function",
"label": "createContextContainer",
"signature": [
"<THandler extends ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.HandlerFunction",
"text": "HandlerFunction"
},
"<any>>() => ",
"() => ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.IContextContainer",
"text": "IContextContainer"
},
"<THandler>"
}
],
"description": [
"\nCreates a new {@link IContextContainer} for a service owner."
Expand Down
29 changes: 4 additions & 25 deletions api_docs/core_http.json
Original file line number Diff line number Diff line change
Expand Up @@ -3725,9 +3725,9 @@
{
"pluginId": "core",
"scope": "server",
"docId": "kibCoreHttpPluginApi",
"section": "def-server.RequestHandlerContextContainer",
"text": "RequestHandlerContextContainer"
"docId": "kibCorePluginApi",
"section": "def-server.IContextContainer",
"text": "IContextContainer"
}
]
},
Expand Down Expand Up @@ -6509,28 +6509,7 @@
"link": "https://github.com/elastic/kibana/tree/mastersrc/core/server/http/types.ts#L30"
},
"signature": [
"IContextContainer<RequestHandler<unknown, unknown, unknown, RequestHandlerContext, any, { custom: <T extends string | Record<string, any> | Error | { message: string | Error; attributes?: Record<string, any> | undefined; } | Buffer | ",
"Stream",
" | undefined>(options: ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.CustomHttpResponseOptions",
"text": "CustomHttpResponseOptions"
},
"<T>) => ",
"KibanaResponse",
"<T>; badRequest: (options?: ",
{
"pluginId": "core",
"scope": "server",
"docId": "kibCorePluginApi",
"section": "def-server.ErrorHttpResponseOptions",
"text": "ErrorHttpResponseOptions"
},
") => ",
"KibanaResponse"
"IContextContainer"
],
"initialIsOpen": false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Creates a new [IContextContainer](./kibana-plugin-core-server.icontextcontainer.
<b>Signature:</b>

```typescript
createContextContainer<THandler extends HandlerFunction<any>>(): IContextContainer<THandler>;
createContextContainer(): IContextContainer;
```
<b>Returns:</b>

`IContextContainer<THandler>`
`IContextContainer`

Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ Create a new handler function pre-wired to context for the plugin.
<b>Signature:</b>

```typescript
createHandler(pluginOpaqueId: PluginOpaqueId, handler: THandler): (...rest: HandlerParameters<THandler>) => ShallowPromise<ReturnType<THandler>>;
createHandler(pluginOpaqueId: PluginOpaqueId, handler: RequestHandler): (...rest: HandlerParameters<RequestHandler>) => ShallowPromise<ReturnType<RequestHandler>>;
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| pluginOpaqueId | <code>PluginOpaqueId</code> | The plugin opaque ID for the plugin that registers this handler. |
| handler | <code>THandler</code> | Handler function to pass context object to. |
| handler | <code>RequestHandler</code> | Handler function to pass context object to. |

<b>Returns:</b>

`(...rest: HandlerParameters<THandler>) => ShallowPromise<ReturnType<THandler>>`
`(...rest: HandlerParameters<RequestHandler>) => ShallowPromise<ReturnType<RequestHandler>>`

A function that takes `THandlerParameters`<!-- -->, calls `handler` with a new context, and returns a Promise of the `handler` return value.
A function that takes `RequestHandler` parameters, calls `handler` with a new context, and returns a Promise of the `handler` return value.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ An object that handles registration of context providers and configuring handler
<b>Signature:</b>

```typescript
export interface IContextContainer<THandler extends RequestHandler>
export interface IContextContainer
```

## Remarks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ An object that handles registration of http request context providers.
<b>Signature:</b>

```typescript
export declare type RequestHandlerContextContainer = IContextContainer<RequestHandler>;
export declare type RequestHandlerContextContainer = IContextContainer;
```
8 changes: 4 additions & 4 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export { ConfigService }

// @public
export interface ContextSetup {
createContextContainer<THandler extends HandlerFunction<any>>(): IContextContainer<THandler>;
createContextContainer(): IContextContainer;
}

// @internal
Expand Down Expand Up @@ -1063,8 +1063,8 @@ export interface IClusterClient {
}

// @public
export interface IContextContainer<THandler extends RequestHandler> {
createHandler(pluginOpaqueId: PluginOpaqueId, handler: THandler): (...rest: HandlerParameters<THandler>) => ShallowPromise<ReturnType<THandler>>;
export interface IContextContainer {
createHandler(pluginOpaqueId: PluginOpaqueId, handler: RequestHandler): (...rest: HandlerParameters<RequestHandler>) => ShallowPromise<ReturnType<RequestHandler>>;
registerContext<Context extends RequestHandlerContext, ContextName extends keyof Context>(pluginOpaqueId: PluginOpaqueId, contextName: ContextName, provider: IContextProvider<Context, ContextName>): this;
}

Expand Down Expand Up @@ -1932,7 +1932,7 @@ export interface RequestHandlerContext {
}

// @public
export type RequestHandlerContextContainer = IContextContainer<RequestHandler>;
export type RequestHandlerContextContainer = IContextContainer;

// @public
export type RequestHandlerContextProvider<Context extends RequestHandlerContext, ContextName extends keyof Context> = IContextProvider<Context, ContextName>;
Expand Down

0 comments on commit 156ac91

Please sign in to comment.