TypeScript Function

Hello! :slight_smile:

I’m interested to use typescript for an Automate Function and I’ve seen there is already a typescript template repo on github. But since the function won’t be “registered” through the Automate interface (Typscript option currently missing), I guess that doesn’t work.

I did create a python function through Automate and replaced its code it with the typescript code on github :open_mouth: … but the “Build annd Publish” Action fails.

Anyways… What would be the best way to already start testing? For another project of us (a.k.a. web app) I also created some basic typescript SDK, which I would like to test for Automate.

Thanks so much in advance! :slight_smile:

1 Like

There is no technical reason why a Javascript Function would not be possible. We temporarily paused development on creating the official template so we could focus our efforts during this Beta phase.

Was there any specific error from the “Build and Publish” action? Perhaps we can try to debug that?


1 Like

Thanks! :slight_smile:

Not sure if that’s helping you:

You probably won’t see the detailed Error messsages from the github actions, even if I make the repo public again, right?

Thanks for sharing the log messages; this wasn’t the problem I was expecting! Can you share a link to the GitHub repository and the function on Automate please?


Sure! I made it public again.

Don’t get confused … :smiley: the repo called “python” because I created it with the python template via Automate, but I simply replaced the complete code with the typescript template’s code manually with the last commit.


Thanks for having a look!!


PS: It’s also called “private” because I tested that. It still showed up in Automate’s (public) functions list, which actually wasn’t what I expected. Is that indented to have a “public” function, but “private” source code?

The error message isn’t printed correctly in GitHub Actions, which was a problem that was fixed in versions >= 0.8.0 of speckle automate’s action . I’d recommend updating the GitHub Action to the latest version. The relevant line to change is in .github/workflows/main.yml

After updating, if you re-run the GitHub Action workflow we should see a better error message and hopefully will be able to identify the root cause.

We currently haven’t implemented any private Functions. It may be a forthcoming feature if there is sufficient demand for it.


Did that. The new error message:

1 Like

Great, that’s a lot more helpful. The json schema used to describe the function inputs will need to be 2020-12 draft version.


I’m a little bit googling and guessing here, but does this mean zod dowsn’t support it (yet)?

Can I do anything on my side to solve the issue?

I’d output the schema using the jsonSchema2019-09 configuration value.

As a ‘hacky’ workaround I would suggest you could use some json manipulation to amend the $schema value produced by zod-to-json-schema to be "https://json-schema.org/draft/2020-12/schema".
The parts of the 2019-09 and 2020-12 schemas that are output are likely (I hope!) to be valid and compatible for both versions, so I wouldn’t expect much more complexity than this.


1 Like

Your “hacky” workaround suggestion works! :partying_face: :heart:

At least so far:

I have this now, but I guess it’s a different one (?) …

I will have a look and many thanks so far!!