Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

@rubriclab/actions

Package Overview
Dependencies
Maintainers
4
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rubriclab/actions

The Actions package aims to provide a powerful and simple way to define actions (which are essentially API primitives) and execute them safely with JSON serializable payloads.

latest
Source
npmnpm
Version
0.0.54
Version published
Maintainers
4
Created
Source

@rubriclab/actions

The Actions package aims to provide a powerful and simple way to define actions (which are essentially API primitives) and execute them safely with JSON serializable payloads.

It is part of Rubric's architecture for Generative UI when used with:

  • @rubriclab/actions
  • @rubriclab/blocks
  • @rubriclab/chains
  • @rubriclab/agents
  • @rubriclab/events

Demo

Get Started

Installation

bun add @rubriclab/actions

@rubriclab scope packages are not built, they are all raw typescript. If using in a next.js app, make sure to transpile.

// next.config.ts
import type { NextConfig } from  'next' 
export default {
	transpilePackages: ['@rubriclab/actions'],
	reactStrictMode: true
} satisfies  NextConfig

If using inside the monorepo (@rubric), simply add {"@rubriclab/actions": "*"} to dependencies and then run bun i

Define Actions

To get started, define a few actions.

import { createAction } from '@rubriclab/actions'
import { z } from 'zod'

const convertStringToNumber = createAction({
	schema: {
		input: z.object({
			str: z.string()
		}),
		output: z.number()
	},
	execute: ({ str }) => Number(str)
})

export const actions = { convertStringToNumber }

Create an Executor

Pass all your actions into an executor to get a function to execute it.

'use server'

import { createActionExecutor } from '@rubriclab/actions'
import { actions } from './actions'

export const { execute } = createActionExecutor({ actions })

Execute an Action

const number = await execute({ action: 'convertStringToNumber' params: { str: '2' } })

FAQs

Package last updated on 13 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts