Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@joyautomation/tentacle",
"version": "0.0.43",
"version": "0.0.44",
"description": "Tentacle is a modern soft PLC",
"author": "Joy Automation",
"license": "Apache-2.0",
Expand Down
22 changes: 22 additions & 0 deletions plc/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
isSourceRedis,
isVariableModbusSourceRuntime,
isVariableOpcuaSourceRuntime,
isVariableRedisSourceRuntime,
type PlcVariableRedisSourceRuntime,
type PlcSource,
type PlcSourceRuntime,
type PlcSources,
Expand Down Expand Up @@ -82,6 +84,9 @@ export function addPlcToSchema<
const PlcRuntimeVariableMqttSourceRef = builder.objectRef<
PlcVariableMqttSourceRuntime<M>
>("PlcVariableMqttSourceRuntime");
const PlcRuntimeVariableRedisSourceRef = builder.objectRef<
PlcVariableRedisSourceRuntime<S, unknown>
>("PlcVariableRedisSourceRuntime");
const PlcRuntimeVariableErrorRef = builder.objectRef<{
error: string | null;
message?: string | null;
Expand Down Expand Up @@ -122,6 +127,7 @@ export function addPlcToSchema<
PlcRuntimeVariableOpcuaSourceRef,
PlcRuntimeVariableRestSourceRef,
PlcRuntimeVariableMqttSourceRef,
PlcRuntimeVariableRedisSourceRef,
],
resolveType: (source) => {
if (isSourceModbus(source)) {
Expand All @@ -136,6 +142,9 @@ export function addPlcToSchema<
if (isSourceMqtt(source)) {
return "PlcVariableMqttSourceRuntime";
}
if (isSourceRedis(source)) {
return "PlcVariableRedisSourceRuntime";
}
return undefined;
},
}
Expand Down Expand Up @@ -320,6 +329,16 @@ export function addPlcToSchema<
}),
}),
});
PlcRuntimeVariableRedisSourceRef.implement({
fields: (t) => ({
id: t.string({
resolve: (parent) => parent.id.toString(),
}),
type: t.exposeString("type"),
key: t.exposeString("key"),
bidirectional: t.exposeBoolean("bidirectional"),
}),
});
PlcRuntimeVariableRef.implement({
fields: (t) => ({
id: t.exposeString("id"),
Expand Down Expand Up @@ -364,6 +383,9 @@ export function addPlcToSchema<
if (isVariableMqttSourceRuntime(source)) {
return source;
}
if (isVariableRedisSourceRuntime(source)) {
return source;
}
}
return null;
},
Expand Down