summaryrefslogtreecommitdiffhomepage
path: root/cloud/resource
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-08-30 00:58:22 -0400
committerDax Raad <[email protected]>2025-08-30 00:58:22 -0400
commitf821b555140cc41f68c7c034bb82ae0cb07d7321 (patch)
tree1f7f5b7d6534f02809bdded6ab311603930cfa0e /cloud/resource
parent37f284f9a97d3354143d64fc76c2eb9f7d9ccf9e (diff)
downloadopencode-f821b555140cc41f68c7c034bb82ae0cb07d7321.tar.gz
opencode-f821b555140cc41f68c7c034bb82ae0cb07d7321.zip
ignore: cloud resource
Diffstat (limited to 'cloud/resource')
-rw-r--r--cloud/resource/bun.lock13
-rw-r--r--cloud/resource/package.json15
-rw-r--r--cloud/resource/resource.cloudflare.ts15
-rw-r--r--cloud/resource/resource.node.ts2
-rw-r--r--cloud/resource/sst-env.d.ts92
-rw-r--r--cloud/resource/tsconfig.json12
6 files changed, 149 insertions, 0 deletions
diff --git a/cloud/resource/bun.lock b/cloud/resource/bun.lock
new file mode 100644
index 000000000..56bdf44ca
--- /dev/null
+++ b/cloud/resource/bun.lock
@@ -0,0 +1,13 @@
+{
+ "lockfileVersion": 1,
+ "workspaces": {
+ "": {
+ "dependencies": {
+ "@cloudflare/workers-types": "^4.20250830.0",
+ },
+ },
+ },
+ "packages": {
+ "@cloudflare/workers-types": ["@cloudflare/[email protected]", "", {}, "sha512-uAGZFqEBFnCiwIokxMnrrtjIkT8qyGT1LACSScEUyW7nKmtD0Viykp9QZWrIlssyEp/MDB6XsdALF8y6upxpcg=="],
+ }
+}
diff --git a/cloud/resource/package.json b/cloud/resource/package.json
new file mode 100644
index 000000000..fd9fa6f34
--- /dev/null
+++ b/cloud/resource/package.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://json.schemastore.org/package.json",
+ "name": "@opencode/cloud-resource",
+ "dependencies": {
+ "@cloudflare/workers-types": "^4.20250830.0"
+ },
+ "exports": {
+ ".": {
+ "production": {
+ "import": "./resource.cloudflare.ts"
+ },
+ "import": "./resource.node.ts"
+ }
+ }
+}
diff --git a/cloud/resource/resource.cloudflare.ts b/cloud/resource/resource.cloudflare.ts
new file mode 100644
index 000000000..ad3fbe2a8
--- /dev/null
+++ b/cloud/resource/resource.cloudflare.ts
@@ -0,0 +1,15 @@
+import { env } from "cloudflare:workers"
+
+export const Resource = new Proxy(
+ {},
+ {
+ get(_target, prop: string) {
+ if (prop in env) {
+ // @ts-expect-error
+ const value = env[prop]
+ return typeof value === "string" ? JSON.parse(value) : value
+ }
+ throw new Error(`"${prop}" is not linked in your sst.config.ts (cloudflare)`)
+ },
+ },
+) as Record<string, any>
diff --git a/cloud/resource/resource.node.ts b/cloud/resource/resource.node.ts
new file mode 100644
index 000000000..a13102198
--- /dev/null
+++ b/cloud/resource/resource.node.ts
@@ -0,0 +1,2 @@
+console.log(process.env)
+export { Resource } from "sst"
diff --git a/cloud/resource/sst-env.d.ts b/cloud/resource/sst-env.d.ts
new file mode 100644
index 000000000..9c4f5cc0d
--- /dev/null
+++ b/cloud/resource/sst-env.d.ts
@@ -0,0 +1,92 @@
+/* This file is auto-generated by SST. Do not edit. */
+/* tslint:disable */
+/* eslint-disable */
+/* deno-fmt-ignore-file */
+
+import "sst"
+declare module "sst" {
+ export interface Resource {
+ "ANTHROPIC_API_KEY": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "AUTH_API_URL": {
+ "type": "sst.sst.Linkable"
+ "value": string
+ }
+ "Console": {
+ "type": "sst.cloudflare.SolidStart"
+ "url": string
+ }
+ "DATABASE_PASSWORD": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "DATABASE_USERNAME": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "Database": {
+ "database": string
+ "host": string
+ "password": string
+ "port": number
+ "type": "sst.sst.Linkable"
+ "username": string
+ }
+ "GITHUB_APP_ID": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "GITHUB_APP_PRIVATE_KEY": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "GITHUB_CLIENT_ID_CONSOLE": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "GITHUB_CLIENT_SECRET_CONSOLE": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "GOOGLE_CLIENT_ID": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "OPENAI_API_KEY": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "STRIPE_SECRET_KEY": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ "STRIPE_WEBHOOK_SECRET": {
+ "type": "sst.sst.Linkable"
+ "value": string
+ }
+ "Web": {
+ "type": "sst.cloudflare.Astro"
+ "url": string
+ }
+ "ZHIPU_API_KEY": {
+ "type": "sst.sst.Secret"
+ "value": string
+ }
+ }
+}
+// cloudflare
+import * as cloudflare from "@cloudflare/workers-types";
+declare module "sst" {
+ export interface Resource {
+ "Api": cloudflare.Service
+ "AuthApi": cloudflare.Service
+ "AuthStorage": cloudflare.KVNamespace
+ "Bucket": cloudflare.R2Bucket
+ "GatewayApi": cloudflare.Service
+ }
+}
+
+import "sst"
+export {} \ No newline at end of file
diff --git a/cloud/resource/tsconfig.json b/cloud/resource/tsconfig.json
new file mode 100644
index 000000000..829dbad01
--- /dev/null
+++ b/cloud/resource/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://json.schemastore.org/tsconfig",
+ "extends": "@tsconfig/node22/tsconfig.json",
+ "compilerOptions": {
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "types": [
+ "@cloudflare/workers-types",
+ "node"
+ ]
+ }
+}