Earlier quoted context omitted.
My bad, this is open telemetry stuff to check the status of your servers, not for the vendor to slurp as much data from you as possible.
This is Open Telemetry functions you're referencing. Being able to trace, profile and debug your own code that's executing in a highly distributed environment is a pretty useful thing. This isn't (necessarily) user behavior telemetry. At least understand what you're looking at before getting the ick.
Make any TypeScript function durable
21–30 of 89 posts
Re: Make any TypeScript function durable
#22Of all the syntax options they could've gone with, they settled on what I would say is arguably the worst. If you want a one-liner, decorators are widely used across different languages and Typescript supports them as well.
Decorators don't work for functions, unfortunately, so wouldn't work in this case. You'd need to add a bunch of class boilerplate to make it work. JavaScript didn't have a lot of great options for this kind of statically-declared metaprogramming, which is why the "use X"; syntax has become so popular in various spaces. It's definitely not my favourite approach, but I don't think there's any clear "best" solution here…
Re: Make any TypeScript function durable
#23This is actually pretty cool. We have a similar custom library at Xbox that's used extensively across all of our services. I do wish that there was some kind of self-hostable World implementation at launch. If other PAAS providers jump onto this, I could see this sticking around.
Re: Make any TypeScript function durable
#24Of all the syntax options they could've gone with, they settled on what I would say is arguably the worst. If you want a one-liner, decorators are widely used across different languages and Typescript supports them as well.
My bad, this is open telemetry stuff to check the status of your servers, not for vendors to extract as much data as they can from you. > I'm trying to find how they implemented the "use workflow" thing, and before I could find it I already found https://github.com/vercel/workflow/blob/main/packages/core/s... > Telemetry is part of the core. > Yuck.
Re: Make any TypeScript function durable
#25Re: Make any TypeScript function durable
#26Re: Make any TypeScript function durable
#27just build state machines folks
Re: Make any TypeScript function durable
#28 export async function welcome(userId: string) {
const user = await retry(() => getUser(userId));
const { subject, body } = await retry(() => generateEmail({
name: user.name, plan: user.plan
}));
const { status } = await retry(() => sendEmail({
to: user.email,
subject,
body,
}), 2);
return { status, subject, body };
}Re: Make any TypeScript function durable
#29Use client and use server aren’t great, but the fact they had to be declared at the top of a file was at least clear. Starting to scatter magic strings throughout a code base feels like a real step back.
I think "use client" is the only one that has to go at the top of a file.
Re: Make any TypeScript function durable
#30Earlier quoted context omitted.
Decorators don't work for functions, unfortunately, so wouldn't work in this case. You'd need to add a bunch of class boilerplate to make it work. JavaScript didn't have a lot of great options for this kind of statically-declared metaprogramming, which is why the "use X"; syntax has become so popular in various spaces. It's definitely not my favourite approach, but I don't think there's any clear "best" solution here…
Since this magic string requires a preprocessor step anyway, there's no reason they couldn't make it a decorator that works on functions. I don't see the problem?