@finos/legend-graph 31.2.1 → 31.2.3
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-manager/AbstractPureGraphManager.d.ts +2 -0
- package/lib/graph-manager/AbstractPureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/AbstractPureGraphManager.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts +2 -0
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js +6 -0
- package/lib/graph-manager/protocol/pure/v1/V1_PureGraphManager.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.d.ts +2 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.js +18 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_Engine.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.d.ts +5 -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 -0
- package/lib/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.d.ts +22 -0
- package/lib/graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.d.ts.map +1 -0
- package/lib/graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.js +26 -0
- package/lib/graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -4
- package/package.json +7 -7
- package/src/graph-manager/AbstractPureGraphManager.ts +10 -0
- package/src/graph-manager/protocol/pure/v1/V1_PureGraphManager.ts +13 -0
- package/src/graph-manager/protocol/pure/v1/engine/V1_Engine.ts +34 -0
- package/src/graph-manager/protocol/pure/v1/engine/V1_EngineServerClient.ts +34 -0
- package/src/graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.ts +30 -0
- package/src/index.ts +1 -1
- package/tsconfig.json +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-graph",
|
|
3
|
-
"version": "31.2.
|
|
3
|
+
"version": "31.2.3",
|
|
4
4
|
"description": "Legend graph and graph manager",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"test:watch": "jest --watch"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@finos/legend-shared": "10.0.
|
|
44
|
-
"@finos/legend-storage": "3.0.
|
|
43
|
+
"@finos/legend-shared": "10.0.26",
|
|
44
|
+
"@finos/legend-storage": "3.0.76",
|
|
45
45
|
"mobx": "6.10.2",
|
|
46
46
|
"serializr": "3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@finos/legend-dev-utils": "2.0.
|
|
50
|
-
"@jest/globals": "29.
|
|
49
|
+
"@finos/legend-dev-utils": "2.0.80",
|
|
50
|
+
"@jest/globals": "29.7.0",
|
|
51
51
|
"cross-env": "7.0.3",
|
|
52
|
-
"eslint": "8.
|
|
53
|
-
"jest": "29.
|
|
52
|
+
"eslint": "8.49.0",
|
|
53
|
+
"jest": "29.7.0",
|
|
54
54
|
"npm-run-all": "4.1.5",
|
|
55
55
|
"rimraf": "5.0.1",
|
|
56
56
|
"typescript": "5.2.2"
|
|
@@ -322,6 +322,16 @@ export abstract class AbstractPureGraphManager {
|
|
|
322
322
|
pretty?: boolean,
|
|
323
323
|
): Promise<Map<string, string>>;
|
|
324
324
|
|
|
325
|
+
abstract valueSpecificationToPureCode(
|
|
326
|
+
valSpec: PlainObject<ValueSpecification>,
|
|
327
|
+
pretty?: boolean,
|
|
328
|
+
): Promise<string>;
|
|
329
|
+
|
|
330
|
+
abstract pureCodeToValueSpecification(
|
|
331
|
+
valSpec: string,
|
|
332
|
+
pretty?: boolean,
|
|
333
|
+
): Promise<PlainObject<ValueSpecification>>;
|
|
334
|
+
|
|
325
335
|
abstract pureCodeToValueSpecifications(
|
|
326
336
|
lambdas: Map<string, string>,
|
|
327
337
|
graph: PureModel,
|
|
@@ -1831,6 +1831,19 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
|
|
|
1831
1831
|
return this.engine.transformValueSpecsToCode(input, Boolean(pretty));
|
|
1832
1832
|
}
|
|
1833
1833
|
|
|
1834
|
+
async valueSpecificationToPureCode(
|
|
1835
|
+
valSpec: PlainObject<ValueSpecification>,
|
|
1836
|
+
pretty?: boolean | undefined,
|
|
1837
|
+
): Promise<string> {
|
|
1838
|
+
return this.engine.transformValueSpecToCode(valSpec, Boolean(pretty));
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
async pureCodeToValueSpecification(
|
|
1842
|
+
valSpec: string,
|
|
1843
|
+
): Promise<PlainObject<ValueSpecification>> {
|
|
1844
|
+
return this.engine.transformCodeToValueSpec(valSpec);
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1834
1847
|
async pureCodeToValueSpecifications(
|
|
1835
1848
|
lambdas: Map<string, string>,
|
|
1836
1849
|
graph: PureModel,
|
|
@@ -405,6 +405,17 @@ export class V1_Engine {
|
|
|
405
405
|
);
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
async transformValueSpecToCode(
|
|
409
|
+
input: PlainObject<V1_ValueSpecification>,
|
|
410
|
+
pretty: boolean,
|
|
411
|
+
): Promise<string> {
|
|
412
|
+
const code = await this.engineServerClient.JSONToGrammar_valueSpecification(
|
|
413
|
+
input,
|
|
414
|
+
pretty ? V1_RenderStyle.PRETTY : V1_RenderStyle.STANDARD,
|
|
415
|
+
);
|
|
416
|
+
return code;
|
|
417
|
+
}
|
|
418
|
+
|
|
408
419
|
async transformCodeToValueSpeces(
|
|
409
420
|
input: Record<string, V1_GrammarParserBatchInputEntry>,
|
|
410
421
|
): Promise<Map<string, PlainObject>> {
|
|
@@ -422,6 +433,29 @@ export class V1_Engine {
|
|
|
422
433
|
return finalResults;
|
|
423
434
|
}
|
|
424
435
|
|
|
436
|
+
async transformCodeToValueSpec(
|
|
437
|
+
input: string,
|
|
438
|
+
): Promise<PlainObject<V1_ValueSpecification>> {
|
|
439
|
+
try {
|
|
440
|
+
const batchResults =
|
|
441
|
+
await this.engineServerClient.grammarToJSON_valueSpecification(input);
|
|
442
|
+
return batchResults;
|
|
443
|
+
} catch (error) {
|
|
444
|
+
assertErrorThrown(error);
|
|
445
|
+
if (
|
|
446
|
+
error instanceof NetworkClientError &&
|
|
447
|
+
error.response.status === HttpStatus.BAD_REQUEST
|
|
448
|
+
) {
|
|
449
|
+
throw V1_buildParserError(
|
|
450
|
+
V1_ParserError.serialization.fromJson(
|
|
451
|
+
error.payload as PlainObject<V1_ParserError>,
|
|
452
|
+
),
|
|
453
|
+
);
|
|
454
|
+
}
|
|
455
|
+
throw error;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
425
459
|
async transformLambdaToCode(
|
|
426
460
|
lambda: RawLambda,
|
|
427
461
|
pretty: boolean,
|
|
@@ -81,6 +81,7 @@ import type { V1_DatabaseToModelGenerationInput } from './relational/V1_Database
|
|
|
81
81
|
import type { V1_TestDataGenerationInput } from './service/V1_TestDataGenerationInput.js';
|
|
82
82
|
import type { V1_TestDataGenerationResult } from './service/V1_TestDataGenerationResult.js';
|
|
83
83
|
import type { V1_RelationalConnectionBuilder } from './relational/V1_RelationalConnectionBuilder.js';
|
|
84
|
+
import type { V1_LambdaPrefix } from './lambda/V1_LambdaPrefix.js';
|
|
84
85
|
|
|
85
86
|
enum CORE_ENGINE_ACTIVITY_TRACE {
|
|
86
87
|
GRAMMAR_TO_JSON = 'transform Pure code to protocol',
|
|
@@ -191,6 +192,12 @@ export class V1_EngineServerClient extends AbstractServerClient {
|
|
|
191
192
|
getCurrentUserId = (): Promise<string> =>
|
|
192
193
|
this.get(`${this._server()}/currentUser`);
|
|
193
194
|
|
|
195
|
+
// ------------------------------------------- Server -------------------------------------------
|
|
196
|
+
|
|
197
|
+
_lambda = (): string => `${this.baseUrl}/lambda/v1`;
|
|
198
|
+
getLambdaPrefixes = (): Promise<PlainObject<V1_LambdaPrefix>[]> =>
|
|
199
|
+
this.get(`${this._lambda()}/lambdaPrefixes`);
|
|
200
|
+
|
|
194
201
|
// ------------------------------------------- Protocol -------------------------------------------
|
|
195
202
|
|
|
196
203
|
getClassifierPathMap = (): Promise<ClassifierPathMapping[]> =>
|
|
@@ -281,6 +288,19 @@ export class V1_EngineServerClient extends AbstractServerClient {
|
|
|
281
288
|
{ enableCompression: true },
|
|
282
289
|
);
|
|
283
290
|
|
|
291
|
+
grammarToJSON_valueSpecification = (
|
|
292
|
+
input: string,
|
|
293
|
+
): Promise<PlainObject<V1_ValueSpecification>> =>
|
|
294
|
+
this.postWithTracing(
|
|
295
|
+
this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.GRAMMAR_TO_JSON),
|
|
296
|
+
`${this._grammarToJSON()}/valueSpecification`,
|
|
297
|
+
input,
|
|
298
|
+
{},
|
|
299
|
+
undefined,
|
|
300
|
+
undefined,
|
|
301
|
+
{ enableCompression: true },
|
|
302
|
+
);
|
|
303
|
+
|
|
284
304
|
grammarToJSON_relationalOperationElement = (
|
|
285
305
|
input: string,
|
|
286
306
|
sourceId?: string | undefined,
|
|
@@ -381,6 +401,20 @@ export class V1_EngineServerClient extends AbstractServerClient {
|
|
|
381
401
|
{ enableCompression: true },
|
|
382
402
|
);
|
|
383
403
|
|
|
404
|
+
JSONToGrammar_valueSpecification = (
|
|
405
|
+
input: PlainObject<V1_ValueSpecification>,
|
|
406
|
+
renderStyle?: V1_RenderStyle | undefined,
|
|
407
|
+
): Promise<string> =>
|
|
408
|
+
this.postWithTracing(
|
|
409
|
+
this.getTraceData(CORE_ENGINE_ACTIVITY_TRACE.JSON_TO_GRAMMAR),
|
|
410
|
+
`${this._JSONToGrammar()}/valueSpecification`,
|
|
411
|
+
input,
|
|
412
|
+
{},
|
|
413
|
+
{ [HttpHeader.ACCEPT]: ContentType.TEXT_PLAIN },
|
|
414
|
+
{ renderStyle },
|
|
415
|
+
{ enableCompression: false },
|
|
416
|
+
);
|
|
417
|
+
|
|
384
418
|
JSONToGrammar_relationalOperationElement = (
|
|
385
419
|
input: PlainObject<V1_RawRelationalOperationElement>,
|
|
386
420
|
renderStyle?: V1_RenderStyle | undefined,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2020-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 { SerializationFactory } from '@finos/legend-shared';
|
|
18
|
+
import { createModelSchema, primitive } from 'serializr';
|
|
19
|
+
|
|
20
|
+
export class V1_LambdaPrefix {
|
|
21
|
+
platformVersion!: string;
|
|
22
|
+
prefix!: string;
|
|
23
|
+
|
|
24
|
+
static readonly serialization = new SerializationFactory(
|
|
25
|
+
createModelSchema(V1_LambdaPrefix, {
|
|
26
|
+
platformVersion: primitive(),
|
|
27
|
+
prefix: primitive(),
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -128,6 +128,7 @@ export { V1_Multiplicity } from './graph-manager/protocol/pure/v1/model/packagea
|
|
|
128
128
|
export { V1_ExternalFormatDescription } from './graph-manager/protocol/pure/v1/engine/externalFormat/V1_ExternalFormatDescription.js';
|
|
129
129
|
export { V1_ExternalFormatModelGenerationInput } from './graph-manager/protocol/pure/v1/engine/externalFormat/V1_ExternalFormatModelGeneration.js';
|
|
130
130
|
export { V1_ExecuteInput } from './graph-manager/protocol/pure/v1/engine/execution/V1_ExecuteInput.js';
|
|
131
|
+
export { V1_LambdaPrefix } from './graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.js';
|
|
131
132
|
export {
|
|
132
133
|
V1_buildExecutionResult,
|
|
133
134
|
V1_serializeExecutionResult,
|
|
@@ -135,7 +136,6 @@ export {
|
|
|
135
136
|
export { V1_CString } from './graph-manager/protocol/pure/v1/model/valueSpecification/raw/V1_CString.js';
|
|
136
137
|
export { V1_CStrictDate } from './graph-manager/protocol/pure/v1/model/valueSpecification/raw/V1_CStrictDate.js';
|
|
137
138
|
export { V1_INTERNAL__UnknownFunctionActivator } from './graph-manager/protocol/pure/v1/model/packageableElements/function/V1_INTERNAL__UnknownFunctionActivator.js';
|
|
138
|
-
|
|
139
139
|
// --------------------------------------------- EXECUTION PLAN --------------------------------------------------
|
|
140
140
|
|
|
141
141
|
export { INTERNAL__UnknownExecutionResult } from './graph-manager/action/execution/INTERNAL__UnknownExecutionResult.js';
|
package/tsconfig.json
CHANGED
|
@@ -414,6 +414,7 @@
|
|
|
414
414
|
"./src/graph-manager/protocol/pure/v1/engine/grammar/V1_RenderStyle.ts",
|
|
415
415
|
"./src/graph-manager/protocol/pure/v1/engine/import/V1_ImportConfigurationDescription.ts",
|
|
416
416
|
"./src/graph-manager/protocol/pure/v1/engine/import/V1_PureModelContextGenerationInput.ts",
|
|
417
|
+
"./src/graph-manager/protocol/pure/v1/engine/lambda/V1_LambdaPrefix.ts",
|
|
417
418
|
"./src/graph-manager/protocol/pure/v1/engine/query/V1_Query.ts",
|
|
418
419
|
"./src/graph-manager/protocol/pure/v1/engine/query/V1_QuerySearchSpecification.ts",
|
|
419
420
|
"./src/graph-manager/protocol/pure/v1/engine/relational/V1_DatabaseToModelGenerationInput.ts",
|