(groups: ReadonlyArray<Group>, endpoints: Readonly<Record<string, string>>)
| 398 | } |
| 399 | |
| 400 | function renderImportedProjection(groups: ReadonlyArray<Group>, endpoints: Readonly<Record<string, string>>) { |
| 401 | const imports = groups.flatMap((group) => |
| 402 | group.endpoints.map((endpoint) => { |
| 403 | const name = endpoints[`${group.identifier}.${endpoint.endpoint.name}`] |
| 404 | if (name === undefined) { |
| 405 | throw new GenerationError({ |
| 406 | reason: `Missing imported endpoint: ${group.identifier}.${endpoint.endpoint.name}`, |
| 407 | }) |
| 408 | } |
| 409 | return name |
| 410 | }), |
| 411 | ) |
| 412 | const source = `const Api = HttpApi.make("generated").${groups |
| 413 | .map((group) => { |
| 414 | const options = group.endpoints[0]?.topLevel ? ", { topLevel: true }" : "" |
| 415 | return `add(HttpApiGroup.make(${JSON.stringify(group.identifier)}${options})${group.endpoints.map((endpoint) => `.add(${endpoints[`${group.identifier}.${endpoint.endpoint.name}`]})`).join("")})` |
| 416 | }) |
| 417 | .join(".")}\n\n` |
| 418 | return { imports: [...new Set(imports)], source } |
| 419 | } |
| 420 | |
| 421 | function renderPromiseTypes( |
| 422 | groups: ReadonlyArray<Group>, |
no outgoing calls
no test coverage detected