serverlessworkflow / sdk-typescript

Typescript SDK for Serverless Workflow
https://serverlessworkflow.io/
Apache License 2.0
62 stars 16 forks source link

Workflow is not exported from the package #172

Closed giorgosera closed 1 year ago

giorgosera commented 2 years ago

What happened:

I'm following the example here which builds a workflow from a source.

However, when I try this Module '"@severlessworkflow/sdk-typescript"' has no exported member 'Workflow'.

What you expected to happen:

I'd expect to be able to run the example.

How to reproduce it:

You can try following the examples in the README and run the example I mentioned above.

Try to do this:

import { Specification, Workflow } from '@severlessworkflow/sdk-typescript';

Anything else we need to know?:

Looking at the other examples I can see that the way Workflow is imported is inconsistent. For example, in a subsequent examples here's how it's imported:

import { Workflow } from '../src/lib/definitions/workflow';

const workflowAsJson: string = Workflow.toJson(workflow);

It seems like a typo to me since I wouldn't expect to import from '../src/lib/definitions/workflow' but from the package itself.

If I try this then it works

import {   Specification,  } from '@severlessworkflow/sdk-typescript';

const source = "actual dsl string here"

 const workflow: Specification.Workflow = Specification.Workflow.fromSource(source);

Environment:

antmendoza commented 2 years ago

Thank you @giorgosera for reporting this.

giorgosera commented 2 years ago

Hopefully, soon I'll know enough about the Serverless DSL and this lib to submit a PR to fix it :) Thanks for your reply.

antmendoza commented 1 year ago

fixed here https://github.com/serverlessworkflow/sdk-typescript/pull/175