Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,7 @@ src/platform/packages/shared/kbn-i18n-react @elastic/kibana-core
src/platform/packages/shared/kbn-interpreter @elastic/kibana-visualizations
src/platform/packages/shared/kbn-io-ts-utils @elastic/observability-ui
src/platform/packages/shared/kbn-jest-benchmarks @elastic/observability-ui
src/platform/packages/shared/kbn-kbn-client @elastic/kibana-operations @elastic/appex-qa
src/platform/packages/shared/kbn-lazy-object @elastic/kibana-operations @elastic/observability-ui
src/platform/packages/shared/kbn-lens-common @elastic/kibana-visualizations
src/platform/packages/shared/kbn-lens-common-2 @elastic/kibana-visualizations
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1714,6 +1714,7 @@
"@kbn/jest-serializers": "link:src/platform/packages/private/kbn-jest-serializers",
"@kbn/journeys": "link:src/platform/packages/private/kbn-journeys",
"@kbn/json-ast": "link:packages/kbn-json-ast",
"@kbn/kbn-client": "link:src/platform/packages/shared/kbn-kbn-client",
"@kbn/kbn-genai-cli": "link:x-pack/solutions/observability/packages/kbn-genai-cli",
"@kbn/kibana-manifest-schema": "link:packages/kbn-kibana-manifest-schema",
"@kbn/lazy-object": "link:src/platform/packages/shared/kbn-lazy-object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ dependsOn:
- '@kbn/security-plugin'
- '@kbn/tooling-log'
- '@kbn/repo-info'
- '@kbn/kbn-client'
- '@kbn/test'
- '@kbn/dev-cli-runner'
- '@kbn/core-status-common'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { ToolingLog } from '@kbn/tooling-log';
import type { KbnClientOptions } from '@kbn/test';
import { KbnClient } from '@kbn/test';
import pRetry from 'p-retry';
import type { ReqOptions } from '@kbn/test/src/kbn_client/kbn_client_requester';
import type { ReqOptions } from '@kbn/kbn-client';
import { type AxiosResponse } from 'axios';
import type { ClientOptions } from '@elastic/elasticsearch/lib/client';
import fs from 'fs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@kbn/security-plugin",
"@kbn/tooling-log",
"@kbn/repo-info",
"@kbn/kbn-client",
"@kbn/test",
"@kbn/dev-cli-runner",
"@kbn/core-status-common",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './kbn_client';
export { uriencode } from './kbn_client_requester';
export * from './src/kbn_client';
14 changes: 14 additions & 0 deletions src/platform/packages/shared/kbn-kbn-client/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

module.exports = {
preset: '@kbn/test/jest_node',
rootDir: '../../../../..',
roots: ['<rootDir>/src/platform/packages/shared/kbn-kbn-client'],
};
11 changes: 11 additions & 0 deletions src/platform/packages/shared/kbn-kbn-client/kibana.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"type": "shared-common",
"id": "@kbn/kbn-client",
"owner": [
"@elastic/kibana-operations",
"@elastic/appex-qa"
],
"group": "platform",
"visibility": "shared",
"devOnly": true
}
58 changes: 58 additions & 0 deletions src/platform/packages/shared/kbn-kbn-client/moon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This file is generated by the @kbn/moon package. Any manual edits will be erased!
# To extend this, write your extensions/overrides to 'moon.extend.yml'
# then regenerate this file with: 'node scripts/regenerate_moon_projects.js --update --filter @kbn/kbn-client'

$schema: https://moonrepo.dev/schemas/project.json
id: '@kbn/kbn-client'
layer: unknown
owners:
defaultOwner: '@elastic/kibana-operations'
toolchains:
default: node
language: typescript
project:
title: '@kbn/kbn-client'
description: Moon project for @kbn/kbn-client
channel: ''
owner: '@elastic/kibana-operations'
sourceRoot: src/platform/packages/shared/kbn-kbn-client
dependsOn:
- '@kbn/core-saved-objects-api-server'
- '@kbn/dev-cli-errors'
- '@kbn/dev-utils'
- '@kbn/repo-info'
- '@kbn/tooling-log'
tags:
- shared-common
- package
- dev
- group-platform
- shared
- jest-unit-tests
fileGroups:
src:
- '**/*.ts'
- '!target/**/*'
tasks:
jest:
command: node
args:
- '--no-experimental-require-module'
- $workspaceRoot/scripts/jest
- '--config'
- $projectRoot/jest.config.js
options:
runFromWorkspaceRoot: true
inputs:
- '@group(src)'
jestCI:
command: node
args:
- '--no-experimental-require-module'
- $workspaceRoot/scripts/jest
- '--config'
- $projectRoot/jest.config.js
options:
runFromWorkspaceRoot: true
inputs:
- '@group(src)'
6 changes: 6 additions & 0 deletions src/platform/packages/shared/kbn-kbn-client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "@kbn/kbn-client",
"private": true,
"version": "1.0.0",
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export * from './kbn_client';
export { uriencode } from './kbn_client_requester';
export type { ReqOptions } from './kbn_client_requester';
export { KbnClientRequesterError } from './kbn_client_requester_error';
export { KbnClientSavedObjects } from './kbn_client_saved_objects';
export type { UiSettingValues } from './kbn_client_ui_settings';
23 changes: 23 additions & 0 deletions src/platform/packages/shared/kbn-kbn-client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "@kbn/tsconfig-base/tsconfig.json",
"compilerOptions": {
"outDir": "target/types",
"types": [
"jest",
"node"
]
},
"include": [
"**/*.ts"
],
"exclude": [
"target/**/*"
],
"kbn_references": [
"@kbn/core-saved-objects-api-server",
"@kbn/dev-cli-errors",
"@kbn/dev-utils",
"@kbn/repo-info",
"@kbn/tooling-log"
]
}
1 change: 1 addition & 0 deletions src/platform/packages/shared/kbn-scout/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependsOn:
- '@kbn/repo-packages'
- '@kbn/es'
- '@kbn/dev-proc-runner'
- '@kbn/kbn-client'
- '@kbn/test'
- '@kbn/es-archiver'
- '@kbn/dev-utils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { createEsClientForTesting, KbnClient } from '@kbn/test';
import { KbnClient } from '@kbn/kbn-client';
import { createEsClientForTesting } from '@kbn/test';
import type { ScoutLogger } from './logger';
import type { ScoutTestConfig, EsClient } from '../../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export { createSamlSessionManager } from './saml_auth';
export type { KibanaUrl } from './kibana_url';
export type { SamlSessionManager } from '@kbn/test';
export { ScoutLogger } from './logger';
export type { KbnClient } from '@kbn/test';
export type { KbnClient } from '@kbn/kbn-client';
export type { Client as EsClient } from '@elastic/elasticsearch';
export {
createCustomRole,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
*/

import { test as base } from '@playwright/test';
import type { KbnClient, SamlSessionManager } from '@kbn/test';
import type { KbnClient } from '@kbn/kbn-client';
import type { SamlSessionManager } from '@kbn/test';
import type { Client } from '@elastic/elasticsearch';
import type {
KibanaUrl,
Expand All @@ -30,7 +31,8 @@ import type { ScoutTestOptions } from '../../../types';
import type { ScoutTestConfig } from '.';

// re-export to import types from '@kbn-scout'
export type { KbnClient, SamlSessionManager } from '@kbn/test';
export type { KbnClient } from '@kbn/kbn-client';
export type { SamlSessionManager } from '@kbn/test';
export type { Client as EsClient } from '@elastic/elasticsearch';
export type { KibanaUrl } from '../../../../common/services/kibana_url';
export type { ScoutTestConfig } from '../../../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { UiSettingValues } from '@kbn/test/src/kbn_client/kbn_client_ui_settings';
import type { UiSettingValues } from '@kbn/kbn-client';

/**
* Solution view types for Kibana spaces.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { UiSettingValues } from '@kbn/test/src/kbn_client/kbn_client_ui_settings';
import type { UiSettingValues } from '@kbn/kbn-client';
import { formatTime, isValidUTCDate } from '../../../../utils';
import { coreWorkerFixtures } from '..';
import type { ImportSavedObjects, ScoutSpaceParallelFixture, SpaceSolutionView } from '.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { UiSettingValues } from '@kbn/test/src/kbn_client/kbn_client_ui_settings';
import type { UiSettingValues } from '@kbn/kbn-client';

export interface UiSettingsFixture {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import type { UiSettingValues } from '@kbn/test/src/kbn_client/kbn_client_ui_settings';
import type { UiSettingValues } from '@kbn/kbn-client';
import { isValidUTCDate, formatTime } from '../../../../utils';
import { coreWorkerFixtures } from '../core_fixtures';
import type { UiSettingsFixture } from '.';
Expand Down
1 change: 1 addition & 0 deletions src/platform/packages/shared/kbn-scout/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@kbn/repo-packages",
"@kbn/es",
"@kbn/dev-proc-runner",
"@kbn/kbn-client",
"@kbn/test",
"@kbn/es-archiver",
"@kbn/dev-utils",
Expand Down
4 changes: 1 addition & 3 deletions src/platform/packages/shared/kbn-test/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

export { KbnClientRequesterError } from './src/kbn_client/kbn_client_requester_error';

// @internal
export { startServersCli, startServers } from './src/functional_tests/start_servers';

Expand Down Expand Up @@ -76,7 +74,7 @@ export { runJestAll } from './src/jest/run_all';

export * from './src/kbn_archiver_cli';

export * from './src/kbn_client';
export * from '@kbn/kbn-client';

export * from './src/find_test_plugin_paths';

Expand Down
2 changes: 1 addition & 1 deletion src/platform/packages/shared/kbn-test/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ project:
owner: '@elastic/kibana-operations'
sourceRoot: src/platform/packages/shared/kbn-test
dependsOn:
- '@kbn/kbn-client'
- '@kbn/dev-utils'
- '@kbn/std'
- '@kbn/tooling-log'
Expand All @@ -32,7 +33,6 @@ dependsOn:
- '@kbn/stdio-dev-helpers'
- '@kbn/babel-register'
- '@kbn/repo-packages'
- '@kbn/core-saved-objects-api-server'
- '@kbn/mock-idp-utils'
- '@kbn/code-owners'
- '@kbn/scout-reporting'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const readCloudUsersFromFileMock = jest.spyOn(helper, 'readCloudUsersFromFile');

const getTestToken = () => 'kbn_cookie_' + crypto.randomBytes(16).toString('hex');

jest.mock('../kbn_client/kbn_client', () => {
jest.mock('@kbn/kbn-client', () => {
return {
KbnClient: jest.fn(),
};
Expand All @@ -53,7 +53,7 @@ describe('SamlSessionManager', () => {
beforeEach(() => {
jest.resetAllMocks();
jest
.requireMock('../kbn_client/kbn_client')
.requireMock('@kbn/kbn-client')
.KbnClient.mockImplementation(() => ({ version: { get } }));
get.mockImplementation(() => Promise.resolve('8.12.0'));

Expand Down Expand Up @@ -267,7 +267,7 @@ describe('SamlSessionManager', () => {
beforeEach(() => {
jest.resetAllMocks();
jest
.requireMock('../kbn_client/kbn_client')
.requireMock('@kbn/kbn-client')
.KbnClient.mockImplementation(() => ({ version: { get } }));
get.mockImplementationOnce(() => Promise.resolve('8.12.0'));

Expand All @@ -293,7 +293,7 @@ describe('SamlSessionManager', () => {
beforeEach(() => {
jest.resetAllMocks();
jest
.requireMock('../kbn_client/kbn_client')
.requireMock('@kbn/kbn-client')
.KbnClient.mockImplementation(() => ({ version: { get } }));
get.mockImplementationOnce(() => Promise.resolve('8.12.0'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { ToolingLog } from '@kbn/tooling-log';
import Url from 'url';
import type { ServerlessProjectType } from '@kbn/es';
import { createHash } from 'crypto';
import { KbnClient } from '../kbn_client';
import { KbnClient } from '@kbn/kbn-client';
import { isValidHostname, readCloudUsersFromFile } from './helper';
import type { Session } from './saml_auth';
import { createCloudSAMLSession, createLocalSAMLSession, getSecurityProfile } from './saml_auth';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Url from 'url';
import type { ToolingLog } from '@kbn/tooling-log';
import Supertest from 'supertest';

import { KbnClient } from '../../kbn_client';
import { KbnClient } from '@kbn/kbn-client';
import type { Config } from './config';
import { getKibanaCliArg } from '../../functional_tests/lib/kibana_cli_args';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import Url from 'url';
import type { Flags } from '@kbn/dev-cli-runner';
import { RunWithCommands } from '@kbn/dev-cli-runner';
import { createFlagError } from '@kbn/dev-cli-errors';
import { KbnClient } from './kbn_client';
import { KbnClient } from '@kbn/kbn-client';

import { readConfigFile, EsVersion } from './functional_test_runner';

Expand Down
2 changes: 1 addition & 1 deletion src/platform/packages/shared/kbn-test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"target/**/*",
],
"kbn_references": [
"@kbn/kbn-client",
"@kbn/dev-utils",
"@kbn/std",
"@kbn/tooling-log",
Expand All @@ -34,7 +35,6 @@
"@kbn/stdio-dev-helpers",
"@kbn/babel-register",
"@kbn/repo-packages",
"@kbn/core-saved-objects-api-server",
"@kbn/mock-idp-utils",
"@kbn/code-owners",
"@kbn/scout-reporting",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,8 @@
"@kbn/json-ast/*": ["packages/kbn-json-ast/*"],
"@kbn/json-schemas": ["x-pack/platform/packages/private/ml/json_schemas"],
"@kbn/json-schemas/*": ["x-pack/platform/packages/private/ml/json_schemas/*"],
"@kbn/kbn-client": ["src/platform/packages/shared/kbn-kbn-client"],
"@kbn/kbn-client/*": ["src/platform/packages/shared/kbn-kbn-client/*"],
"@kbn/kbn-genai-cli": ["x-pack/solutions/observability/packages/kbn-genai-cli"],
"@kbn/kbn-genai-cli/*": ["x-pack/solutions/observability/packages/kbn-genai-cli/*"],
"@kbn/kbn-health-gateway-status-plugin": ["src/platform/test/health_gateway/plugins/status"],
Expand Down
Loading
Loading