| 118 | * @param ctx The context of the invocation. |
| 119 | */ |
| 120 | export async function loadParentState( |
| 121 | executor: Executor, |
| 122 | object: DaggerObject, |
| 123 | ctx: InvokeCtx, |
| 124 | ): Promise<Args> { |
| 125 | const parentState: Args = {} |
| 126 | |
| 127 | for (const [key, value] of Object.entries(ctx.parentArgs)) { |
| 128 | const property = object.properties[key] |
| 129 | if (!property) { |
| 130 | throw new Error(`could not find parent property ${key}`) |
| 131 | } |
| 132 | |
| 133 | if (!property.type) { |
| 134 | throw new Error(`could not find type for parent property ${key}`) |
| 135 | } |
| 136 | |
| 137 | parentState[property.name] = await loadValue(executor, value, property.type) |
| 138 | } |
| 139 | |
| 140 | return parentState |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * This function load the value as a Dagger type. |