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

Extract src/core in a separate TS project #76785

Merged
merged 25 commits into from
Sep 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
871fa93
break dependency on data plugin TS code
mshustov Sep 4, 2020
2f8fe03
move global typings to @kbn/utility-types
mshustov Sep 4, 2020
58a6833
import types from @kbn/utility-types
mshustov Sep 4, 2020
053f33a
remove type dependency on plugins
mshustov Sep 4, 2020
3ee5024
add intermediate js files to break dependency on outter TS code
mshustov Sep 4, 2020
0afe83f
temp type declaration for query-string
mshustov Sep 4, 2020
b013a97
declare src/core project
mshustov Sep 4, 2020
4d11218
export types to reference in the built d.ts files
mshustov Sep 4, 2020
51f9a25
reference core project
mshustov Sep 4, 2020
4c720f0
move jest types out of kbn/utility-types due to a clash with mocha types
mshustov Sep 4, 2020
5109563
Merge branch 'master' into src-core-ts-project
mshustov Sep 4, 2020
51e45d5
fix wrong es_kuery path and ts project paths
mshustov Sep 4, 2020
702edf8
reference core from packages consuming it
mshustov Sep 4, 2020
79cec57
x-pack & oss should use the same lodash version
mshustov Sep 5, 2020
568cf5d
Revert "x-pack & oss should use the same lodash version"
mshustov Sep 5, 2020
ffadf41
use the same lodash version
mshustov Sep 6, 2020
a14a7ed
fix @types/lodash TS2300: Duplicate identifier error
mshustov Sep 7, 2020
795026e
fix wrong imports
mshustov Sep 7, 2020
3c5dd03
Merge branch 'master' into src-core-ts-project
mshustov Sep 7, 2020
c9b2342
update docs
mshustov Sep 7, 2020
d016606
Merge branch 'master' into src-core-ts-project
mshustov Sep 8, 2020
2fba6fa
update docs
mshustov Sep 8, 2020
744a7b1
Merge branch 'master' into src-core-ts-project
mshustov Sep 14, 2020
a4f8860
Merge branch 'master' into src-core-ts-project
mshustov Sep 15, 2020
5cd4bad
add a comment why file is needed
mshustov Sep 15, 2020
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" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a hard requirement, but it reduced the number of processed files

node --max-old-space-size=6144 ./node_modules/.bin/tsc -p examples/bfetch_explorer/tsconfig.json --extendedDiagnostics --noEmit

with references

Files:                         876
Lines:                      219410
Nodes:                      789781
Identifiers:                286371

without references

Files:                        1203
Lines:                      272257
Nodes:                      930313
Identifiers:                333766

]
}
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" }
]
}
12 changes: 12 additions & 0 deletions packages/kbn-utility-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,15 @@ export type PublicKeys<T> = keyof T;
* Returns an object with public keys only.
*/
export type PublicContract<T> = Pick<T, PublicKeys<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,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import type { PublicMethodsOf } from '@kbn/utility-types';
import { CapabilitiesService, CapabilitiesStart } from './capabilities_service';
import { deepFreeze } from '../../../utils';

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 @@ -24,13 +23,12 @@ import { MaybePromise } from '@kbn/utility-types';
import { Observable } from 'rxjs';
import { ParsedQuery } from 'query-string';
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