@iqworksai/common-components 0.1.4 → 0.1.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.
@@ -0,0 +1,58 @@
1
+ import { SelectOption } from '../components/MultiSelect';
2
+
3
+ /**
4
+ * Minimal ScanObject type for DbSchemaBrowser
5
+ */
6
+ export interface ScanObject {
7
+ id: number;
8
+ uuid: string;
9
+ scan_id: number;
10
+ object_type?: 'file' | 'folder' | 'table';
11
+ object_name: string;
12
+ source: string;
13
+ created_at: string;
14
+ updated_at: string;
15
+ scan_object_metadata: Array<{
16
+ metadata_key: string;
17
+ metadata_value: any;
18
+ }>;
19
+ [key: string]: any;
20
+ }
21
+ /**
22
+ * Minimal Metadata type
23
+ */
24
+ export interface Metadata {
25
+ id?: number;
26
+ uuid?: string;
27
+ metadata_key: string;
28
+ metadata_value: string | any;
29
+ [key: string]: any;
30
+ }
31
+ /**
32
+ * Converts a ScanObject to database schema format
33
+ */
34
+ export declare function convertScanObjectToDbSchema(input: ScanObject, attributeMapping: Record<string, Record<string, SelectOption>>, skipDbInTableKey?: boolean, forceDefaultName?: string): {
35
+ result: any;
36
+ skipDbName: boolean;
37
+ };
38
+ /**
39
+ * Extracts and parses the attribute_mapping metadata value from the given array of metadata entries.
40
+ *
41
+ * @param metadataArray - Array of metadata entries, where each entry is an object with 'metadata_key' and
42
+ * 'metadata_value' properties.
43
+ * @returns A Record<string, Record<string, SelectOption>> object containing the parsed attribute mapping. If
44
+ * the metadata value is not a string, or the parse fails, an empty object is returned.
45
+ */
46
+ export declare function extractAttributeMapping(metadataArray: Metadata[]): Record<string, Record<string, SelectOption>>;
47
+ /**
48
+ * Extracts and parses the confidence_metadata metadata value from the given array of metadata entries.
49
+ *
50
+ * @param metadataArray - Array of metadata entries
51
+ * @returns A Record<string, Record<string, any>> object containing the parsed confidence metadata
52
+ */
53
+ export declare function extractConfidenceMetadata(metadataArray: Metadata[]): Record<string, Record<string, any>>;
54
+ /**
55
+ * Gets the confidence color class based on score
56
+ */
57
+ export declare const getConfidenceColor: (score: number) => "bg-green-600" | "bg-yellow-600" | "bg-red-600";
58
+ //# sourceMappingURL=dbSchemaBrowserUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dbSchemaBrowserUtils.d.ts","sourceRoot":"","sources":["../../src/utils/dbSchemaBrowserUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAC3E,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,GAAG,GAAG,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAiCD;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,UAAU,EACjB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAC9D,gBAAgB,GAAE,OAAe,EACjC,gBAAgB,GAAE,MAAW;;;EAwE9B;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAmB/G;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,aAAa,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAmBxG;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,oDAI/C,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Capitalizes the first letter of each word in a given string.
3
+ *
4
+ * @param str - The input string to be processed.
5
+ * @returns A new string with the first letter of each word capitalized.
6
+ */
7
+ export declare function ucwords(str?: string): string;
8
+ /**
9
+ * Formats a given date input into two different formats:
10
+ * 1. A formatted string based on a provided format or a default locale-based format.
11
+ * 2. A human-readable date format like "24 Mar 25 03:53 PM".
12
+ *
13
+ * If the provided date is the same as the function's execution day, both formats will return only the time in "HH:MM" format.
14
+ *
15
+ * The function also converts UTC time to the local timezone before formatting.
16
+ *
17
+ * @param {string | number} input - The date input which can be a Unix timestamp (in seconds) or a date string.
18
+ * @param {string} [format] - An optional format string using "YYYY", "MM", "DD", "HH", "mm", "ss" placeholders.
19
+ * @returns {{ formatted: string; readableDate: string }} - An object containing both the formatted date and the readable date.
20
+ */
21
+ export declare function formatDateTime(input: string | number, format?: string): {
22
+ formatted: string;
23
+ readableDate: string;
24
+ };
25
+ /**
26
+ * Checks if a child path is a subdirectory of a parent path.
27
+ *
28
+ * @param parent - The parent path
29
+ * @param child - The child path to check
30
+ * @returns True if child is a subdirectory of parent
31
+ */
32
+ export declare const isChildPath: (parent: string, child: string) => boolean;
33
+ /**
34
+ * Minimal ScanObject type for FileBrowser
35
+ */
36
+ export interface ScanObject {
37
+ id: number;
38
+ uuid: string;
39
+ scan_id: number;
40
+ object_type?: 'file' | 'folder' | 'table';
41
+ object_name?: string;
42
+ name?: string;
43
+ fullPath?: string;
44
+ parentPath?: string;
45
+ scan_object_metadata?: Array<{
46
+ metadata_key: string;
47
+ metadata_value: any;
48
+ }>;
49
+ [key: string]: any;
50
+ }
51
+ /**
52
+ * Converts a ScanObject to FileMetadata format
53
+ */
54
+ export declare function convertScanObjectToFiledata(scanObject: ScanObject): {
55
+ absolute_path: string | undefined;
56
+ fullPath: string | undefined;
57
+ parentPath: string;
58
+ object_type: undefined;
59
+ object_name: undefined;
60
+ scan_object_metadata: undefined;
61
+ scan_object_results: undefined;
62
+ id: number;
63
+ uuid: string;
64
+ scan_id: number;
65
+ name?: string;
66
+ };
67
+ //# sourceMappingURL=fileBrowserUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileBrowserUtils.d.ts","sourceRoot":"","sources":["../../src/utils/fileBrowserUtils.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAK5C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CA2EnH;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,OAM3D,CAAC;AAqBF;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,KAAK,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAC5E,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,UAAU,EAAE,UAAU;;;;;;;;QAf5D,MAAM;UACJ,MAAM;aACH,MAAM;WAGR,MAAM;EAsBd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iqworksai/common-components",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A reusable React component library and utilities package for IQWorks applications. Provides 46+ UI components, custom hooks, context providers, and utility functions extracted from DiscoverIQ Desktop.",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
@@ -80,10 +80,13 @@
80
80
  "chartjs-plugin-datalabels": "^2.2.0",
81
81
  "chartjs-plugin-zoom": "^2.2.0",
82
82
  "dayjs": "^1.11.19",
83
+ "jquery": "^3.7.1",
84
+ "jstree": "^3.3.16",
83
85
  "papaparse": "^5.5.2",
84
86
  "react-chartjs-2": "^5.3.0",
85
87
  "react-icons": "^5.4.0",
86
- "react-select": "^5.9.0"
88
+ "react-select": "^5.9.0",
89
+ "reactflow": "^11.11.4"
87
90
  },
88
91
  "devDependencies": {
89
92
  "@reduxjs/toolkit": "^2.11.2",
@@ -104,6 +107,8 @@
104
107
  "@testing-library/jest-dom": "^6.6.3",
105
108
  "@testing-library/react": "^16.3.0",
106
109
  "@testing-library/user-event": "^14.6.1",
110
+ "@types/jquery": "^3.5.33",
111
+ "@types/jstree": "^3.3.16",
107
112
  "@types/node": "^20.14.8",
108
113
  "@types/papaparse": "^5.5.2",
109
114
  "@types/react": "^18.3.18",