Skip to content

Commit

Permalink
feat: Declare Env globally
Browse files Browse the repository at this point in the history
  • Loading branch information
drewdecarme committed Nov 6, 2023
1 parent 0a7cda0 commit 08fdb83
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 29 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/app/App.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Env, HandlerArgs, Middleware } from "../utils";
import type { HandlerArgs, Middleware } from "../utils";
import { ErrorNotFound, errorHandler, log } from "../utils";
import type { Route } from "../route/Route";
import type { LogLevel, LoggingType } from "@flare-city/logger";
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/route/Route.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type {
Env,
ApiResponse,
RequestURLSegments,
RequestURLSearchParams,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/route/route.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {
RequestURLSearchParams,
RequestURLSegments,
Middleware,
Env,
ApiResponse,
} from "../utils";

Expand Down
45 changes: 21 additions & 24 deletions packages/core/src/utils/util.env.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
import type { LogLevel, LoggingType } from "@flare-city/logger";

export interface Env {
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
// MY_KV_NAMESPACE: KVNamespace;
//
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
// MY_DURABLE_OBJECT: DurableObjectNamespace;
//
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
// MY_BUCKET: R2Bucket;
//
// Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
// MY_SERVICE: Fetcher;
//
// Example binding to a Queue. Learn more at https://developers.cloudflare.com/queues/javascript-apis/
// MY_QUEUE: Queue;
//
// Vars:
API_AUTH0_DOMAIN: string;
API_AUTH0_CLIENT_ID: string;
API_AUTH0_CLIENT_AUDIENCE: string;
DATABASE_URL: string;
LOG_LEVEL: LogLevel;
LOG_TYPE: LoggingType;
declare global {
interface Env {
// Example binding to KV. Learn more at https://developers.cloudflare.com/workers/runtime-apis/kv/
// MY_KV_NAMESPACE: KVNamespace;
//
// Example binding to Durable Object. Learn more at https://developers.cloudflare.com/workers/runtime-apis/durable-objects/
// MY_DURABLE_OBJECT: DurableObjectNamespace;
//
// Example binding to R2. Learn more at https://developers.cloudflare.com/workers/runtime-apis/r2/
// MY_BUCKET: R2Bucket;
//
// Example binding to a Service. Learn more at https://developers.cloudflare.com/workers/runtime-apis/service-bindings/
// MY_SERVICE: Fetcher;
//
// Example binding to a Queue. Learn more at https://developers.cloudflare.com/queues/javascript-apis/
// MY_QUEUE: Queue;
//
// Vars:

HYPERDRIVE: Hyperdrive;
LOG_LEVEL: LogLevel;
LOG_TYPE: LoggingType;
}
}
2 changes: 0 additions & 2 deletions packages/core/src/utils/util.types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { Env } from "./util.env";

export type ApiResponse<T, M = Record<string, unknown>> = {
data: T;
meta?: M;
Expand Down

0 comments on commit 08fdb83

Please sign in to comment.