@finos/legend-application-marketplace 0.2.12 → 0.2.13

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 (39) hide show
  1. package/lib/components/MarketplaceCard/FieldSearchResultListItem.d.ts +1 -0
  2. package/lib/components/MarketplaceCard/FieldSearchResultListItem.d.ts.map +1 -1
  3. package/lib/components/MarketplaceCard/FieldSearchResultListItem.js +30 -12
  4. package/lib/components/MarketplaceCard/FieldSearchResultListItem.js.map +1 -1
  5. package/lib/index.css +2 -2
  6. package/lib/index.css.map +1 -1
  7. package/lib/package.json +1 -1
  8. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  9. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +16 -2
  10. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  11. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
  12. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +19 -3
  13. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  14. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
  15. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +23 -4
  16. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  17. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.d.ts.map +1 -1
  18. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.js +29 -23
  19. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.js.map +1 -1
  20. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.d.ts.map +1 -1
  21. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.js +8 -1
  22. package/lib/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.js.map +1 -1
  23. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +1 -0
  24. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  25. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +175 -14
  26. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  27. package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.d.ts +4 -0
  28. package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.d.ts.map +1 -1
  29. package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.js +44 -7
  30. package/lib/stores/lakehouse/fieldSearch/FieldSearchResultState.js.map +1 -1
  31. package/package.json +4 -4
  32. package/src/components/MarketplaceCard/FieldSearchResultListItem.tsx +110 -32
  33. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +25 -3
  34. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +34 -5
  35. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +51 -6
  36. package/src/pages/Lakehouse/searchResults/LegendMarketplaceFieldSearchResults.tsx +100 -25
  37. package/src/pages/Lakehouse/searchResults/LegendMarketplaceSearchResults.tsx +37 -0
  38. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +276 -36
  39. package/src/stores/lakehouse/fieldSearch/FieldSearchResultState.ts +53 -4
@@ -19,6 +19,7 @@ import {
19
19
  type GroupedFieldSearchDataProduct,
20
20
  type GroupedFieldSearchResultEntry,
21
21
  } from '@finos/legend-server-marketplace';
22
+ import { hashArray } from '@finos/legend-shared';
22
23
  import { DataProductTypeFilter } from '../LegendMarketplaceSearchResultsStore.js';
23
24
  import { generateGAVCoordinates } from '@finos/legend-storage';
24
25
  import {
@@ -26,6 +27,15 @@ import {
26
27
  generateLegacyDataProductPath,
27
28
  } from '../../../__lib__/LegendMarketplaceNavigation.js';
28
29
 
30
+ enum FieldSearchResultStateDefaultValue {
31
+ UNKNOWN_FIELD_TYPE = 'Unknown',
32
+ EMPTY_FIELD_DESCRIPTION = '-',
33
+ }
34
+
35
+ enum FieldSearchDataProductKey {
36
+ DISTINCT_SEPARATOR = '|',
37
+ }
38
+
29
39
  const PRODUCT_TYPE_FILTER_MAP: Record<
30
40
  DataProductSearchResultDetailsType,
31
41
  DataProductTypeFilter
@@ -39,6 +49,28 @@ const PRODUCT_TYPE_FILTER_MAP: Record<
39
49
  const getDataProductName = (path: string): string =>
40
50
  path.split('::').at(-1) ?? path;
41
51
 
52
+ const generateFieldSearchResultId = (
53
+ fieldName: string,
54
+ fieldType: string,
55
+ fieldDescription: string,
56
+ ): string => `${hashArray([fieldName, fieldType, fieldDescription])}`;
57
+
58
+ const getDistinctDataProducts = (
59
+ dataProducts: FieldSearchDataProductEntry[],
60
+ ): FieldSearchDataProductEntry[] => {
61
+ const seen = new Set<string>();
62
+ return dataProducts.filter((dp) => {
63
+ // Dedupe primarily by owning data product path. Fallback to a stable
64
+ // composite key only when path is unavailable.
65
+ const dedupeKey = dp.path || dp.distinctKey;
66
+ if (seen.has(dedupeKey)) {
67
+ return false;
68
+ }
69
+ seen.add(dedupeKey);
70
+ return true;
71
+ });
72
+ };
73
+
42
74
  const getOwningDataProductPath = (
43
75
  dataProduct: GroupedFieldSearchDataProduct,
44
76
  ): string => {
@@ -71,6 +103,8 @@ const getOwningDataProductPath = (
71
103
  export class FieldSearchDataProductEntry {
72
104
  readonly name: string;
73
105
  readonly datasetName: string | undefined;
106
+ readonly datasetDescription: string | undefined;
107
+ readonly executionContextKey: string | undefined;
74
108
  readonly modelPath: string | undefined;
75
109
  readonly path: string;
76
110
  readonly entityPath: string;
@@ -80,6 +114,7 @@ export class FieldSearchDataProductEntry {
80
114
  readonly artifactId: string | undefined;
81
115
  readonly versionId: string | undefined;
82
116
  readonly productType: DataProductTypeFilter | undefined;
117
+ readonly distinctKey: string;
83
118
 
84
119
  constructor(dataProduct: GroupedFieldSearchDataProduct) {
85
120
  const productType = PRODUCT_TYPE_FILTER_MAP[dataProduct.productType];
@@ -87,6 +122,8 @@ export class FieldSearchDataProductEntry {
87
122
 
88
123
  this.name = dataProductName;
89
124
  this.datasetName = dataProduct.datasetName;
125
+ this.datasetDescription = dataProduct.datasetDescription;
126
+ this.executionContextKey = dataProduct.defaultExecutionContext;
90
127
  this.modelPath = dataProduct.modelPath;
91
128
  this.path = getOwningDataProductPath(dataProduct);
92
129
  this.entityPath = dataProduct.path;
@@ -96,6 +133,12 @@ export class FieldSearchDataProductEntry {
96
133
  this.artifactId = dataProduct.artifactId;
97
134
  this.versionId = dataProduct.versionId;
98
135
  this.productType = productType;
136
+ this.distinctKey = [
137
+ this.path,
138
+ this.entityPath,
139
+ this.dataProductId,
140
+ this.name,
141
+ ].join(FieldSearchDataProductKey.DISTINCT_SEPARATOR);
99
142
  }
100
143
  }
101
144
 
@@ -105,18 +148,24 @@ export class FieldSearchResultState {
105
148
  readonly fieldType: string;
106
149
  readonly fieldDescription: string;
107
150
  readonly dataProducts: FieldSearchDataProductEntry[];
151
+ readonly distinctDataProducts: FieldSearchDataProductEntry[];
108
152
 
109
153
  constructor(result: GroupedFieldSearchResultEntry) {
110
154
  this.fieldName = result.fieldName;
111
- this.fieldType = result.fieldType ?? 'Unknown';
112
- this.fieldDescription = result.fieldDescription ?? '-';
113
- this.id = JSON.stringify([
155
+ this.fieldType =
156
+ result.fieldType ?? FieldSearchResultStateDefaultValue.UNKNOWN_FIELD_TYPE;
157
+ this.fieldDescription =
158
+ result.fieldDescription ??
159
+ FieldSearchResultStateDefaultValue.EMPTY_FIELD_DESCRIPTION;
160
+ this.id = generateFieldSearchResultId(
114
161
  this.fieldName,
115
162
  this.fieldType,
116
163
  this.fieldDescription,
117
- ]);
164
+ );
118
165
  this.dataProducts = result.dataProducts.map(
119
166
  (dp) => new FieldSearchDataProductEntry(dp),
120
167
  );
168
+ // Precompute once since dataProducts are immutable after construction.
169
+ this.distinctDataProducts = getDistinctDataProducts(this.dataProducts);
121
170
  }
122
171
  }