|
1 | 1 | import type { NextModeTagCache } from '@opennextjs/aws/types/overrides.js';
|
2 |
| -import { getCloudflareContext } from '@opennextjs/cloudflare'; |
3 | 2 |
|
4 |
| -interface Env { |
5 |
| - MIDDLEWARE_REFERENCE?: Pick< |
6 |
| - NextModeTagCache, |
7 |
| - 'getLastRevalidated' | 'hasBeenRevalidated' | 'writeTags' | 'getPathsByTags' |
8 |
| - >; |
9 |
| -} |
| 3 | +// interface Env { |
| 4 | +// MIDDLEWARE_REFERENCE?: Pick< |
| 5 | +// NextModeTagCache, |
| 6 | +// 'getLastRevalidated' | 'hasBeenRevalidated' | 'writeTags' | 'getPathsByTags' |
| 7 | +// >; |
| 8 | +// } |
10 | 9 |
|
| 10 | +//TODO: Reenable all of this. |
11 | 11 | export default {
|
12 | 12 | name: 'GitbookTagCache',
|
13 | 13 | mode: 'nextMode',
|
14 |
| - getLastRevalidated: async (tags: string[]) => { |
15 |
| - try { |
16 |
| - const { env } = getCloudflareContext(); |
17 |
| - return (env as Env).MIDDLEWARE_REFERENCE?.getLastRevalidated(tags) ?? 0; |
18 |
| - } catch (error) { |
19 |
| - console.error('Server - Error getting last revalidated tags:', error); |
20 |
| - return 0; // Fallback to 0 if there's an error |
21 |
| - } |
| 14 | + getLastRevalidated: async (_tags: string[]) => { |
| 15 | + return 0; |
| 16 | + // try { |
| 17 | + // const { env } = getCloudflareContext(); |
| 18 | + // return (env as Env).MIDDLEWARE_REFERENCE?.getLastRevalidated(tags) ?? 0; |
| 19 | + // } catch (error) { |
| 20 | + // console.error('Server - Error getting last revalidated tags:', error); |
| 21 | + // return 0; // Fallback to 0 if there's an error |
| 22 | + // } |
22 | 23 | },
|
23 |
| - hasBeenRevalidated: async (tags: string[]) => { |
24 |
| - try { |
25 |
| - const { env } = getCloudflareContext(); |
26 |
| - return (env as Env).MIDDLEWARE_REFERENCE?.hasBeenRevalidated(tags) ?? false; |
27 |
| - } catch (error) { |
28 |
| - console.error('Server - Error checking if tags have been revalidated:', error); |
29 |
| - return false; // Fallback to false if there's an error |
30 |
| - } |
| 24 | + hasBeenRevalidated: async (_tags: string[]) => { |
| 25 | + // try { |
| 26 | + // const { env } = getCloudflareContext(); |
| 27 | + // return (env as Env).MIDDLEWARE_REFERENCE?.hasBeenRevalidated(tags) ?? false; |
| 28 | + // } catch (error) { |
| 29 | + // console.error('Server - Error checking if tags have been revalidated:', error); |
| 30 | + // return false; // Fallback to false if there's an error |
| 31 | + // } |
| 32 | + return false; |
31 | 33 | },
|
32 |
| - writeTags: async (tags: string[]) => { |
33 |
| - try { |
34 |
| - const { env } = getCloudflareContext(); |
35 |
| - (env as Env).MIDDLEWARE_REFERENCE?.writeTags(tags); |
36 |
| - } catch (error) { |
37 |
| - console.error('Server - Error writing tags:', error); |
38 |
| - } |
| 34 | + writeTags: async (_tags: string[]) => { |
| 35 | + // try { |
| 36 | + // const { env } = getCloudflareContext(); |
| 37 | + // (env as Env).MIDDLEWARE_REFERENCE?.writeTags(tags); |
| 38 | + // } catch (error) { |
| 39 | + // console.error('Server - Error writing tags:', error); |
| 40 | + // } |
| 41 | + return; |
39 | 42 | },
|
40 | 43 | } satisfies NextModeTagCache;
|
0 commit comments