#Dagger Functions with JS
1 messages ยท Page 1 of 1 (latest)
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.
ok so if we are not using TS modules then good to go for node sdk to write dagger ci cd code in js right?
Yes, just pinging @shell dock to confirm if we're still guaranteeing compatibility.
Awaiting response then. Thanks for clarity and support
Yes it's good!
But I would always recommand to use modules to make your CI reusable and easier to maintain
which module you are talking about from https://daggerverse.dev/ or something else?
I think he meant writing your pipelines in your own functions and use dagger call instead of sticking with dagger run.
ok then it can be done with js code also, right?
Not with modules, no. Tom was trying to say moving to modules with TS is worth it. That's of course up to you ๐
so you mean dagger call will work only with TS sdk? and not with nodejs sdk with js files?
Yes
then this is roadblock for js developers...why such restrictions?
can we call graphql api directly through js?
and as per this docs dagger run is also supported https://docs.dagger.io/reference/979596/cli/
I explained it here ๐
Yes, you can continue to use dagger run with JS. It's dagger call that requires TS because it's for modules and we only support modules with the TS SDK.
so dagger run will not be deprecated, right?
No, it'll continue to be supported.
But it's going to be considered a more advanced/niche use case.
ok so dagger call will remain widely used and dagger run will remain like more advanced feature, right?
yes that's right