@@ -14,7 +14,10 @@ export interface OpenFunctionContext {
14
14
/**
15
15
* The target runtime of the context.
16
16
*/
17
- runtime : keyof typeof RuntimeType ;
17
+ runtime :
18
+ | `${RuntimeType } `
19
+ | `${Capitalize < RuntimeType > } `
20
+ | `${Uppercase < RuntimeType > } `;
18
21
/**
19
22
* Optional port string of the server.
20
23
*/
@@ -64,7 +67,7 @@ export interface OpenFunctionComponent {
64
67
/**
65
68
* Optional metadata as hash map for the component.
66
69
*/
67
- metadata ?: { [ key : string ] : string } ;
70
+ metadata ?: Record < string , string > ;
68
71
}
69
72
70
73
/**
@@ -75,11 +78,11 @@ export enum RuntimeType {
75
78
/**
76
79
* The Knative type.
77
80
*/
78
- Knative = 'Knative ' ,
81
+ Knative = 'knative ' ,
79
82
/**
80
83
* The async type.
81
84
*/
82
- Async = 'Async ' ,
85
+ Async = 'async ' ,
83
86
}
84
87
85
88
/**
@@ -108,15 +111,15 @@ export class ContextUtils {
108
111
* @returns A boolean value.
109
112
*/
110
113
static IsKnativeRuntime ( context : OpenFunctionContext ) : boolean {
111
- return context ?. runtime === RuntimeType . Knative ;
114
+ return context ?. runtime ?. toLowerCase ( ) === RuntimeType . Knative ;
112
115
}
113
116
/**
114
117
* Returns true if the runtime is Async.
115
118
* @param context - The OpenFunctionContext object.
116
119
* @returns A boolean value.
117
120
*/
118
121
static IsAsyncRuntime ( context : OpenFunctionContext ) : boolean {
119
- return context ?. runtime === RuntimeType . Async ;
122
+ return context ?. runtime ?. toLowerCase ( ) === RuntimeType . Async ;
120
123
}
121
124
122
125
/**
0 commit comments