mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Added deprecation to all the io-ts types and copies of them (#99260)
## Summary Adds deprecation to all the io-ts types and copies of them found in the code base. Phase 1 (Completed): Copy all the utilities to the `packages/kbn-securitysolution-io-ts-utils` Phase 2: Add all the deprecation messages about them to the code base Phase 3+: Teams and others will eventually remove/replace them with the utils from `kbn-securitysolution-io-ts-utils`
This commit is contained in:
parent
09d81cfd81
commit
92da1059bd
76 changed files with 873 additions and 8 deletions
|
@ -13,6 +13,10 @@ import { isObject } from 'lodash/fp';
|
|||
|
||||
type ErrorFactory = (message: string) => Error;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts
|
||||
* Bug fix for the TODO is in the format_errors package
|
||||
*/
|
||||
export const formatErrors = (errors: rt.Errors): string[] => {
|
||||
const err = errors.map((error) => {
|
||||
if (error.message != null) {
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
import * as t from 'io-ts';
|
||||
import { isObject } from 'lodash/fp';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts
|
||||
*/
|
||||
export const formatErrors = (errors: t.Errors): string[] => {
|
||||
const err = errors.map((error) => {
|
||||
if (error.message != null) {
|
||||
|
|
|
@ -12,14 +12,44 @@ import * as t from 'io-ts';
|
|||
import { DefaultNamespace } from '../types/default_namespace';
|
||||
import { DefaultArray, DefaultStringArray, NonEmptyString } from '../../shared_imports';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const name = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Name = t.TypeOf<typeof name>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const nameOrUndefined = t.union([name, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NameOrUndefined = t.TypeOf<typeof nameOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const description = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Description = t.TypeOf<typeof description>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const descriptionOrUndefined = t.union([description, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type DescriptionOrUndefined = t.TypeOf<typeof descriptionOrUndefined>;
|
||||
|
||||
export const list_id = NonEmptyString;
|
||||
|
@ -28,15 +58,47 @@ export const list_idOrUndefined = t.union([list_id, t.undefined]);
|
|||
export type ListIdOrUndefined = t.TypeOf<typeof list_idOrUndefined>;
|
||||
|
||||
export const item = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const created_at = t.string; // TODO: Make this into an ISO Date string check
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updated_at = t.string; // TODO: Make this into an ISO Date string check
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updated_by = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const created_by = t.string;
|
||||
|
||||
export const file = t.object;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const id = NonEmptyString;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Id = t.TypeOf<typeof id>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const idOrUndefined = t.union([id, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type IdOrUndefined = t.TypeOf<typeof idOrUndefined>;
|
||||
|
||||
export const binary = t.string;
|
||||
|
@ -93,6 +155,9 @@ export const valueOrUndefined = t.union([value, t.undefined]);
|
|||
export const tie_breaker_id = t.string; // TODO: Use UUID for this instead of a string for validation
|
||||
export const _index = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const type = t.keyof({
|
||||
binary: null,
|
||||
boolean: null,
|
||||
|
@ -122,9 +187,24 @@ export const type = t.keyof({
|
|||
export const typeOrUndefined = t.union([type, t.undefined]);
|
||||
export type Type = t.TypeOf<typeof type>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const meta = t.object;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Meta = t.TypeOf<typeof meta>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const metaOrUndefined = t.union([meta, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type MetaOrUndefined = t.TypeOf<typeof metaOrUndefined>;
|
||||
|
||||
export const esDataTypeRange = t.exact(t.type({ gte: t.string, lte: t.string }));
|
||||
|
@ -207,28 +287,77 @@ export const esDataTypeUnion = t.union([
|
|||
|
||||
export type EsDataTypeUnion = t.TypeOf<typeof esDataTypeUnion>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const tags = DefaultStringArray;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Tags = t.TypeOf<typeof tags>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const tagsOrUndefined = t.union([tags, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type TagsOrUndefined = t.TypeOf<typeof tagsOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const exceptionListType = t.keyof({
|
||||
detection: null,
|
||||
endpoint: null,
|
||||
endpoint_events: null,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const exceptionListTypeOrUndefined = t.union([exceptionListType, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ExceptionListType = t.TypeOf<typeof exceptionListType>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ExceptionListTypeOrUndefined = t.TypeOf<typeof exceptionListTypeOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export enum ExceptionListTypeEnum {
|
||||
DETECTION = 'detection',
|
||||
ENDPOINT = 'endpoint',
|
||||
ENDPOINT_EVENTS = 'endpoint_events',
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const exceptionListItemType = t.keyof({ simple: null });
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const exceptionListItemTypeOrUndefined = t.union([exceptionListItemType, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ExceptionListItemType = t.TypeOf<typeof exceptionListItemType>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ExceptionListItemTypeOrUndefined = t.TypeOf<typeof exceptionListItemTypeOrUndefined>;
|
||||
|
||||
export const list_type = t.keyof({ item: null, list: null });
|
||||
|
@ -275,14 +404,32 @@ export type CursorOrUndefined = t.TypeOf<typeof cursorOrUndefined>;
|
|||
|
||||
export const namespace_type = DefaultNamespace;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const operatorIncluded = t.keyof({ included: null });
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const operator = t.keyof({ excluded: null, included: null });
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Operator = t.TypeOf<typeof operator>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export enum OperatorEnum {
|
||||
INCLUDED = 'included',
|
||||
EXCLUDED = 'excluded',
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export enum OperatorTypeEnum {
|
||||
NESTED = 'nested',
|
||||
MATCH = 'match',
|
||||
|
@ -320,15 +467,36 @@ export type Immutable = t.TypeOf<typeof immutable>;
|
|||
export const immutableOrUndefined = t.union([immutable, t.undefined]);
|
||||
export type ImmutableOrUndefined = t.TypeOf<typeof immutableOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const osType = t.keyof({
|
||||
linux: null,
|
||||
macos: null,
|
||||
windows: null,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type OsType = t.TypeOf<typeof osType>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const osTypeArray = DefaultArray(osType);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type OsTypeArray = t.TypeOf<typeof osTypeArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const osTypeArrayOrUndefined = t.union([osTypeArray, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type OsTypeArrayOrUndefined = t.OutputOf<typeof osTypeArray>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../shared_imports';
|
||||
import { created_at, created_by, id, updated_at, updated_by } from '../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const comment = t.intersection([
|
||||
t.exact(
|
||||
t.type({
|
||||
|
@ -27,8 +30,27 @@ export const comment = t.intersection([
|
|||
),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const commentsArray = t.array(comment);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type CommentsArray = t.TypeOf<typeof commentsArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Comment = t.TypeOf<typeof comment>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const commentsArrayOrUndefined = t.union([commentsArray, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type CommentsArrayOrUndefined = t.TypeOf<typeof commentsArrayOrUndefined>;
|
||||
|
|
|
@ -9,15 +9,41 @@ import * as t from 'io-ts';
|
|||
|
||||
import { NonEmptyString } from '../../shared_imports';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const createComment = t.exact(
|
||||
t.type({
|
||||
comment: NonEmptyString,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type CreateComment = t.TypeOf<typeof createComment>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const createCommentsArray = t.array(createComment);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type CreateCommentsArray = t.TypeOf<typeof createCommentsArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type CreateComments = t.TypeOf<typeof createComment>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const createCommentsArrayOrUndefined = t.union([createCommentsArray, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type CreateCommentsArrayOrUndefined = t.TypeOf<typeof createCommentsArrayOrUndefined>;
|
||||
|
|
|
@ -13,6 +13,7 @@ import { CommentsArray, comment } from './comment';
|
|||
/**
|
||||
* Types the DefaultCommentsArray as:
|
||||
* - If null or undefined, then a default array of type entry will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultCommentsArray = new t.Type<CommentsArray, CommentsArray, unknown>(
|
||||
'DefaultCommentsArray',
|
||||
|
|
|
@ -13,6 +13,7 @@ import { CreateCommentsArray, createComment } from './create_comment';
|
|||
/**
|
||||
* Types the DefaultCreateComments as:
|
||||
* - If null or undefined, then a default array of type entry will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultCreateCommentsArray = new t.Type<
|
||||
CreateCommentsArray,
|
||||
|
|
|
@ -14,6 +14,7 @@ export type NamespaceType = t.TypeOf<typeof namespaceType>;
|
|||
/**
|
||||
* Types the DefaultNamespace as:
|
||||
* - If null or undefined, then a default string/enumeration of "single" will be used.
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultNamespace = new t.Type<NamespaceType, NamespaceType | undefined, unknown>(
|
||||
'DefaultNamespace',
|
||||
|
|
|
@ -17,6 +17,7 @@ export type NamespaceTypeArray = t.TypeOf<typeof namespaceTypeArray>;
|
|||
* Types the DefaultNamespaceArray as:
|
||||
* - If null or undefined, then a default string array of "single" will be used.
|
||||
* - If it contains a string, then it is split along the commas and puts them into an array and validates it
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultNamespaceArray = new t.Type<
|
||||
NamespaceTypeArray,
|
||||
|
@ -40,5 +41,12 @@ export const DefaultNamespaceArray = new t.Type<
|
|||
String
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type DefaultNamespaceArrayType = t.OutputOf<typeof DefaultNamespaceArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type DefaultNamespaceArrayTypeDecoded = t.TypeOf<typeof DefaultNamespaceArray>;
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the DefaultStringBooleanFalse as:
|
||||
* - If a string this will convert the string to a boolean
|
||||
* - If null or undefined, then a default false will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultStringBooleanFalse = new t.Type<boolean, boolean | undefined | string, unknown>(
|
||||
'DefaultStringBooleanFalse',
|
||||
|
@ -30,4 +31,7 @@ export const DefaultStringBooleanFalse = new t.Type<boolean, boolean | undefined
|
|||
t.identity
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type DefaultStringBooleanFalseC = typeof DefaultStringBooleanFalse;
|
||||
|
|
|
@ -13,6 +13,7 @@ import { UpdateCommentsArray, updateCommentsArray } from './update_comment';
|
|||
/**
|
||||
* Types the DefaultCommentsUpdate as:
|
||||
* - If null or undefined, then a default array of type entry will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultUpdateCommentsArray = new t.Type<
|
||||
UpdateCommentsArray,
|
||||
|
|
|
@ -15,6 +15,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* - Example input converted to output: undefined -> []
|
||||
* - Example input converted to output: null -> []
|
||||
* - Example input converted to output: "a,b,c" -> ["a", "b", "c"]
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const EmptyStringArray = new t.Type<string[], string | undefined | null, unknown>(
|
||||
'EmptyStringArray',
|
||||
|
@ -40,5 +41,12 @@ export const EmptyStringArray = new t.Type<string[], string | undefined | null,
|
|||
String
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EmptyStringArrayEncoded = t.OutputOf<typeof EmptyStringArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EmptyStringArrayDecoded = t.TypeOf<typeof EmptyStringArray>;
|
||||
|
|
|
@ -12,15 +12,22 @@ import { endpointEntryMatchAny } from './entry_match_any';
|
|||
import { endpointEntryMatch } from './entry_match';
|
||||
import { endpointEntryNested } from './entry_nested';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const endpointEntriesArray = t.array(
|
||||
t.union([endpointEntryMatch, endpointEntryMatchAny, endpointEntryNested])
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EndpointEntriesArray = t.TypeOf<typeof endpointEntriesArray>;
|
||||
|
||||
/**
|
||||
* Types the nonEmptyEndpointEntriesArray as:
|
||||
* - An array of entries of length 1 or greater
|
||||
*
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const nonEmptyEndpointEntriesArray = new t.Type<
|
||||
EndpointEntriesArray,
|
||||
|
@ -39,5 +46,12 @@ export const nonEmptyEndpointEntriesArray = new t.Type<
|
|||
t.identity
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyEndpointEntriesArray = t.OutputOf<typeof nonEmptyEndpointEntriesArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyEndpointEntriesArrayDecoded = t.TypeOf<typeof nonEmptyEndpointEntriesArray>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../../shared_imports';
|
||||
import { operatorIncluded } from '../../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const endpointEntryMatch = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -18,4 +21,8 @@ export const endpointEntryMatch = t.exact(
|
|||
value: NonEmptyString,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EndpointEntryMatch = t.TypeOf<typeof endpointEntryMatch>;
|
||||
|
|
|
@ -11,6 +11,9 @@ import { NonEmptyString } from '../../../shared_imports';
|
|||
import { operatorIncluded } from '../../common/schemas';
|
||||
import { nonEmptyOrNullableStringArray } from '../non_empty_or_nullable_string_array';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const endpointEntryMatchAny = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -19,4 +22,8 @@ export const endpointEntryMatchAny = t.exact(
|
|||
value: nonEmptyOrNullableStringArray,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EndpointEntryMatchAny = t.TypeOf<typeof endpointEntryMatchAny>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../../shared_imports';
|
||||
import { operatorIncluded } from '../../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const endpointEntryMatchWildcard = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -18,4 +21,8 @@ export const endpointEntryMatchWildcard = t.exact(
|
|||
value: NonEmptyString,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EndpointEntryMatchWildcard = t.TypeOf<typeof endpointEntryMatchWildcard>;
|
||||
|
|
|
@ -11,6 +11,9 @@ import { NonEmptyString } from '../../../shared_imports';
|
|||
|
||||
import { nonEmptyEndpointNestedEntriesArray } from './non_empty_nested_entries_array';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const endpointEntryNested = t.exact(
|
||||
t.type({
|
||||
entries: nonEmptyEndpointNestedEntriesArray,
|
||||
|
@ -18,4 +21,8 @@ export const endpointEntryNested = t.exact(
|
|||
type: t.keyof({ nested: null }),
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EndpointEntryNested = t.TypeOf<typeof endpointEntryNested>;
|
||||
|
|
|
@ -11,15 +11,22 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
import { endpointEntryMatchAny } from './entry_match_any';
|
||||
import { endpointEntryMatch } from './entry_match';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const endpointNestedEntriesArray = t.array(
|
||||
t.union([endpointEntryMatch, endpointEntryMatchAny])
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EndpointNestedEntriesArray = t.TypeOf<typeof endpointNestedEntriesArray>;
|
||||
|
||||
/**
|
||||
* Types the nonEmptyNestedEntriesArray as:
|
||||
* - An array of entries of length 1 or greater
|
||||
*
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const nonEmptyEndpointNestedEntriesArray = new t.Type<
|
||||
EndpointNestedEntriesArray,
|
||||
|
@ -38,9 +45,16 @@ export const nonEmptyEndpointNestedEntriesArray = new t.Type<
|
|||
t.identity
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyEndpointNestedEntriesArray = t.OutputOf<
|
||||
typeof nonEmptyEndpointNestedEntriesArray
|
||||
>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyEndpointNestedEntriesArrayDecoded = t.TypeOf<
|
||||
typeof nonEmptyEndpointNestedEntriesArray
|
||||
>;
|
||||
|
|
|
@ -16,6 +16,10 @@ import { entriesMatchWildcard } from './entry_match_wildcard';
|
|||
|
||||
// NOTE: Type nested is not included here to denote it's non-recursive nature.
|
||||
// So a nested entry is really just a collection of `Entry` types.
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entry = t.union([
|
||||
entriesMatch,
|
||||
entriesMatchAny,
|
||||
|
@ -23,8 +27,15 @@ export const entry = t.union([
|
|||
entriesExists,
|
||||
entriesMatchWildcard,
|
||||
]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Entry = t.TypeOf<typeof entry>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesArray = t.array(
|
||||
t.union([
|
||||
entriesMatch,
|
||||
|
@ -35,7 +46,18 @@ export const entriesArray = t.array(
|
|||
entriesMatchWildcard,
|
||||
])
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntriesArray = t.TypeOf<typeof entriesArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesArrayOrUndefined = t.union([entriesArray, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntriesArrayOrUndefined = t.TypeOf<typeof entriesArrayOrUndefined>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../shared_imports';
|
||||
import { operator } from '../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesExists = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -17,4 +20,8 @@ export const entriesExists = t.exact(
|
|||
type: t.keyof({ exists: null }),
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntryExists = t.TypeOf<typeof entriesExists>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../shared_imports';
|
||||
import { operator, type } from '../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesList = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -18,4 +21,8 @@ export const entriesList = t.exact(
|
|||
type: t.keyof({ list: null }),
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntryList = t.TypeOf<typeof entriesList>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../shared_imports';
|
||||
import { operator } from '../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesMatch = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -18,4 +21,8 @@ export const entriesMatch = t.exact(
|
|||
value: NonEmptyString,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntryMatch = t.TypeOf<typeof entriesMatch>;
|
||||
|
|
|
@ -12,6 +12,9 @@ import { operator } from '../common/schemas';
|
|||
|
||||
import { nonEmptyOrNullableStringArray } from './non_empty_or_nullable_string_array';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesMatchAny = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -20,4 +23,8 @@ export const entriesMatchAny = t.exact(
|
|||
value: nonEmptyOrNullableStringArray,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntryMatchAny = t.TypeOf<typeof entriesMatchAny>;
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../shared_imports';
|
||||
import { operator } from '../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesMatchWildcard = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -18,4 +21,8 @@ export const entriesMatchWildcard = t.exact(
|
|||
value: NonEmptyString,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntryMatchWildcard = t.TypeOf<typeof entriesMatchWildcard>;
|
||||
|
|
|
@ -11,6 +11,9 @@ import { NonEmptyString } from '../../shared_imports';
|
|||
|
||||
import { nonEmptyNestedEntriesArray } from './non_empty_nested_entries_array';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const entriesNested = t.exact(
|
||||
t.type({
|
||||
entries: nonEmptyNestedEntriesArray,
|
||||
|
@ -18,4 +21,8 @@ export const entriesNested = t.exact(
|
|||
type: t.keyof({ nested: null }),
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type EntryNested = t.TypeOf<typeof entriesNested>;
|
||||
|
|
|
@ -14,7 +14,7 @@ import { entriesList } from './entry_list';
|
|||
/**
|
||||
* Types the nonEmptyEntriesArray as:
|
||||
* - An array of entries of length 1 or greater
|
||||
*
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const nonEmptyEntriesArray = new t.Type<EntriesArray, EntriesArray, unknown>(
|
||||
'NonEmptyEntriesArray',
|
||||
|
@ -37,5 +37,12 @@ export const nonEmptyEntriesArray = new t.Type<EntriesArray, EntriesArray, unkno
|
|||
t.identity
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyEntriesArray = t.OutputOf<typeof nonEmptyEntriesArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyEntriesArrayDecoded = t.TypeOf<typeof nonEmptyEntriesArray>;
|
||||
|
|
|
@ -19,7 +19,7 @@ export type NestedEntriesArray = t.TypeOf<typeof nestedEntriesArray>;
|
|||
/**
|
||||
* Types the nonEmptyNestedEntriesArray as:
|
||||
* - An array of entries of length 1 or greater
|
||||
*
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const nonEmptyNestedEntriesArray = new t.Type<
|
||||
NestedEntriesArray,
|
||||
|
@ -38,5 +38,12 @@ export const nonEmptyNestedEntriesArray = new t.Type<
|
|||
t.identity
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyNestedEntriesArray = t.OutputOf<typeof nonEmptyNestedEntriesArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyNestedEntriesArrayDecoded = t.TypeOf<typeof nonEmptyNestedEntriesArray>;
|
||||
|
|
|
@ -12,7 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the nonEmptyOrNullableStringArray as:
|
||||
* - An array of non empty strings of length 1 or greater
|
||||
* - This differs from NonEmptyStringArray in that both input and output are type array
|
||||
*
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const nonEmptyOrNullableStringArray = new t.Type<string[], string[], unknown>(
|
||||
'NonEmptyOrNullableStringArray',
|
||||
|
@ -31,5 +31,12 @@ export const nonEmptyOrNullableStringArray = new t.Type<string[], string[], unkn
|
|||
t.identity
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyOrNullableStringArray = t.OutputOf<typeof nonEmptyOrNullableStringArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyOrNullableStringArrayDecoded = t.TypeOf<typeof nonEmptyOrNullableStringArray>;
|
||||
|
|
|
@ -13,6 +13,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* - A string that is not empty (which will be turned into an array of size 1)
|
||||
* - A comma separated string that can turn into an array by splitting on it
|
||||
* - Example input converted to output: "a,b,c" -> ["a", "b", "c"]
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const NonEmptyStringArray = new t.Type<string[], string, unknown>(
|
||||
'NonEmptyStringArray',
|
||||
|
@ -36,5 +37,12 @@ export const NonEmptyStringArray = new t.Type<string[], string, unknown>(
|
|||
String
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyStringArray = t.OutputOf<typeof NonEmptyStringArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type NonEmptyStringArrayDecoded = t.TypeOf<typeof NonEmptyStringArray>;
|
||||
|
|
|
@ -15,6 +15,7 @@ export type StringToPositiveNumberC = t.Type<number, string, unknown>;
|
|||
* - If a string this converts the string into a number
|
||||
* - Ensures it is a number (and not NaN)
|
||||
* - Ensures it is positive number
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const StringToPositiveNumber: StringToPositiveNumberC = new t.Type<number, string, unknown>(
|
||||
'StringToPositiveNumber',
|
||||
|
|
|
@ -10,6 +10,9 @@ import * as t from 'io-ts';
|
|||
import { NonEmptyString } from '../../shared_imports';
|
||||
import { id } from '../common/schemas';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updateComment = t.intersection([
|
||||
t.exact(
|
||||
t.type({
|
||||
|
@ -23,8 +26,27 @@ export const updateComment = t.intersection([
|
|||
),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type UpdateComment = t.TypeOf<typeof updateComment>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updateCommentsArray = t.array(updateComment);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type UpdateCommentsArray = t.TypeOf<typeof updateCommentsArray>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updateCommentsArrayOrUndefined = t.union([updateCommentsArray, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type UpdateCommentsArrayOrUndefined = t.TypeOf<typeof updateCommentsArrayOrUndefined>;
|
||||
|
|
|
@ -16,10 +16,16 @@ interface Message<T> {
|
|||
schema: T | {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
const onLeft = <T>(errors: t.Errors): Message<T> => {
|
||||
return { errors, schema: {} };
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
const onRight = <T>(schema: T): Message<T> => {
|
||||
return {
|
||||
errors: [],
|
||||
|
@ -27,12 +33,16 @@ const onRight = <T>(schema: T): Message<T> => {
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const foldLeftRight = fold(onLeft, onRight);
|
||||
|
||||
/**
|
||||
* Convenience utility to keep the error message handling within tests to be
|
||||
* very concise.
|
||||
* @param validation The validation to get the errors from
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const getPaths = <A>(validation: t.Validation<A>): string[] => {
|
||||
return pipe(
|
||||
|
@ -46,6 +56,7 @@ export const getPaths = <A>(validation: t.Validation<A>): string[] => {
|
|||
|
||||
/**
|
||||
* Convenience utility to remove text appended to links by EUI
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const removeExternalLinkText = (str: string): string =>
|
||||
str.replace(/\(opens in a new tab or window\)/g, '');
|
||||
|
|
|
@ -18,7 +18,7 @@ export type SavedObjectType = 'exception-list' | 'exception-list-agnostic';
|
|||
*
|
||||
* will yield a type of:
|
||||
* type A = { a: undefined; b: number; }
|
||||
*
|
||||
* @deprecated This has no replacement. We should stop using/relying on this and just remove it.
|
||||
*/
|
||||
export type RequiredKeepUndefined<T> = { [K in keyof T]-?: [T[K]] } extends infer U
|
||||
? U extends Record<keyof U, [unknown]>
|
||||
|
|
|
@ -25,6 +25,7 @@ import { isObject, get } from 'lodash/fp';
|
|||
* @param original The original to check if it has additional keys
|
||||
* @param decoded The decoded either which has either an existing error or the
|
||||
* decoded object which could have additional keys stripped from it.
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/exact_check/index.ts
|
||||
*/
|
||||
export const exactCheck = <T>(
|
||||
original: unknown,
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
import * as t from 'io-ts';
|
||||
import { isObject } from 'lodash/fp';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts
|
||||
*/
|
||||
export const formatErrors = (errors: t.Errors): string[] => {
|
||||
const err = errors.map((error) => {
|
||||
if (error.message != null) {
|
||||
|
|
|
@ -16,10 +16,16 @@ interface Message<T> {
|
|||
schema: T | {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
const onLeft = <T>(errors: t.Errors): Message<T> => {
|
||||
return { errors, schema: {} };
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
const onRight = <T>(schema: T): Message<T> => {
|
||||
return {
|
||||
errors: [],
|
||||
|
@ -27,12 +33,16 @@ const onRight = <T>(schema: T): Message<T> => {
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const foldLeftRight = fold(onLeft, onRight);
|
||||
|
||||
/**
|
||||
* Convenience utility to keep the error message handling within tests to be
|
||||
* very concise.
|
||||
* @param validation The validation to get the errors from
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const getPaths = <A>(validation: t.Validation<A>): string[] => {
|
||||
return pipe(
|
||||
|
@ -46,6 +56,7 @@ export const getPaths = <A>(validation: t.Validation<A>): string[] => {
|
|||
|
||||
/**
|
||||
* Convenience utility to remove text appended to links by EUI
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const removeExternalLinkText = (str: string): string =>
|
||||
str.replace(/\(opens in a new tab or window\)/g, '');
|
||||
|
|
|
@ -76,14 +76,25 @@ export type Filters = t.TypeOf<typeof filters>; // Filters are not easily type-a
|
|||
export const filtersOrUndefined = t.union([filters, t.undefined]);
|
||||
export type FiltersOrUndefined = t.TypeOf<typeof filtersOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const saved_object_attribute_single: t.Type<SavedObjectAttributeSingle> = t.recursion(
|
||||
'saved_object_attribute_single',
|
||||
() => t.union([t.string, t.number, t.boolean, t.null, t.undefined, saved_object_attributes])
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const saved_object_attribute: t.Type<SavedObjectAttribute> = t.recursion(
|
||||
'saved_object_attribute',
|
||||
() => t.union([saved_object_attribute_single, t.array(saved_object_attribute_single)])
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const saved_object_attributes: t.Type<SavedObjectAttributes> = t.recursion(
|
||||
'saved_object_attributes',
|
||||
() => t.record(t.string, saved_object_attribute)
|
||||
|
@ -172,10 +183,24 @@ export type Query = t.TypeOf<typeof query>;
|
|||
export const queryOrUndefined = t.union([query, t.undefined]);
|
||||
export type QueryOrUndefined = t.TypeOf<typeof queryOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const language = t.keyof({ eql: null, kuery: null, lucene: null });
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Language = t.TypeOf<typeof language>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const languageOrUndefined = t.union([language, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type LanguageOrUndefined = t.TypeOf<typeof languageOrUndefined>;
|
||||
|
||||
export const license = t.string;
|
||||
|
@ -246,7 +271,14 @@ export type Meta = t.TypeOf<typeof meta>;
|
|||
export const metaOrUndefined = t.union([meta, t.undefined]);
|
||||
export type MetaOrUndefined = t.TypeOf<typeof metaOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const max_signals = PositiveIntegerGreaterThanZero;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type MaxSignals = t.TypeOf<typeof max_signals>;
|
||||
|
||||
export const maxSignalsOrUndefined = t.union([max_signals, t.undefined]);
|
||||
|
@ -258,10 +290,21 @@ export type Name = t.TypeOf<typeof name>;
|
|||
export const nameOrUndefined = t.union([name, t.undefined]);
|
||||
export type NameOrUndefined = t.TypeOf<typeof nameOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const operator = t.keyof({
|
||||
equals: null,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Operator = t.TypeOf<typeof operator>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export enum OperatorEnum {
|
||||
EQUALS = 'equals',
|
||||
}
|
||||
|
@ -272,8 +315,19 @@ export type RiskScore = t.TypeOf<typeof risk_score>;
|
|||
export const riskScoreOrUndefined = t.union([risk_score, t.undefined]);
|
||||
export type RiskScoreOrUndefined = t.TypeOf<typeof riskScoreOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const risk_score_mapping_field = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const risk_score_mapping_value = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const risk_score_mapping_item = t.exact(
|
||||
t.type({
|
||||
field: risk_score_mapping_field,
|
||||
|
@ -283,7 +337,14 @@ export const risk_score_mapping_item = t.exact(
|
|||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const risk_score_mapping = t.array(risk_score_mapping_item);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type RiskScoreMapping = t.TypeOf<typeof risk_score_mapping>;
|
||||
|
||||
export const riskScoreMappingOrUndefined = t.union([risk_score_mapping, t.undefined]);
|
||||
|
@ -295,14 +356,39 @@ export type RuleNameOverride = t.TypeOf<typeof rule_name_override>;
|
|||
export const ruleNameOverrideOrUndefined = t.union([rule_name_override, t.undefined]);
|
||||
export type RuleNameOverrideOrUndefined = t.TypeOf<typeof ruleNameOverrideOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severity = t.keyof({ low: null, medium: null, high: null, critical: null });
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Severity = t.TypeOf<typeof severity>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severityOrUndefined = t.union([severity, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type SeverityOrUndefined = t.TypeOf<typeof severityOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severity_mapping_field = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severity_mapping_value = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severity_mapping_item = t.exact(
|
||||
t.type({
|
||||
field: severity_mapping_field,
|
||||
|
@ -311,12 +397,30 @@ export const severity_mapping_item = t.exact(
|
|||
severity,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type SeverityMappingItem = t.TypeOf<typeof severity_mapping_item>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severity_mapping = t.array(severity_mapping_item);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type SeverityMapping = t.TypeOf<typeof severity_mapping>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const severityMappingOrUndefined = t.union([severity_mapping, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type SeverityMappingOrUndefined = t.TypeOf<typeof severityMappingOrUndefined>;
|
||||
|
||||
export const status = t.keyof({ open: null, closed: null, 'in-progress': null });
|
||||
|
@ -407,29 +511,92 @@ export type Fields = t.TypeOf<typeof fields>;
|
|||
export const fieldsOrUndefined = t.union([fields, t.undefined]);
|
||||
export type FieldsOrUndefined = t.TypeOf<typeof fieldsOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_framework = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_tactic_id = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_tactic_name = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_tactic_reference = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_tactic = t.type({
|
||||
id: threat_tactic_id,
|
||||
name: threat_tactic_name,
|
||||
reference: threat_tactic_reference,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatTactic = t.TypeOf<typeof threat_tactic>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_subtechnique_id = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_subtechnique_name = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_subtechnique_reference = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_subtechnique = t.type({
|
||||
id: threat_subtechnique_id,
|
||||
name: threat_subtechnique_name,
|
||||
reference: threat_subtechnique_reference,
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatSubtechnique = t.TypeOf<typeof threat_subtechnique>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_subtechniques = t.array(threat_subtechnique);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_technique_id = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_technique_name = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_technique_reference = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_technique = t.intersection([
|
||||
t.exact(
|
||||
t.type({
|
||||
|
@ -444,8 +611,20 @@ export const threat_technique = t.intersection([
|
|||
})
|
||||
),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatTechnique = t.TypeOf<typeof threat_technique>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_techniques = t.array(threat_technique);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat = t.intersection([
|
||||
t.exact(
|
||||
t.type({
|
||||
|
@ -459,9 +638,20 @@ export const threat = t.intersection([
|
|||
})
|
||||
),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Threat = t.TypeOf<typeof threat>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threats = t.array(threat);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Threats = t.TypeOf<typeof threats>;
|
||||
|
||||
export const threatsOrUndefined = t.union([threats, t.undefined]);
|
||||
|
@ -517,16 +707,38 @@ export type ThresholdNormalized = t.TypeOf<typeof thresholdNormalized>;
|
|||
export const thresholdNormalizedOrUndefined = t.union([thresholdNormalized, t.undefined]);
|
||||
export type ThresholdNormalizedOrUndefined = t.TypeOf<typeof thresholdNormalizedOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const created_at = IsoDateString;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updated_at = IsoDateString;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const updated_by = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const created_by = t.string;
|
||||
export const updatedByOrNull = t.union([updated_by, t.null]);
|
||||
export type UpdatedByOrNull = t.TypeOf<typeof updatedByOrNull>;
|
||||
export const createdByOrNull = t.union([created_by, t.null]);
|
||||
export type CreatedByOrNull = t.TypeOf<typeof createdByOrNull>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const version = PositiveIntegerGreaterThanZero;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type Version = t.TypeOf<typeof version>;
|
||||
|
||||
export const versionOrUndefined = t.union([version, t.undefined]);
|
||||
|
|
|
@ -12,6 +12,7 @@ import { actions, Actions } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultStringArray as:
|
||||
* - If undefined, then a default action array will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultActionsArray = new t.Type<Actions, Actions | undefined, unknown>(
|
||||
'DefaultActionsArray',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the DefaultArray<C> as:
|
||||
* - If undefined, then a default array will be set
|
||||
* - If an array is sent in, then the array will be validated to ensure all elements are type C
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultArray = <C extends t.Mixed>(codec: C) => {
|
||||
const arrType = t.array(codec);
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the DefaultBooleanFalse as:
|
||||
* - If null or undefined, then a default false will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultBooleanFalse = new t.Type<boolean, boolean | undefined, unknown>(
|
||||
'DefaultBooleanFalse',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the DefaultBooleanTrue as:
|
||||
* - If null or undefined, then a default true will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultBooleanTrue = new t.Type<boolean, boolean | undefined, unknown>(
|
||||
'DefaultBooleanTrue',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the DefaultEmptyString as:
|
||||
* - If null or undefined, then a default of an empty string "" will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultEmptyString = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultEmptyString',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the DefaultExportFileName as:
|
||||
* - If null or undefined, then a default of "export.ndjson" will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultExportFileName = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultExportFileName',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { from } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultFromString as:
|
||||
* - If null or undefined, then a default of the string "now-6m" will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultFromString = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultFromString',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the DefaultIntervalString as:
|
||||
* - If null or undefined, then a default of the string "5m" will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultIntervalString = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultIntervalString',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { language } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultLanguageString as:
|
||||
* - If null or undefined, then a default of the string "kuery" will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultLanguageString = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultLanguageString',
|
||||
|
|
|
@ -15,6 +15,7 @@ import { DEFAULT_MAX_SIGNALS } from '../../../constants';
|
|||
* - Natural Number (positive integer and not a float),
|
||||
* - greater than 1
|
||||
* - If undefined then it will use DEFAULT_MAX_SIGNALS (100) as the default
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultMaxSignalsNumber = new t.Type<number, number | undefined, unknown>(
|
||||
'DefaultMaxSignals',
|
||||
|
|
|
@ -14,6 +14,7 @@ import { PositiveIntegerGreaterThanZero } from './positive_integer_greater_than_
|
|||
* - If a string this will convert the string to a number
|
||||
* - If null or undefined, then a default of 1 will be used
|
||||
* - If the number is 0 or less this will not validate as it has to be a positive number greater than zero
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultPage = new t.Type<number, number | undefined, unknown>(
|
||||
'DefaultPerPage',
|
||||
|
|
|
@ -14,6 +14,7 @@ import { PositiveIntegerGreaterThanZero } from './positive_integer_greater_than_
|
|||
* - If a string this will convert the string to a number
|
||||
* - If null or undefined, then a default of 20 will be used
|
||||
* - If the number is 0 or less this will not validate as it has to be a positive number greater than zero
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultPerPage = new t.Type<number, number | undefined, unknown>(
|
||||
'DefaultPerPage',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { risk_score_mapping, RiskScoreMapping } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultStringArray as:
|
||||
* - If null or undefined, then a default risk_score_mapping array will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultRiskScoreMappingArray = new t.Type<
|
||||
RiskScoreMapping,
|
||||
|
|
|
@ -12,6 +12,7 @@ import { severity_mapping, SeverityMapping } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultStringArray as:
|
||||
* - If null or undefined, then a default severity_mapping array will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultSeverityMappingArray = new t.Type<
|
||||
SeverityMapping,
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the DefaultStringArray as:
|
||||
* - If undefined, then a default array will be set
|
||||
* - If an array is sent in, then the array will be validated to ensure all elements are a string
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultStringArray = new t.Type<string[], string[] | undefined, unknown>(
|
||||
'DefaultStringArray',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the DefaultStringBooleanFalse as:
|
||||
* - If a string this will convert the string to a boolean
|
||||
* - If null or undefined, then a default false will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultStringBooleanFalse = new t.Type<boolean, boolean | undefined | string, unknown>(
|
||||
'DefaultStringBooleanFalse',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Threats, threats } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultThreatArray as:
|
||||
* - If null or undefined, then an empty array will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultThreatArray = new t.Type<Threats, Threats | undefined, unknown>(
|
||||
'DefaultThreatArray',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { ThrottleOrNull, throttle } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultThrottleNull as:
|
||||
* - If null or undefined, then a null will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultThrottleNull = new t.Type<ThrottleOrNull, ThrottleOrNull | undefined, unknown>(
|
||||
'DefaultThreatNull',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the DefaultToString as:
|
||||
* - If null or undefined, then a default of the string "now" will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultToString = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultToString',
|
||||
|
|
|
@ -15,6 +15,7 @@ import { NonEmptyString } from './non_empty_string';
|
|||
* Types the DefaultUuid as:
|
||||
* - If null or undefined, then a default string uuid.v4() will be
|
||||
* created otherwise it will be checked just against an empty string
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultUuid = new t.Type<string, string | undefined, unknown>(
|
||||
'DefaultUuid',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { version, Version } from '../common/schemas';
|
|||
/**
|
||||
* Types the DefaultVersionNumber as:
|
||||
* - If null or undefined, then a default of the number 1 will be used
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultVersionNumber = new t.Type<Version, Version | undefined, unknown>(
|
||||
'DefaultVersionNumber',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the IsoDateString as:
|
||||
* - A string that is an ISOString
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const IsoDateString = new t.Type<string, string, unknown>(
|
||||
'IsoDateString',
|
||||
|
|
|
@ -11,6 +11,9 @@ import { exceptionListType, namespaceType } from '../../../shared_imports';
|
|||
|
||||
import { NonEmptyString } from './non_empty_string';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const list = t.exact(
|
||||
t.type({
|
||||
id: NonEmptyString,
|
||||
|
|
|
@ -13,6 +13,7 @@ import { ListArray, list } from './lists';
|
|||
/**
|
||||
* Types the DefaultListArray as:
|
||||
* - If null or undefined, then a default array of type list will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const DefaultListArray = new t.Type<ListArray, ListArray | undefined, unknown>(
|
||||
'DefaultListArray',
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
import * as t from 'io-ts';
|
||||
import { Either } from 'fp-ts/lib/Either';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const NonEmptyArray = <C extends t.Mixed>(
|
||||
codec: C,
|
||||
name: string = `NonEmptyArray<${codec.name}>`
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the NonEmptyString as:
|
||||
* - A string that is not empty
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const NonEmptyString = new t.Type<string, string, unknown>(
|
||||
'NonEmptyString',
|
||||
|
|
|
@ -10,13 +10,27 @@ import * as t from 'io-ts';
|
|||
|
||||
import { NonEmptyArray } from './non_empty_array';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const machine_learning_job_id_normalized = NonEmptyArray(t.string);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type MachineLearningJobIdNormalized = t.TypeOf<typeof machine_learning_job_id_normalized>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const machineLearningJobIdNormalizedOrUndefined = t.union([
|
||||
machine_learning_job_id_normalized,
|
||||
t.undefined,
|
||||
]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type MachineLearningJobIdNormalizedOrUndefined = t.TypeOf<
|
||||
typeof machineLearningJobIdNormalizedOrUndefined
|
||||
>;
|
||||
|
|
|
@ -13,6 +13,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* - If null or undefined, then a default false will be set
|
||||
* - If true is sent in then this will return an error
|
||||
* - If false is sent in then this will allow it only false
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const OnlyFalseAllowed = new t.Type<boolean, boolean | undefined, unknown>(
|
||||
'DefaultBooleanTrue',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the positive integer are:
|
||||
* - Natural Number (positive integer and not a float),
|
||||
* - zero or greater
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const PositiveInteger = new t.Type<number, number, unknown>(
|
||||
'PositiveInteger',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the positive integer greater than zero is:
|
||||
* - Natural Number (positive integer and not a float),
|
||||
* - 1 or greater
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const PositiveIntegerGreaterThanZero = new t.Type<number, number, unknown>(
|
||||
'PositiveIntegerGreaterThanZero',
|
||||
|
|
|
@ -11,6 +11,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
/**
|
||||
* Types the ReferencesDefaultArray as:
|
||||
* - If null or undefined, then a default array will be set
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const ReferencesDefaultArray = new t.Type<string[], string[] | undefined, unknown>(
|
||||
'referencesWithDefaultArray',
|
||||
|
|
|
@ -12,6 +12,7 @@ import { Either } from 'fp-ts/lib/Either';
|
|||
* Types the risk score as:
|
||||
* - Natural Number (positive integer and not a float),
|
||||
* - Between the values [0 and 100] inclusive.
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const RiskScore = new t.Type<number, number, unknown>(
|
||||
'RiskScore',
|
||||
|
|
|
@ -13,21 +13,69 @@ import { NonEmptyArray } from './non_empty_array';
|
|||
import { NonEmptyString } from './non_empty_string';
|
||||
import { PositiveIntegerGreaterThanZero } from './positive_integer_greater_than_zero';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_query = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatQuery = t.TypeOf<typeof threat_query>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatQueryOrUndefined = t.union([threat_query, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatQueryOrUndefined = t.TypeOf<typeof threatQueryOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_indicator_path = t.string;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatIndicatorPath = t.TypeOf<typeof threat_indicator_path>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatIndicatorPathOrUndefined = t.union([threat_indicator_path, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatIndicatorPathOrUndefined = t.TypeOf<typeof threatIndicatorPathOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_filters = t.array(t.unknown); // Filters are not easily type-able yet
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatFilters = t.TypeOf<typeof threat_filters>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatFiltersOrUndefined = t.union([threat_filters, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatFiltersOrUndefined = t.TypeOf<typeof threatFiltersOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatMapEntry = t.exact(
|
||||
t.type({
|
||||
field: NonEmptyString,
|
||||
|
@ -36,40 +84,131 @@ export const threatMapEntry = t.exact(
|
|||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatMapEntry = t.TypeOf<typeof threatMapEntry>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatMappingEntries = t.array(threatMapEntry);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatMappingEntries = t.TypeOf<typeof threatMappingEntries>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatMap = t.exact(
|
||||
t.type({
|
||||
entries: threatMappingEntries,
|
||||
})
|
||||
);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatMap = t.TypeOf<typeof threatMap>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_mapping = NonEmptyArray(threatMap, 'NonEmptyArray<ThreatMap>');
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatMapping = t.TypeOf<typeof threat_mapping>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatMappingOrUndefined = t.union([threat_mapping, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatMappingOrUndefined = t.TypeOf<typeof threatMappingOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_index = t.array(t.string);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatIndex = t.TypeOf<typeof threat_index>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatIndexOrUndefined = t.union([threat_index, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatIndexOrUndefined = t.TypeOf<typeof threatIndexOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threat_language = t.union([language, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatLanguage = t.TypeOf<typeof threat_language>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const threatLanguageOrUndefined = t.union([threat_language, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ThreatLanguageOrUndefined = t.TypeOf<typeof threatLanguageOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const concurrent_searches = PositiveIntegerGreaterThanZero;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ConcurrentSearches = t.TypeOf<typeof concurrent_searches>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const concurrentSearchesOrUndefined = t.union([concurrent_searches, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ConcurrentSearchesOrUndefined = t.TypeOf<typeof concurrentSearchesOrUndefined>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const items_per_search = PositiveIntegerGreaterThanZero;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ItemsPerSearch = t.TypeOf<typeof concurrent_searches>;
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const itemsPerSearchOrUndefined = t.union([items_per_search, t.undefined]);
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export type ItemsPerSearchOrUndefined = t.TypeOf<typeof itemsPerSearchOrUndefined>;
|
||||
|
|
|
@ -14,6 +14,7 @@ const regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|||
* Types the risk score as:
|
||||
* - Natural Number (positive integer and not a float),
|
||||
* - Between the values [0 and 100] inclusive.
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils
|
||||
*/
|
||||
export const UUID = new t.Type<string, string, unknown>(
|
||||
'UUID',
|
||||
|
|
|
@ -25,6 +25,7 @@ import { isObject, get } from 'lodash/fp';
|
|||
* @param original The original to check if it has additional keys
|
||||
* @param decoded The decoded either which has either an existing error or the
|
||||
* decoded object which could have additional keys stripped from it.
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/exact_check/index.ts
|
||||
*/
|
||||
export const exactCheck = <T>(
|
||||
original: unknown,
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
import * as t from 'io-ts';
|
||||
import { isObject } from 'lodash/fp';
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts
|
||||
*/
|
||||
export const formatErrors = (errors: t.Errors): string[] => {
|
||||
const err = errors.map((error) => {
|
||||
if (error.message != null) {
|
||||
|
|
|
@ -15,10 +15,16 @@ interface Message<T> {
|
|||
schema: T | {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
const onLeft = <T>(errors: t.Errors): Message<T> => {
|
||||
return { schema: {}, errors };
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
const onRight = <T>(schema: T): Message<T> => {
|
||||
return {
|
||||
schema,
|
||||
|
@ -26,11 +32,15 @@ const onRight = <T>(schema: T): Message<T> => {
|
|||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const foldLeftRight = fold(onLeft, onRight);
|
||||
|
||||
/**
|
||||
* Convenience utility to keep the error message handling within tests to be
|
||||
* very concise.
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
* @param validation The validation to get the errors from
|
||||
*/
|
||||
export const getPaths = <A>(validation: t.Validation<A>): string[] => {
|
||||
|
@ -45,6 +55,7 @@ export const getPaths = <A>(validation: t.Validation<A>): string[] => {
|
|||
|
||||
/**
|
||||
* Convenience utility to remove text appended to links by EUI
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/test_utils/index.ts
|
||||
*/
|
||||
export const removeExternalLinkText = (str: string) =>
|
||||
str.replace(/\(opens in a new tab or window\)/g, '');
|
||||
|
|
|
@ -40,6 +40,9 @@ export const buildFrameworkRequest = async (
|
|||
|
||||
export const escapeHatch = schema.object({}, { unknowns: 'allow' });
|
||||
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts
|
||||
*/
|
||||
export const formatErrors = (errors: rt.Errors): string[] => {
|
||||
const err = errors.map((error) => {
|
||||
if (error.message != null) {
|
||||
|
|
|
@ -16,8 +16,9 @@ function isObject(value: unknown) {
|
|||
return value != null && (type === 'object' || type === 'function');
|
||||
}
|
||||
|
||||
// TODO: Copied from https://github.com/elastic/kibana/blob/master/x-pack/plugins/security_solution/common/format_errors.ts
|
||||
// We should figure out a better way to share this
|
||||
/**
|
||||
* @deprecated Use packages/kbn-securitysolution-io-ts-utils/src/format_errors/index.ts
|
||||
*/
|
||||
export const formatErrors = (errors: t.Errors): string[] => {
|
||||
return errors.map((error) => {
|
||||
if (error.message != null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue