| 1 | import { |
| 2 | makeNamedHttpBinding, |
| 3 | type BindingIam, |
| 4 | type GcpHttpOp, |
| 5 | } from "../HttpBinding.ts"; |
| 6 | import type { Function as CloudFunction } from "./Function.ts"; |
| 7 | |
| 8 | /** |
| 9 | * Shared HTTP scaffolding for Cloud Functions bindings. |
| 10 | * NOT exported from index.ts. |
| 11 | */ |
| 12 | export const makeFunctionHttpBinding = < |
| 13 | I extends { name?: string }, |
| 14 | A, |
| 15 | E, |
| 16 | >(options: { |
| 17 | tag: string; |
| 18 | iam: BindingIam; |
| 19 | operation: GcpHttpOp<I, A, E>; |
| 20 | }) => |
| 21 | makeNamedHttpBinding<CloudFunction, I, A, E>({ |
| 22 | tag: options.tag, |
| 23 | operation: options.operation, |
| 24 | iam: options.iam, |
| 25 | resourceName: (fn) => fn.name, |
| 26 | }); |