@finos/legend-graph 32.3.34 → 32.3.36

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.
@@ -57,9 +57,16 @@ export enum V1_ResourceBuilderType {
57
57
  FUNCTION_ACCESS_POINT = 'functionAccessPoint',
58
58
  }
59
59
 
60
- export enum V1_SampleQueryType {
61
- IN_LINE_SAMPLE_QUERY = 'inLineSampleQuery',
62
- PACKAGEABLE_ELEMENT_SAMPLE_QUERY = 'packageableElementSampleQuery',
60
+ export enum V1_ExecutableInfoType {
61
+ TEMPLATE = 'templateExecutableInfo',
62
+ FUNCTION_POINTER = 'functionPointerExecutableInfo',
63
+ SERVICE = 'service',
64
+ MULTI_EXECUTION_SERVICE = 'multiExecutionService',
65
+ }
66
+
67
+ export enum V1_ExecutableResultType {
68
+ TDS = 'tds',
69
+ RELATION = 'relation',
63
70
  }
64
71
 
65
72
  export enum V1_DatabaseDDLImplementationType {
@@ -280,14 +287,14 @@ export class V1_MappingGenerationInfo {
280
287
  export class V1_NativeModelExecutionContextInfo {
281
288
  key!: string;
282
289
  mapping!: string;
283
- runtime?: V1_RuntimeGenerationInfo | undefined;
290
+ runtimeGeneration?: V1_RuntimeGenerationInfo | undefined;
284
291
  datasets: V1_DatasetSpecification[] = [];
285
292
 
286
293
  static readonly serialization = new SerializationFactory(
287
294
  createModelSchema(V1_NativeModelExecutionContextInfo, {
288
295
  key: primitive(),
289
296
  mapping: primitive(),
290
- runtime: optionalCustomUsingModelSchema(
297
+ runtimeGeneration: optionalCustomUsingModelSchema(
291
298
  V1_RuntimeGenerationInfo.serialization.schema,
292
299
  ),
293
300
  datasets: list(
@@ -297,63 +304,223 @@ export class V1_NativeModelExecutionContextInfo {
297
304
  );
298
305
  }
299
306
 
300
- export abstract class V1_SampleQueryInfo {
301
- id!: string;
302
- title!: string;
303
- description?: string;
304
- executionContextKey!: string;
307
+ export abstract class V1_ExecutableInfo {
308
+ id?: string | undefined;
309
+ executionContextKey?: string | undefined;
310
+ query!: string;
311
+ }
312
+
313
+ export class V1_TemplateExecutableInfo extends V1_ExecutableInfo {
314
+ static readonly serialization = new SerializationFactory(
315
+ createModelSchema(V1_TemplateExecutableInfo, {
316
+ _type: usingConstantValueSchema(V1_ExecutableInfoType.TEMPLATE),
317
+ id: optional(primitive()),
318
+ executionContextKey: optional(primitive()),
319
+ query: primitive(),
320
+ }),
321
+ );
305
322
  }
306
323
 
307
- export class V1_InLineSampleQueryInfo extends V1_SampleQueryInfo {
308
- queryGrammar!: string;
324
+ export class V1_FunctionPointerExecutableInfo extends V1_ExecutableInfo {
325
+ function!: string;
309
326
 
310
327
  static readonly serialization = new SerializationFactory(
311
- createModelSchema(V1_InLineSampleQueryInfo, {
312
- _type: usingConstantValueSchema(V1_SampleQueryType.IN_LINE_SAMPLE_QUERY),
313
- id: primitive(),
314
- title: primitive(),
315
- description: optional(primitive()),
316
- queryGrammar: primitive(),
317
- executionContextKey: primitive(),
328
+ createModelSchema(V1_FunctionPointerExecutableInfo, {
329
+ _type: usingConstantValueSchema(V1_ExecutableInfoType.FUNCTION_POINTER),
330
+ id: optional(primitive()),
331
+ executionContextKey: optional(primitive()),
332
+ function: primitive(),
333
+ query: primitive(),
334
+ }),
335
+ );
336
+ }
337
+
338
+ export class V1_ServiceExecutableInfo extends V1_ExecutableInfo {
339
+ pattern!: string;
340
+ mapping?: string | undefined;
341
+ runtime?: string | undefined;
342
+ datasets: V1_DatasetSpecification[] = [];
343
+
344
+ static readonly serialization = new SerializationFactory(
345
+ createModelSchema(V1_ServiceExecutableInfo, {
346
+ _type: usingConstantValueSchema(V1_ExecutableInfoType.SERVICE),
347
+ id: optional(primitive()),
348
+ executionContextKey: optional(primitive()),
349
+ datasets: list(
350
+ usingModelSchema(V1_DatasetSpecification.serialization.schema),
351
+ ),
352
+ mapping: optional(primitive()),
353
+ pattern: primitive(),
354
+ query: primitive(),
355
+ runtime: optional(primitive()),
356
+ }),
357
+ );
358
+ }
359
+
360
+ export class V1_MultiExecutionServiceKeyedExecutableInfo {
361
+ key!: string;
362
+ mapping?: string | undefined;
363
+ runtime?: string | undefined;
364
+ datasets: V1_DatasetSpecification[] = [];
365
+
366
+ static readonly serialization = new SerializationFactory(
367
+ createModelSchema(V1_MultiExecutionServiceKeyedExecutableInfo, {
368
+ key: primitive(),
369
+ mapping: optional(primitive()),
370
+ runtime: optional(primitive()),
371
+ datasets: list(
372
+ usingModelSchema(V1_DatasetSpecification.serialization.schema),
373
+ ),
318
374
  }),
319
375
  );
320
376
  }
321
377
 
322
- export class V1_PackageableElementSampleQueryInfo extends V1_SampleQueryInfo {
323
- queryPath!: string;
378
+ export class V1_MultiExecutionServiceExecutableInfo extends V1_ExecutableInfo {
379
+ pattern!: string;
380
+ keyedExecutableInfos: V1_MultiExecutionServiceKeyedExecutableInfo[] = [];
324
381
 
325
382
  static readonly serialization = new SerializationFactory(
326
- createModelSchema(V1_PackageableElementSampleQueryInfo, {
383
+ createModelSchema(V1_MultiExecutionServiceExecutableInfo, {
327
384
  _type: usingConstantValueSchema(
328
- V1_SampleQueryType.PACKAGEABLE_ELEMENT_SAMPLE_QUERY,
385
+ V1_ExecutableInfoType.MULTI_EXECUTION_SERVICE,
329
386
  ),
330
- id: primitive(),
331
- title: primitive(),
332
- description: optional(primitive()),
333
- queryPath: primitive(),
334
- executionContextKey: primitive(),
387
+ id: optional(primitive()),
388
+ executionContextKey: optional(primitive()),
389
+ keyedExecutableInfos: list(
390
+ usingModelSchema(
391
+ V1_MultiExecutionServiceKeyedExecutableInfo.serialization.schema,
392
+ ),
393
+ ),
394
+ pattern: primitive(),
395
+ query: primitive(),
335
396
  }),
336
397
  );
337
398
  }
338
399
 
339
- const V1_deserializeSampleQuery = (
340
- json: PlainObject<V1_SampleQueryInfo>,
341
- ): V1_SampleQueryInfo => {
400
+ const V1_deserializeExecutableInfo = (
401
+ json: PlainObject<V1_ExecutableInfo>,
402
+ ): V1_ExecutableInfo => {
342
403
  switch (json._type) {
343
- case V1_SampleQueryType.IN_LINE_SAMPLE_QUERY:
344
- return deserialize(V1_InLineSampleQueryInfo.serialization.schema, json);
345
- case V1_SampleQueryType.PACKAGEABLE_ELEMENT_SAMPLE_QUERY:
346
- return deserialize(
347
- V1_PackageableElementSampleQueryInfo.serialization.schema,
404
+ case V1_ExecutableInfoType.TEMPLATE:
405
+ return V1_TemplateExecutableInfo.serialization.fromJson(json);
406
+ case V1_ExecutableInfoType.FUNCTION_POINTER:
407
+ return V1_FunctionPointerExecutableInfo.serialization.fromJson(json);
408
+ case V1_ExecutableInfoType.SERVICE:
409
+ return V1_ServiceExecutableInfo.serialization.fromJson(json);
410
+ case V1_ExecutableInfoType.MULTI_EXECUTION_SERVICE:
411
+ return V1_MultiExecutionServiceExecutableInfo.serialization.fromJson(
348
412
  json,
349
413
  );
350
414
  default:
351
415
  throw new UnsupportedOperationError(
352
- `Can't deserialize data product sample query of type '${json._type}'`,
416
+ `Can't deserialize executable info of type '${json._type}'`,
353
417
  );
354
418
  }
355
419
  };
356
420
 
421
+ // ========================
422
+ // Executable Result classes
423
+ // ========================
424
+
425
+ export class V1_ExecutableTDSResultColumn {
426
+ name!: string;
427
+ type?: string | undefined;
428
+ relationalType?: string | undefined;
429
+ doc?: string | undefined;
430
+
431
+ static readonly serialization = new SerializationFactory(
432
+ createModelSchema(V1_ExecutableTDSResultColumn, {
433
+ name: primitive(),
434
+ type: optional(primitive()),
435
+ relationalType: optional(primitive()),
436
+ doc: optional(primitive()),
437
+ }),
438
+ );
439
+ }
440
+
441
+ export class V1_ExecutableTDSResultInfo {
442
+ tdsColumns: V1_ExecutableTDSResultColumn[] = [];
443
+
444
+ static readonly serialization = new SerializationFactory(
445
+ createModelSchema(V1_ExecutableTDSResultInfo, {
446
+ _type: usingConstantValueSchema(V1_ExecutableResultType.TDS),
447
+ tdsColumns: list(
448
+ usingModelSchema(V1_ExecutableTDSResultColumn.serialization.schema),
449
+ ),
450
+ }),
451
+ );
452
+ }
453
+
454
+ export abstract class V1_ExecutableResult {}
455
+
456
+ export class V1_ExecutableTDSResult extends V1_ExecutableResult {
457
+ tdsResult!: V1_ExecutableTDSResultInfo;
458
+
459
+ static readonly serialization = new SerializationFactory(
460
+ createModelSchema(V1_ExecutableTDSResult, {
461
+ _type: usingConstantValueSchema(V1_ExecutableResultType.TDS),
462
+ tdsResult: usingModelSchema(
463
+ V1_ExecutableTDSResultInfo.serialization.schema,
464
+ ),
465
+ }),
466
+ );
467
+ }
468
+
469
+ export class V1_ExecutableRelationResult extends V1_ExecutableResult {
470
+ genericType!: V1_GenericType;
471
+
472
+ static readonly serialization = new SerializationFactory(
473
+ createModelSchema(V1_ExecutableRelationResult, {
474
+ _type: usingConstantValueSchema(V1_ExecutableResultType.RELATION),
475
+ genericType: custom(
476
+ (val) => serialize(V1_genericTypeModelSchema, val),
477
+ (val) => V1_deserializeGenericType(val),
478
+ ),
479
+ }),
480
+ );
481
+ }
482
+
483
+ const V1_deserializeExecutableResult = (
484
+ json: PlainObject<V1_ExecutableResult>,
485
+ ): V1_ExecutableResult => {
486
+ switch (json._type) {
487
+ case V1_ExecutableResultType.TDS:
488
+ return V1_ExecutableTDSResult.serialization.fromJson(json);
489
+ case V1_ExecutableResultType.RELATION:
490
+ return V1_ExecutableRelationResult.serialization.fromJson(json);
491
+ default:
492
+ throw new UnsupportedOperationError(
493
+ `Can't deserialize executable result of type '${json._type}'`,
494
+ );
495
+ }
496
+ };
497
+
498
+ export class V1_SampleQuery {
499
+ title!: string;
500
+ description?: string | undefined;
501
+ executable?: string | undefined;
502
+ info!: V1_ExecutableInfo;
503
+ result!: V1_ExecutableResult;
504
+
505
+ static readonly serialization = new SerializationFactory(
506
+ createModelSchema(V1_SampleQuery, {
507
+ title: primitive(),
508
+ description: optional(primitive()),
509
+ executable: optional(primitive()),
510
+ info: custom(
511
+ () => SKIP,
512
+ (val: PlainObject<V1_ExecutableInfo>) =>
513
+ V1_deserializeExecutableInfo(val),
514
+ ),
515
+ result: custom(
516
+ () => SKIP,
517
+ (val: PlainObject<V1_ExecutableResult>) =>
518
+ V1_deserializeExecutableResult(val),
519
+ ),
520
+ }),
521
+ );
522
+ }
523
+
357
524
  export class V1_NativeModelAccessInfo {
358
525
  diagrams: V1_DiagramInfo[] = [];
359
526
  model!: V1_PureModelContextData;
@@ -362,7 +529,7 @@ export class V1_NativeModelAccessInfo {
362
529
  elementDocs: V1_ModelDocumentationEntry[] = [];
363
530
  mappingGenerations!: Map<string, V1_MappingGenerationInfo>;
364
531
  nativeModelExecutionContexts!: V1_NativeModelExecutionContextInfo[];
365
- sampleQueries?: V1_SampleQueryInfo[] | undefined;
532
+ sampleQueries?: V1_SampleQuery[] | undefined;
366
533
 
367
534
  static readonly serialization = new SerializationFactory(
368
535
  createModelSchema(V1_NativeModelAccessInfo, {
@@ -380,8 +547,8 @@ export class V1_NativeModelAccessInfo {
380
547
  ),
381
548
  sampleQueries: optionalCustomList(
382
549
  () => SKIP as never,
383
- (val: PlainObject<V1_SampleQueryInfo>) =>
384
- V1_deserializeSampleQuery(val),
550
+ (val: PlainObject<V1_SampleQuery>) =>
551
+ V1_SampleQuery.serialization.fromJson(val),
385
552
  ),
386
553
  mappingGenerations: custom(
387
554
  () => SKIP,
@@ -501,6 +668,10 @@ function V1_deserializeModelDocumentationEntry(
501
668
  }
502
669
  }
503
670
 
671
+ export enum V1_AccessPointGroupInfoType {
672
+ MODEL = 'modelAccessPointGroup',
673
+ }
674
+
504
675
  export class V1_AccessPointGroupInfo {
505
676
  id!: string;
506
677
  description: string | undefined;
@@ -517,6 +688,45 @@ export class V1_AccessPointGroupInfo {
517
688
  );
518
689
  }
519
690
 
691
+ export class V1_ModelAccessPointGroupInfo extends V1_AccessPointGroupInfo {
692
+ mappingGeneration!: V1_MappingGenerationInfo;
693
+ diagrams: V1_DiagramInfo[] = [];
694
+ model!: V1_PureModelContextData;
695
+ elements: string[] = [];
696
+ elementDocs: V1_ModelDocumentationEntry[] = [];
697
+
698
+ static override readonly serialization = new SerializationFactory(
699
+ createModelSchema(V1_ModelAccessPointGroupInfo, {
700
+ _type: usingConstantValueSchema(V1_AccessPointGroupInfoType.MODEL),
701
+ id: primitive(),
702
+ description: optional(primitive()),
703
+ accessPointImplementations: list(
704
+ usingModelSchema(V1_AccessPointImplementation.serialization.schema),
705
+ ),
706
+ mappingGeneration: usingModelSchema(
707
+ V1_MappingGenerationInfo.serialization.schema,
708
+ ),
709
+ diagrams: list(usingModelSchema(V1_DiagramInfo.serialization.schema)),
710
+ model: V1_pureModelContextDataPropSchema,
711
+ elements: list(primitive()),
712
+ elementDocs: list(
713
+ custom(() => SKIP, V1_deserializeModelDocumentationEntry),
714
+ ),
715
+ }),
716
+ );
717
+ }
718
+
719
+ function V1_deserializeAccessPointGroupInfo(
720
+ json: PlainObject<V1_AccessPointGroupInfo>,
721
+ ): V1_AccessPointGroupInfo {
722
+ switch (json._type) {
723
+ case V1_AccessPointGroupInfoType.MODEL:
724
+ return V1_ModelAccessPointGroupInfo.serialization.fromJson(json);
725
+ default:
726
+ return V1_AccessPointGroupInfo.serialization.fromJson(json);
727
+ }
728
+ }
729
+
520
730
  export class V1_DataProductArtifact {
521
731
  dataProduct!: V1_DataProductInfo;
522
732
  accessPointGroups: V1_AccessPointGroupInfo[] = [];
@@ -526,7 +736,11 @@ export class V1_DataProductArtifact {
526
736
  createModelSchema(V1_DataProductArtifact, {
527
737
  dataProduct: usingModelSchema(V1_DataProductInfo.serialization.schema),
528
738
  accessPointGroups: list(
529
- usingModelSchema(V1_AccessPointGroupInfo.serialization.schema),
739
+ custom(
740
+ () => SKIP,
741
+ (val: PlainObject<V1_AccessPointGroupInfo>) =>
742
+ V1_deserializeAccessPointGroupInfo(val),
743
+ ),
530
744
  ),
531
745
  nativeModelAccess: optionalCustomUsingModelSchema(
532
746
  V1_NativeModelAccessInfo.serialization.schema,
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import type { V1_AppDirNode } from '../../../lakehouse/entitlements/V1_CoreEntitlements.js';
18
+ import type { V1_RelationTypeColumn } from '../type/V1_RelationType.js';
18
19
  import { V1_INTERNAL__UnknownPackageableElement } from '../V1_INTERNAL__UnknownPackageableElement.js';
19
20
  import type { V1_PackageableElementVisitor } from '../V1_PackageableElement.js';
20
21
 
@@ -29,3 +30,18 @@ export class V1_IngestDefinition extends V1_INTERNAL__UnknownPackageableElement
29
30
  return visitor.visit_IngestDefinition(this);
30
31
  }
31
32
  }
33
+ export interface V1_IngestDataset {
34
+ name: string;
35
+ primaryKey: string[];
36
+ source: {
37
+ _type: string;
38
+ schema: {
39
+ _type: string;
40
+ columns: V1_RelationTypeColumn[];
41
+ };
42
+ };
43
+ }
44
+
45
+ export interface V1_IngestDefinitionContent {
46
+ datasets?: V1_IngestDataset[];
47
+ }
package/src/index.ts CHANGED
@@ -93,7 +93,11 @@ export { SnowflakeAppDeploymentConfiguration } from './graph/metamodel/pure/func
93
93
  export { SnowflakeM2MUdf } from './graph/metamodel/pure/packageableElements/function/SnowflakeM2MUdf.js';
94
94
  export { SnowflakeM2MUdfDeploymentConfiguration } from './graph/metamodel/pure/functionActivator/SnowflakeM2MUdfDeploymentConfiguration.js';
95
95
  export { INTERNAL__UnknownElement } from './graph/metamodel/pure/packageableElements/INTERNAL__UnknownElement.js';
96
- export { V1_IngestDefinition } from './graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js';
96
+ export {
97
+ V1_IngestDefinition,
98
+ type V1_IngestDataset,
99
+ type V1_IngestDefinitionContent,
100
+ } from './graph-manager/protocol/pure/v1/model/packageableElements/ingest/V1_IngestDefinition.js';
97
101
  export {
98
102
  Ownership,
99
103
  DeploymentOwner,
@@ -402,11 +406,24 @@ export {
402
406
  V1_NativeModelExecutionContextInfo,
403
407
  V1_AccessPointImplementation,
404
408
  V1_AccessPointGroupInfo,
405
- V1_SampleQueryInfo,
406
- V1_InLineSampleQueryInfo,
407
- V1_PackageableElementSampleQueryInfo,
409
+ V1_DataProductInfo,
410
+ V1_ModelAccessPointGroupInfo,
411
+ V1_AccessPointGroupInfoType,
412
+ V1_SampleQuery,
413
+ V1_ExecutableInfo,
414
+ V1_TemplateExecutableInfo,
415
+ V1_FunctionPointerExecutableInfo,
416
+ V1_ServiceExecutableInfo,
417
+ V1_MultiExecutionServiceExecutableInfo,
418
+ V1_MultiExecutionServiceKeyedExecutableInfo,
419
+ V1_ExecutableResult,
420
+ V1_ExecutableTDSResult,
421
+ V1_ExecutableTDSResultColumn,
422
+ V1_ExecutableTDSResultInfo,
423
+ V1_ExecutableRelationResult,
408
424
  V1_NativeModelAccessInfo,
409
425
  V1_DiagramInfo,
426
+ V1_ModelDocumentationEntry,
410
427
  V1_EnumerationDocumentationEntry,
411
428
  V1_AssociationDocumentationEntry,
412
429
  V1_ClassDocumentationEntry,