[Fleet] Use type-only imports where possible (#92979)
## Summary
Use [type-only `import`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export) to differentiate between runtime values and (erasable) TS types.
<img width="1499" alt="Screen Shot 2021-02-27 at 6 34 46 PM" src="https://user-images.githubusercontent.com/57655/109403323-84e32c80-792a-11eb-94b7-854d0e5c3e99.png">
Allows Babel and `tsc` to make some optimizations since it can be sure what can be erased.
It can also be helpful in situations like below which highlights that even though `KibanaAssetType` and `KibanaSavedObjectType` are named a certain way and from `common/types`, they are JS values _not_ TS types. They are `enum`s which means they are JS objects at runtime; not eliminated at runtime.
d92a1a08d8/x-pack/plugins/fleet/common/types/models/epm.ts (L41-L63)
This commit is contained in:
parent
92134cb88e
commit
1702cf98f0
189 changed files with 483 additions and 469 deletions
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import { defaultPackages } from './epm';
|
||||
import { AgentPolicy } from '../types';
|
||||
import type { AgentPolicy } from '../types';
|
||||
|
||||
export const AGENT_POLICY_SAVED_OBJECT_TYPE = 'ingest-agent-policies';
|
||||
export const AGENT_POLICY_INDEX = '.fleet-policies';
|
||||
export const agentPolicyStatuses = {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { NewOutput } from '../types';
|
||||
import type { NewOutput } from '../types';
|
||||
|
||||
export const OUTPUT_SAVED_OBJECT_TYPE = 'ingest-outputs';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { NewPackagePolicy, PackagePolicy } from './types';
|
||||
import type { NewPackagePolicy, PackagePolicy } from './types';
|
||||
|
||||
export const createNewPackagePolicyMock = (): NewPackagePolicy => {
|
||||
return {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { AGENT_POLLING_THRESHOLD_MS, AGENT_SAVED_OBJECT_TYPE } from '../constants';
|
||||
import { Agent, AgentStatus } from '../types';
|
||||
import type { Agent, AgentStatus } from '../types';
|
||||
|
||||
export function getAgentStatus(agent: Agent, now: number = Date.now()): AgentStatus {
|
||||
const { last_checkin: lastCheckIn } = agent;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FullAgentPolicyKibanaConfig } from '../types';
|
||||
import type { FullAgentPolicyKibanaConfig } from '../types';
|
||||
|
||||
export function getFullAgentPolicyKibanaConfig(kibanaUrls: string[]): FullAgentPolicyKibanaConfig {
|
||||
// paths and protocol are validated to be the same for all urls, so use the first to get them
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { safeDump } from 'js-yaml';
|
||||
import { FullAgentPolicy } from '../types';
|
||||
import type { FullAgentPolicy } from '../types';
|
||||
|
||||
const POLICY_KEYS_ORDER = [
|
||||
'id',
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { isAgentUpgradeable } from './is_agent_upgradeable';
|
||||
import { Agent } from '../types/models/agent';
|
||||
import type { Agent } from '../types/models/agent';
|
||||
|
||||
const getAgent = ({
|
||||
version,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import semverCoerce from 'semver/functions/coerce';
|
||||
import semverLt from 'semver/functions/lt';
|
||||
import { Agent } from '../types';
|
||||
import type { Agent } from '../types';
|
||||
|
||||
export function isAgentUpgradeable(agent: Agent, kibanaVersion: string) {
|
||||
let agentVersion: string;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { Observable, Subscription } from 'rxjs';
|
||||
import { ILicense } from '../../../licensing/common/types';
|
||||
import type { ILicense } from '../../../licensing/common/types';
|
||||
|
||||
// Generic license service class that works with the license observable
|
||||
// Both server and client plugins instancates a singleton version of this class
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PackageInfo, AgentPolicy, PackagePolicy } from '../types';
|
||||
import type { PackageInfo, AgentPolicy, PackagePolicy } from '../types';
|
||||
|
||||
// Assume packages only ever include 1 config template for now
|
||||
export const isPackageLimited = (packageInfo: PackageInfo): boolean => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PackagePolicy, PackagePolicyInput } from '../types';
|
||||
import type { PackagePolicy, PackagePolicyInput } from '../types';
|
||||
import { storedPackagePoliciesToAgentInputs } from './package_policies_to_agent_inputs';
|
||||
|
||||
describe('Fleet - storedPackagePoliciesToAgentInputs', () => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PackagePolicy, FullAgentPolicyInput, FullAgentPolicyInputStream } from '../types';
|
||||
import type { PackagePolicy, FullAgentPolicyInput, FullAgentPolicyInputStream } from '../types';
|
||||
import { DEFAULT_OUTPUT } from '../constants';
|
||||
|
||||
export const storedPackagePoliciesToAgentInputs = (
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PackageInfo } from '../types';
|
||||
import type { PackageInfo } from '../types';
|
||||
import { packageToPackagePolicy, packageToPackagePolicyInputs } from './package_to_package_policy';
|
||||
|
||||
describe('Fleet - packageToPackagePolicy', () => {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
PackageInfo,
|
||||
RegistryPolicyTemplate,
|
||||
RegistryVarsEntry,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FullAgentPolicy } from './agent_policy';
|
||||
import type { FullAgentPolicy } from './agent_policy';
|
||||
import { AGENT_TYPE_EPHEMERAL, AGENT_TYPE_PERMANENT, AGENT_TYPE_TEMPORARY } from '../../constants';
|
||||
|
||||
export type AgentType =
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import { agentPolicyStatuses } from '../../constants';
|
||||
import { DataType, ValueOf } from '../../types';
|
||||
import { PackagePolicy, PackagePolicyPackage } from './package_policy';
|
||||
import { Output } from './output';
|
||||
import type { DataType, ValueOf } from '../../types';
|
||||
import type { PackagePolicy, PackagePolicyPackage } from './package_policy';
|
||||
import type { Output } from './output';
|
||||
|
||||
export type AgentPolicyStatus = typeof agentPolicyStatuses;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
// Follow pattern from https://github.com/elastic/kibana/pull/52447
|
||||
// TODO: Update when https://github.com/elastic/kibana/issues/53021 is closed
|
||||
import { SavedObject, SavedObjectAttributes, SavedObjectReference } from 'src/core/public';
|
||||
import type { SavedObject, SavedObjectAttributes, SavedObjectReference } from 'src/core/public';
|
||||
import {
|
||||
ASSETS_SAVED_OBJECT_TYPE,
|
||||
agentAssetTypes,
|
||||
|
@ -16,8 +16,8 @@ import {
|
|||
installationStatuses,
|
||||
requiredPackages,
|
||||
} from '../../constants';
|
||||
import { ValueOf } from '../../types';
|
||||
import { PackageSpecManifest, PackageSpecScreenshot } from './package_spec';
|
||||
import type { ValueOf } from '../../types';
|
||||
import type { PackageSpecManifest, PackageSpecScreenshot } from './package_spec';
|
||||
|
||||
export type InstallationStatus = typeof installationStatuses;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RegistryPolicyTemplate } from './epm';
|
||||
import type { RegistryPolicyTemplate } from './epm';
|
||||
|
||||
// Based on https://github.com/elastic/package-spec/blob/master/versions/1/manifest.spec.yml#L8
|
||||
export interface PackageSpecManifest {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { SavedObjectAttributes } from 'src/core/public';
|
||||
import type { SavedObjectAttributes } from 'src/core/public';
|
||||
|
||||
export interface BaseSettings {
|
||||
agent_auto_upgrade: boolean;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
Agent,
|
||||
AgentAction,
|
||||
NewAgentAction,
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AgentPolicy, NewAgentPolicy, FullAgentPolicy } from '../models';
|
||||
import { ListWithKuery } from './common';
|
||||
import type { AgentPolicy, NewAgentPolicy, FullAgentPolicy } from '../models';
|
||||
import type { ListWithKuery } from './common';
|
||||
|
||||
export interface GetAgentPoliciesRequest {
|
||||
query: ListWithKuery & {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { HttpFetchQuery } from 'src/core/public';
|
||||
import type { HttpFetchQuery } from 'src/core/public';
|
||||
|
||||
export interface ListWithKuery extends HttpFetchQuery {
|
||||
page?: number;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { DataStream } from '../models';
|
||||
import type { DataStream } from '../models';
|
||||
|
||||
export interface GetDataStreamsResponse {
|
||||
data_streams: DataStream[];
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EnrollmentAPIKey } from '../models';
|
||||
import type { EnrollmentAPIKey } from '../models';
|
||||
|
||||
export interface GetEnrollmentAPIKeysRequest {
|
||||
query: {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
AssetReference,
|
||||
CategorySummaryList,
|
||||
Installable,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Output } from '../models';
|
||||
import type { Output } from '../models';
|
||||
|
||||
export interface GetOneOutputResponse {
|
||||
item: Output;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PackagePolicy, NewPackagePolicy, UpdatePackagePolicy } from '../models';
|
||||
import type { PackagePolicy, NewPackagePolicy, UpdatePackagePolicy } from '../models';
|
||||
|
||||
export interface GetPackagePoliciesRequest {
|
||||
query: {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { Settings } from '../models';
|
||||
import type { Settings } from '../models';
|
||||
|
||||
export interface GetSettingsResponse {
|
||||
item: Settings;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { useContext } from 'react';
|
||||
import { FleetConfigType } from '../../../plugin';
|
||||
import type { FleetConfigType } from '../../../plugin';
|
||||
|
||||
export const ConfigContext = React.createContext<FleetConfigType | null>(null);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FleetStartServices } from '../../../plugin';
|
||||
import type { FleetStartServices } from '../../../plugin';
|
||||
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public';
|
||||
|
||||
export function useStartServices(): FleetStartServices {
|
||||
|
|
|
@ -5,13 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
BASE_PATH,
|
||||
StaticPage,
|
||||
DynamicPage,
|
||||
DynamicPagePathValues,
|
||||
pagePathGetters,
|
||||
} from '../constants';
|
||||
import { BASE_PATH, pagePathGetters } from '../constants';
|
||||
import type { StaticPage, DynamicPage, DynamicPagePathValues } from '../constants';
|
||||
import { useStartServices } from './';
|
||||
|
||||
const getPath = (page: StaticPage | DynamicPage, values: DynamicPagePathValues = {}): string => {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useEffect, useState } from 'react';
|
||||
import { ICON_TYPES } from '@elastic/eui';
|
||||
import { PackageInfo, PackageListItem } from '../types';
|
||||
import type { PackageInfo, PackageListItem } from '../types';
|
||||
import { useLinks } from '../sections/epm/hooks';
|
||||
import { sendGetPackageInfoByKey } from './index';
|
||||
|
||||
|
|
|
@ -5,14 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
useRequest,
|
||||
sendRequest,
|
||||
useConditionalRequest,
|
||||
SendConditionalRequestConfig,
|
||||
} from './use_request';
|
||||
import { useRequest, sendRequest, useConditionalRequest } from './use_request';
|
||||
import type { SendConditionalRequestConfig } from './use_request';
|
||||
import { agentPolicyRouteService } from '../../services';
|
||||
import {
|
||||
import type {
|
||||
GetAgentPoliciesRequest,
|
||||
GetAgentPoliciesResponse,
|
||||
GetOneAgentPolicyResponse,
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { useRequest, UseRequestConfig, sendRequest } from './use_request';
|
||||
import { useRequest, sendRequest } from './use_request';
|
||||
import type { UseRequestConfig } from './use_request';
|
||||
import { agentRouteService } from '../../services';
|
||||
import {
|
||||
import type {
|
||||
GetOneAgentResponse,
|
||||
GetOneAgentEventsResponse,
|
||||
GetOneAgentEventsRequest,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { sendRequest } from './use_request';
|
||||
import { appRoutesService } from '../../services';
|
||||
import { CheckPermissionsResponse } from '../../types';
|
||||
import type { CheckPermissionsResponse } from '../../types';
|
||||
|
||||
export const sendGetPermissionsCheck = () => {
|
||||
return sendRequest<CheckPermissionsResponse>({
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useRequest } from './use_request';
|
||||
import { dataStreamRouteService } from '../../services';
|
||||
import { GetDataStreamsResponse } from '../../types';
|
||||
import type { GetDataStreamsResponse } from '../../types';
|
||||
|
||||
export const useGetDataStreams = () => {
|
||||
return useRequest<GetDataStreamsResponse>({
|
||||
|
|
|
@ -5,15 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
useRequest,
|
||||
UseRequestConfig,
|
||||
sendRequest,
|
||||
useConditionalRequest,
|
||||
SendConditionalRequestConfig,
|
||||
} from './use_request';
|
||||
import { useRequest, sendRequest, useConditionalRequest } from './use_request';
|
||||
import type { UseRequestConfig, SendConditionalRequestConfig } from './use_request';
|
||||
import { enrollmentAPIKeyRouteService } from '../../services';
|
||||
import {
|
||||
import type {
|
||||
GetOneEnrollmentAPIKeyResponse,
|
||||
GetEnrollmentAPIKeysResponse,
|
||||
GetEnrollmentAPIKeysRequest,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { useRequest, sendRequest } from './use_request';
|
||||
import { epmRouteService } from '../../services';
|
||||
import {
|
||||
import type {
|
||||
GetCategoriesRequest,
|
||||
GetCategoriesResponse,
|
||||
GetPackagesRequest,
|
||||
|
@ -17,7 +17,7 @@ import {
|
|||
InstallPackageResponse,
|
||||
DeletePackageResponse,
|
||||
} from '../../types';
|
||||
import { GetStatsResponse } from '../../../../../common';
|
||||
import type { GetStatsResponse } from '../../../../../common';
|
||||
|
||||
export const useGetCategories = (query: GetCategoriesRequest['query'] = {}) => {
|
||||
return useRequest<GetCategoriesResponse>({
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { sendRequest, useRequest } from './use_request';
|
||||
import { outputRoutesService } from '../../services';
|
||||
import { PutOutputRequest, GetOutputsResponse } from '../../types';
|
||||
import type { PutOutputRequest, GetOutputsResponse } from '../../types';
|
||||
|
||||
export function useGetOutputs() {
|
||||
return useRequest<GetOutputsResponse>({
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
import { sendRequest, useRequest } from './use_request';
|
||||
import { packagePolicyRouteService } from '../../services';
|
||||
import {
|
||||
import type {
|
||||
CreatePackagePolicyRequest,
|
||||
CreatePackagePolicyResponse,
|
||||
UpdatePackagePolicyRequest,
|
||||
UpdatePackagePolicyResponse,
|
||||
} from '../../types';
|
||||
import {
|
||||
import type {
|
||||
DeletePackagePoliciesRequest,
|
||||
DeletePackagePoliciesResponse,
|
||||
GetPackagePoliciesRequest,
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { sendRequest, useRequest } from './use_request';
|
||||
import { settingsRoutesService } from '../../services';
|
||||
import { PutSettingsResponse, PutSettingsRequest, GetSettingsResponse } from '../../types';
|
||||
import type { PutSettingsResponse, PutSettingsRequest, GetSettingsResponse } from '../../types';
|
||||
|
||||
export function useGetSettings() {
|
||||
return useRequest<GetSettingsResponse>({
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { sendRequest } from './use_request';
|
||||
import { setupRouteService, fleetSetupRouteService } from '../../services';
|
||||
import { GetFleetStatusResponse } from '../../types';
|
||||
import type { GetFleetStatusResponse } from '../../types';
|
||||
|
||||
export const sendSetup = () => {
|
||||
return sendRequest({
|
||||
|
|
|
@ -6,14 +6,16 @@
|
|||
*/
|
||||
|
||||
import { useState, useEffect } from 'react';
|
||||
import { HttpSetup } from 'src/core/public';
|
||||
import type { HttpSetup } from 'src/core/public';
|
||||
import {
|
||||
SendRequestConfig,
|
||||
SendRequestResponse,
|
||||
UseRequestConfig as _UseRequestConfig,
|
||||
sendRequest as _sendRequest,
|
||||
useRequest as _useRequest,
|
||||
} from '../../../../../../../../src/plugins/es_ui_shared/public';
|
||||
import type {
|
||||
SendRequestConfig,
|
||||
SendRequestResponse,
|
||||
} from '../../../../../../../../src/plugins/es_ui_shared/public';
|
||||
|
||||
let httpClient: HttpSetup;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import React, { useContext } from 'react';
|
||||
import { UIExtensionPoint, UIExtensionsStorage } from '../types';
|
||||
import type { UIExtensionPoint, UIExtensionsStorage } from '../types';
|
||||
|
||||
export const UIExtensionsContext = React.createContext<UIExtensionsStorage>({});
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { useHistory, useLocation } from 'react-router-dom';
|
||||
import { useUrlParams } from './use_url_params';
|
||||
import { PAGE_SIZE_OPTIONS, Pagination, usePagination } from './use_pagination';
|
||||
import { PAGE_SIZE_OPTIONS, usePagination } from './use_pagination';
|
||||
import type { Pagination } from './use_pagination';
|
||||
|
||||
type SetUrlPagination = (pagination: Pagination) => void;
|
||||
interface UrlPagination {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FleetConfigType } from '../../../plugin';
|
||||
import type { FleetConfigType } from '../../../plugin';
|
||||
|
||||
export const createConfigurationMock = (): FleetConfigType => {
|
||||
return {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { dataPluginMock } from '../../../../../../../src/plugins/data/public/mocks';
|
||||
import { licensingMock } from '../../../../../licensing/public/mocks';
|
||||
import { homePluginMock } from '../../../../../../../src/plugins/home/public/mocks';
|
||||
import { MockedFleetSetupDeps, MockedFleetStartDeps } from './types';
|
||||
import type { MockedFleetSetupDeps, MockedFleetStartDeps } from './types';
|
||||
|
||||
export const createSetupDepsMock = (): MockedFleetSetupDeps => {
|
||||
return {
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UIExtensionsStorage } from '../types';
|
||||
import type { UIExtensionsStorage } from '../types';
|
||||
import { createExtensionRegistrationCallback } from '../services/ui_extensions';
|
||||
import { MockedFleetStart } from './types';
|
||||
import type { MockedFleetStart } from './types';
|
||||
|
||||
export const createStartMock = (extensionsStorage: UIExtensionsStorage = {}): MockedFleetStart => {
|
||||
return {
|
||||
|
|
|
@ -5,8 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { MockedKeys } from '@kbn/utility-types/jest';
|
||||
import { FleetSetupDeps, FleetStart, FleetStartDeps, FleetStartServices } from '../../../plugin';
|
||||
import type { MockedKeys } from '@kbn/utility-types/jest';
|
||||
import type {
|
||||
FleetSetupDeps,
|
||||
FleetStart,
|
||||
FleetStartDeps,
|
||||
FleetStartServices,
|
||||
} from '../../../plugin';
|
||||
|
||||
export type MockedFleetStartServices = MockedKeys<FleetStartServices>;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PackagePolicyConfigRecord, RegistryVarsEntry } from '../../../../types';
|
||||
import type { PackagePolicyConfigRecord, RegistryVarsEntry } from '../../../../types';
|
||||
import { validatePackagePolicyConfig } from './';
|
||||
|
||||
export const hasInvalidButRequiredVar = (
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RegistryVarsEntry } from '../../../../types';
|
||||
import type { RegistryVarsEntry } from '../../../../types';
|
||||
|
||||
export const isAdvancedVar = (varDef: RegistryVarsEntry): boolean => {
|
||||
if (varDef.show_user || (varDef.required && varDef.default === undefined)) {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { installationStatuses } from '../../../../../../../common/constants';
|
||||
import { PackageInfo, NewPackagePolicy, RegistryPolicyTemplate } from '../../../../types';
|
||||
import type { PackageInfo, NewPackagePolicy, RegistryPolicyTemplate } from '../../../../types';
|
||||
import { validatePackagePolicy, validationHasErrors } from './validate_package_policy';
|
||||
|
||||
describe('Fleet - validatePackagePolicy()', () => {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import { safeLoad } from 'js-yaml';
|
||||
import { getFlattenedObject, isValidNamespace } from '../../../../services';
|
||||
import {
|
||||
import type {
|
||||
NewPackagePolicy,
|
||||
PackagePolicyInput,
|
||||
PackagePolicyInputStream,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { RegistryRelease } from '../../../types';
|
||||
import type { RegistryRelease } from '../../../types';
|
||||
|
||||
export const RELEASE_BADGE_LABEL: { [key in Exclude<RegistryRelease, 'ga'>]: string } = {
|
||||
beta: i18n.translate('xpack.fleet.epm.releaseBadge.betaLabel', {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
import type {
|
||||
PackagePolicy,
|
||||
GetAgentPoliciesResponse,
|
||||
GetAgentPoliciesResponseItem,
|
||||
|
@ -15,10 +15,8 @@ import {
|
|||
import { agentPolicyRouteService } from '../../../../../services';
|
||||
import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '../../../../../constants';
|
||||
import { useGetPackagePolicies } from '../../../../../hooks';
|
||||
import {
|
||||
SendConditionalRequestConfig,
|
||||
useConditionalRequest,
|
||||
} from '../../../../../hooks/use_request/use_request';
|
||||
import { useConditionalRequest } from '../../../../../hooks/use_request/use_request';
|
||||
import type { SendConditionalRequestConfig } from '../../../../../hooks/use_request/use_request';
|
||||
|
||||
export interface PackagePolicyEnriched extends PackagePolicy {
|
||||
_agentPolicy: GetAgentPoliciesResponseItem | undefined;
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
*/
|
||||
|
||||
import { lazy } from 'react';
|
||||
|
||||
import {
|
||||
import type {
|
||||
PackagePolicyEditExtensionComponent,
|
||||
UIExtensionRegistrationCallback,
|
||||
UIExtensionsStorage,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UIExtensionRegistrationCallback, UIExtensionsStorage } from '../types';
|
||||
import type { UIExtensionRegistrationCallback, UIExtensionsStorage } from '../types';
|
||||
|
||||
/** Factory that returns a callback that can be used to register UI extensions */
|
||||
export const createExtensionRegistrationCallback = (
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ApplicationStart } from 'kibana/public';
|
||||
import { PackagePolicy } from './';
|
||||
import type { ApplicationStart } from 'kibana/public';
|
||||
import type { PackagePolicy } from './';
|
||||
|
||||
/**
|
||||
* Supported routing state for the create package policy page routes
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ComponentType, LazyExoticComponent } from 'react';
|
||||
import { NewPackagePolicy, PackageInfo, PackagePolicy } from './index';
|
||||
import type { ComponentType, LazyExoticComponent } from 'react';
|
||||
import type { NewPackagePolicy, PackageInfo, PackagePolicy } from './index';
|
||||
|
||||
/** Register a Fleet UI extension */
|
||||
export type UIExtensionRegistrationCallback = (extensionPoint: UIExtensionPoint) => void;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { PluginInitializerContext } from 'src/core/public';
|
||||
import type { PluginInitializerContext } from 'src/core/public';
|
||||
import { FleetPlugin } from './plugin';
|
||||
|
||||
export { FleetSetup, FleetStart } from './plugin';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import {
|
||||
import type {
|
||||
AppMountParameters,
|
||||
CoreSetup,
|
||||
Plugin,
|
||||
|
@ -14,18 +14,18 @@ import {
|
|||
} from 'src/core/public';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DEFAULT_APP_CATEGORIES, AppNavLinkStatus } from '../../../../src/core/public';
|
||||
import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../../src/plugins/data/public';
|
||||
import {
|
||||
HomePublicPluginSetup,
|
||||
FeatureCatalogueCategory,
|
||||
} from '../../../../src/plugins/home/public';
|
||||
import type {
|
||||
DataPublicPluginSetup,
|
||||
DataPublicPluginStart,
|
||||
} from '../../../../src/plugins/data/public';
|
||||
import { FeatureCatalogueCategory } from '../../../../src/plugins/home/public';
|
||||
import type { HomePublicPluginSetup } from '../../../../src/plugins/home/public';
|
||||
import { Storage } from '../../../../src/plugins/kibana_utils/public';
|
||||
import { LicensingPluginSetup } from '../../licensing/public';
|
||||
import { PLUGIN_ID, CheckPermissionsResponse, PostIngestSetupResponse } from '../common';
|
||||
import type { LicensingPluginSetup } from '../../licensing/public';
|
||||
import { PLUGIN_ID, setupRouteService, appRoutesService } from '../common';
|
||||
import type { CheckPermissionsResponse, PostIngestSetupResponse } from '../common';
|
||||
import { BASE_PATH } from './applications/fleet/constants';
|
||||
|
||||
import { FleetConfigType } from '../common/types';
|
||||
import { setupRouteService, appRoutesService } from '../common';
|
||||
import type { FleetConfigType } from '../common/types';
|
||||
import { licenseService } from './applications/fleet/hooks/use_license';
|
||||
import { setHttpClient } from './applications/fleet/hooks/use_request/use_request';
|
||||
import {
|
||||
|
@ -34,7 +34,10 @@ import {
|
|||
TutorialModuleNotice,
|
||||
} from './applications/fleet/components/home_integration';
|
||||
import { createExtensionRegistrationCallback } from './applications/fleet/services/ui_extensions';
|
||||
import { UIExtensionRegistrationCallback, UIExtensionsStorage } from './applications/fleet/types';
|
||||
import type {
|
||||
UIExtensionRegistrationCallback,
|
||||
UIExtensionsStorage,
|
||||
} from './applications/fleet/types';
|
||||
|
||||
export { FleetConfigType } from '../common/types';
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { createFlagError, run, ToolingLog } from '@kbn/dev-utils';
|
||||
import fetch from 'node-fetch';
|
||||
import os from 'os';
|
||||
import {
|
||||
import type {
|
||||
Agent as _Agent,
|
||||
PostAgentCheckinRequest,
|
||||
PostAgentCheckinResponse,
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { ElasticsearchClient, SavedObjectsClient } from 'kibana/server';
|
||||
import { SavedObjectsClient } from 'kibana/server';
|
||||
import type { ElasticsearchClient } from 'kibana/server';
|
||||
import { FleetConfigType } from '../../common/types';
|
||||
import * as AgentService from '../services/agents';
|
||||
import { isFleetServerSetup } from '../services/fleet_server';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FleetConfigType } from '..';
|
||||
import type { FleetConfigType } from '..';
|
||||
|
||||
export const getIsAgentsEnabled = (config: FleetConfigType) => {
|
||||
return config.agents.enabled;
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreSetup } from 'kibana/server';
|
||||
import { ElasticsearchClient, SavedObjectsClient } from '../../../../../src/core/server';
|
||||
import type { CoreSetup } from 'kibana/server';
|
||||
import { SavedObjectsClient } from '../../../../../src/core/server';
|
||||
import type { ElasticsearchClient } from '../../../../../src/core/server';
|
||||
|
||||
export async function getInternalClients(
|
||||
core: CoreSetup
|
||||
|
|
|
@ -9,7 +9,7 @@ import { SavedObjectsClient } from 'kibana/server';
|
|||
import _ from 'lodash';
|
||||
import { getPackageSavedObjects } from '../services/epm/packages/get';
|
||||
import { agentPolicyService } from '../services';
|
||||
import { NewPackagePolicy } from '../types';
|
||||
import type { NewPackagePolicy } from '../types';
|
||||
|
||||
export interface PackageUsage {
|
||||
name: string;
|
||||
|
|
|
@ -5,13 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
||||
import { CoreSetup } from 'kibana/server';
|
||||
import type { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
|
||||
import type { CoreSetup } from 'kibana/server';
|
||||
import { getIsAgentsEnabled } from './config_collectors';
|
||||
import { AgentUsage, getAgentUsage } from './agent_collectors';
|
||||
import { getAgentUsage } from './agent_collectors';
|
||||
import type { AgentUsage } from './agent_collectors';
|
||||
import { getInternalClients } from './helpers';
|
||||
import { PackageUsage, getPackageUsage } from './package_collectors';
|
||||
import { FleetConfigType } from '..';
|
||||
import { getPackageUsage } from './package_collectors';
|
||||
import type { PackageUsage } from './package_collectors';
|
||||
import type { FleetConfigType } from '..';
|
||||
|
||||
interface Usage {
|
||||
agents_enabled: boolean;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
*/
|
||||
|
||||
import Boom, { isBoom } from '@hapi/boom';
|
||||
import {
|
||||
import { KibanaRequest } from 'src/core/server';
|
||||
import type {
|
||||
RequestHandlerContext,
|
||||
KibanaRequest,
|
||||
IKibanaResponse,
|
||||
KibanaResponseFactory,
|
||||
} from 'src/core/server';
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import type { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
|
||||
import { FleetPlugin } from './plugin';
|
||||
import {
|
||||
AGENT_POLICY_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
|
||||
|
|
|
@ -12,12 +12,11 @@ import {
|
|||
} from 'src/core/server/mocks';
|
||||
import { coreMock } from '../../../../src/core/server/mocks';
|
||||
import { licensingMock } from '../../../plugins/licensing/server/mocks';
|
||||
|
||||
import { FleetAppContext } from './plugin';
|
||||
import type { FleetAppContext } from './plugin';
|
||||
import { encryptedSavedObjectsMock } from '../../encrypted_saved_objects/server/mocks';
|
||||
import { securityMock } from '../../security/server/mocks';
|
||||
import { PackagePolicyServiceInterface } from './services/package_policy';
|
||||
import { AgentPolicyServiceInterface, AgentService } from './services';
|
||||
import type { PackagePolicyServiceInterface } from './services/package_policy';
|
||||
import type { AgentPolicyServiceInterface, AgentService } from './services';
|
||||
|
||||
export const createAppContextStartContractMock = (): FleetAppContext => {
|
||||
return {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { postAgentAcksHandlerBuilder } from './acks_handlers';
|
||||
import {
|
||||
import type {
|
||||
ElasticsearchClient,
|
||||
KibanaResponseFactory,
|
||||
RequestHandlerContext,
|
||||
|
@ -17,9 +17,9 @@ import {
|
|||
httpServerMock,
|
||||
savedObjectsClientMock,
|
||||
} from '../../../../../../src/core/server/mocks';
|
||||
import { PostAgentAcksResponse } from '../../../common/types/rest_spec';
|
||||
import type { PostAgentAcksResponse } from '../../../common/types/rest_spec';
|
||||
import { AckEventSchema } from '../../types/models';
|
||||
import { AcksService } from '../../services/agents';
|
||||
import type { AcksService } from '../../services/agents';
|
||||
|
||||
describe('test acks schema', () => {
|
||||
it('validate that ack event schema expect action id', async () => {
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
// handlers that handle events from agents in response to actions received
|
||||
|
||||
import { RequestHandler } from 'kibana/server';
|
||||
import { AcksService } from '../../services/agents';
|
||||
import { AgentEvent } from '../../../common/types/models';
|
||||
import { PostAgentAcksRequest, PostAgentAcksResponse } from '../../../common/types/rest_spec';
|
||||
import type { RequestHandler } from 'kibana/server';
|
||||
import type { AcksService } from '../../services/agents';
|
||||
import type { AgentEvent } from '../../../common/types/models';
|
||||
import type { PostAgentAcksRequest, PostAgentAcksResponse } from '../../../common/types/rest_spec';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
||||
export const postAgentAcksHandlerBuilder = function (
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { NewAgentActionSchema } from '../../types/models';
|
||||
import {
|
||||
import type {
|
||||
ElasticsearchClient,
|
||||
KibanaResponseFactory,
|
||||
RequestHandlerContext,
|
||||
|
@ -17,10 +17,10 @@ import {
|
|||
savedObjectsClientMock,
|
||||
httpServerMock,
|
||||
} from 'src/core/server/mocks';
|
||||
import { ActionsService } from '../../services/agents';
|
||||
import { AgentAction } from '../../../common/types/models';
|
||||
import type { ActionsService } from '../../services/agents';
|
||||
import type { AgentAction } from '../../../common/types/models';
|
||||
import { postNewAgentActionHandlerBuilder } from './actions_handlers';
|
||||
import {
|
||||
import type {
|
||||
PostNewAgentActionRequest,
|
||||
PostNewAgentActionResponse,
|
||||
} from '../../../common/types/rest_spec';
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
|
||||
// handlers that handle agent actions request
|
||||
|
||||
import { RequestHandler } from 'kibana/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler } from 'kibana/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { PostNewAgentActionRequestSchema } from '../../types/rest_spec';
|
||||
import { ActionsService } from '../../services/agents';
|
||||
import { PostNewAgentActionResponse } from '../../../common/types/rest_spec';
|
||||
import type { ActionsService } from '../../services/agents';
|
||||
import type { PostNewAgentActionResponse } from '../../../common/types/rest_spec';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
||||
export const postNewAgentActionHandlerBuilder = function (
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { AbortController } from 'abort-controller';
|
||||
import {
|
||||
import type {
|
||||
GetAgentsResponse,
|
||||
GetOneAgentResponse,
|
||||
GetOneAgentEventsResponse,
|
||||
|
@ -25,11 +25,11 @@ import {
|
|||
UpdateAgentRequestSchema,
|
||||
DeleteAgentRequestSchema,
|
||||
GetOneAgentEventsRequestSchema,
|
||||
PostAgentCheckinRequest,
|
||||
GetAgentStatusRequestSchema,
|
||||
PutAgentReassignRequestSchema,
|
||||
PostBulkAgentReassignRequestSchema,
|
||||
} from '../../types';
|
||||
import type { PostAgentCheckinRequest } from '../../types';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
import { licenseService } from '../../services';
|
||||
import * as AgentService from '../../services/agents';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter, RouteValidationResultFactory } from 'src/core/server';
|
||||
import type { IRouter, RouteValidationResultFactory } from 'src/core/server';
|
||||
import Ajv from 'ajv';
|
||||
import {
|
||||
PLUGIN_ID,
|
||||
|
@ -51,7 +51,7 @@ import * as AgentService from '../../services/agents';
|
|||
import { postNewAgentActionHandlerBuilder } from './actions_handlers';
|
||||
import { appContextService } from '../../services';
|
||||
import { postAgentUnenrollHandler, postBulkAgentsUnenrollHandler } from './unenroll_handler';
|
||||
import { FleetConfigType } from '../..';
|
||||
import type { FleetConfigType } from '../..';
|
||||
import { postAgentUpgradeHandler, postBulkAgentsUpgradeHandler } from './upgrade_handler';
|
||||
|
||||
const ajv = new Ajv({
|
||||
|
|
|
@ -5,9 +5,12 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import { PostAgentUnenrollResponse, PostBulkAgentUnenrollResponse } from '../../../common/types';
|
||||
import type { RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import type {
|
||||
PostAgentUnenrollResponse,
|
||||
PostBulkAgentUnenrollResponse,
|
||||
} from '../../../common/types';
|
||||
import { PostAgentUnenrollRequestSchema, PostBulkAgentUnenrollRequestSchema } from '../../types';
|
||||
import { licenseService } from '../../services';
|
||||
import * as AgentService from '../../services/agents';
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import semverCoerce from 'semver/functions/coerce';
|
||||
import { PostAgentUpgradeResponse, PostBulkAgentUpgradeResponse } from '../../../common/types';
|
||||
import type { PostAgentUpgradeResponse, PostBulkAgentUpgradeResponse } from '../../../common/types';
|
||||
import { PostAgentUpgradeRequestSchema, PostBulkAgentUpgradeRequestSchema } from '../../types';
|
||||
import * as AgentService from '../../services/agents';
|
||||
import { appContextService } from '../../services';
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import { RequestHandler, ResponseHeaders } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler, ResponseHeaders } from 'src/core/server';
|
||||
import bluebird from 'bluebird';
|
||||
import { fullAgentPolicyToYaml } from '../../../common/services';
|
||||
import { appContextService, agentPolicyService, packagePolicyService } from '../../services';
|
||||
|
@ -20,10 +20,10 @@ import {
|
|||
CopyAgentPolicyRequestSchema,
|
||||
DeleteAgentPolicyRequestSchema,
|
||||
GetFullAgentPolicyRequestSchema,
|
||||
AgentPolicy,
|
||||
NewPackagePolicy,
|
||||
} from '../../types';
|
||||
import {
|
||||
import type { AgentPolicy, NewPackagePolicy } from '../../types';
|
||||
import { defaultPackages } from '../../../common';
|
||||
import type {
|
||||
GetAgentPoliciesResponse,
|
||||
GetAgentPoliciesResponseItem,
|
||||
GetOneAgentPolicyResponse,
|
||||
|
@ -32,7 +32,6 @@ import {
|
|||
CopyAgentPolicyResponse,
|
||||
DeleteAgentPolicyResponse,
|
||||
GetFullAgentPolicyResponse,
|
||||
defaultPackages,
|
||||
} from '../../../common';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, AGENT_POLICY_API_ROUTES } from '../../constants';
|
||||
import {
|
||||
GetAgentPoliciesRequestSchema,
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter, RequestHandler } from 'src/core/server';
|
||||
import type { IRouter, RequestHandler } from 'src/core/server';
|
||||
import { APP_API_ROUTES } from '../../constants';
|
||||
import { appContextService } from '../../services';
|
||||
import { CheckPermissionsResponse } from '../../../common';
|
||||
import type { CheckPermissionsResponse } from '../../../common';
|
||||
|
||||
export const getCheckPermissionsHandler: RequestHandler = async (context, request, response) => {
|
||||
const body: CheckPermissionsResponse = { success: true };
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler, SavedObjectsClientContract } from 'src/core/server';
|
||||
import { keyBy, keys, merge } from 'lodash';
|
||||
import { DataStream } from '../../types';
|
||||
import { GetDataStreamsResponse, KibanaAssetType, KibanaSavedObjectType } from '../../../common';
|
||||
import type { RequestHandler, SavedObjectsClientContract } from 'src/core/server';
|
||||
import type { DataStream } from '../../types';
|
||||
import { KibanaAssetType, KibanaSavedObjectType } from '../../../common';
|
||||
import type { GetDataStreamsResponse } from '../../../common';
|
||||
import { getPackageSavedObjects, getKibanaSavedObject } from '../../services/epm/packages/get';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, DATA_STREAM_API_ROUTES } from '../../constants';
|
||||
import { getListHandler } from './handlers';
|
||||
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import {
|
||||
GetEnrollmentAPIKeysRequestSchema,
|
||||
PostEnrollmentAPIKeyRequestSchema,
|
||||
DeleteEnrollmentAPIKeyRequestSchema,
|
||||
GetOneEnrollmentAPIKeyRequestSchema,
|
||||
} from '../../types';
|
||||
import {
|
||||
import type {
|
||||
GetEnrollmentAPIKeysResponse,
|
||||
GetOneEnrollmentAPIKeyResponse,
|
||||
DeleteEnrollmentAPIKeyResponse,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, ENROLLMENT_API_KEY_ROUTES } from '../../constants';
|
||||
import {
|
||||
GetEnrollmentAPIKeysRequestSchema,
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import mime from 'mime-types';
|
||||
import path from 'path';
|
||||
import { RequestHandler, ResponseHeaders, KnownHeaders } from 'src/core/server';
|
||||
import {
|
||||
import type { RequestHandler, ResponseHeaders, KnownHeaders } from 'src/core/server';
|
||||
import type {
|
||||
GetInfoResponse,
|
||||
InstallPackageResponse,
|
||||
DeletePackageResponse,
|
||||
|
@ -33,7 +33,6 @@ import {
|
|||
GetStatsRequestSchema,
|
||||
} from '../../types';
|
||||
import {
|
||||
BulkInstallResponse,
|
||||
bulkInstallPackages,
|
||||
getCategories,
|
||||
getPackages,
|
||||
|
@ -47,6 +46,7 @@ import {
|
|||
getInstallationObject,
|
||||
getInstallation,
|
||||
} from '../../services/epm/packages';
|
||||
import type { BulkInstallResponse } from '../../services/epm/packages';
|
||||
import { defaultIngestErrorHandler, ingestErrorToResponseOptions } from '../../errors';
|
||||
import { splitPkgKey } from '../../services/epm/registry';
|
||||
import { licenseService } from '../../services';
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, EPM_API_ROUTES } from '../../constants';
|
||||
import {
|
||||
getCategoriesHandler,
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
*/
|
||||
|
||||
import url from 'url';
|
||||
import { IRouter, BasePath, KibanaRequest } from 'src/core/server';
|
||||
import { BasePath, KibanaRequest } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { INSTALL_SCRIPT_API_ROUTES } from '../../constants';
|
||||
import { getScript } from '../../services/install_script';
|
||||
import { InstallScriptRequestSchema } from '../../types';
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
isLimitedRoute,
|
||||
registerLimitedConcurrencyRoutes,
|
||||
} from './limited_concurrency';
|
||||
import { FleetConfigType } from '../index';
|
||||
import type { FleetConfigType } from '../index';
|
||||
|
||||
describe('registerLimitedConcurrencyRoutes', () => {
|
||||
test(`doesn't call registerOnPreAuth if maxConcurrentConnections is 0`, async () => {
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { KibanaRequest } from 'kibana/server';
|
||||
import type {
|
||||
CoreSetup,
|
||||
KibanaRequest,
|
||||
LifecycleResponseFactory,
|
||||
OnPreAuthToolkit,
|
||||
OnPreAuthHandler,
|
||||
} from 'kibana/server';
|
||||
import { LIMITED_CONCURRENCY_ROUTE_TAG } from '../../common';
|
||||
import { FleetConfigType } from '../index';
|
||||
import type { FleetConfigType } from '../index';
|
||||
|
||||
export class MaxCounter {
|
||||
constructor(private readonly max: number = 1) {}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { GetOneOutputRequestSchema, PutOutputRequestSchema } from '../../types';
|
||||
import { GetOneOutputResponse, GetOutputsResponse } from '../../../common';
|
||||
import type { GetOneOutputResponse, GetOutputsResponse } from '../../../common';
|
||||
import { outputService } from '../../services/output';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, OUTPUT_API_ROUTES } from '../../constants';
|
||||
import { getOneOuputHandler, getOutputsHandler, putOuputHandler } from './handler';
|
||||
import {
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
*/
|
||||
|
||||
import { httpServerMock, httpServiceMock } from 'src/core/server/mocks';
|
||||
import { IRouter, KibanaRequest, RequestHandler, RouteConfig } from 'kibana/server';
|
||||
import { KibanaRequest } from 'kibana/server';
|
||||
import type { IRouter, RequestHandler, RouteConfig } from 'kibana/server';
|
||||
import { registerRoutes } from './index';
|
||||
import { PACKAGE_POLICY_API_ROUTES } from '../../../common/constants';
|
||||
import { appContextService } from '../../services';
|
||||
import { appContextService, packagePolicyService } from '../../services';
|
||||
import { createAppContextStartContractMock, xpackMocks } from '../../mocks';
|
||||
import { PackagePolicyServiceInterface, ExternalCallback } from '../..';
|
||||
import type { PackagePolicyServiceInterface, ExternalCallback } from '../..';
|
||||
import { CreatePackagePolicyRequestSchema } from '../../types/rest_spec';
|
||||
import { packagePolicyService } from '../../services';
|
||||
|
||||
const packagePolicyServiceMock = packagePolicyService as jest.Mocked<PackagePolicyServiceInterface>;
|
||||
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import Boom from '@hapi/boom';
|
||||
import { RequestHandler, SavedObjectsErrorHelpers } from '../../../../../../src/core/server';
|
||||
import { SavedObjectsErrorHelpers } from '../../../../../../src/core/server';
|
||||
import type { RequestHandler } from '../../../../../../src/core/server';
|
||||
import { appContextService, packagePolicyService } from '../../services';
|
||||
import {
|
||||
GetPackagePoliciesRequestSchema,
|
||||
|
@ -16,7 +17,7 @@ import {
|
|||
UpdatePackagePolicyRequestSchema,
|
||||
DeletePackagePoliciesRequestSchema,
|
||||
} from '../../types';
|
||||
import { CreatePackagePolicyResponse, DeletePackagePoliciesResponse } from '../../../common';
|
||||
import type { CreatePackagePolicyResponse, DeletePackagePoliciesResponse } from '../../../common';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
||||
export const getPackagePoliciesHandler: RequestHandler<
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, PACKAGE_POLICY_API_ROUTES } from '../../constants';
|
||||
import {
|
||||
GetPackagePoliciesRequestSchema,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter, RequestHandler } from 'src/core/server';
|
||||
import type { IRouter, RequestHandler } from 'src/core/server';
|
||||
import { appContextService } from '../services';
|
||||
|
||||
export function enforceSuperUser<T1, T2, T3>(
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter, RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { IRouter, RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { PLUGIN_ID, SETTINGS_API_ROUTES } from '../../constants';
|
||||
import { PutSettingsRequestSchema, GetSettingsRequestSchema } from '../../types';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { httpServerMock } from 'src/core/server/mocks';
|
||||
import { PostIngestSetupResponse } from '../../../common';
|
||||
import type { PostIngestSetupResponse } from '../../../common';
|
||||
import { RegistryError } from '../../errors';
|
||||
import { createAppContextStartContractMock, xpackMocks } from '../../mocks';
|
||||
import { FleetSetupHandler } from './handlers';
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { RequestHandler } from 'src/core/server';
|
||||
import { TypeOf } from '@kbn/config-schema';
|
||||
import type { RequestHandler } from 'src/core/server';
|
||||
import type { TypeOf } from '@kbn/config-schema';
|
||||
import { outputService, appContextService } from '../../services';
|
||||
import { GetFleetStatusResponse, PostIngestSetupResponse } from '../../../common';
|
||||
import type { GetFleetStatusResponse, PostIngestSetupResponse } from '../../../common';
|
||||
import { setupIngestManager, setupFleet } from '../../services/setup';
|
||||
import { PostFleetSetupRequestSchema } from '../../types';
|
||||
import { defaultIngestErrorHandler } from '../../errors';
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { IRouter } from 'src/core/server';
|
||||
|
||||
import type { IRouter } from 'src/core/server';
|
||||
import { PLUGIN_ID, AGENTS_SETUP_API_ROUTES, SETUP_API_ROUTE } from '../../constants';
|
||||
import { FleetConfigType } from '../../../common';
|
||||
import type { FleetConfigType } from '../../../common';
|
||||
import { getFleetStatusHandler, createFleetSetupHandler, FleetSetupHandler } from './handlers';
|
||||
import { PostFleetSetupRequestSchema } from '../../types';
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue