You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** human-readable description of this backend. Optional */
description?: string;
/** arbitrary user-defined machine-readable data of this backend. Optional */
metadata?: string;
/** labels to watch for tunnels on, e.g. app->foo, dc->bar */
labels: Map<string,string>;
}
This is problematic because the function that serializes arguments for the underlying API calls iterates on Object.keys applied to the Map, and at least on the latest node LTS, this gives nothing
The association of these 2 facts mean that when we pass labels to ngrok-api generated type, we always lose all the values during serialization; in my example, that means I cannot set the labels to a tunnel group backend using the API*
All those Map<string, string> interfaces look like they could just be Record<string, string>, which would allow objects to be serialized as expected.
*Unless I use // @ts-ignore:
// eslint-disable-next-line @typescript-eslint/no-unnecessary-conditionconstlabels: Record<string,string>=Object.fromEntries(params.backend.labels??newMap())labels.edge=params.edge.idconstrequest: TunnelGroupBackendUpdate={id: params.backend.id,// @ts-expect-error ngrok-api wants a `Map`, but a `Map` serializes to nothing, so the tunnel backend group rule isn’t created. We// enforce an object to deal with this.
labels,}
Cheers,
Gerry
The text was updated successfully, but these errors were encountered:
Hello,
The payloads for e.g. the tunnel group backends enforces a
Map<string, string>
:ngrok-api-typescript/src/datatypes.ts
Lines 490 to 497 in 31188cf
This is problematic because the function that serializes arguments for the underlying API calls iterates on
Object.keys
applied to theMap
, and at least on the latest node LTS, this gives nothingngrok-api-typescript/src/util.ts
Lines 37 to 50 in 31188cf
The association of these 2 facts mean that when we pass
labels
tongrok-api
generated type, we always lose all the values during serialization; in my example, that means I cannot set the labels to a tunnel group backend using the API*All those
Map<string, string>
interfaces look like they could just beRecord<string, string>
, which would allow objects to be serialized as expected.*Unless I use
// @ts-ignore
:Cheers,
Gerry
The text was updated successfully, but these errors were encountered: