@igstack/app-catalog-frontend-core 0.3.1-alpha-20260405015231 → 0.3.1-alpha-20260406011911
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/esm/__tests__/integration/harness/MockBackendVerifier.d.ts +3 -3
- package/dist/esm/__tests__/integration/mock-backend/MockBackendConfigurer.d.ts +4 -4
- package/dist/esm/__tests__/integration/mock-backend/MockDb.d.ts +11 -7
- package/dist/esm/api/infra/trpc.d.ts +3 -3
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.d.ts +2 -3
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js +2 -4
- package/dist/esm/modules/appCatalog/context/AppCatalogContext.js.map +1 -1
- package/dist/esm/modules/appCatalog/hooks/useAppCounts.d.ts +2 -2
- package/dist/esm/modules/appCatalog/hooks/useAppCounts.js +3 -3
- package/dist/esm/modules/appCatalog/hooks/useAppCounts.js.map +1 -1
- package/dist/esm/modules/appCatalog/hooks/useUpdateApp.d.ts +9 -0
- package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/components/AccessRequestSection.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/AppDetailModal.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/components/ScreenshotGallery.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js +12 -14
- package/dist/esm/modules/appCatalog/ui/components/SubResourcesSection.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/components/TierVariantsSection.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/components/TierVariantsSection.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/filters/FilterBar.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/filters/FilterBar.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.d.ts +3 -3
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js +19 -19
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogGrid.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/grid/AppCatalogTable.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/grid/appCatalogUtils.d.ts +2 -2
- package/dist/esm/modules/appCatalog/ui/hooks/useKeyboardNavigation.d.ts +3 -3
- package/dist/esm/modules/appCatalog/ui/hooks/useKeyboardNavigation.js.map +1 -1
- package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js +20 -12
- package/dist/esm/modules/appCatalog/ui/pages/AppCatalogPage.js.map +1 -1
- package/dist/esm/modules/appCatalog/utils/resolveHelpers.d.ts +5 -2
- package/dist/esm/modules/appCatalog/utils/resolveHelpers.js +4 -4
- package/dist/esm/modules/appCatalog/utils/resolveHelpers.js.map +1 -1
- package/dist/esm/modules/appCatalog/utils/searchApps.d.ts +11 -6
- package/dist/esm/modules/appCatalog/utils/searchApps.js +15 -14
- package/dist/esm/modules/appCatalog/utils/searchApps.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/integration/appCatalog.integration.test.ts +3 -3
- package/src/__tests__/integration/harness/MockBackendVerifier.ts +5 -5
- package/src/__tests__/integration/mock-backend/MockBackendConfigurer.ts +16 -12
- package/src/__tests__/integration/mock-backend/MockDb.ts +30 -22
- package/src/__tests__/modules/appCatalog/ScreenshotPreview.test.tsx +4 -5
- package/src/__tests__/modules/appCatalog/utils/searchApps.test.ts +28 -30
- package/src/__tests__/modules/gallery/EscapeDismissal.integration.test.tsx +3 -4
- package/src/modules/appCatalog/context/AppCatalogContext.tsx +4 -8
- package/src/modules/appCatalog/hooks/useAppCounts.ts +5 -5
- package/src/modules/appCatalog/ui/components/AccessRequestSection.tsx +2 -2
- package/src/modules/appCatalog/ui/components/AppDetailModal.tsx +10 -10
- package/src/modules/appCatalog/ui/components/ScreenshotGallery.tsx +2 -2
- package/src/modules/appCatalog/ui/components/SearchAndFilterHeader.tsx +6 -2
- package/src/modules/appCatalog/ui/components/SubResourcesSection.tsx +17 -17
- package/src/modules/appCatalog/ui/components/TierVariantsSection.tsx +2 -2
- package/src/modules/appCatalog/ui/filters/FilterBar.tsx +2 -2
- package/src/modules/appCatalog/ui/grid/AppCatalogGrid.tsx +34 -37
- package/src/modules/appCatalog/ui/grid/AppCatalogTable.tsx +3 -3
- package/src/modules/appCatalog/ui/grid/appCatalogUtils.ts +2 -2
- package/src/modules/appCatalog/ui/hooks/useKeyboardNavigation.ts +3 -3
- package/src/modules/appCatalog/ui/pages/AppCatalogPage.tsx +24 -14
- package/src/modules/appCatalog/utils/resolveHelpers.ts +13 -10
- package/src/modules/appCatalog/utils/searchApps.ts +36 -31
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AppForCatalog,
|
|
3
|
-
SubResource,
|
|
4
|
-
} from '@igstack/app-catalog-backend-core'
|
|
1
|
+
import type { Resource } from '@igstack/app-catalog-backend-core'
|
|
5
2
|
|
|
6
3
|
export interface SearchMatch {
|
|
7
4
|
/** Field where the match occurred */
|
|
@@ -19,12 +16,15 @@ export interface SearchMatch {
|
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
export interface SearchResult {
|
|
22
|
-
app:
|
|
19
|
+
app: Resource
|
|
23
20
|
match: SearchMatch
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
|
-
* Search and sort
|
|
24
|
+
* Search and sort resources by relevance with highlighting support.
|
|
25
|
+
* Only root resources (no parentSlug) are scored and returned.
|
|
26
|
+
* Child resources (with parentSlug) contribute to their parent's score.
|
|
27
|
+
*
|
|
28
28
|
* Priority order:
|
|
29
29
|
* 0. Exact match in abbreviation
|
|
30
30
|
* 1. Exact match in displayName
|
|
@@ -41,19 +41,21 @@ export interface SearchResult {
|
|
|
41
41
|
* 12. Teams
|
|
42
42
|
* 13. Description
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param resources - Array of all resources (root + children)
|
|
45
45
|
* @param searchQuery - Search query string
|
|
46
|
-
* @returns Filtered and sorted array of
|
|
46
|
+
* @returns Filtered and sorted array of root resources
|
|
47
47
|
*/
|
|
48
|
-
export function
|
|
49
|
-
|
|
48
|
+
export function searchResources(
|
|
49
|
+
resources: Resource[],
|
|
50
50
|
searchQuery: string,
|
|
51
|
-
|
|
52
|
-
): AppForCatalog[] {
|
|
51
|
+
): Resource[] {
|
|
53
52
|
const normalizedQuery = searchQuery.trim().toLowerCase()
|
|
54
53
|
|
|
54
|
+
// Separate root resources from children
|
|
55
|
+
const rootResources = resources.filter((r) => !r.parentSlug)
|
|
56
|
+
|
|
55
57
|
if (normalizedQuery === '') {
|
|
56
|
-
return
|
|
58
|
+
return rootResources
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
// Split query into terms for multi-word matching (AND logic)
|
|
@@ -63,18 +65,18 @@ export function searchApps(
|
|
|
63
65
|
const allTermsMatch = (text: string): boolean =>
|
|
64
66
|
queryTerms.every((term) => text.includes(term))
|
|
65
67
|
|
|
66
|
-
// Build
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const list =
|
|
71
|
-
list.push(
|
|
72
|
-
|
|
68
|
+
// Build children lookup: parentSlug -> Resource[]
|
|
69
|
+
const childrenByParent = new Map<string, Resource[]>()
|
|
70
|
+
for (const r of resources) {
|
|
71
|
+
if (r.parentSlug) {
|
|
72
|
+
const list = childrenByParent.get(r.parentSlug) ?? []
|
|
73
|
+
list.push(r)
|
|
74
|
+
childrenByParent.set(r.parentSlug, list)
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
// Filter and score
|
|
77
|
-
const scoredApps =
|
|
78
|
+
// Filter and score root resources
|
|
79
|
+
const scoredApps = rootResources
|
|
78
80
|
.map((app): SearchResult | null => {
|
|
79
81
|
const name = app.displayName.toLowerCase()
|
|
80
82
|
const abbreviation = app.abbreviation?.toLowerCase() || ''
|
|
@@ -143,15 +145,15 @@ export function searchApps(
|
|
|
143
145
|
return { app, match: { field: 'description', type: 'contains' } }
|
|
144
146
|
}
|
|
145
147
|
|
|
146
|
-
// Check
|
|
147
|
-
const
|
|
148
|
-
if (
|
|
149
|
-
const subMatch =
|
|
150
|
-
(
|
|
151
|
-
allTermsMatch(
|
|
152
|
-
|
|
153
|
-
(
|
|
154
|
-
? allTermsMatch(
|
|
148
|
+
// Check child resources (name, aliases, description) — supports multi-word queries
|
|
149
|
+
const children = childrenByParent.get(app.slug)
|
|
150
|
+
if (children) {
|
|
151
|
+
const subMatch = children.some(
|
|
152
|
+
(r) =>
|
|
153
|
+
allTermsMatch(r.displayName.toLowerCase()) ||
|
|
154
|
+
(r.aliases ?? []).some((a) => allTermsMatch(a.toLowerCase())) ||
|
|
155
|
+
(r.description
|
|
156
|
+
? allTermsMatch(r.description.toLowerCase())
|
|
155
157
|
: false),
|
|
156
158
|
)
|
|
157
159
|
if (subMatch) {
|
|
@@ -259,3 +261,6 @@ export function highlightText(
|
|
|
259
261
|
|
|
260
262
|
return segments
|
|
261
263
|
}
|
|
264
|
+
|
|
265
|
+
/** @deprecated Use searchResources instead */
|
|
266
|
+
export const searchApps = searchResources
|