-
Notifications
You must be signed in to change notification settings - Fork 0
Cleanup sdk #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cleanup sdk #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| source 'https://rubygems.org' | ||
|
|
||
| ruby '3.4.7' | ||
|
|
||
|
|
||
| gem 'tucana', '0.0.56' | ||
| gem 'grpc', '~> 1.67' | ||
| gem 'tucana', '0.0.56' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,50 +1,29 @@ | ||
| import { createSdk } from "../src/action_sdk.js"; | ||
| import { Struct, Value } from "@code0-tech/tucana/pb/shared.struct_pb.js"; | ||
| import { constructValue } from "@code0-tech/tucana/helpers/shared.struct_helper.js"; | ||
| import { ActionProjectConfiguration } from "@code0-tech/tucana/pb/shared.action_configuration_pb.js"; | ||
| import {randomUUID} from "node:crypto"; | ||
|
|
||
| const sdk = createSdk({ | ||
| token: "your_token_here", | ||
| token: randomUUID(), | ||
| actionUrl: "127.0.0.1:50051", | ||
| actionId: "action_123", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does this id come from?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its just an auth token currently just an random identifier for the test server |
||
| version: "0.0.0", | ||
| }) | ||
|
|
||
| sdk.registerConfigDefinitions({ | ||
| type: { | ||
| signature: "string", | ||
| identifier: "STRING", | ||
| version: "0.0.0", | ||
| rules: [], | ||
| name: [], | ||
| genericKeys: [], | ||
| alias: [], | ||
| displayMessage: [], | ||
| linkedDataTypeIdentifiers: [], | ||
| definitionSource: "" | ||
| }, | ||
| name: [], | ||
| description: [], | ||
| type: "LIST<STRING>", | ||
| linkedDataTypeIdentifiers: ["STRING", "LIST"], | ||
| identifier: "config_discord_bot_token", | ||
| }) | ||
|
Comment on lines
13
to
17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be parsed in as the root sdk object |
||
|
|
||
| sdk.registerDataType({ | ||
| identifier: "SOME_DATATYPE", | ||
| signature: "any", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its named type not signature
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should discuss this naming in tucana then |
||
| name: [], | ||
| alias: [], | ||
| rules: [], | ||
| genericKeys: [], | ||
| displayMessage: [], | ||
| definitionSource: "", | ||
| linkedDataTypeIdentifiers: [], | ||
| version: "0.0.0", | ||
| }) | ||
|
|
||
| sdk.registerFunctionDefinition( | ||
| { | ||
| signature: "(n: NUMBER) => NUMBER", | ||
| definitionSource: "", | ||
| linkedDataTypeIdentifiers: ["NUMBER"], | ||
| runtimeParameterDefinitions: [ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its should be named simply parameters
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tucana naming |
||
| { | ||
|
|
@@ -55,46 +34,23 @@ sdk.registerFunctionDefinition( | |
| defaultValue: constructValue(20), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just put in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can change it |
||
| } | ||
| ], | ||
| alias: [], | ||
| deprecationMessage: [], | ||
| description: [], | ||
| displayIcon: "", | ||
| displayMessage: [], | ||
| documentation: [], | ||
| name: [], | ||
| throwsError: false, | ||
| version: "0.0.0", | ||
| runtimeName: "fib", | ||
| }, | ||
| async (params: Struct): Promise<Value> => { | ||
| console.log("Received parameters:", params); | ||
| let n = params.fields["n"]; | ||
|
|
||
| (n: number): number => { | ||
| function fibonacci(num: number): number { | ||
| if (num <= 1) return num; | ||
| return fibonacci(num - 1) + fibonacci(num - 2); | ||
| } | ||
|
|
||
| if (n && n.kind.oneofKind === "numberValue") { | ||
| return constructValue(fibonacci(n.kind.numberValue)); | ||
| } | ||
|
|
||
| return constructValue(fibonacci(1)); | ||
| return fibonacci(n) | ||
| } | ||
| ) | ||
|
|
||
| sdk.registerFlowType( | ||
| { | ||
| documentation: [], | ||
| description: [], | ||
| displayIcon: "", | ||
| displayMessage: [], | ||
| editable: false, | ||
| inputTypeIdentifier: "STRING", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be named inputType
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tucana |
||
| name: [], | ||
| alias: [], | ||
| identifier: "test_flow", | ||
| settings: [], | ||
| version: "0.0.0", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. version is absolute here, because its the same as in sdk
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops |
||
| } | ||
| ) | ||
|
|
@@ -119,4 +75,4 @@ function connectToSdk() { | |
| connectToSdk(); | ||
| }, 5000) | ||
| }) | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be named differently