parent
dee1841f6c
commit
df4f66b4ac
34
package.json
34
package.json
|
@ -74,6 +74,10 @@
|
|||
"url": "https://github.com/elastic/kibana.git"
|
||||
},
|
||||
"resolutions": {
|
||||
"**/@hapi/iron": "^5.1.4",
|
||||
"**/@types/hapi__boom": "^7.4.1",
|
||||
"**/@types/hapi__hapi": "^18.2.6",
|
||||
"**/@types/hapi__mimos": "4.1.0",
|
||||
"**/@types/node": ">=10.17.17 <10.20.0",
|
||||
"**/cross-fetch/node-fetch": "^2.6.1",
|
||||
"**/deepmerge": "^4.2.2",
|
||||
|
@ -121,7 +125,16 @@
|
|||
"@elastic/numeral": "^2.5.0",
|
||||
"@elastic/request-crypto": "1.1.4",
|
||||
"@elastic/safer-lodash-set": "0.0.0",
|
||||
"@hapi/boom": "^7.4.11",
|
||||
"@hapi/cookie": "^10.1.2",
|
||||
"@hapi/good-squeeze": "5.2.1",
|
||||
"@hapi/h2o2": "^8.3.2",
|
||||
"@hapi/hapi": "^18.4.1",
|
||||
"@hapi/hoek": "^8.5.1",
|
||||
"@hapi/inert": "^5.2.2",
|
||||
"@hapi/podium": "^3.4.3",
|
||||
"@hapi/statehood": "^6.1.2",
|
||||
"@hapi/vision": "^5.5.4",
|
||||
"@hapi/wreck": "^15.0.2",
|
||||
"@kbn/ace": "1.0.0",
|
||||
"@kbn/analytics": "1.0.0",
|
||||
|
@ -144,7 +157,6 @@
|
|||
"angular-elastic": "^2.5.1",
|
||||
"angular-sanitize": "^1.8.0",
|
||||
"bluebird": "3.5.5",
|
||||
"boom": "^7.2.0",
|
||||
"chalk": "^4.1.0",
|
||||
"check-disk-space": "^2.1.0",
|
||||
"chokidar": "^3.4.2",
|
||||
|
@ -164,15 +176,10 @@
|
|||
"glob": "^7.1.2",
|
||||
"glob-all": "^3.2.1",
|
||||
"globby": "^8.0.1",
|
||||
"h2o2": "^8.1.2",
|
||||
"handlebars": "4.7.6",
|
||||
"hapi": "^17.5.3",
|
||||
"hapi-auth-cookie": "^9.0.0",
|
||||
"hjson": "3.2.1",
|
||||
"hoek": "^5.0.4",
|
||||
"http-proxy-agent": "^2.1.0",
|
||||
"https-proxy-agent": "^5.0.0",
|
||||
"inert": "^5.1.0",
|
||||
"inline-style": "^2.0.0",
|
||||
"joi": "^13.5.2",
|
||||
"js-yaml": "^3.14.0",
|
||||
|
@ -216,7 +223,6 @@
|
|||
"tslib": "^2.0.0",
|
||||
"type-detect": "^4.0.8",
|
||||
"uuid": "3.3.2",
|
||||
"vision": "^5.3.3",
|
||||
"whatwg-fetch": "^3.0.0",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
|
@ -270,7 +276,6 @@
|
|||
"@types/archiver": "^3.1.0",
|
||||
"@types/babel__core": "^7.1.10",
|
||||
"@types/bluebird": "^3.1.1",
|
||||
"@types/boom": "^7.2.0",
|
||||
"@types/chance": "^1.0.0",
|
||||
"@types/cheerio": "^0.22.10",
|
||||
"@types/chromedriver": "^81.0.0",
|
||||
|
@ -290,14 +295,16 @@
|
|||
"@types/glob": "^7.1.2",
|
||||
"@types/globby": "^8.0.0",
|
||||
"@types/graphql": "^0.13.2",
|
||||
"@types/h2o2": "^8.1.1",
|
||||
"@types/hapi": "^17.0.18",
|
||||
"@types/hapi-auth-cookie": "^9.1.0",
|
||||
"@types/hapi__boom": "^7.4.1",
|
||||
"@types/hapi__cookie": "^10.1.1",
|
||||
"@types/hapi__h2o2": "8.3.0",
|
||||
"@types/hapi__hapi": "^18.2.6",
|
||||
"@types/hapi__hoek": "^6.2.0",
|
||||
"@types/hapi__inert": "^5.2.1",
|
||||
"@types/hapi__podium": "^3.4.1",
|
||||
"@types/has-ansi": "^3.0.0",
|
||||
"@types/history": "^4.7.3",
|
||||
"@types/hjson": "^2.4.2",
|
||||
"@types/hoek": "^4.1.3",
|
||||
"@types/inert": "^5.1.2",
|
||||
"@types/jest": "^26.0.14",
|
||||
"@types/jest-when": "^2.7.1",
|
||||
"@types/joi": "^13.4.2",
|
||||
|
@ -322,7 +329,6 @@
|
|||
"@types/opn": "^5.1.0",
|
||||
"@types/pegjs": "^0.10.1",
|
||||
"@types/pngjs": "^3.4.0",
|
||||
"@types/podium": "^1.0.0",
|
||||
"@types/prop-types": "^15.7.3",
|
||||
"@types/reach__router": "^1.2.6",
|
||||
"@types/react": "^16.9.36",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import { Action } from 'history';
|
||||
import { ApiResponse } from '@elastic/elasticsearch/lib/Transport';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ConfigPath } from '@kbn/config';
|
||||
import { EnvironmentMode } from '@kbn/config';
|
||||
import { EuiBreadcrumb } from '@elastic/eui';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { LegacyElasticsearchErrorHelpers } from './errors';
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { get } from 'lodash';
|
||||
|
||||
const code = Symbol('ElasticsearchError');
|
||||
|
|
|
@ -22,8 +22,8 @@ import { Agent as HttpsAgent, ServerOptions as TlsOptions } from 'https';
|
|||
|
||||
import apm from 'elastic-apm-node';
|
||||
import { ByteSizeValue } from '@kbn/config-schema';
|
||||
import { Server, Request } from 'hapi';
|
||||
import HapiProxy from 'h2o2';
|
||||
import { Server, Request } from '@hapi/hapi';
|
||||
import HapiProxy from '@hapi/h2o2';
|
||||
import { sampleSize } from 'lodash';
|
||||
import * as Rx from 'rxjs';
|
||||
import { take } from 'rxjs/operators';
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Request, Server } from 'hapi';
|
||||
import hapiAuthCookie from 'hapi-auth-cookie';
|
||||
import { Request, Server } from '@hapi/hapi';
|
||||
import hapiAuthCookie from '@hapi/cookie';
|
||||
// @ts-expect-error no TS definitions
|
||||
import Statehood from 'statehood';
|
||||
import Statehood from '@hapi/statehood';
|
||||
|
||||
import { KibanaRequest, ensureRawRequest } from './router';
|
||||
import { SessionStorageFactory, SessionStorage } from './session_storage';
|
||||
|
@ -80,7 +80,7 @@ class ScopedCookieSessionStorage<T extends Record<string, any>> implements Sessi
|
|||
const session = await this.server.auth.test('security-cookie', this.request);
|
||||
// A browser can send several cookies, if it's not an array, just return the session value
|
||||
if (!Array.isArray(session)) {
|
||||
return session as T;
|
||||
return session.credentials as T;
|
||||
}
|
||||
|
||||
// If we have an array with one value, we're good also
|
||||
|
@ -141,20 +141,22 @@ export async function createCookieSessionStorageFactory<T>(
|
|||
await server.register({ plugin: hapiAuthCookie });
|
||||
|
||||
server.auth.strategy('security-cookie', 'cookie', {
|
||||
cookie: cookieOptions.name,
|
||||
password: cookieOptions.encryptionKey,
|
||||
validateFunc: async (req, session: T | T[]) => {
|
||||
cookie: {
|
||||
name: cookieOptions.name,
|
||||
password: cookieOptions.encryptionKey,
|
||||
isSecure: cookieOptions.isSecure,
|
||||
path: basePath === undefined ? '/' : basePath,
|
||||
clearInvalid: false,
|
||||
isHttpOnly: true,
|
||||
isSameSite: cookieOptions.sameSite === 'None' ? false : cookieOptions.sameSite ?? false,
|
||||
},
|
||||
validateFunc: async (req: Request, session: T | T[]) => {
|
||||
const result = cookieOptions.validate(session);
|
||||
if (!result.isValid) {
|
||||
clearInvalidCookie(req, result.path);
|
||||
}
|
||||
return { valid: result.isValid };
|
||||
},
|
||||
isSecure: cookieOptions.isSecure,
|
||||
path: basePath,
|
||||
clearInvalid: false,
|
||||
isHttpOnly: true,
|
||||
isSameSite: cookieOptions.sameSite === 'None' ? false : cookieOptions.sameSite ?? false,
|
||||
});
|
||||
|
||||
// A hack to support SameSite: 'None'.
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { parse as parseUrl } from 'url';
|
||||
import { Request } from 'hapi';
|
||||
import { URL, format as formatUrl } from 'url';
|
||||
import { Request } from '@hapi/hapi';
|
||||
import { merge } from 'lodash';
|
||||
import { Socket } from 'net';
|
||||
import { stringify } from 'query-string';
|
||||
|
@ -73,7 +73,7 @@ function createKibanaRequestMock<P = any, Q = any, B = any>({
|
|||
auth = { isAuthenticated: true },
|
||||
}: RequestFixtureOptions<P, Q, B> = {}) {
|
||||
const queryString = stringify(query, { sort: false });
|
||||
const url = parseUrl(`${path}${queryString ? `?${queryString}` : ''}`);
|
||||
const url = new URL(`${path}${queryString ? `?${queryString}` : ''}`, 'http://localhost');
|
||||
|
||||
return KibanaRequest.from<P, Q, B>(
|
||||
createRawRequestMock({
|
||||
|
@ -87,6 +87,9 @@ function createKibanaRequestMock<P = any, Q = any, B = any>({
|
|||
method,
|
||||
url,
|
||||
route: {
|
||||
// @ts-expect-error According to types/hapi__hapi the following settings-fields have problems:
|
||||
// - `auth` can't be a boolean, but it can according to the @hapi/hapi source (https://github.com/hapijs/hapi/blob/v18.4.2/lib/route.js#L139)
|
||||
// - `app` isn't a valid property, but it is and this was fixed in the types in v19.0.1 (https://github.com/DefinitelyTyped/DefinitelyTyped/pull/41968)
|
||||
settings: { tags: routeTags, auth: routeAuthRequired, app: kibanaRouteOptions },
|
||||
},
|
||||
raw: {
|
||||
|
@ -120,9 +123,11 @@ type DeepPartialObject<T> = { [P in keyof T]+?: DeepPartial<T[P]> };
|
|||
function createRawRequestMock(customization: DeepPartial<Request> = {}) {
|
||||
const pathname = customization.url?.pathname || '/';
|
||||
const path = `${pathname}${customization.url?.search || ''}`;
|
||||
const url = Object.assign({ pathname, path, href: path }, customization.url);
|
||||
const url = new URL(
|
||||
formatUrl(Object.assign({ pathname, path, href: path }, customization.url)),
|
||||
'http://localhost'
|
||||
);
|
||||
|
||||
// @ts-expect-error _core isn't supposed to be accessed - remove once we upgrade to hapi v18
|
||||
return merge(
|
||||
{},
|
||||
{
|
||||
|
@ -140,12 +145,6 @@ function createRawRequestMock(customization: DeepPartial<Request> = {}) {
|
|||
socket: {},
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
},
|
||||
customization
|
||||
) as Request;
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { Server } from 'hapi';
|
||||
import HapiStaticFiles from 'inert';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import HapiStaticFiles from '@hapi/inert';
|
||||
import url from 'url';
|
||||
import uuid from 'uuid';
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
|
||||
import { CspConfig } from '../csp';
|
||||
|
@ -88,6 +88,7 @@ const createInternalSetupContractMock = () => {
|
|||
start: jest.fn(),
|
||||
stop: jest.fn(),
|
||||
config: jest.fn().mockReturnValue(configMock.create()),
|
||||
// @ts-expect-error somehow it thinks that `Server` isn't a `Construtable`
|
||||
} as unknown) as jest.MockedClass<Server>,
|
||||
createCookieSessionStorageFactory: jest.fn(),
|
||||
registerOnPreRouting: jest.fn(),
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { Observable, Subscription, combineLatest } from 'rxjs';
|
||||
import { first, map } from 'rxjs/operators';
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import { pick } from '@kbn/std';
|
||||
|
||||
import { CoreService } from '../../types';
|
||||
|
|
|
@ -31,7 +31,7 @@ jest.mock('uuid', () => ({
|
|||
}));
|
||||
|
||||
import supertest from 'supertest';
|
||||
import { Request, ResponseToolkit } from 'hapi';
|
||||
import { Request, ResponseToolkit } from '@hapi/hapi';
|
||||
import Joi from 'joi';
|
||||
|
||||
import {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Lifecycle, Request, ResponseToolkit, Server, ServerOptions, Util } from 'hapi';
|
||||
import Hoek from 'hoek';
|
||||
import { Lifecycle, Request, ResponseToolkit, Server, ServerOptions, Util } from '@hapi/hapi';
|
||||
import Hoek from '@hapi/hoek';
|
||||
import { ServerOptions as TLSOptions } from 'https';
|
||||
import { ValidationError } from 'joi';
|
||||
import uuid from 'uuid';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Request, ResponseToolkit, Server } from 'hapi';
|
||||
import { Request, ResponseToolkit, Server } from '@hapi/hapi';
|
||||
import { format as formatUrl } from 'url';
|
||||
|
||||
import { Logger } from '../logging';
|
||||
|
|
|
@ -23,8 +23,8 @@ import {
|
|||
legacyClusterClientInstanceMock,
|
||||
} from './core_service.test.mocks';
|
||||
|
||||
import Boom from 'boom';
|
||||
import { Request } from 'hapi';
|
||||
import Boom from '@hapi/boom';
|
||||
import { Request } from '@hapi/hapi';
|
||||
import { errors as esErrors } from 'elasticsearch';
|
||||
import { LegacyElasticsearchErrorHelpers } from '../../elasticsearch/legacy';
|
||||
|
||||
|
|
|
@ -124,6 +124,54 @@ describe('KibanaRequest', () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('route options', () => {
|
||||
describe('authRequired', () => {
|
||||
it('returns false if a route configured with "authRequired": false', async () => {
|
||||
const { server: innerServer, createRouter, registerAuth } = await server.setup(setupDeps);
|
||||
registerAuth((req, res, t) => t.authenticated());
|
||||
const router = createRouter('/');
|
||||
router.get(
|
||||
{ path: '/', validate: false, options: { authRequired: false } },
|
||||
(context, req, res) => res.ok({ body: { authRequired: req.route.options.authRequired } })
|
||||
);
|
||||
await server.start();
|
||||
|
||||
await supertest(innerServer.listener).get('/').expect(200, {
|
||||
authRequired: false,
|
||||
});
|
||||
});
|
||||
it('returns "optional" if a route configured with "authRequired": optional', async () => {
|
||||
const { server: innerServer, createRouter, registerAuth } = await server.setup(setupDeps);
|
||||
registerAuth((req, res, t) => t.authenticated());
|
||||
const router = createRouter('/');
|
||||
router.get(
|
||||
{ path: '/', validate: false, options: { authRequired: 'optional' } },
|
||||
(context, req, res) => res.ok({ body: { authRequired: req.route.options.authRequired } })
|
||||
);
|
||||
await server.start();
|
||||
|
||||
await supertest(innerServer.listener).get('/').expect(200, {
|
||||
authRequired: 'optional',
|
||||
});
|
||||
});
|
||||
it('returns true if a route configured with "authRequired": true', async () => {
|
||||
const { server: innerServer, createRouter, registerAuth } = await server.setup(setupDeps);
|
||||
registerAuth((req, res, t) => t.authenticated());
|
||||
const router = createRouter('/');
|
||||
router.get(
|
||||
{ path: '/', validate: false, options: { authRequired: true } },
|
||||
(context, req, res) => res.ok({ body: { authRequired: req.route.options.authRequired } })
|
||||
);
|
||||
await server.start();
|
||||
|
||||
await supertest(innerServer.listener).get('/').expect(200, {
|
||||
authRequired: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('events', () => {
|
||||
describe('aborted$', () => {
|
||||
it('emits once and completes when request aborted', async (done) => {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
import { Stream } from 'stream';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import supertest from 'supertest';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
|
@ -769,7 +769,7 @@ describe('Response factory', () => {
|
|||
await supertest(innerServer.listener).get('/').expect(200);
|
||||
});
|
||||
|
||||
it('supports answering with Stream', async () => {
|
||||
it('supports answering with Stream (without custom Content-Type)', async () => {
|
||||
const { server: innerServer, createRouter } = await server.setup(setupDeps);
|
||||
const router = createRouter('/');
|
||||
|
||||
|
@ -790,8 +790,39 @@ describe('Response factory', () => {
|
|||
|
||||
const result = await supertest(innerServer.listener).get('/').expect(200);
|
||||
|
||||
expect(result.text).toBe(undefined);
|
||||
expect(result.body.toString()).toBe('abc');
|
||||
expect(result.header['content-type']).toBe('application/octet-stream');
|
||||
});
|
||||
|
||||
it('supports answering with Stream (with custom Content-Type)', async () => {
|
||||
const { server: innerServer, createRouter } = await server.setup(setupDeps);
|
||||
const router = createRouter('/');
|
||||
|
||||
router.get({ path: '/', validate: false }, (context, req, res) => {
|
||||
const stream = new Stream.Readable({
|
||||
read() {
|
||||
this.push('a');
|
||||
this.push('b');
|
||||
this.push('c');
|
||||
this.push(null);
|
||||
},
|
||||
});
|
||||
|
||||
return res.ok({
|
||||
body: stream,
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
await server.start();
|
||||
|
||||
const result = await supertest(innerServer.listener).get('/').expect(200);
|
||||
|
||||
expect(result.text).toBe('abc');
|
||||
expect(result.header['content-type']).toBe(undefined);
|
||||
expect(result.header['content-type']).toBe('text/plain; charset=utf-8');
|
||||
});
|
||||
|
||||
it('supports answering with chunked Stream', async () => {
|
||||
|
@ -807,7 +838,12 @@ describe('Response factory', () => {
|
|||
stream.end();
|
||||
}, 100);
|
||||
|
||||
return res.ok({ body: stream });
|
||||
return res.ok({
|
||||
body: stream,
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
await server.start();
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { Lifecycle, Request, ResponseToolkit } from 'hapi';
|
||||
import { Lifecycle, Request, ResponseToolkit } from '@hapi/hapi';
|
||||
import { Logger } from '../../logging';
|
||||
import {
|
||||
HapiResponseAdapter,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from 'hapi';
|
||||
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from '@hapi/hapi';
|
||||
import { Logger } from '../../logging';
|
||||
import {
|
||||
HapiResponseAdapter,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from 'hapi';
|
||||
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from '@hapi/hapi';
|
||||
import { Logger } from '../../logging';
|
||||
import {
|
||||
HapiResponseAdapter,
|
||||
|
|
|
@ -17,8 +17,13 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Lifecycle, Request, ResponseObject, ResponseToolkit as HapiResponseToolkit } from 'hapi';
|
||||
import Boom from 'boom';
|
||||
import {
|
||||
Lifecycle,
|
||||
Request,
|
||||
ResponseObject,
|
||||
ResponseToolkit as HapiResponseToolkit,
|
||||
} from '@hapi/hapi';
|
||||
import Boom from '@hapi/boom';
|
||||
import { Logger } from '../../logging';
|
||||
|
||||
import { HapiResponseAdapter, KibanaRequest, ResponseHeaders } from '../router';
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { URL } from 'url';
|
||||
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from 'hapi';
|
||||
import { Lifecycle, Request, ResponseToolkit as HapiResponseToolkit } from '@hapi/hapi';
|
||||
import { Logger } from '../../logging';
|
||||
import {
|
||||
HapiResponseAdapter,
|
||||
|
@ -111,9 +110,7 @@ export function adoptToHapiOnRequest(fn: OnPreRoutingHandler, log: Logger) {
|
|||
|
||||
if (preRoutingResult.isRewriteUrl(result)) {
|
||||
const appState = request.app as KibanaRequestState;
|
||||
appState.rewrittenUrl =
|
||||
// @ts-expect-error request._core isn't supposed to be accessed - remove once we upgrade to hapi v18
|
||||
appState.rewrittenUrl ?? new URL(request.url.href!, request._core.info.uri);
|
||||
appState.rewrittenUrl = appState.rewrittenUrl ?? request.url;
|
||||
|
||||
const { url } = result;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { KibanaResponse, KibanaResponseFactory, kibanaResponseFactory } from './response';
|
||||
import { wrapErrors } from './error_wrapper';
|
||||
import { KibanaRequest, RequestHandler, RequestHandlerContext } from 'kibana/server';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { RequestHandlerWrapper } from './router';
|
||||
|
||||
export const wrapErrors: RequestHandlerWrapper = (handler) => {
|
||||
|
|
|
@ -21,7 +21,7 @@ jest.mock('uuid', () => ({
|
|||
v4: jest.fn().mockReturnValue('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'),
|
||||
}));
|
||||
|
||||
import { RouteOptions } from 'hapi';
|
||||
import { RouteOptions } from '@hapi/hapi';
|
||||
import { KibanaRequest } from './request';
|
||||
import { httpServerMock } from '../http_server.mocks';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
@ -198,6 +198,7 @@ describe('KibanaRequest', () => {
|
|||
const request = httpServerMock.createRawRequest({
|
||||
route: {
|
||||
settings: {
|
||||
// @ts-expect-error According to types/hapi__hapi, `auth` can't be a boolean, but it can according to the @hapi/hapi source (https://github.com/hapijs/hapi/blob/v18.4.2/lib/route.js#L139)
|
||||
auth,
|
||||
},
|
||||
},
|
||||
|
@ -207,11 +208,10 @@ describe('KibanaRequest', () => {
|
|||
expect(kibanaRequest.route.options.authRequired).toBe(false);
|
||||
});
|
||||
it('handles required auth: { mode: "required" }', () => {
|
||||
const auth: RouteOptions['auth'] = { mode: 'required' };
|
||||
const request = httpServerMock.createRawRequest({
|
||||
route: {
|
||||
settings: {
|
||||
auth,
|
||||
auth: { mode: 'required' },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -221,11 +221,10 @@ describe('KibanaRequest', () => {
|
|||
});
|
||||
|
||||
it('handles required auth: { mode: "optional" }', () => {
|
||||
const auth: RouteOptions['auth'] = { mode: 'optional' };
|
||||
const request = httpServerMock.createRawRequest({
|
||||
route: {
|
||||
settings: {
|
||||
auth,
|
||||
auth: { mode: 'optional' },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -235,11 +234,10 @@ describe('KibanaRequest', () => {
|
|||
});
|
||||
|
||||
it('handles required auth: { mode: "try" } as "optional"', () => {
|
||||
const auth: RouteOptions['auth'] = { mode: 'try' };
|
||||
const request = httpServerMock.createRawRequest({
|
||||
route: {
|
||||
settings: {
|
||||
auth,
|
||||
auth: { mode: 'try' },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -249,26 +247,24 @@ describe('KibanaRequest', () => {
|
|||
});
|
||||
|
||||
it('throws on auth: strategy name', () => {
|
||||
const auth: RouteOptions['auth'] = 'session';
|
||||
const request = httpServerMock.createRawRequest({
|
||||
route: {
|
||||
settings: {
|
||||
auth,
|
||||
auth: { strategies: ['session'] },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(() => KibanaRequest.from(request)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"unexpected authentication options: \\"session\\" for route: /"`
|
||||
`"unexpected authentication options: {\\"strategies\\":[\\"session\\"]} for route: /"`
|
||||
);
|
||||
});
|
||||
|
||||
it('throws on auth: { mode: unexpected mode }', () => {
|
||||
const auth: RouteOptions['auth'] = { mode: undefined };
|
||||
const request = httpServerMock.createRawRequest({
|
||||
route: {
|
||||
settings: {
|
||||
auth,
|
||||
auth: { mode: undefined },
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { URL } from 'url';
|
||||
import uuid from 'uuid';
|
||||
import { Request, RouteOptionsApp, ApplicationState } from 'hapi';
|
||||
import { Request, RouteOptionsApp, RequestApplicationState, RouteOptions } from '@hapi/hapi';
|
||||
import { Observable, fromEvent, merge } from 'rxjs';
|
||||
import { shareReplay, first, takeUntil } from 'rxjs/operators';
|
||||
import { RecursiveReadonly } from '@kbn/utility-types';
|
||||
|
@ -42,7 +42,7 @@ export interface KibanaRouteOptions extends RouteOptionsApp {
|
|||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface KibanaRequestState extends ApplicationState {
|
||||
export interface KibanaRequestState extends RequestApplicationState {
|
||||
requestId: string;
|
||||
requestUuid: string;
|
||||
rewrittenUrl?: URL;
|
||||
|
@ -212,8 +212,7 @@ export class KibanaRequest<
|
|||
this.uuid = appState?.requestUuid ?? uuid.v4();
|
||||
this.rewrittenUrl = appState?.rewrittenUrl;
|
||||
|
||||
// @ts-expect-error request._core isn't supposed to be accessed - remove once we upgrade to hapi v18
|
||||
this.url = new URL(request.url.href!, request._core.info.uri);
|
||||
this.url = request.url;
|
||||
this.headers = deepFreeze({ ...request.headers });
|
||||
this.isSystemRequest =
|
||||
request.headers['kbn-system-request'] === 'true' ||
|
||||
|
@ -261,8 +260,16 @@ export class KibanaRequest<
|
|||
const socketTimeout = (request.raw.req.socket as any)?.timeout;
|
||||
const options = ({
|
||||
authRequired: this.getAuthRequired(request),
|
||||
// some places in LP call KibanaRequest.from(request) manually. remove fallback to true before v8
|
||||
xsrfRequired: (request.route.settings.app as KibanaRouteOptions)?.xsrfRequired ?? true,
|
||||
// TypeScript note: Casting to `RouterOptions` to fix the following error:
|
||||
//
|
||||
// Property 'app' does not exist on type 'RouteSettings'
|
||||
//
|
||||
// In @types/hapi__hapi v18, `request.route.settings` is of type
|
||||
// `RouteSettings`, which doesn't have an `app` property. I think this is
|
||||
// a mistake. In v19, the `RouteSettings` interface does have an `app`
|
||||
// property.
|
||||
xsrfRequired:
|
||||
((request.route.settings as RouteOptions).app as KibanaRouteOptions)?.xsrfRequired ?? true, // some places in LP call KibanaRequest.from(request) manually. remove fallback to true before v8
|
||||
tags: request.route.settings.tags || [],
|
||||
timeout: {
|
||||
payload: payloadTimeout,
|
||||
|
@ -302,6 +309,7 @@ export class KibanaRequest<
|
|||
return true;
|
||||
}
|
||||
|
||||
// @ts-expect-error According to @types/hapi__hapi, `route.settings` should be of type `RouteSettings`, but it seems that it's actually `RouteOptions` (https://github.com/hapijs/hapi/blob/v18.4.2/lib/route.js#L139)
|
||||
if (authOptions === false) return false;
|
||||
throw new Error(
|
||||
`unexpected authentication options: ${JSON.stringify(authOptions)} for route: ${
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ResponseObject as HapiResponseObject, ResponseToolkit as HapiResponseToolkit } from 'hapi';
|
||||
import {
|
||||
ResponseObject as HapiResponseObject,
|
||||
ResponseToolkit as HapiResponseToolkit,
|
||||
} from '@hapi/hapi';
|
||||
import typeDetect from 'type-detect';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import * as stream from 'stream';
|
||||
|
||||
import {
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Request, ResponseObject, ResponseToolkit } from 'hapi';
|
||||
import Boom from 'boom';
|
||||
import { Request, ResponseObject, ResponseToolkit } from '@hapi/hapi';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { isConfigSchema } from '@kbn/config-schema';
|
||||
import { Logger } from '../../logging';
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { ServerExtType } from 'hapi';
|
||||
import Podium from 'podium';
|
||||
import { ServerExtType } from '@hapi/hapi';
|
||||
import Podium from '@hapi/podium';
|
||||
// @ts-expect-error: implicit any for JS file
|
||||
import { Config } from '../../../../legacy/server/config';
|
||||
// @ts-expect-error: implicit any for JS file
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import v8 from 'v8';
|
||||
import { Bench } from 'hoek';
|
||||
import { Bench } from '@hapi/hoek';
|
||||
import { OpsProcessMetrics, MetricsCollector } from './types';
|
||||
|
||||
export class ProcessMetricsCollector implements MetricsCollector<OpsProcessMetrics> {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { ResponseObject, Server as HapiServer } from 'hapi';
|
||||
import { ResponseObject, Server as HapiServer } from '@hapi/hapi';
|
||||
import { OpsServerMetrics, MetricsCollector } from './types';
|
||||
|
||||
interface ServerResponseTime {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import { BehaviorSubject, Subject } from 'rxjs';
|
||||
import { take, filter } from 'rxjs/operators';
|
||||
import supertest from 'supertest';
|
||||
import { Server as HapiServer } from 'hapi';
|
||||
import { Server as HapiServer } from '@hapi/hapi';
|
||||
import { createHttpServer } from '../../http/test_utils';
|
||||
import { HttpService, IRouter } from '../../http';
|
||||
import { contextServiceMock } from '../../context/context_service.mock';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Server as HapiServer } from 'hapi';
|
||||
import { Server as HapiServer } from '@hapi/hapi';
|
||||
import {
|
||||
ProcessMetricsCollector,
|
||||
OsMetricsCollector,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { createListStream } from '../../utils/streams';
|
||||
import { SavedObjectsClientContract, SavedObject } from '../types';
|
||||
import { fetchNestedDependencies } from './inject_nested_depdendencies';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { Transform } from 'stream';
|
||||
|
||||
export function createLimitStream(limit: number) {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { SavedObject, SavedObjectsClientContract } from '../types';
|
||||
import { SavedObjectsImportError, SavedObjectsImportRetry } from './types';
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
* given an empty migrationVersion property {} if no such property exists.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { set } from '@elastic/safer-lodash-set';
|
||||
import _ from 'lodash';
|
||||
import Semver from 'semver';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { SavedObjectsErrorHelpers } from './errors';
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
// 400 - badRequest
|
||||
const CODE_BAD_REQUEST = 'SavedObjectsClient/badRequest';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { IndexMapping } from '../../../mappings';
|
||||
import { getQueryParams } from './query_params';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { getProperty, IndexMapping } from '../../../mappings';
|
||||
|
||||
const TOP_LEVEL_FIELDS = ['_id', '_score'];
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { decodeVersion } from './decode_version';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
```ts
|
||||
|
||||
import { ApiResponse } from '@elastic/elasticsearch/lib/Transport';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { BulkIndexDocumentsParams } from 'elasticsearch';
|
||||
import { CatAliasesParams } from 'elasticsearch';
|
||||
import { CatAllocationParams } from 'elasticsearch';
|
||||
|
@ -129,16 +129,16 @@ import { RecursiveReadonly } from '@kbn/utility-types';
|
|||
import { ReindexParams } from 'elasticsearch';
|
||||
import { ReindexRethrottleParams } from 'elasticsearch';
|
||||
import { RenderSearchTemplateParams } from 'elasticsearch';
|
||||
import { Request } from 'hapi';
|
||||
import { ResponseObject } from 'hapi';
|
||||
import { ResponseToolkit } from 'hapi';
|
||||
import { Request } from '@hapi/hapi';
|
||||
import { ResponseObject } from '@hapi/hapi';
|
||||
import { ResponseToolkit } from '@hapi/hapi';
|
||||
import { SchemaTypeError } from '@kbn/config-schema';
|
||||
import { ScrollParams } from 'elasticsearch';
|
||||
import { SearchParams } from 'elasticsearch';
|
||||
import { SearchResponse as SearchResponse_2 } from 'elasticsearch';
|
||||
import { SearchShardsParams } from 'elasticsearch';
|
||||
import { SearchTemplateParams } from 'elasticsearch';
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import { ShallowPromise } from '@kbn/utility-types';
|
||||
import { SnapshotCreateParams } from 'elasticsearch';
|
||||
import { SnapshotCreateRepositoryParams } from 'elasticsearch';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import KbnServer from '../kbn_server';
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { format } from 'url';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { registerHapiPlugins } from './register_hapi_plugins';
|
||||
import { setupBasePathProvider } from './setup_base_path_provider';
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import HapiTemplates from 'vision';
|
||||
import HapiStaticFiles from 'inert';
|
||||
import HapiProxy from 'h2o2';
|
||||
import HapiTemplates from '@hapi/vision';
|
||||
import HapiStaticFiles from '@hapi/inert';
|
||||
import HapiProxy from '@hapi/h2o2';
|
||||
|
||||
const plugins = [HapiTemplates, HapiStaticFiles, HapiProxy];
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { i18n, i18nLoader } from '@kbn/i18n';
|
||||
import { basename } from 'path';
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import type { UsageCollectionSetup } from '../../../plugins/usage_collection/server';
|
||||
import { getKibanaTranslationPaths } from './get_kibana_translation_paths';
|
||||
import KbnServer, { KibanaConfig } from '../kbn_server';
|
||||
|
|
4
src/legacy/server/kbn_server.d.ts
vendored
4
src/legacy/server/kbn_server.d.ts
vendored
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
|
||||
import {
|
||||
CoreSetup,
|
||||
|
@ -104,4 +104,4 @@ export default class KbnServer {
|
|||
}
|
||||
|
||||
// Re-export commonly used hapi types.
|
||||
export { Server, Request, ResponseToolkit } from 'hapi';
|
||||
export { Server, Request, ResponseToolkit } from '@hapi/hapi';
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { isMaster, isWorker } from 'cluster';
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import { LogRotator } from './log_rotator';
|
||||
import { KibanaConfig } from '../../kbn_server';
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
import * as chokidar from 'chokidar';
|
||||
import { isMaster } from 'cluster';
|
||||
import fs from 'fs';
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import { throttle } from 'lodash';
|
||||
import { tmpdir } from 'os';
|
||||
import { basename, dirname, join, sep } from 'path';
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
import { createHash } from 'crypto';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import * as UiSharedDeps from '@kbn/ui-shared-deps';
|
||||
import { KibanaRequest } from '../../../core/server';
|
||||
|
|
|
@ -22,8 +22,8 @@ import { readFileSync } from 'fs';
|
|||
import crypto from 'crypto';
|
||||
|
||||
import Chance from 'chance';
|
||||
import Hapi from 'hapi';
|
||||
import Inert from 'inert';
|
||||
import Hapi from '@hapi/hapi';
|
||||
import Inert from '@hapi/inert';
|
||||
|
||||
import { createBundlesRoute } from './bundles_route';
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { extname, join } from 'path';
|
||||
|
||||
import Hapi from 'hapi';
|
||||
import Hapi from '@hapi/hapi';
|
||||
import * as UiSharedDeps from '@kbn/ui-shared-deps';
|
||||
|
||||
import { createDynamicAssetResponse } from './dynamic_asset_response';
|
||||
|
|
|
@ -22,8 +22,8 @@ import { resolve } from 'path';
|
|||
import { promisify } from 'util';
|
||||
|
||||
import Accept from 'accept';
|
||||
import Boom from 'boom';
|
||||
import Hapi from 'hapi';
|
||||
import Boom from '@hapi/boom';
|
||||
import Hapi from '@hapi/hapi';
|
||||
|
||||
import { FileHashCache } from './file_hash_cache';
|
||||
import { getFileHash } from './file_hash';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Hapi from 'hapi';
|
||||
import Hapi from '@hapi/hapi';
|
||||
|
||||
import { createBundlesRoute } from './bundles_route';
|
||||
import { getNpUiPluginPublicDirs } from './np_ui_plugin_public_dirs';
|
||||
|
|
|
@ -21,7 +21,7 @@ import http from 'http';
|
|||
import https from 'https';
|
||||
import net from 'net';
|
||||
import stream from 'stream';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { URL } from 'url';
|
||||
|
||||
interface Args {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { ApiResponse as ApiResponse_2 } from '@elastic/elasticsearch/lib/Transpo
|
|||
import { ApplicationStart } from 'kibana/public';
|
||||
import { Assign } from '@kbn/utility-types';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { CoreSetup } from 'src/core/public';
|
||||
import { CoreSetup as CoreSetup_2 } from 'kibana/public';
|
||||
import { CoreStart } from 'kibana/public';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { get } from 'lodash';
|
||||
|
||||
const ERR_ES_INDEX_NOT_FOUND = 'index_not_found_exception';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
```ts
|
||||
|
||||
import { APICaller as APICaller_2 } from 'kibana/server';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { BulkIndexDocumentsParams } from 'elasticsearch';
|
||||
import { CallCluster as CallCluster_2 } from 'src/legacy/core_plugins/elasticsearch';
|
||||
import { CatAliasesParams } from 'elasticsearch';
|
||||
|
@ -116,9 +116,9 @@ import { RecursiveReadonly } from 'kibana/public';
|
|||
import { ReindexParams } from 'elasticsearch';
|
||||
import { ReindexRethrottleParams } from 'elasticsearch';
|
||||
import { RenderSearchTemplateParams } from 'elasticsearch';
|
||||
import { Request } from 'hapi';
|
||||
import { ResponseObject } from 'hapi';
|
||||
import { ResponseToolkit } from 'hapi';
|
||||
import { Request } from '@hapi/hapi';
|
||||
import { ResponseObject } from '@hapi/hapi';
|
||||
import { ResponseToolkit } from '@hapi/hapi';
|
||||
import { SchemaTypeError } from '@kbn/config-schema';
|
||||
import { ScrollParams } from 'elasticsearch';
|
||||
import { SearchParams } from 'elasticsearch';
|
||||
|
|
|
@ -12,7 +12,7 @@ import { ApiResponse as ApiResponse_2 } from '@elastic/elasticsearch';
|
|||
import { ApplicationStart as ApplicationStart_2 } from 'kibana/public';
|
||||
import { Assign } from '@kbn/utility-types';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { CoreSetup as CoreSetup_2 } from 'src/core/public';
|
||||
import { CoreSetup as CoreSetup_3 } from 'kibana/public';
|
||||
import { CoreStart as CoreStart_2 } from 'kibana/public';
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import { parse } from 'url';
|
||||
import { trim } from 'lodash';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
export function shortUrlAssertValid(url: string) {
|
||||
const { protocol, hostname, pathname } = parse(url);
|
||||
|
|
|
@ -28,7 +28,7 @@ import {
|
|||
FakeRequest,
|
||||
} from 'src/core/server';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Server } from 'hapi';
|
||||
import { Server } from '@hapi/hapi';
|
||||
import { VisTypeTimeseriesConfig } from './config';
|
||||
import { getVisData, GetVisData, GetVisDataOptions } from './lib/get_vis_data';
|
||||
import { ValidationTelemetryService } from './validation_telemetry';
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { isBoom } from 'boom';
|
||||
import { isBoom } from '@hapi/boom';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { getFields } from '../lib/get_fields';
|
||||
import { Framework } from '../plugin';
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import { errors as esErrors } from 'elasticsearch';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import {
|
||||
isEsIndexNotFoundError,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
"@cypress/webpack-preprocessor": "^5.4.1",
|
||||
"@elastic/apm-rum-react": "^1.2.5",
|
||||
"@elastic/maki": "6.3.0",
|
||||
"@hapi/hapi": "^18.4.1",
|
||||
"@kbn/babel-preset": "1.0.0",
|
||||
"@kbn/dev-utils": "1.0.0",
|
||||
"@kbn/es": "1.0.0",
|
||||
|
@ -57,7 +58,6 @@
|
|||
"@types/angular": "^1.6.56",
|
||||
"@types/archiver": "^3.1.0",
|
||||
"@types/base64-js": "^1.2.5",
|
||||
"@types/boom": "^7.2.0",
|
||||
"@types/cheerio": "^0.22.10",
|
||||
"@types/chroma-js": "^1.4.2",
|
||||
"@types/color": "^3.0.0",
|
||||
|
@ -174,7 +174,6 @@
|
|||
"graphql-codegen-typescript-resolvers": "^0.18.2",
|
||||
"graphql-codegen-typescript-server": "^0.18.2",
|
||||
"gulp": "4.0.2",
|
||||
"hapi": "^17.5.3",
|
||||
"he": "^1.2.0",
|
||||
"history-extra": "^5.0.1",
|
||||
"hoist-non-react-statics": "^3.3.2",
|
||||
|
@ -272,6 +271,8 @@
|
|||
"@elastic/node-crypto": "1.2.1",
|
||||
"@elastic/numeral": "^2.5.0",
|
||||
"@elastic/safer-lodash-set": "0.0.0",
|
||||
"@hapi/boom": "^7.4.11",
|
||||
"@hapi/h2o2": "^8.3.2",
|
||||
"@kbn/config-schema": "1.0.0",
|
||||
"@kbn/i18n": "1.0.0",
|
||||
"@kbn/interpreter": "1.0.0",
|
||||
|
@ -289,7 +290,6 @@
|
|||
"archiver": "^3.1.1",
|
||||
"axios": "^0.19.2",
|
||||
"bluebird": "3.5.5",
|
||||
"boom": "^7.2.0",
|
||||
"chroma-js": "^1.4.1",
|
||||
"classnames": "2.2.6",
|
||||
"concat-stream": "1.6.2",
|
||||
|
@ -314,7 +314,6 @@
|
|||
"graphql-fields": "^1.0.2",
|
||||
"graphql-tag": "^2.10.3",
|
||||
"graphql-tools": "^3.0.2",
|
||||
"h2o2": "^8.1.2",
|
||||
"handlebars": "4.7.6",
|
||||
"history": "^4.9.0",
|
||||
"idx": "^2.5.6",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { RunContext, TaskManagerSetupContract } from '../../task_manager/server';
|
||||
import { ActionType as CommonActionType } from '../common';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import {
|
||||
ILegacyScopedClusterClient,
|
||||
SavedObjectsClientContract,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { KibanaRequest } from 'src/core/server';
|
||||
import { SecurityPluginSetup } from '../../../security/server';
|
||||
import { ActionsAuthorizationAuditLogger } from './audit_logger';
|
||||
|
|
|
@ -145,12 +145,6 @@ test('executes the task by calling the executor with proper parameters', async (
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -277,12 +271,6 @@ test('uses API key when provided', async () => {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
@ -322,12 +310,6 @@ test(`doesn't use API key when not provided`, async () => {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
|
|
@ -102,12 +102,6 @@ export class TaskRunnerFactory {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
} as unknown) as KibanaRequest;
|
||||
|
||||
let executorResult: ActionTypeExecutorResult<unknown>;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ActionType, ActionTypeConfig, ActionTypeSecrets, ActionTypeParams } from '../types';
|
||||
|
||||
export function validateParams<
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ILicenseState } from './license_state';
|
||||
|
||||
export function verifyApiAccess(licenseState: ILicenseState) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import typeDetect from 'type-detect';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { omit, isEqual, map, uniq, pick, truncate, trim } from 'lodash';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { Request } from 'hapi';
|
||||
import { Request } from '@hapi/hapi';
|
||||
import { AlertsClientFactory, AlertsClientFactoryOpts } from './alerts_client_factory';
|
||||
import { alertTypeRegistryMock } from './alert_type_registry.mock';
|
||||
import { taskManagerMock } from '../../task_manager/server/mocks';
|
||||
|
@ -60,12 +60,6 @@ const fakeRequest = ({
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
getSavedObjectsClient: () => savedObjectsClient,
|
||||
} as unknown) as Request;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { map, mapValues, fromPairs, has } from 'lodash';
|
||||
import { KibanaRequest } from 'src/core/server';
|
||||
import { ALERTS_FEATURE_ID } from '../../common';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { LicenseState } from './license_state';
|
||||
|
||||
export function verifyApiAccess(licenseState: LicenseState) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { assertNever } from '@kbn/std';
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { AlertType, AlertExecutorOptions } from '../types';
|
||||
|
||||
export function validateAlertTypeParams(
|
||||
|
|
|
@ -149,12 +149,6 @@ describe('Alerting Plugin', () => {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
getSavedObjectsClient: jest.fn(),
|
||||
} as unknown) as KibanaRequest;
|
||||
await startContract.getAlertsClientWithRequest(fakeRequest);
|
||||
|
|
|
@ -364,12 +364,6 @@ describe('Task Runner', () => {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(actionsClient.enqueueExecution).toHaveBeenCalledTimes(1);
|
||||
expect(actionsClient.enqueueExecution.mock.calls[0]).toMatchInlineSnapshot(`
|
||||
|
@ -668,12 +662,6 @@ describe('Task Runner', () => {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -706,12 +694,6 @@ describe('Task Runner', () => {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -101,12 +101,6 @@ export class TaskRunner {
|
|||
url: '/',
|
||||
},
|
||||
},
|
||||
// TODO: Remove once we upgrade to hapi v18
|
||||
_core: {
|
||||
info: {
|
||||
uri: 'http://localhost',
|
||||
},
|
||||
},
|
||||
} as unknown) as KibanaRequest;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { Logger } from 'kibana/server';
|
||||
import uuid from 'uuid/v4';
|
||||
import { snakeCase } from 'lodash';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ProcessorEvent } from '../../../common/processor_event';
|
||||
import { ML_ERRORS } from '../../../common/anomaly_detection';
|
||||
import { PromiseReturnType } from '../../../../observability/typings/common';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { Logger } from 'kibana/server';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ML_ERRORS } from '../../../common/anomaly_detection';
|
||||
import { Setup } from '../helpers/setup_request';
|
||||
import { getMlJobsWithAPMGroup } from './get_ml_jobs_with_apm_group';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ML_ERRORS } from '../../../common/anomaly_detection';
|
||||
import { Setup } from '../helpers/setup_request';
|
||||
import { getMlJobsWithAPMGroup } from './get_ml_jobs_with_apm_group';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { getServiceHealthStatus } from '../../../common/service_health_status';
|
||||
import { Setup, SetupTimeRange } from '../helpers/setup_request';
|
||||
import { PromiseReturnType } from '../../../typings/common';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { uniq, take, sortBy } from 'lodash';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { ProcessorEvent } from '../../../common/processor_event';
|
||||
import { Setup, SetupTimeRange } from '../helpers/setup_request';
|
||||
import { rangeFilter } from '../../../common/utils/range_filter';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import { pick, difference } from 'lodash';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import * as t from 'io-ts';
|
||||
import { PathReporter } from 'io-ts/lib/PathReporter';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import * as t from 'io-ts';
|
||||
import {
|
||||
invalidLicenseMessage,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as t from 'io-ts';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { uniq } from 'lodash';
|
||||
import { setupRequest } from '../lib/helpers/setup_request';
|
||||
import { getServiceAgentName } from '../lib/services/get_service_agent_name';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as t from 'io-ts';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { setupRequest } from '../../lib/helpers/setup_request';
|
||||
import { getServiceNames } from '../../lib/settings/agent_configuration/get_service_names';
|
||||
import { createOrUpdateConfiguration } from '../../lib/settings/agent_configuration/create_or_update_configuration';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as t from 'io-ts';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { isActivePlatinumLicense } from '../../../common/service_map';
|
||||
import { ML_ERRORS } from '../../../common/anomaly_detection';
|
||||
import { createRoute } from '../create_route';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import * as t from 'io-ts';
|
||||
import { pick } from 'lodash';
|
||||
import { INVALID_LICENSE } from '../../../common/custom_link';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import * as t from 'io-ts';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { setupRequest } from '../lib/helpers/setup_request';
|
||||
import { getTransactionCharts } from '../lib/transactions/charts';
|
||||
import { getTransactionDistribution } from '../lib/transactions/distribution';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import boom from 'boom';
|
||||
import boom from '@hapi/boom';
|
||||
|
||||
export const formatResponse = (esErrors) => (resp) => {
|
||||
if (resp.isBoom) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { badRequest } from 'boom';
|
||||
import { badRequest } from '@hapi/boom';
|
||||
import { initializeListTemplates } from './list';
|
||||
import { kibanaResponseFactory, RequestHandlerContext, RequestHandler } from 'src/core/server';
|
||||
import { savedObjectsClientMock, httpServerMock } from 'src/core/server/mocks';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { pipe } from 'fp-ts/lib/pipeable';
|
||||
import { fold } from 'fp-ts/lib/Either';
|
||||
import { identity } from 'fp-ts/lib/function';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { pipe } from 'fp-ts/lib/pipeable';
|
||||
import { fold } from 'fp-ts/lib/Either';
|
||||
import { identity } from 'fp-ts/lib/function';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { pipe } from 'fp-ts/lib/pipeable';
|
||||
import { fold } from 'fp-ts/lib/Either';
|
||||
import { identity } from 'fp-ts/lib/function';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { CASE_SAVED_OBJECT } from '../../../../saved_object_types';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import Boom from 'boom';
|
||||
import Boom from '@hapi/boom';
|
||||
|
||||
import { pipe } from 'fp-ts/lib/pipeable';
|
||||
import { fold } from 'fp-ts/lib/Either';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue