Import an Ontology Edit function into my Typescript functions repo

Is there a way to import an Ontology Edit function into my Typescript functions repo? I have some useful Ontology Edit functions (e.g. addComment, changeStatus) that are very useful and installed via Marketplace into our ontology. I would like to use these function in my own Ontology Edit function, since I want to have a function that can execute both these actions in 1 ontology edit (e.g. Comment and close). I can’t find a way to do this?

The only workaround I can think of, is calling a Webhook to the actions that are backed by these functions. Then in my typescript ontology edit function, I call these webhooks, one after the other. The problem is 1) this is slow, since it has to wait for 2 separate ontology edits and 2) it feels weird to have to build a webhook to call an action when the function is sitting in my ontology. I just want to import it and use it.

Thoughts?

This is not possible at the moment. You can only import read-only (i.e. Query) functions.

Is that going to be a future thing? And if so, roughly how long? Else we’ll invest in making actions and webhooks to unblock ourselves.

We don’t have any current plans to allow this.

The workaround you suggested should work. Alternatively you may be able to try using our new TypeScript Ontology SDK Functions template which is better setup to allow you to publish your code as a library. You could then consume the common helper functions as libraries in other TypeScript Ontology SDK Functions repositories.

Ok thanks. Are there docs on this new template? I can’t find anything yet. Also, would actions still be able to use the core functions as they do now? e.g. Add Comment action still calls and uses the addComment function. But I outside of this workflow, I can use addComment function in my code repo. Does the former still work? Or is it like a library thing that can’t back an action.

Currently the only documentation is in the readme of the template itself, given that its still experimental. There is also a new package in the TypeScript OSDK for creating edits which allow you to register functions as ontology edit functions.

1 Like