inngest / inngest-js

The developer platform for easily building reliable workflows with zero infrastructure for TypeScript & JavaScript
https://www.inngest.com/
GNU General Public License v3.0
370 stars 37 forks source link

Remove `private` modifier from `createExecution` method on `InngestFunction` #618

Closed MonsterDeveloper closed 2 weeks ago

MonsterDeveloper commented 2 weeks ago

Summary

Removed private modifier from createExecution method on InngestFunction in order to allow calling created functions in the apps that use inngest-js.


When I was researching opportunities on testing my inngest functions, I found out that Inngest already has an option to call the create function that it uses internally for testing: InngestFunction.createExecution. It is used the the Inngest's own test files, e.g. InngestFunction.test.ts

It even seems to be working in my setup, if I ignore the type errors.

However, the createExecution method is not typed, resulting in very bad DX: CleanShot 2024-06-16 at 19 24 36@2x

To add type definitions to this method, I removed the private modifier so that declarations for this method ship with the library, allowing developers to call/test created functions.

Checklist

Related

468

changeset-bot[bot] commented 2 weeks ago

🦋 Changeset detected

Latest commit: f6dbb52ed577c0d824601b75a27234d770aaf6a1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ------- | ----- | | inngest | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jpwilliams commented 2 weeks ago

Thanks, @MonsterDeveloper.

I've shifted it to protected instead, as that should correctly generate the typing needed whilst still only allowing access via [" instead of ..

MonsterDeveloper commented 2 weeks ago

@jpwilliams good point. Made the changes.