@j0hanz/superfetch 1.2.3 → 1.2.4

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 CHANGED
@@ -540,7 +540,7 @@ Rate limiting applies to `/mcp` and `/mcp/downloads` and is configurable via `RA
540
540
  | HTML Parsing | Cheerio ^1.1.2, LinkeDOM ^0.18.12 |
541
541
  | Markdown | Turndown ^7.2.2 |
542
542
  | HTTP | Express ^5.2.1, undici ^6.22.0 |
543
- | Validation | Zod ^3.24.1 |
543
+ | Validation | Zod ^4.3.4 |
544
544
 
545
545
  ---
546
546
 
@@ -1,73 +1,46 @@
1
1
  import { z } from 'zod';
2
2
  export declare const fetchUrlInputSchema: z.ZodObject<{
3
- customHeaders: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
4
- timeout: z.ZodDefault<z.ZodNumber>;
5
- retries: z.ZodDefault<z.ZodNumber>;
6
- } & {
7
- url: z.ZodString;
8
- } & {
3
+ format: z.ZodDefault<z.ZodEnum<{
4
+ jsonl: "jsonl";
5
+ markdown: "markdown";
6
+ }>>;
7
+ includeContentBlocks: z.ZodOptional<z.ZodBoolean>;
9
8
  extractMainContent: z.ZodDefault<z.ZodBoolean>;
10
9
  includeMetadata: z.ZodDefault<z.ZodBoolean>;
11
10
  maxContentLength: z.ZodOptional<z.ZodNumber>;
12
- } & {
13
- format: z.ZodDefault<z.ZodEnum<["jsonl", "markdown"]>>;
14
- includeContentBlocks: z.ZodOptional<z.ZodBoolean>;
15
- }, "strict", z.ZodTypeAny, {
16
- url: string;
17
- extractMainContent: boolean;
18
- includeMetadata: boolean;
19
- retries: number;
20
- format: "jsonl" | "markdown";
21
- timeout: number;
22
- maxContentLength?: number | undefined;
23
- includeContentBlocks?: boolean | undefined;
24
- customHeaders?: Record<string, string> | undefined;
25
- }, {
26
- url: string;
27
- extractMainContent?: boolean | undefined;
28
- includeMetadata?: boolean | undefined;
29
- maxContentLength?: number | undefined;
30
- retries?: number | undefined;
31
- format?: "jsonl" | "markdown" | undefined;
32
- includeContentBlocks?: boolean | undefined;
33
- timeout?: number | undefined;
34
- customHeaders?: Record<string, string> | undefined;
35
- }>;
36
- export declare const fetchMarkdownInputSchema: z.ZodObject<{
37
- customHeaders: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodString>, Record<string, string>, Record<string, string>>>;
11
+ url: z.ZodURL;
12
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
38
13
  timeout: z.ZodDefault<z.ZodNumber>;
39
14
  retries: z.ZodDefault<z.ZodNumber>;
40
- } & {
41
- url: z.ZodString;
42
- } & {
15
+ }, z.core.$strict>;
16
+ export declare const fetchMarkdownInputSchema: z.ZodObject<{
43
17
  extractMainContent: z.ZodDefault<z.ZodBoolean>;
44
18
  includeMetadata: z.ZodDefault<z.ZodBoolean>;
45
19
  maxContentLength: z.ZodOptional<z.ZodNumber>;
46
- }, "strict", z.ZodTypeAny, {
47
- url: string;
48
- extractMainContent: boolean;
49
- includeMetadata: boolean;
50
- retries: number;
51
- timeout: number;
52
- maxContentLength?: number | undefined;
53
- customHeaders?: Record<string, string> | undefined;
54
- }, {
55
- url: string;
56
- extractMainContent?: boolean | undefined;
57
- includeMetadata?: boolean | undefined;
58
- maxContentLength?: number | undefined;
59
- retries?: number | undefined;
60
- timeout?: number | undefined;
61
- customHeaders?: Record<string, string> | undefined;
62
- }>;
20
+ url: z.ZodURL;
21
+ customHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
+ timeout: z.ZodDefault<z.ZodNumber>;
23
+ retries: z.ZodDefault<z.ZodNumber>;
24
+ }, z.core.$strict>;
63
25
  export declare const fetchUrlOutputSchema: z.ZodObject<{
26
+ contentSize: z.ZodOptional<z.ZodNumber>;
27
+ resourceUri: z.ZodOptional<z.ZodString>;
28
+ resourceMimeType: z.ZodOptional<z.ZodString>;
29
+ cached: z.ZodBoolean;
30
+ truncated: z.ZodOptional<z.ZodBoolean>;
31
+ error: z.ZodOptional<z.ZodString>;
32
+ errorCode: z.ZodOptional<z.ZodString>;
64
33
  url: z.ZodString;
65
34
  title: z.ZodOptional<z.ZodString>;
66
35
  contentBlocks: z.ZodNumber;
67
36
  fetchedAt: z.ZodString;
68
- format: z.ZodEnum<["jsonl", "markdown"]>;
37
+ format: z.ZodEnum<{
38
+ jsonl: "jsonl";
39
+ markdown: "markdown";
40
+ }>;
69
41
  content: z.ZodOptional<z.ZodString>;
70
- } & {
42
+ }, z.core.$strict>;
43
+ export declare const fetchMarkdownOutputSchema: z.ZodObject<{
71
44
  contentSize: z.ZodOptional<z.ZodNumber>;
72
45
  resourceUri: z.ZodOptional<z.ZodString>;
73
46
  resourceMimeType: z.ZodOptional<z.ZodString>;
@@ -75,36 +48,6 @@ export declare const fetchUrlOutputSchema: z.ZodObject<{
75
48
  truncated: z.ZodOptional<z.ZodBoolean>;
76
49
  error: z.ZodOptional<z.ZodString>;
77
50
  errorCode: z.ZodOptional<z.ZodString>;
78
- }, "strict", z.ZodTypeAny, {
79
- url: string;
80
- fetchedAt: string;
81
- format: "jsonl" | "markdown";
82
- contentBlocks: number;
83
- cached: boolean;
84
- error?: string | undefined;
85
- title?: string | undefined;
86
- truncated?: boolean | undefined;
87
- resourceUri?: string | undefined;
88
- resourceMimeType?: string | undefined;
89
- content?: string | undefined;
90
- contentSize?: number | undefined;
91
- errorCode?: string | undefined;
92
- }, {
93
- url: string;
94
- fetchedAt: string;
95
- format: "jsonl" | "markdown";
96
- contentBlocks: number;
97
- cached: boolean;
98
- error?: string | undefined;
99
- title?: string | undefined;
100
- truncated?: boolean | undefined;
101
- resourceUri?: string | undefined;
102
- resourceMimeType?: string | undefined;
103
- content?: string | undefined;
104
- contentSize?: number | undefined;
105
- errorCode?: string | undefined;
106
- }>;
107
- export declare const fetchMarkdownOutputSchema: z.ZodObject<{
108
51
  url: z.ZodString;
109
52
  title: z.ZodOptional<z.ZodString>;
110
53
  fetchedAt: z.ZodString;
@@ -113,55 +56,5 @@ export declare const fetchMarkdownOutputSchema: z.ZodObject<{
113
56
  downloadUrl: z.ZodString;
114
57
  fileName: z.ZodString;
115
58
  expiresAt: z.ZodString;
116
- }, "strip", z.ZodTypeAny, {
117
- expiresAt: string;
118
- downloadUrl: string;
119
- fileName: string;
120
- }, {
121
- expiresAt: string;
122
- downloadUrl: string;
123
- fileName: string;
124
- }>>;
125
- } & {
126
- contentSize: z.ZodOptional<z.ZodNumber>;
127
- resourceUri: z.ZodOptional<z.ZodString>;
128
- resourceMimeType: z.ZodOptional<z.ZodString>;
129
- cached: z.ZodBoolean;
130
- truncated: z.ZodOptional<z.ZodBoolean>;
131
- error: z.ZodOptional<z.ZodString>;
132
- errorCode: z.ZodOptional<z.ZodString>;
133
- }, "strict", z.ZodTypeAny, {
134
- url: string;
135
- fetchedAt: string;
136
- cached: boolean;
137
- error?: string | undefined;
138
- markdown?: string | undefined;
139
- title?: string | undefined;
140
- truncated?: boolean | undefined;
141
- resourceUri?: string | undefined;
142
- resourceMimeType?: string | undefined;
143
- contentSize?: number | undefined;
144
- file?: {
145
- expiresAt: string;
146
- downloadUrl: string;
147
- fileName: string;
148
- } | undefined;
149
- errorCode?: string | undefined;
150
- }, {
151
- url: string;
152
- fetchedAt: string;
153
- cached: boolean;
154
- error?: string | undefined;
155
- markdown?: string | undefined;
156
- title?: string | undefined;
157
- truncated?: boolean | undefined;
158
- resourceUri?: string | undefined;
159
- resourceMimeType?: string | undefined;
160
- contentSize?: number | undefined;
161
- file?: {
162
- expiresAt: string;
163
- downloadUrl: string;
164
- fileName: string;
165
- } | undefined;
166
- errorCode?: string | undefined;
167
- }>;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strict>;
@@ -7,7 +7,7 @@ const MAX_CONTENT_LENGTH = config.constants.maxContentSize;
7
7
  const customHeadersSchema = z
8
8
  .record(z.string().max(MAX_HEADER_NAME_LENGTH), z.string().max(MAX_HEADER_VALUE_LENGTH))
9
9
  .refine((headers) => Object.keys(headers).length <= MAX_HEADER_COUNT, {
10
- message: `customHeaders must have at most ${MAX_HEADER_COUNT} entries`,
10
+ error: `customHeaders must have at most ${MAX_HEADER_COUNT} entries`,
11
11
  });
12
12
  const requestOptionsSchema = z.object({
13
13
  customHeaders: customHeadersSchema
@@ -75,29 +75,18 @@ const fileDownloadSchema = z.object({
75
75
  fileName: z.string().describe('Suggested filename for download'),
76
76
  expiresAt: z.string().describe('ISO timestamp when download expires'),
77
77
  });
78
- export const fetchUrlInputSchema = requestOptionsSchema
79
- .extend({
80
- url: z
81
- .string()
82
- .min(1)
83
- .max(config.constants.maxUrlLength)
84
- .describe('The URL to fetch'),
85
- })
86
- .merge(extractionOptionsSchema)
87
- .merge(formatOptionsSchema)
88
- .strict();
89
- export const fetchMarkdownInputSchema = requestOptionsSchema
90
- .extend({
91
- url: z
92
- .string()
93
- .min(1)
94
- .max(config.constants.maxUrlLength)
95
- .describe('The URL to fetch'),
96
- })
97
- .merge(extractionOptionsSchema)
98
- .strict();
99
- export const fetchUrlOutputSchema = z
100
- .object({
78
+ export const fetchUrlInputSchema = z.strictObject({
79
+ ...requestOptionsSchema.shape,
80
+ url: z.url({ protocol: /^https?:$/i }).describe('The URL to fetch'),
81
+ ...extractionOptionsSchema.shape,
82
+ ...formatOptionsSchema.shape,
83
+ });
84
+ export const fetchMarkdownInputSchema = z.strictObject({
85
+ ...requestOptionsSchema.shape,
86
+ url: z.url({ protocol: /^https?:$/i }).describe('The URL to fetch'),
87
+ ...extractionOptionsSchema.shape,
88
+ });
89
+ export const fetchUrlOutputSchema = z.strictObject({
101
90
  url: z.string().describe('The fetched URL'),
102
91
  title: z.string().optional().describe('Page title'),
103
92
  contentBlocks: z
@@ -111,11 +100,9 @@ export const fetchUrlOutputSchema = z
111
100
  .string()
112
101
  .optional()
113
102
  .describe('The extracted content in JSONL or Markdown format'),
114
- })
115
- .merge(resourceFieldsSchema)
116
- .strict();
117
- export const fetchMarkdownOutputSchema = z
118
- .object({
103
+ ...resourceFieldsSchema.shape,
104
+ });
105
+ export const fetchMarkdownOutputSchema = z.strictObject({
119
106
  url: z.string().describe('The fetched URL'),
120
107
  title: z.string().optional().describe('Page title'),
121
108
  fetchedAt: z
@@ -128,6 +115,5 @@ export const fetchMarkdownOutputSchema = z
128
115
  file: fileDownloadSchema
129
116
  .optional()
130
117
  .describe('Download information when content is cached'),
131
- })
132
- .merge(resourceFieldsSchema)
133
- .strict();
118
+ ...resourceFieldsSchema.shape,
119
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@j0hanz/superfetch",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "mcpName": "io.github.j0hanz/superfetch",
5
5
  "description": "Intelligent web content fetcher MCP server that converts HTML to clean, AI-readable JSONL format",
6
6
  "type": "module",
@@ -59,7 +59,7 @@
59
59
  "linkedom": "^0.18.12",
60
60
  "turndown": "^7.2.2",
61
61
  "undici": "^6.22.0",
62
- "zod": "^3.24.1"
62
+ "zod": "^4.3.4"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@eslint/js": "^9.39.2",