@j0hanz/superfetch 2.5.2 → 2.6.0
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.
- package/README.md +356 -223
- package/dist/assets/logo.svg +24837 -24835
- package/dist/cache.d.ts +28 -20
- package/dist/cache.js +292 -514
- package/dist/config.d.ts +41 -7
- package/dist/config.js +298 -148
- package/dist/crypto.js +25 -12
- package/dist/dom-noise-removal.js +379 -421
- package/dist/errors.d.ts +2 -2
- package/dist/errors.js +25 -8
- package/dist/fetch.d.ts +18 -16
- package/dist/fetch.js +1132 -526
- package/dist/host-normalization.js +40 -10
- package/dist/http-native.js +628 -287
- package/dist/index.js +67 -7
- package/dist/instructions.md +44 -30
- package/dist/ip-blocklist.d.ts +8 -0
- package/dist/ip-blocklist.js +65 -0
- package/dist/json.js +14 -9
- package/dist/language-detection.d.ts +2 -11
- package/dist/language-detection.js +289 -280
- package/dist/markdown-cleanup.d.ts +0 -1
- package/dist/markdown-cleanup.js +391 -429
- package/dist/mcp-validator.js +4 -2
- package/dist/mcp.js +184 -135
- package/dist/observability.js +89 -21
- package/dist/resources.js +16 -6
- package/dist/server-tuning.d.ts +2 -0
- package/dist/server-tuning.js +25 -23
- package/dist/session.d.ts +1 -0
- package/dist/session.js +41 -33
- package/dist/tasks.d.ts +2 -0
- package/dist/tasks.js +91 -9
- package/dist/timer-utils.d.ts +5 -0
- package/dist/timer-utils.js +20 -0
- package/dist/tools.d.ts +28 -5
- package/dist/tools.js +317 -183
- package/dist/transform-types.d.ts +5 -1
- package/dist/transform.d.ts +3 -2
- package/dist/transform.js +1138 -421
- package/dist/type-guards.d.ts +1 -0
- package/dist/type-guards.js +7 -0
- package/dist/workers/transform-child.d.ts +1 -0
- package/dist/workers/transform-child.js +118 -0
- package/dist/workers/transform-worker.js +87 -78
- package/package.json +21 -13
package/dist/cache.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { ServerResponse } from 'node:http';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
declare const CachedPayloadSchema: z.ZodObject<{
|
|
5
|
+
content: z.ZodOptional<z.ZodString>;
|
|
6
|
+
markdown: z.ZodOptional<z.ZodString>;
|
|
7
|
+
title: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type CachedPayload = z.infer<typeof CachedPayloadSchema>;
|
|
3
10
|
export interface CacheEntry {
|
|
4
11
|
url: string;
|
|
5
12
|
title?: string;
|
|
@@ -7,38 +14,39 @@ export interface CacheEntry {
|
|
|
7
14
|
fetchedAt: string;
|
|
8
15
|
expiresAt: string;
|
|
9
16
|
}
|
|
10
|
-
export interface CachedPayload {
|
|
11
|
-
content?: string;
|
|
12
|
-
markdown?: string;
|
|
13
|
-
title?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface CacheKeyParts {
|
|
16
|
-
namespace: string;
|
|
17
|
-
urlHash: string;
|
|
18
|
-
}
|
|
19
17
|
export interface McpIcon {
|
|
20
18
|
src: string;
|
|
21
19
|
mimeType: string;
|
|
22
|
-
sizes
|
|
20
|
+
sizes?: string[];
|
|
23
21
|
}
|
|
24
|
-
export
|
|
25
|
-
export declare function resolveCachedPayloadContent(payload: CachedPayload): string | null;
|
|
26
|
-
export declare function createCacheKey(namespace: string, url: string, vary?: Record<string, unknown> | string): string | null;
|
|
27
|
-
export declare function parseCacheKey(cacheKey: string): CacheKeyParts | null;
|
|
28
|
-
export declare function toResourceUri(cacheKey: string): string | null;
|
|
29
|
-
interface CacheUpdateEvent {
|
|
30
|
-
cacheKey: string;
|
|
22
|
+
export interface CacheKeyParts {
|
|
31
23
|
namespace: string;
|
|
32
24
|
urlHash: string;
|
|
33
25
|
}
|
|
34
|
-
|
|
26
|
+
export interface CacheSetOptions {
|
|
27
|
+
force?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface CacheGetOptions {
|
|
30
|
+
force?: boolean;
|
|
31
|
+
}
|
|
35
32
|
interface CacheEntryMetadata {
|
|
36
33
|
url: string;
|
|
37
34
|
title?: string;
|
|
38
35
|
}
|
|
36
|
+
interface CacheUpdateEvent {
|
|
37
|
+
cacheKey: string;
|
|
38
|
+
namespace: string;
|
|
39
|
+
urlHash: string;
|
|
40
|
+
}
|
|
41
|
+
type CacheUpdateListener = (event: CacheUpdateEvent) => unknown;
|
|
42
|
+
export declare function parseCachedPayload(raw: string): CachedPayload | null;
|
|
43
|
+
export declare function resolveCachedPayloadContent(payload: CachedPayload): string | null;
|
|
44
|
+
export declare function createCacheKey(namespace: string, url: string, vary?: Record<string, unknown> | string): string | null;
|
|
45
|
+
export declare function parseCacheKey(cacheKey: string): CacheKeyParts | null;
|
|
46
|
+
export declare function toResourceUri(cacheKey: string): string | null;
|
|
39
47
|
export declare function onCacheUpdate(listener: CacheUpdateListener): () => void;
|
|
40
|
-
export declare function get(cacheKey: string | null): CacheEntry | undefined;
|
|
41
|
-
export declare function set(cacheKey: string | null, content: string, metadata: CacheEntryMetadata): void;
|
|
48
|
+
export declare function get(cacheKey: string | null, options?: CacheGetOptions): CacheEntry | undefined;
|
|
49
|
+
export declare function set(cacheKey: string | null, content: string, metadata: CacheEntryMetadata, options?: CacheSetOptions): void;
|
|
42
50
|
export declare function keys(): readonly string[];
|
|
43
51
|
export declare function isEnabled(): boolean;
|
|
44
52
|
export declare function registerCachedContentResource(server: McpServer, serverIcons?: McpIcon[]): void;
|