@finos/legend-application-marketplace 0.2.26 → 0.2.27

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 (46) hide show
  1. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts +2 -2
  2. package/lib/__lib__/LegendMarketplaceTelemetryHelper.d.ts.map +1 -1
  3. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js +2 -2
  4. package/lib/__lib__/LegendMarketplaceTelemetryHelper.js.map +1 -1
  5. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.d.ts.map +1 -1
  6. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.js +11 -6
  7. package/lib/components/__test-utils__/LegendMarketplaceStoreTestUtils.js.map +1 -1
  8. package/lib/index.css +2 -2
  9. package/lib/index.css.map +1 -1
  10. package/lib/package.json +1 -1
  11. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.d.ts.map +1 -1
  12. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js +10 -7
  13. package/lib/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.js.map +1 -1
  14. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.d.ts.map +1 -1
  15. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js +3 -2
  16. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.js.map +1 -1
  17. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts +1 -1
  18. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.d.ts.map +1 -1
  19. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js +67 -38
  20. package/lib/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.js.map +1 -1
  21. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts +1 -2
  22. package/lib/stores/ai/LegendMarketplaceAIChatStore.d.ts.map +1 -1
  23. package/lib/stores/ai/LegendMarketplaceAIChatStore.js +12 -8
  24. package/lib/stores/ai/LegendMarketplaceAIChatStore.js.map +1 -1
  25. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +39 -15
  26. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  27. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +324 -39
  28. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  29. package/lib/utils/EntitlementsUtils.d.ts +2 -2
  30. package/lib/utils/EntitlementsUtils.d.ts.map +1 -1
  31. package/lib/utils/EntitlementsUtils.js +11 -2
  32. package/lib/utils/EntitlementsUtils.js.map +1 -1
  33. package/lib/utils/LakehouseUtils.d.ts +2 -1
  34. package/lib/utils/LakehouseUtils.d.ts.map +1 -1
  35. package/lib/utils/LakehouseUtils.js +31 -2
  36. package/lib/utils/LakehouseUtils.js.map +1 -1
  37. package/package.json +8 -8
  38. package/src/__lib__/LegendMarketplaceTelemetryHelper.ts +6 -6
  39. package/src/components/__test-utils__/LegendMarketplaceStoreTestUtils.tsx +20 -8
  40. package/src/pages/Lakehouse/entitlements/EntitlementsClosedContractsDashboard.tsx +13 -5
  41. package/src/pages/Lakehouse/entitlements/EntitlementsPendingContractsDashboard.tsx +5 -1
  42. package/src/pages/Lakehouse/entitlements/EntitlementsPendingTasksDashboard.tsx +306 -299
  43. package/src/stores/ai/LegendMarketplaceAIChatStore.ts +14 -9
  44. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +538 -91
  45. package/src/utils/EntitlementsUtils.tsx +13 -2
  46. package/src/utils/LakehouseUtils.tsx +80 -1
@@ -25,6 +25,7 @@ import {
25
25
  } from '@finos/legend-extension-dsl-data-product';
26
26
  import {
27
27
  GraphManagerState,
28
+ V1_LiteDataContract,
28
29
  V1_LiteDataContractWithUserStatus,
29
30
  V1_ResourceType,
30
31
  V1_AccessPointGroupReference,
@@ -104,8 +105,15 @@ export type EntitlementsRow =
104
105
  }
105
106
  | { kind: 'request'; data: V1_DataRequestWithWorkflow };
106
107
 
107
- export const getContractData = (row: EntitlementsRow) =>
108
- row.kind === ROW_KIND_CONTRACT ? row.data.contractResultLite : undefined;
108
+ export const getContractData = (
109
+ row: EntitlementsRow,
110
+ ): V1_LiteDataContract | undefined => {
111
+ if (row.kind === ROW_KIND_CONTRACT) {
112
+ const lite = row.data.contractResultLite;
113
+ return lite instanceof V1_LiteDataContract ? lite : undefined;
114
+ }
115
+ return undefined;
116
+ };
109
117
 
110
118
  export const getRequestData = (row: EntitlementsRow) =>
111
119
  row.kind === ROW_KIND_REQUEST ? row.data.dataRequest : undefined;
@@ -402,6 +410,9 @@ export const useSelectedViewerState = (
402
410
  }
403
411
  if (selectedRow.kind === ROW_KIND_CONTRACT) {
404
412
  const contract = selectedRow.data.contractResultLite;
413
+ if (!(contract instanceof V1_LiteDataContract)) {
414
+ return undefined;
415
+ }
405
416
  return new DataContractViewerState(
406
417
  contract,
407
418
  (contractId: string, taskId: string) =>
@@ -18,15 +18,23 @@ import {
18
18
  type GraphManagerState,
19
19
  type V1_EntitlementsDataProductDetails,
20
20
  type V1_PureGraphManager,
21
+ type V1_DataProduct,
21
22
  V1_AdHocDeploymentDataProductOrigin,
23
+ V1_dataProductModelSchema,
22
24
  V1_SdlcDeploymentDataProductOrigin,
25
+ CORE_PURE_PATH,
23
26
  } from '@finos/legend-graph';
24
- import { ActionState, type PlainObject } from '@finos/legend-shared';
27
+ import {
28
+ ActionState,
29
+ guaranteeNonNullable,
30
+ type PlainObject,
31
+ } from '@finos/legend-shared';
25
32
  import {
26
33
  type ProjectVersionEntities,
27
34
  resolveVersion,
28
35
  } from '@finos/legend-server-depot';
29
36
  import type { Entity } from '@finos/legend-storage';
37
+ import { deserialize } from 'serializr';
30
38
  import type { LegendMarketplaceBaseStore } from '../stores/LegendMarketplaceBaseStore.js';
31
39
 
32
40
  export const buildGraphForDataProduct = async (
@@ -69,3 +77,74 @@ export const buildGraphForDataProduct = async (
69
77
  );
70
78
  }
71
79
  };
80
+
81
+ export const getDataProductFromDetails = async (
82
+ details: V1_EntitlementsDataProductDetails,
83
+ graphManager: V1_PureGraphManager,
84
+ marketplaceBaseStore: LegendMarketplaceBaseStore,
85
+ ): Promise<V1_DataProduct | undefined> => {
86
+ if (details.origin instanceof V1_SdlcDeploymentDataProductOrigin) {
87
+ const rawEntities =
88
+ (await marketplaceBaseStore.depotServerClient.getVersionEntities(
89
+ details.origin.group,
90
+ details.origin.artifact,
91
+ resolveVersion(details.origin.version),
92
+ CORE_PURE_PATH.DATA_PRODUCT,
93
+ )) as {
94
+ artifactId: string;
95
+ entity: Entity;
96
+ groupId: string;
97
+ versionId: string;
98
+ versionedEntity: boolean;
99
+ }[];
100
+ const entities = rawEntities.map((entity) =>
101
+ deserialize(
102
+ V1_dataProductModelSchema(
103
+ graphManager.pluginManager.getPureProtocolProcessorPlugins(),
104
+ ),
105
+ entity.entity.content,
106
+ ),
107
+ );
108
+ const matchingEntities = entities.filter(
109
+ (entity) => entity.name.toLowerCase() === details.id.toLowerCase(),
110
+ );
111
+ if (matchingEntities.length === 0) {
112
+ throw new Error(
113
+ `No data product found with name ${details.id} in project`,
114
+ );
115
+ } else if (matchingEntities.length > 1) {
116
+ throw new Error(
117
+ `Multiple data products found with name ${details.id} in project`,
118
+ );
119
+ }
120
+ return matchingEntities[0];
121
+ } else if (details.origin instanceof V1_AdHocDeploymentDataProductOrigin) {
122
+ const entities: Entity[] = await graphManager.pureCodeToEntities(
123
+ details.origin.definition,
124
+ );
125
+ const elements = entities
126
+ .filter((e) => e.classifierPath === CORE_PURE_PATH.DATA_PRODUCT)
127
+ .map((entity) =>
128
+ deserialize(
129
+ V1_dataProductModelSchema(
130
+ graphManager.pluginManager.getPureProtocolProcessorPlugins(),
131
+ ),
132
+ entity.content,
133
+ ),
134
+ );
135
+ const matchingEntities = elements.filter(
136
+ (element) => element.name.toLowerCase() === details.id.toLowerCase(),
137
+ );
138
+ if (matchingEntities.length > 1) {
139
+ throw new Error(
140
+ `Multiple data products found with name ${details.id} in deployed definition`,
141
+ );
142
+ }
143
+ return guaranteeNonNullable(
144
+ matchingEntities[0],
145
+ `No data product found with name ${details.id} in deployed definition`,
146
+ );
147
+ } else {
148
+ return undefined;
149
+ }
150
+ };