@@ -14,7 +14,10 @@ export interface OpenFunctionContext {
1414 /**
1515 * The target runtime of the context.
1616 */
17- runtime : keyof typeof RuntimeType ;
17+ runtime :
18+ | `${RuntimeType } `
19+ | `${Capitalize < RuntimeType > } `
20+ | `${Uppercase < RuntimeType > } `;
1821 /**
1922 * Optional port string of the server.
2023 */
@@ -64,7 +67,7 @@ export interface OpenFunctionComponent {
6467 /**
6568 * Optional metadata as hash map for the component.
6669 */
67- metadata ?: { [ key : string ] : string } ;
70+ metadata ?: Record < string , string > ;
6871}
6972
7073/**
@@ -75,11 +78,11 @@ export enum RuntimeType {
7578 /**
7679 * The Knative type.
7780 */
78- Knative = 'Knative ' ,
81+ Knative = 'knative ' ,
7982 /**
8083 * The async type.
8184 */
82- Async = 'Async ' ,
85+ Async = 'async ' ,
8386}
8487
8588/**
@@ -108,15 +111,15 @@ export class ContextUtils {
108111 * @returns A boolean value.
109112 */
110113 static IsKnativeRuntime ( context : OpenFunctionContext ) : boolean {
111- return context ?. runtime === RuntimeType . Knative ;
114+ return context ?. runtime ?. toLowerCase ( ) === RuntimeType . Knative ;
112115 }
113116 /**
114117 * Returns true if the runtime is Async.
115118 * @param context - The OpenFunctionContext object.
116119 * @returns A boolean value.
117120 */
118121 static IsAsyncRuntime ( context : OpenFunctionContext ) : boolean {
119- return context ?. runtime === RuntimeType . Async ;
122+ return context ?. runtime ?. toLowerCase ( ) === RuntimeType . Async ;
120123 }
121124
122125 /**
0 commit comments