@finos/legend-application-marketplace 0.2.23 → 0.2.25

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 (30) hide show
  1. package/lib/components/__test-utils__/TEST_DATA__ContractErrors.d.ts +88 -0
  2. package/lib/components/__test-utils__/TEST_DATA__ContractErrors.d.ts.map +1 -0
  3. package/lib/components/__test-utils__/TEST_DATA__ContractErrors.js +178 -0
  4. package/lib/components/__test-utils__/TEST_DATA__ContractErrors.js.map +1 -0
  5. package/lib/index.css +1 -1
  6. package/lib/package.json +1 -1
  7. package/lib/stores/LegendMarketplaceBaseStore.d.ts +2 -2
  8. package/lib/stores/LegendMarketplaceBaseStore.d.ts.map +1 -1
  9. package/lib/stores/LegendMarketplaceBaseStore.js.map +1 -1
  10. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.d.ts.map +1 -1
  11. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js +3 -3
  12. package/lib/stores/lakehouse/LegendMarketplaceProductViewerStore.js.map +1 -1
  13. package/lib/stores/lakehouse/dataProducts/ProductCardState.js +3 -3
  14. package/lib/stores/lakehouse/dataProducts/ProductCardState.js.map +1 -1
  15. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts +3 -17
  16. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.d.ts.map +1 -1
  17. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js +20 -195
  18. package/lib/stores/lakehouse/entitlements/EntitlementsDashboardState.js.map +1 -1
  19. package/lib/utils/LakehouseUtils.d.ts +1 -2
  20. package/lib/utils/LakehouseUtils.d.ts.map +1 -1
  21. package/lib/utils/LakehouseUtils.js +2 -31
  22. package/lib/utils/LakehouseUtils.js.map +1 -1
  23. package/package.json +8 -8
  24. package/src/components/__test-utils__/TEST_DATA__ContractErrors.ts +252 -0
  25. package/src/stores/LegendMarketplaceBaseStore.ts +1 -1
  26. package/src/stores/lakehouse/LegendMarketplaceProductViewerStore.ts +3 -5
  27. package/src/stores/lakehouse/dataProducts/ProductCardState.ts +3 -3
  28. package/src/stores/lakehouse/entitlements/EntitlementsDashboardState.ts +41 -302
  29. package/src/utils/LakehouseUtils.tsx +1 -80
  30. package/tsconfig.json +1 -0
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {
18
+ type V1_EntitlementsDataProductDetailsResponse,
19
+ type V1_EntitlementsLakehouseEnvironmentType,
20
+ V1_IngestEnvironmentClassification,
21
+ } from '@finos/legend-graph';
22
+ import { type PlainObject } from '@finos/legend-shared';
23
+ import type { IngestDeploymentServerConfig } from '@finos/legend-server-lakehouse';
24
+ import type { StoreProjectData } from '@finos/legend-server-depot';
25
+ import type { StoredFileGeneration } from '@finos/legend-storage';
26
+
27
+ export type LakehouseContractSyncStatusResponseFixture = {
28
+ status: string;
29
+ unsyncedUsers?: { username: string }[];
30
+ unsyncedAccessPoints?: { accessPointName: string }[];
31
+ unsyncedTargetAccounts?: string[];
32
+ };
33
+
34
+ export const buildSyncStatusResponse = (params: {
35
+ status: string;
36
+ unsyncedUsers?: string[];
37
+ unsyncedAccessPoints?: string[];
38
+ unsyncedTargetAccounts?: string[];
39
+ }): LakehouseContractSyncStatusResponseFixture => ({
40
+ status: params.status,
41
+ ...(params.unsyncedUsers
42
+ ? { unsyncedUsers: params.unsyncedUsers.map((u) => ({ username: u })) }
43
+ : {}),
44
+ ...(params.unsyncedAccessPoints
45
+ ? {
46
+ unsyncedAccessPoints: params.unsyncedAccessPoints.map((a) => ({
47
+ accessPointName: a,
48
+ })),
49
+ }
50
+ : {}),
51
+ ...(params.unsyncedTargetAccounts
52
+ ? { unsyncedTargetAccounts: params.unsyncedTargetAccounts }
53
+ : {}),
54
+ });
55
+
56
+ export const mockSyncStatus_fullySynced: LakehouseContractSyncStatusResponseFixture =
57
+ buildSyncStatusResponse({ status: 'FULLY_SYNCED' });
58
+
59
+ export const mockSyncStatus_neverSynced: LakehouseContractSyncStatusResponseFixture =
60
+ buildSyncStatusResponse({ status: 'NEVER_SYNCED' });
61
+
62
+ export const mockSyncStatus_notFullySynced_all: LakehouseContractSyncStatusResponseFixture =
63
+ buildSyncStatusResponse({
64
+ status: 'NOT_FULLY_SYNCED',
65
+ unsyncedUsers: ['user1'],
66
+ unsyncedTargetAccounts: ['targetAccount1'],
67
+ unsyncedAccessPoints: ['accessPoint1'],
68
+ });
69
+
70
+ export const mockDataProductDetailsResponse_adHoc = (params: {
71
+ deploymentId: number;
72
+ resourceId: string;
73
+ envType: V1_EntitlementsLakehouseEnvironmentType;
74
+ }): V1_EntitlementsDataProductDetailsResponse =>
75
+ ({
76
+ dataProducts: [
77
+ {
78
+ id: params.resourceId,
79
+ deploymentId: params.deploymentId,
80
+ title: 'Mock Ad-Hoc Data Product',
81
+ description: 'Ad-hoc deployment for contract-errors tests',
82
+ origin: {
83
+ type: 'AdHocDeployment',
84
+ definition: '',
85
+ },
86
+ lakehouseEnvironment: {
87
+ producerEnvironmentName: 'test-env',
88
+ type: params.envType,
89
+ },
90
+ dataProduct: {
91
+ name: params.resourceId,
92
+ accessPoints: [],
93
+ accessPointGroupStereotypeMappings: [],
94
+ owner: {
95
+ appDirId: 12345,
96
+ level: 'DEPLOYMENT',
97
+ },
98
+ },
99
+ fullPath: `test::${params.resourceId}`,
100
+ },
101
+ ],
102
+ }) as unknown as V1_EntitlementsDataProductDetailsResponse;
103
+
104
+ export const TEST_APG_ID = 'GROUP1';
105
+ export const TEST_DP_NAME = 'MyDataProduct';
106
+ export const TEST_GAV = {
107
+ groupId: 'com.example',
108
+ artifactId: 'my-data-product',
109
+ versionId: '1.0.0',
110
+ };
111
+ export const TEST_FULL_PATH = `test::${TEST_DP_NAME}`;
112
+
113
+ export const mockDataProductDetailsResponse_sdlc = (params: {
114
+ deploymentId: number;
115
+ resourceId: string;
116
+ envType: V1_EntitlementsLakehouseEnvironmentType;
117
+ }): V1_EntitlementsDataProductDetailsResponse =>
118
+ ({
119
+ dataProducts: [
120
+ {
121
+ id: params.resourceId,
122
+ deploymentId: params.deploymentId,
123
+ title: 'Mock SDLC Data Product',
124
+ description: 'SDLC deployment for contract-errors tests',
125
+ origin: {
126
+ type: 'SdlcDeployment',
127
+ group: TEST_GAV.groupId,
128
+ artifact: TEST_GAV.artifactId,
129
+ version: TEST_GAV.versionId,
130
+ },
131
+ lakehouseEnvironment: {
132
+ producerEnvironmentName: 'test-env',
133
+ type: params.envType,
134
+ },
135
+ dataProduct: {
136
+ name: TEST_DP_NAME,
137
+ accessPoints: [],
138
+ accessPointGroupStereotypeMappings: [],
139
+ owner: {
140
+ appDirId: 12345,
141
+ level: 'DEPLOYMENT',
142
+ },
143
+ },
144
+ fullPath: TEST_FULL_PATH,
145
+ },
146
+ ],
147
+ }) as unknown as V1_EntitlementsDataProductDetailsResponse;
148
+
149
+ export type ArtifactDatasetSpec = {
150
+ ingestPath: string;
151
+ producer:
152
+ | { kind: 'appDir'; appDirId: number }
153
+ | { kind: 'kerberos'; kerberos: string };
154
+ datasetName: string;
155
+ };
156
+
157
+ export type ArtifactAccessPointImplSpec = {
158
+ id: string;
159
+ datasets: ArtifactDatasetSpec[];
160
+ dependencyAccessPoints?: {
161
+ dataProductId: string;
162
+ accessPointId: string;
163
+ }[];
164
+ };
165
+
166
+ const buildDatasetJson = (spec: ArtifactDatasetSpec): PlainObject => ({
167
+ ingestDefinition: {
168
+ path: spec.ingestPath,
169
+ producer:
170
+ spec.producer.kind === 'appDir'
171
+ ? { _type: 'AppDir', appDirId: spec.producer.appDirId }
172
+ : { _type: 'Kerberos', kerberos: spec.producer.kerberos },
173
+ },
174
+ dataset: spec.datasetName,
175
+ });
176
+
177
+ export const buildModernAccessPointImpl = (
178
+ spec: ArtifactAccessPointImplSpec,
179
+ ): PlainObject => ({
180
+ id: spec.id,
181
+ resourceBuilder: {
182
+ _type: 'databaseDDL',
183
+ reproducible: true,
184
+ targetEnvironment: 'prod',
185
+ script: '',
186
+ resourceType: 'TABLE',
187
+ },
188
+ dependencyDatasets: spec.datasets.map(buildDatasetJson),
189
+ dependencyAccessPoints: (spec.dependencyAccessPoints ?? []).map((dep) => ({
190
+ dataProductId: dep.dataProductId,
191
+ accessPointId: dep.accessPointId,
192
+ production: true,
193
+ })),
194
+ });
195
+
196
+ export const buildDataProductArtifactJson = (params: {
197
+ accessPointImpls: PlainObject[];
198
+ }): string =>
199
+ JSON.stringify({
200
+ dataProduct: {
201
+ path: TEST_FULL_PATH,
202
+ deploymentId: String(11111),
203
+ },
204
+ accessPointGroups: [
205
+ {
206
+ id: TEST_APG_ID,
207
+ accessPointImplementations: params.accessPointImpls,
208
+ },
209
+ ],
210
+ });
211
+
212
+ export const mockStoreProjectData: PlainObject<StoreProjectData> = {
213
+ projectId: 'test-project-id',
214
+ groupId: TEST_GAV.groupId,
215
+ artifactId: TEST_GAV.artifactId,
216
+ };
217
+
218
+ export const buildGenerationFilesResponse = (params: {
219
+ artifactJson: string;
220
+ }): PlainObject<StoredFileGeneration>[] => [
221
+ {
222
+ groupId: TEST_GAV.groupId,
223
+ artifactId: TEST_GAV.artifactId,
224
+ versionId: TEST_GAV.versionId,
225
+ type: 'dataProduct',
226
+ path: TEST_FULL_PATH,
227
+ file: {
228
+ path: TEST_FULL_PATH,
229
+ content: params.artifactJson,
230
+ },
231
+ },
232
+ ];
233
+
234
+ export const buildMockIngestEnvConfig = (
235
+ classification: V1_IngestEnvironmentClassification = V1_IngestEnvironmentClassification.PROD,
236
+ ): PlainObject<IngestDeploymentServerConfig> => ({
237
+ ingestEnvironmentUrn: `test-${classification}-urn`,
238
+ environmentClassification: classification,
239
+ ingestServerUrl: `https://test-${classification}-ingest-server.com`,
240
+ });
241
+
242
+ export const mockProducerEnvironment: PlainObject = {
243
+ producerEnvironmentUrn: 'urn:lakehouse:prod:producer:deployment:11111',
244
+ };
245
+
246
+ export const TEST_SERVER_URNS: string[] = [
247
+ 'urn:lakehouse:prod:ingest:definition:alloy-git:com.example~my-data-product~com.example::IngestA',
248
+ 'urn:lakehouse:prod:ingest:definition:alloy-git:other.group~other-artifact~com.example::IngestLoose',
249
+ 'urn:lakehouse:prod:ingest:definition:rest-api:svc-acct~com.example::IngestK',
250
+ 'urn:lakehouse:prod-parallel:ingest:definition:alloy-git:com.example~my-data-product~com.example::IngestA',
251
+ 'urn:lakehouse:non-prod:ingest:definition:alloy-git:com.example~my-data-product~com.example::IngestA',
252
+ ];
@@ -268,7 +268,7 @@ export class LegendMarketplaceBaseStore {
268
268
  return vendorImageMap;
269
269
  }
270
270
 
271
- private async createInitializedGraphManager(): Promise<V1_PureGraphManager> {
271
+ async createInitializedGraphManager(): Promise<V1_PureGraphManager> {
272
272
  const graphManager = new V1_PureGraphManager(
273
273
  this.applicationStore.pluginManager,
274
274
  this.applicationStore.logService,
@@ -59,10 +59,7 @@ import {
59
59
  V1_SdlcDeploymentDataProductOrigin,
60
60
  V1_TerminalModelSchema,
61
61
  } from '@finos/legend-graph';
62
- import {
63
- buildGraphForDataProduct,
64
- getDataProductFromDetails,
65
- } from '../../utils/LakehouseUtils.js';
62
+ import { buildGraphForDataProduct } from '../../utils/LakehouseUtils.js';
66
63
  import {
67
64
  type Entity,
68
65
  type StoredFileGeneration,
@@ -95,6 +92,7 @@ import {
95
92
  TerminalProductLayoutState,
96
93
  TerminalProductViewerState,
97
94
  DATAPRODUCT_TYPE,
95
+ getDataProductFromDetails,
98
96
  } from '@finos/legend-extension-dsl-data-product';
99
97
  import { LegendMarketplaceTelemetryHelper } from '../../__lib__/LegendMarketplaceTelemetryHelper.js';
100
98
 
@@ -281,7 +279,7 @@ export class LegendMarketplaceProductViewerStore {
281
279
  yield getDataProductFromDetails(
282
280
  entitlementsDataProductDetails,
283
281
  graphManager,
284
- this.marketplaceBaseStore,
282
+ this.marketplaceBaseStore.depotServerClient,
285
283
  ),
286
284
  V1_DataProduct,
287
285
  `Unable to get V1_DataProduct from details for id: ${entitlementsDataProductDetails.id}`,
@@ -45,7 +45,7 @@ import {
45
45
  type PlainObject,
46
46
  } from '@finos/legend-shared';
47
47
  import { LEGEND_MARKETPLACE_APP_EVENT } from '../../../__lib__/LegendMarketplaceAppEvent.js';
48
- import { getDataProductFromDetails } from '../../../utils/LakehouseUtils.js';
48
+ import { getDataProductFromDetails } from '@finos/legend-extension-dsl-data-product';
49
49
  import type { IngestDeploymentServerConfig } from '@finos/legend-server-lakehouse';
50
50
 
51
51
  export const MAX_PRODUCT_IMAGE_COUNT = 15;
@@ -281,7 +281,7 @@ export class ProductCardState {
281
281
  const v1_dataProduct = await getDataProductFromDetails(
282
282
  entitlementsDataProductDetails,
283
283
  this.graphManager,
284
- this.marketplaceBaseStore,
284
+ this.marketplaceBaseStore.depotServerClient,
285
285
  );
286
286
 
287
287
  return v1_dataProduct;
@@ -305,7 +305,7 @@ export class ProductCardState {
305
305
  const v1_dataProduct = await getDataProductFromDetails(
306
306
  entitlementsDataProductDetails,
307
307
  this.graphManager,
308
- this.marketplaceBaseStore,
308
+ this.marketplaceBaseStore.depotServerClient,
309
309
  );
310
310
 
311
311
  return v1_dataProduct;