From 9fcb886b63ee134107229115c9222b0dd0a79184 Mon Sep 17 00:00:00 2001 From: nicosammito Date: Wed, 3 Dec 2025 11:37:09 +0100 Subject: [PATCH 1/3] Update @code0-tech/sagittarius-graphql-types to version 0.0.0-c63274fdd --- package/mapper/package-lock.json | 8 ++++---- package/mapper/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/mapper/package-lock.json b/package/mapper/package-lock.json index 495d897..67066ec 100644 --- a/package/mapper/package-lock.json +++ b/package/mapper/package-lock.json @@ -8,7 +8,7 @@ "name": "@code0-tech/definition-mapper", "version": "0.0.0", "dependencies": { - "@code0-tech/sagittarius-graphql-types": "^0.0.0-56198dce107a9c09cc5eca0773f239d9c3eba598", + "@code0-tech/sagittarius-graphql-types": "^0.0.0-c63274fdd34593b8aa24f9f977659fd3d6270150", "@code0-tech/tucana": "^0.0.44", "@protobuf-ts/runtime": "^2.11.1", "@protobuf-ts/runtime-rpc": "^2.11.1", @@ -67,9 +67,9 @@ } }, "node_modules/@code0-tech/sagittarius-graphql-types": { - "version": "0.0.0-f91466f0f343596ad170e7e5c5316a70b072594d", - "resolved": "https://registry.npmjs.org/@code0-tech/sagittarius-graphql-types/-/sagittarius-graphql-types-0.0.0-f91466f0f343596ad170e7e5c5316a70b072594d.tgz", - "integrity": "sha512-vXnbsCw1n3KhWX0ZutKR9xmspEyg9/cZspSMPTPyD8sSTDcPooei1967GlsfpPKfsJGPLzrMKxMRUS/ANXlATg==" + "version": "0.0.0-c63274fdd34593b8aa24f9f977659fd3d6270150", + "resolved": "https://registry.npmjs.org/@code0-tech/sagittarius-graphql-types/-/sagittarius-graphql-types-0.0.0-c63274fdd34593b8aa24f9f977659fd3d6270150.tgz", + "integrity": "sha512-6J0DC2OdNnZRcS7jJkwCIEv4PoQmpDMdR4FAdVKfrE08X4PZAD+csVf0zTVjmX82KFzVL0M46HB/6twpKCsRUg==" }, "node_modules/@code0-tech/tucana": { "version": "0.0.44", diff --git a/package/mapper/package.json b/package/mapper/package.json index 073f9d4..f9d2d4f 100644 --- a/package/mapper/package.json +++ b/package/mapper/package.json @@ -29,7 +29,7 @@ "access": "public" }, "dependencies": { - "@code0-tech/sagittarius-graphql-types": "^0.0.0-56198dce107a9c09cc5eca0773f239d9c3eba598", + "@code0-tech/sagittarius-graphql-types": "^0.0.0-c63274fdd34593b8aa24f9f977659fd3d6270150", "@code0-tech/tucana": "^0.0.44", "@protobuf-ts/runtime": "^2.11.1", "@protobuf-ts/runtime-rpc": "^2.11.1", From 7bc38342fa3b879a27591351b9a86a6e957d105f Mon Sep 17 00:00:00 2001 From: nicosammito Date: Wed, 3 Dec 2025 11:57:44 +0100 Subject: [PATCH 2/3] Enhance data type mappers with additional type definitions and properties --- package/mapper/src/mapper/dataTypeMapper.ts | 24 +++++++++++++++++++-- package/mapper/src/mapper/flowTypeMapper.ts | 8 +++++-- package/mapper/src/mapper/functionMapper.ts | 15 ++++++++----- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/package/mapper/src/mapper/dataTypeMapper.ts b/package/mapper/src/mapper/dataTypeMapper.ts index 05b8481..0abe349 100644 --- a/package/mapper/src/mapper/dataTypeMapper.ts +++ b/package/mapper/src/mapper/dataTypeMapper.ts @@ -17,28 +17,45 @@ import {getTranslationConnection} from "./translation.js"; import {Value} from "@code0-tech/tucana/pb/shared.struct_pb.js"; enum GenericCombinationStrategyType { + /** Represents a logical AND combination. */ And = 'AND', + /** Represents a logical OR combination. */ Or = 'OR' } enum DataTypeRulesVariant { + /** The rule checks if a key is present in the data type. */ ContainsKey = 'CONTAINS_KEY', + /** The rule checks if a specific type is present in the data type. */ ContainsType = 'CONTAINS_TYPE', - InputType = 'INPUT_TYPE', + /** The rule checks if the data type matches a specific input type. */ + InputTypes = 'INPUT_TYPES', + /** The rule checks if an item is part of a collection in the data type. */ ItemOfCollection = 'ITEM_OF_COLLECTION', + /** The rule checks if a number falls within a specified range. */ NumberRange = 'NUMBER_RANGE', + /** The rule checks if the data type is a child of a specific parent type. */ ParentType = 'PARENT_TYPE', + /** The rule checks if a string matches a specified regular expression. */ Regex = 'REGEX', + /** The rule checks if the data type matches a specific return type. */ ReturnType = 'RETURN_TYPE' } enum DataTypeVariant { + /** Represents an array */ Array = 'ARRAY', + /** Represents an data type containing a data type */ DataType = 'DATA_TYPE', + /** Represents a error */ Error = 'ERROR', + /** Represents a node */ Node = 'NODE', + /** Represents an object */ Object = 'OBJECT', + /** Represents a primitive datatype */ Primitive = 'PRIMITIVE', + /** Represents a type */ Type = 'TYPE' } @@ -51,9 +68,12 @@ function getDataType(identifier: string, constructedDataTypes: ConstructedDataTy return null } const constructed: DataType = { + __typename: "DataType", id: `gid://sagittarius/DataType/${getID(constructedDataTypes)}`, genericKeys: tucanaDataType.genericKeys, identifier: tucanaDataType.identifier, + aliases: getTranslationConnection(tucanaDataType.alias), + displayMessages: getTranslationConnection(tucanaDataType.displayMessage), name: getTranslationConnection(tucanaDataType.name), rules: createRules(tucanaDataType.rules, constructedDataTypes), variant: getDataTypeVariant(tucanaDataType.variant), @@ -135,7 +155,7 @@ function createRules(rule: DefinitionDataTypeRule[], constructedDataTypes: Const }), } const rule : DataTypeRule = { - variant: DataTypeRulesVariant.InputType, + variant: DataTypeRulesVariant.InputTypes, config: ruleConfig } return rule; diff --git a/package/mapper/src/mapper/flowTypeMapper.ts b/package/mapper/src/mapper/flowTypeMapper.ts index 53424e9..d6efeb9 100644 --- a/package/mapper/src/mapper/flowTypeMapper.ts +++ b/package/mapper/src/mapper/flowTypeMapper.ts @@ -6,13 +6,16 @@ import {ConstructedDataTypes, getID} from "../definition/mapper.js"; function mapFlowType(flowType: TucanaFlowType, constructed: ConstructedDataTypes): FlowType | null { return { - id: `gid://sagittarius/TypesFlowType/${getID(constructed)}`, + __typename: "FlowType", + id: `gid://sagittarius/FlowType/${getID(constructed)}`, identifier: flowType.identifier, inputType: getDataType(flowType.inputTypeIdentifier!!, constructed), returnType: getDataType(flowType.returnTypeIdentifier!!, constructed), flowTypeSettings: createFlowTypeSetting(flowType.settings, constructed), names: getTranslationConnection(flowType.name), descriptions: getTranslationConnection(flowType.description), + aliases: getTranslationConnection(flowType.alias), + displayMessages: getTranslationConnection(flowType.displayMessage), editable: flowType.editable } } @@ -20,12 +23,13 @@ function mapFlowType(flowType: TucanaFlowType, constructed: ConstructedDataTypes function createFlowTypeSetting(settings: TucanaFlowTypeSetting[], constructed: ConstructedDataTypes): FlowTypeSetting[] { return settings.map(setting => { const flowSetting: FlowTypeSetting = { + __typename: "FlowTypeSetting", id: `gid://sagittarius/FlowTypeSetting/${getID(constructed)}`, names: getTranslationConnection(setting.name), descriptions: getTranslationConnection(setting.description), dataType: getDataType(setting.dataTypeIdentifier, constructed), identifier: setting.identifier, - unique: setting.unique + unique: setting.unique, } return flowSetting; diff --git a/package/mapper/src/mapper/functionMapper.ts b/package/mapper/src/mapper/functionMapper.ts index 221e203..de89d28 100644 --- a/package/mapper/src/mapper/functionMapper.ts +++ b/package/mapper/src/mapper/functionMapper.ts @@ -8,20 +8,24 @@ import {ConstructedDataTypes, getID} from "../definition/mapper.js"; import {getTranslationConnection} from "./translation.js"; function mapFunction(func: TucanaFunction, constructed: ConstructedDataTypes): FunctionDefinition | null { - return { + return { + __typename: "FunctionDefinition", id: `gid://sagittarius/FunctionDefinition/${getID(constructed)}`, genericKeys: func.genericKeys, names: getTranslationConnection(func.name), descriptions: getTranslationConnection(func.description), documentations: getTranslationConnection(func.documentation), deprecationMessages: getTranslationConnection(func.deprecationMessage), + identifier: func.runtimeName, + displayMessages: getTranslationConnection(func.displayMessage), + aliases: getTranslationConnection(func.alias), throwsError: func.throwsError, returnType: getDataTypeIdentifier(func.returnTypeIdentifier, constructed), parameterDefinitions: getParameterDefinitionConnection(func.runtimeParameterDefinitions, constructed), - runtimeFunctionDefinition: { - id: `gid://sagittarius/RuntimeFunctionDefinition/${getID(constructed)}`, - identifier: func.runtimeName - } + runtimeFunctionDefinition: { + id: `gid://sagittarius/RuntimeFunctionDefinition/${getID(constructed)}`, + identifier: func.runtimeName + } } } @@ -30,6 +34,7 @@ function getParameterDefinitionConnection(def: RuntimeParameterDefinition[], con count: def.length, nodes: def.map(node => { return { + __typename: "ParameterDefinition", id: `gid://sagittarius/ParameterDefinition/${getID(constructed)}`, names: getTranslationConnection(node.name), identifier: node.runtimeName, From d1fbed469d2d57395a146dc14c1bbab46951108c Mon Sep 17 00:00:00 2001 From: nicosammito Date: Wed, 3 Dec 2025 12:37:32 +0100 Subject: [PATCH 3/3] Fix path in DefinitionMapper to correctly reference definitions --- package/mapper/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/mapper/src/index.ts b/package/mapper/src/index.ts index feacd0c..2869011 100644 --- a/package/mapper/src/index.ts +++ b/package/mapper/src/index.ts @@ -2,7 +2,7 @@ import {DefinitionMapper, Feature} from "./definition/mapper.js"; import * as fs from "node:fs"; import * as path from "node:path"; -DefinitionMapper("../../definitions").then((value: Feature[]) => { +DefinitionMapper("../../../definitions").then((value: Feature[]) => { const functions = value.flatMap(v => v.runtimeFunctions); const types = value.flatMap(v => v.dataTypes); const flows = value.flatMap(v => v.flowTypes);