Skip to content

Commit d8a089d

Browse files
Merge pull request #164 from code0-tech/feat-update-sagittarius-types
Feat update sagittarius types
2 parents a681be4 + d1fbed4 commit d8a089d

File tree

6 files changed

+44
-15
lines changed

6 files changed

+44
-15
lines changed

package/mapper/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package/mapper/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"access": "public"
3030
},
3131
"dependencies": {
32-
"@code0-tech/sagittarius-graphql-types": "^0.0.0-56198dce107a9c09cc5eca0773f239d9c3eba598",
32+
"@code0-tech/sagittarius-graphql-types": "^0.0.0-c63274fdd34593b8aa24f9f977659fd3d6270150",
3333
"@code0-tech/tucana": "^0.0.44",
3434
"@protobuf-ts/runtime": "^2.11.1",
3535
"@protobuf-ts/runtime-rpc": "^2.11.1",

package/mapper/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {DefinitionMapper, Feature} from "./definition/mapper.js";
22
import * as fs from "node:fs";
33
import * as path from "node:path";
44

5-
DefinitionMapper("../../definitions").then((value: Feature[]) => {
5+
DefinitionMapper("../../../definitions").then((value: Feature[]) => {
66
const functions = value.flatMap(v => v.runtimeFunctions);
77
const types = value.flatMap(v => v.dataTypes);
88
const flows = value.flatMap(v => v.flowTypes);

package/mapper/src/mapper/dataTypeMapper.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,45 @@ import {getTranslationConnection} from "./translation.js";
1717
import {Value} from "@code0-tech/tucana/pb/shared.struct_pb.js";
1818

1919
enum GenericCombinationStrategyType {
20+
/** Represents a logical AND combination. */
2021
And = 'AND',
22+
/** Represents a logical OR combination. */
2123
Or = 'OR'
2224
}
2325

2426
enum DataTypeRulesVariant {
27+
/** The rule checks if a key is present in the data type. */
2528
ContainsKey = 'CONTAINS_KEY',
29+
/** The rule checks if a specific type is present in the data type. */
2630
ContainsType = 'CONTAINS_TYPE',
27-
InputType = 'INPUT_TYPE',
31+
/** The rule checks if the data type matches a specific input type. */
32+
InputTypes = 'INPUT_TYPES',
33+
/** The rule checks if an item is part of a collection in the data type. */
2834
ItemOfCollection = 'ITEM_OF_COLLECTION',
35+
/** The rule checks if a number falls within a specified range. */
2936
NumberRange = 'NUMBER_RANGE',
37+
/** The rule checks if the data type is a child of a specific parent type. */
3038
ParentType = 'PARENT_TYPE',
39+
/** The rule checks if a string matches a specified regular expression. */
3140
Regex = 'REGEX',
41+
/** The rule checks if the data type matches a specific return type. */
3242
ReturnType = 'RETURN_TYPE'
3343
}
3444

3545
enum DataTypeVariant {
46+
/** Represents an array */
3647
Array = 'ARRAY',
48+
/** Represents an data type containing a data type */
3749
DataType = 'DATA_TYPE',
50+
/** Represents a error */
3851
Error = 'ERROR',
52+
/** Represents a node */
3953
Node = 'NODE',
54+
/** Represents an object */
4055
Object = 'OBJECT',
56+
/** Represents a primitive datatype */
4157
Primitive = 'PRIMITIVE',
58+
/** Represents a type */
4259
Type = 'TYPE'
4360
}
4461

@@ -51,9 +68,12 @@ function getDataType(identifier: string, constructedDataTypes: ConstructedDataTy
5168
return null
5269
}
5370
const constructed: DataType = {
71+
__typename: "DataType",
5472
id: `gid://sagittarius/DataType/${getID(constructedDataTypes)}`,
5573
genericKeys: tucanaDataType.genericKeys,
5674
identifier: tucanaDataType.identifier,
75+
aliases: getTranslationConnection(tucanaDataType.alias),
76+
displayMessages: getTranslationConnection(tucanaDataType.displayMessage),
5777
name: getTranslationConnection(tucanaDataType.name),
5878
rules: createRules(tucanaDataType.rules, constructedDataTypes),
5979
variant: getDataTypeVariant(tucanaDataType.variant),
@@ -135,7 +155,7 @@ function createRules(rule: DefinitionDataTypeRule[], constructedDataTypes: Const
135155
}),
136156
}
137157
const rule : DataTypeRule = {
138-
variant: DataTypeRulesVariant.InputType,
158+
variant: DataTypeRulesVariant.InputTypes,
139159
config: ruleConfig
140160
}
141161
return rule;

package/mapper/src/mapper/flowTypeMapper.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,30 @@ import {ConstructedDataTypes, getID} from "../definition/mapper.js";
66

77
function mapFlowType(flowType: TucanaFlowType, constructed: ConstructedDataTypes): FlowType | null {
88
return {
9-
id: `gid://sagittarius/TypesFlowType/${getID(constructed)}`,
9+
__typename: "FlowType",
10+
id: `gid://sagittarius/FlowType/${getID(constructed)}`,
1011
identifier: flowType.identifier,
1112
inputType: getDataType(flowType.inputTypeIdentifier!!, constructed),
1213
returnType: getDataType(flowType.returnTypeIdentifier!!, constructed),
1314
flowTypeSettings: createFlowTypeSetting(flowType.settings, constructed),
1415
names: getTranslationConnection(flowType.name),
1516
descriptions: getTranslationConnection(flowType.description),
17+
aliases: getTranslationConnection(flowType.alias),
18+
displayMessages: getTranslationConnection(flowType.displayMessage),
1619
editable: flowType.editable
1720
}
1821
}
1922

2023
function createFlowTypeSetting(settings: TucanaFlowTypeSetting[], constructed: ConstructedDataTypes): FlowTypeSetting[] {
2124
return settings.map(setting => {
2225
const flowSetting: FlowTypeSetting = {
26+
__typename: "FlowTypeSetting",
2327
id: `gid://sagittarius/FlowTypeSetting/${getID(constructed)}`,
2428
names: getTranslationConnection(setting.name),
2529
descriptions: getTranslationConnection(setting.description),
2630
dataType: getDataType(setting.dataTypeIdentifier, constructed),
2731
identifier: setting.identifier,
28-
unique: setting.unique
32+
unique: setting.unique,
2933
}
3034

3135
return flowSetting;

package/mapper/src/mapper/functionMapper.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,24 @@ import {ConstructedDataTypes, getID} from "../definition/mapper.js";
88
import {getTranslationConnection} from "./translation.js";
99

1010
function mapFunction(func: TucanaFunction, constructed: ConstructedDataTypes): FunctionDefinition | null {
11-
return {
11+
return {
12+
__typename: "FunctionDefinition",
1213
id: `gid://sagittarius/FunctionDefinition/${getID(constructed)}`,
1314
genericKeys: func.genericKeys,
1415
names: getTranslationConnection(func.name),
1516
descriptions: getTranslationConnection(func.description),
1617
documentations: getTranslationConnection(func.documentation),
1718
deprecationMessages: getTranslationConnection(func.deprecationMessage),
19+
identifier: func.runtimeName,
20+
displayMessages: getTranslationConnection(func.displayMessage),
21+
aliases: getTranslationConnection(func.alias),
1822
throwsError: func.throwsError,
1923
returnType: getDataTypeIdentifier(func.returnTypeIdentifier, constructed),
2024
parameterDefinitions: getParameterDefinitionConnection(func.runtimeParameterDefinitions, constructed),
21-
runtimeFunctionDefinition: {
22-
id: `gid://sagittarius/RuntimeFunctionDefinition/${getID(constructed)}`,
23-
identifier: func.runtimeName
24-
}
25+
runtimeFunctionDefinition: {
26+
id: `gid://sagittarius/RuntimeFunctionDefinition/${getID(constructed)}`,
27+
identifier: func.runtimeName
28+
}
2529
}
2630
}
2731

@@ -30,6 +34,7 @@ function getParameterDefinitionConnection(def: RuntimeParameterDefinition[], con
3034
count: def.length,
3135
nodes: def.map(node => {
3236
return {
37+
__typename: "ParameterDefinition",
3338
id: `gid://sagittarius/ParameterDefinition/${getID(constructed)}`,
3439
names: getTranslationConnection(node.name),
3540
identifier: node.runtimeName,

0 commit comments

Comments
 (0)