diff --git a/bun.lock b/bun.lock index 251e0071..9c136e28 100644 --- a/bun.lock +++ b/bun.lock @@ -8,7 +8,7 @@ }, "devDependencies": { "prettier": "3.5.3", - "sst": "3.17.11", + "sst": "3.17.12", }, }, "cloud/app": { @@ -495,7 +495,7 @@ "@hey-api/json-schema-ref-parser": ["@hey-api/json-schema-ref-parser@1.0.6", "", { "dependencies": { "@jsdevtools/ono": "^7.1.3", "@types/json-schema": "^7.0.15", "js-yaml": "^4.1.0", "lodash": "^4.17.21" } }, "sha512-yktiFZoWPtEW8QKS65eqKwA5MTKp88CyiL8q72WynrBs/73SAaxlSWlA2zW/DZlywZ5hX1OYzrCC0wFdvO9c2w=="], - "@hey-api/openapi-ts": ["@hey-api/openapi-ts@0.80.1", "", { "dependencies": { "@hey-api/json-schema-ref-parser": "1.0.6", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", "commander": "13.0.0", "handlebars": "4.7.8", "open": "10.1.2", "semver": "7.7.2" }, "peerDependencies": { "typescript": "^5.5.3" }, "bin": { "openapi-ts": "bin/index.cjs" } }, "sha512-AC478kg36vmmrseLZNFonZ/cmXXmDzW5yWz4PVg1S8ebJsRtVRJ/QU+mtnXfzf9avN2P0pz/AO4WAe4jyFY2gA=="], + "@hey-api/openapi-ts": ["@hey-api/openapi-ts@0.81.0", "", { "dependencies": { "@hey-api/json-schema-ref-parser": "1.0.6", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", "commander": "13.0.0", "handlebars": "4.7.8", "js-yaml": "4.1.0", "open": "10.1.2", "semver": "7.7.2" }, "peerDependencies": { "typescript": "^5.5.3" }, "bin": { "openapi-ts": "bin/index.cjs" } }, "sha512-PoJukNBkUfHOoMDpN33bBETX49TUhy7Hu8Sa0jslOvFndvZ5VjQr4Nl/Dzjb9LG1Lp5HjybyTJMA6a1zYk/q6A=="], "@hono/zod-validator": ["@hono/zod-validator@0.4.2", "", { "peerDependencies": { "hono": ">=3.9.0", "zod": "^3.19.1" } }, "sha512-1rrlBg+EpDPhzOV4hT9pxr5+xDVmKuz6YJl+la7VCwK6ass5ldyKm5fD+umJdV2zhHD6jROoCCv8NbTwyfhT0g=="], @@ -1531,7 +1531,7 @@ "end-of-stream": ["end-of-stream@1.4.5", "", { "dependencies": { "once": "^1.4.0" } }, "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg=="], - "entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="], + "entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], "env-paths": ["env-paths@3.0.0", "", {}, "sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A=="], @@ -2675,23 +2675,23 @@ "ssri": ["ssri@10.0.6", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ=="], - "sst": ["sst@3.17.11", "", { "dependencies": { "aws-sdk": "2.1692.0", "aws4fetch": "1.0.18", "jose": "5.2.3", "opencontrol": "0.0.6", "openid-client": "5.6.4" }, "optionalDependencies": { "sst-darwin-arm64": "3.17.11", "sst-darwin-x64": "3.17.11", "sst-linux-arm64": "3.17.11", "sst-linux-x64": "3.17.11", "sst-linux-x86": "3.17.11", "sst-win32-arm64": "3.17.11", "sst-win32-x64": "3.17.11", "sst-win32-x86": "3.17.11" }, "bin": { "sst": "bin/sst.mjs" } }, "sha512-Hwl14L55ZmgAX2ZtBSBoe5BpClSlZ/LNPgB/yqQpX2eaWME5dmW+Qmrm1HHGLft8JD85pJd6P2i7wuFkMrS/qA=="], + "sst": ["sst@3.17.12", "", { "dependencies": { "aws-sdk": "2.1692.0", "aws4fetch": "1.0.18", "jose": "5.2.3", "opencontrol": "0.0.6", "openid-client": "5.6.4" }, "optionalDependencies": { "sst-darwin-arm64": "3.17.12", "sst-darwin-x64": "3.17.12", "sst-linux-arm64": "3.17.12", "sst-linux-x64": "3.17.12", "sst-linux-x86": "3.17.12", "sst-win32-arm64": "3.17.12", "sst-win32-x64": "3.17.12", "sst-win32-x86": "3.17.12" }, "bin": { "sst": "bin/sst.mjs" } }, "sha512-UwUbucNZRLp9GHgPAwkat1sBsNGaJfHsLXZHCMKsolCW7CEuugJfvBl2vOyJrhKP4N+Xnv1QFh0BGsOmN0kQeA=="], - "sst-darwin-arm64": ["sst-darwin-arm64@3.17.11", "", { "os": "darwin", "cpu": "arm64" }, "sha512-c3A0MIJ+fb2T6gjUvDvt3Pakx9QSqJduO3gb48kVlE0NPApTau16CXzEyyoVKZNFxGFakuGUjFtTJfrfmTiwbA=="], + "sst-darwin-arm64": ["sst-darwin-arm64@3.17.12", "", { "os": "darwin", "cpu": "arm64" }, "sha512-9Oky2ZmJoeEN97ALWtFRt3kvSIZLjYoQoOtJvTaNQJTFi/9OsUE/6I5zdedf5GhMKCT1JvY+Ngpv3U3Y6SEYOg=="], - "sst-darwin-x64": ["sst-darwin-x64@3.17.11", "", { "os": "darwin", "cpu": "x64" }, "sha512-ctKPvmN4E52sN23EpTcuDQPXYkic8iY9Piy6b3ie9g1voPxs0h36XrRIckbYq5enSeby2Gk4BeI7OaZlj8B90A=="], + "sst-darwin-x64": ["sst-darwin-x64@3.17.12", "", { "os": "darwin", "cpu": "x64" }, "sha512-n6tWCjFF9Pb+QzxXJmuTGfQ4GW96Nf6ATtb7Wpa+9RDLRHrEBdOjXAp7osr7MB9djPRkt4942nwUZ7wX/EULpg=="], - "sst-linux-arm64": ["sst-linux-arm64@3.17.11", "", { "os": "linux", "cpu": "arm64" }, "sha512-LdXpUDT5A5g6W0YkON15ySwmTDMbhXkbVxCk6YqB4eus5iEL4pniV/qImPsHcl5od2bWbPosjeDFLnGogxwPLA=="], + "sst-linux-arm64": ["sst-linux-arm64@3.17.12", "", { "os": "linux", "cpu": "arm64" }, "sha512-iMflBzQWhF5kmRdXu402dwVpQI9LfFR3yFok3HUTV0ema5Pq2kPphEatEEw1dyG2ZXCBLeKN+T3Ujjfer+ddRA=="], - "sst-linux-x64": ["sst-linux-x64@3.17.11", "", { "os": "linux", "cpu": "x64" }, "sha512-UU7ZK4qlb19Bc6G3Tj8BL0lYhKRBkdVul3gsCHc8D07gjHrDYP1JZcRPteq/Ij7zLlLBzNilwhpBNhDcRqJ2BA=="], + "sst-linux-x64": ["sst-linux-x64@3.17.12", "", { "os": "linux", "cpu": "x64" }, "sha512-89rZXs3IfGrY9yiDNuLfcJvHnAUX1gRVeB+lqQ1M2sbJD2iMpN+fx93owcApAndtZYzYNfQYEZ/xYwI6HFfu4w=="], - "sst-linux-x86": ["sst-linux-x86@3.17.11", "", { "os": "linux", "cpu": "none" }, "sha512-q/Y+trzKVT9pc/kIYkgnISQqv69y/6T6IM1/fBgq3ZWbb9TBpLrW848vFS0PThH23QrcuV1U+2e6a9IgU67LHg=="], + "sst-linux-x86": ["sst-linux-x86@3.17.12", "", { "os": "linux", "cpu": "none" }, "sha512-Zc2nd2syaq/DfNxtDcn4NOh8RBCaCZ1qsjLFpvGGfMMRnGiWjofuE6eFX3fhchGL3uvaqwlENvtzj4UC/MF5wQ=="], - "sst-win32-arm64": ["sst-win32-arm64@3.17.11", "", { "os": "win32", "cpu": "arm64" }, "sha512-lTIepV7/0GqUTbpTIAYs3KZegRzvb+xYEwkJwEFL7eCKKUGnrGPo13858PHeKmYdGRWa4tbeOsviRYaoXrWCDw=="], + "sst-win32-arm64": ["sst-win32-arm64@3.17.12", "", { "os": "win32", "cpu": "arm64" }, "sha512-Bb7M6PoImmGeyzJu75QbNHBs0mDp21DsKFyMucn2dwxYwahuFPjjMbG+tlziWtxcNgdZMdEcy9jR8ot1jAIh0Q=="], - "sst-win32-x64": ["sst-win32-x64@3.17.11", "", { "os": "win32", "cpu": "x64" }, "sha512-CLZTwqRDUGWShaR02Nd1VMGG9G/a50NY0rjh/WopaTFj2SoEot/vZil4LkVWqma4rOdNX+ABJ4//O92VQSHkQQ=="], + "sst-win32-x64": ["sst-win32-x64@3.17.12", "", { "os": "win32", "cpu": "x64" }, "sha512-7f41o1WhxdcuLhHijoavkX5O3L/Pnma6zCoL3kG6f9Njc6Zyj8Oha2fQz6Tesb/Qt8deG04WU4bL3FmxgNHU6g=="], - "sst-win32-x86": ["sst-win32-x86@3.17.11", "", { "os": "win32", "cpu": "none" }, "sha512-KQKeU/6m7AUu9LFg71wMn6612aY+ZHwmUsTRdGPOt6zDr1oGJAFUy8lXtbqx6txpdKgDzixHDT6aLXvnf9DR0Q=="], + "sst-win32-x86": ["sst-win32-x86@3.17.12", "", { "os": "win32", "cpu": "none" }, "sha512-AfsNJQMTlefHitaVRWh5Uf3AaICIaomFbSo5qDbibgkvhbppCxgMFpW0IxiWySjWrCN5hMMkxdxlZP9IHqqxjQ=="], "stack-trace": ["stack-trace@0.0.10", "", {}, "sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg=="], @@ -3117,8 +3117,6 @@ "@openauthjs/solid/@openauthjs/openauth": ["@openauthjs/openauth@0.4.2", "", { "dependencies": { "@standard-schema/spec": "1.0.0-beta.3", "aws4fetch": "1.0.20", "jose": "5.9.6" }, "peerDependencies": { "arctic": "^2.2.2", "hono": "^4.0.0" } }, "sha512-8+Bia559iffrZXfQ0LWXrVVVriochS88pDtB8indyQ1S+40MQgDBu8aBzKt+fgSrTmoQGCTT+wlOXgbjc9qIcw=="], - "@opencode-ai/sdk/@hey-api/openapi-ts": ["@hey-api/openapi-ts@0.81.0", "", { "dependencies": { "@hey-api/json-schema-ref-parser": "1.0.6", "ansi-colors": "4.1.3", "c12": "2.0.1", "color-support": "1.1.3", "commander": "13.0.0", "handlebars": "4.7.8", "js-yaml": "4.1.0", "open": "10.1.2", "semver": "7.7.2" }, "peerDependencies": { "typescript": "^5.5.3" }, "bin": { "openapi-ts": "bin/index.cjs" } }, "sha512-PoJukNBkUfHOoMDpN33bBETX49TUhy7Hu8Sa0jslOvFndvZ5VjQr4Nl/Dzjb9LG1Lp5HjybyTJMA6a1zYk/q6A=="], - "@opentelemetry/instrumentation-grpc/@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.27.0", "", {}, "sha512-sAay1RrB+ONOem0OZanAR1ZI/k7yDpnOQSQmTMuGImUQb2y8EbSaCJ94FQluM74xoU03vlb2d2U90hZluL6nQg=="], "@oslojs/jwt/@oslojs/encoding": ["@oslojs/encoding@0.4.1", "", {}, "sha512-hkjo6MuIK/kQR5CrGNdAPZhS01ZCXuWDRJ187zh6qqF2+yMHZpD9fAYpX8q2bOO6Ryhl3XpCT6kUX76N8hhm4Q=="], @@ -3161,8 +3159,6 @@ "@vinxi/server-components/magicast": ["magicast@0.2.11", "", { "dependencies": { "@babel/parser": "^7.22.16", "@babel/types": "^7.22.17", "recast": "^0.23.4" } }, "sha512-6saXbRDA1HMkqbsvHOU6HBjCVgZT460qheRkLhJQHWAbhXoWESI3Kn/dGGXyKs15FFKR85jsUqFx2sMK0wy/5g=="], - "@vue/compiler-core/entities": ["entities@4.5.0", "", {}, "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw=="], - "@vue/compiler-core/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="], "@vue/compiler-sfc/estree-walker": ["estree-walker@2.0.2", "", {}, "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w=="], @@ -3309,6 +3305,8 @@ "parse-json/@babel/code-frame": ["@babel/code-frame@7.27.1", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.27.1", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg=="], + "parse5/entities": ["entities@6.0.1", "", {}, "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g=="], + "path-scurry/lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="], "pkg-types/pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], diff --git a/cloud/app/app.config.ts b/cloud/app/app.config.ts index 0ffa557f..4dd799ed 100644 --- a/cloud/app/app.config.ts +++ b/cloud/app/app.config.ts @@ -5,5 +5,18 @@ export default defineConfig({ server: { allowedHosts: true, }, + build: { + rollupOptions: { + external: ["cloudflare:workers"], + }, + minify: false, + }, + }, + server: { + compatibilityDate: "2024-09-19", + preset: "cloudflare_module", + cloudflare: { + nodeCompat: true, + }, }, }) diff --git a/cloud/app/src/global.d.ts b/cloud/app/src/global.d.ts index dc6f10c2..a44606d2 100644 --- a/cloud/app/src/global.d.ts +++ b/cloud/app/src/global.d.ts @@ -1 +1,2 @@ /// +declare module "cloudflare:workers" diff --git a/cloud/app/src/routes/auth/callback.ts b/cloud/app/src/routes/auth/callback.ts index edeb3579..4e38df07 100644 --- a/cloud/app/src/routes/auth/callback.ts +++ b/cloud/app/src/routes/auth/callback.ts @@ -1,6 +1,7 @@ import { redirect } from "@solidjs/router" import type { APIEvent } from "@solidjs/start/server" -import { AuthClient, useAuthSession } from "~/context/auth" +import { AuthClient } from "~/context/auth" +import { useAuthSession } from "~/context/auth.session" export async function GET(input: APIEvent) { const url = new URL(input.request.url) diff --git a/cloud/app/src/routes/gateway/v1/chat/completions.ts b/cloud/app/src/routes/gateway/v1/chat/completions.ts index f69feade..95c2c268 100644 --- a/cloud/app/src/routes/gateway/v1/chat/completions.ts +++ b/cloud/app/src/routes/gateway/v1/chat/completions.ts @@ -1,4 +1,4 @@ -import { Resource } from "sst" +import { Resource } from "@opencode/cloud-core/util/resource.js" import { Billing } from "@opencode/cloud-core/billing.js" import type { APIEvent } from "@solidjs/start/server" import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js" diff --git a/cloud/app/src/routes/index.tsx b/cloud/app/src/routes/index.tsx index b9344bc5..5a4e0797 100644 --- a/cloud/app/src/routes/index.tsx +++ b/cloud/app/src/routes/index.tsx @@ -31,8 +31,6 @@ const isLoggedIn = query(async () => { return false }, "isLoggedIn") - - export default function Home() { createAsync(() => isLoggedIn(), { deferStream: true, @@ -83,7 +81,9 @@ export default function Home() {
- Login + + Login +
diff --git a/cloud/app/src/routes/stripe/webhook.ts b/cloud/app/src/routes/stripe/webhook.ts index 258ebe41..29f0f248 100644 --- a/cloud/app/src/routes/stripe/webhook.ts +++ b/cloud/app/src/routes/stripe/webhook.ts @@ -1,4 +1,3 @@ -import { Resource } from "sst" import { Billing } from "@opencode/cloud-core/billing.js" import type { APIEvent } from "@solidjs/start/server" import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js" @@ -6,6 +5,7 @@ import { BillingTable, PaymentTable } from "@opencode/cloud-core/schema/billing. import { Identifier } from "@opencode/cloud-core/identifier.js" import { centsToMicroCents } from "@opencode/cloud-core/util/price.js" import { Actor } from "@opencode/cloud-core/actor.js" +import { Resource } from "@opencode/cloud-core/util/resource.js" export async function POST(input: APIEvent) { const body = await Billing.stripe().webhooks.constructEventAsync( diff --git a/cloud/core/drizzle.config.ts b/cloud/core/drizzle.config.ts index c65363cb..82c48783 100644 --- a/cloud/core/drizzle.config.ts +++ b/cloud/core/drizzle.config.ts @@ -1,5 +1,5 @@ import { defineConfig } from "drizzle-kit" -import { Resource } from "sst" +import { Resource } from "./src/util/resource" export default defineConfig({ out: "./migrations/", diff --git a/cloud/core/src/billing.ts b/cloud/core/src/billing.ts index 94ba23b8..705999c2 100644 --- a/cloud/core/src/billing.ts +++ b/cloud/core/src/billing.ts @@ -1,4 +1,3 @@ -import { Resource } from "sst" import { Stripe } from "stripe" import { Database, eq, sql } from "./drizzle" import { BillingTable, PaymentTable, UsageTable } from "./schema/billing.sql" @@ -8,6 +7,7 @@ import { z } from "zod" import { Identifier } from "./identifier" import { centsToMicroCents } from "./util/price" import { User } from "./user" +import { Resource } from "./util/resource" export namespace Billing { export const stripe = () => diff --git a/cloud/core/src/drizzle/index.ts b/cloud/core/src/drizzle/index.ts index f35ce0a3..894f578f 100644 --- a/cloud/core/src/drizzle/index.ts +++ b/cloud/core/src/drizzle/index.ts @@ -1,5 +1,5 @@ import { drizzle } from "drizzle-orm/postgres-js" -import { Resource } from "sst" +import { Resource } from "../util/resource" export * from "drizzle-orm" import postgres from "postgres" diff --git a/cloud/core/src/util/resource.ts b/cloud/core/src/util/resource.ts new file mode 100644 index 00000000..1543145d --- /dev/null +++ b/cloud/core/src/util/resource.ts @@ -0,0 +1,14 @@ +import { env } from "cloudflare:workers"; + +export const Resource = new Proxy( + {}, + { + get(_target, prop: string) { + if (prop in env) { + const value = env[prop]; + return typeof value === "string" ? JSON.parse(value) : value; + } + throw new Error(`"${prop}" is not linked in your sst.config.ts`); + }, + } +) as Record; diff --git a/cloud/function/src/auth.ts b/cloud/function/src/auth.ts index 5d7c852c..79d7805d 100644 --- a/cloud/function/src/auth.ts +++ b/cloud/function/src/auth.ts @@ -1,4 +1,3 @@ -import { Resource } from "sst" import { z } from "zod" import { issuer } from "@openauthjs/openauth" import type { Theme } from "@openauthjs/openauth/ui/theme" @@ -10,6 +9,7 @@ import { CloudflareStorage } from "@openauthjs/openauth/storage/cloudflare" import { Account } from "@opencode/cloud-core/account.js" import { Workspace } from "@opencode/cloud-core/workspace.js" import { Actor } from "@opencode/cloud-core/actor.js" +import { Resource } from "@opencode/cloud-core/util/resource.js" type Env = { AuthStorage: KVNamespace @@ -28,8 +28,8 @@ export const subjects = createSubjects({ const MY_THEME: Theme = { ...THEME_OPENAUTH, - logo: "https://opencode.ai/favicon.svg" -}; + logo: "https://opencode.ai/favicon.svg", +} export default { async fetch(request: Request, env: Env, ctx: ExecutionContext) { diff --git a/cloud/function/src/gateway.ts b/cloud/function/src/gateway.ts index 2f498276..c8b39990 100644 --- a/cloud/function/src/gateway.ts +++ b/cloud/function/src/gateway.ts @@ -3,7 +3,7 @@ import { Hono, MiddlewareHandler } from "hono" import { cors } from "hono/cors" import { HTTPException } from "hono/http-exception" import { zValidator } from "@hono/zod-validator" -import { Resource } from "sst" +import { Resource } from "@opencode/cloud-core/util/resource.js" import { type ProviderMetadata, type LanguageModelUsage, generateText, streamText } from "ai" import { createAnthropic } from "@ai-sdk/anthropic" import { createOpenAI } from "@ai-sdk/openai" diff --git a/cloud/function/sst-env.d.ts b/cloud/function/sst-env.d.ts index f60ec81a..9c4f5cc0 100644 --- a/cloud/function/sst-env.d.ts +++ b/cloud/function/sst-env.d.ts @@ -14,6 +14,10 @@ declare module "sst" { "type": "sst.sst.Linkable" "value": string } + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string + } "DATABASE_PASSWORD": { "type": "sst.sst.Secret" "value": string diff --git a/infra/cloud.ts b/infra/cloud.ts index 13fb2768..542aef96 100644 --- a/infra/cloud.ts +++ b/infra/cloud.ts @@ -1,6 +1,5 @@ import { WebhookEndpoint } from "pulumi-stripe" import { domain } from "./stage" -import { web } from "./app" //////////////// // DATABASE @@ -106,23 +105,9 @@ export const gateway = new sst.cloudflare.Worker("GatewayApi", { // CONSOLE //////////////// -/* -export const console = new sst.cloudflare.x.StaticSite("Console", { +export const console = new sst.cloudflare.x.SolidStart("Console", { domain: `console.${domain}`, - path: "cloud/web", - build: { - command: "bun run build", - output: "dist/client", - }, - environment: { - VITE_DOCS_URL: web.url.apply((url) => url!), - VITE_API_URL: gateway.url.apply((url) => url!), - VITE_AUTH_URL: auth.url.apply((url) => url!), - }, -}) -*/ - -new sst.x.DevCommand("Solid", { + path: "cloud/app", link: [ database, AUTH_API_URL, @@ -132,11 +117,19 @@ new sst.x.DevCommand("Solid", { OPENAI_API_KEY, ZHIPU_API_KEY, ], - dev: { - directory: "cloud/app", - command: "bun dev", - }, environment: { + //VITE_DOCS_URL: web.url.apply((url) => url!), + //VITE_API_URL: gateway.url.apply((url) => url!), VITE_AUTH_URL: auth.url.apply((url) => url!), }, }) + +//new sst.x.DevCommand("Solid", { +// dev: { +// directory: "cloud/app", +// command: "bun dev", +// }, +// environment: { +// VITE_AUTH_URL: auth.url.apply((url) => url!), +// }, +//}) diff --git a/package.json b/package.json index 2ba76807..a38d1b61 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ }, "devDependencies": { "prettier": "3.5.3", - "sst": "3.17.11" + "sst": "3.17.12" }, "repository": { "type": "git", diff --git a/packages/function/sst-env.d.ts b/packages/function/sst-env.d.ts index f60ec81a..9c4f5cc0 100644 --- a/packages/function/sst-env.d.ts +++ b/packages/function/sst-env.d.ts @@ -14,6 +14,10 @@ declare module "sst" { "type": "sst.sst.Linkable" "value": string } + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string + } "DATABASE_PASSWORD": { "type": "sst.sst.Secret" "value": string diff --git a/sst-env.d.ts b/sst-env.d.ts index 5715d2ea..8725b456 100644 --- a/sst-env.d.ts +++ b/sst-env.d.ts @@ -28,6 +28,10 @@ declare module "sst" { "name": string "type": "sst.cloudflare.Bucket" } + "Console": { + "type": "sst.cloudflare.SolidStart" + "url": string + } "DATABASE_PASSWORD": { "type": "sst.sst.Secret" "value": string