Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.x] Extract src/core in a separate TS project (#76785) #77509

Merged
merged 2 commits into from
Sep 16, 2020
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
5 changes: 4 additions & 1 deletion examples/alerting_example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"common/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/bfetch_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/dashboard_embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/developer_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/embeddable_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"server/**/*.ts",
"../../typings/**/*"
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/embeddable_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/routing_example/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"common/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/search_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/state_containers_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@
"common/**/*.ts",
"../../typings/**/*"
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/ui_action_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/ui_actions_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,8 @@
"public/**/*.tsx",
"../../typings/**/*",
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/url_generators_examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*"
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
5 changes: 4 additions & 1 deletion examples/url_generators_explorer/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"server/**/*.ts",
"../../typings/**/*"
],
"exclude": []
"exclude": [],
"references": [
{ "path": "../../src/core/tsconfig.json" }
]
}
8 changes: 7 additions & 1 deletion packages/kbn-utility-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,14 @@ export type PublicKeys<T> = keyof T;
*/
export type PublicContract<T> = Pick<T, PublicKeys<T>>;

type MethodKeysOf<T> = {
/**
* Returns public method names
*/
export type MethodKeysOf<T> = {
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
}[keyof T];

/**
* Returns an object with public methods only.
*/
export type PublicMethodsOf<T> = Pick<T, MethodKeysOf<T>>;
1 change: 0 additions & 1 deletion packages/kbn-utility-types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"stripInternal": true,
"declarationMap": true,
"types": [
"jest",
"node"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* specific language governing permissions and limitations
* under the License.
*/

import { deepFreeze } from '@kbn/std';
import type { PublicMethodsOf } from '@kbn/utility-types';
import { CapabilitiesService, CapabilitiesStart } from './capabilities_service';
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/application/test_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { AppUnmount, Mounter } from './types';
import { ApplicationService } from './application_service';

Expand Down
1 change: 1 addition & 0 deletions src/core/public/chrome/chrome_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import { BehaviorSubject } from 'rxjs';
import type { PublicMethodsOf } from '@kbn/utility-types';
import { ChromeBadge, ChromeBrand, ChromeBreadcrumb, ChromeService, InternalChromeStart } from './';

const createStartContractMock = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/context/context_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { ContextService, ContextSetup } from './context_service';
import { contextMock } from '../../utils/context.mock';

Expand Down
2 changes: 1 addition & 1 deletion src/core/public/core_app/core_app.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { CoreApp } from './core_app';

type CoreAppContract = PublicMethodsOf<CoreApp>;
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/doc_links/doc_links_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { injectedMetadataServiceMock } from '../injected_metadata/injected_metadata_service.mock';
import { DocLinksService, DocLinksStart } from './doc_links_service';

Expand Down
1 change: 1 addition & 0 deletions src/core/public/fatal_errors/fatal_errors_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import { FatalErrorsService, FatalErrorsSetup } from './fatal_errors_service';

const createSetupContractMock = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/http/http_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { HttpService } from './http_service';
import { HttpSetup } from './types';
import { BehaviorSubject } from 'rxjs';
Expand Down
1 change: 1 addition & 0 deletions src/core/public/http/loading_count_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { LoadingCountSetup, LoadingCountService } from './loading_count_service';
import { BehaviorSubject } from 'rxjs';
import type { PublicMethodsOf } from '@kbn/utility-types';

const createSetupContractMock = () => {
const setupContract: jest.Mocked<LoadingCountSetup> = {
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/i18n/i18n_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/

import React from 'react';
import type { PublicMethodsOf } from '@kbn/utility-types';

import { I18nService, I18nStart } from './i18n_service';

const PassThroughComponent = ({ children }: { children: React.ReactNode }) => children;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import { InjectedMetadataService, InjectedMetadataSetup } from './injected_metadata_service';

const createSetupContractMock = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/integrations/integrations_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { IntegrationsService } from './integrations_service';

type IntegrationsServiceContract = PublicMethodsOf<IntegrationsService>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import {
NotificationsService,
NotificationsSetup,
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/overlays/banners/banners_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { OverlayBannersStart, OverlayBannersService } from './banners_service';

const createStartContractMock = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/overlays/flyout/flyout_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { FlyoutService, OverlayFlyoutStart } from './flyout_service';

const createStartContractMock = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/overlays/modal/modal_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { ModalService, OverlayModalStart } from './modal_service';

const createStartContractMock = () => {
Expand Down
1 change: 1 addition & 0 deletions src/core/public/overlays/overlay_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import { OverlayService, OverlayStart } from './overlay_service';
import { overlayBannersServiceMock } from './banners/banners_service.mock';
import { overlayFlyoutServiceMock } from './flyout/flyout_service.mock';
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/plugins/plugins_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { PluginsService, PluginsServiceSetup } from './plugins_service';

const createSetupContractMock = () => {
Expand Down
4 changes: 1 addition & 3 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import { Action } from 'history';
import { ApiResponse } from '@elastic/elasticsearch/lib/Transport';
import Boom from 'boom';
import { ErrorToastOptions as ErrorToastOptions_2 } from 'src/core/public/notifications';
import { EuiBreadcrumb } from '@elastic/eui';
import { EuiButtonEmptyProps } from '@elastic/eui';
import { EuiConfirmModalProps } from '@elastic/eui';
Expand All @@ -23,13 +22,12 @@ import { LocationDescriptorObject } from 'history';
import { MaybePromise } from '@kbn/utility-types';
import { Observable } from 'rxjs';
import { Path } from 'history';
import { PublicMethodsOf } from '@kbn/utility-types';
import { PublicUiSettingsParams as PublicUiSettingsParams_2 } from 'src/core/server/types';
import React from 'react';
import { RecursiveReadonly } from '@kbn/utility-types';
import * as Rx from 'rxjs';
import { SavedObject as SavedObject_2 } from 'src/core/server';
import { ShallowPromise } from '@kbn/utility-types';
import { ToastInputFields as ToastInputFields_2 } from 'src/core/public/notifications';
import { TransportRequestOptions } from '@elastic/elasticsearch/lib/Transport';
import { TransportRequestParams } from '@elastic/elasticsearch/lib/Transport';
import { TransportRequestPromise } from '@elastic/elasticsearch/lib/Transport';
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/rendering/rendering_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { RenderingService } from './rendering_service';

type RenderingServiceContract = PublicMethodsOf<RenderingService>;
Expand Down
1 change: 1 addition & 0 deletions src/core/public/saved_objects/saved_objects_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { cloneDeep, pick, throttle } from 'lodash';
import { resolve as resolveUrl } from 'url';
import type { PublicMethodsOf } from '@kbn/utility-types';

import {
SavedObject,
Expand Down
1 change: 1 addition & 0 deletions src/core/public/ui_settings/ui_settings_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* under the License.
*/
import * as Rx from 'rxjs';
import type { PublicMethodsOf } from '@kbn/utility-types';
import { UiSettingsService } from './';
import { IUiSettingsClient } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/audit_trail/audit_trail_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { AuditTrailSetup, AuditTrailStart, Auditor } from './types';
import { AuditTrailService } from './audit_trail_service';

Expand Down
2 changes: 1 addition & 1 deletion src/core/server/capabilities/capabilities_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { CapabilitiesService, CapabilitiesSetup, CapabilitiesStart } from './capabilities_service';

const createSetupContractMock = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/config/config_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { Type } from '@kbn/config-schema';
import { isEqual } from 'lodash';
import { BehaviorSubject, combineLatest, Observable } from 'rxjs';
Expand Down
2 changes: 1 addition & 1 deletion src/core/server/config/raw_config_service.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import type { PublicMethodsOf } from '@kbn/utility-types';
import { RawConfigService } from './raw_config_service';
import { Observable, of } from 'rxjs';

Expand Down
Loading