Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 24 additions & 18 deletions packages/open-next/src/types/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,32 @@ declare global {
// Needed in the cache adapter
/**
* The cache adapter for incremental static regeneration.
* Only available in main functions or in the external middleware with `enableCacheInterception` set to `true`.
* Defined in `createMainHandler` or in `adapter/middleware.ts`.
* Only available in main functions and in the external middleware when `enableCacheInterception` is `true`.
* Defined in `createMainHandler` and in `adapters/middleware.ts`.
*/
var incrementalCache: IncrementalCache;

/**
* The cache adapter for the tag cache.
* Only available in main functions, the initializationFunction or in the external middleware with `enableCacheInterception` set to `true`.
* Defined in `createMainHandler` or in `adapter/middleware.ts`.
* Only available in main functions and in the external middleware when `enableCacheInterception` is `true`.
* Defined in `createMainHandler` and in `adapters/middleware.ts`.
*/
var tagCache: TagCache;

/**
* The queue that is used to handle ISR revalidation requests.
* Only available in main functions and in the external middleware when `enableCacheInterception` is `true`.
* Defined in `createMainHandler` and in `adapters/middleware.ts`.
*/
var queue: Queue;

/**
* A boolean that indicates if the DynamoDB cache is disabled.
* @deprecated This will be removed, use `globalThis.openNextConfig.dangerous?.disableTagCache` instead.
* Defined in esbuild banner for the cache adapter.
*/
var disableDynamoDBCache: boolean;

/**
* A boolean that indicates if the incremental cache is disabled.
* @deprecated This will be removed, use `globalThis.openNextConfig.dangerous?.disableIncrementalCache` instead.
Expand All @@ -107,7 +117,7 @@ declare global {
/**
* A boolean that indicates if the runtime is Edge.
* Only available in `edge` runtime functions (i.e. external middleware or function with edge runtime).
* Defined in the `edge-adapter.ts`.
* Defined in `adapters/edge-adapter.ts`.
*/
var isEdgeRuntime: true;

Expand All @@ -121,35 +131,34 @@ declare global {
/**
* The fetch function that should be used to make requests during the execution of the function.
* Used to bypass Next intercepting and caching the fetch calls. Only available in main functions.
* Defined in the `server-adapter.ts` and in `adapters/middleware.ts`.
* Defined in `adapters/server-adapter.ts` and in `adapters/middleware.ts`.
*/
var internalFetch: typeof fetch;

/**
* The Open Next configuration object.
* Available in all functions.
* Defined in the `createMainHandler` or in the `createGenericHandler`.
* Defined in `createMainHandler` and in the `createGenericHandler`.
*/
var openNextConfig: Partial<OpenNextConfig>;

/**
* The name of the function that is currently being executed.
* Only available in main functions.
* Defined in the `createMainHandler`.
* Defined in `createMainHandler`.
*/
var fnName: string | undefined;
/**
* The unique identifier of the server.
* Only available in main functions.
* Defined in the `createMainHandler`.
* Defined in `createMainHandler`.
*/
var serverId: string;

/**
* The AsyncLocalStorage instance that is used to store the request context.
* Only available in main, middleware and edge functions.
* TODO: should be available everywhere in the future.
* Defined in `requestHandler.ts`, `middleware.ts` and `edge-adapter.ts`.
* Defined in `requestHandler.ts`, `adapters/middleware.ts` and `adapters/edge-adapter.ts`.
*/
var __openNextAls: AsyncLocalStorage<OpenNextRequestContext>;

Expand All @@ -159,22 +168,26 @@ declare global {
* Defined in the esbuild edge plugin.
*/
var _ENTRIES: Entries;

/**
* The routes object that contains the routes that are available in the function.
* Only available in edge runtime functions.
* Defined in the esbuild edge plugin.
*/
var _ROUTES: EdgeRoute[];

/**
* A map that is used in the edge runtime.
* Only available in edge runtime functions.
*/
var __storage__: Map<unknown, unknown>;

/**
* AsyncContext available globally in the edge runtime.
* Only available in edge runtime functions.
*/
var AsyncContext: any;

/**
* AsyncLocalStorage available globally in the edge runtime.
* Only available in edge runtime functions.
Expand All @@ -190,13 +203,6 @@ declare global {
*/
var openNextVersion: string;

/**
* The queue that is used to handle ISR revalidation requests.
* Only available in main functions and in the external middleware with `enableCacheInterception` set to `true`.
* Defined in `createMainHandler` or in `adapter/middleware.ts`.
*/
var queue: Queue;

/**
* The function that is used when resolving external rewrite requests.
* Only available in main functions
Expand Down