mcp-use 1.6.3-canary.0 → 1.7.0-canary.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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/chunk-3R5PDYIN.js +403 -0
- package/dist/{chunk-BWOTID2D.js → chunk-AGKMD2ZM.js} +7 -350
- package/dist/{chunk-SJEHVCPM.js → chunk-BG2APH43.js} +120 -26
- package/dist/{chunk-YURRUCIM.js → chunk-CPG2WZUL.js} +9 -11
- package/dist/chunk-F4UHAA5L.js +854 -0
- package/dist/chunk-JQKKMUCT.js +0 -0
- package/dist/chunk-MTHLLDCX.js +97 -0
- package/dist/{chunk-MCF5P6GJ.js → chunk-S6K5QZBJ.js} +739 -29
- package/dist/{display-YIYC6WJE.js → display-A5IEINAP.js} +79 -17
- package/dist/index.cjs +1055 -136
- package/dist/index.js +14 -10
- package/dist/{langfuse-C4HKZ3NL.js → langfuse-N5Y5BSXK.js} +1 -1
- package/dist/oauth-U4NNKN4B.js +30 -0
- package/dist/src/agents/display.d.ts.map +1 -1
- package/dist/src/agents/index.cjs +854 -78
- package/dist/src/agents/index.js +3 -2
- package/dist/src/auth/browser-provider.d.ts +2 -0
- package/dist/src/auth/browser-provider.d.ts.map +1 -1
- package/dist/src/auth/callback.d.ts.map +1 -1
- package/dist/src/auth/index.cjs +421 -0
- package/dist/src/auth/index.js +10 -0
- package/dist/src/auth/types.d.ts +3 -1
- package/dist/src/auth/types.d.ts.map +1 -1
- package/dist/src/browser.cjs +924 -98
- package/dist/src/browser.js +8 -5
- package/dist/src/connectors/base.d.ts +52 -121
- package/dist/src/connectors/base.d.ts.map +1 -1
- package/dist/src/connectors/http.d.ts.map +1 -1
- package/dist/src/managers/server_manager.d.ts.map +1 -1
- package/dist/src/managers/tools/acquire_active_mcp_server.d.ts +2 -2
- package/dist/src/managers/tools/acquire_active_mcp_server.d.ts.map +1 -1
- package/dist/src/managers/tools/add_server_from_config.d.ts +1 -7
- package/dist/src/managers/tools/add_server_from_config.d.ts.map +1 -1
- package/dist/src/managers/tools/connect_mcp_server.d.ts +2 -10
- package/dist/src/managers/tools/connect_mcp_server.d.ts.map +1 -1
- package/dist/src/managers/tools/list_mcp_servers.d.ts +2 -2
- package/dist/src/managers/tools/list_mcp_servers.d.ts.map +1 -1
- package/dist/src/managers/tools/release_mcp_server_connection.d.ts +2 -2
- package/dist/src/managers/tools/release_mcp_server_connection.d.ts.map +1 -1
- package/dist/src/observability/langfuse.d.ts +4 -0
- package/dist/src/observability/langfuse.d.ts.map +1 -1
- package/dist/src/react/McpUseProvider.d.ts.map +1 -1
- package/dist/src/react/index.cjs +189 -41
- package/dist/src/react/index.js +4 -2
- package/dist/src/react/types.d.ts +12 -1
- package/dist/src/react/types.d.ts.map +1 -1
- package/dist/src/react/useMcp.d.ts.map +1 -1
- package/dist/src/server/connect-adapter.d.ts.map +1 -1
- package/dist/src/server/context-storage.d.ts +54 -0
- package/dist/src/server/context-storage.d.ts.map +1 -0
- package/dist/src/server/index.cjs +1413 -418
- package/dist/src/server/index.d.ts +4 -1
- package/dist/src/server/index.d.ts.map +1 -1
- package/dist/src/server/index.js +426 -420
- package/dist/src/server/mcp-server.d.ts +50 -81
- package/dist/src/server/mcp-server.d.ts.map +1 -1
- package/dist/src/server/oauth/index.d.ts +13 -0
- package/dist/src/server/oauth/index.d.ts.map +1 -0
- package/dist/src/server/oauth/middleware.d.ts +19 -0
- package/dist/src/server/oauth/middleware.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/auth0.d.ts +22 -0
- package/dist/src/server/oauth/providers/auth0.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/custom.d.ts +19 -0
- package/dist/src/server/oauth/providers/custom.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/keycloak.d.ts +22 -0
- package/dist/src/server/oauth/providers/keycloak.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/supabase.d.ts +24 -0
- package/dist/src/server/oauth/providers/supabase.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/types.d.ts +138 -0
- package/dist/src/server/oauth/providers/types.d.ts.map +1 -0
- package/dist/src/server/oauth/providers/workos.d.ts +30 -0
- package/dist/src/server/oauth/providers/workos.d.ts.map +1 -0
- package/dist/src/server/oauth/providers.d.ts +208 -0
- package/dist/src/server/oauth/providers.d.ts.map +1 -0
- package/dist/src/server/oauth/routes.d.ts +33 -0
- package/dist/src/server/oauth/routes.d.ts.map +1 -0
- package/dist/src/server/oauth/utils.d.ts +155 -0
- package/dist/src/server/oauth/utils.d.ts.map +1 -0
- package/dist/src/server/types/common.d.ts +47 -0
- package/dist/src/server/types/common.d.ts.map +1 -1
- package/dist/src/server/types/context.d.ts +34 -0
- package/dist/src/server/types/context.d.ts.map +1 -0
- package/dist/src/server/types/index.d.ts +2 -1
- package/dist/src/server/types/index.d.ts.map +1 -1
- package/dist/src/server/types/tool.d.ts +82 -9
- package/dist/src/server/types/tool.d.ts.map +1 -1
- package/dist/src/server/utils/index.d.ts +6 -0
- package/dist/src/server/utils/index.d.ts.map +1 -0
- package/dist/src/server/utils/response-helpers.d.ts +151 -0
- package/dist/src/server/utils/response-helpers.d.ts.map +1 -0
- package/dist/src/server/utils/runtime.d.ts +25 -0
- package/dist/src/server/utils/runtime.d.ts.map +1 -0
- package/dist/src/task_managers/streamable_http.d.ts +1 -0
- package/dist/src/task_managers/streamable_http.d.ts.map +1 -1
- package/dist/src/utils/json-schema-to-zod/JSONSchemaToZod.d.ts +270 -0
- package/dist/src/utils/json-schema-to-zod/JSONSchemaToZod.d.ts.map +1 -0
- package/dist/src/utils/json-schema-to-zod/Type.d.ts +24 -0
- package/dist/src/utils/json-schema-to-zod/Type.d.ts.map +1 -0
- package/dist/src/utils/json-schema-to-zod/index.d.ts +3 -0
- package/dist/src/utils/json-schema-to-zod/index.d.ts.map +1 -0
- package/dist/src/utils/url-sanitize.d.ts +17 -0
- package/dist/src/utils/url-sanitize.d.ts.map +1 -0
- package/dist/tsup.config.d.ts.map +1 -1
- package/package.json +30 -38
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Typed CallToolResult that constrains the structuredContent property
|
|
4
|
+
* to match a specific type T. Used for output schema validation.
|
|
5
|
+
* T must be a record type (object) to match the SDK's CallToolResult interface.
|
|
6
|
+
*/
|
|
7
|
+
export interface TypedCallToolResult<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<CallToolResult, "structuredContent"> {
|
|
8
|
+
structuredContent?: T;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create a text content response for MCP tools
|
|
12
|
+
*
|
|
13
|
+
* @param content - The text content to return
|
|
14
|
+
* @returns CallToolResult with text content
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* server.tool({
|
|
19
|
+
* name: 'greet',
|
|
20
|
+
* schema: z.object({ name: z.string() }),
|
|
21
|
+
* cb: async ({ name }) => text(`Hello, ${name}!`)
|
|
22
|
+
* })
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function text(content: string): CallToolResult;
|
|
26
|
+
/**
|
|
27
|
+
* Create an image content response for MCP tools
|
|
28
|
+
*
|
|
29
|
+
* @param data - The image data (data URL or base64)
|
|
30
|
+
* @param mimeType - MIME type (e.g., 'image/png', defaults to 'image/png')
|
|
31
|
+
* @returns CallToolResult with image content
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* server.tool({
|
|
36
|
+
* name: 'generate-image',
|
|
37
|
+
* cb: async () => image('data:image/png;base64,...', 'image/png')
|
|
38
|
+
* })
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function image(data: string, mimeType?: string): CallToolResult;
|
|
42
|
+
/**
|
|
43
|
+
* Create a resource content response for MCP tools
|
|
44
|
+
*
|
|
45
|
+
* @param uri - The resource URI
|
|
46
|
+
* @param mimeType - Optional MIME type
|
|
47
|
+
* @param text - Optional text content for the resource
|
|
48
|
+
* @returns CallToolResult with resource content
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* server.tool({
|
|
53
|
+
* name: 'get-config',
|
|
54
|
+
* cb: async () => resource('file:///config.json', 'application/json')
|
|
55
|
+
* })
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function resource(uri: string, mimeType?: string, text?: string): CallToolResult;
|
|
59
|
+
/**
|
|
60
|
+
* Create an error response for MCP tools
|
|
61
|
+
*
|
|
62
|
+
* @param message - The error message
|
|
63
|
+
* @returns CallToolResult marked as error
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* server.tool({
|
|
68
|
+
* name: 'risky-operation',
|
|
69
|
+
* cb: async () => {
|
|
70
|
+
* if (somethingWrong) {
|
|
71
|
+
* return error('Operation failed: invalid input')
|
|
72
|
+
* }
|
|
73
|
+
* return text('Success!')
|
|
74
|
+
* }
|
|
75
|
+
* })
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare function error(message: string): CallToolResult;
|
|
79
|
+
/**
|
|
80
|
+
* Create a JSON object response for MCP tools
|
|
81
|
+
*
|
|
82
|
+
* @param data - The object to return as JSON
|
|
83
|
+
* @returns TypedCallToolResult with JSON text content and typed structuredContent
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* server.tool({
|
|
88
|
+
* name: 'get-user-info',
|
|
89
|
+
* cb: async (_args, _ctx, { auth }) => object({
|
|
90
|
+
* userId: auth.user.userId,
|
|
91
|
+
* email: auth.user.email
|
|
92
|
+
* })
|
|
93
|
+
* })
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare function object<T extends Record<string, any>>(data: T): TypedCallToolResult<T>;
|
|
97
|
+
export declare function array<T extends any[]>(data: T): TypedCallToolResult<{
|
|
98
|
+
data: T;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for widget response utility
|
|
102
|
+
*/
|
|
103
|
+
export interface WidgetResponseConfig {
|
|
104
|
+
/** Widget name from resources folder */
|
|
105
|
+
name: string;
|
|
106
|
+
/** Structured data to pass to the widget */
|
|
107
|
+
data: Record<string, any>;
|
|
108
|
+
/** Optional text message (defaults to "Displaying {name}") */
|
|
109
|
+
message?: string;
|
|
110
|
+
/** Status text while tool is invoking */
|
|
111
|
+
invoking?: string;
|
|
112
|
+
/** Status text after tool has invoked */
|
|
113
|
+
invoked?: string;
|
|
114
|
+
/** Whether the widget can initiate tool calls (defaults to true) */
|
|
115
|
+
widgetAccessible?: boolean;
|
|
116
|
+
/** Whether this tool result can produce a widget (defaults to true) */
|
|
117
|
+
resultCanProduceWidget?: boolean;
|
|
118
|
+
/** Optional build ID for cache busting (usually auto-set by server) */
|
|
119
|
+
buildId?: string;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Create a widget response for MCP tools
|
|
123
|
+
*
|
|
124
|
+
* Returns a complete tool result configured to display an OpenAI Apps SDK widget.
|
|
125
|
+
* This allows any tool to return a widget, not just auto-registered widget tools.
|
|
126
|
+
*
|
|
127
|
+
* The widget must exist in your resources folder and be registered with the server
|
|
128
|
+
* using `server.uiResource()`.
|
|
129
|
+
*
|
|
130
|
+
* @param config - Widget response configuration
|
|
131
|
+
* @returns CallToolResult with widget metadata and structured content
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```typescript
|
|
135
|
+
* server.tool({
|
|
136
|
+
* name: 'get-weather',
|
|
137
|
+
* schema: z.object({ city: z.string() }),
|
|
138
|
+
* cb: async ({ city }) => {
|
|
139
|
+
* const weatherData = await fetchWeather(city);
|
|
140
|
+
* return widget({
|
|
141
|
+
* name: 'weather-display',
|
|
142
|
+
* data: weatherData,
|
|
143
|
+
* message: `Showing weather for ${city}`
|
|
144
|
+
* });
|
|
145
|
+
* }
|
|
146
|
+
* })
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
export declare function widget(config: WidgetResponseConfig): CallToolResult;
|
|
150
|
+
export declare function mix(...results: CallToolResult[]): CallToolResult;
|
|
151
|
+
//# sourceMappingURL=response-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response-helpers.d.ts","sourceRoot":"","sources":["../../../../src/server/utils/response-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB,CAClC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAC3D,SAAQ,IAAI,CAAC,cAAc,EAAE,mBAAmB,CAAC;IACjD,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACvB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CASpD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,MAAoB,GAC7B,cAAc,CAUhB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CACtB,GAAG,EAAE,MAAM,EACX,QAAQ,CAAC,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,cAAc,CAahB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAUrD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClD,IAAI,EAAE,CAAC,GACN,mBAAmB,CAAC,CAAC,CAAC,CAYxB;AAED,wBAAgB,KAAK,CAAC,CAAC,SAAS,GAAG,EAAE,EACnC,IAAI,EAAE,CAAC,GACN,mBAAmB,CAAC;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,CAAC,CAUlC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,uEAAuE;IACvE,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,cAAc,CA+CnE;AAED,wBAAgB,GAAG,CAAC,GAAG,OAAO,EAAE,cAAc,EAAE,GAAG,cAAc,CA4BhE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-runtime utilities for Node.js and Deno compatibility
|
|
3
|
+
*/
|
|
4
|
+
export declare const isDeno: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Get an environment variable in a cross-runtime compatible way
|
|
7
|
+
* Works in both Node.js and Deno environments
|
|
8
|
+
*
|
|
9
|
+
* @param key - The environment variable key
|
|
10
|
+
* @returns The value of the environment variable, or undefined if not set
|
|
11
|
+
*/
|
|
12
|
+
export declare function getEnv(key: string): string | undefined;
|
|
13
|
+
export declare function getCwd(): string;
|
|
14
|
+
export declare const fsHelpers: {
|
|
15
|
+
readFileSync(path: string, encoding?: string): Promise<string>;
|
|
16
|
+
readFile(path: string): Promise<ArrayBuffer>;
|
|
17
|
+
existsSync(path: string): Promise<boolean>;
|
|
18
|
+
readdirSync(path: string): Promise<string[]>;
|
|
19
|
+
};
|
|
20
|
+
export declare const pathHelpers: {
|
|
21
|
+
join(...paths: string[]): string;
|
|
22
|
+
relative(from: string, to: string): string;
|
|
23
|
+
};
|
|
24
|
+
export declare function generateUUID(): string;
|
|
25
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/server/utils/runtime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,MAAM,SAAkD,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKtD;AAGD,wBAAgB,MAAM,IAAI,MAAM,CAK/B;AAGD,eAAO,MAAM,SAAS;uBACK,MAAM,aAAY,MAAM,GAAY,OAAO,CAAC,MAAM,CAAC;mBAWvD,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;qBAa3B,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;sBAaxB,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAWnD,CAAC;AAGF,eAAO,MAAM,WAAW;mBACP,MAAM,EAAE,GAAG,MAAM;mBAUjB,MAAM,MAAM,MAAM,GAAG,MAAM;CAkB3C,CAAC;AAIF,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
|
|
@@ -19,6 +19,7 @@ export declare class StreamableHttpConnectionManager extends ConnectionManager<S
|
|
|
19
19
|
protected establishConnection(): Promise<StreamableHTTPClientTransport>;
|
|
20
20
|
/**
|
|
21
21
|
* Close the underlying transport and clean up resources.
|
|
22
|
+
* Per MCP specification, terminates the session with DELETE request before closing.
|
|
22
23
|
*/
|
|
23
24
|
protected closeConnection(_connection: StreamableHTTPClientTransport): Promise<void>;
|
|
24
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamable_http.d.ts","sourceRoot":"","sources":["../../../src/task_managers/streamable_http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAC/G,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,qBAAa,+BAAgC,SAAQ,iBAAiB,CAAC,6BAA6B,CAAC;IACnG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAuC;IAC7D,OAAO,CAAC,UAAU,CAA8C;IAEhE;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,oCAAoC;IAM1E;;;OAGG;cACa,mBAAmB,IAAI,OAAO,CAAC,6BAA6B,CAAC;IAO7E
|
|
1
|
+
{"version":3,"file":"streamable_http.d.ts","sourceRoot":"","sources":["../../../src/task_managers/streamable_http.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,oDAAoD,CAAC;AAC/G,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AAEnG,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C,qBAAa,+BAAgC,SAAQ,iBAAiB,CAAC,6BAA6B,CAAC;IACnG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAuC;IAC7D,OAAO,CAAC,UAAU,CAA8C;IAEhE;;;;;OAKG;gBACS,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,oCAAoC;IAM1E;;;OAGG;cACa,mBAAmB,IAAI,OAAO,CAAC,6BAA6B,CAAC;IAO7E;;;OAGG;cACa,eAAe,CAC7B,WAAW,EAAE,6BAA6B,GACzC,OAAO,CAAC,IAAI,CAAC;IAehB;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;CACF"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import type { ZodSchema } from "zod";
|
|
2
|
+
import type { JSONSchema } from "./Type.js";
|
|
3
|
+
export declare class JSONSchemaToZod {
|
|
4
|
+
/**
|
|
5
|
+
* Converts a JSON schema to a Zod schema.
|
|
6
|
+
*
|
|
7
|
+
* @param {JSONSchema} schema - The JSON schema.
|
|
8
|
+
* @returns {ZodSchema} - The Zod schema.
|
|
9
|
+
*/
|
|
10
|
+
static convert(schema: JSONSchema): ZodSchema;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if data matches a condition schema.
|
|
13
|
+
*
|
|
14
|
+
* @param {JSONValue} data - The data to check.
|
|
15
|
+
* @param {JSONSchema} condition - The condition schema.
|
|
16
|
+
* @returns {boolean} - Whether the data matches the condition.
|
|
17
|
+
*/
|
|
18
|
+
private static matchesCondition;
|
|
19
|
+
/**
|
|
20
|
+
* Validates data against a conditional schema and adds issues to context if validation fails.
|
|
21
|
+
*
|
|
22
|
+
* @param {JSONValue} data - The data to validate.
|
|
23
|
+
* @param {JSONSchema} schema - The conditional schema.
|
|
24
|
+
* @param {z.RefinementCtx} ctx - The Zod refinement context.
|
|
25
|
+
*/
|
|
26
|
+
private static validateConditionalSchema;
|
|
27
|
+
/**
|
|
28
|
+
* Validates that all required properties are present in the data.
|
|
29
|
+
*
|
|
30
|
+
* @param {JSONValue} data - The data to validate.
|
|
31
|
+
* @param {JSONSchema} schema - The schema containing required properties.
|
|
32
|
+
* @param {z.RefinementCtx} ctx - The Zod refinement context.
|
|
33
|
+
*/
|
|
34
|
+
private static validateRequiredProperties;
|
|
35
|
+
/**
|
|
36
|
+
* Validates property patterns for string properties.
|
|
37
|
+
*
|
|
38
|
+
* @param {JSONValue} data - The data to validate.
|
|
39
|
+
* @param {JSONSchema} schema - The schema containing property patterns.
|
|
40
|
+
* @param {z.RefinementCtx} ctx - The Zod refinement context.
|
|
41
|
+
*/
|
|
42
|
+
private static validatePropertyPatterns;
|
|
43
|
+
/**
|
|
44
|
+
* Validates nested if-then-else conditions.
|
|
45
|
+
*
|
|
46
|
+
* @param {JSONValue} data - The data to validate.
|
|
47
|
+
* @param {JSONSchema} schema - The schema containing if-then-else conditions.
|
|
48
|
+
* @param {z.RefinementCtx} ctx - The Zod refinement context.
|
|
49
|
+
*/
|
|
50
|
+
private static validateNestedConditions;
|
|
51
|
+
/**
|
|
52
|
+
* Parses a JSON schema and returns the corresponding Zod schema.
|
|
53
|
+
* This is the main entry point for schema conversion.
|
|
54
|
+
*
|
|
55
|
+
* @param {JSONSchema} schema - The JSON schema.
|
|
56
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
57
|
+
*/
|
|
58
|
+
private static parseSchema;
|
|
59
|
+
/**
|
|
60
|
+
* Handles schemas with an array of types.
|
|
61
|
+
*
|
|
62
|
+
* @param {JSONSchema} schema - The JSON schema with type array.
|
|
63
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
64
|
+
*/
|
|
65
|
+
private static handleTypeArray;
|
|
66
|
+
/**
|
|
67
|
+
* Handles nullable types by creating a nullable schema.
|
|
68
|
+
*
|
|
69
|
+
* @param {JSONSchema} schema - The JSON schema with nullable type.
|
|
70
|
+
* @returns {ZodTypeAny} - The nullable Zod schema.
|
|
71
|
+
*/
|
|
72
|
+
private static handleNullableType;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a union type from an array of types.
|
|
75
|
+
*
|
|
76
|
+
* @param {string[]} types - Array of type strings.
|
|
77
|
+
* @param {JSONSchema} baseSchema - The base schema to apply to each type.
|
|
78
|
+
* @returns {ZodTypeAny} - The union Zod schema.
|
|
79
|
+
*/
|
|
80
|
+
private static createUnionFromTypes;
|
|
81
|
+
/**
|
|
82
|
+
* Handles schemas with a single type.
|
|
83
|
+
*
|
|
84
|
+
* @param {JSONSchema} schema - The JSON schema with single type.
|
|
85
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
86
|
+
*/
|
|
87
|
+
private static handleSingleType;
|
|
88
|
+
/**
|
|
89
|
+
* Parses a number schema.
|
|
90
|
+
*
|
|
91
|
+
* @param {JSONSchema} schema - The JSON schema for a number.
|
|
92
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
93
|
+
*/
|
|
94
|
+
private static parseNumberSchema;
|
|
95
|
+
/**
|
|
96
|
+
* Applies bounds validation to a number schema.
|
|
97
|
+
*
|
|
98
|
+
* @param {z.ZodNumber} numberSchema - The base number schema.
|
|
99
|
+
* @param {JSONSchema} schema - The JSON schema with bounds.
|
|
100
|
+
* @returns {z.ZodNumber} - The updated schema with bounds validation.
|
|
101
|
+
*/
|
|
102
|
+
private static applyNumberBounds;
|
|
103
|
+
/**
|
|
104
|
+
* Applies multipleOf validation to a number schema.
|
|
105
|
+
*
|
|
106
|
+
* @param {z.ZodNumber} numberSchema - The base number schema.
|
|
107
|
+
* @param {JSONSchema} schema - The JSON schema with multipleOf.
|
|
108
|
+
* @returns {z.ZodNumber} - The updated schema with multipleOf validation.
|
|
109
|
+
*/
|
|
110
|
+
private static applyNumberMultipleOf;
|
|
111
|
+
/**
|
|
112
|
+
* Applies enum validation to a number schema.
|
|
113
|
+
*
|
|
114
|
+
* @param {z.ZodNumber} numberSchema - The base number schema.
|
|
115
|
+
* @param {JSONSchema} schema - The JSON schema with enum.
|
|
116
|
+
* @returns {z.ZodNumber} - The updated schema with enum validation.
|
|
117
|
+
*/
|
|
118
|
+
private static applyNumberEnum;
|
|
119
|
+
/**
|
|
120
|
+
* Applies integer constraint to a number schema if needed.
|
|
121
|
+
*
|
|
122
|
+
* @param {z.ZodNumber} numberSchema - The base number schema.
|
|
123
|
+
* @param {JSONSchema} schema - The JSON schema.
|
|
124
|
+
* @returns {z.ZodNumber} - The updated schema with integer validation if needed.
|
|
125
|
+
*/
|
|
126
|
+
private static applyIntegerConstraint;
|
|
127
|
+
/**
|
|
128
|
+
* Parses a string schema.
|
|
129
|
+
*
|
|
130
|
+
* @param {JSONSchema} schema - The JSON schema for a string.
|
|
131
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
132
|
+
*/
|
|
133
|
+
private static parseString;
|
|
134
|
+
/**
|
|
135
|
+
* Applies format validation to a string schema.
|
|
136
|
+
*
|
|
137
|
+
* @param {z.ZodString} stringSchema - The base string schema.
|
|
138
|
+
* @param {JSONSchema} schema - The JSON schema with format.
|
|
139
|
+
* @returns {ZodTypeAny} - The updated schema with format validation.
|
|
140
|
+
*/
|
|
141
|
+
private static applyStringFormat;
|
|
142
|
+
/**
|
|
143
|
+
* Applies pattern validation to a string schema.
|
|
144
|
+
*
|
|
145
|
+
* @param {z.ZodString} stringSchema - The base string schema.
|
|
146
|
+
* @param {JSONSchema} schema - The JSON schema with pattern.
|
|
147
|
+
* @returns {z.ZodString} - The updated schema with pattern validation.
|
|
148
|
+
*/
|
|
149
|
+
private static applyStringPattern;
|
|
150
|
+
/**
|
|
151
|
+
* Applies length constraints to a string schema.
|
|
152
|
+
*
|
|
153
|
+
* @param {z.ZodString} stringSchema - The base string schema.
|
|
154
|
+
* @param {JSONSchema} schema - The JSON schema with length constraints.
|
|
155
|
+
* @returns {z.ZodString} - The updated schema with length validation.
|
|
156
|
+
*/
|
|
157
|
+
private static applyStringLength;
|
|
158
|
+
/**
|
|
159
|
+
* Applies enum validation to a string schema.
|
|
160
|
+
*
|
|
161
|
+
* @param {z.ZodString} stringSchema - The base string schema.
|
|
162
|
+
* @param {JSONSchema} schema - The JSON schema with enum.
|
|
163
|
+
* @returns {ZodTypeAny} - The updated schema with enum validation.
|
|
164
|
+
*/
|
|
165
|
+
private static applyStringEnum;
|
|
166
|
+
/**
|
|
167
|
+
* Parses a JSON schema of type array and returns the corresponding Zod schema.
|
|
168
|
+
*
|
|
169
|
+
* @param {JSONSchema} schema - The JSON schema.
|
|
170
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
171
|
+
*/
|
|
172
|
+
private static parseArray;
|
|
173
|
+
/**
|
|
174
|
+
* Applies constraints to an array schema.
|
|
175
|
+
*
|
|
176
|
+
* @param {z.ZodArray<any>} arraySchema - The base array schema.
|
|
177
|
+
* @param {JSONSchema} schema - The JSON schema with array constraints.
|
|
178
|
+
* @returns {z.ZodTypeAny} - The updated array schema with constraints.
|
|
179
|
+
*/
|
|
180
|
+
private static applyArrayConstraints;
|
|
181
|
+
/**
|
|
182
|
+
* Parses an object schema.
|
|
183
|
+
*
|
|
184
|
+
* @param {JSONSchema} schema - The JSON schema for an object.
|
|
185
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
186
|
+
*/
|
|
187
|
+
private static parseObject;
|
|
188
|
+
/**
|
|
189
|
+
* Processes object properties and builds the shape object.
|
|
190
|
+
*
|
|
191
|
+
* @param {JSONSchema} schema - The JSON schema for an object.
|
|
192
|
+
* @param {Record<string, ZodTypeAny>} shape - The shape object to populate.
|
|
193
|
+
*/
|
|
194
|
+
private static processObjectProperties;
|
|
195
|
+
/**
|
|
196
|
+
* Processes additionalProperties configuration.
|
|
197
|
+
*
|
|
198
|
+
* @param {JSONSchema} schema - The JSON schema for an object.
|
|
199
|
+
* @param {z.ZodObject<any, any>} objectSchema - The Zod object schema.
|
|
200
|
+
* @returns {z.ZodObject<any, any>} - The updated Zod object schema.
|
|
201
|
+
*/
|
|
202
|
+
private static processAdditionalProperties;
|
|
203
|
+
/**
|
|
204
|
+
* Parses a conditional schema with if-then-else.
|
|
205
|
+
*
|
|
206
|
+
* @param {JSONSchema} schema - The JSON schema with conditional validation.
|
|
207
|
+
* @returns {ZodTypeAny} - The conditional Zod schema.
|
|
208
|
+
*/
|
|
209
|
+
private static parseConditional;
|
|
210
|
+
/**
|
|
211
|
+
* Creates a base object schema from the given JSON schema.
|
|
212
|
+
*
|
|
213
|
+
* @param {JSONSchema} schema - The JSON schema.
|
|
214
|
+
* @returns {z.ZodObject<any, any>} - The base Zod object schema.
|
|
215
|
+
*/
|
|
216
|
+
private static createBaseObjectSchema;
|
|
217
|
+
/**
|
|
218
|
+
* Applies default values from schema properties to data object.
|
|
219
|
+
*
|
|
220
|
+
* @param {JSONValue} data - The original data object.
|
|
221
|
+
* @param {JSONSchema} schema - The schema with default values.
|
|
222
|
+
* @returns {JSONValue} - The data object with defaults applied.
|
|
223
|
+
*/
|
|
224
|
+
private static applyDefaultValues;
|
|
225
|
+
/**
|
|
226
|
+
* Parses a schema with combinators (oneOf, anyOf, allOf).
|
|
227
|
+
* Delegates to the appropriate combinator parser based on which combinator is present.
|
|
228
|
+
*
|
|
229
|
+
* @param {JSONSchema} schema - The JSON schema with combinators.
|
|
230
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
231
|
+
*/
|
|
232
|
+
private static parseCombinator;
|
|
233
|
+
/**
|
|
234
|
+
* Parses a oneOf combinator schema.
|
|
235
|
+
*
|
|
236
|
+
* @param {JSONSchema[]} schemas - Array of JSON schemas in the oneOf.
|
|
237
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
238
|
+
*/
|
|
239
|
+
private static parseOneOf;
|
|
240
|
+
/**
|
|
241
|
+
* Parses an anyOf combinator schema.
|
|
242
|
+
*
|
|
243
|
+
* @param {JSONSchema[]} schemas - Array of JSON schemas in the anyOf.
|
|
244
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
245
|
+
*/
|
|
246
|
+
private static parseAnyOf;
|
|
247
|
+
/**
|
|
248
|
+
* Creates a union from an array of schemas, handling special cases.
|
|
249
|
+
*
|
|
250
|
+
* @param {JSONSchema[]} schemas - Array of JSON schemas to create a union from.
|
|
251
|
+
* @returns {ZodTypeAny} - The union Zod schema.
|
|
252
|
+
*/
|
|
253
|
+
private static createUnionFromSchemas;
|
|
254
|
+
/**
|
|
255
|
+
* Parses an allOf combinator schema by merging all schemas.
|
|
256
|
+
*
|
|
257
|
+
* @param {JSONSchema[]} schemas - Array of JSON schemas in the allOf.
|
|
258
|
+
* @returns {ZodTypeAny} - The ZodTypeAny schema.
|
|
259
|
+
*/
|
|
260
|
+
private static parseAllOf;
|
|
261
|
+
/**
|
|
262
|
+
* Merges two JSON schemas together.
|
|
263
|
+
*
|
|
264
|
+
* @param {JSONSchema} baseSchema - The base JSON schema.
|
|
265
|
+
* @param {JSONSchema} addSchema - The JSON schema to add.
|
|
266
|
+
* @returns {JSONSchema} - The merged JSON schema
|
|
267
|
+
*/
|
|
268
|
+
private static mergeSchemas;
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=JSONSchemaToZod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSONSchemaToZod.d.ts","sourceRoot":"","sources":["../../../../src/utils/json-schema-to-zod/JSONSchemaToZod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAErC,OAAO,KAAK,EAAE,UAAU,EAAyB,MAAM,WAAW,CAAC;AAEnE,qBAAa,eAAe;IAC1B;;;;;OAKG;WACW,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS;IAIpD;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IA2D/B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAUxC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAiCzC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;IA6CvC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAiBvC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAyB1B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAc9B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAuBjC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAYnC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAmC/B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAahC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAqBhC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAapC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAsB9B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAarC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAmB1B;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAwBhC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAcjC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAiBhC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAc9B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAkBzB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAyBpC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,WAAW;IAgB1B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAgBtC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAoB1C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,gBAAgB;IA0B/B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAerC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IA+BjC;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAiB9B;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAIzB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAIzB;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAkCrC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAmBzB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;CAoB5B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents any valid JSON value.
|
|
3
|
+
*/
|
|
4
|
+
export type JSONValue = string | number | boolean | null | JSONObject | JSONValue[];
|
|
5
|
+
/**
|
|
6
|
+
* Represents a JSON object.
|
|
7
|
+
*/
|
|
8
|
+
export type JSONObject = {
|
|
9
|
+
[key: string]: JSONValue;
|
|
10
|
+
};
|
|
11
|
+
export type JSONSchema = {
|
|
12
|
+
type?: string | string[];
|
|
13
|
+
properties?: Record<string, JSONSchema>;
|
|
14
|
+
items?: JSONSchema | JSONSchema[];
|
|
15
|
+
required?: string[];
|
|
16
|
+
enum?: (string | number)[];
|
|
17
|
+
format?: string;
|
|
18
|
+
oneOf?: JSONSchema[];
|
|
19
|
+
allOf?: JSONSchema[];
|
|
20
|
+
anyOf?: JSONSchema[];
|
|
21
|
+
additionalProperties?: boolean | JSONSchema;
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Type.d.ts","sourceRoot":"","sources":["../../../../src/utils/json-schema-to-zod/Type.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,UAAU,GACV,SAAS,EAAE,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,UAAU,GAAG,UAAU,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC5C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/json-schema-to-zod/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL sanitization utility
|
|
3
|
+
*
|
|
4
|
+
* Sanitizes URLs to prevent security issues by:
|
|
5
|
+
* - Restricting to http/https protocols only
|
|
6
|
+
* - Encoding URL components properly
|
|
7
|
+
* - Validating hostnames
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Sanitizes a URL string by encoding all components and validating the protocol.
|
|
11
|
+
*
|
|
12
|
+
* @param raw - The raw URL string to sanitize
|
|
13
|
+
* @returns The sanitized URL as a string
|
|
14
|
+
* @throws Error if the URL is invalid or uses an unsupported protocol
|
|
15
|
+
*/
|
|
16
|
+
export declare function sanitizeUrl(raw: string): string;
|
|
17
|
+
//# sourceMappingURL=url-sanitize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url-sanitize.d.ts","sourceRoot":"","sources":["../../../src/utils/url-sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA+B/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,
|
|
1
|
+
{"version":3,"file":"tsup.config.d.ts","sourceRoot":"","sources":["../tsup.config.ts"],"names":[],"mappings":";AAEA,wBA2CG"}
|