Skip to content

Commit 784958f

Browse files
authored
update docs for global (#737)
1 parent cc4f5f4 commit 784958f

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

packages/open-next/src/types/global.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,32 @@ declare global {
6666
// Needed in the cache adapter
6767
/**
6868
* The cache adapter for incremental static regeneration.
69-
* Only available in main functions or in the external middleware with `enableCacheInterception` set to `true`.
70-
* Defined in `createMainHandler` or in `adapter/middleware.ts`.
69+
* Only available in main functions and in the external middleware when `enableCacheInterception` is `true`.
70+
* Defined in `createMainHandler` and in `adapters/middleware.ts`.
7171
*/
7272
var incrementalCache: IncrementalCache;
73+
7374
/**
7475
* The cache adapter for the tag cache.
75-
* Only available in main functions, the initializationFunction or in the external middleware with `enableCacheInterception` set to `true`.
76-
* Defined in `createMainHandler` or in `adapter/middleware.ts`.
76+
* Only available in main functions and in the external middleware when `enableCacheInterception` is `true`.
77+
* Defined in `createMainHandler` and in `adapters/middleware.ts`.
7778
*/
7879
var tagCache: TagCache;
80+
81+
/**
82+
* The queue that is used to handle ISR revalidation requests.
83+
* Only available in main functions and in the external middleware when `enableCacheInterception` is `true`.
84+
* Defined in `createMainHandler` and in `adapters/middleware.ts`.
85+
*/
86+
var queue: Queue;
87+
7988
/**
8089
* A boolean that indicates if the DynamoDB cache is disabled.
8190
* @deprecated This will be removed, use `globalThis.openNextConfig.dangerous?.disableTagCache` instead.
8291
* Defined in esbuild banner for the cache adapter.
8392
*/
8493
var disableDynamoDBCache: boolean;
94+
8595
/**
8696
* A boolean that indicates if the incremental cache is disabled.
8797
* @deprecated This will be removed, use `globalThis.openNextConfig.dangerous?.disableIncrementalCache` instead.
@@ -107,7 +117,7 @@ declare global {
107117
/**
108118
* A boolean that indicates if the runtime is Edge.
109119
* Only available in `edge` runtime functions (i.e. external middleware or function with edge runtime).
110-
* Defined in the `edge-adapter.ts`.
120+
* Defined in `adapters/edge-adapter.ts`.
111121
*/
112122
var isEdgeRuntime: true;
113123

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

128138
/**
129139
* The Open Next configuration object.
130140
* Available in all functions.
131-
* Defined in the `createMainHandler` or in the `createGenericHandler`.
141+
* Defined in `createMainHandler` and in the `createGenericHandler`.
132142
*/
133143
var openNextConfig: Partial<OpenNextConfig>;
134144

135145
/**
136146
* The name of the function that is currently being executed.
137147
* Only available in main functions.
138-
* Defined in the `createMainHandler`.
148+
* Defined in `createMainHandler`.
139149
*/
140150
var fnName: string | undefined;
141151
/**
142152
* The unique identifier of the server.
143153
* Only available in main functions.
144-
* Defined in the `createMainHandler`.
154+
* Defined in `createMainHandler`.
145155
*/
146156
var serverId: string;
147157

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

@@ -159,22 +168,26 @@ declare global {
159168
* Defined in the esbuild edge plugin.
160169
*/
161170
var _ENTRIES: Entries;
171+
162172
/**
163173
* The routes object that contains the routes that are available in the function.
164174
* Only available in edge runtime functions.
165175
* Defined in the esbuild edge plugin.
166176
*/
167177
var _ROUTES: EdgeRoute[];
178+
168179
/**
169180
* A map that is used in the edge runtime.
170181
* Only available in edge runtime functions.
171182
*/
172183
var __storage__: Map<unknown, unknown>;
184+
173185
/**
174186
* AsyncContext available globally in the edge runtime.
175187
* Only available in edge runtime functions.
176188
*/
177189
var AsyncContext: any;
190+
178191
/**
179192
* AsyncLocalStorage available globally in the edge runtime.
180193
* Only available in edge runtime functions.
@@ -190,13 +203,6 @@ declare global {
190203
*/
191204
var openNextVersion: string;
192205

193-
/**
194-
* The queue that is used to handle ISR revalidation requests.
195-
* Only available in main functions and in the external middleware with `enableCacheInterception` set to `true`.
196-
* Defined in `createMainHandler` or in `adapter/middleware.ts`.
197-
*/
198-
var queue: Queue;
199-
200206
/**
201207
* The function that is used when resolving external rewrite requests.
202208
* Only available in main functions

0 commit comments

Comments
 (0)