| 1 | import * as GCP from "@/GCP"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { serveProbes } from "../../bindingHost.ts"; |
| 4 | |
| 5 | export const TITLE = "Cotton tee"; |
| 6 | |
| 7 | export const Shirt = GCP.RecommendationEngine.CatalogsCatalogItem("Shirt", { |
| 8 | title: TITLE, |
| 9 | categoryHierarchies: [{ categories: ["Apparel", "T-Shirts"] }], |
| 10 | }); |
| 11 | |
| 12 | /** |
| 13 | * Effect-native Cloud Run service exercising every Recommendations AI |
| 14 | * binding as its own runtime service account. Deployed from |
| 15 | * {@link ../Bindings.test.ts}. |
| 16 | */ |
| 17 | export default class RecommendationEngineBindingsHost extends GCP.Function<RecommendationEngineBindingsHost>()( |
| 18 | "RecommendationEngineBindingsHost", |
| 19 | { main: import.meta.url, invokerIamDisabled: true }, |
| 20 | Effect.gen(function* () { |
| 21 | const getCatalogItem = |
| 22 | yield* GCP.RecommendationEngine.GetCatalogItem(Shirt); |
| 23 | |
| 24 | return { |
| 25 | fetch: serveProbes({ |
| 26 | getCatalogItem: getCatalogItem(), |
| 27 | }), |
| 28 | }; |
| 29 | }).pipe(Effect.provide(GCP.RecommendationEngine.GetCatalogItemHttp)), |
| 30 | ) {} |