Download packages/console/resource/resource.cloudflare.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 759 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/console/resource/resource.cloudflare.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/console/resource/resource.cloudflare.ts
-
curl -L -o resource.cloudflare.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/console/resource/resource.cloudflare.ts
759 Bytes
| import { env } from "cloudflare:workers" | |
| export { waitUntil } from "cloudflare:workers" | |
| export const Resource = new Proxy( | |
| {}, | |
| { | |
| get(_target, prop: string) { | |
| if (`SST_RESOURCE_${prop}` in env) { | |
| // @ts-expect-error | |
| const value = env[`SST_RESOURCE_${prop}`] | |
| return typeof value === "string" ? JSON.parse(value) : value | |
| } | |
| if (prop in env) { | |
| // @ts-expect-error | |
| const value = env[prop] | |
| return typeof value === "string" ? JSON.parse(value) : value | |
| } else if (prop === "App") { | |
| // @ts-expect-error | |
| return JSON.parse(env.SST_RESOURCE_App) | |
| } | |
| throw new Error(`"${prop}" is not linked in your sst.config.ts (cloudflare)`) | |
| }, | |
| }, | |
| ) as Record<string, any> | |