-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
233 changed files
with
5,355 additions
and
3,449 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
load("@npm//@bazel/typescript:index.bzl", "ts_config") | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library") | ||
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project") | ||
|
||
PKG_DIRNAME = "core-http-server" | ||
PKG_REQUIRE_NAME = "@kbn/core-http-server" | ||
|
||
SOURCE_FILES = glob( | ||
[ | ||
"src/**/*.ts", | ||
], | ||
exclude = [ | ||
"**/*.test.*", | ||
"**/*.stories.*", | ||
], | ||
) | ||
|
||
SRCS = SOURCE_FILES | ||
|
||
filegroup( | ||
name = "srcs", | ||
srcs = SRCS, | ||
) | ||
|
||
NPM_MODULE_EXTRA_FILES = [ | ||
"package.json", | ||
] | ||
|
||
RUNTIME_DEPS = [ | ||
"//packages/kbn-config-schema", | ||
] | ||
|
||
TYPES_DEPS = [ | ||
"@npm//@types/node", | ||
"@npm//@types/jest", | ||
"@npm//rxjs", | ||
"@npm//@hapi/hapi", | ||
"@npm//@types/hapi__hapi", | ||
"@npm//@hapi/boom", | ||
"//packages/kbn-config-schema:npm_module_types", | ||
"//packages/kbn-utility-types:npm_module_types", | ||
"//packages/core/base/core-base-common:npm_module_types" | ||
] | ||
|
||
jsts_transpiler( | ||
name = "target_node", | ||
srcs = SRCS, | ||
build_pkg_name = package_name(), | ||
) | ||
|
||
ts_config( | ||
name = "tsconfig", | ||
src = "tsconfig.json", | ||
deps = [ | ||
"//:tsconfig.base.json", | ||
"//:tsconfig.bazel.json", | ||
], | ||
) | ||
|
||
ts_project( | ||
name = "tsc_types", | ||
args = ['--pretty'], | ||
srcs = SRCS, | ||
deps = TYPES_DEPS, | ||
declaration = True, | ||
emit_declaration_only = True, | ||
out_dir = "target_types", | ||
root_dir = "src", | ||
tsconfig = ":tsconfig", | ||
) | ||
|
||
js_library( | ||
name = PKG_DIRNAME, | ||
srcs = NPM_MODULE_EXTRA_FILES, | ||
deps = RUNTIME_DEPS + [":target_node"], | ||
package_name = PKG_REQUIRE_NAME, | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
pkg_npm( | ||
name = "npm_module", | ||
deps = [":" + PKG_DIRNAME], | ||
) | ||
|
||
filegroup( | ||
name = "build", | ||
srcs = [":npm_module"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
pkg_npm_types( | ||
name = "npm_module_types", | ||
srcs = SRCS, | ||
deps = [":tsc_types"], | ||
package_name = PKG_REQUIRE_NAME, | ||
tsconfig = ":tsconfig", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
filegroup( | ||
name = "build_types", | ||
srcs = [":npm_module_types"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# @kbn/core-http-server | ||
|
||
This package contains the public types for Core's server-side http service. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "@kbn/core-http-server", | ||
"private": true, | ||
"version": "1.0.0", | ||
"main": "./target_node/index.js", | ||
"license": "SSPL-1.0 OR Elastic License 2.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { KibanaRequest } from './router'; | ||
import type { AuthHeaders } from './lifecycle'; | ||
|
||
/** | ||
* Get headers to authenticate a user against Elasticsearch. | ||
* @param request {@link KibanaRequest} - an incoming request. | ||
* @return authentication headers {@link AuthHeaders} for - an incoming request. | ||
* @public | ||
* */ | ||
export type GetAuthHeaders = (request: KibanaRequest) => AuthHeaders | undefined; | ||
|
||
/** @public */ | ||
export type SetAuthHeaders = (request: KibanaRequest, headers: AuthHeaders) => void; | ||
|
||
/** @public */ | ||
export interface IAuthHeadersStorage { | ||
set: SetAuthHeaders; | ||
get: GetAuthHeaders; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { KibanaRequest } from './router'; | ||
|
||
/** | ||
* Status indicating an outcome of the authentication. | ||
* @public | ||
*/ | ||
export enum AuthStatus { | ||
/** | ||
* `auth` interceptor successfully authenticated a user | ||
*/ | ||
authenticated = 'authenticated', | ||
/** | ||
* `auth` interceptor failed user authentication | ||
*/ | ||
unauthenticated = 'unauthenticated', | ||
/** | ||
* `auth` interceptor has not been registered | ||
*/ | ||
unknown = 'unknown', | ||
} | ||
|
||
/** | ||
* Gets authentication state for a request. Returned by `auth` interceptor. | ||
* @param request {@link KibanaRequest} - an incoming request. | ||
* @public | ||
*/ | ||
export type GetAuthState = <T = unknown>( | ||
request: KibanaRequest | ||
) => { status: AuthStatus; state: T }; | ||
|
||
/** | ||
* Returns authentication status for a request. | ||
* @param request {@link KibanaRequest} - an incoming request. | ||
* @public | ||
*/ | ||
export type IsAuthenticated = (request: KibanaRequest) => boolean; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import type { KibanaRequest } from './router'; | ||
|
||
/** | ||
* Access or manipulate the Kibana base path | ||
* | ||
* @public | ||
*/ | ||
export interface IBasePath { | ||
/** | ||
* returns the server's basePath. | ||
* | ||
* See {@link IBasePath.get} for getting the basePath value for a specific request | ||
*/ | ||
readonly serverBasePath: string; | ||
|
||
/** | ||
* The server's publicly exposed base URL, if configured. Includes protocol, host, port (optional) and the | ||
* {@link IBasePath.serverBasePath}. | ||
* | ||
* @remarks | ||
* Should be used for generating external URL links back to this Kibana instance. | ||
*/ | ||
readonly publicBaseUrl?: string; | ||
|
||
/** | ||
* returns `basePath` value, specific for an incoming request. | ||
*/ | ||
get(request: KibanaRequest): string; | ||
|
||
/** | ||
* sets `basePath` value, specific for an incoming request. | ||
*/ | ||
set(request: KibanaRequest, requestSpecificBasePath: string): void; | ||
|
||
/** | ||
* Prepends `path` with the basePath. | ||
*/ | ||
prepend(path: string): string; | ||
|
||
/** | ||
* Removes the prepended basePath from the `path`. | ||
*/ | ||
remove(path: string): string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
/** | ||
* CSP configuration for use in Kibana. | ||
* @public | ||
*/ | ||
export interface ICspConfig { | ||
/** | ||
* Specify whether browsers that do not support CSP should be | ||
* able to use Kibana. Use `true` to block and `false` to allow. | ||
*/ | ||
readonly strict: boolean; | ||
|
||
/** | ||
* Specify whether users with legacy browsers should be warned | ||
* about their lack of Kibana security compliance. | ||
*/ | ||
readonly warnLegacyBrowsers: boolean; | ||
|
||
/** | ||
* Whether or not embedding (using iframes) should be allowed by the CSP. If embedding is disabled, a restrictive 'frame-ancestors' rule will be added to the default CSP rules. | ||
*/ | ||
readonly disableEmbedding: boolean; | ||
|
||
/** | ||
* The CSP rules in a formatted directives string for use | ||
* in a `Content-Security-Policy` header. | ||
*/ | ||
readonly header: string; | ||
} |
Oops, something went wrong.