@crowdstrike/logscale-parser-edit 1.126.0--build-684--sha-1de8e2885c1117489d131c478ebf5a572b6881cf
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/index.d.ts +127 -0
- package/index.js +26534 -0
- package/index.js.map +6 -0
- package/package.json +14 -0
package/index.d.ts
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
/**
|
2
|
+
* @crowdstrike/logscale-parser-edit
|
3
|
+
*
|
4
|
+
* Allows you to embed an editor for LogScale parsers as a WebComponent.
|
5
|
+
*
|
6
|
+
* ```ts
|
7
|
+
* // Importing the module defines the "logscale-parser-edit" custom element as a side-effect.
|
8
|
+
* import {createElement, Options} from "@crowdstrike/logscale-parser-edit";
|
9
|
+
*
|
10
|
+
* // See documentation for `createElement`
|
11
|
+
* const element : ParserEdit = createElement(options);
|
12
|
+
* document.body.appendChild(element);
|
13
|
+
* ```
|
14
|
+
*
|
15
|
+
* @packageDocumentation
|
16
|
+
*/
|
17
|
+
|
18
|
+
/** Common options shared by all LogScale Webcomponents
|
19
|
+
* @public
|
20
|
+
*/
|
21
|
+
export declare interface CommonOptions {
|
22
|
+
/** The current unix time as millisecs. Defaults to `Date.now` if not set. */
|
23
|
+
currentTime?: number;
|
24
|
+
/** Allows you to open the webcomponent's internal shadow DOM.
|
25
|
+
*
|
26
|
+
* This is useful for writing E2E tests where you want to inspect the internal DOM of the WebComponent.
|
27
|
+
* Do this sparingly, since the internal DOM elements can change between releases of
|
28
|
+
* the webcomponents.
|
29
|
+
*/
|
30
|
+
shadowRootMode?: "open" | "closed";
|
31
|
+
/** Names of experimental features to be enabled. The names of features are provided by LogScale on a case-by-case basis.
|
32
|
+
* Should be left empty or undefined by default.
|
33
|
+
*/
|
34
|
+
featureFlags?: Array<string> | Record<string, boolean>;
|
35
|
+
}
|
36
|
+
|
37
|
+
/** Helper function that creates a `logscale-parser-edit` webcomponent and initializes it with the provided options.
|
38
|
+
*
|
39
|
+
* ```ts
|
40
|
+
* const options : Options = {
|
41
|
+
* parserId: "some-parser-id",
|
42
|
+
* repoName: "some-repo-name",
|
43
|
+
* apiURL: "https://...",
|
44
|
+
* theme: "dark",
|
45
|
+
* // ...
|
46
|
+
* };
|
47
|
+
*
|
48
|
+
* const element : ParserEdit = createElement(options);
|
49
|
+
*
|
50
|
+
* // To trigger the save behavior, you need to register a callback
|
51
|
+
* element.onSave((error: Error) => {
|
52
|
+
* if (error) {
|
53
|
+
* console.error("SAVE FAILED", error);
|
54
|
+
* return;
|
55
|
+
* }
|
56
|
+
* console.log("SAVE SUCCESS");
|
57
|
+
* });
|
58
|
+
* // then you can call the `save` method as needed:
|
59
|
+
* element.save();
|
60
|
+
*
|
61
|
+
* // ParserEdit inherits from HtmlElement and can be added to the DOM:
|
62
|
+
* document.body.appendChild(element);
|
63
|
+
* ```
|
64
|
+
*
|
65
|
+
* @public
|
66
|
+
*/
|
67
|
+
export declare function createElement(options: Options): ParserEdit;
|
68
|
+
|
69
|
+
/** Initialization options.
|
70
|
+
* @public
|
71
|
+
*/
|
72
|
+
export declare interface Options extends CommonOptions {
|
73
|
+
/** Base URL where the LogScale cluster is accessed. */
|
74
|
+
apiURL: string;
|
75
|
+
/** If the LSP websocket server is accessed from a different URL than the `apiUrl`, you can set this. */
|
76
|
+
lspURL?: string;
|
77
|
+
/** If provided, this token will be passed in the Authentication header as a Bearer token.
|
78
|
+
* This can be a user's personal API token or an OICD token.
|
79
|
+
*
|
80
|
+
* This method of setting the authentication token is not recommended, since it exposes the authorization token to be read from JavaScript.
|
81
|
+
* Consider using a secure HTTP-only cookie instead.
|
82
|
+
*/
|
83
|
+
authToken?: string;
|
84
|
+
/** If provided, HTTP calls will have the "X-CSRF-Token" header set to this value. */
|
85
|
+
csrfToken?: string;
|
86
|
+
/** Will initialize the webcomponent in light or dark mode. The theme can be switched through the `setTheme()` method after initialization. */
|
87
|
+
theme: 'light' | 'dark';
|
88
|
+
/** Language to start the webcomponent in. */
|
89
|
+
locale?: "jp" | "en";
|
90
|
+
/** Advanced feature: Set the language version to be used. This depends on the backend configuration and might crash if set inappropriately. */
|
91
|
+
languageVersion?: string;
|
92
|
+
/** Name of the repository containing the parser to be edited. */
|
93
|
+
repoName: string;
|
94
|
+
/** ID of the parser to be edited. */
|
95
|
+
parserId: string;
|
96
|
+
}
|
97
|
+
|
98
|
+
/** Custom element that embeds the LogScale parser editor.
|
99
|
+
* @public @sealed
|
100
|
+
*/
|
101
|
+
export declare class ParserEdit extends WebcomponentBase<Options> {
|
102
|
+
/** Requests the parser to be saved. Will trigger the callback provided by `#onSave` once completed (on success or failure).
|
103
|
+
* @public
|
104
|
+
*/
|
105
|
+
save(): void;
|
106
|
+
/** Saves a callback for when a parser is saved.
|
107
|
+
* @public
|
108
|
+
*/
|
109
|
+
onSave(callback: (error: Error) => void): void;
|
110
|
+
}
|
111
|
+
|
112
|
+
/** Base class for LogScale's webcomponents.
|
113
|
+
* @public */
|
114
|
+
export declare abstract class WebcomponentBase<Opts extends CommonOptions> extends HTMLElement {
|
115
|
+
/** Initializes the webcomponent with options.
|
116
|
+
*
|
117
|
+
* This should be called only once per webcomponent.
|
118
|
+
* You should not need to call this if you are using the `createElement` helper function.
|
119
|
+
* @public
|
120
|
+
*/
|
121
|
+
init(options: Opts): void;
|
122
|
+
/** Set the UI theme to dark or light.
|
123
|
+
* @public */
|
124
|
+
setTheme(theme: "dark" | "light"): void;
|
125
|
+
}
|
126
|
+
|
127
|
+
export { }
|