kibana/x-pack/typings/index.d.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
declare module '*.html' {
const template: string;
Migrate from tslint (#33826) * chore(NA): remove tslint dependencies, configs and enable eslint typescript parser. * fix(NA): apply recommend eslint typescript rule.s * chore(NA): upgrade eslint package versions. * chore(NA): split javascript eslint config in an override section. * chore(NA): split all eslint configs with overrides. * chore(NA): remove missing console.log. * chore(NA): change eslint splits and overrides order. * chore(NA): replace tslint disable comments with eslint ones. * chore(NA): solve eslint typescript errors for elastic/kibana-custom/no-default-export * chore(NA): fixed multiple eslint typescript rule failures. * chore(NA): add tarfet folder to the eslint ignore. * chore(NA): apply prettier rule to ts type file. * chore(NA): remove last mentions to tslint * chore(NA): add old defined rules * chore(NA): missing port rules website * chore(na): ordered rules * chore(NA): solved eslint typescript problems. * chore(NA): fix spaced comment problems. * chore(NA): fix some more eslint typescript rules: import/order no-empty-interface * chore(NA): fix last rules and comment out what are the ones still failing. * chore(NA): comment out camelcase rule. * chore(NA): regenerate kbn pm dist. * chore(NA): updated snapshots. * chore(NA): updated snapshots. * chore(NA): disabled sort-keys rule. * chore(NA): remove rule prefer-arrow/prefer-arrow-functions. * chore(NA): fix for @typescript-eslint/no-var-requires rule. * chore(NA): fixes for @typescript-eslint/camelcase rule. * chore(NA): fix typo on eslint config kibana typescript. Co-Authored-By: mistic <tiagoffcc@hotmail.com> * chore(NA): remove legacy note after the intellij upgrade to 2019.1 * fix(NA): import order plugin. * chore(NA): fix ts ignore positions after auto fix. * fix(NA): performance issue with typescript eslint. * refact(NA): eslint configs organization. * chore(NA): apply resticted paths to ts files too. * chore(NA): split comment from eslint ignore.
2019-04-05 18:45:23 +02:00
// eslint-disable-next-line import/no-default-export
export default template;
}
[Core] Rewrite saved objects in typescript (#36829) * Convert simple files to TS * Fix jest tests * Rename saved_objects_client{.js => .ts} * WIP saved_objects_client * saved_objects repository{.js => .ts} * includedFields support string[] for type paramater * Repository/saved_objects_client -> TS * Fix tests and dependencies * Fix saved objects type errors and simplify * saved_objects/index saved_objects/service/index -> ts * Fix saved objects export test after switching to typed mock * Workaround type error * Revert "Workaround type error" This reverts commit de3252267eb2e6bf56a5584d271b55a7afdc1c53. * Correctly type Server.savedObjects.SaveObjectsClient constructor * saved_objects/service/lib/index.{js -> ts} * saved_objects/service/lib/scoped_client_provider{js -> ts} * Typescriptify scoped_client_provider * Fix x-pack jest imports * Add lodash/internal/toPath typings to xpath * Introduce SavedObjectsClientContract We need a way to specify that injected dependencies should adhere to the SavedObjectsClient "contract". We can't use the SavedObjectsClient class itself since it contains the private _repository property which in TS is included in the type signature of a class. * Cleanup and simplify types * Fix repository#delete should return {} * Add SavedObjects repository test for uncovered bug Test for a bug in our previous js implementation that can lead to data corruption and data loss. If a bulkGet request is made where one of the objects to fetch is of a type that isn't allowed, the returned result will include documents which have the incorrect id and type assigned. E.g. the data of an object with id '1' is returned with id '2'. Saving '2' will incorrectly override it's data with that of the data of object '1'. * SavedObject.updated_at: string and unify saved_object / serializer types * Cleanup * Address code review feedback * Don't mock errors helpers in SavedObjectsClient Mock * Address CR feedback * CR Feedback #2 * Add kibana-platform as code owners of Saved Objects * Better typings for SavedObjectsClient.errors * Use unknown as default for generic type request paramater * Bump @types/elasticsearch * Fix types for isForbiddenError * Bump x-pack @types/elasticsearch
2019-06-06 10:49:13 +02:00
declare module 'lodash/internal/toPath' {
function toPath(value: string | string[]): string[];
export = toPath;
}
type MethodKeysOf<T> = {
[K in keyof T]: T[K] extends (...args: any[]) => any ? K : never;
[Core] Rewrite saved objects in typescript (#36829) * Convert simple files to TS * Fix jest tests * Rename saved_objects_client{.js => .ts} * WIP saved_objects_client * saved_objects repository{.js => .ts} * includedFields support string[] for type paramater * Repository/saved_objects_client -> TS * Fix tests and dependencies * Fix saved objects type errors and simplify * saved_objects/index saved_objects/service/index -> ts * Fix saved objects export test after switching to typed mock * Workaround type error * Revert "Workaround type error" This reverts commit de3252267eb2e6bf56a5584d271b55a7afdc1c53. * Correctly type Server.savedObjects.SaveObjectsClient constructor * saved_objects/service/lib/index.{js -> ts} * saved_objects/service/lib/scoped_client_provider{js -> ts} * Typescriptify scoped_client_provider * Fix x-pack jest imports * Add lodash/internal/toPath typings to xpath * Introduce SavedObjectsClientContract We need a way to specify that injected dependencies should adhere to the SavedObjectsClient "contract". We can't use the SavedObjectsClient class itself since it contains the private _repository property which in TS is included in the type signature of a class. * Cleanup and simplify types * Fix repository#delete should return {} * Add SavedObjects repository test for uncovered bug Test for a bug in our previous js implementation that can lead to data corruption and data loss. If a bulkGet request is made where one of the objects to fetch is of a type that isn't allowed, the returned result will include documents which have the incorrect id and type assigned. E.g. the data of an object with id '1' is returned with id '2'. Saving '2' will incorrectly override it's data with that of the data of object '1'. * SavedObject.updated_at: string and unify saved_object / serializer types * Cleanup * Address code review feedback * Don't mock errors helpers in SavedObjectsClient Mock * Address CR feedback * CR Feedback #2 * Add kibana-platform as code owners of Saved Objects * Better typings for SavedObjectsClient.errors * Use unknown as default for generic type request paramater * Bump @types/elasticsearch * Fix types for isForbiddenError * Bump x-pack @types/elasticsearch
2019-06-06 10:49:13 +02:00
}[keyof T];
type PublicMethodsOf<T> = Pick<T, MethodKeysOf<T>>;
declare module 'axios/lib/adapters/xhr';
type MockedKeys<T> = { [P in keyof T]: jest.Mocked<T[P]> };
type DeeplyMockedKeys<T> = {
[P in keyof T]: T[P] extends (...args: any[]) => any
? jest.MockInstance<ReturnType<T[P]>, Parameters<T[P]>>
: DeeplyMockedKeys<T[P]>;
} &
T;
// allow JSON files to be imported directly without lint errors
// see: https://github.com/palantir/tslint/issues/1264#issuecomment-228433367
// and: https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#arbitrary-expressions-are-forbidden-in-export-assignments-in-ambient-contexts
declare module '*.json' {
const json: any;
// eslint-disable-next-line import/no-default-export
export default json;
}