mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 18:24:21 +01:00
ignore: cloud resource
This commit is contained in:
11
bun.lock
11
bun.lock
@@ -29,6 +29,7 @@
|
|||||||
"version": "0.5.28",
|
"version": "0.5.28",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sts": "3.782.0",
|
"@aws-sdk/client-sts": "3.782.0",
|
||||||
|
"@opencode/cloud-resource": "workspace:*",
|
||||||
"drizzle-orm": "0.41.0",
|
"drizzle-orm": "0.41.0",
|
||||||
"postgres": "3.4.7",
|
"postgres": "3.4.7",
|
||||||
"stripe": "18.0.0",
|
"stripe": "18.0.0",
|
||||||
@@ -58,6 +59,12 @@
|
|||||||
"typescript": "catalog:",
|
"typescript": "catalog:",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"cloud/resource": {
|
||||||
|
"name": "@opencode/cloud-resource",
|
||||||
|
"dependencies": {
|
||||||
|
"@cloudflare/workers-types": "^4.20250830.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
"packages/function": {
|
"packages/function": {
|
||||||
"name": "@opencode/function",
|
"name": "@opencode/function",
|
||||||
"version": "0.5.28",
|
"version": "0.5.28",
|
||||||
@@ -652,6 +659,8 @@
|
|||||||
|
|
||||||
"@opencode/cloud-function": ["@opencode/cloud-function@workspace:cloud/function"],
|
"@opencode/cloud-function": ["@opencode/cloud-function@workspace:cloud/function"],
|
||||||
|
|
||||||
|
"@opencode/cloud-resource": ["@opencode/cloud-resource@workspace:cloud/resource"],
|
||||||
|
|
||||||
"@opencode/function": ["@opencode/function@workspace:packages/function"],
|
"@opencode/function": ["@opencode/function@workspace:packages/function"],
|
||||||
|
|
||||||
"@opencode/web": ["@opencode/web@workspace:packages/web"],
|
"@opencode/web": ["@opencode/web@workspace:packages/web"],
|
||||||
@@ -3034,6 +3043,8 @@
|
|||||||
|
|
||||||
"@openauthjs/openauth/jose": ["jose@5.9.6", "", {}, "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ=="],
|
"@openauthjs/openauth/jose": ["jose@5.9.6", "", {}, "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ=="],
|
||||||
|
|
||||||
|
"@opencode/cloud-resource/@cloudflare/workers-types": ["@cloudflare/workers-types@4.20250830.0", "", {}, "sha512-uAGZFqEBFnCiwIokxMnrrtjIkT8qyGT1LACSScEUyW7nKmtD0Viykp9QZWrIlssyEp/MDB6XsdALF8y6upxpcg=="],
|
||||||
|
|
||||||
"@opentelemetry/instrumentation-grpc/@opentelemetry/semantic-conventions": ["@opentelemetry/semantic-conventions@1.27.0", "", {}, "sha512-sAay1RrB+ONOem0OZanAR1ZI/k7yDpnOQSQmTMuGImUQb2y8EbSaCJ94FQluM74xoU03vlb2d2U90hZluL6nQg=="],
|
"@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=="],
|
"@oslojs/jwt/@oslojs/encoding": ["@oslojs/encoding@0.4.1", "", {}, "sha512-hkjo6MuIK/kQR5CrGNdAPZhS01ZCXuWDRJ187zh6qqF2+yMHZpD9fAYpX8q2bOO6Ryhl3XpCT6kUX76N8hhm4Q=="],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vinxi dev --host 0.0.0.0",
|
"dev": "vinxi dev --host 0.0.0.0",
|
||||||
"dev:remote": "bun sst shell --target=Solid --stage=dev bun dev",
|
"dev:remote": "bun sst shell --target=Console --stage=dev bun dev",
|
||||||
"build": "vinxi build",
|
"build": "vinxi build",
|
||||||
"start": "vinxi start",
|
"start": "vinxi start",
|
||||||
"version": "0.5.28"
|
"version": "0.5.28"
|
||||||
|
|||||||
1
cloud/app/src/global.d.ts
vendored
1
cloud/app/src/global.d.ts
vendored
@@ -1,2 +1 @@
|
|||||||
/// <reference types="@solidjs/start/env" />
|
/// <reference types="@solidjs/start/env" />
|
||||||
declare module "cloudflare:workers"
|
|
||||||
|
|||||||
9
cloud/app/src/routes/debug/index.ts
Normal file
9
cloud/app/src/routes/debug/index.ts
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import type { APIEvent } from "@solidjs/start/server"
|
||||||
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
|
import { json } from "@solidjs/router"
|
||||||
|
|
||||||
|
export async function GET(evt: APIEvent) {
|
||||||
|
return json({
|
||||||
|
data: Resource.Database.host,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Resource } from "@opencode/cloud-core/util/resource.js"
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
import { Billing } from "@opencode/cloud-core/billing.js"
|
import { Billing } from "@opencode/cloud-core/billing.js"
|
||||||
import type { APIEvent } from "@solidjs/start/server"
|
import type { APIEvent } from "@solidjs/start/server"
|
||||||
import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js"
|
import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { BillingTable, PaymentTable } from "@opencode/cloud-core/schema/billing.
|
|||||||
import { Identifier } from "@opencode/cloud-core/identifier.js"
|
import { Identifier } from "@opencode/cloud-core/identifier.js"
|
||||||
import { centsToMicroCents } from "@opencode/cloud-core/util/price.js"
|
import { centsToMicroCents } from "@opencode/cloud-core/util/price.js"
|
||||||
import { Actor } from "@opencode/cloud-core/actor.js"
|
import { Actor } from "@opencode/cloud-core/actor.js"
|
||||||
import { Resource } from "@opencode/cloud-core/util/resource.js"
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
|
|
||||||
export async function POST(input: APIEvent) {
|
export async function POST(input: APIEvent) {
|
||||||
const body = await Billing.stripe().webhooks.constructEventAsync(
|
const body = await Billing.stripe().webhooks.constructEventAsync(
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"customConditions": [
|
||||||
|
"workers"
|
||||||
|
],
|
||||||
"target": "ESNext",
|
"target": "ESNext",
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
@@ -10,10 +14,14 @@
|
|||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"types": ["vinxi/types/client"],
|
"types": [
|
||||||
|
"vinxi/types/client"
|
||||||
|
],
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"~/*": ["./src/*"]
|
"~/*": [
|
||||||
|
"./src/*"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
import { defineConfig } from "drizzle-kit"
|
import { defineConfig } from "drizzle-kit"
|
||||||
import { Resource } from "./src/util/resource"
|
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
out: "./migrations/",
|
out: "./migrations/",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sts": "3.782.0",
|
"@aws-sdk/client-sts": "3.782.0",
|
||||||
|
"@opencode/cloud-resource": "workspace:*",
|
||||||
"drizzle-orm": "0.41.0",
|
"drizzle-orm": "0.41.0",
|
||||||
"postgres": "3.4.7",
|
"postgres": "3.4.7",
|
||||||
"stripe": "18.0.0",
|
"stripe": "18.0.0",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { z } from "zod"
|
|||||||
import { Identifier } from "./identifier"
|
import { Identifier } from "./identifier"
|
||||||
import { centsToMicroCents } from "./util/price"
|
import { centsToMicroCents } from "./util/price"
|
||||||
import { User } from "./user"
|
import { User } from "./user"
|
||||||
import { Resource } from "./util/resource"
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
|
|
||||||
export namespace Billing {
|
export namespace Billing {
|
||||||
export const stripe = () =>
|
export const stripe = () =>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { drizzle } from "drizzle-orm/postgres-js"
|
import { drizzle } from "drizzle-orm/postgres-js"
|
||||||
import { Resource } from "../util/resource"
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
export * from "drizzle-orm"
|
export * from "drizzle-orm"
|
||||||
import postgres from "postgres"
|
import postgres from "postgres"
|
||||||
|
|
||||||
|
|||||||
0
cloud/core/src/util/env.cloudflare.ts
Normal file
0
cloud/core/src/util/env.cloudflare.ts
Normal file
@@ -9,7 +9,7 @@ import { CloudflareStorage } from "@openauthjs/openauth/storage/cloudflare"
|
|||||||
import { Account } from "@opencode/cloud-core/account.js"
|
import { Account } from "@opencode/cloud-core/account.js"
|
||||||
import { Workspace } from "@opencode/cloud-core/workspace.js"
|
import { Workspace } from "@opencode/cloud-core/workspace.js"
|
||||||
import { Actor } from "@opencode/cloud-core/actor.js"
|
import { Actor } from "@opencode/cloud-core/actor.js"
|
||||||
import { Resource } from "@opencode/cloud-core/util/resource.js"
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
|
|
||||||
type Env = {
|
type Env = {
|
||||||
AuthStorage: KVNamespace
|
AuthStorage: KVNamespace
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { Hono, MiddlewareHandler } from "hono"
|
import { Hono, MiddlewareHandler } from "hono"
|
||||||
import { Resource } from "@opencode/cloud-core/util/resource.js"
|
|
||||||
import { type ProviderMetadata, type LanguageModelUsage } from "ai"
|
import { type ProviderMetadata, type LanguageModelUsage } from "ai"
|
||||||
import { createAnthropic } from "@ai-sdk/anthropic"
|
import { createAnthropic } from "@ai-sdk/anthropic"
|
||||||
import { createOpenAI } from "@ai-sdk/openai"
|
import { createOpenAI } from "@ai-sdk/openai"
|
||||||
@@ -10,6 +9,7 @@ import { Actor } from "@opencode/cloud-core/actor.js"
|
|||||||
import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js"
|
import { Database, eq, sql } from "@opencode/cloud-core/drizzle/index.js"
|
||||||
import { KeyTable } from "@opencode/cloud-core/schema/key.sql.js"
|
import { KeyTable } from "@opencode/cloud-core/schema/key.sql.js"
|
||||||
import { Billing } from "@opencode/cloud-core/billing.js"
|
import { Billing } from "@opencode/cloud-core/billing.js"
|
||||||
|
import { Resource } from "@opencode/cloud-resource"
|
||||||
|
|
||||||
type Env = {}
|
type Env = {}
|
||||||
|
|
||||||
|
|||||||
13
cloud/resource/bun.lock
Normal file
13
cloud/resource/bun.lock
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"@cloudflare/workers-types": "^4.20250830.0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@cloudflare/workers-types": ["@cloudflare/workers-types@4.20250830.0", "", {}, "sha512-uAGZFqEBFnCiwIokxMnrrtjIkT8qyGT1LACSScEUyW7nKmtD0Viykp9QZWrIlssyEp/MDB6XsdALF8y6upxpcg=="],
|
||||||
|
}
|
||||||
|
}
|
||||||
15
cloud/resource/package.json
Normal file
15
cloud/resource/package.json
Normal file
@@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
import { env } from "cloudflare:workers";
|
import { env } from "cloudflare:workers"
|
||||||
|
|
||||||
export const Resource = new Proxy(
|
export const Resource = new Proxy(
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
get(_target, prop: string) {
|
get(_target, prop: string) {
|
||||||
if (prop in env) {
|
if (prop in env) {
|
||||||
const value = env[prop];
|
// @ts-expect-error
|
||||||
return typeof value === "string" ? JSON.parse(value) : value;
|
const value = env[prop]
|
||||||
|
return typeof value === "string" ? JSON.parse(value) : value
|
||||||
}
|
}
|
||||||
throw new Error(`"${prop}" is not linked in your sst.config.ts`);
|
throw new Error(`"${prop}" is not linked in your sst.config.ts (cloudflare)`)
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
) as Record<string, any>;
|
) as Record<string, any>
|
||||||
2
cloud/resource/resource.node.ts
Normal file
2
cloud/resource/resource.node.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
console.log(process.env)
|
||||||
|
export { Resource } from "sst"
|
||||||
92
cloud/resource/sst-env.d.ts
vendored
Normal file
92
cloud/resource/sst-env.d.ts
vendored
Normal file
@@ -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 {}
|
||||||
12
cloud/resource/tsconfig.json
Normal file
12
cloud/resource/tsconfig.json
Normal file
@@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user