Bring Your Own (BYO): Custom Operations

Prev Next

The Bring Your Own framework is intended for developers who have a strong understanding of the Unqork Designer Platform and JavaScript.

Overview                                            

The BYO framework enables developers to create custom operations that integrate seamlessly with the Unqork Designer Platform. After defining and registering a custom operation, it functions as a native operation that can be used throughout the platform.

Discover how Creators use operations in the Introduction to the Operations Builder article.

To improve security, external URLs cannot be imported into a BYO implementation file. Unqork recommends copying external source code  into the implementation JavaScript file.

Operation Definition

Define a custom operation's key attributes in the manifest.json file. Each entry in the root-level or component-level events array (components → operations) defines an operation available in the Unqork Designer Platform.

Learn more about the operation definition in our BYO: Understanding the manifest.json File article.

A component can execute custom operations  through configuration in the Operations Builder. This enables Creators to execute custom JavaScript functions as operations, performing complex logic, implementing interactions, or changing behavior with a BYO component.

Define each operation as a named export in your main JavaScript file. The export name must match the type value specified in the manifest.json file.

// Pseudo Code for an operation

class Operation {
  // ...
}

class OperationHandler {
  // ...
}

// If the operation handler does not return a result. This can be omitted.
class OperationContext {
  // ...
}

// Export for the operation
export const operationsOnly = {
  model: async () => Operation,
  handler: async () => OperationHandler,
  contextModel: async () => OperationContext, // If the operation handler does not return a result. This can be omitted.
}

Line 7 : OperationHandler

The operation handler must have an execute method. When the operation runs, this method is called with the following arguments:

  • operation: The operation configuration.

  • api: The Operation API that lets the operation read or write component state, and emit events.

Line 12: OperationContext

The operation API consists of the following methods, state, and events.

Method: state

  • resolveByKey(targetingKey: string): Resolves a targeting string into the state for the targeted component. It locates only one component.

  • set(key: string, update: Partial<ComponentState>): Sets the component state as identified by a unique key.

  • get(key: string): Retrieves the  component state as identified by a unique key.

Method: events

  • emit(event: Event): Emits a custom event.

Resources

Bring Your Own (BYO) Framework Landing Page

Find all the resources needed to build your own components here.

Introduction to the Bring Your Own (BYO) Framework

Get started building your own custom assets, including components, events, and operations.

Create a BYO Package

Discover the structure and content of a BYO Package                                                    

Understanding the manifest.json File

Learn about the file's specification, component and event definitions.                                                    

Understanding the BYO Runtime Engine API

Discover the interface between your custom BYO components and the Unqork platform.

Custom Component

Understand the state, interface, and events of a custom component.    

Custom Component SDK

Extend component functionality in the Unqork Designer Platform.

Custom Events

Learn more about creating custom events for use in the Operations Builder.                                                    

Event Payloads

Learn more about viewing and using event payloads with the Operations Builder.                                                    

BYO  Implementation Examples

Discover examples of component implementation using the Unqork Designer Platform.