Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
refs f9cb7ed
refs b3f5dc4
  • Loading branch information
ashokaditya committed Apr 27, 2021
1 parent 835812f commit dbd3532
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
1 change: 0 additions & 1 deletion x-pack/plugins/lists/common/schemas/types/entries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const entry = t.union([
entriesMatchAny,
entriesList,
entriesExists,
entriesNested,
entriesMatchWildcard,
]);
export type Entry = t.TypeOf<typeof entry>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import { TypeOf } from '@kbn/config-schema';
import { ApplicationStart } from 'kibana/public';

import { Entry } from '../../../../lists/common/schemas/types/entries';
import {
DeleteTrustedAppsRequestSchema,
GetOneTrustedAppRequestSchema,
Expand Down Expand Up @@ -76,9 +75,10 @@ export enum OperatorFieldIds {
matches = 'matches',
}

export type TrustedAppEntryTypes = 'match' | 'wildcard';
export interface ConditionEntry<T extends ConditionEntryField = ConditionEntryField> {
field: T;
type: Entry['type'];
type: TrustedAppEntryTypes;
operator: 'included';
value: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@ describe('mapping', () => {
updated_at: '11/11/2011T11:11:11.111',
updated_by: 'admin',
os: OperatingSystem.WINDOWS,
entries: [
createConditionEntry(ConditionEntryField.SIGNER, 'nested', 'Microsoft Windows'),
],
entries: [createConditionEntry(ConditionEntryField.SIGNER, 'match', 'Microsoft Windows')],
}
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import uuid from 'uuid';

import { OsType } from '../../../../../lists/common/schemas';
import {
Entry,
EntriesArray,
EntryMatch,
EntryMatchWildcard,
Expand All @@ -30,6 +29,7 @@ import {
OperatingSystem,
TrustedApp,
UpdateTrustedApp,
TrustedAppEntryTypes,
} from '../../../../common/endpoint/types';

type ConditionEntriesMap = { [K in ConditionEntryField]?: ConditionEntry<K> };
Expand All @@ -56,7 +56,7 @@ const filterUndefined = <T>(list: Array<T | undefined>): T[] => {

export const createConditionEntry = <T extends ConditionEntryField>(
field: T,
type: Entry['type'],
type: TrustedAppEntryTypes,
value: string
): ConditionEntry<T> => {
return { field, value, type, operator: OPERATOR_VALUE };
Expand Down Expand Up @@ -110,7 +110,7 @@ export const entriesToConditionEntriesMap = (entries: EntriesArray): ConditionEn
...result,
[ConditionEntryField.SIGNER]: createConditionEntry(
ConditionEntryField.SIGNER,
entry.type,
subjectNameCondition.type,
subjectNameCondition.value
),
};
Expand Down

0 comments on commit dbd3532

Please sign in to comment.