You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

@temporalio/common

Package Overview
Dependencies
6
Maintainers
8
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@temporalio/common

Common library for code that's used across the Client, Worker, and/or Workflow


Version published
Maintainers
8
Created

Package description

What is @temporalio/common?

@temporalio/common is a package that provides common utilities and types for use with the Temporal workflow orchestration engine. It is designed to facilitate the development of workflows and activities by providing shared types and helper functions.

What are @temporalio/common's main functionalities?

Workflow Execution

This feature allows you to start a workflow execution using the Temporal client. The code sample demonstrates how to connect to the Temporal service and start a workflow.

const { WorkflowClient } = require('@temporalio/client');
const { Connection } = require('@temporalio/common');

async function run() {
  const connection = await Connection.connect();
  const client = new WorkflowClient(connection.service);
  const handle = await client.start('myWorkflow', { taskQueue: 'my-task-queue' });
  console.log(`Started workflow ${handle.workflowId}`);
}
run().catch(err => console.error(err));

Activity Definition

This feature allows you to define activities that can be executed within workflows. The code sample shows how to define a simple activity that takes an input and returns a greeting message.

const { defineActivity } = require('@temporalio/common');

const myActivity = defineActivity(async (input) => {
  return `Hello, ${input.name}!`;
});

module.exports = { myActivity };

Workflow Definition

This feature allows you to define workflows that orchestrate the execution of activities. The code sample demonstrates how to define a workflow that calls an activity and returns its result.

const { defineWorkflow } = require('@temporalio/common');
const { myActivity } = require('./activities');

const myWorkflow = defineWorkflow(async (input) => {
  const result = await myActivity({ name: input.name });
  return result;
});

module.exports = { myWorkflow };

Other packages similar to @temporalio/common

Readme

Source

@temporalio/common

NPM

Part of Temporal's TypeScript SDK (see docs and samples).

Common library for code that's used across the Client, Worker, and/or Workflow:

Keywords

FAQs

Package last updated on 28 Apr 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc