@spectric/ui 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Banner-CZ3qKIQC.js +172 -0
- package/dist/assets/Banner.stories-BMf4MBpI.js +19 -0
- package/dist/assets/BitDisplay.stories-wztXxpxe.js +18 -0
- package/dist/assets/Bits-C_TSTjST.js +1 -0
- package/dist/assets/Button.stories-gHxjWwVf.js +142 -0
- package/dist/assets/Color-F6OSRLHC-AjFOL-zN.js +1 -0
- package/dist/assets/DocsRenderer-CFRXHY34-CvW79YxE.js +761 -0
- package/dist/assets/Header.stories-Bc09U6g1.js +25 -0
- package/dist/assets/Page.stories-DNJKhAFs.js +114 -0
- package/dist/assets/QueryBar.stories-Da5C-SV4.js +17 -0
- package/dist/assets/_commonjsHelpers-Cpj98o6Y.js +1 -0
- package/dist/assets/chunk-L4EGOTBX-AI5g0G5Z.js +2 -0
- package/dist/assets/data-CwENMT7L.js +3 -0
- package/dist/assets/dialog-CFHXbUTQ.js +611 -0
- package/dist/assets/directive-helpers-IbK5tOA8.js +5 -0
- package/dist/assets/entry-preview-Di-j0SPB.js +4 -0
- package/dist/assets/entry-preview-docs-CUBRpM7y.js +1 -0
- package/dist/assets/iframe-BQFuVTVZ.js +2 -0
- package/dist/assets/index-BCiKWbv6.js +1 -0
- package/dist/assets/index-BHYIh-Xd.js +8 -0
- package/dist/assets/index-DBGhiA-l.js +1 -0
- package/dist/assets/index-DrFu-skq.js +6 -0
- package/dist/assets/index-oFsFREWh.js +9 -0
- package/dist/assets/input.stories-Cgdv-5bN.js +58 -0
- package/dist/assets/lit-element-UdLzEcH-.js +19 -0
- package/dist/assets/preview-BWzBA1C2.js +396 -0
- package/dist/assets/preview-CGiTbRot.js +2 -0
- package/dist/assets/preview-D77C14du.js +34 -0
- package/dist/assets/preview-DEMzn_yN.js +1 -0
- package/dist/assets/preview-DFmD0pui.js +1 -0
- package/dist/assets/preview-DGUiP6tS.js +7 -0
- package/dist/assets/preview-DQVTHjv1.js +182 -0
- package/dist/assets/preview-aVwhiz9X.js +1 -0
- package/dist/assets/tiny-invariant-CopsF_GD.js +1 -0
- package/dist/classes/BitArray.d.ts +11 -0
- package/dist/classes/DisposibleElement.d.ts +21 -0
- package/dist/components/Banner.d.ts +51 -0
- package/dist/components/Bitdisplay.d.ts +91 -0
- package/dist/components/Button.d.ts +65 -0
- package/dist/components/Header.d.ts +70 -0
- package/dist/components/Page.d.ts +93 -0
- package/dist/components/Panel.d.ts +14 -0
- package/dist/components/ThemeProvider.d.ts +99 -0
- package/dist/components/button.css.d.ts +2 -0
- package/dist/components/configurations/classifications.d.ts +29 -0
- package/dist/components/dialog/dialog.css.d.ts +1 -0
- package/dist/components/dialog/dialog.d.ts +60 -0
- package/dist/components/dialog/index.d.ts +1 -0
- package/dist/components/header.css.d.ts +2 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/input.css.d.ts +2 -0
- package/dist/components/input.d.ts +156 -0
- package/dist/components/page.css.d.ts +2 -0
- package/dist/components/panel.css.d.ts +2 -0
- package/dist/components/query_bar/QueryBar.d.ts +113 -0
- package/dist/components/query_bar/index.d.ts +2 -0
- package/dist/components/query_bar/querylanguage/kuery/ast/ast.d.ts +13 -0
- package/dist/components/query_bar/querylanguage/kuery/ast/index.d.ts +1 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/and.d.ts +9 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/exists.d.ts +10 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/index.d.ts +1 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/is.d.ts +34 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/nested.d.ts +11 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/not.d.ts +9 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/or.d.ts +10 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/range.d.ts +10 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/utils/get_fields.d.ts +2 -0
- package/dist/components/query_bar/querylanguage/kuery/functions/utils/get_full_field_name_node.d.ts +2 -0
- package/dist/components/query_bar/querylanguage/kuery/index.d.ts +7 -0
- package/dist/components/query_bar/querylanguage/kuery/kuery_syntax_error.d.ts +13 -0
- package/dist/components/query_bar/querylanguage/kuery/node_types/function.d.ts +5 -0
- package/dist/components/query_bar/querylanguage/kuery/node_types/index.d.ts +3 -0
- package/dist/components/query_bar/querylanguage/kuery/node_types/literal.d.ts +3 -0
- package/dist/components/query_bar/querylanguage/kuery/node_types/named_arg.d.ts +4 -0
- package/dist/components/query_bar/querylanguage/kuery/node_types/types.d.ts +49 -0
- package/dist/components/query_bar/querylanguage/kuery/node_types/wildcard.d.ts +8 -0
- package/dist/components/query_bar/querylanguage/kuery/types.d.ts +18 -0
- package/dist/components/query_bar/querylanguage/outputTypes/toCQL.d.ts +14 -0
- package/dist/components/query_bar/querylanguage/outputTypes/toMongo.d.ts +20 -0
- package/dist/components/query_bar/querylanguage/utils.d.ts +1 -0
- package/dist/components/query_bar/types.d.ts +56 -0
- package/dist/components/splitview/index.d.ts +1 -0
- package/dist/components/splitview/splitview.css.d.ts +1 -0
- package/dist/components/splitview/splitview.d.ts +73 -0
- package/dist/components/types.d.ts +21 -0
- package/dist/custom-elements.json +1919 -0
- package/dist/favicon.svg +1 -0
- package/dist/iframe.html +639 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +4139 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.html +190 -0
- package/dist/index.json +1 -0
- package/dist/index.umd.js +945 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/nunito-sans-bold.woff2 +0 -0
- package/dist/nunito-sans-italic.woff2 +0 -0
- package/dist/nunito-sans-regular.woff2 +0 -0
- package/dist/project.json +1 -0
- package/dist/sb-addons/chromatic-com-storybook-8/manager-bundle.js +333 -0
- package/dist/sb-addons/chromatic-com-storybook-8/manager-bundle.js.LEGAL.txt +40 -0
- package/dist/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-backgrounds-3/manager-bundle.js +12 -0
- package/dist/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-controls-1/manager-bundle.js +391 -0
- package/dist/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-measure-6/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-outline-7/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-toolbars-5/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/essentials-viewport-4/manager-bundle.js +3 -0
- package/dist/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +3 -0
- package/dist/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js.LEGAL.txt +0 -0
- package/dist/sb-common-assets/favicon.svg +1 -0
- package/dist/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/dist/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/dist/sb-manager/globals-module-info.js +1028 -0
- package/dist/sb-manager/globals-runtime.js +40861 -0
- package/dist/sb-manager/globals.js +48 -0
- package/dist/sb-manager/runtime.js +13338 -0
- package/dist/sb-preview/globals.js +33 -0
- package/dist/sb-preview/runtime.js +7174 -0
- package/dist/style.css +1 -0
- package/dist/utils/debounce.d.ts +2 -0
- package/dist/utils/spread.d.ts +32 -0
- package/package.json +6 -1
- package/src/components/query_bar/QueryBar.ts +15 -2
- package/.gitlab-ci.yml +0 -28
- package/.nvmrc +0 -1
- package/.storybook/analyze.sh +0 -4
- package/.storybook/main.ts +0 -55
- package/.storybook/preview.ts +0 -42
- package/.vscode/extensions.json +0 -5
- package/.vscode/settings.json +0 -41
- package/html-include.png +0 -0
- package/test/__init__.py +0 -9
- package/test/elastic.py +0 -9
- package/test/interface.py +0 -16
- package/tsconfig.json +0 -29
- package/vite.config.js +0 -34
- package/vue-example.png +0 -0
- package/vue-include.png +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
|
2
|
+
import { ReactElementWithPropsAndEvents } from './types';
|
|
3
|
+
export declare enum InputVariants {
|
|
4
|
+
Text = "text",
|
|
5
|
+
TextArea = "text-area",
|
|
6
|
+
number = "number",
|
|
7
|
+
color = "color",
|
|
8
|
+
date = "date",//replace default eventually with custom
|
|
9
|
+
datetime = "datetime-local",//replace default eventually with custom
|
|
10
|
+
email = "email",
|
|
11
|
+
file = "file",//display drop area
|
|
12
|
+
hidden = "hidden",//display drop area
|
|
13
|
+
password = "password"
|
|
14
|
+
}
|
|
15
|
+
type InputVariantsTypes = `${InputVariants}`;
|
|
16
|
+
export interface InputProps {
|
|
17
|
+
/** Input type */
|
|
18
|
+
variant: InputVariantsTypes;
|
|
19
|
+
/**Label to display above the input */
|
|
20
|
+
label: string;
|
|
21
|
+
/**placeholder text to display*/
|
|
22
|
+
placeholder: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
readonly: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The helper text.
|
|
27
|
+
*/
|
|
28
|
+
helperText: string;
|
|
29
|
+
/**
|
|
30
|
+
* Specify if the currently value is invalid.
|
|
31
|
+
*/
|
|
32
|
+
invalid: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Message which is displayed if the value is invalid.
|
|
35
|
+
*/
|
|
36
|
+
invalidText: string | TemplateResult<1>;
|
|
37
|
+
/**
|
|
38
|
+
* Max character count allowed for input. This is needed in order for enableCounter to display
|
|
39
|
+
*/
|
|
40
|
+
maxCount: number;
|
|
41
|
+
/**
|
|
42
|
+
* Boolean property to set the required status
|
|
43
|
+
*/
|
|
44
|
+
required?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Shows a button to display the password
|
|
47
|
+
*/
|
|
48
|
+
showPasswordVisibilityToggle?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Name for the input used for form data events //TODO make sure this works
|
|
51
|
+
*/
|
|
52
|
+
name?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Pattern to validate the input against for HTML validity checking
|
|
55
|
+
*/
|
|
56
|
+
pattern?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The sets the autocomplete for the input.
|
|
59
|
+
*/
|
|
60
|
+
autocomplete: HTMLInputElement['autocomplete'];
|
|
61
|
+
}
|
|
62
|
+
export declare class SpectricInput extends LitElement implements InputProps {
|
|
63
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
64
|
+
placeholder: string;
|
|
65
|
+
readonly: boolean;
|
|
66
|
+
variant: InputVariantsTypes;
|
|
67
|
+
disabled: boolean;
|
|
68
|
+
label: string;
|
|
69
|
+
/**
|
|
70
|
+
* "Hide password" tooltip text on password visibility toggle
|
|
71
|
+
*/
|
|
72
|
+
hidePasswordLabel: string;
|
|
73
|
+
/**
|
|
74
|
+
* "Show password" tooltip text on password visibility toggle
|
|
75
|
+
*/
|
|
76
|
+
showPasswordLabel: string;
|
|
77
|
+
/**
|
|
78
|
+
* Boolean property to render password visibility toggle
|
|
79
|
+
*/
|
|
80
|
+
showPasswordVisibilityToggle: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* The helper text.
|
|
83
|
+
*/
|
|
84
|
+
helperText: string;
|
|
85
|
+
/**
|
|
86
|
+
* Specify if the currently value is invalid.
|
|
87
|
+
*/
|
|
88
|
+
invalid: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Boolean property to set the required status
|
|
91
|
+
*/
|
|
92
|
+
required: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Message which is displayed if the value is invalid.
|
|
95
|
+
*/
|
|
96
|
+
invalidText: InputProps["invalidText"];
|
|
97
|
+
/**
|
|
98
|
+
* Name for the input used for form data events //TODO make sure this works
|
|
99
|
+
*/
|
|
100
|
+
name: string;
|
|
101
|
+
/**
|
|
102
|
+
* Pattern to validate the input against for HTML validity checking
|
|
103
|
+
*/
|
|
104
|
+
pattern: string;
|
|
105
|
+
maxCount: InputProps['maxCount'];
|
|
106
|
+
/**
|
|
107
|
+
* The internal value.
|
|
108
|
+
*/
|
|
109
|
+
protected _value: string | boolean | number;
|
|
110
|
+
private _showPassword;
|
|
111
|
+
/**
|
|
112
|
+
* The sets the autocomplete for the input.
|
|
113
|
+
*/
|
|
114
|
+
autocomplete: HTMLInputElement['autocomplete'];
|
|
115
|
+
get selectionStart(): number | null;
|
|
116
|
+
/**
|
|
117
|
+
* The value of the input.
|
|
118
|
+
*/
|
|
119
|
+
get value(): string | number | boolean;
|
|
120
|
+
set value(value: string | number | boolean);
|
|
121
|
+
setSelectionRange(start: number, end: number, direction?: "forward" | "backward" | "none"): void;
|
|
122
|
+
/**
|
|
123
|
+
* Handles `oninput` event on the `<input>`.
|
|
124
|
+
*/
|
|
125
|
+
protected _handleInput: ({ target }: Event) => void;
|
|
126
|
+
/**
|
|
127
|
+
* The underlying input element
|
|
128
|
+
*/
|
|
129
|
+
protected _input: HTMLInputElement;
|
|
130
|
+
private handleTogglePasswordVisibility;
|
|
131
|
+
protected render(): unknown;
|
|
132
|
+
}
|
|
133
|
+
declare global {
|
|
134
|
+
interface HTMLElementTagNameMap {
|
|
135
|
+
"spectric-input": SpectricInput;
|
|
136
|
+
}
|
|
137
|
+
namespace JSX {
|
|
138
|
+
interface IntrinsicElements {
|
|
139
|
+
/**
|
|
140
|
+
* {@link SpectricInput}
|
|
141
|
+
*/
|
|
142
|
+
"spectric-input": ReactElementWithPropsAndEvents<SpectricInput, InputProps>;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
namespace React {
|
|
146
|
+
namespace JSX {
|
|
147
|
+
interface IntrinsicElements {
|
|
148
|
+
/**
|
|
149
|
+
* {@link SpectricInput}
|
|
150
|
+
*/
|
|
151
|
+
"spectric-input": ReactElementWithPropsAndEvents<SpectricInput, InputProps>;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { SpectricInput } from '../input';
|
|
3
|
+
import { JsonObject } from './types';
|
|
4
|
+
import { HTMLElementTagWithEvents, ReactElementWithPropsAndEvents } from '../types';
|
|
5
|
+
import * as kuery from "./querylanguage/kuery";
|
|
6
|
+
export type FieldTypes = {
|
|
7
|
+
name: string;
|
|
8
|
+
type: "string" | "number" | "boolean";
|
|
9
|
+
format?: "date-time";
|
|
10
|
+
};
|
|
11
|
+
type SuggestionType = 'conjunction' | "field" | 'operator' | 'value';
|
|
12
|
+
type Suggestion = {
|
|
13
|
+
fieldName: string;
|
|
14
|
+
end: number;
|
|
15
|
+
prefix: string;
|
|
16
|
+
start: number;
|
|
17
|
+
suffix: string;
|
|
18
|
+
suggestionTypes: (SuggestionType)[];
|
|
19
|
+
text: string;
|
|
20
|
+
type: "cursor";
|
|
21
|
+
};
|
|
22
|
+
export declare enum SupportedLanguages {
|
|
23
|
+
MONGO = "toMongo",
|
|
24
|
+
CQL = "toCql",
|
|
25
|
+
DSL = "toDSL",
|
|
26
|
+
AST = "AST"
|
|
27
|
+
}
|
|
28
|
+
type SupportedLanguagesTypes = `${SupportedLanguages}`;
|
|
29
|
+
interface QueryEventMap {
|
|
30
|
+
"change": (event: CustomEvent<string | kuery.KueryNode | JsonObject>) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface IQueryProps {
|
|
33
|
+
/**
|
|
34
|
+
* The output of the query in a specific format
|
|
35
|
+
*/
|
|
36
|
+
outputLanguage: SupportedLanguagesTypes;
|
|
37
|
+
/**
|
|
38
|
+
* The output of the query
|
|
39
|
+
*/
|
|
40
|
+
value: string;
|
|
41
|
+
/**
|
|
42
|
+
* Fields that are used for the auto complete
|
|
43
|
+
*/
|
|
44
|
+
fields: FieldTypes[];
|
|
45
|
+
/**
|
|
46
|
+
* Callback that will provide values for specific fields
|
|
47
|
+
*/
|
|
48
|
+
getValuesForField: (field: string, text: string) => Promise<string[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Input placeholder
|
|
51
|
+
*/
|
|
52
|
+
placeholder: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The Query component will take Opensearch Dashboard Query language and transform it into various outputs
|
|
56
|
+
*/
|
|
57
|
+
export declare class SpectricQuery extends LitElement implements IQueryProps {
|
|
58
|
+
private uuid;
|
|
59
|
+
placeholder: string;
|
|
60
|
+
constructor();
|
|
61
|
+
protected createRenderRoot(): HTMLElement | DocumentFragment;
|
|
62
|
+
/**
|
|
63
|
+
* The internal value.
|
|
64
|
+
*/
|
|
65
|
+
protected _value: string;
|
|
66
|
+
private suggestion?;
|
|
67
|
+
/**
|
|
68
|
+
* The value of the input.
|
|
69
|
+
*/
|
|
70
|
+
get value(): string;
|
|
71
|
+
set value(value: string);
|
|
72
|
+
outputLanguage: SupportedLanguagesTypes;
|
|
73
|
+
private completions;
|
|
74
|
+
private completionIndex;
|
|
75
|
+
fields: FieldTypes[];
|
|
76
|
+
_autocomplete?: HTMLDivElement;
|
|
77
|
+
_asyncAutocomplete: Promise<HTMLDivElement>;
|
|
78
|
+
/**
|
|
79
|
+
* The underlying input element
|
|
80
|
+
*/
|
|
81
|
+
protected _input: SpectricInput;
|
|
82
|
+
_parseQuery: (e?: InputEvent | undefined) => void;
|
|
83
|
+
getValuesForField: (field: string, text: string) => Promise<string[]>;
|
|
84
|
+
autoComplete(suggestion: Suggestion): Promise<void>;
|
|
85
|
+
protected updated(changed: PropertyValues): void;
|
|
86
|
+
_selectCompletion: () => Promise<void>;
|
|
87
|
+
_handleArrows: (e: KeyboardEvent) => void;
|
|
88
|
+
protected render(): import('lit-html').TemplateResult<1>;
|
|
89
|
+
}
|
|
90
|
+
declare global {
|
|
91
|
+
interface HTMLElementTagNameMap {
|
|
92
|
+
"spectric-query": HTMLElementTagWithEvents<SpectricQuery, QueryEventMap>;
|
|
93
|
+
}
|
|
94
|
+
namespace JSX {
|
|
95
|
+
interface IntrinsicElements {
|
|
96
|
+
/**
|
|
97
|
+
* {@link SpectricQuery}
|
|
98
|
+
*/
|
|
99
|
+
"spectric-query": ReactElementWithPropsAndEvents<SpectricQuery, IQueryProps, QueryEventMap>;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
namespace React {
|
|
103
|
+
namespace JSX {
|
|
104
|
+
interface IntrinsicElements {
|
|
105
|
+
/**
|
|
106
|
+
* {@link SpectricQuery}
|
|
107
|
+
*/
|
|
108
|
+
"spectric-query": ReactElementWithPropsAndEvents<SpectricQuery, IQueryProps, QueryEventMap>;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { KueryNode, DslQuery, KueryParseOptions } from '../types';
|
|
2
|
+
import { JsonObject, IIndexPattern, FieldTypes } from '../../..';
|
|
3
|
+
export declare const fromLiteralExpression: (expression: string | DslQuery, parseOptions?: Partial<KueryParseOptions>) => KueryNode;
|
|
4
|
+
export declare const fromKueryExpression: (expression: string | DslQuery, parseOptions?: Partial<KueryParseOptions>) => KueryNode;
|
|
5
|
+
export declare const doesKueryExpressionHaveLuceneSyntaxError: (expression: string | DslQuery) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* @params {String} indexPattern
|
|
8
|
+
* @params {Object} config - contains the dateFormatTZ
|
|
9
|
+
*
|
|
10
|
+
* IndexPattern isn't required, but if you pass one in, we can be more intelligent
|
|
11
|
+
* about how we craft the queries (e.g. scripted fields)
|
|
12
|
+
*/
|
|
13
|
+
export declare const toOpenSearchQuery: (node: KueryNode, indexPattern?: IIndexPattern | FieldTypes[], config?: Record<string, any>, context?: Record<string, any>) => JsonObject;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ast';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
export declare function buildNodeParams(children: KueryNode[]): {
|
|
3
|
+
arguments: KueryNode[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): {
|
|
6
|
+
bool: {
|
|
7
|
+
filter: any;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../../';
|
|
2
|
+
export declare function buildNodeParams(fieldName: string): {
|
|
3
|
+
arguments: import('..').LiteralTypeBuildNode[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, //@ts-ignore
|
|
6
|
+
config?: Record<string, any>, context?: Record<string, any>): {
|
|
7
|
+
exists: {
|
|
8
|
+
field: string | number | boolean | null;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const functions: any;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
export declare function buildNodeParams(fieldName: string, value: any, isPhrase?: boolean): {
|
|
3
|
+
arguments: (import('..').LiteralTypeBuildNode | import('..').KueryNode)[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): {
|
|
6
|
+
query_string: {
|
|
7
|
+
query: string;
|
|
8
|
+
};
|
|
9
|
+
multi_match?: undefined;
|
|
10
|
+
match_all?: undefined;
|
|
11
|
+
bool?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
multi_match: {
|
|
14
|
+
type: string;
|
|
15
|
+
query: any;
|
|
16
|
+
lenient: boolean;
|
|
17
|
+
};
|
|
18
|
+
query_string?: undefined;
|
|
19
|
+
match_all?: undefined;
|
|
20
|
+
bool?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
match_all: {};
|
|
23
|
+
query_string?: undefined;
|
|
24
|
+
multi_match?: undefined;
|
|
25
|
+
bool?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
bool: {
|
|
28
|
+
should: any[];
|
|
29
|
+
minimum_should_match: number;
|
|
30
|
+
};
|
|
31
|
+
query_string?: undefined;
|
|
32
|
+
multi_match?: undefined;
|
|
33
|
+
match_all?: undefined;
|
|
34
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
export declare function buildNodeParams(path: any, child: any): {
|
|
3
|
+
arguments: any[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): {
|
|
6
|
+
nested: {
|
|
7
|
+
path: string | import('../../..').JsonObject;
|
|
8
|
+
query: import('../../..').JsonObject;
|
|
9
|
+
score_mode: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
export declare function buildNodeParams(child: KueryNode): {
|
|
3
|
+
arguments: KueryNode[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): {
|
|
6
|
+
bool: {
|
|
7
|
+
must_not: import('../../..').JsonObject;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
export declare function buildNodeParams(children: KueryNode[]): {
|
|
3
|
+
arguments: KueryNode[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): {
|
|
6
|
+
bool: {
|
|
7
|
+
should: any;
|
|
8
|
+
minimum_should_match: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
export declare function buildNodeParams(fieldName: string, params: any): {
|
|
3
|
+
arguments: (import('..').LiteralTypeBuildNode | import('..').NamedArgTypeBuildNode | import('..').KueryNode)[];
|
|
4
|
+
};
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): {
|
|
6
|
+
bool: {
|
|
7
|
+
should: any[];
|
|
8
|
+
minimum_should_match: number;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DQLSyntaxError } from './kuery_syntax_error';
|
|
2
|
+
export { nodeTypes } from './node_types';
|
|
3
|
+
export * from './ast';
|
|
4
|
+
export { fromKueryExpression as parse, toOpenSearchQuery as toDSL } from './ast';
|
|
5
|
+
export { toCql } from '../outputTypes/toCQL';
|
|
6
|
+
export { toMongo } from '../outputTypes/toMongo';
|
|
7
|
+
export * from './types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface DQLSyntaxErrorData extends Error {
|
|
2
|
+
found: string;
|
|
3
|
+
expected: DQLSyntaxErrorExpected[] | null;
|
|
4
|
+
location: any;
|
|
5
|
+
}
|
|
6
|
+
interface DQLSyntaxErrorExpected {
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class DQLSyntaxError extends Error {
|
|
10
|
+
shortMessage: string;
|
|
11
|
+
constructor(error: DQLSyntaxErrorData, expression: any);
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IIndexPattern, KueryNode } from '../../..';
|
|
2
|
+
import { FunctionName, FunctionTypeBuildNode } from './types';
|
|
3
|
+
export declare function buildNode(functionName: FunctionName, ...args: any[]): any;
|
|
4
|
+
export declare function buildNodeWithArgumentNodes(functionName: FunctionName, args: any[]): FunctionTypeBuildNode;
|
|
5
|
+
export declare function toOpenSearchQuery(node: KueryNode, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>): any;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { JsonValue, IIndexPattern } from '../../../types';
|
|
2
|
+
import { KueryNode } from '..';
|
|
3
|
+
export type FunctionName = 'is' | 'and' | 'or' | 'not' | 'range' | 'exists' | 'geoBoundingBox' | 'geoPolygon' | 'nested';
|
|
4
|
+
interface FunctionType {
|
|
5
|
+
buildNode: (functionName: FunctionName, ...args: any[]) => FunctionTypeBuildNode;
|
|
6
|
+
buildNodeWithArgumentNodes: (functionName: FunctionName, args: any[]) => FunctionTypeBuildNode;
|
|
7
|
+
toOpenSearchQuery: (node: any, indexPattern?: IIndexPattern, config?: Record<string, any>, context?: Record<string, any>) => JsonValue;
|
|
8
|
+
}
|
|
9
|
+
export interface FunctionTypeBuildNode {
|
|
10
|
+
type: 'function';
|
|
11
|
+
function: FunctionName;
|
|
12
|
+
arguments: any[];
|
|
13
|
+
}
|
|
14
|
+
interface LiteralType {
|
|
15
|
+
buildNode: (value: null | boolean | number | string) => LiteralTypeBuildNode;
|
|
16
|
+
toOpenSearchQuery: (node: any) => null | boolean | number | string;
|
|
17
|
+
}
|
|
18
|
+
export interface LiteralTypeBuildNode {
|
|
19
|
+
type: 'literal';
|
|
20
|
+
value: null | boolean | number | string;
|
|
21
|
+
}
|
|
22
|
+
interface NamedArgType {
|
|
23
|
+
buildNode: (name: string, value: any) => NamedArgTypeBuildNode;
|
|
24
|
+
toOpenSearchQuery: (node: any) => JsonValue;
|
|
25
|
+
}
|
|
26
|
+
export interface NamedArgTypeBuildNode {
|
|
27
|
+
type: 'namedArg';
|
|
28
|
+
name: string;
|
|
29
|
+
value: any;
|
|
30
|
+
}
|
|
31
|
+
interface WildcardType {
|
|
32
|
+
wildcardSymbol: string;
|
|
33
|
+
buildNode: (value: string) => WildcardTypeBuildNode | KueryNode;
|
|
34
|
+
test: (node: any, string: string) => boolean;
|
|
35
|
+
toOpenSearchQuery: (node: any) => string;
|
|
36
|
+
toQueryStringQuery: (node: any) => string;
|
|
37
|
+
hasLeadingWildcard: (node: any) => boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface WildcardTypeBuildNode {
|
|
40
|
+
type: 'wildcard';
|
|
41
|
+
value: string;
|
|
42
|
+
}
|
|
43
|
+
export interface NodeTypes {
|
|
44
|
+
function: FunctionType;
|
|
45
|
+
literal: LiteralType;
|
|
46
|
+
namedArg: NamedArgType;
|
|
47
|
+
wildcard: WildcardType;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WildcardTypeBuildNode } from './types';
|
|
2
|
+
import { KueryNode } from '..';
|
|
3
|
+
export declare const wildcardSymbol = "@kuery-wildcard@";
|
|
4
|
+
export declare function buildNode(value: string): WildcardTypeBuildNode | KueryNode;
|
|
5
|
+
export declare function test(node: any, str: string): boolean;
|
|
6
|
+
export declare function toOpenSearchQuery(node: any): string;
|
|
7
|
+
export declare function toQueryStringQuery(node: any): string;
|
|
8
|
+
export declare function hasLeadingWildcard(node: any): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NodeTypes } from './node_types';
|
|
2
|
+
export * from './node_types';
|
|
3
|
+
export interface KueryNode {
|
|
4
|
+
type: keyof NodeTypes;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}
|
|
7
|
+
export type DslQuery = any;
|
|
8
|
+
export interface KueryParseOptions {
|
|
9
|
+
helpers: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
startRule: string;
|
|
13
|
+
allowLeadingWildcards: boolean;
|
|
14
|
+
errorOnLuceneSyntax: boolean;
|
|
15
|
+
cursorSymbol?: string;
|
|
16
|
+
parseCursor?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export { nodeTypes } from './node_types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FieldTypes, KueryNode } from '../..';
|
|
2
|
+
export declare const KQL_WILDCARD_SYMBOL = "@kuery-wildcard@";
|
|
3
|
+
export declare const KQL_NODE_TYPE_WILDCARD = "wildcard";
|
|
4
|
+
export type FunctionName = 'is' | 'and' | 'or' | 'not' | 'range' | 'exists' | 'nested';
|
|
5
|
+
export declare const functions: {
|
|
6
|
+
is: (node: KueryNode, fields?: FieldTypes[]) => string;
|
|
7
|
+
and: (node: KueryNode, fields?: FieldTypes[]) => string;
|
|
8
|
+
or: (node: KueryNode, fields?: FieldTypes[]) => string;
|
|
9
|
+
not: (node: KueryNode, fields?: FieldTypes[]) => string;
|
|
10
|
+
range: (node: KueryNode) => string;
|
|
11
|
+
exists: (node: KueryNode) => string;
|
|
12
|
+
nested: (node: KueryNode) => string;
|
|
13
|
+
};
|
|
14
|
+
export declare const toCql: (node: KueryNode, fields?: FieldTypes[]) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FieldTypes, KueryNode } from '../..';
|
|
2
|
+
export declare const KQL_WILDCARD_SYMBOL = "@kuery-wildcard@";
|
|
3
|
+
export declare const KQL_NODE_TYPE_WILDCARD = "wildcard";
|
|
4
|
+
export type FunctionName = 'is' | 'and' | 'or' | 'not' | 'range' | 'exists' | 'nested';
|
|
5
|
+
export declare const functions: {
|
|
6
|
+
is: (node: KueryNode) => any;
|
|
7
|
+
and: (node: KueryNode) => any;
|
|
8
|
+
or: (node: KueryNode) => {
|
|
9
|
+
$or: any;
|
|
10
|
+
};
|
|
11
|
+
not: (node: KueryNode) => any;
|
|
12
|
+
range: (node: KueryNode) => any;
|
|
13
|
+
exists: (node: KueryNode) => {
|
|
14
|
+
[x: string]: {
|
|
15
|
+
$ne: null;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
nested: (node: KueryNode) => string;
|
|
19
|
+
};
|
|
20
|
+
export declare const toMongo: (node: KueryNode, fields?: FieldTypes[]) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getTimeZoneFromSettings(dateFormatTZ: string): string;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { NodeTypes } from './querylanguage/kuery/node_types';
|
|
2
|
+
export interface KueryNode {
|
|
3
|
+
type: keyof NodeTypes;
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
export type DslQuery = any;
|
|
7
|
+
export interface KueryParseOptions {
|
|
8
|
+
helpers: {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
startRule: string;
|
|
12
|
+
allowLeadingWildcards: boolean;
|
|
13
|
+
errorOnLuceneSyntax: boolean;
|
|
14
|
+
cursorSymbol?: string;
|
|
15
|
+
parseCursor?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export type IIndexPattern = {
|
|
18
|
+
fields: IFieldType[];
|
|
19
|
+
};
|
|
20
|
+
export interface JsonArray extends Array<JsonValue> {
|
|
21
|
+
}
|
|
22
|
+
export interface JsonObject {
|
|
23
|
+
[key: string]: JsonValue;
|
|
24
|
+
}
|
|
25
|
+
export type JsonValue = null | boolean | number | string | JsonObject | JsonArray;
|
|
26
|
+
export { nodeTypes } from './querylanguage/kuery/node_types';
|
|
27
|
+
export interface IFieldSubType {
|
|
28
|
+
multi?: {
|
|
29
|
+
parent: string;
|
|
30
|
+
};
|
|
31
|
+
nested?: {
|
|
32
|
+
path: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface IFieldType {
|
|
36
|
+
name: string;
|
|
37
|
+
type: string;
|
|
38
|
+
script?: string;
|
|
39
|
+
lang?: string;
|
|
40
|
+
count?: number;
|
|
41
|
+
esTypes?: string[];
|
|
42
|
+
aggregatable?: boolean;
|
|
43
|
+
filterable?: boolean;
|
|
44
|
+
searchable?: boolean;
|
|
45
|
+
sortable?: boolean;
|
|
46
|
+
visualizable?: boolean;
|
|
47
|
+
readFromDocValues?: boolean;
|
|
48
|
+
scripted?: boolean;
|
|
49
|
+
subType?: IFieldSubType;
|
|
50
|
+
displayName?: string;
|
|
51
|
+
format?: any;
|
|
52
|
+
}
|
|
53
|
+
export interface LatLon {
|
|
54
|
+
lat: number;
|
|
55
|
+
lon: number;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './splitview';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const style: import('lit').CSSResult;
|