(metadata: ImageMetadataEntry[])
| 122 | } |
| 123 | |
| 124 | export function lifecycleCommandOriginMapFromMetadata(metadata: ImageMetadataEntry[]): LifecycleHooksInstallMap { |
| 125 | const map: LifecycleHooksInstallMap = { |
| 126 | onCreateCommand: [], |
| 127 | updateContentCommand: [], |
| 128 | postCreateCommand: [], |
| 129 | postStartCommand: [], |
| 130 | postAttachCommand: [], |
| 131 | initializeCommand: [] |
| 132 | }; |
| 133 | for (const entry of metadata) { |
| 134 | const id = entry.id; // Only Features have IDs encoded in the metadata. |
| 135 | const origin = id ?? 'devcontainer.json'; |
| 136 | for (const hook of pickFeatureLifecycleHookProperties) { |
| 137 | const command = entry[hook]; |
| 138 | if (command) { |
| 139 | map[hook].push({ origin, command }); |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | return map; |
| 144 | } |
| 145 | |
| 146 | function mergeLifecycleHooks(metadata: ImageMetadataEntry[], hook: (keyof SchemaFeatureLifecycleHooks)): LifecycleCommand[] | undefined { |
| 147 | const collected: LifecycleCommand[] = []; |
no outgoing calls
no test coverage detected