@revealui/core 0.3.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/client/admin/components/AdminDashboard.d.ts.map +1 -1
  2. package/dist/client/admin/components/AdminDashboard.js +20 -3
  3. package/dist/client/richtext/index.d.ts.map +1 -1
  4. package/dist/client/richtext/plugins/FloatingToolbarPlugin.js +1 -3
  5. package/dist/collections/operations/create.d.ts +2 -1
  6. package/dist/collections/operations/create.d.ts.map +1 -1
  7. package/dist/collections/operations/create.js +28 -1
  8. package/dist/database/type-adapter.d.ts.map +1 -1
  9. package/dist/features.d.ts +13 -3
  10. package/dist/features.d.ts.map +1 -1
  11. package/dist/features.js +17 -0
  12. package/dist/globals/GlobalOperations.d.ts.map +1 -1
  13. package/dist/globals/GlobalOperations.js +12 -2
  14. package/dist/index.d.ts +11 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +11 -1
  17. package/dist/license.d.ts +6 -0
  18. package/dist/license.d.ts.map +1 -1
  19. package/dist/license.js +14 -1
  20. package/dist/monitoring/alerts.d.ts +4 -4
  21. package/dist/monitoring/alerts.d.ts.map +1 -1
  22. package/dist/plugins/nested-docs.d.ts.map +1 -1
  23. package/dist/plugins/nested-docs.js +0 -1
  24. package/dist/queries/queryBuilder.d.ts.map +1 -1
  25. package/dist/queries/queryBuilder.js +4 -3
  26. package/dist/richtext/index.d.ts.map +1 -1
  27. package/dist/storage/vercel-blob.d.ts.map +1 -1
  28. package/dist/storage/vercel-blob.js +3 -0
  29. package/dist/types/api.d.ts.map +1 -1
  30. package/dist/types/config.d.ts.map +1 -1
  31. package/dist/types/core.d.ts +1 -1
  32. package/dist/types/core.d.ts.map +1 -1
  33. package/dist/types/extensions.d.ts.map +1 -1
  34. package/dist/types/frontend.d.ts.map +1 -1
  35. package/dist/types/legacy.d.ts.map +1 -1
  36. package/dist/types/query.d.ts.map +1 -1
  37. package/dist/types/runtime.d.ts +1 -0
  38. package/dist/types/runtime.d.ts.map +1 -1
  39. package/dist/utils/error-responses.d.ts.map +1 -1
  40. package/dist/utils/error-responses.js +2 -3
  41. package/package.json +24 -24
  42. package/dist/caching/app-cache.d.ts +0 -242
  43. package/dist/caching/app-cache.d.ts.map +0 -1
  44. package/dist/caching/app-cache.js +0 -438
  45. package/dist/caching/cdn-config.d.ts +0 -155
  46. package/dist/caching/cdn-config.d.ts.map +0 -1
  47. package/dist/caching/cdn-config.js +0 -415
  48. package/dist/caching/edge-cache.d.ts +0 -177
  49. package/dist/caching/edge-cache.d.ts.map +0 -1
  50. package/dist/caching/edge-cache.js +0 -414
  51. package/dist/caching/service-worker.d.ts +0 -157
  52. package/dist/caching/service-worker.d.ts.map +0 -1
  53. package/dist/caching/service-worker.js +0 -438
  54. package/dist/client/admin/utils/auth.d.ts +0 -23
  55. package/dist/client/admin/utils/auth.d.ts.map +0 -1
  56. package/dist/client/admin/utils/auth.js +0 -52
  57. package/dist/client/http/client.d.ts +0 -15
  58. package/dist/client/http/client.d.ts.map +0 -1
  59. package/dist/client/http/client.js +0 -49
  60. package/dist/client/http/fetchBanner.d.ts +0 -18
  61. package/dist/client/http/fetchBanner.d.ts.map +0 -1
  62. package/dist/client/http/fetchBanner.js +0 -44
  63. package/dist/client/http/fetchCard.d.ts +0 -18
  64. package/dist/client/http/fetchCard.d.ts.map +0 -1
  65. package/dist/client/http/fetchCard.js +0 -46
  66. package/dist/client/http/fetchEvents.d.ts +0 -18
  67. package/dist/client/http/fetchEvents.d.ts.map +0 -1
  68. package/dist/client/http/fetchEvents.js +0 -44
  69. package/dist/client/http/fetchHero.d.ts +0 -17
  70. package/dist/client/http/fetchHero.d.ts.map +0 -1
  71. package/dist/client/http/fetchHero.js +0 -55
  72. package/dist/client/http/fetchMainInfos.d.ts +0 -17
  73. package/dist/client/http/fetchMainInfos.d.ts.map +0 -1
  74. package/dist/client/http/fetchMainInfos.js +0 -44
  75. package/dist/client/http/fetchVideos.d.ts +0 -13
  76. package/dist/client/http/fetchVideos.d.ts.map +0 -1
  77. package/dist/client/http/fetchVideos.js +0 -36
  78. package/dist/client/http/index.d.ts +0 -19
  79. package/dist/client/http/index.d.ts.map +0 -1
  80. package/dist/client/http/index.js +0 -11
  81. package/dist/error-handling/circuit-breaker.d.ts +0 -262
  82. package/dist/error-handling/circuit-breaker.d.ts.map +0 -1
  83. package/dist/error-handling/circuit-breaker.js +0 -550
  84. package/dist/error-handling/retry.d.ts +0 -194
  85. package/dist/error-handling/retry.d.ts.map +0 -1
  86. package/dist/error-handling/retry.js +0 -455
  87. package/dist/errors/index.d.ts +0 -23
  88. package/dist/errors/index.d.ts.map +0 -1
  89. package/dist/errors/index.js +0 -40
  90. package/dist/generated/agents/index.d.ts +0 -8
  91. package/dist/generated/agents/index.d.ts.map +0 -1
  92. package/dist/generated/agents/index.js +0 -7
  93. package/dist/generated/components/index.d.ts +0 -8
  94. package/dist/generated/components/index.d.ts.map +0 -1
  95. package/dist/generated/components/index.js +0 -7
  96. package/dist/generated/functions/index.d.ts +0 -8
  97. package/dist/generated/functions/index.d.ts.map +0 -1
  98. package/dist/generated/functions/index.js +0 -7
  99. package/dist/generated/hooks/index.d.ts +0 -8
  100. package/dist/generated/hooks/index.d.ts.map +0 -1
  101. package/dist/generated/hooks/index.js +0 -7
  102. package/dist/generated/plans/index.d.ts +0 -8
  103. package/dist/generated/plans/index.d.ts.map +0 -1
  104. package/dist/generated/plans/index.js +0 -7
  105. package/dist/generated/prompts/index.d.ts +0 -8
  106. package/dist/generated/prompts/index.d.ts.map +0 -1
  107. package/dist/generated/prompts/index.js +0 -7
  108. package/dist/generated/tools/index.d.ts +0 -8
  109. package/dist/generated/tools/index.d.ts.map +0 -1
  110. package/dist/generated/tools/index.js +0 -7
  111. package/dist/generated/types/supabase.d.ts +0 -193
  112. package/dist/generated/types/supabase.d.ts.map +0 -1
  113. package/dist/generated/types/supabase.js +0 -5
  114. package/dist/optimization/asset-optimizer.d.ts +0 -206
  115. package/dist/optimization/asset-optimizer.d.ts.map +0 -1
  116. package/dist/optimization/asset-optimizer.js +0 -336
  117. package/dist/optimization/build-optimizer.d.ts +0 -202
  118. package/dist/optimization/build-optimizer.d.ts.map +0 -1
  119. package/dist/optimization/build-optimizer.js +0 -271
  120. package/dist/optimization/bundle-analyzer.d.ts +0 -98
  121. package/dist/optimization/bundle-analyzer.d.ts.map +0 -1
  122. package/dist/optimization/bundle-analyzer.js +0 -346
  123. package/dist/optimization/code-splitting.d.ts +0 -121
  124. package/dist/optimization/code-splitting.d.ts.map +0 -1
  125. package/dist/optimization/code-splitting.js +0 -261
  126. package/dist/plugin/index.d.ts +0 -12
  127. package/dist/plugin/index.d.ts.map +0 -1
  128. package/dist/plugin/index.js +0 -4
  129. package/dist/security/audit.d.ts +0 -188
  130. package/dist/security/audit.d.ts.map +0 -1
  131. package/dist/security/audit.js +0 -433
  132. package/dist/security/auth.d.ts +0 -110
  133. package/dist/security/auth.d.ts.map +0 -1
  134. package/dist/security/auth.js +0 -257
  135. package/dist/security/authorization.d.ts +0 -211
  136. package/dist/security/authorization.d.ts.map +0 -1
  137. package/dist/security/authorization.js +0 -492
  138. package/dist/security/encryption.d.ts +0 -226
  139. package/dist/security/encryption.d.ts.map +0 -1
  140. package/dist/security/encryption.js +0 -534
  141. package/dist/security/gdpr-storage.d.ts +0 -102
  142. package/dist/security/gdpr-storage.d.ts.map +0 -1
  143. package/dist/security/gdpr-storage.js +0 -65
  144. package/dist/security/gdpr.d.ts +0 -320
  145. package/dist/security/gdpr.d.ts.map +0 -1
  146. package/dist/security/gdpr.js +0 -531
  147. package/dist/security/headers.d.ts +0 -184
  148. package/dist/security/headers.d.ts.map +0 -1
  149. package/dist/security/headers.js +0 -420
  150. package/dist/utils/jwt-validation.d.ts +0 -14
  151. package/dist/utils/jwt-validation.d.ts.map +0 -1
  152. package/dist/utils/jwt-validation.js +0 -36
  153. package/dist/utils/request-headers.d.ts +0 -15
  154. package/dist/utils/request-headers.d.ts.map +0 -1
  155. package/dist/utils/request-headers.js +0 -31
@@ -1,415 +0,0 @@
1
- /**
2
- * CDN Configuration and Cache Management
3
- *
4
- * Utilities for CDN caching, edge caching, and cache invalidation
5
- */
6
- export const DEFAULT_CDN_CONFIG = {
7
- provider: 'vercel',
8
- ttl: 31536000, // 1 year for static assets
9
- staleWhileRevalidate: 86400, // 1 day
10
- staleIfError: 604800, // 1 week
11
- bypassCache: false,
12
- cacheKey: ['url', 'headers.accept', 'headers.accept-encoding'],
13
- varyHeaders: ['Accept', 'Accept-Encoding'],
14
- };
15
- /**
16
- * Generate Cache-Control header
17
- */
18
- export function generateCacheControl(config) {
19
- const directives = [];
20
- // Visibility
21
- if (config.noStore) {
22
- directives.push('no-store');
23
- return directives.join(', ');
24
- }
25
- if (config.noCache) {
26
- directives.push('no-cache');
27
- return directives.join(', ');
28
- }
29
- if (config.public) {
30
- directives.push('public');
31
- }
32
- else if (config.private) {
33
- directives.push('private');
34
- }
35
- // Max age
36
- if (config.maxAge !== undefined) {
37
- directives.push(`max-age=${config.maxAge}`);
38
- }
39
- // Shared max age (CDN)
40
- if (config.sMaxAge !== undefined) {
41
- directives.push(`s-maxage=${config.sMaxAge}`);
42
- }
43
- // Stale-while-revalidate
44
- if (config.staleWhileRevalidate !== undefined) {
45
- directives.push(`stale-while-revalidate=${config.staleWhileRevalidate}`);
46
- }
47
- // Stale-if-error
48
- if (config.staleIfError !== undefined) {
49
- directives.push(`stale-if-error=${config.staleIfError}`);
50
- }
51
- // Immutable
52
- if (config.immutable) {
53
- directives.push('immutable');
54
- }
55
- return directives.join(', ');
56
- }
57
- /**
58
- * Cache presets for different asset types
59
- */
60
- export const CDN_CACHE_PRESETS = {
61
- // Static assets with hashed filenames (immutable)
62
- immutable: {
63
- maxAge: 31536000, // 1 year
64
- sMaxAge: 31536000,
65
- public: true,
66
- immutable: true,
67
- },
68
- // Static assets (images, fonts)
69
- static: {
70
- maxAge: 2592000, // 30 days
71
- sMaxAge: 31536000, // 1 year on CDN
72
- staleWhileRevalidate: 86400, // 1 day
73
- public: true,
74
- },
75
- // API responses (short-lived)
76
- api: {
77
- maxAge: 0,
78
- sMaxAge: 60, // 1 minute on CDN
79
- staleWhileRevalidate: 30,
80
- public: true,
81
- },
82
- // HTML pages (dynamic)
83
- page: {
84
- maxAge: 0,
85
- sMaxAge: 300, // 5 minutes on CDN
86
- staleWhileRevalidate: 60,
87
- public: true,
88
- },
89
- // User-specific data
90
- private: {
91
- maxAge: 300, // 5 minutes
92
- private: true,
93
- staleWhileRevalidate: 60,
94
- },
95
- // No caching
96
- noCache: {
97
- noStore: true,
98
- },
99
- // Revalidate every request
100
- revalidate: {
101
- maxAge: 0,
102
- sMaxAge: 0,
103
- noCache: true,
104
- },
105
- };
106
- /**
107
- * Purge CDN cache
108
- */
109
- export async function purgeCDNCache(urls, config) {
110
- const { provider } = config;
111
- switch (provider) {
112
- case 'cloudflare':
113
- return purgeCloudflare(urls, config);
114
- case 'vercel':
115
- return purgeVercel(urls, config);
116
- case 'fastly':
117
- return purgeFastly(urls, config);
118
- default:
119
- throw new Error(`Unsupported CDN provider: ${provider}`);
120
- }
121
- }
122
- /**
123
- * Purge Cloudflare cache
124
- */
125
- async function purgeCloudflare(urls, config) {
126
- const { apiKey, zoneId } = config;
127
- if (!(apiKey && zoneId)) {
128
- throw new Error('Cloudflare API key and zone ID required');
129
- }
130
- try {
131
- const response = await fetch(`https://api.cloudflare.com/client/v4/zones/${zoneId}/purge_cache`, {
132
- method: 'POST',
133
- headers: {
134
- // biome-ignore lint/style/useNamingConvention: HTTP header convention
135
- Authorization: `Bearer ${apiKey}`,
136
- 'Content-Type': 'application/json',
137
- },
138
- body: JSON.stringify({ files: urls }),
139
- });
140
- const data = await response.json();
141
- return {
142
- success: data.success,
143
- purged: urls.length,
144
- errors: data.errors,
145
- };
146
- }
147
- catch (error) {
148
- return {
149
- success: false,
150
- purged: 0,
151
- errors: [error instanceof Error ? error.message : 'Unknown error'],
152
- };
153
- }
154
- }
155
- /**
156
- * Purge Vercel cache
157
- */
158
- async function purgeVercel(urls, config) {
159
- const { apiKey } = config;
160
- if (!apiKey) {
161
- throw new Error('Vercel API token required');
162
- }
163
- try {
164
- const response = await fetch('https://api.vercel.com/v1/purge', {
165
- method: 'POST',
166
- headers: {
167
- // biome-ignore lint/style/useNamingConvention: HTTP header convention
168
- Authorization: `Bearer ${apiKey}`,
169
- 'Content-Type': 'application/json',
170
- },
171
- body: JSON.stringify({ urls }),
172
- });
173
- const data = await response.json();
174
- return {
175
- success: response.ok,
176
- purged: urls.length,
177
- errors: data.error ? [data.error.message] : undefined,
178
- };
179
- }
180
- catch (error) {
181
- return {
182
- success: false,
183
- purged: 0,
184
- errors: [error instanceof Error ? error.message : 'Unknown error'],
185
- };
186
- }
187
- }
188
- /**
189
- * Purge Fastly cache
190
- */
191
- async function purgeFastly(urls, config) {
192
- const { apiKey } = config;
193
- if (!apiKey) {
194
- throw new Error('Fastly API key required');
195
- }
196
- try {
197
- const results = await Promise.all(urls.map(async (url) => {
198
- const response = await fetch(url, {
199
- method: 'PURGE',
200
- headers: {
201
- 'Fastly-Key': apiKey,
202
- },
203
- });
204
- return response.ok;
205
- }));
206
- const purged = results.filter(Boolean).length;
207
- return {
208
- success: purged === urls.length,
209
- purged,
210
- };
211
- }
212
- catch (error) {
213
- return {
214
- success: false,
215
- purged: 0,
216
- errors: [error instanceof Error ? error.message : 'Unknown error'],
217
- };
218
- }
219
- }
220
- /**
221
- * Purge by cache tag
222
- */
223
- export async function purgeCacheByTag(tags, config) {
224
- const { provider, apiKey, zoneId } = config;
225
- if (provider === 'cloudflare') {
226
- if (!(apiKey && zoneId)) {
227
- throw new Error('Cloudflare API key and zone ID required');
228
- }
229
- try {
230
- const response = await fetch(`https://api.cloudflare.com/client/v4/zones/${zoneId}/purge_cache`, {
231
- method: 'POST',
232
- headers: {
233
- // biome-ignore lint/style/useNamingConvention: HTTP header convention
234
- Authorization: `Bearer ${apiKey}`,
235
- 'Content-Type': 'application/json',
236
- },
237
- body: JSON.stringify({ tags }),
238
- });
239
- const data = await response.json();
240
- return {
241
- success: data.success,
242
- purged: tags.length,
243
- errors: data.errors,
244
- };
245
- }
246
- catch (error) {
247
- return {
248
- success: false,
249
- purged: 0,
250
- errors: [error instanceof Error ? error.message : 'Unknown error'],
251
- };
252
- }
253
- }
254
- throw new Error(`Cache tag purging not supported for ${provider}`);
255
- }
256
- /**
257
- * Purge everything
258
- */
259
- export async function purgeAllCache(config) {
260
- const { provider, apiKey, zoneId } = config;
261
- if (provider === 'cloudflare') {
262
- if (!(apiKey && zoneId)) {
263
- throw new Error('Cloudflare API key and zone ID required');
264
- }
265
- try {
266
- const response = await fetch(`https://api.cloudflare.com/client/v4/zones/${zoneId}/purge_cache`, {
267
- method: 'POST',
268
- headers: {
269
- // biome-ignore lint/style/useNamingConvention: HTTP header convention
270
- Authorization: `Bearer ${apiKey}`,
271
- 'Content-Type': 'application/json',
272
- },
273
- body: JSON.stringify({ purge_everything: true }),
274
- });
275
- const data = await response.json();
276
- return {
277
- success: data.success,
278
- errors: data.errors,
279
- };
280
- }
281
- catch (error) {
282
- return {
283
- success: false,
284
- errors: [error instanceof Error ? error.message : 'Unknown error'],
285
- };
286
- }
287
- }
288
- throw new Error(`Purge all not supported for ${provider}`);
289
- }
290
- /**
291
- * CDN cache warming
292
- */
293
- export async function warmCDNCache(urls, options = {}) {
294
- const { concurrency = 5, headers = {} } = options;
295
- const results = [];
296
- const chunks = [];
297
- // Split into chunks
298
- for (let i = 0; i < urls.length; i += concurrency) {
299
- chunks.push(urls.slice(i, i + concurrency));
300
- }
301
- // Warm cache in chunks
302
- for (const chunk of chunks) {
303
- const chunkResults = await Promise.all(chunk.map(async (url) => {
304
- try {
305
- const response = await fetch(url, { headers });
306
- return {
307
- success: response.ok,
308
- error: response.ok ? undefined : `${response.status} ${response.statusText}`,
309
- };
310
- }
311
- catch (error) {
312
- return {
313
- success: false,
314
- error: error instanceof Error ? error.message : 'Unknown error',
315
- };
316
- }
317
- }));
318
- results.push(...chunkResults);
319
- }
320
- const warmed = results.filter((r) => r.success).length;
321
- const failed = results.filter((r) => !r.success).length;
322
- const errors = results.flatMap((r) => (r.error ? [r.error] : []));
323
- return { warmed, failed, errors };
324
- }
325
- /**
326
- * Generate cache tags
327
- */
328
- export function generateCacheTags(resource) {
329
- const tags = [];
330
- // Type tag
331
- tags.push(resource.type);
332
- // ID tag
333
- if (resource.id) {
334
- tags.push(`${resource.type}:${resource.id}`);
335
- }
336
- // Related tags
337
- if (resource.related) {
338
- tags.push(...resource.related);
339
- }
340
- return tags;
341
- }
342
- /**
343
- * Edge cache configuration for Vercel
344
- */
345
- export function generateVercelCacheConfig(preset) {
346
- const config = CDN_CACHE_PRESETS[preset];
347
- const cacheControl = generateCacheControl(config);
348
- return {
349
- headers: {
350
- 'Cache-Control': cacheControl,
351
- 'CDN-Cache-Control': cacheControl,
352
- 'Vercel-CDN-Cache-Control': cacheControl,
353
- },
354
- };
355
- }
356
- /**
357
- * Edge cache configuration for Cloudflare
358
- */
359
- export function generateCloudflareConfig(preset, options = {}) {
360
- const config = CDN_CACHE_PRESETS[preset];
361
- const cacheControl = generateCacheControl(config);
362
- const headers = {
363
- 'Cache-Control': cacheControl,
364
- };
365
- // Cache tags
366
- if (options.cacheTags && options.cacheTags.length > 0) {
367
- headers['Cache-Tag'] = options.cacheTags.join(',');
368
- }
369
- // Bypass on cookie
370
- if (options.bypassOnCookie) {
371
- headers['Cache-Control'] = `${cacheControl}, bypass=${options.bypassOnCookie}`;
372
- }
373
- return { headers };
374
- }
375
- /**
376
- * Check if response should be cached
377
- */
378
- export function shouldCacheResponse(status, headers) {
379
- // Don't cache errors
380
- if (status >= 400) {
381
- return false;
382
- }
383
- // Check Cache-Control header
384
- const cacheControl = headers.get('cache-control') || '';
385
- if (cacheControl.includes('no-store') ||
386
- cacheControl.includes('no-cache') ||
387
- cacheControl.includes('private')) {
388
- return false;
389
- }
390
- return true;
391
- }
392
- /**
393
- * Calculate cache TTL from headers
394
- */
395
- export function getCacheTTL(headers) {
396
- const cacheControl = headers.get('cache-control') || '';
397
- // Check s-maxage first (CDN)
398
- const sMaxAgeMatch = cacheControl.match(/s-maxage=(\d+)/);
399
- if (sMaxAgeMatch?.[1]) {
400
- return parseInt(sMaxAgeMatch[1], 10);
401
- }
402
- // Check max-age
403
- const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
404
- if (maxAgeMatch?.[1]) {
405
- return parseInt(maxAgeMatch[1], 10);
406
- }
407
- // Check Expires header
408
- const expires = headers.get('expires');
409
- if (expires) {
410
- const expiresDate = new Date(expires);
411
- const now = new Date();
412
- return Math.max(0, Math.floor((expiresDate.getTime() - now.getTime()) / 1000));
413
- }
414
- return 0;
415
- }
@@ -1,177 +0,0 @@
1
- /**
2
- * Edge Caching and ISR (Incremental Static Regeneration)
3
- *
4
- * Utilities for Next.js edge caching, ISR, and on-demand revalidation
5
- */
6
- import type { NextRequest, NextResponse } from 'next/server';
7
- /**
8
- * ISR Configuration
9
- */
10
- export interface ISRConfig {
11
- revalidate?: number | false;
12
- tags?: string[];
13
- dynamicParams?: boolean;
14
- }
15
- export declare const ISR_PRESETS: {
16
- readonly always: {
17
- readonly revalidate: 0;
18
- };
19
- readonly minute: {
20
- readonly revalidate: 60;
21
- };
22
- readonly fiveMinutes: {
23
- readonly revalidate: 300;
24
- };
25
- readonly hourly: {
26
- readonly revalidate: 3600;
27
- };
28
- readonly daily: {
29
- readonly revalidate: 86400;
30
- };
31
- readonly never: {
32
- readonly revalidate: false;
33
- };
34
- };
35
- /**
36
- * Generate static params for ISR
37
- */
38
- export declare function generateStaticParams<T>(fetchFn: () => Promise<T[]>, mapFn: (item: T) => Record<string, string>): Promise<Array<Record<string, string>>>;
39
- /**
40
- * Revalidate tag
41
- */
42
- export declare function revalidateTag(tag: string, secret?: string): Promise<{
43
- revalidated: boolean;
44
- error?: string;
45
- }>;
46
- /**
47
- * Revalidate path
48
- */
49
- export declare function revalidatePath(path: string, secret?: string): Promise<{
50
- revalidated: boolean;
51
- error?: string;
52
- }>;
53
- /**
54
- * Revalidate multiple paths
55
- */
56
- export declare function revalidatePaths(paths: string[], secret?: string): Promise<{
57
- revalidated: number;
58
- failed: number;
59
- errors: Array<{
60
- path: string;
61
- error: string;
62
- }>;
63
- }>;
64
- /**
65
- * Revalidate multiple tags
66
- */
67
- export declare function revalidateTags(tags: string[], secret?: string): Promise<{
68
- revalidated: number;
69
- failed: number;
70
- errors: Array<{
71
- tag: string;
72
- error: string;
73
- }>;
74
- }>;
75
- /**
76
- * Edge middleware cache configuration
77
- */
78
- export interface EdgeCacheConfig {
79
- cache?: 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached';
80
- next?: {
81
- revalidate?: number | false;
82
- tags?: string[];
83
- };
84
- }
85
- /**
86
- * Create edge cached fetch
87
- */
88
- export declare function createEdgeCachedFetch(config?: EdgeCacheConfig): <T>(url: string, options?: RequestInit) => Promise<T>;
89
- /**
90
- * Unstable cache wrapper (Next.js 14+)
91
- */
92
- export declare function createCachedFunction<TArgs extends unknown[], TReturn>(fn: (...args: TArgs) => Promise<TReturn>, options?: {
93
- tags?: string[];
94
- revalidate?: number | false;
95
- }): (...args: TArgs) => Promise<TReturn>;
96
- /**
97
- * Edge rate limiting with cache
98
- */
99
- export interface EdgeRateLimitConfig {
100
- limit: number;
101
- window: number;
102
- key?: (request: NextRequest) => string;
103
- }
104
- export declare class EdgeRateLimiter {
105
- private config;
106
- private cache;
107
- constructor(config: EdgeRateLimitConfig);
108
- /**
109
- * Check rate limit
110
- */
111
- check(request: NextRequest): {
112
- allowed: boolean;
113
- limit: number;
114
- remaining: number;
115
- reset: number;
116
- };
117
- /**
118
- * Clean up expired entries
119
- */
120
- cleanup(): void;
121
- }
122
- /**
123
- * Edge geolocation caching
124
- */
125
- export interface GeoLocation {
126
- country?: string;
127
- region?: string;
128
- city?: string;
129
- latitude?: number;
130
- longitude?: number;
131
- }
132
- export declare function getGeoLocation(request: NextRequest): GeoLocation | null;
133
- /**
134
- * Edge A/B testing with cache
135
- */
136
- export declare function getABTestVariant(request: NextRequest, testName: string, variants: string[]): string;
137
- /**
138
- * Edge personalization cache
139
- */
140
- export interface PersonalizationConfig {
141
- userId?: string;
142
- preferences?: Record<string, unknown>;
143
- location?: GeoLocation;
144
- device?: 'mobile' | 'tablet' | 'desktop';
145
- variant?: string;
146
- }
147
- export declare function getPersonalizationConfig(request: NextRequest): PersonalizationConfig;
148
- /**
149
- * Edge cache headers helper
150
- */
151
- export declare function setEdgeCacheHeaders(response: NextResponse, config: {
152
- maxAge?: number;
153
- sMaxAge?: number;
154
- staleWhileRevalidate?: number;
155
- tags?: string[];
156
- }): NextResponse;
157
- /**
158
- * Preload links for critical resources
159
- */
160
- export declare function addPreloadLinks(response: NextResponse, resources: Array<{
161
- href: string;
162
- as: string;
163
- type?: string;
164
- crossorigin?: boolean;
165
- }>): NextResponse;
166
- /**
167
- * Cache warming for ISR pages
168
- */
169
- export declare function warmISRCache(paths: string[], baseURL?: string): Promise<{
170
- warmed: number;
171
- failed: number;
172
- errors: Array<{
173
- path: string;
174
- error: string;
175
- }>;
176
- }>;
177
- //# sourceMappingURL=edge-cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"edge-cache.d.ts","sourceRoot":"","sources":["../../src/caching/edge-cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG7D;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;CA8Bd,CAAC;AAEX;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,OAAO,EAAE,MAAM,OAAO,CAAC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