Skip to content

Commit 91d1b19

Browse files
Merge branch 'master' into osquery-telemetry
2 parents bcb6138 + 305f127 commit 91d1b19

221 files changed

Lines changed: 8376 additions & 2246 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api_docs/cases.json

Lines changed: 897 additions & 276 deletions
Large diffs are not rendered by default.

api_docs/cases.mdx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ import casesObj from './cases.json';
3232
### Interfaces
3333
<DocDefinitionList data={casesObj.client.interfaces}/>
3434

35-
### Consts, variables and types
36-
<DocDefinitionList data={casesObj.client.misc}/>
37-
3835
## Server
3936

4037
### Classes

docs/canvas/canvas-function-reference.asciidoc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,6 +2893,33 @@ Alias: `type`
28932893
[[u_fns]]
28942894
== U
28952895

2896+
[float]
2897+
[[uiSetting_fn]]
2898+
=== `uiSetting`
2899+
2900+
Returns a UI settings parameter value.
2901+
2902+
*Accepts:* `null`
2903+
2904+
[cols="3*^<"]
2905+
|===
2906+
|Argument |Type |Description
2907+
2908+
|_Unnamed_ ***
2909+
2910+
Aliases: `parameter`
2911+
|`string`
2912+
|The parameter name.
2913+
2914+
|`default`
2915+
|`any`
2916+
|A default value in case of the parameter is not set.
2917+
2918+
Default: `null`
2919+
|===
2920+
2921+
*Returns:* `ui_setting`
2922+
28962923
[float]
28972924
[[urlparam_fn]]
28982925
=== `urlparam`

docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ The actual function is defined in the <code>fn</code> key. The function can be \
7070
7171
| Method | Modifiers | Description |
7272
| --- | --- | --- |
73-
| [setup()](./kibana-plugin-plugins-expressions-public.expressionsservice.setup.md) | | Returns Kibana Platform \*setup\* life-cycle contract. Useful to return the same contract on server-side and browser-side. |
74-
| [start()](./kibana-plugin-plugins-expressions-public.expressionsservice.start.md) | | Returns Kibana Platform \*start\* life-cycle contract. Useful to return the same contract on server-side and browser-side. |
73+
| [setup(args)](./kibana-plugin-plugins-expressions-public.expressionsservice.setup.md) | | Returns Kibana Platform \*setup\* life-cycle contract. Useful to return the same contract on server-side and browser-side. |
74+
| [start(args)](./kibana-plugin-plugins-expressions-public.expressionsservice.start.md) | | Returns Kibana Platform \*start\* life-cycle contract. Useful to return the same contract on server-side and browser-side. |
7575
| [stop()](./kibana-plugin-plugins-expressions-public.expressionsservice.stop.md) | | |
7676

docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.setup.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ Returns Kibana Platform \*setup\* life-cycle contract. Useful to return the same
99
<b>Signature:</b>
1010

1111
```typescript
12-
setup(): ExpressionsServiceSetup;
12+
setup(...args: unknown[]): ExpressionsServiceSetup;
1313
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| args | <code>unknown[]</code> | |
20+
1421
<b>Returns:</b>
1522

1623
`ExpressionsServiceSetup`

docs/development/plugins/expressions/public/kibana-plugin-plugins-expressions-public.expressionsservice.start.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@ Returns Kibana Platform \*start\* life-cycle contract. Useful to return the same
99
<b>Signature:</b>
1010

1111
```typescript
12-
start(): ExpressionsServiceStart;
12+
start(...args: unknown[]): ExpressionsServiceStart;
1313
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| args | <code>unknown[]</code> | |
20+
1421
<b>Returns:</b>
1522

1623
`ExpressionsServiceStart`

packages/kbn-monaco/src/monaco_imports.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ import 'monaco-editor/esm/vs/editor/contrib/folding/folding.js'; // Needed for f
2121
import 'monaco-editor/esm/vs/editor/contrib/suggest/suggestController.js'; // Needed for suggestions
2222
import 'monaco-editor/esm/vs/editor/contrib/hover/hover.js'; // Needed for hover
2323
import 'monaco-editor/esm/vs/editor/contrib/parameterHints/parameterHints.js'; // Needed for signature
24+
import 'monaco-editor/esm/vs/editor/contrib/bracketMatching/bracketMatching.js'; // Needed for brackets matching highlight
2425

2526
export { monaco };

packages/kbn-tinymath/grammar/grammar.peggy

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// tinymath parsing grammar
22

33
{
4-
function simpleLocation (location) {
5-
// Returns an object representing the position of the function within the expression,
6-
// demarcated by the position of its first character and last character. We calculate these values
7-
// using the offset because the expression could span multiple lines, and we don't want to deal
8-
// with column and line values.
9-
return {
10-
min: location.start.offset,
11-
max: location.end.offset
4+
function simpleLocation (location) {
5+
// Returns an object representing the position of the function within the expression,
6+
// demarcated by the position of its first character and last character. We calculate these values
7+
// using the offset because the expression could span multiple lines, and we don't want to deal
8+
// with column and line values.
9+
return {
10+
min: location.start.offset,
11+
max: location.end.offset
12+
}
1213
}
13-
}
1414
}
1515

1616
start
@@ -74,26 +74,34 @@ Expression
7474
= AddSubtract
7575

7676
AddSubtract
77-
= _ left:MultiplyDivide rest:(('+' / '-') MultiplyDivide)* _ {
78-
return rest.reduce((acc, curr) => ({
77+
= _ left:MultiplyDivide rest:(('+' / '-') MultiplyDivide)+ _ {
78+
const topLevel = rest.reduce((acc, curr) => ({
7979
type: 'function',
8080
name: curr[0] === '+' ? 'add' : 'subtract',
8181
args: [acc, curr[1]],
82-
location: simpleLocation(location()),
83-
text: text()
84-
}), left)
82+
}), left);
83+
if (typeof topLevel === 'object') {
84+
topLevel.location = simpleLocation(location());
85+
topLevel.text = text();
86+
}
87+
return topLevel;
8588
}
89+
/ MultiplyDivide
8690

8791
MultiplyDivide
8892
= _ left:Factor rest:(('*' / '/') Factor)* _ {
89-
return rest.reduce((acc, curr) => ({
93+
const topLevel = rest.reduce((acc, curr) => ({
9094
type: 'function',
9195
name: curr[0] === '*' ? 'multiply' : 'divide',
9296
args: [acc, curr[1]],
93-
location: simpleLocation(location()),
94-
text: text()
95-
}), left)
97+
}), left);
98+
if (typeof topLevel === 'object') {
99+
topLevel.location = simpleLocation(location());
100+
topLevel.text = text();
101+
}
102+
return topLevel;
96103
}
104+
/ Factor
97105

98106
Factor
99107
= Group

packages/kbn-tinymath/index.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ export interface TinymathLocation {
2424
export interface TinymathFunction {
2525
type: 'function';
2626
name: string;
27-
text: string;
2827
args: TinymathAST[];
29-
location: TinymathLocation;
28+
// Location is not guaranteed because PEG grammars are not left-recursive
29+
location?: TinymathLocation;
30+
// Text is not guaranteed because PEG grammars are not left-recursive
31+
text?: string;
3032
}
3133

3234
export interface TinymathVariable {

packages/kbn-tinymath/test/library.test.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,35 @@ describe('Parser', () => {
4141
});
4242
});
4343

44+
describe('Math', () => {
45+
it('converts basic symbols into left-to-right pairs', () => {
46+
expect(parse('a + b + c - d')).toEqual({
47+
args: [
48+
{
49+
name: 'add',
50+
type: 'function',
51+
args: [
52+
{
53+
name: 'add',
54+
type: 'function',
55+
args: [
56+
expect.objectContaining({ location: { min: 0, max: 2 } }),
57+
expect.objectContaining({ location: { min: 3, max: 6 } }),
58+
],
59+
},
60+
expect.objectContaining({ location: { min: 7, max: 10 } }),
61+
],
62+
},
63+
expect.objectContaining({ location: { min: 11, max: 13 } }),
64+
],
65+
name: 'subtract',
66+
type: 'function',
67+
text: 'a + b + c - d',
68+
location: { min: 0, max: 13 },
69+
});
70+
});
71+
});
72+
4473
describe('Variables', () => {
4574
it('strings', () => {
4675
expect(parse('f')).toEqual(variableEqual('f'));
@@ -263,6 +292,8 @@ describe('Evaluate', () => {
263292
expect(evaluate('5/20')).toEqual(0.25);
264293
expect(evaluate('1 + 1 + 2 + 3 + 12')).toEqual(19);
265294
expect(evaluate('100 / 10 / 10')).toEqual(1);
295+
expect(evaluate('0 * 1 - 100 / 10 / 10')).toEqual(-1);
296+
expect(evaluate('100 / (10 / 10)')).toEqual(100);
266297
});
267298

268299
it('equations with functions', () => {

0 commit comments

Comments
 (0)