MCPcopy Create free account
hub / github.com/dagger/dagger / buildEnum

Method buildEnum

sdk/typescript/src/module/executor.ts:87–98  ·  view source on GitHub ↗

* Transfer a Dagger enum member name into its implemented value. * An enum value A = "a" will be received as "A" by the entrypoint * but should be transformed into "a" to be sent to the function. * If the enum isn't found in the module, it may be a core enum so we keep the value * as is.

(enumName: string, value: string)

Source from the content-addressed store, hash-verified

85 * as is.
86 */
87 buildEnum(enumName: string, value: string): any {
88 const enumObject = this.daggerModule.enums[enumName]
89 if (!enumObject) {
90 return value
91 }
92
93 if (!enumObject.values[value]) {
94 throw new Error(`Enum ${enumName} does not have member ${value}`)
95 }
96
97 return enumObject.values[value].value
98 }
99
100 async getResult(
101 object: string,

Callers 1

loadValueFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected