@finos/legend-graph 31.10.65 → 32.0.1
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/lib/graph/helpers/ValueSpecificationHelper.d.ts +2 -2
- package/lib/graph/helpers/ValueSpecificationHelper.d.ts.map +1 -1
- package/lib/graph/helpers/ValueSpecificationHelper.js +4 -4
- package/lib/graph/helpers/ValueSpecificationHelper.js.map +1 -1
- package/lib/graph/metamodel/pure/data/EmbeddedData.d.ts +2 -2
- package/lib/graph/metamodel/pure/data/EmbeddedData.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/data/EmbeddedData.js.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_Relation.d.ts → Relation.d.ts} +2 -2
- package/lib/graph/metamodel/pure/packageableElements/relation/Relation.d.ts.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_Relation.js → Relation.js} +2 -2
- package/lib/graph/metamodel/pure/packageableElements/relation/Relation.js.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_RelationType.d.ts → RelationType.d.ts} +4 -4
- package/lib/graph/metamodel/pure/packageableElements/relation/RelationType.d.ts.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/relation/{Relation_RelationType.js → RelationType.js} +3 -3
- package/lib/graph/metamodel/pure/packageableElements/relation/RelationType.js.map +1 -0
- package/lib/graph/metamodel/pure/packageableElements/store/modelToModel/mapping/PureInstanceSetImplementation.d.ts +3 -2
- package/lib/graph/metamodel/pure/packageableElements/store/modelToModel/mapping/PureInstanceSetImplementation.d.ts.map +1 -1
- package/lib/graph/metamodel/pure/packageableElements/store/modelToModel/mapping/PureInstanceSetImplementation.js.map +1 -1
- package/lib/graph-manager/AbstractPureGraphManager.d.ts +5 -2
- package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/AbstractPureGraphManager.js.map +1 -1
- package/lib/graph-manager/action/query/PersistentDataCubeQuery.d.ts +11 -0
- package/lib/graph-manager/action/query/PersistentDataCubeQuery.d.ts.map +1 -1
- package/lib/graph-manager/action/query/PersistentDataCubeQuery.js +21 -0
- package/lib/graph-manager/action/query/PersistentDataCubeQuery.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +5 -2
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +19 -11
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts +1 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js +5 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_GraphManagerEngine.d.ts +10 -7
- package/lib/graph-manager/protocol/pure/v1/engine/V1_GraphManagerEngine.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.d.ts +10 -7
- package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.js +31 -20
- package/lib/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.d.ts +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.d.ts +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.js +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/helpers/V1_DomainHelper.js +2 -2
- package/lib/graph-manager/protocol/pure/v1/helpers/V1_DomainHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.d.ts +3 -4
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.js +7 -11
- package/lib/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.js +2 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ClassMappingFirstPassBuilder.js +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ClassMappingFirstPassBuilder.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js +2 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.js +4 -4
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.d.ts +4 -2
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js +49 -38
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.js +3 -3
- package/lib/index.d.ts +7 -6
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -6
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +3 -3
- package/src/graph/helpers/ValueSpecificationHelper.ts +5 -5
- package/src/graph/metamodel/pure/data/EmbeddedData.ts +2 -2
- package/src/graph/metamodel/pure/packageableElements/relation/{Relation_Relation.ts → Relation.ts} +1 -1
- package/src/graph/metamodel/pure/packageableElements/relation/{Relation_RelationType.ts → RelationType.ts} +5 -3
- package/src/graph/metamodel/pure/packageableElements/store/modelToModel/mapping/PureInstanceSetImplementation.ts +3 -2
- package/src/graph-manager/AbstractPureGraphManager.ts +15 -3
- package/src/graph-manager/action/query/PersistentDataCubeQuery.ts +30 -0
- package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +42 -13
- package/src/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.ts +8 -0
- package/src/graph-manager/protocol/pure/v1/engine/V1_GraphManagerEngine.ts +24 -9
- package/src/graph-manager/protocol/pure/v1/engine/V1_RemoteEngine.ts +66 -22
- package/src/graph-manager/protocol/pure/v1/engine/compilation/V1_CompleteCodeInput.ts +1 -1
- package/src/graph-manager/protocol/pure/v1/engine/execution/V1_ExecutionHelper.ts +1 -1
- package/src/graph-manager/protocol/pure/v1/helpers/V1_DomainHelper.ts +2 -2
- package/src/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.ts +8 -24
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/from/V1_ValueSpecificationTransformer.ts +2 -2
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_ClassMappingFirstPassBuilder.ts +1 -1
- package/src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationBuilderHelper.ts +2 -2
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_DomainSerializationHelper.ts +4 -4
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.ts +70 -52
- package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ValueSpecificationSerializer.ts +3 -3
- package/src/index.ts +15 -8
- package/tsconfig.json +2 -2
- package/lib/graph/metamodel/pure/packageableElements/relation/Relation_Relation.d.ts.map +0 -1
- package/lib/graph/metamodel/pure/packageableElements/relation/Relation_Relation.js.map +0 -1
- package/lib/graph/metamodel/pure/packageableElements/relation/Relation_RelationType.d.ts.map +0 -1
- package/lib/graph/metamodel/pure/packageableElements/relation/Relation_RelationType.js.map +0 -1
|
@@ -342,7 +342,10 @@ import type { RelationTypeMetadata } from '../../../action/relation/RelationType
|
|
|
342
342
|
import type { CodeCompletionResult } from '../../../action/compilation/Completion.js';
|
|
343
343
|
import { V1_CompleteCodeInput } from './engine/compilation/V1_CompleteCodeInput.js';
|
|
344
344
|
import type { DeploymentResult } from '../../../action/DeploymentResult.js';
|
|
345
|
-
import type {
|
|
345
|
+
import type {
|
|
346
|
+
LightPersistentDataCubeQuery,
|
|
347
|
+
PersistentDataCubeQuery,
|
|
348
|
+
} from '../../../action/query/PersistentDataCubeQuery.js';
|
|
346
349
|
|
|
347
350
|
class V1_PureModelContextDataIndex {
|
|
348
351
|
elements: V1_PackageableElement[] = [];
|
|
@@ -1769,7 +1772,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1769
1772
|
const graphData = this.graphToPureModelContextData(graph, {
|
|
1770
1773
|
excludeUnknown: options?.excludeUnknown,
|
|
1771
1774
|
});
|
|
1772
|
-
const grammarToJson = await this.engine.
|
|
1775
|
+
const grammarToJson = await this.engine.transformPureModelContextDataToCode(
|
|
1773
1776
|
graphData,
|
|
1774
1777
|
Boolean(options?.pretty),
|
|
1775
1778
|
);
|
|
@@ -1792,7 +1795,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1792
1795
|
options?: { pretty?: boolean | undefined },
|
|
1793
1796
|
): Promise<string> {
|
|
1794
1797
|
const startTime = Date.now();
|
|
1795
|
-
const grammarToJson = await this.engine.
|
|
1798
|
+
const grammarToJson = await this.engine.transformPureModelContextDataToCode(
|
|
1796
1799
|
await this.entitiesToPureModelContextData(entities),
|
|
1797
1800
|
Boolean(options?.pretty),
|
|
1798
1801
|
);
|
|
@@ -1814,7 +1817,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1814
1817
|
},
|
|
1815
1818
|
): Promise<Entity[]> {
|
|
1816
1819
|
const index = new Map<string, V1_SourceInformation>();
|
|
1817
|
-
const pmcd = await this.engine.
|
|
1820
|
+
const pmcd = await this.engine.transformCodeToPureModelContextData(code, {
|
|
1818
1821
|
sourceInformationIndex: options?.sourceInformationIndex
|
|
1819
1822
|
? index
|
|
1820
1823
|
: undefined,
|
|
@@ -1877,21 +1880,27 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1877
1880
|
lambdas.forEach((val, key) => {
|
|
1878
1881
|
input[key] = this.serializeValueSpecification(val);
|
|
1879
1882
|
});
|
|
1880
|
-
return this.engine.
|
|
1883
|
+
return this.engine.transformValueSpecificationsToCode(
|
|
1884
|
+
input,
|
|
1885
|
+
Boolean(pretty),
|
|
1886
|
+
);
|
|
1881
1887
|
}
|
|
1882
1888
|
|
|
1883
1889
|
async valueSpecificationToPureCode(
|
|
1884
1890
|
valSpec: PlainObject<ValueSpecification>,
|
|
1885
1891
|
pretty?: boolean | undefined,
|
|
1886
1892
|
): Promise<string> {
|
|
1887
|
-
return this.engine.
|
|
1893
|
+
return this.engine.transformValueSpecificationToCode(
|
|
1894
|
+
valSpec,
|
|
1895
|
+
Boolean(pretty),
|
|
1896
|
+
);
|
|
1888
1897
|
}
|
|
1889
1898
|
|
|
1890
1899
|
async pureCodeToValueSpecification(
|
|
1891
1900
|
valSpec: string,
|
|
1892
1901
|
returnSourceInformation?: boolean,
|
|
1893
1902
|
): Promise<PlainObject<ValueSpecification>> {
|
|
1894
|
-
return this.engine.
|
|
1903
|
+
return this.engine.transformCodeToValueSpecification(
|
|
1895
1904
|
valSpec,
|
|
1896
1905
|
returnSourceInformation,
|
|
1897
1906
|
);
|
|
@@ -1911,7 +1920,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1911
1920
|
returnSourceInformation: false,
|
|
1912
1921
|
};
|
|
1913
1922
|
});
|
|
1914
|
-
const specs = await this.engine.
|
|
1923
|
+
const specs = await this.engine.transformCodeToValueSpecifications(
|
|
1915
1924
|
pureCodeToValueSpecInput,
|
|
1916
1925
|
);
|
|
1917
1926
|
const result = new Map<string, ValueSpecification>();
|
|
@@ -3250,7 +3259,21 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
3250
3259
|
}
|
|
3251
3260
|
}
|
|
3252
3261
|
|
|
3253
|
-
// ---------------------------------------------
|
|
3262
|
+
// --------------------------------------------- DataCube Query ---------------------------------------------
|
|
3263
|
+
|
|
3264
|
+
override searchDataCubeQueries(
|
|
3265
|
+
searchSpecification: QuerySearchSpecification,
|
|
3266
|
+
): Promise<LightPersistentDataCubeQuery[]> {
|
|
3267
|
+
return this.engine.searchDataCubeQueries(
|
|
3268
|
+
V1_transformQuerySearchSpecification(searchSpecification),
|
|
3269
|
+
);
|
|
3270
|
+
}
|
|
3271
|
+
|
|
3272
|
+
override getDataCubeQueries(
|
|
3273
|
+
queryIds: string[],
|
|
3274
|
+
): Promise<LightPersistentDataCubeQuery[]> {
|
|
3275
|
+
return this.engine.getDataCubeQueries(queryIds);
|
|
3276
|
+
}
|
|
3254
3277
|
|
|
3255
3278
|
override async getDataCubeQuery(
|
|
3256
3279
|
queryId: string,
|
|
@@ -3258,11 +3281,17 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
3258
3281
|
const query = await this.engine.getDataCubeQuery(queryId);
|
|
3259
3282
|
return query;
|
|
3260
3283
|
}
|
|
3261
|
-
|
|
3262
|
-
|
|
3284
|
+
|
|
3285
|
+
override async createDataCubeQuery(
|
|
3286
|
+
query: PersistentDataCubeQuery,
|
|
3263
3287
|
): Promise<PersistentDataCubeQuery> {
|
|
3264
|
-
|
|
3265
|
-
|
|
3288
|
+
return this.engine.createDataCubeQuery(query);
|
|
3289
|
+
}
|
|
3290
|
+
|
|
3291
|
+
override updateDataCubeQuery(
|
|
3292
|
+
query: PersistentDataCubeQuery,
|
|
3293
|
+
): Promise<PersistentDataCubeQuery> {
|
|
3294
|
+
return this.engine.updateDataCubeQuery(query);
|
|
3266
3295
|
}
|
|
3267
3296
|
|
|
3268
3297
|
override async deleteDataCubeQuery(queryId: string): Promise<void> {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
type ServerClientConfig,
|
|
22
22
|
type TraceData,
|
|
23
23
|
HttpHeader,
|
|
24
|
+
NetworkClient,
|
|
24
25
|
} from '@finos/legend-shared';
|
|
25
26
|
import type { V1_PureModelContextData } from '../model/context/V1_PureModelContextData.js';
|
|
26
27
|
import type {
|
|
@@ -164,6 +165,13 @@ export const V1_getEngineSerializationFormat = (
|
|
|
164
165
|
}
|
|
165
166
|
};
|
|
166
167
|
|
|
168
|
+
// eslint-disable-next-line @finos/legend/enforce-protocol-export-prefix
|
|
169
|
+
export async function getCurrentUserIDFromEngineServer(
|
|
170
|
+
engineServerUrl: string,
|
|
171
|
+
): Promise<string> {
|
|
172
|
+
return new NetworkClient().get(`${engineServerUrl}/server/v1/currentUser`);
|
|
173
|
+
}
|
|
174
|
+
|
|
167
175
|
export class V1_EngineServerClient extends AbstractServerClient {
|
|
168
176
|
currentUserId?: string | undefined;
|
|
169
177
|
private env?: string | undefined;
|
|
@@ -91,7 +91,10 @@ import type { RelationTypeMetadata } from '../../../../action/relation/RelationT
|
|
|
91
91
|
import type { V1_CompleteCodeInput } from './compilation/V1_CompleteCodeInput.js';
|
|
92
92
|
import type { CodeCompletionResult } from '../../../../action/compilation/Completion.js';
|
|
93
93
|
import type { DeploymentResult } from '../../../../action/DeploymentResult.js';
|
|
94
|
-
import type {
|
|
94
|
+
import type {
|
|
95
|
+
LightPersistentDataCubeQuery,
|
|
96
|
+
PersistentDataCubeQuery,
|
|
97
|
+
} from '../../../../action/query/PersistentDataCubeQuery.js';
|
|
95
98
|
|
|
96
99
|
export interface V1_GraphManagerEngine {
|
|
97
100
|
config: TEMPORARY__AbstractEngineConfig;
|
|
@@ -106,12 +109,12 @@ export interface V1_GraphManagerEngine {
|
|
|
106
109
|
|
|
107
110
|
// ------------------------------------------- Grammar -------------------------------------------
|
|
108
111
|
|
|
109
|
-
|
|
112
|
+
transformPureModelContextDataToCode: (
|
|
110
113
|
graph: V1_PureModelContextData,
|
|
111
114
|
pretty: boolean,
|
|
112
115
|
) => Promise<string>;
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
transformCodeToPureModelContextData: (
|
|
115
118
|
code: string,
|
|
116
119
|
options?: {
|
|
117
120
|
sourceInformationIndex?: Map<string, V1_SourceInformation> | undefined;
|
|
@@ -125,22 +128,22 @@ export interface V1_GraphManagerEngine {
|
|
|
125
128
|
plugins: PureProtocolProcessorPlugin[],
|
|
126
129
|
) => Promise<Map<string, string>>;
|
|
127
130
|
|
|
128
|
-
|
|
131
|
+
transformValueSpecificationsToCode: (
|
|
129
132
|
input: Record<string, PlainObject<V1_ValueSpecification>>,
|
|
130
133
|
pretty: boolean,
|
|
131
134
|
) => Promise<Map<string, string>>;
|
|
132
135
|
|
|
133
|
-
|
|
136
|
+
transformValueSpecificationToCode: (
|
|
134
137
|
input: PlainObject<V1_ValueSpecification>,
|
|
135
138
|
pretty: boolean,
|
|
136
139
|
) => Promise<string>;
|
|
137
140
|
|
|
138
|
-
|
|
141
|
+
transformCodeToValueSpecifications: (
|
|
139
142
|
input: Record<string, V1_GrammarParserBatchInputEntry>,
|
|
140
143
|
) => Promise<Map<string, PlainObject>>;
|
|
141
144
|
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
transformCodeToValueSpecification: (
|
|
146
|
+
code: string,
|
|
144
147
|
returnSourceInformation?: boolean,
|
|
145
148
|
) => Promise<PlainObject<V1_ValueSpecification>>;
|
|
146
149
|
|
|
@@ -338,7 +341,15 @@ export interface V1_GraphManagerEngine {
|
|
|
338
341
|
|
|
339
342
|
getCurrentUserId: () => string | undefined;
|
|
340
343
|
|
|
341
|
-
// -------------------------------------------
|
|
344
|
+
// ------------------------------------------- DataCube Query -------------------------------------------
|
|
345
|
+
|
|
346
|
+
searchDataCubeQueries: (
|
|
347
|
+
searchSpecification: V1_QuerySearchSpecification,
|
|
348
|
+
) => Promise<LightPersistentDataCubeQuery[]>;
|
|
349
|
+
|
|
350
|
+
getDataCubeQueries: (
|
|
351
|
+
queryIds: string[],
|
|
352
|
+
) => Promise<LightPersistentDataCubeQuery[]>;
|
|
342
353
|
|
|
343
354
|
getDataCubeQuery: (id: string) => Promise<PersistentDataCubeQuery>;
|
|
344
355
|
|
|
@@ -346,6 +357,10 @@ export interface V1_GraphManagerEngine {
|
|
|
346
357
|
query: PersistentDataCubeQuery,
|
|
347
358
|
) => Promise<PersistentDataCubeQuery>;
|
|
348
359
|
|
|
360
|
+
updateDataCubeQuery: (
|
|
361
|
+
query: PersistentDataCubeQuery,
|
|
362
|
+
) => Promise<PersistentDataCubeQuery>;
|
|
363
|
+
|
|
349
364
|
deleteDataCubeQuery: (id: string) => Promise<void>;
|
|
350
365
|
|
|
351
366
|
// ------------------------------------------ Analysis ------------------------------------------
|
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
import type { V1_SourceInformation } from '../model/V1_SourceInformation.js';
|
|
128
128
|
import { V1_INTERNAL__PackageableElementWithSourceInformation } from '../transformation/pureProtocol/serializationHelpers/V1_CoreSerializationHelper.js';
|
|
129
129
|
import { ELEMENT_PATH_DELIMITER } from '../../../../../graph/MetaModelConst.js';
|
|
130
|
-
import {
|
|
130
|
+
import { V1_deserializeExecutionResult } from './execution/V1_ExecutionHelper.js';
|
|
131
131
|
import type {
|
|
132
132
|
ClassifierPathMapping,
|
|
133
133
|
SubtypeInfo,
|
|
@@ -154,7 +154,7 @@ import { V1_RelationalConnectionBuilder } from './relational/V1_RelationalConnec
|
|
|
154
154
|
import type { PostValidationAssertionResult } from '../../../../../DSL_Service_Exports.js';
|
|
155
155
|
import { V1_DebugTestsResult } from './test/V1_DebugTestsResult.js';
|
|
156
156
|
import type { V1_GraphManagerEngine } from './V1_GraphManagerEngine.js';
|
|
157
|
-
import { V1_RelationType } from '../model/packageableElements/type/V1_RelationType.js';
|
|
157
|
+
import { type V1_RelationType } from '../model/packageableElements/type/V1_RelationType.js';
|
|
158
158
|
import {
|
|
159
159
|
RelationTypeColumnMetadata,
|
|
160
160
|
RelationTypeMetadata,
|
|
@@ -162,7 +162,12 @@ import {
|
|
|
162
162
|
import { V1_CompleteCodeInput } from './compilation/V1_CompleteCodeInput.js';
|
|
163
163
|
import { CodeCompletionResult } from '../../../../action/compilation/Completion.js';
|
|
164
164
|
import { DeploymentResult } from '../../../../action/DeploymentResult.js';
|
|
165
|
-
import {
|
|
165
|
+
import {
|
|
166
|
+
LightPersistentDataCubeQuery,
|
|
167
|
+
PersistentDataCubeQuery,
|
|
168
|
+
} from '../../../../action/query/PersistentDataCubeQuery.js';
|
|
169
|
+
import { V1_getGenericTypeFullPath } from '../helpers/V1_DomainHelper.js';
|
|
170
|
+
import { V1_relationTypeModelSchema } from '../transformation/pureProtocol/serializationHelpers/V1_TypeSerializationHelper.js';
|
|
166
171
|
|
|
167
172
|
class V1_RemoteEngineConfig extends TEMPORARY__AbstractEngineConfig {
|
|
168
173
|
private engine: V1_RemoteEngine;
|
|
@@ -329,7 +334,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
329
334
|
return sourceInformationIndex;
|
|
330
335
|
}
|
|
331
336
|
|
|
332
|
-
|
|
337
|
+
transformPureModelContextDataToCode(
|
|
333
338
|
graph: V1_PureModelContextData,
|
|
334
339
|
pretty: boolean,
|
|
335
340
|
): Promise<string> {
|
|
@@ -339,7 +344,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
339
344
|
);
|
|
340
345
|
}
|
|
341
346
|
|
|
342
|
-
async
|
|
347
|
+
async transformCodeToPureModelContextData(
|
|
343
348
|
code: string,
|
|
344
349
|
options?: {
|
|
345
350
|
sourceInformationIndex?: Map<string, V1_SourceInformation> | undefined;
|
|
@@ -413,7 +418,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
413
418
|
);
|
|
414
419
|
}
|
|
415
420
|
|
|
416
|
-
async
|
|
421
|
+
async transformValueSpecificationsToCode(
|
|
417
422
|
input: Record<string, PlainObject<V1_ValueSpecification>>,
|
|
418
423
|
pretty: boolean,
|
|
419
424
|
): Promise<Map<string, string>> {
|
|
@@ -426,7 +431,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
426
431
|
);
|
|
427
432
|
}
|
|
428
433
|
|
|
429
|
-
async
|
|
434
|
+
async transformValueSpecificationToCode(
|
|
430
435
|
input: PlainObject<V1_ValueSpecification>,
|
|
431
436
|
pretty: boolean,
|
|
432
437
|
): Promise<string> {
|
|
@@ -437,7 +442,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
437
442
|
return code;
|
|
438
443
|
}
|
|
439
444
|
|
|
440
|
-
async
|
|
445
|
+
async transformCodeToValueSpecifications(
|
|
441
446
|
input: Record<string, V1_GrammarParserBatchInputEntry>,
|
|
442
447
|
): Promise<Map<string, PlainObject>> {
|
|
443
448
|
const batchResults =
|
|
@@ -454,7 +459,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
454
459
|
return finalResults;
|
|
455
460
|
}
|
|
456
461
|
|
|
457
|
-
async
|
|
462
|
+
async transformCodeToValueSpecification(
|
|
458
463
|
input: string,
|
|
459
464
|
returnSourceInformation?: boolean,
|
|
460
465
|
): Promise<PlainObject<V1_ValueSpecification>> {
|
|
@@ -720,27 +725,32 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
720
725
|
async getLambdaRelationTypeFromRawInput(
|
|
721
726
|
rawInput: V1_LambdaReturnTypeInput,
|
|
722
727
|
): Promise<RelationTypeMetadata> {
|
|
723
|
-
const
|
|
728
|
+
const result = deserialize(
|
|
729
|
+
V1_relationTypeModelSchema,
|
|
724
730
|
(await this.engineServerClient.lambdaRelationType(
|
|
725
731
|
V1_LambdaReturnTypeInput.serialization.toJson(rawInput),
|
|
726
732
|
)) as unknown as PlainObject<V1_RelationType>,
|
|
727
733
|
);
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
(
|
|
734
|
+
const relationType = new RelationTypeMetadata();
|
|
735
|
+
relationType.columns = result.columns.map(
|
|
736
|
+
(column) =>
|
|
737
|
+
new RelationTypeColumnMetadata(
|
|
738
|
+
V1_getGenericTypeFullPath(column.genericType),
|
|
739
|
+
column.name,
|
|
740
|
+
),
|
|
731
741
|
);
|
|
732
|
-
return
|
|
742
|
+
return relationType;
|
|
733
743
|
}
|
|
734
744
|
|
|
735
745
|
async getCodeCompletion(
|
|
736
746
|
rawInput: V1_CompleteCodeInput,
|
|
737
747
|
): Promise<CodeCompletionResult> {
|
|
738
|
-
const
|
|
748
|
+
const result = CodeCompletionResult.serialization.fromJson(
|
|
739
749
|
(await this.engineServerClient.completeCode(
|
|
740
750
|
V1_CompleteCodeInput.serialization.toJson(rawInput),
|
|
741
751
|
)) as unknown as PlainObject<CodeCompletionResult>,
|
|
742
752
|
);
|
|
743
|
-
return
|
|
753
|
+
return result;
|
|
744
754
|
}
|
|
745
755
|
|
|
746
756
|
// --------------------------------------------- Execution ---------------------------------------------
|
|
@@ -763,7 +773,7 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
763
773
|
returnUndefOnError(() =>
|
|
764
774
|
this.parseExecutionResults(executionResultInText, options),
|
|
765
775
|
) ?? executionResultInText;
|
|
766
|
-
const executionResult =
|
|
776
|
+
const executionResult = V1_deserializeExecutionResult(rawExecutionResult);
|
|
767
777
|
const executionTraceId = executionResultMap.get(V1_ZIPKIN_TRACE_HEADER);
|
|
768
778
|
if (executionTraceId) {
|
|
769
779
|
return { executionResult, executionTraceId };
|
|
@@ -989,7 +999,10 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
989
999
|
// from the front end to engine would take up a lot of bandwidth.
|
|
990
1000
|
const textModel = new V1_PureModelContextText();
|
|
991
1001
|
textModel.serializer = model.serializer;
|
|
992
|
-
textModel.code = await this.
|
|
1002
|
+
textModel.code = await this.transformPureModelContextDataToCode(
|
|
1003
|
+
model,
|
|
1004
|
+
false,
|
|
1005
|
+
);
|
|
993
1006
|
return (
|
|
994
1007
|
await this.engineServerClient.generateFile(
|
|
995
1008
|
generationMode,
|
|
@@ -1108,12 +1121,12 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
1108
1121
|
await this.engineServerClient.searchQueries(
|
|
1109
1122
|
V1_QuerySearchSpecification.serialization.toJson(searchSpecification),
|
|
1110
1123
|
)
|
|
1111
|
-
).map((
|
|
1124
|
+
).map((query) => V1_LightQuery.serialization.fromJson(query));
|
|
1112
1125
|
}
|
|
1113
1126
|
|
|
1114
1127
|
async getQueries(queryIds: string[]): Promise<V1_LightQuery[]> {
|
|
1115
|
-
return (await this.engineServerClient.getQueries(queryIds)).map((
|
|
1116
|
-
V1_LightQuery.serialization.fromJson(
|
|
1128
|
+
return (await this.engineServerClient.getQueries(queryIds)).map((query) =>
|
|
1129
|
+
V1_LightQuery.serialization.fromJson(query),
|
|
1117
1130
|
);
|
|
1118
1131
|
}
|
|
1119
1132
|
|
|
@@ -1159,7 +1172,27 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
1159
1172
|
broadcastToCluster,
|
|
1160
1173
|
);
|
|
1161
1174
|
}
|
|
1162
|
-
// ------------------------------------------
|
|
1175
|
+
// ------------------------------------------ QueryData Cube ------------------------------------------
|
|
1176
|
+
|
|
1177
|
+
async searchDataCubeQueries(
|
|
1178
|
+
searchSpecification: V1_QuerySearchSpecification,
|
|
1179
|
+
): Promise<LightPersistentDataCubeQuery[]> {
|
|
1180
|
+
return (
|
|
1181
|
+
await this.engineServerClient.searchDataCubeQueries(
|
|
1182
|
+
V1_QuerySearchSpecification.serialization.toJson(searchSpecification),
|
|
1183
|
+
)
|
|
1184
|
+
).map((query) =>
|
|
1185
|
+
LightPersistentDataCubeQuery.serialization.fromJson(query),
|
|
1186
|
+
);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
async getDataCubeQueries(
|
|
1190
|
+
queryIds: string[],
|
|
1191
|
+
): Promise<LightPersistentDataCubeQuery[]> {
|
|
1192
|
+
return (await this.engineServerClient.getDataCubeQueries(queryIds)).map(
|
|
1193
|
+
(query) => LightPersistentDataCubeQuery.serialization.fromJson(query),
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1163
1196
|
|
|
1164
1197
|
async getDataCubeQuery(id: string): Promise<PersistentDataCubeQuery> {
|
|
1165
1198
|
return PersistentDataCubeQuery.serialization.fromJson(
|
|
@@ -1177,6 +1210,17 @@ export class V1_RemoteEngine implements V1_GraphManagerEngine {
|
|
|
1177
1210
|
);
|
|
1178
1211
|
}
|
|
1179
1212
|
|
|
1213
|
+
async updateDataCubeQuery(
|
|
1214
|
+
query: PersistentDataCubeQuery,
|
|
1215
|
+
): Promise<PersistentDataCubeQuery> {
|
|
1216
|
+
return PersistentDataCubeQuery.serialization.fromJson(
|
|
1217
|
+
await this.engineServerClient.updateDataCubeQuery(
|
|
1218
|
+
query.id,
|
|
1219
|
+
PersistentDataCubeQuery.serialization.toJson(query),
|
|
1220
|
+
),
|
|
1221
|
+
);
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1180
1224
|
async deleteDataCubeQuery(queryId: string): Promise<void> {
|
|
1181
1225
|
await this.engineServerClient.deleteDataCubeQuery(queryId);
|
|
1182
1226
|
}
|
|
@@ -22,7 +22,7 @@ import { V1_pureModelContextPropSchema } from '../../transformation/pureProtocol
|
|
|
22
22
|
export class V1_CompleteCodeInput {
|
|
23
23
|
model!: V1_PureModelContext;
|
|
24
24
|
codeBlock!: string;
|
|
25
|
-
offset
|
|
25
|
+
offset?: number | undefined;
|
|
26
26
|
|
|
27
27
|
constructor(
|
|
28
28
|
codeBlock: string,
|
|
@@ -168,7 +168,7 @@ export const V1_buildExecutionResult = (
|
|
|
168
168
|
throw new UnsupportedOperationError(`Can't build execution result`, protocol);
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
export const
|
|
171
|
+
export const V1_deserializeExecutionResult = (
|
|
172
172
|
json: PlainObject<V1_ExecutionResult> | string | null | boolean | number,
|
|
173
173
|
): V1_ExecutionResult => {
|
|
174
174
|
if (json === null || isString(json) || isNumber(json) || isBoolean(json)) {
|
|
@@ -36,7 +36,7 @@ export const V1_getGenericTypeFullPath = (val: V1_GenericType): string => {
|
|
|
36
36
|
return val.rawType.fullPath;
|
|
37
37
|
}
|
|
38
38
|
throw new UnsupportedOperationError(
|
|
39
|
-
'
|
|
39
|
+
`Can't extract type path from generic type`,
|
|
40
40
|
);
|
|
41
41
|
};
|
|
42
42
|
|
|
@@ -152,6 +152,6 @@ export function V1_createRelationTypeColumn(
|
|
|
152
152
|
): V1_RelationTypeColumn {
|
|
153
153
|
const column = new V1_RelationTypeColumn();
|
|
154
154
|
column.name = name;
|
|
155
|
-
column.
|
|
155
|
+
column.genericType = V1_createGenericTypeWithElementPath(type);
|
|
156
156
|
return column;
|
|
157
157
|
}
|
package/src/graph-manager/protocol/pure/v1/model/packageableElements/type/V1_RelationType.ts
CHANGED
|
@@ -14,43 +14,27 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
hashArray,
|
|
19
|
-
SerializationFactory,
|
|
20
|
-
usingModelSchema,
|
|
21
|
-
type Hashable,
|
|
22
|
-
} from '@finos/legend-shared';
|
|
23
|
-
import { createModelSchema, list, primitive } from 'serializr';
|
|
17
|
+
import { hashArray, type Hashable } from '@finos/legend-shared';
|
|
24
18
|
import type { V1_Type } from './V1_Type.js';
|
|
25
19
|
import { CORE_HASH_STRUCTURE } from '../../../../../../../graph/Core_HashUtils.js';
|
|
20
|
+
import type { V1_GenericType } from './V1_GenericType.js';
|
|
26
21
|
|
|
27
22
|
export class V1_RelationTypeColumn implements Hashable {
|
|
28
23
|
name!: string;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
static readonly serialization = new SerializationFactory(
|
|
32
|
-
createModelSchema(V1_RelationTypeColumn, {
|
|
33
|
-
name: primitive(),
|
|
34
|
-
type: primitive(),
|
|
35
|
-
}),
|
|
36
|
-
);
|
|
24
|
+
genericType!: V1_GenericType;
|
|
37
25
|
|
|
38
26
|
get hashCode(): string {
|
|
39
|
-
return hashArray([
|
|
27
|
+
return hashArray([
|
|
28
|
+
CORE_HASH_STRUCTURE.RELATION_TYPE,
|
|
29
|
+
this.name,
|
|
30
|
+
this.genericType,
|
|
31
|
+
]);
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
34
|
|
|
43
35
|
export class V1_RelationType implements V1_Type {
|
|
44
36
|
columns: V1_RelationTypeColumn[] = [];
|
|
45
37
|
|
|
46
|
-
static readonly serialization = new SerializationFactory(
|
|
47
|
-
createModelSchema(V1_RelationType, {
|
|
48
|
-
columns: list(
|
|
49
|
-
usingModelSchema(V1_RelationTypeColumn.serialization.schema),
|
|
50
|
-
),
|
|
51
|
-
}),
|
|
52
|
-
);
|
|
53
|
-
|
|
54
38
|
get hashCode(): string {
|
|
55
39
|
return hashArray([
|
|
56
40
|
CORE_HASH_STRUCTURE.RELATION_TYPE,
|
|
@@ -89,7 +89,7 @@ import { V1_CByteArray } from '../../../model/valueSpecification/raw/V1_CByteArr
|
|
|
89
89
|
import type { ColSpecArrayInstance } from '../../../../../../../graph/metamodel/pure/valueSpecification/RelationValueSpecification.js';
|
|
90
90
|
import { V1_ColSpecArray } from '../../../model/valueSpecification/raw/classInstance/relation/V1_ColSpecArray.js';
|
|
91
91
|
import { V1_ColSpec } from '../../../model/valueSpecification/raw/classInstance/relation/V1_ColSpec.js';
|
|
92
|
-
import {
|
|
92
|
+
import { RelationColumn } from '../../../../../../../graph/metamodel/pure/packageableElements/relation/RelationType.js';
|
|
93
93
|
import { V1_createGenericTypeWithElementPath } from '../../../helpers/V1_DomainHelper.js';
|
|
94
94
|
|
|
95
95
|
class V1_ValueSpecificationTransformer
|
|
@@ -134,7 +134,7 @@ class V1_ValueSpecificationTransformer
|
|
|
134
134
|
valueSpecification: FunctionExpression,
|
|
135
135
|
): V1_ValueSpecification {
|
|
136
136
|
// handle relational column
|
|
137
|
-
if (valueSpecification.func instanceof
|
|
137
|
+
if (valueSpecification.func instanceof RelationColumn) {
|
|
138
138
|
const _property = new V1_AppliedProperty();
|
|
139
139
|
_property.property = valueSpecification.func.name;
|
|
140
140
|
_property.parameters = valueSpecification.parametersValues.map((value) =>
|
|
@@ -183,7 +183,7 @@ export class V1_ClassMappingFirstPassBuilder
|
|
|
183
183
|
);
|
|
184
184
|
const targetClass = this.context.resolveClass(classMapping.class);
|
|
185
185
|
const srcClassReference = classMapping.srcClass
|
|
186
|
-
? this.context.
|
|
186
|
+
? this.context.resolveType(classMapping.srcClass)
|
|
187
187
|
: undefined;
|
|
188
188
|
const pureInstanceSetImplementation = new PureInstanceSetImplementation(
|
|
189
189
|
V1_getInferredClassMappingId(targetClass.value, classMapping),
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
import { V1_SubTypeGraphFetchTree } from '../../../../model/valueSpecification/raw/classInstance/graph/V1_SubTypeGraphFetchTree.js';
|
|
110
110
|
import { findMappingLocalProperty } from '../../../../../../../../graph/helpers/DSL_Mapping_Helper.js';
|
|
111
111
|
import { getRelationTypeGenericType } from '../../../../../../../../graph/helpers/ValueSpecificationHelper.js';
|
|
112
|
-
import {
|
|
112
|
+
import { RelationType } from '../../../../../../../../graph/metamodel/pure/packageableElements/relation/RelationType.js';
|
|
113
113
|
import {
|
|
114
114
|
V1_getGenericTypeFullPath,
|
|
115
115
|
V1_createGenericTypeWithElementPath,
|
|
@@ -585,7 +585,7 @@ export function V1_processProperty(
|
|
|
585
585
|
EnumValueExplicitReference.create(getEnumValue(inferredType, property)),
|
|
586
586
|
];
|
|
587
587
|
return enumValueInstanceValue;
|
|
588
|
-
} else if (inferredType instanceof
|
|
588
|
+
} else if (inferredType instanceof RelationType) {
|
|
589
589
|
const col = guaranteeNonNullable(
|
|
590
590
|
inferredType.columns.find((e) => property === e.name),
|
|
591
591
|
`Can't find property ${property} in relation`,
|
|
@@ -86,7 +86,7 @@ import { V1_DefaultValue } from '../../../model/packageableElements/domain/V1_De
|
|
|
86
86
|
import { V1_HostedService } from '../../../model/packageableElements/function/V1_HostedService.js';
|
|
87
87
|
import {
|
|
88
88
|
V1_deserializeGenericType,
|
|
89
|
-
|
|
89
|
+
V1_genericTypeModelSchema,
|
|
90
90
|
} from './V1_TypeSerializationHelper.js';
|
|
91
91
|
import { PackageableElementPointerType } from '../../../../../../../graph/MetaModelConst.js';
|
|
92
92
|
import type { V1_PackageableElementPointer } from '../../../model/packageableElements/V1_PackageableElement.js';
|
|
@@ -256,7 +256,7 @@ export const V1_propertyModelSchema = createModelSchema(V1_Property, {
|
|
|
256
256
|
aggregation: optional(primitive()),
|
|
257
257
|
defaultValue: optional(usingModelSchema(V1_defaultValueModelSchema)),
|
|
258
258
|
genericType: custom(
|
|
259
|
-
(val) => serialize(
|
|
259
|
+
(val) => serialize(V1_genericTypeModelSchema, val),
|
|
260
260
|
(val) => V1_deserializeGenericType(val),
|
|
261
261
|
{
|
|
262
262
|
beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
|
|
@@ -289,7 +289,7 @@ export const V1_derivedPropertyModelSchema = createModelSchema(
|
|
|
289
289
|
name: primitive(),
|
|
290
290
|
parameters: raw(),
|
|
291
291
|
returnGenericType: custom(
|
|
292
|
-
(val) => serialize(
|
|
292
|
+
(val) => serialize(V1_genericTypeModelSchema, val),
|
|
293
293
|
(val) => V1_deserializeGenericType(val),
|
|
294
294
|
{
|
|
295
295
|
beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
|
|
@@ -423,7 +423,7 @@ export const V1_functionModelSchema = (
|
|
|
423
423
|
postConstraints: list(primitive()), // NOTE: these are not currently supported and just added to pass roundtrip test
|
|
424
424
|
preConstraints: list(primitive()), // NOTE: these are not currently supported and just added to pass roundtrip test
|
|
425
425
|
returnGenericType: custom(
|
|
426
|
-
(val) => serialize(
|
|
426
|
+
(val) => serialize(V1_genericTypeModelSchema, val),
|
|
427
427
|
(val) => V1_deserializeGenericType(val),
|
|
428
428
|
{
|
|
429
429
|
beforeDeserialize: function (callback, jsonValue, jsonParentValue) {
|