| 81 | export const layerWith = (resolve: Interface["resolve"]) => Layer.succeed(Service, Service.of({ resolve })) |
| 82 | |
| 83 | const apiKey = (model: ModelV2.Info, credential?: Credential.Value) => { |
| 84 | if (credential?.type === "key") return Auth.value(credential.key) |
| 85 | if (credential?.type === "oauth") return Auth.value(credential.access) |
| 86 | const value = model.request.body.apiKey ?? model.api.settings?.apiKey |
| 87 | if (typeof value === "string") return Auth.value(value) |
| 88 | } |
| 89 | |
| 90 | const withDefaults = (model: ModelV2.Info, route: AnyRoute) => { |
| 91 | const body = model.request.body |