( chosenAddOns: Array<AddOn>, )
| 56 | } |
| 57 | |
| 58 | export function populateAddOnOptionsDefaults( |
| 59 | chosenAddOns: Array<AddOn>, |
| 60 | ): Record<string, Record<string, unknown>> { |
| 61 | const addOnOptions: Record<string, Record<string, unknown>> = {} |
| 62 | |
| 63 | for (const addOn of chosenAddOns) { |
| 64 | if (addOn.options) { |
| 65 | const defaults: Record<string, unknown> = {} |
| 66 | for (const [optionKey, optionDef] of Object.entries(addOn.options)) { |
| 67 | defaults[optionKey] = optionDef.default |
| 68 | } |
| 69 | addOnOptions[addOn.id] = defaults |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | return addOnOptions |
| 74 | } |
| 75 | |
| 76 | export async function loadRemoteAddOn(url: string): Promise<AddOn> { |
| 77 | const response = await fetch(url) |
nothing calls this directly
no outgoing calls
no test coverage detected