@crowdstrike/logscale-file-editor 1.143.0--build-1386--sha-7dd77c28f152f02d096cfff2b59838bf1e98cde4

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.
Files changed (4) hide show
  1. package/index.d.ts +106 -0
  2. package/index.js +14281 -0
  3. package/index.js.map +6 -0
  4. package/package.json +14 -0
package/index.d.ts ADDED
@@ -0,0 +1,106 @@
1
+ /**
2
+ * @crowdstrike/logscale-file-editor
3
+ *
4
+ * Allows you to embed an editor for files in LogScale as a WebComponent.
5
+ *
6
+ * ```ts
7
+ * // Importing the module defines the "logscale-file-editor" custom element as a side-effect.
8
+ * import {createElement, Options} from "@crowdstrike/logscale-file-editor";
9
+ *
10
+ * // See documentation for `createElement`
11
+ * const element : FileEditor = 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-file-editor` webcomponent and initializes it with the provided options.
38
+ *
39
+ * ```ts
40
+ * const options : Options = {
41
+ * apiURL: "https://...",
42
+ * theme: "dark",
43
+ * // ...
44
+ * };
45
+ *
46
+ * const element : FileEditor = createElement(options);
47
+ *
48
+ * // FileEditor inherits from HtmlElement and can be added to the DOM:
49
+ * document.body.appendChild(element);
50
+ * ```
51
+ *
52
+ * @public
53
+ */
54
+ export declare function createElement(options: Options): FileEditor;
55
+
56
+ /** Custom element that embeds the LogScale file-editor.
57
+ * @public @sealed
58
+ */
59
+ export declare class FileEditor extends WebcomponentBase<Options> {
60
+ }
61
+
62
+ /** Initialization options.
63
+ * @public
64
+ */
65
+ export declare interface Options extends CommonOptions {
66
+ /** Base URL where the LogScale cluster is accessed. */
67
+ apiURL: string;
68
+ /** If provided, this token will be passed in the Authentication header as a Bearer token.
69
+ * This can be a user's personal API token or an OICD token.
70
+ *
71
+ * This method of setting the authentication token is not recommended, since it exposes the authorization token to be read from JavaScript.
72
+ * Consider using a secure HTTP-only cookie instead.
73
+ */
74
+ authToken?: string;
75
+ /** If provided, HTTP calls will have the "X-CSRF-Token" header set to this value. */
76
+ csrfToken?: string;
77
+ /** Will initialize the webcomponent in light or dark mode. The theme can be switched through the `setTheme()` method after initialization. */
78
+ theme: 'light' | 'dark';
79
+ /** Name of the repository or view. */
80
+ repoOrViewName: string;
81
+ /** Language to start the webcomponent in. */
82
+ locale?: "jp" | "en";
83
+ /** The file to open, must end with .csv */
84
+ fileName: string;
85
+ /** How many rows to skip. E.g. 100 to show row 101 as the first row. */
86
+ offset?: number;
87
+ /** The number of rows to display. */
88
+ limit?: number;
89
+ }
90
+
91
+ /** Base class for LogScale's webcomponents.
92
+ * @public */
93
+ export declare abstract class WebcomponentBase<Opts extends CommonOptions> extends HTMLElement {
94
+ /** Initializes the webcomponent with options.
95
+ *
96
+ * This should be called only once per webcomponent.
97
+ * You should not need to call this if you are using the `createElement` helper function.
98
+ * @public
99
+ */
100
+ init(options: Opts): void;
101
+ /** Set the UI theme to dark or light.
102
+ * @public */
103
+ setTheme(theme: "dark" | "light"): void;
104
+ }
105
+
106
+ export { }