diff --git a/docs/src/content/docs/automation/getting-started/quick-start.md b/docs/src/content/docs/automation/getting-started/quick-start.md index 37a898ca64a..0457c2ee35d 100644 --- a/docs/src/content/docs/automation/getting-started/quick-start.md +++ b/docs/src/content/docs/automation/getting-started/quick-start.md @@ -19,7 +19,7 @@ description: A guide in my new Starlight docs site. ## Creating and running triggers -If you are testing components in development, check out [Working with Triggers](../../developer_guide/components/triggers/) +If you are testing components in development, check out [Working with Triggers](../../developer_guide/testing_triggers/triggers)
diff --git a/docs/src/content/docs/developer_guide/build_component/add_connection.md b/docs/src/content/docs/developer_guide/build_component/add_connection.md index efe28ad48f6..20c615f659f 100644 --- a/docs/src/content/docs/developer_guide/build_component/add_connection.md +++ b/docs/src/content/docs/developer_guide/build_component/add_connection.md @@ -12,7 +12,7 @@ scopes in the `authorizations` method of the `CONNECTION_DEFINITION` constant. T define the properties that are required for the connection, such as Client ID and Client Secret. Here is an example of a connection with OAuth2 authorization: -``` +``` java public static final ModifiableConnectionDefinition CONNECTION_DEFINITION = connection() .baseUri((connectionParameters, context) -> "base url") .authorizations( diff --git a/docs/src/content/docs/developer_guide/build_component/create_action.md b/docs/src/content/docs/developer_guide/build_component/create_action.md index 8edda5f0267..9c02e9a2550 100644 --- a/docs/src/content/docs/developer_guide/build_component/create_action.md +++ b/docs/src/content/docs/developer_guide/build_component/create_action.md @@ -7,7 +7,7 @@ In `server/libs/modules/components/newcomponent/src/main/java/com/bytechef/compo `NewComponentDummyAction` class defines the connection. The `ACTION_DEFINITION` constant contains all the details about the action, including its name, title, description, properties and others. -``` +``` java public static final ModifiableActionDefinition ACTION_DEFINITION = action("dummy") .title("Dummy Action") .description("Action description.") @@ -24,17 +24,14 @@ public static final ModifiableActionDefinition ACTION_DEFINITION = action("dummy .perform(NewComponentDummyAction::perform); ``` +The `perform` method contains the logic for the action. Here is the simplest example of the `perform` method that returns the value of the `name` property. - -``` -protected static Object perform( +``` java +protected static String perform( Parameters inputParameters, Parameters connectionParameters, ActionContext actionContext) { - return actionContext - .http(http -> http.post("some url")) - .configuration(Http.responseType(Http.ResponseType.JSON)) - .body() - .execute() - .getBody(new TypeReference<>() {}); + return inputParemeters.getRequiredString("name"); } ``` + +For more information about any method in the `ACTION_DEFINITION`, refer to the [action documentation](../component_specification/action.md). diff --git a/docs/src/content/docs/developer_guide/build_component/create_component_definition.md b/docs/src/content/docs/developer_guide/build_component/create_component_definition.md index ce6d7262ee3..78ad90002a9 100644 --- a/docs/src/content/docs/developer_guide/build_component/create_component_definition.md +++ b/docs/src/content/docs/developer_guide/build_component/create_component_definition.md @@ -7,7 +7,7 @@ In `server/libs/modules/components/newcomponent/src/main/java/com/bytechef/compo `NewComponentComponentHandler` class defines the component. The `COMPONENT_DEFINITION` constant contains all the details about the component, including its name, title, description, icon, categories, connection, actions, triggers and others. -``` +``` java private static final ComponentDefinition COMPONENT_DEFINITION = component("newComponent") .title("New Component") .description("New component description.") diff --git a/docs/src/content/docs/developer_guide/build_component/initial_setup.md b/docs/src/content/docs/developer_guide/build_component/initial_setup.md index 65dada1b204..088c3de2094 100644 --- a/docs/src/content/docs/developer_guide/build_component/initial_setup.md +++ b/docs/src/content/docs/developer_guide/build_component/initial_setup.md @@ -5,10 +5,24 @@ title: "Initial Setup" To create new component, we will use `example` component as template. 1. Copy the example component from `server/libs/modules/components/example` into a new package `server/libs/modules/components/newcomponent`, where `newcomponent` is name of your new component. -2. Inside the new package, replace all occurrences of word `example` with `newcomponent`. Then, replace all occurrences of `Example` with `NewComponent`. -#### Setup Gradle +2. Update Settings: + - Open `bytechef/settings.gradle.kts`. + - Add the following line to include your new component in the build process: + ```kotlin + include("server:libs:modules:components:newcomponent") + ``` -3. In file `bytechef/settings.gradle.kts`, add line: `include("server:libs:modules:components:newcomponent")` -4. In both files `bytechef/server/ee/apps/worker-app/build.gradle.kts` and `bytechef/server/apps/server-app/build.gradle.kts`, add line `implementation(project(":server:libs:modules:components:newcomponent"))` -5. Load gradle changes. After that IntelliJ should recognize your connector as a java module. +3. Modify Build Files: + - Open `bytechef/server/ee/apps/worker-app/build.gradle.kts` and `bytechef/server/apps/server-app/build.gradle.kts`. + - Add the following line to both files to ensure your component is included as a dependency: + ```kotlin + implementation(project(":server:libs:modules:components:newcomponent")) + ``` +4. Load Gradle Changes: + - Refresh or reload the Gradle project in IntelliJ IDEA. + - This step ensures that IntelliJ recognizes your new component as a Java module, allowing you to work with it seamlessly within the IDE. + +5. Rename Package and Classes: + - Inside the newly created package, rename the `example` subpackage to `newcomponent`. + - Additionally, rename all classes within this package that start with `Example` to start with `NewComponent`. diff --git a/docs/src/content/docs/developer_guide/component_specification/component.md b/docs/src/content/docs/developer_guide/component_specification/component.md index 9a0c11b8080..e8cce5a3ed9 100644 --- a/docs/src/content/docs/developer_guide/component_specification/component.md +++ b/docs/src/content/docs/developer_guide/component_specification/component.md @@ -5,9 +5,9 @@ title: "Component" The component definition is used to specify the properties of a component. Below is an explanation of each method that can be used in the component definition: - `component(String name)` - Builds new `ModifiableComponentDefinition` with the specified name. The name defines the component key (backend ID). -- `actions(A... actionDefinitions)` - Specifies the actions that the component can perform. +- [`actions(A... actionDefinitions)`](./action) - Specifies the actions that the component can perform. - `categories(ComponentCategory... category)` - Defines the category or categories that the component belongs to, used to group components together in the UI. -- `connection(ModifiableConnectionDefinition connectionDefinition)` - Sets the connection definition for the component. +- [`connection(ModifiableConnectionDefinition connectionDefinition)`](./connection) - Sets the connection definition for the component. - `connectionRequired(boolean connectionRequired)` - Indicates whether the component requires a connection to be configured before it can be used. - `customAction(boolean customAction)` - Indicates if the component is REST-based. - `description(String description)` - Provides a short description of the component. diff --git a/docs/src/content/docs/developer_guide/component_specification/connection.md b/docs/src/content/docs/developer_guide/component_specification/connection.md index 4747a54806a..42760abe65c 100644 --- a/docs/src/content/docs/developer_guide/component_specification/connection.md +++ b/docs/src/content/docs/developer_guide/component_specification/connection.md @@ -34,7 +34,7 @@ Each authorization type has different properties that are required for successfu Basic Auth is a simple authentication scheme built into the HTTP protocol. It requires a username and password, which are sent with each request. -``` +```java authorization(AuthorizationType.BASIC_AUTH) .title("Basic Auth") .properties( @@ -50,7 +50,7 @@ authorization(AuthorizationType.BASIC_AUTH) Bearer Token authentication involves sending a token with each request. This token is typically obtained from an authorization server and represents the user's identity. -``` +```java authorization(AuthorizationType.BEARER_TOKEN) .title("Bearer Token") .properties( @@ -63,7 +63,7 @@ authorization(AuthorizationType.BEARER_TOKEN) OAuth2 Authorization Code is a robust authorization framework that allows third-party applications to obtain limited access to a web service. It involves redirecting the user to an authorization server to obtain an authorization code, which is then exchanged for an access token. -``` +```java authorization(AuthorizationType.OAUTH2_AUTHORIZATION_CODE) .title("OAuth2 Authorization Code") .properties( diff --git a/docs/src/content/docs/developer_guide/component_specification/property.md b/docs/src/content/docs/developer_guide/component_specification/property.md index 3ca9a3dc29e..e029b89302c 100644 --- a/docs/src/content/docs/developer_guide/component_specification/property.md +++ b/docs/src/content/docs/developer_guide/component_specification/property.md @@ -7,17 +7,20 @@ title: "Property" The `ModifiableArrayProperty` class is a customizable property type designed to handle array values within a component. - `array(String name)` - Initializes a new `ModifiableArrayProperty` with the specified name. -- `defaultValue(...)` - Sets the default value for the property using various data types such as Boolean, Integer, Long, Float, Double, String, or Map. -- `exampleValue(...)` - Provides an example value for illustrative purposes using various data types. -- `items(...)` - Specifies the properties that define the items in the array. +- `defaultValue(T... defaultValue)` - Sets the default value for the property using various data types such as Boolean, Integer, Long, Float, Double, String, or Map. +- `exampleValue(T... exampleValue)` - Provides an example value for illustrative purposes using various data types. +- `items(P.. properties)` - Specifies the properties that define the items in the array. - `optionsLookupDependsOn(String... optionsLookupDependsOn)` - Defines dependencies for option lookups. - `maxItems(long maxItems)` - Sets the maximum number of items allowed in the array. - `minItems(long minItems)` - Sets the minimum number of items required in the array. - `multipleValues(boolean multipleValues)` - Indicates whether the array can contain multiple values. -- `options(...)` - Specifies a list of options for the property or defines a function to dynamically generate options. +- `options(Option... options)` - Specifies a list of options for the property. +- `options(OptionsFunction optionsFunction)` - Defines a function to dynamically generate options. ### Boolean Property +The `ModifiableBooleanProperty` class is a customizable property type designed to handle boolean values within a component. + - `bool(String name)` - Initializes a new `ModifiableBooleanProperty` with the specified name. - `defaultValue(boolean defaultValue)` - Sets the default value for the property. - `exampleValue(boolean exampleValue)` - Provides an example value for illustrative purposes. diff --git a/docs/src/content/docs/developer_guide/generate_component/customize_component.md b/docs/src/content/docs/developer_guide/generate_component/customize_component.md index a17dfe2a924..1e733c7562a 100644 --- a/docs/src/content/docs/developer_guide/generate_component/customize_component.md +++ b/docs/src/content/docs/developer_guide/generate_component/customize_component.md @@ -2,7 +2,7 @@ title: "Customize Component" --- -### Connector Icon +### Connector Icon and Category 1. Find an Icon: - Search for a suitable user interface icon for your component in `.svg` format. @@ -10,23 +10,34 @@ title: "Customize Component" 2. Save the Icon: - Place the icon in the following directory: `server/libs/modules/components/newcomponent/src/main/resources/assets/newcomponent.svg`. -3. Update Component Handler: - - In `NewComponentComponentHandler.class`, override the `modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition)` method: +3. Choose a Category: + - Select a category for your component. Available categories can be found in [ComponentCategory](https://github.com/bytechefhq/bytechef/blob/master/sdks/backend/java/component-api/src/main/java/com/bytechef/component/definition/ComponentCategory.java). + +4. Update Component Handler: + - In `NewComponentComponentHandler`, override the `modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition)` method: ```java @Override public ModifiableComponentDefinition modifyComponent(ModifiableComponentDefinition modifiableComponentDefinition) { - return modifiableComponentDefinition.icon("path:assets/newcomponent.svg"); + return modifiableComponentDefinition + .icon("path:assets/newcomponent.svg") + .categories(ComponentCategory.HELPERS); } ``` ### Connection -If your component requires custom authentication parameters, override the `modifyConnection(ModifiableConnectionDefinition modifiableConnectionDefinition)` method in `NewComponentComponentHandler.class`. +If your component requires custom authentication parameters, override the `modifyConnection(ModifiableConnectionDefinition modifiableConnectionDefinition)` method in `NewComponentComponentHandler`. + +Refer to examples like [`ShopifyComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L72), [`DiscordComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/discord/src/main/java/com/bytechef/component/discord/DiscordComponentHandler.java#L92), or [`PipelinerComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/pipeliner/src/main/java/com/bytechef/component/pipeliner/PipelinerComponentHandler.java#L57) for guidance. + +### Action + +If some actions require properties not specified in the OpenAPI schema, override the `modifyActions(ModifiableActionDefinition... actionDefinitions)` method in `NewComponentComponentHandler`. -Refer to examples like [`ShopifyComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L72), [`DiscordComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/discord/src/main/java/com/bytechef/component/discord/DiscordComponentHandler.java#L92), or [`PipelinerComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/pipeliner/src/main/java/com/bytechef/component/pipeliner/PipelinerComponentHandler.java#L57) for guidance. +Refer to examples like [`DiscordComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/discord/src/main/java/com/bytechef/component/discord/DiscordComponentHandler.java#L66) or [`ClickupComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/clickup/src/main/java/com/bytechef/component/clickup/ClickupComponentHandler.java#L60). ### Dynamic options -For parameters that require dynamic options, override the `modifyProperty(ActionDefinition actionDefinition, ModifiableProperty modifiableProperty)` method in `NewComponentComponentHandler.class`. +For parameters that require dynamic options, override the `modifyProperty(ActionDefinition actionDefinition, ModifiableProperty modifiableProperty)` method in `NewComponentComponentHandler`. -Check examples such as [`ShopifyComponentHandler.class`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L96) for implementation details. +Check examples such as [`ShopifyComponentHandler`](https://github.com/bytechefhq/bytechef/blob/master/server/libs/modules/components/shopify/src/main/java/com/bytechef/component/shopify/ShopifyComponentHandler.java#L96) for implementation details. diff --git a/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/ExampleComponentHandler.java b/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/ExampleComponentHandler.java index feb380197ca..8facee1b8e8 100644 --- a/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/ExampleComponentHandler.java +++ b/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/ExampleComponentHandler.java @@ -26,9 +26,6 @@ import com.bytechef.component.example.trigger.ExampleDummyTrigger; import com.google.auto.service.AutoService; -/** - * @author Mario Cvjetojevic - */ @AutoService(ComponentHandler.class) public class ExampleComponentHandler implements ComponentHandler { diff --git a/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/action/ExampleDummyAction.java b/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/action/ExampleDummyAction.java index c85d28ffe93..b4dec73a00c 100644 --- a/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/action/ExampleDummyAction.java +++ b/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/action/ExampleDummyAction.java @@ -24,9 +24,6 @@ import com.bytechef.component.definition.ComponentDsl.ModifiableActionDefinition; import com.bytechef.component.definition.Parameters; -/** - * @author Mario Cvjetojevic - */ public class ExampleDummyAction { public static final ModifiableActionDefinition ACTION_DEFINITION = action("dummyAction") diff --git a/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/constant/ExampleConstants.java b/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/constant/ExampleConstants.java index 613a9d33c8b..f8e9cace45d 100644 --- a/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/constant/ExampleConstants.java +++ b/server/libs/modules/components/example/src/main/java/com/bytechef/component/example/constant/ExampleConstants.java @@ -16,10 +16,7 @@ package com.bytechef.component.example.constant; -/** - * @author Mario Cvjetojevic - */ -public final class ExampleConstants { +public class ExampleConstants { public static final String ID = "id"; diff --git a/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/ExampleComponentHandlerTest.java b/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/ExampleComponentHandlerTest.java index da9459456be..b8752a07753 100644 --- a/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/ExampleComponentHandlerTest.java +++ b/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/ExampleComponentHandlerTest.java @@ -19,9 +19,6 @@ import com.bytechef.test.jsonasssert.JsonFileAssert; import org.junit.jupiter.api.Test; -/** - * @author Mario Cvjetojevic - */ class ExampleComponentHandlerTest { @Test diff --git a/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/action/ExampleDummyActionTest.java b/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/action/ExampleDummyActionTest.java index 9f1d81bb967..8d3d35344ac 100644 --- a/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/action/ExampleDummyActionTest.java +++ b/server/libs/modules/components/example/src/test/java/com/bytechef/component/example/action/ExampleDummyActionTest.java @@ -23,9 +23,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -/** - * @author Mario Cvjetojevic - */ class ExampleDummyActionTest { @Test