Skip to content

Commit 9689387

Browse files
author
Nico Sammito
authored
Merge pull request #609 from code0-tech/feat/sagittarius-update
Sagittarius update
2 parents 7cb95a7 + 2d078e0 commit 9689387

18 files changed

Lines changed: 157 additions & 107 deletions

package-lock.json

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

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@
2020
"@ariakit/react": "^0.4.17",
2121
"@babel/plugin-proposal-decorators": "^7.29.0",
2222
"@babel/plugin-transform-class-properties": "^7.28.6",
23-
"@code0-tech/sagittarius-graphql-types": "^0.0.0-e610ffe24a7dc3cf7b4c285994830412410f229e",
23+
"@code0-tech/sagittarius-graphql-types": "^0.0.0-703d578a55a3f0f20be3cb6892418f9e04d25716",
24+
"@codemirror/autocomplete": "^6.20.0",
25+
"@codemirror/lang-json": "^6.0.2",
2426
"@dagrejs/dagre": "^2.0.3",
2527
"@mdx-js/react": "^3.1.1",
28+
"@monaco-editor/react": "^4.7.0",
2629
"@radix-ui/react-checkbox": "^1.3.3",
2730
"@radix-ui/react-context-menu": "^2.2.16",
2831
"@radix-ui/react-dialog": "^1.1.15",
@@ -31,7 +34,6 @@
3134
"@radix-ui/react-one-time-password-field": "^0.1.8",
3235
"@radix-ui/react-radio-group": "^1.3.8",
3336
"@radix-ui/react-scroll-area": "^1.2.10",
34-
"ldrs": "^1.1.9",
3537
"@radix-ui/react-tabs": "^1.1.13",
3638
"@radix-ui/react-toggle-group": "^1.1.11",
3739
"@radix-ui/react-tooltip": "^1.2.8",
@@ -52,6 +54,8 @@
5254
"@types/react": "^19.2.8",
5355
"@types/react-dom": "^19.2.3",
5456
"@types/react-syntax-highlighter": "^15.5.13",
57+
"@uiw/codemirror-themes": "^4.25.4",
58+
"@uiw/react-codemirror": "^4.25.4",
5559
"@vitejs/plugin-react": "^5.1.3",
5660
"@vitest/browser-playwright": "^4.0.17",
5761
"@vitest/coverage-v8": "^4.0.17",
@@ -66,13 +70,15 @@
6670
"identity-obj-proxy": "^3.0.0",
6771
"jest-image-snapshot": "^6.5.1",
6872
"js-md5": "^0.8.3",
73+
"ldrs": "^1.1.9",
6974
"merge-props": "^6.0.0",
7075
"overlap-area": "^1.1.0",
7176
"playwright": "1.58.1",
7277
"react": "^19.2.3",
7378
"react-contenteditable": "^3.3.7",
7479
"react-dom": "^19.2.3",
7580
"react-resizable-panels": "^4.6.2",
81+
"react-syntax-highlighter": "^16.1.0",
7682
"react-zoom-pan-pinch": "^3.7.0",
7783
"rimraf": "^6.1.2",
7884
"sass": "^1.97.2",
@@ -86,13 +92,7 @@
8692
"vite": "^7.3.1",
8793
"vite-plugin-dts": "^4.5.4",
8894
"vite-plugin-lib-inject-css": "^2.2.2",
89-
"vitest": "^4.0.17",
90-
"@codemirror/autocomplete": "^6.20.0",
91-
"@codemirror/lang-json": "^6.0.2",
92-
"@monaco-editor/react": "^4.7.0",
93-
"@uiw/codemirror-themes": "^4.25.4",
94-
"@uiw/react-codemirror": "^4.25.4",
95-
"react-syntax-highlighter": "^16.1.0"
95+
"vitest": "^4.0.17"
9696
},
9797
"main": "dist/index.js",
9898
"repository": {
@@ -105,7 +105,10 @@
105105
"types": "dist/index.d.ts",
106106
"peerDependencies": {
107107
"@ariakit/react": "^0.4.17",
108-
"@code0-tech/sagittarius-graphql-types": "0.0.0-e610ffe24a7dc3cf7b4c285994830412410f229e",
108+
"@code0-tech/sagittarius-graphql-types": "0.0.0-703d578a55a3f0f20be3cb6892418f9e04d25716",
109+
"@codemirror/autocomplete": "^6.20.0",
110+
"@codemirror/lang-json": "^6.0.2",
111+
"@monaco-editor/react": "^4.7.0",
109112
"@radix-ui/react-checkbox": "^1.3.3",
110113
"@radix-ui/react-context-menu": "^2.2.16",
111114
"@radix-ui/react-dialog": "^1.1.15",
@@ -118,24 +121,21 @@
118121
"@radix-ui/react-toggle-group": "^1.1.11",
119122
"@radix-ui/react-tooltip": "^1.2.8",
120123
"@tabler/icons-react": "3.36.1",
124+
"@uiw/codemirror-themes": "^4.25.4",
125+
"@uiw/react-codemirror": "^4.25.4",
121126
"@xyflow/react": "^12.10.0",
122127
"cmdk": "^1.1.1",
123128
"js-md5": "^0.8.3",
129+
"ldrs": "^1.1.9",
124130
"merge-props": "^6.0.0",
125131
"overlap-area": "^1.1.0",
126132
"react": "^18.0.0 || ^19.0.0",
127133
"react-contenteditable": "^3.3.7",
128134
"react-dom": "^18.0.0 || ^19.0.0",
129135
"react-resizable-panels": "^4.3.1",
130-
"react-zoom-pan-pinch": "^3.7.0",
131-
"sonner": "^2.0.7",
132-
"@codemirror/autocomplete": "^6.20.0",
133-
"@codemirror/lang-json": "^6.0.2",
134-
"@monaco-editor/react": "^4.7.0",
135-
"@uiw/codemirror-themes": "^4.25.4",
136-
"@uiw/react-codemirror": "^4.25.4",
137136
"react-syntax-highlighter": "^16.1.0",
138-
"ldrs": "^1.1.9"
137+
"react-zoom-pan-pinch": "^3.7.0",
138+
"sonner": "^2.0.7"
139139
},
140140
"publishConfig": {
141141
"access": "public"

src/components/d-flow-data-type/DFlowDataType.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
DataTypeIdentifier,
66
DataTypeRule,
77
DataTypeRulesContainsKeyConfig,
8-
DataTypeRulesInputTypesConfig, DataTypeRulesVariant,
8+
DataTypeRulesInputTypesConfig,
9+
DataTypeRulesVariant,
910
Flow,
1011
GenericMapper,
1112
LiteralValue,
@@ -19,6 +20,7 @@ import {
1920
import {useValueValidation} from "../d-flow-validation/DValueValidation.hook";
2021
import {findReturnNode} from "./rules/DFlowDataTypeReturnTypeRule";
2122
import {md5} from "js-md5";
23+
import {useReturnTypes} from "../d-flow-node/DFlowNode.return.hook";
2224

2325
export type DFlowDataTypeDependencies = {
2426
namespaceId: Namespace['id']
@@ -150,8 +152,6 @@ export abstract class DFlowDataTypeReactiveService extends ReactiveArrayService<
150152

151153
if (!value) return undefined
152154

153-
if (value.__typename === "ReferenceValue") return value.dataTypeIdentifier
154-
155155
const dataType = this.getDataTypeFromValue(value, flow, dependencies)
156156
if ((dataType?.genericKeys?.length ?? 0) <= 0 || !dataType?.genericKeys) return {
157157
dataType: {

src/components/d-flow-data-type/rules/DFlowDataTypeContainsKeyRule.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ import {useValueValidation} from "../../d-flow-validation/DValueValidation.hook"
1212

1313
@staticImplements<DFlowDataTypeRule>()
1414
export class DFlowDataTypeContainsKeyRule {
15-
public static validate(value: NodeParameterValue, config: DataTypeRulesContainsKeyConfig, generics?: Map<string, GenericMapper>, service?: DFlowDataTypeReactiveService, flow?: Flow): boolean {
15+
public static validate(value: NodeParameterValue, config: DataTypeRulesContainsKeyConfig, generics?: Map<string, GenericMapper>, flow?: Flow, dataTypeService?: DFlowDataTypeReactiveService): boolean {
1616

1717
const genericMapper = generics?.get(config?.dataTypeIdentifier?.genericKey!!)
1818
const genericTypes = generics?.get(config?.dataTypeIdentifier?.genericKey!!)?.sourceDataTypeIdentifiers
1919
const genericCombination = generics?.get(config?.dataTypeIdentifier?.genericKey!!)?.genericCombinationStrategies
2020

2121
//TODO: seperate general validation
2222
//if (!(isObject(value))) return false
23-
if ((config?.key ?? "") in value && config?.dataTypeIdentifier?.genericKey && !genericMapper && !service?.getDataType(config.dataTypeIdentifier)) return true
23+
if ((config?.key ?? "") in value && config?.dataTypeIdentifier?.genericKey && !genericMapper && !dataTypeService?.getDataType(config.dataTypeIdentifier)) return true
2424

25-
if (!(service?.getDataType(config.dataTypeIdentifier!!) || genericMapper)) return false
25+
if (!(dataTypeService?.getDataType(config.dataTypeIdentifier!!) || genericMapper)) return false
2626

2727
//use of generic key but datatypes does not exist
28-
if (genericMapper && !service?.hasDataTypes(genericTypes!!)) return false
28+
if (genericMapper && !dataTypeService?.hasDataTypes(genericTypes!!)) return false
2929

3030
//check if all generic combinations are set
3131
if (genericMapper && !(((genericCombination?.length ?? 0) + 1) == genericTypes!!.length)) return false
3232

3333
//use generic given type for checking against value
3434
if (config?.dataTypeIdentifier?.genericKey && genericMapper && genericTypes) {
3535
const checkAllTypes: boolean[] = genericTypes.map(genericType => {
36-
return useValueValidation((value as LiteralValue).value[(config?.key ?? "")], service?.getDataType(genericType)!!, service!!, flow, ((genericType.genericType)!!.genericMappers as GenericMapper[]))
36+
return useValueValidation((value as LiteralValue).value[(config?.key ?? "")], dataTypeService?.getDataType(genericType)!!, dataTypeService!!, flow, ((genericType.genericType)!!.genericMappers as GenericMapper[]))
3737
})
3838

3939
const combination = checkAllTypes.length > 1 ? checkAllTypes.reduce((previousValue, currentValue, currentIndex) => {
@@ -49,9 +49,9 @@ export class DFlowDataTypeContainsKeyRule {
4949

5050
//normal datatype link
5151
if (config?.dataTypeIdentifier?.dataType) {
52-
return ((config?.key ?? "") in value) && useValueValidation((value as LiteralValue).value[(config?.key ?? "")], service?.getDataType(config.dataTypeIdentifier)!!, service!!)
52+
return ((config?.key ?? "") in value) && useValueValidation((value as LiteralValue).value[(config?.key ?? "")], dataTypeService?.getDataType(config.dataTypeIdentifier)!!, dataTypeService!!)
5353
}
5454

55-
return ((config?.key ?? "") in value) && useValueValidation((value as LiteralValue).value[(config?.key ?? "")], service?.getDataType(config.dataTypeIdentifier!!)!!, service!!, flow, genericMapping(config?.dataTypeIdentifier?.genericType?.genericMappers!!, generics))
55+
return ((config?.key ?? "") in value) && useValueValidation((value as LiteralValue).value[(config?.key ?? "")], dataTypeService?.getDataType(config.dataTypeIdentifier!!)!!, dataTypeService!!, flow, genericMapping(config?.dataTypeIdentifier?.genericType?.genericMappers!!, generics))
5656
}
5757
}

src/components/d-flow-data-type/rules/DFlowDataTypeContainsTypeRule.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {useValueValidation} from "../../d-flow-validation/DValueValidation.hook"
1212

1313
@staticImplements<DFlowDataTypeRule>()
1414
export class DFlowDataTypeContainsTypeRule {
15-
public static validate(value: NodeParameterValue, config: DataTypeRulesContainsKeyConfig, generics?: Map<string, GenericMapper>, service?: DFlowDataTypeReactiveService, flow?: Flow): boolean {
15+
public static validate(value: NodeParameterValue, config: DataTypeRulesContainsKeyConfig, generics?: Map<string, GenericMapper>, flow?: Flow, dataTypeService?: DFlowDataTypeReactiveService): boolean {
1616

1717
const genericMapper = generics?.get(config?.dataTypeIdentifier?.genericKey!!)
1818
const genericTypes = generics?.get(config?.dataTypeIdentifier?.genericKey!!)?.sourceDataTypeIdentifiers
@@ -21,12 +21,12 @@ export class DFlowDataTypeContainsTypeRule {
2121
//TODO: seperate general validation
2222
if ("value" in value && !(Array.isArray(value.value))) return false
2323

24-
if (config?.dataTypeIdentifier?.genericKey && !genericMapper && !service?.getDataType(config.dataTypeIdentifier)) return true
24+
if (config?.dataTypeIdentifier?.genericKey && !genericMapper && !dataTypeService?.getDataType(config.dataTypeIdentifier)) return true
2525

26-
if (!(service?.getDataType(config.dataTypeIdentifier!!) || genericMapper)) return false
26+
if (!(dataTypeService?.getDataType(config.dataTypeIdentifier!!) || genericMapper)) return false
2727

2828
//use of generic key but datatype does not exist
29-
if (genericMapper && !service?.hasDataTypes(genericTypes!!)) return false
29+
if (genericMapper && !dataTypeService?.hasDataTypes(genericTypes!!)) return false
3030

3131
//check if all generic combinations are set
3232
if (genericMapper && !(((genericCombination?.length ?? 0) + 1) == genericTypes!!.length)) return false
@@ -39,12 +39,12 @@ export class DFlowDataTypeContainsTypeRule {
3939
return useValueValidation({
4040
__typename: "LiteralValue",
4141
value: value1
42-
}, service?.getDataType(genericType)!!, service!!, flow, ((genericType.genericType as GenericType)!!.genericMappers as GenericMapper[]))
42+
}, dataTypeService?.getDataType(genericType)!!, dataTypeService!!, flow, ((genericType.genericType as GenericType)!!.genericMappers as GenericMapper[]))
4343
}
4444
return useValueValidation({
4545
__typename: "LiteralValue",
4646
value: value1
47-
}, service?.getDataType(genericType)!!, service!!, flow)
47+
}, dataTypeService?.getDataType(genericType)!!, dataTypeService!!, flow)
4848
})
4949
})
5050

@@ -59,10 +59,10 @@ export class DFlowDataTypeContainsTypeRule {
5959

6060
//normal datatype link
6161
if (config?.dataTypeIdentifier?.dataType) {
62-
return (value as LiteralValue).value.every((value1: any) => useValueValidation(value1, service?.getDataType(config.dataTypeIdentifier!!)!!, service!!))
62+
return (value as LiteralValue).value.every((value1: any) => useValueValidation(value1, dataTypeService?.getDataType(config.dataTypeIdentifier!!)!!, dataTypeService!!))
6363
}
6464

65-
return (value as LiteralValue).value.every((value1: any) => useValueValidation(value1, service?.getDataType(config.dataTypeIdentifier!!)!!, service!!, flow, genericMapping((config.dataTypeIdentifier?.genericType as GenericType).genericMappers!!, generics)))
65+
return (value as LiteralValue).value.every((value1: any) => useValueValidation(value1, dataTypeService?.getDataType(config.dataTypeIdentifier!!)!!, dataTypeService!!, flow, genericMapping((config.dataTypeIdentifier?.genericType as GenericType).genericMappers!!, generics)))
6666

6767
}
6868
}

src/components/d-flow-data-type/rules/DFlowDataTypeParentRule.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export interface DFlowDataTypeParentRuleConfig {
1010

1111
@staticImplements<DFlowDataTypeRule>()
1212
export class DFlowDataTypeParentRule {
13-
public static validate(value: NodeParameterValue, config: DFlowDataTypeParentRuleConfig, generics?: Map<string, GenericMapper>, service?: DFlowDataTypeReactiveService, flow?: Flow): boolean {
13+
public static validate(value: NodeParameterValue, config: DFlowDataTypeParentRuleConfig, generics?: Map<string, GenericMapper>, flow?: Flow, dataTypeService?: DFlowDataTypeReactiveService): boolean {
1414

1515
const replacedType = generics ? replaceGenericKeysInType(config.type, generics) : config.type
1616

17-
if (!service) return false
18-
return useValueValidation(value, service.getDataType(replacedType)!!, service, flow, Array.from(generics!!, ([_, value]) => value))
17+
if (!dataTypeService) return false
18+
return useValueValidation(value, dataTypeService.getDataType(replacedType)!!, dataTypeService, flow, Array.from(generics!!, ([_, value]) => value))
1919

2020
}
2121
}

0 commit comments

Comments
 (0)