The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { GcpEnvironment } from "@alchemy.run/gcp/Environment"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { MinimumLogLevel } from "effect/References"; |
| 4 | |
| 5 | export const logLevel = Effect.provideService( |
| 6 | MinimumLogLevel, |
| 7 | process.env.DEBUG ? "Debug" : "Info", |
| 8 | ); |
| 9 | |
| 10 | export const currentProject = GcpEnvironment.current.pipe(Effect.map((env) => env.project)); |
| 11 | export const location = "us-central1"; |
| 12 | |
| 13 | export const missingService = (serviceId = "alchemy-missing-service") => |
| 14 | currentProject.pipe( |
| 15 | Effect.map((project) => `projects/${project}/locations/${location}/services/${serviceId}`), |
| 16 | ); |
| 17 | |
| 18 | export const missingSchema = (serviceId = "alchemy-missing-service") => |
| 19 | missingService(serviceId).pipe(Effect.map((name) => `${name}/schemas/main`)); |
| 20 | |
| 21 | export const missingConnector = (serviceId = "alchemy-missing-service") => |
| 22 | missingService(serviceId).pipe( |
| 23 | Effect.map((name) => `${name}/connectors/alchemy-missing-connector`), |
| 24 | ); |
| 25 | |
| 26 | export const schemaSource = (extraField?: string) => ({ |
| 27 | files: [ |
| 28 | { |
| 29 | path: "schema.gql", |
| 30 | content: |
| 31 | extraField === undefined |
| 32 | ? "type AlchemyNote @table { title: String! }" |
| 33 | : `type AlchemyNote @table { title: String! ${extraField} }`, |
| 34 | }, |
| 35 | ], |
| 36 | }); |
| 37 | |
| 38 | export const unlinkedDatasources = [{ postgresql: { unlinked: true as const } }]; |
| 39 | |
| 40 | export const connectorSource = { |
| 41 | files: [ |
| 42 | { |
| 43 | path: "queries.gql", |
| 44 | content: "query ListAlchemyNotes @auth(level: PUBLIC) { alchemyNotes { id title } }", |
| 45 | }, |
| 46 | ], |
| 47 | }; |