@industream/flowmaker-flowbox-ui-components 0.0.16 → 1.0.0
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.
|
@@ -68,6 +68,22 @@
|
|
|
68
68
|
let client: DataCatalogClient | null = null;
|
|
69
69
|
let clientUrl = '';
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Deduplicate entries by id — keep only the first occurrence.
|
|
73
|
+
*/
|
|
74
|
+
function deduplicateEntries(items: CatalogEntry[]): CatalogEntry[] {
|
|
75
|
+
const seen = new Set<string>();
|
|
76
|
+
const result: CatalogEntry[] = [];
|
|
77
|
+
for (const item of items) {
|
|
78
|
+
const id = item.id;
|
|
79
|
+
if (!seen.has(id)) {
|
|
80
|
+
seen.add(id);
|
|
81
|
+
result.push(item);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
function getClient(apiUrl: string): DataCatalogClient {
|
|
72
88
|
if (client && clientUrl === apiUrl) return client;
|
|
73
89
|
client = new DataCatalogClient({ baseUrl: apiUrl });
|
|
@@ -107,14 +123,15 @@
|
|
|
107
123
|
limit: MAX_ENTRIES + 1
|
|
108
124
|
});
|
|
109
125
|
const items = result.items ?? [];
|
|
126
|
+
const uniqueItems = deduplicateEntries(items);
|
|
110
127
|
|
|
111
|
-
if (
|
|
128
|
+
if (uniqueItems.length > MAX_ENTRIES) {
|
|
112
129
|
// Too many — enter server search mode, don't show entries
|
|
113
130
|
tooMany = true;
|
|
114
131
|
entries = [];
|
|
115
132
|
} else {
|
|
116
133
|
tooMany = false;
|
|
117
|
-
entries =
|
|
134
|
+
entries = uniqueItems;
|
|
118
135
|
}
|
|
119
136
|
} catch (err: any) {
|
|
120
137
|
error = err.message ?? 'Failed to load catalog entries';
|
|
@@ -152,7 +169,8 @@
|
|
|
152
169
|
}, abort.signal)
|
|
153
170
|
.then((result) => {
|
|
154
171
|
if (abort.signal.aborted) return;
|
|
155
|
-
|
|
172
|
+
const items = result.items ?? [];
|
|
173
|
+
entries = deduplicateEntries(items);
|
|
156
174
|
searching = false;
|
|
157
175
|
})
|
|
158
176
|
.catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@industream/flowmaker-flowbox-ui-components",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Reusable Svelte components for FlowMaker FlowBox UI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "./dist/index.js",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"svelte": "^5.0.0",
|
|
46
|
-
"@industream/datacatalog-client": "
|
|
46
|
+
"@industream/datacatalog-client": "1.9.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@industream/datacatalog-client": "1.
|
|
49
|
+
"@industream/datacatalog-client": "1.9.0",
|
|
50
50
|
"svelte": "^5.0.0",
|
|
51
51
|
"vite": "^6.0.0",
|
|
52
52
|
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
@@ -68,6 +68,22 @@
|
|
|
68
68
|
let client: DataCatalogClient | null = null;
|
|
69
69
|
let clientUrl = '';
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Deduplicate entries by id — keep only the first occurrence.
|
|
73
|
+
*/
|
|
74
|
+
function deduplicateEntries(items: CatalogEntry[]): CatalogEntry[] {
|
|
75
|
+
const seen = new Set<string>();
|
|
76
|
+
const result: CatalogEntry[] = [];
|
|
77
|
+
for (const item of items) {
|
|
78
|
+
const id = item.id;
|
|
79
|
+
if (!seen.has(id)) {
|
|
80
|
+
seen.add(id);
|
|
81
|
+
result.push(item);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
|
|
71
87
|
function getClient(apiUrl: string): DataCatalogClient {
|
|
72
88
|
if (client && clientUrl === apiUrl) return client;
|
|
73
89
|
client = new DataCatalogClient({ baseUrl: apiUrl });
|
|
@@ -107,14 +123,15 @@
|
|
|
107
123
|
limit: MAX_ENTRIES + 1
|
|
108
124
|
});
|
|
109
125
|
const items = result.items ?? [];
|
|
126
|
+
const uniqueItems = deduplicateEntries(items);
|
|
110
127
|
|
|
111
|
-
if (
|
|
128
|
+
if (uniqueItems.length > MAX_ENTRIES) {
|
|
112
129
|
// Too many — enter server search mode, don't show entries
|
|
113
130
|
tooMany = true;
|
|
114
131
|
entries = [];
|
|
115
132
|
} else {
|
|
116
133
|
tooMany = false;
|
|
117
|
-
entries =
|
|
134
|
+
entries = uniqueItems;
|
|
118
135
|
}
|
|
119
136
|
} catch (err: any) {
|
|
120
137
|
error = err.message ?? 'Failed to load catalog entries';
|
|
@@ -152,7 +169,8 @@
|
|
|
152
169
|
}, abort.signal)
|
|
153
170
|
.then((result) => {
|
|
154
171
|
if (abort.signal.aborted) return;
|
|
155
|
-
|
|
172
|
+
const items = result.items ?? [];
|
|
173
|
+
entries = deduplicateEntries(items);
|
|
156
174
|
searching = false;
|
|
157
175
|
})
|
|
158
176
|
.catch((err) => {
|