#Dagger Functions with JS

1 messages ยท Page 1 of 1 (latest)

eager crow
#

Dagger Functions extend the core API with user functions. So they're used to implement "server-side" resolvers. Each SDK has it's own DX for defining functions, since they have to be able to report which type the function returns, as well as the types of its arguments, and that's very dependent on the target language.

With JS we'd need a different DX, likely with JSDoc, or non-typesafe/dynamic objects. That's different enough that it warrants a different SDK, but one that would have to be contributed by the community, same as others like PHP or Rust.

This is different from client calls, using dag from within the body of the functions. Technically that's compatible between TS and JS, but I'm not sure if we've kept that compatibility or not after the split. However, that only makes sense if you're not using modules with the TypeScript SDK because that code already requires a TypeScript runtime.

molten cargo
eager crow
#

Yes, just pinging @shell dock to confirm if we're still guaranteeing compatibility.

molten cargo
shell dock
molten cargo
eager crow
#

I think he meant writing your pipelines in your own functions and use dagger call instead of sticking with dagger run.

molten cargo
#

ok then it can be done with js code also, right?

eager crow
#

Not with modules, no. Tom was trying to say moving to modules with TS is worth it. That's of course up to you ๐Ÿ™‚

molten cargo
#

so you mean dagger call will work only with TS sdk? and not with nodejs sdk with js files?

eager crow
#

Yes

molten cargo
#

then this is roadblock for js developers...why such restrictions?

#

can we call graphql api directly through js?

eager crow
molten cargo
#

so dagger run will not be deprecated, right?

eager crow
#

No, it'll continue to be supported.

#

But it's going to be considered a more advanced/niche use case.

molten cargo