improve StartTunnel validation and GC (#3062)

* improve StartTunnel validation and GC

* update sdk formatting
This commit is contained in:
Aiden McClelland
2025-11-28 13:14:52 -07:00
committed by GitHub
parent 72eb8b1eb6
commit a53b15f2a3
8 changed files with 81 additions and 37 deletions

View File

@@ -45,9 +45,10 @@ export interface ActionInfo<
readonly _INPUT: Type
}
export class Action<Id extends T.ActionId, Type extends Record<string, any>>
implements ActionInfo<Id, Type>
{
export class Action<
Id extends T.ActionId,
Type extends Record<string, any>,
> implements ActionInfo<Id, Type> {
readonly _INPUT: Type = null as any as Type
private prevInputSpec: Record<
string,
@@ -148,8 +149,7 @@ export class Action<Id extends T.ActionId, Type extends Record<string, any>>
export class Actions<
AllActions extends Record<T.ActionId, Action<T.ActionId, any>>,
> implements InitScript
{
> implements InitScript {
private constructor(private readonly actions: AllActions) {}
static of(): Actions<{}> {
return new Actions({})

View File

@@ -109,9 +109,11 @@ export class DropPromise<T> implements Promise<T> {
}
}
export class DropGenerator<T = unknown, TReturn = any, TNext = unknown>
implements AsyncGenerator<T, TReturn, TNext>
{
export class DropGenerator<
T = unknown,
TReturn = any,
TNext = unknown,
> implements AsyncGenerator<T, TReturn, TNext> {
private static dropFns: { [id: number]: () => void } = {}
private static registry = new FinalizationRegistry((id: number) => {
const drop = DropGenerator.dropFns[id]