Skip to content

Commit

Permalink
fix: ensure services is objects
Browse files Browse the repository at this point in the history
  • Loading branch information
allanhvam committed Oct 22, 2024
1 parent d54a721 commit d57b2d3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ ava.config.js
ava.config.mjs
tsconfig.json
lib/tests/*
lib/debug.js
lib/debug.js
.eslint*
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "simple-workflows",
"version": "0.2.0",
"version": "0.2.1",
"description": "Workflows as code in TypeScript",
"main": "lib/index.js",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions src/workflows/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export type Trigger<P> = {

export type Services<T> = { [P in keyof T]: OnlyAsync<T[P]> };

export type Workflow<S extends Record<string, any>, P = void> = {
export type Workflow<S extends Record<string, object>, P = void> = {
name: string;
description?: string;
tags?: Array<string>;
Expand All @@ -26,7 +26,7 @@ export type Workflow<S extends Record<string, any>, P = void> = {

export const workflows = new Map<string, Workflow<any, any>>();

export const workflow = <S extends Record<string, any>, P = void>(workflow: Workflow<S, P>) => {
export const workflow = <S extends Record<string, object>, P = void>(workflow: Workflow<S, P>) => {
workflows.set(workflow.name, workflow);

const runInternal = async (id: string, services: S, triggerData: P): Promise<WorkflowHandle<(triggerData: P) => any>> => {
Expand Down

0 comments on commit d57b2d3

Please sign in to comment.