[KQL] Update literal type to include isQuoted (#134397)

* Clean up literal type

* [KQL] Clean up wildcard type

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Fix bugs

* [KQL] Update literal type to include isQuoted

* Update node builder

* Update tests with new AST

* Fix test

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Lukas Olson 2022-07-26 10:03:18 -07:00 committed by GitHub
parent 97c0b32159
commit 153f65990e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 175 additions and 286 deletions

View file

@ -183,8 +183,7 @@ NotListOfValues
Value "value"
= value:QuotedString {
if (value.type === 'cursor') return value;
const isPhrase = buildLiteralNode(true);
return (field) => buildFunctionNode('is', [field, value, isPhrase]);
return (field) => buildFunctionNode('is', [field, value]);
}
/ value:UnquotedLiteral {
if (value.type === 'cursor') return value;
@ -193,8 +192,7 @@ Value "value"
error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.');
}
const isPhrase = buildLiteralNode(false);
return (field) => buildFunctionNode('is', [field, value, isPhrase]);
return (field) => buildFunctionNode('is', [field, value]);
}
Or "OR"
@ -222,7 +220,7 @@ QuotedString
};
}
/ '"' chars:QuotedCharacter* '"' {
return buildLiteralNode(chars.join(''));
return buildLiteralNode(chars.join(''), true);
}
QuotedCharacter

View file

@ -146,7 +146,7 @@ describe('kuery AST API', () => {
});
test('should treat quoted values as phrases', () => {
const expected = nodeTypes.function.buildNode('is', 'foo', 'bar baz', true);
const expected = nodeTypes.function.buildNode('is', 'foo', '"bar baz"');
const actual = fromKueryExpression('foo:"bar baz"');
expect(actual).toEqual(expected);
});
@ -328,19 +328,19 @@ describe('kuery AST API', () => {
test('should support double quoted strings that do not need escapes except for quotes', () => {
const expected = nodeTypes.literal.buildNode('\\():<>"*');
const actual = fromLiteralExpression('"\\():<>\\"*"');
expect(actual).toEqual(expected);
expect(actual.value).toEqual(expected.value);
});
test('should support escaped backslashes inside quoted strings', () => {
const expected = nodeTypes.literal.buildNode('\\');
const actual = fromLiteralExpression('"\\\\"');
expect(actual).toEqual(expected);
expect(actual.value).toEqual(expected.value);
});
test('should support escaped unicode sequences inside quoted strings', () => {
const expected = nodeTypes.literal.buildNode('\\u00A0');
const actual = fromLiteralExpression('"\\\\u00A0"');
expect(actual).toEqual(expected);
expect(actual.value).toEqual(expected.value);
});
test('should detect wildcards and build wildcard AST nodes', () => {

View file

@ -51,16 +51,16 @@ describe('kuery functions', () => {
test('should default to a non-phrase query', () => {
const {
arguments: [, , isPhrase],
arguments: [, value],
} = is.buildNodeParams('response', 200);
expect(isPhrase.value).toBe(false);
expect(value.isQuoted).toBe(false);
});
test('should allow specification of a phrase query', () => {
const {
arguments: [, , isPhrase],
} = is.buildNodeParams('response', 200, true);
expect(isPhrase.value).toBe(true);
arguments: [, value],
} = is.buildNodeParams('response', '"200"');
expect(value.isQuoted).toBe(true);
});
});
@ -180,7 +180,7 @@ describe('kuery functions', () => {
minimum_should_match: 1,
},
};
const node = nodeTypes.function.buildNode('is', 'extension', 'jpg', true);
const node = nodeTypes.function.buildNode('is', 'extension', '"jpg"');
const result = is.toElasticsearchQuery(node, indexPattern);
expect(result).toEqual(expected);

View file

@ -19,7 +19,7 @@ import * as ast from '../ast';
import * as literal from '../node_types/literal';
import * as wildcard from '../node_types/wildcard';
export function buildNodeParams(fieldName: string, value: any, isPhrase: boolean = false) {
export function buildNodeParams(fieldName: string, value: any) {
if (isUndefined(fieldName)) {
throw new Error('fieldName is a required argument');
}
@ -32,9 +32,8 @@ export function buildNodeParams(fieldName: string, value: any, isPhrase: boolean
: literal.buildNode(fieldName);
const valueNode =
typeof value === 'string' ? ast.fromLiteralExpression(value) : literal.buildNode(value);
const isPhraseNode = literal.buildNode(isPhrase);
return {
arguments: [fieldNode, valueNode, isPhraseNode],
arguments: [fieldNode, valueNode],
};
}
@ -45,7 +44,7 @@ export function toElasticsearchQuery(
context: KqlContext = {}
): estypes.QueryDslQueryContainer {
const {
arguments: [fieldNameArg, valueArg, isPhraseArg],
arguments: [fieldNameArg, valueArg],
} = node;
const isExistsQuery = wildcard.isNode(valueArg) && wildcard.isLoneWildcard(valueArg);
@ -62,7 +61,7 @@ export function toElasticsearchQuery(
context?.nested ? context.nested.path : undefined
);
const value = !isUndefined(valueArg) ? ast.toElasticsearchQuery(valueArg) : valueArg;
const type = isPhraseArg.value ? 'phrase' : 'best_fields';
const type = valueArg.isQuoted ? 'phrase' : 'best_fields';
if (fullFieldNameArg.value === null) {
if (wildcard.isNode(valueArg)) {
return {

View file

@ -367,8 +367,7 @@ function peg$parse(input, options) {
};
var peg$f15 = function(value) {
if (value.type === 'cursor') return value;
const isPhrase = buildLiteralNode(true);
return (field) => buildFunctionNode('is', [field, value, isPhrase]);
return (field) => buildFunctionNode('is', [field, value]);
};
var peg$f16 = function(value) {
if (value.type === 'cursor') return value;
@ -377,8 +376,7 @@ function peg$parse(input, options) {
error('Leading wildcards are disabled. See query:allowLeadingWildcards in Advanced Settings.');
}
const isPhrase = buildLiteralNode(false);
return (field) => buildFunctionNode('is', [field, value, isPhrase]);
return (field) => buildFunctionNode('is', [field, value]);
};
var peg$f17 = function() { return parseCursor; };
var peg$f18 = function(prefix, cursor, suffix) {
@ -393,7 +391,7 @@ function peg$parse(input, options) {
};
};
var peg$f19 = function(chars) {
return buildLiteralNode(chars.join(''));
return buildLiteralNode(chars.join(''), true);
};
var peg$f20 = function(char) { return char; };
var peg$f21 = function(chars) {

View file

@ -15,16 +15,18 @@ export type KqlLiteralType = null | boolean | number | string;
export interface KqlLiteralNode extends KueryNode {
type: typeof KQL_NODE_TYPE_LITERAL;
value: KqlLiteralType;
isQuoted: boolean;
}
export function isNode(node: KueryNode): node is KqlLiteralNode {
return node.type === KQL_NODE_TYPE_LITERAL;
}
export function buildNode(value: KqlLiteralType): KqlLiteralNode {
export function buildNode(value: KqlLiteralType, isQuoted: boolean = false): KqlLiteralNode {
return {
type: KQL_NODE_TYPE_LITERAL,
value,
isQuoted,
};
}

View file

@ -13,7 +13,6 @@ export const nodeBuilder = {
return nodeTypes.function.buildNodeWithArgumentNodes('is', [
nodeTypes.literal.buildNode(fieldName),
typeof value === 'string' ? nodeTypes.literal.buildNode(value) : value,
nodeTypes.literal.buildNode(false),
]);
},
or: (nodes: KueryNode[]): KueryNode => {

View file

@ -103,19 +103,14 @@ describe('Filter Utils', () => {
expect(
validateConvertFilterToKueryNode(
['foo'],
esKuery.nodeTypes.function.buildNode('is', `foo.attributes.title`, 'best', true),
esKuery.nodeTypes.function.buildNode('is', `foo.attributes.title`, '"best"'),
mockMappings
)
).toEqual(esKuery.fromKueryExpression('foo.title: "best"'));
});
test('does not mutate the input KueryNode', () => {
const input = esKuery.nodeTypes.function.buildNode(
'is',
`foo.attributes.title`,
'best',
true
);
const input = esKuery.nodeTypes.function.buildNode('is', `foo.attributes.title`, '"best"');
const inputCopy = cloneDeep(input);

View file

@ -86,14 +86,14 @@ describe('findSharedOriginObjects', () => {
[obj1, obj2, obj3].forEach(({ type, origin }, i) => {
expect(kueryFilterArgs[i * 2].arguments).toEqual(
expect.arrayContaining([
{ type: 'literal', value: `${type}.id` },
{ type: 'literal', value: `${type}:${origin}` },
{ type: 'literal', value: `${type}.id`, isQuoted: false },
{ type: 'literal', value: `${type}:${origin}`, isQuoted: false },
])
);
expect(kueryFilterArgs[i * 2 + 1].arguments).toEqual(
expect.arrayContaining([
{ type: 'literal', value: `${type}.originId` },
{ type: 'literal', value: origin },
{ type: 'literal', value: `${type}.originId`, isQuoted: false },
{ type: 'literal', value: origin, isQuoted: false },
])
);
});

View file

@ -82,10 +82,10 @@ describe('findLegacyUrlAliases', () => {
const typeAndIdFilter = typeAndIdFilters[i].arguments;
expect(typeAndIdFilter).toEqual([
expect.objectContaining({
arguments: expect.arrayContaining([{ type: 'literal', value: type }]),
arguments: expect.arrayContaining([{ type: 'literal', value: type, isQuoted: false }]),
}),
expect.objectContaining({
arguments: expect.arrayContaining([{ type: 'literal', value: id }]),
arguments: expect.arrayContaining([{ type: 'literal', value: id, isQuoted: false }]),
}),
]);
});

View file

@ -3764,6 +3764,7 @@ describe('SavedObjectsRepository', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "dashboard.otherField",
},
@ -3771,10 +3772,6 @@ describe('SavedObjectsRepository', () => {
"type": "wildcard",
"value": "@kuery-wildcard@",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -3804,6 +3801,7 @@ describe('SavedObjectsRepository', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "dashboard.otherField",
},
@ -3811,10 +3809,6 @@ describe('SavedObjectsRepository', () => {
"type": "wildcard",
"value": "@kuery-wildcard@",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -358,17 +358,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.realmType",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_realm_type",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -376,17 +374,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.realmName",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_realm_name",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -394,17 +390,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.username",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_username",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -450,17 +444,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.realmType",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_realm_type",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -468,17 +460,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.realmName",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_realm_name",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -486,17 +476,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.username",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_username",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -504,17 +492,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": null,
},
Object {
"isQuoted": false,
"type": "literal",
"value": "foobar",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -533,17 +519,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.realmType",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_realm_type",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -551,17 +535,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.realmName",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_realm_name",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -569,17 +551,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "search-session.attributes.username",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "my_username",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -587,17 +567,15 @@ describe('SearchSessionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "foo",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "bar",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -11,9 +11,8 @@ describe('convertRuleIdsToKueryNode', () => {
test('should convert ids correctly', () => {
expect(convertRuleIdsToKueryNode(['1'])).toEqual({
arguments: [
{ type: 'literal', value: 'alert.id' },
{ type: 'literal', value: 'alert:1' },
{ type: 'literal', value: false },
{ type: 'literal', value: 'alert.id', isQuoted: false },
{ type: 'literal', value: 'alert:1', isQuoted: false },
],
function: 'is',
type: 'function',
@ -28,14 +27,12 @@ describe('convertRuleIdsToKueryNode', () => {
{
type: 'literal',
value: 'alert.id',
isQuoted: false,
},
{
type: 'literal',
value: 'alert:1',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',
@ -46,14 +43,12 @@ describe('convertRuleIdsToKueryNode', () => {
{
type: 'literal',
value: 'alert.id',
isQuoted: false,
},
{
type: 'literal',
value: 'alert:22',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',

View file

@ -12,9 +12,8 @@ describe('buildKueryNodeFilter', () => {
test('should convert KQL string into Kuery', () => {
expect(buildKueryNodeFilter('foo: "bar"')).toEqual({
arguments: [
{ type: 'literal', value: 'foo' },
{ type: 'literal', value: 'bar' },
{ type: 'literal', value: true },
{ type: 'literal', value: 'foo', isQuoted: false },
{ type: 'literal', value: 'bar', isQuoted: true },
],
function: 'is',
type: 'function',

View file

@ -109,11 +109,13 @@ describe('modifyFilterKueryNode', () => {
expect(astFilter.arguments[2].arguments[0]).toEqual({
type: 'literal',
value: 'alert.attributes.params.severity',
isQuoted: false,
});
expect(astFilter.arguments[2].arguments[2]).toEqual({
type: 'literal',
value: 'medium',
isQuoted: false,
});
modifyFilterKueryNode({ astFilter });
@ -121,11 +123,13 @@ describe('modifyFilterKueryNode', () => {
expect(astFilter.arguments[2].arguments[0]).toEqual({
type: 'literal',
value: 'alert.attributes.mapped_params.severity',
isQuoted: false,
});
expect(astFilter.arguments[2].arguments[2]).toEqual({
type: 'literal',
value: '40-medium',
isQuoted: false,
});
});
@ -140,11 +144,13 @@ describe('modifyFilterKueryNode', () => {
expect(astFilter.arguments[2].arguments[0]).toEqual({
type: 'literal',
value: 'alert.attributes.params.threat.tactic.name',
isQuoted: false,
});
expect(astFilter.arguments[2].arguments[1]).toEqual({
type: 'literal',
value: 'Exfiltration',
isQuoted: false,
});
});
});

View file

@ -331,14 +331,12 @@ describe('bulkEdit()', () => {
{
type: 'literal',
value: 'alert.attributes.tags',
isQuoted: false,
},
{
type: 'literal',
value: 'APM',
},
{
type: 'literal',
value: true,
isQuoted: true,
},
],
function: 'is',
@ -383,14 +381,12 @@ describe('bulkEdit()', () => {
{
type: 'literal',
value: 'alert.id',
isQuoted: false,
},
{
type: 'literal',
value: 'alert:2',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',
@ -401,14 +397,12 @@ describe('bulkEdit()', () => {
{
type: 'literal',
value: 'alert.id',
isQuoted: false,
},
{
type: 'literal',
value: 'alert:3',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',
@ -544,14 +538,12 @@ describe('bulkEdit()', () => {
{
type: 'literal',
value: 'alert.attributes.tags',
isQuoted: false,
},
{
type: 'literal',
value: 'APM',
},
{
type: 'literal',
value: true,
isQuoted: true,
},
],
function: 'is',

View file

@ -509,17 +509,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -527,17 +525,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "b",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -618,17 +614,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -636,17 +630,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "b",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -774,17 +766,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -792,17 +782,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "b",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -883,17 +871,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -901,17 +887,15 @@ describe('authorization', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "b",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -26,17 +26,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hello",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -50,17 +48,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hello",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -78,17 +74,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hello",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -96,17 +90,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "b",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hi",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -128,17 +120,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "b",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hi",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -146,17 +136,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hello",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -229,17 +217,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hello",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -254,17 +240,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hello",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -272,17 +256,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "a.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "hi",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -100,11 +100,13 @@ describe('MTTR', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"gte",
Object {
"isQuoted": false,
"type": "literal",
"value": "2022-04-28T15:18:00.000Z",
},
@ -115,11 +117,13 @@ describe('MTTR', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"lte",
Object {
"isQuoted": false,
"type": "literal",
"value": "2022-04-28T15:22:00.000Z",
},
@ -134,17 +138,15 @@ describe('MTTR', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "cases",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -59,11 +59,13 @@ describe('getCasesMetrics', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"gte",
Object {
"isQuoted": false,
"type": "literal",
"value": "2022-04-28T15:18:00.000Z",
},
@ -74,11 +76,13 @@ describe('getCasesMetrics', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"lte",
Object {
"isQuoted": false,
"type": "literal",
"value": "2022-04-28T15:22:00.000Z",
},
@ -93,17 +97,15 @@ describe('getCasesMetrics', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "cases",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -60,11 +60,13 @@ describe('getStatusTotalsByType', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"gte",
Object {
"isQuoted": false,
"type": "literal",
"value": "2022-04-28T15:18:00.000Z",
},
@ -75,11 +77,13 @@ describe('getStatusTotalsByType', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"lte",
Object {
"isQuoted": false,
"type": "literal",
"value": "2022-04-28T15:22:00.000Z",
},
@ -94,17 +98,15 @@ describe('getStatusTotalsByType', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "cases",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -231,17 +231,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.tags",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "tag1",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -249,17 +247,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.tags",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "tag2",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -278,17 +274,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_by.username",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "bob",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -296,17 +290,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_by.username",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "sam",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -323,17 +315,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.owner",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "observability",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -346,17 +336,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.status",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "open",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -370,17 +358,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.severity",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "critical",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -395,11 +381,13 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"gte",
Object {
"isQuoted": false,
"type": "literal",
"value": "now-1M",
},
@ -410,11 +398,13 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_at",
},
"lte",
Object {
"isQuoted": false,
"type": "literal",
"value": "now",
},
@ -443,17 +433,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.tags",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "tag1",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -461,17 +449,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.tags",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "tag2",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -483,17 +469,15 @@ describe('utils', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases.attributes.created_by.username",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "sam",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -1256,17 +1256,15 @@ describe('CaseUserActionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases-user-actions.attributes.type",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "connector",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",
@ -1274,17 +1272,15 @@ describe('CaseUserActionService', () => {
Object {
"arguments": Array [
Object {
"isQuoted": false,
"type": "literal",
"value": "cases-user-actions.attributes.type",
},
Object {
"isQuoted": false,
"type": "literal",
"value": "create_case",
},
Object {
"type": "literal",
"value": false,
},
],
"function": "is",
"type": "function",

View file

@ -103,14 +103,12 @@ describe('alerts', () => {
{
type: 'literal',
value: 'cases-comments.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'alert',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',

View file

@ -348,14 +348,12 @@ describe('getCasesTelemetryData', () => {
{
type: 'literal',
value: 'cases-comments.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'alert',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',
@ -395,14 +393,12 @@ describe('getCasesTelemetryData', () => {
{
type: 'literal',
value: 'cases-user-actions.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'connector',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',

View file

@ -102,14 +102,12 @@ describe('comments', () => {
{
type: 'literal',
value: 'cases-comments.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'user',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',

View file

@ -137,14 +137,12 @@ describe('getConnectorsTelemetryData', () => {
{
type: 'literal',
value: 'cases-user-actions.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'connector',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',
@ -193,14 +191,12 @@ describe('getConnectorsTelemetryData', () => {
{
type: 'literal',
value: 'cases-user-actions.attributes.payload.connector.type',
isQuoted: false,
},
{
type: 'literal',
value: connector,
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',

View file

@ -72,14 +72,12 @@ describe('pushes', () => {
{
type: 'literal',
value: 'cases-user-actions.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'pushed',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',

View file

@ -382,14 +382,12 @@ describe('utils', () => {
{
type: 'literal',
value: 'cases-comments.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'alert',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',
@ -405,14 +403,12 @@ describe('utils', () => {
{
type: 'literal',
value: 'cases-user-actions.attributes.type',
isQuoted: false,
},
{
type: 'literal',
value: 'connector',
},
{
type: 'literal',
value: false,
isQuoted: false,
},
],
function: 'is',