(account, headers, project, customDomain)
| 169 | } |
| 170 | |
| 171 | async function projectHasPagesDomain(account, headers, project, customDomain) { |
| 172 | const { ok, json } = await cf( |
| 173 | `${CF_API}/accounts/${account}/pages/projects/${project}/domains`, |
| 174 | headers, |
| 175 | ); |
| 176 | if (!ok) { |
| 177 | throw new Error( |
| 178 | `List domains for ${project} failed: ${JSON.stringify(json)}`, |
| 179 | ); |
| 180 | } |
| 181 | |
| 182 | return json.result?.some((domain) => domain.name === customDomain); |
| 183 | } |
| 184 | |
| 185 | async function addPagesDomain(account, headers, project, customDomain) { |
| 186 | if (await projectHasPagesDomain(account, headers, project, customDomain)) { |
no test coverage detected