@gdacm/dashboard-manager 0.1.1

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/info.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ export type Info = import("@gdacm/base-types").Info;
2
+ export type GenericMetaOptions = import("@gdacm/base-types").GenericMetaOptions;
3
+ export type GenericOptions = import("@gdacm/base-types").GenericOptions;
4
+ export type MetaOptions<T extends GenericOptions> = import("@gdacm/base-types").MetaOptions<T>;
5
+ /**
6
+ * @param {...(Info|undefined)} infos
7
+ * @returns {Info}
8
+ */
9
+ export declare const mergeInfos: (...infos: (Info | undefined)[]) => Info;
10
+ /**
11
+ * @returns {Info}
12
+ */
13
+ export declare const getEnvVarsInfo: () => Info;
14
+ /**
15
+ * @template T
16
+ * @param {String} key
17
+ * @param {GenericMetaOptions} metaOptions
18
+ * @param {T} [defaultValue]
19
+ * @returns {T}
20
+ */
21
+ export declare const getFromOptionsOrInfo: <T>(key: string, metaOptions: GenericMetaOptions, defaultValue?: T) => T;
22
+ /**
23
+ * @template {GenericOptions} T
24
+ * @param {...GenericOptions|undefined} metaOptionsList
25
+ * @returns {MetaOptions<T>}
26
+ */
27
+ export declare const mergeOptions: <T extends GenericOptions>(...metaOptionsList: (GenericOptions | undefined)[]) => MetaOptions<T>;
28
+ /**
29
+ * @param {Info|Info[]|undefined} infoCode
30
+ * @param {String|String[]} localFolderPaths
31
+ */
32
+ export declare const getInfo: (infoCode: Info | Info[] | undefined, localFolderPaths: string | string[]) => Promise<import("@gdacm/base-types").Info>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ *
3
+ * @param {string|undefined} vid
4
+ * @returns {string|undefined} The Grafana ID (40 characters) or undefined if vid is undefined
5
+ */
6
+ declare const getGrafanaId: (vid: string | undefined) => string | undefined;
7
+ /**
8
+ * @param {string} input
9
+ * @returns {string} The slugified version of the input
10
+ */
11
+ declare const getSlug: (input: string) => string;
12
+ /**
13
+ * @param {String} str
14
+ * @returns {String}
15
+ */
16
+ declare const getFirstEmoji: (str: string) => string;
17
+ /**
18
+ * @param {string} str
19
+ * @param {string} newEmoji
20
+ * @returns {string} The string with the first emoji replaced by the new emoji
21
+ */
22
+ declare const replaceFirstEmojiWithOtherEmoji: (str: string, newEmoji: string) => string;
23
+ /**
24
+ * @param {String} str
25
+ * @param {String} newEmoji
26
+ * @returns {String}
27
+ */
28
+ declare const replaceFirstEmojiWithOtherEmojiOrAddOne: (str: string, newEmoji: string) => string;
29
+ /**
30
+ * @param {String} str
31
+ * @param {String} newEmoji
32
+ * @returns {String}
33
+ */
34
+ declare const addEmojiIfNoEmojiPresent: (str: string, newEmoji: string) => string;
35
+ export { getGrafanaId, getSlug, replaceFirstEmojiWithOtherEmoji, replaceFirstEmojiWithOtherEmojiOrAddOne, addEmojiIfNoEmojiPresent, getFirstEmoji };
@@ -0,0 +1,40 @@
1
+ /**
2
+ *
3
+ * @param {string} dir
4
+ */
5
+ export declare const ensurePathExists: (dir: string) => Promise<void>;
6
+ /**
7
+ * Checks if a file exists.
8
+ *
9
+ * @param {string} filePath
10
+ * @returns {Promise<boolean>} True if the file exists, false otherwise
11
+ */
12
+ export declare const fileExists: (filePath: string) => Promise<boolean>;
13
+ /**
14
+ * Writes a JavaScript object to a YAML file.
15
+ *
16
+ * @param {string} filePath
17
+ * @param {Object} data
18
+ */
19
+ export declare const writeYamlFile: (filePath: string, data: Object) => Promise<void>;
20
+ /**
21
+ * Writes a JavaScript object to a JSON file.
22
+ *
23
+ * @param {string} filePath
24
+ * @param {Object} data
25
+ */
26
+ export declare const writeJsonFile: (filePath: string, data: Object) => Promise<void>;
27
+ /**
28
+ * Read a Yaml file and parse its content into a JavaScript object.
29
+ *
30
+ * @param {string} filePath
31
+ * @returns {Promise<Object|null>} The parsed Yaml object
32
+ */
33
+ export declare const readYamlFile: (filePath: string) => Promise<Object | null>;
34
+ /**
35
+ * Reads a JSON file and parses its content into a JavaScript object.
36
+ *
37
+ * @param {string} filePath
38
+ * @returns {Promise<Object|null>} The parsed JSON object
39
+ */
40
+ export declare const readJsonFile: (filePath: string) => Promise<Object | null>;
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@gdacm/dashboard-manager",
3
+ "version": "0.1.1",
4
+ "author": "gissehel",
5
+ "type": "module",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "license": "MIT",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "clean:local": "rm -rf dist .turbo",
20
+ "dev": "vite build --watch",
21
+ "build:js": "vite build",
22
+ "build:types": "tsc -p tsconfig.types.json",
23
+ "build": "yarn build:js && yarn build:types"
24
+ },
25
+ "dependencies": {
26
+ "@gdacm/base-types": "^0.1.1",
27
+ "@gdacm/grafana-items": "^0.1.1",
28
+ "js-yaml": "^5.2.3"
29
+ },
30
+ "devDependencies": {
31
+ "@types/node": "^26.1.2",
32
+ "typescript": "^7.0.2",
33
+ "vite": "^8.2.0"
34
+ }
35
+ }