1
1
import { GenericHookServiceConfig } from "../../Connections" ;
2
2
import { ConfigError } from "../../errors" ;
3
3
import { hideKey } from "../Decorators" ;
4
- import parseDuration from "parse-duration" ;
4
+ const parseDurationImport = import ( "parse-duration" ) ;
5
5
6
6
function makePrefixedUrl ( urlString : string ) : URL {
7
7
return new URL ( urlString . endsWith ( "/" ) ? urlString : urlString + "/" ) ;
@@ -35,7 +35,7 @@ export class BridgeConfigGenericWebhooks {
35
35
public readonly enableHttpGet : boolean ;
36
36
37
37
@hideKey ( )
38
- public readonly maxExpiryTimeMs ?: number ;
38
+ public readonly maxExpiryTimeMs ?: Promise < number | undefined > ;
39
39
public readonly sendExpiryNotice : boolean ;
40
40
public readonly requireExpiryTime : boolean ;
41
41
// Public facing value for config generator
@@ -56,19 +56,19 @@ export class BridgeConfigGenericWebhooks {
56
56
this . userIdPrefix = yaml . userIdPrefix ;
57
57
this . allowJsTransformationFunctions = yaml . allowJsTransformationFunctions ;
58
58
this . waitForComplete = yaml . waitForComplete ;
59
- this . maxExpiryTimeMs = yaml . maxExpiryTime ? parseDuration ( yaml . maxExpiryTime ) : undefined ;
60
59
this . maxExpiryTime = yaml . maxExpiryTime ;
60
+ this . maxExpiryTimeMs = yaml . maxExpiryTime ? parseDurationImport . then ( v => v . default ( yaml . maxExpiryTime ! ) ?? undefined ) : undefined ;
61
61
}
62
62
63
63
@hideKey ( )
64
- public get publicConfig ( ) : GenericHookServiceConfig {
65
- return {
64
+ public get publicConfig ( ) : Promise < GenericHookServiceConfig > {
65
+ return ( async ( ) => ( {
66
66
userIdPrefix : this . userIdPrefix ,
67
67
allowJsTransformationFunctions : this . allowJsTransformationFunctions ,
68
68
waitForComplete : this . waitForComplete ,
69
- maxExpiryTime : this . maxExpiryTimeMs ,
69
+ maxExpiryTime : await this . maxExpiryTimeMs ,
70
70
requireExpiryTime : this . requireExpiryTime ,
71
- }
71
+ } ) ) ( ) ;
72
72
}
73
73
74
74
}
0 commit comments