| 1 | import * as GCP from "@/GCP"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { serveProbes } from "../../bindingHost.ts"; |
| 4 | |
| 5 | /** |
| 6 | * `…/connections/{c}/entityTypes/{type}` of an existing Integration |
| 7 | * Connectors connection (the test is gated on it being set). |
| 8 | */ |
| 9 | export const ENTITY_TYPE_PARENT = ( |
| 10 | process.env.GCP_TEST_CONNECTORS_PARENT ?? "" |
| 11 | ).trim(); |
| 12 | |
| 13 | /** Entity GetEntity reads. */ |
| 14 | export const Account = GCP.Connectors.ConnectionsEntityTypesEntity("Account", { |
| 15 | parent: ENTITY_TYPE_PARENT, |
| 16 | fields: { Name: "Alchemy Binding" }, |
| 17 | }); |
| 18 | |
| 19 | /** |
| 20 | * Effect-native Cloud Run service exercising every Integration Connectors |
| 21 | * binding as its own runtime service account. Deployed from |
| 22 | * {@link ../Bindings.test.ts}. |
| 23 | */ |
| 24 | export default class ConnectorsBindingsHost extends GCP.Function<ConnectorsBindingsHost>()( |
| 25 | "ConnectorsBindingsHost", |
| 26 | { main: import.meta.url, invokerIamDisabled: true }, |
| 27 | Effect.gen(function* () { |
| 28 | const getEntity = yield* GCP.Connectors.GetEntity(Account); |
| 29 | |
| 30 | return { |
| 31 | fetch: serveProbes({ |
| 32 | getEntity: getEntity(), |
| 33 | }), |
| 34 | }; |
| 35 | }).pipe(Effect.provide(GCP.Connectors.GetEntityHttp)), |
| 36 | ) {} |