mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Deterministic output for doc types (#76890)
* disable incremental builds for public type generation. They generate non-deterministic types https://github.com/microsoft/rushstack/issues/1958 * do not infer public types
This commit is contained in:
parent
39f8fc6b87
commit
2f1c0127e2
12 changed files with 77 additions and 116 deletions
|
@ -8,5 +8,5 @@
|
|||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
export declare type AppenderConfigType = TypeOf<typeof appendersSchema>;
|
||||
export declare type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | LegacyAppenderConfig;
|
||||
```
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
* @packageDocumentation
|
||||
*/
|
||||
|
||||
import { Type } from '@kbn/config-schema';
|
||||
import {
|
||||
ElasticsearchServiceSetup,
|
||||
ILegacyScopedClusterClient,
|
||||
|
@ -46,7 +47,6 @@ import {
|
|||
ElasticsearchServiceStart,
|
||||
IScopedClusterClient,
|
||||
} from './elasticsearch';
|
||||
|
||||
import { HttpServiceSetup, HttpServiceStart } from './http';
|
||||
import { HttpResources } from './http_resources';
|
||||
|
||||
|
@ -63,12 +63,7 @@ import { CapabilitiesSetup, CapabilitiesStart } from './capabilities';
|
|||
import { MetricsServiceStart } from './metrics';
|
||||
import { StatusServiceSetup } from './status';
|
||||
import { Auditor, AuditTrailSetup, AuditTrailStart } from './audit_trail';
|
||||
import {
|
||||
LoggingServiceSetup,
|
||||
appendersSchema,
|
||||
loggerContextConfigSchema,
|
||||
loggerSchema,
|
||||
} from './logging';
|
||||
import { AppenderConfigType, appendersSchema, LoggingServiceSetup } from './logging';
|
||||
|
||||
export { AuditableEvent, Auditor, AuditorFactory, AuditTrailSetup } from './audit_trail';
|
||||
export { bootstrap } from './bootstrap';
|
||||
|
@ -497,8 +492,6 @@ export const config = {
|
|||
schema: elasticsearchConfigSchema,
|
||||
},
|
||||
logging: {
|
||||
appenders: appendersSchema,
|
||||
loggers: loggerSchema,
|
||||
loggerContext: loggerContextConfigSchema,
|
||||
appenders: appendersSchema as Type<AppenderConfigType>,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -23,6 +23,11 @@ import { LogRecord } from '../../../logging/log_record';
|
|||
import { LegacyLoggingServer } from '../legacy_logging_server';
|
||||
import { LegacyVars } from '../../types';
|
||||
|
||||
export interface LegacyAppenderConfig {
|
||||
kind: 'legacy-appender';
|
||||
legacyLoggingConfig?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple appender that just forwards `LogRecord` to the legacy KbnServer log.
|
||||
* @internal
|
||||
|
|
|
@ -17,14 +17,17 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { assertNever } from '../../../utils';
|
||||
import { LegacyAppender } from '../../legacy/logging/appenders/legacy_appender';
|
||||
import {
|
||||
LegacyAppender,
|
||||
LegacyAppenderConfig,
|
||||
} from '../../legacy/logging/appenders/legacy_appender';
|
||||
import { Layouts } from '../layouts/layouts';
|
||||
import { LogRecord } from '../log_record';
|
||||
import { ConsoleAppender } from './console/console_appender';
|
||||
import { FileAppender } from './file/file_appender';
|
||||
import { ConsoleAppender, ConsoleAppenderConfig } from './console/console_appender';
|
||||
import { FileAppender, FileAppenderConfig } from './file/file_appender';
|
||||
|
||||
/**
|
||||
* Config schema for validting the shape of the `appenders` key in in {@link LoggerContextConfigType} or
|
||||
|
@ -39,7 +42,7 @@ export const appendersSchema = schema.oneOf([
|
|||
]);
|
||||
|
||||
/** @public */
|
||||
export type AppenderConfigType = TypeOf<typeof appendersSchema>;
|
||||
export type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | LegacyAppenderConfig;
|
||||
|
||||
/**
|
||||
* Entity that can append `LogRecord` instances to file, stdout, memory or whatever
|
||||
|
|
|
@ -19,13 +19,19 @@
|
|||
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { Layout, Layouts } from '../../layouts/layouts';
|
||||
import { Layout, Layouts, LayoutConfigType } from '../../layouts/layouts';
|
||||
import { LogRecord } from '../../log_record';
|
||||
import { DisposableAppender } from '../appenders';
|
||||
|
||||
const { literal, object } = schema;
|
||||
|
||||
export interface ConsoleAppenderConfig {
|
||||
kind: 'console';
|
||||
layout: LayoutConfigType;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Appender that formats all the `LogRecord` instances it receives and logs them via built-in `console`.
|
||||
* @internal
|
||||
*/
|
||||
|
|
|
@ -20,10 +20,16 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { createWriteStream, WriteStream } from 'fs';
|
||||
|
||||
import { Layout, Layouts } from '../../layouts/layouts';
|
||||
import { Layout, Layouts, LayoutConfigType } from '../../layouts/layouts';
|
||||
import { LogRecord } from '../../log_record';
|
||||
import { DisposableAppender } from '../appenders';
|
||||
|
||||
export interface FileAppenderConfig {
|
||||
kind: 'file';
|
||||
layout: LayoutConfigType;
|
||||
path: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appender that formats all the `LogRecord` instances it receives and writes them to the specified file.
|
||||
* @internal
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
import moment from 'moment-timezone';
|
||||
import { merge } from 'lodash';
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { LogRecord } from '../log_record';
|
||||
import { Layout } from './layouts';
|
||||
|
@ -31,7 +31,9 @@ const jsonLayoutSchema = object({
|
|||
});
|
||||
|
||||
/** @internal */
|
||||
export type JsonLayoutConfigType = TypeOf<typeof jsonLayoutSchema>;
|
||||
export interface JsonLayoutConfigType {
|
||||
kind: 'json';
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout that just converts `LogRecord` into JSON string.
|
||||
|
|
|
@ -26,7 +26,7 @@ import { PatternLayout, PatternLayoutConfigType } from './pattern_layout';
|
|||
|
||||
const { oneOf } = schema;
|
||||
|
||||
type LayoutConfigType = PatternLayoutConfigType | JsonLayoutConfigType;
|
||||
export type LayoutConfigType = PatternLayoutConfigType | JsonLayoutConfigType;
|
||||
|
||||
/**
|
||||
* Entity that can format `LogRecord` instance into a string.
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import { schema, TypeOf } from '@kbn/config-schema';
|
||||
import { schema } from '@kbn/config-schema';
|
||||
|
||||
import { LogRecord } from '../log_record';
|
||||
import { Layout } from './layouts';
|
||||
|
@ -58,7 +58,11 @@ const conversions: Conversion[] = [
|
|||
];
|
||||
|
||||
/** @internal */
|
||||
export type PatternLayoutConfigType = TypeOf<typeof patternLayoutSchema>;
|
||||
export interface PatternLayoutConfigType {
|
||||
kind: 'pattern';
|
||||
highlight?: boolean;
|
||||
pattern?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layout that formats `LogRecord` using the `pattern` string with optional
|
||||
|
|
|
@ -96,7 +96,9 @@ export const config = {
|
|||
}),
|
||||
};
|
||||
|
||||
export type LoggingConfigType = TypeOf<typeof config.schema>;
|
||||
export type LoggingConfigType = Omit<TypeOf<typeof config.schema>, 'appenders'> & {
|
||||
appenders: Map<string, AppenderConfigType>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Config schema for validating the inputs to the {@link LoggingServiceStart.configure} API.
|
||||
|
|
|
@ -153,10 +153,12 @@ import { UpdateDocumentByQueryParams } from 'elasticsearch';
|
|||
import { UpdateDocumentParams } from 'elasticsearch';
|
||||
import { Url } from 'url';
|
||||
|
||||
// Warning: (ae-forgotten-export) The symbol "appendersSchema" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "ConsoleAppenderConfig" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "FileAppenderConfig" needs to be exported by the entry point index.d.ts
|
||||
// Warning: (ae-forgotten-export) The symbol "LegacyAppenderConfig" needs to be exported by the entry point index.d.ts
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type AppenderConfigType = TypeOf<typeof appendersSchema>;
|
||||
export type AppenderConfigType = ConsoleAppenderConfig | FileAppenderConfig | LegacyAppenderConfig;
|
||||
|
||||
// @public
|
||||
export function assertNever(x: never): never;
|
||||
|
@ -325,108 +327,45 @@ export type CapabilitiesSwitcher = (request: KibanaRequest, uiCapabilities: Capa
|
|||
export const config: {
|
||||
elasticsearch: {
|
||||
schema: import("@kbn/config-schema").ObjectType<{
|
||||
sniffOnStart: import("@kbn/config-schema").Type<boolean>;
|
||||
sniffInterval: import("@kbn/config-schema").Type<false | import("moment").Duration>;
|
||||
sniffOnConnectionFault: import("@kbn/config-schema").Type<boolean>;
|
||||
hosts: import("@kbn/config-schema").Type<string | string[]>;
|
||||
preserveHost: import("@kbn/config-schema").Type<boolean>;
|
||||
username: import("@kbn/config-schema").Type<string | undefined>;
|
||||
password: import("@kbn/config-schema").Type<string | undefined>;
|
||||
requestHeadersWhitelist: import("@kbn/config-schema").Type<string | string[]>;
|
||||
customHeaders: import("@kbn/config-schema").Type<Record<string, string>>;
|
||||
shardTimeout: import("@kbn/config-schema").Type<import("moment").Duration>;
|
||||
requestTimeout: import("@kbn/config-schema").Type<import("moment").Duration>;
|
||||
pingTimeout: import("@kbn/config-schema").Type<import("moment").Duration>;
|
||||
startupTimeout: import("@kbn/config-schema").Type<import("moment").Duration>;
|
||||
logQueries: import("@kbn/config-schema").Type<boolean>;
|
||||
sniffOnStart: Type<boolean>;
|
||||
sniffInterval: Type<false | import("moment").Duration>;
|
||||
sniffOnConnectionFault: Type<boolean>;
|
||||
hosts: Type<string | string[]>;
|
||||
preserveHost: Type<boolean>;
|
||||
username: Type<string | undefined>;
|
||||
password: Type<string | undefined>;
|
||||
requestHeadersWhitelist: Type<string | string[]>;
|
||||
customHeaders: Type<Record<string, string>>;
|
||||
shardTimeout: Type<import("moment").Duration>;
|
||||
requestTimeout: Type<import("moment").Duration>;
|
||||
pingTimeout: Type<import("moment").Duration>;
|
||||
startupTimeout: Type<import("moment").Duration>;
|
||||
logQueries: Type<boolean>;
|
||||
ssl: import("@kbn/config-schema").ObjectType<{
|
||||
verificationMode: import("@kbn/config-schema").Type<"none" | "certificate" | "full">;
|
||||
certificateAuthorities: import("@kbn/config-schema").Type<string | string[] | undefined>;
|
||||
certificate: import("@kbn/config-schema").Type<string | undefined>;
|
||||
key: import("@kbn/config-schema").Type<string | undefined>;
|
||||
keyPassphrase: import("@kbn/config-schema").Type<string | undefined>;
|
||||
verificationMode: Type<"none" | "certificate" | "full">;
|
||||
certificateAuthorities: Type<string | string[] | undefined>;
|
||||
certificate: Type<string | undefined>;
|
||||
key: Type<string | undefined>;
|
||||
keyPassphrase: Type<string | undefined>;
|
||||
keystore: import("@kbn/config-schema").ObjectType<{
|
||||
path: import("@kbn/config-schema").Type<string | undefined>;
|
||||
password: import("@kbn/config-schema").Type<string | undefined>;
|
||||
path: Type<string | undefined>;
|
||||
password: Type<string | undefined>;
|
||||
}>;
|
||||
truststore: import("@kbn/config-schema").ObjectType<{
|
||||
path: import("@kbn/config-schema").Type<string | undefined>;
|
||||
password: import("@kbn/config-schema").Type<string | undefined>;
|
||||
path: Type<string | undefined>;
|
||||
password: Type<string | undefined>;
|
||||
}>;
|
||||
alwaysPresentCertificate: import("@kbn/config-schema").Type<boolean>;
|
||||
alwaysPresentCertificate: Type<boolean>;
|
||||
}>;
|
||||
apiVersion: import("@kbn/config-schema").Type<string>;
|
||||
apiVersion: Type<string>;
|
||||
healthCheck: import("@kbn/config-schema").ObjectType<{
|
||||
delay: import("@kbn/config-schema").Type<import("moment").Duration>;
|
||||
delay: Type<import("moment").Duration>;
|
||||
}>;
|
||||
ignoreVersionMismatch: import("@kbn/config-schema/target/types/types").ConditionalType<false, boolean, boolean>;
|
||||
}>;
|
||||
};
|
||||
logging: {
|
||||
appenders: import("@kbn/config-schema").Type<Readonly<{} & {
|
||||
layout: Readonly<{} & {
|
||||
kind: "json";
|
||||
}> | Readonly<{
|
||||
pattern?: string | undefined;
|
||||
highlight?: boolean | undefined;
|
||||
} & {
|
||||
kind: "pattern";
|
||||
}>;
|
||||
kind: "console";
|
||||
}> | Readonly<{} & {
|
||||
path: string;
|
||||
layout: Readonly<{} & {
|
||||
kind: "json";
|
||||
}> | Readonly<{
|
||||
pattern?: string | undefined;
|
||||
highlight?: boolean | undefined;
|
||||
} & {
|
||||
kind: "pattern";
|
||||
}>;
|
||||
kind: "file";
|
||||
}> | Readonly<{
|
||||
legacyLoggingConfig?: any;
|
||||
} & {
|
||||
kind: "legacy-appender";
|
||||
}>>;
|
||||
loggers: import("@kbn/config-schema").ObjectType<{
|
||||
appenders: import("@kbn/config-schema").Type<string[]>;
|
||||
context: import("@kbn/config-schema").Type<string>;
|
||||
level: import("@kbn/config-schema").Type<import("./logging/log_level").LogLevelId>;
|
||||
}>;
|
||||
loggerContext: import("@kbn/config-schema").ObjectType<{
|
||||
appenders: import("@kbn/config-schema").Type<Map<string, Readonly<{} & {
|
||||
layout: Readonly<{} & {
|
||||
kind: "json";
|
||||
}> | Readonly<{
|
||||
pattern?: string | undefined;
|
||||
highlight?: boolean | undefined;
|
||||
} & {
|
||||
kind: "pattern";
|
||||
}>;
|
||||
kind: "console";
|
||||
}> | Readonly<{} & {
|
||||
path: string;
|
||||
layout: Readonly<{} & {
|
||||
kind: "json";
|
||||
}> | Readonly<{
|
||||
pattern?: string | undefined;
|
||||
highlight?: boolean | undefined;
|
||||
} & {
|
||||
kind: "pattern";
|
||||
}>;
|
||||
kind: "file";
|
||||
}> | Readonly<{
|
||||
legacyLoggingConfig?: any;
|
||||
} & {
|
||||
kind: "legacy-appender";
|
||||
}>>>;
|
||||
loggers: import("@kbn/config-schema").Type<Readonly<{} & {
|
||||
context: string;
|
||||
appenders: string[];
|
||||
level: import("./logging/log_level").LogLevelId;
|
||||
}>[]>;
|
||||
}>;
|
||||
appenders: Type<AppenderConfigType>;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"incremental": false,
|
||||
"declaration": true,
|
||||
"outDir": "./target/types",
|
||||
"stripInternal": false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue