diff --git a/example/convex/_generated/server.d.ts b/example/convex/_generated/server.d.ts index bec05e6..f235db4 100644 --- a/example/convex/_generated/server.d.ts +++ b/example/convex/_generated/server.d.ts @@ -21,6 +21,17 @@ import { } from "convex/server"; import type { DataModel } from "./dataModel.js"; +/** + * Typesafe environment variables. + * + * This includes platform-provided env vars and any variables declared in + * `convex.config.ts`. + */ +type Env = { + readonly CONVEX_CLOUD_URL: string; + readonly CONVEX_SITE_URL: string; +}; + /** * Define a query in this Convex app's public API. * @@ -95,6 +106,14 @@ export declare const internalAction: ActionBuilder; */ export declare const httpAction: HttpActionBuilder; +/** + * Typesafe environment variables. + * + * This includes platform-provided env vars and any variables declared in + * `convex.config.ts`. + */ +export declare const env: Env; + /** * A set of services for use within Convex query functions. * diff --git a/example/convex/_generated/server.js b/example/convex/_generated/server.js index bf3d25a..2dbe0db 100644 --- a/example/convex/_generated/server.js +++ b/example/convex/_generated/server.js @@ -91,3 +91,11 @@ export const internalAction = internalActionGeneric; * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up. */ export const httpAction = httpActionGeneric; + +/** + * Typesafe environment variables. + * + * This includes platform-provided env vars and any variables declared in + * `convex.config.ts`. + */ +export const env = process.env; diff --git a/example/convex/localComponent/_generated/server.ts b/example/convex/localComponent/_generated/server.ts index 739b02f..1a7688a 100644 --- a/example/convex/localComponent/_generated/server.ts +++ b/example/convex/localComponent/_generated/server.ts @@ -30,6 +30,17 @@ import { } from "convex/server"; import type { DataModel } from "./dataModel.js"; +/** + * Typesafe environment variables. + * + * This includes platform-provided env vars and any variables declared in + * `convex.config.ts`. + */ +type Env = { + readonly CONVEX_CLOUD_URL: string; + readonly CONVEX_SITE_URL: string; +}; + /** * Define a query in this Convex app's public API. * @@ -106,6 +117,8 @@ export const internalAction: ActionBuilder = * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up. */ export const httpAction: HttpActionBuilder = httpActionGeneric; +export const env: Env = (globalThis as unknown as { process: { env: Env } }) + .process.env; /** * A set of services for use within Convex query functions. diff --git a/package-lock.json b/package-lock.json index 608145e..36849ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "@vitejs/plugin-react": "6.0.2", "chokidar-cli": "3.0.0", "convex": "1.46.0", - "convex-helpers": "0.1.118", + "convex-helpers": "0.1.128", "convex-test": "0.0.61", "eslint": "9.39.4", "eslint-plugin-react": "7.37.5", @@ -2175,9 +2175,9 @@ } }, "node_modules/convex-helpers": { - "version": "0.1.118", - "resolved": "https://registry.npmjs.org/convex-helpers/-/convex-helpers-0.1.118.tgz", - "integrity": "sha512-07t10n8CZG/YCDzOy5/WDdNNQYL+mP7VU76BLJCZrB2dvJTH7UZJxPqNrhPH+pZbW52joQ91eQHSksdcgOXebQ==", + "version": "0.1.128", + "resolved": "https://registry.npmjs.org/convex-helpers/-/convex-helpers-0.1.128.tgz", + "integrity": "sha512-5n7uKsJrYnnybvuSAWgDQ9d5Avqk4CzFsJ22SXow4tHmVxSUH6qiJCeomWWxcLSfN9t9jpKIXNJiGJrjddS4ng==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2185,10 +2185,10 @@ }, "peerDependencies": { "@standard-schema/spec": "^1.0.0", - "convex": "^1.32.0", + "convex": "^1.46.0", "hono": "^4.0.5", "react": "^17.0.2 || ^18.0.0 || ^19.0.0", - "typescript": "^5.5 || ^6.0.0", + "typescript": "^5.5 || ^6.0.0 || ^7.0.0", "zod": "^3.25.0 || ^4.0.0" }, "peerDependenciesMeta": { diff --git a/package.json b/package.json index 1d4f4c9..1f62a45 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@vitejs/plugin-react": "6.0.2", "chokidar-cli": "3.0.0", "convex": "1.46.0", - "convex-helpers": "0.1.118", + "convex-helpers": "0.1.128", "convex-test": "0.0.61", "eslint": "9.39.4", "eslint-plugin-react": "7.37.5", diff --git a/src/component/_generated/server.ts b/src/component/_generated/server.ts index 739b02f..1a7688a 100644 --- a/src/component/_generated/server.ts +++ b/src/component/_generated/server.ts @@ -30,6 +30,17 @@ import { } from "convex/server"; import type { DataModel } from "./dataModel.js"; +/** + * Typesafe environment variables. + * + * This includes platform-provided env vars and any variables declared in + * `convex.config.ts`. + */ +type Env = { + readonly CONVEX_CLOUD_URL: string; + readonly CONVEX_SITE_URL: string; +}; + /** * Define a query in this Convex app's public API. * @@ -106,6 +117,8 @@ export const internalAction: ActionBuilder = * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up. */ export const httpAction: HttpActionBuilder = httpActionGeneric; +export const env: Env = (globalThis as unknown as { process: { env: Env } }) + .process.env; /** * A set of services for use within Convex query functions.