@perplexity-ai/mcp-server 0.14.0 → 1.1.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.
Files changed (143) hide show
  1. package/.claude-plugin/marketplace.json +49 -0
  2. package/LICENSE +21 -201
  3. package/README.md +105 -157
  4. package/dist/http.d.ts +15 -0
  5. package/dist/http.js +190 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.js +23 -0
  8. package/dist/logger.d.ts +19 -0
  9. package/dist/logger.js +82 -0
  10. package/dist/server.d.ts +61 -0
  11. package/dist/server.js +613 -0
  12. package/dist/types.d.ts +93 -0
  13. package/dist/types.js +1 -0
  14. package/dist/validation.d.ts +1063 -0
  15. package/dist/validation.js +62 -0
  16. package/package.json +67 -155
  17. package/compat.d.mts +0 -58
  18. package/compat.d.mts.map +0 -1
  19. package/compat.d.ts +0 -58
  20. package/compat.d.ts.map +0 -1
  21. package/compat.js +0 -387
  22. package/compat.js.map +0 -1
  23. package/compat.mjs +0 -378
  24. package/compat.mjs.map +0 -1
  25. package/dynamic-tools.d.mts +0 -12
  26. package/dynamic-tools.d.mts.map +0 -1
  27. package/dynamic-tools.d.ts +0 -12
  28. package/dynamic-tools.d.ts.map +0 -1
  29. package/dynamic-tools.js +0 -135
  30. package/dynamic-tools.js.map +0 -1
  31. package/dynamic-tools.mjs +0 -132
  32. package/dynamic-tools.mjs.map +0 -1
  33. package/filtering.d.mts +0 -2
  34. package/filtering.d.mts.map +0 -1
  35. package/filtering.d.ts +0 -2
  36. package/filtering.d.ts.map +0 -1
  37. package/filtering.js +0 -20
  38. package/filtering.js.map +0 -1
  39. package/filtering.mjs +0 -13
  40. package/filtering.mjs.map +0 -1
  41. package/headers.d.mts +0 -4
  42. package/headers.d.mts.map +0 -1
  43. package/headers.d.ts +0 -4
  44. package/headers.d.ts.map +0 -1
  45. package/headers.js +0 -22
  46. package/headers.js.map +0 -1
  47. package/headers.mjs +0 -18
  48. package/headers.mjs.map +0 -1
  49. package/http.d.mts +0 -9
  50. package/http.d.mts.map +0 -1
  51. package/http.d.ts +0 -9
  52. package/http.d.ts.map +0 -1
  53. package/http.js +0 -108
  54. package/http.js.map +0 -1
  55. package/http.mjs +0 -100
  56. package/http.mjs.map +0 -1
  57. package/index.d.mts +0 -3
  58. package/index.d.mts.map +0 -1
  59. package/index.d.ts +0 -3
  60. package/index.d.ts.map +0 -1
  61. package/index.js +0 -91
  62. package/index.js.map +0 -1
  63. package/index.mjs +0 -89
  64. package/index.mjs.map +0 -1
  65. package/options.d.mts +0 -18
  66. package/options.d.mts.map +0 -1
  67. package/options.d.ts +0 -18
  68. package/options.d.ts.map +0 -1
  69. package/options.js +0 -415
  70. package/options.js.map +0 -1
  71. package/options.mjs +0 -408
  72. package/options.mjs.map +0 -1
  73. package/server.d.mts +0 -35
  74. package/server.d.mts.map +0 -1
  75. package/server.d.ts +0 -35
  76. package/server.d.ts.map +0 -1
  77. package/server.js +0 -166
  78. package/server.js.map +0 -1
  79. package/server.mjs +0 -152
  80. package/server.mjs.map +0 -1
  81. package/src/compat.ts +0 -483
  82. package/src/dynamic-tools.ts +0 -159
  83. package/src/filtering.ts +0 -14
  84. package/src/headers.ts +0 -23
  85. package/src/http.ts +0 -127
  86. package/src/index.ts +0 -108
  87. package/src/options.ts +0 -453
  88. package/src/server.ts +0 -201
  89. package/src/stdio.ts +0 -13
  90. package/src/tools/chat/completions/create-chat-completions.ts +0 -1323
  91. package/src/tools/index.ts +0 -73
  92. package/src/tools/search/create-search.ts +0 -89
  93. package/src/tools/types.ts +0 -103
  94. package/src/tools.ts +0 -1
  95. package/src/tsconfig.json +0 -11
  96. package/stdio.d.mts +0 -3
  97. package/stdio.d.mts.map +0 -1
  98. package/stdio.d.ts +0 -3
  99. package/stdio.d.ts.map +0 -1
  100. package/stdio.js +0 -14
  101. package/stdio.js.map +0 -1
  102. package/stdio.mjs +0 -10
  103. package/stdio.mjs.map +0 -1
  104. package/tools/chat/completions/create-chat-completions.d.mts +0 -45
  105. package/tools/chat/completions/create-chat-completions.d.mts.map +0 -1
  106. package/tools/chat/completions/create-chat-completions.d.ts +0 -45
  107. package/tools/chat/completions/create-chat-completions.d.ts.map +0 -1
  108. package/tools/chat/completions/create-chat-completions.js +0 -1320
  109. package/tools/chat/completions/create-chat-completions.js.map +0 -1
  110. package/tools/chat/completions/create-chat-completions.mjs +0 -1316
  111. package/tools/chat/completions/create-chat-completions.mjs.map +0 -1
  112. package/tools/index.d.mts +0 -10
  113. package/tools/index.d.mts.map +0 -1
  114. package/tools/index.d.ts +0 -10
  115. package/tools/index.d.ts.map +0 -1
  116. package/tools/index.js +0 -57
  117. package/tools/index.js.map +0 -1
  118. package/tools/index.mjs +0 -50
  119. package/tools/index.mjs.map +0 -1
  120. package/tools/search/create-search.d.mts +0 -45
  121. package/tools/search/create-search.d.mts.map +0 -1
  122. package/tools/search/create-search.d.ts +0 -45
  123. package/tools/search/create-search.d.ts.map +0 -1
  124. package/tools/search/create-search.js +0 -86
  125. package/tools/search/create-search.js.map +0 -1
  126. package/tools/search/create-search.mjs +0 -82
  127. package/tools/search/create-search.mjs.map +0 -1
  128. package/tools/types.d.mts +0 -51
  129. package/tools/types.d.mts.map +0 -1
  130. package/tools/types.d.ts +0 -51
  131. package/tools/types.d.ts.map +0 -1
  132. package/tools/types.js +0 -46
  133. package/tools/types.js.map +0 -1
  134. package/tools/types.mjs +0 -42
  135. package/tools/types.mjs.map +0 -1
  136. package/tools.d.mts +0 -2
  137. package/tools.d.mts.map +0 -1
  138. package/tools.d.ts +0 -2
  139. package/tools.d.ts.map +0 -1
  140. package/tools.js +0 -18
  141. package/tools.js.map +0 -1
  142. package/tools.mjs +0 -2
  143. package/tools.mjs.map +0 -1
@@ -0,0 +1,62 @@
1
+ import { z } from "zod";
2
+ // Agent API response schemas, deliberately lenient so new upstream output
3
+ // item types or fields never break the server.
4
+ export const AgentAnnotationSchema = z
5
+ .object({
6
+ type: z.string().nullish(),
7
+ url: z.string().nullish(),
8
+ title: z.string().nullish(),
9
+ })
10
+ .passthrough();
11
+ export const AgentContentPartSchema = z
12
+ .object({
13
+ type: z.string(),
14
+ text: z.string().nullish(),
15
+ annotations: z.array(AgentAnnotationSchema).nullish(),
16
+ })
17
+ .passthrough();
18
+ export const AgentSearchResultSchema = z
19
+ .object({
20
+ id: z.number().nullish(),
21
+ url: z.string().nullish(),
22
+ title: z.string().nullish(),
23
+ snippet: z.string().nullish(),
24
+ date: z.string().nullish(),
25
+ })
26
+ .passthrough();
27
+ export const AgentOutputItemSchema = z
28
+ .object({
29
+ type: z.string(),
30
+ role: z.string().nullish(),
31
+ content: z.array(AgentContentPartSchema).nullish(),
32
+ results: z.array(AgentSearchResultSchema).nullish(),
33
+ })
34
+ .passthrough();
35
+ export const AgentResponseSchema = z
36
+ .object({
37
+ id: z.string().nullish(),
38
+ status: z.string().nullish(),
39
+ model: z.string().nullish(),
40
+ output: z.array(AgentOutputItemSchema),
41
+ usage: z.unknown().optional(),
42
+ error: z
43
+ .object({ message: z.string().nullish(), type: z.string().nullish() })
44
+ .passthrough()
45
+ .nullish(),
46
+ })
47
+ .passthrough();
48
+ export const SearchResultSchema = z.object({
49
+ title: z.string(),
50
+ url: z.string(),
51
+ snippet: z.string().optional(),
52
+ date: z.string().optional(),
53
+ score: z.number().optional(),
54
+ });
55
+ export const SearchUsageSchema = z.object({
56
+ tokens: z.number().optional(),
57
+ });
58
+ export const SearchResponseSchema = z.object({
59
+ results: z.array(SearchResultSchema),
60
+ query: z.string().optional(),
61
+ usage: SearchUsageSchema.optional(),
62
+ });
package/package.json CHANGED
@@ -1,170 +1,82 @@
1
1
  {
2
2
  "name": "@perplexity-ai/mcp-server",
3
- "version": "0.14.0",
4
- "description": "The official MCP Server for the Perplexity API",
5
- "author": "Perplexity <api@perplexity.ai>",
6
- "types": "./index.d.ts",
7
- "main": "./index.js",
8
- "type": "commonjs",
3
+ "version": "1.1.0",
4
+ "mcpName": "ai.perplexity/mcp-server",
5
+ "description": "Real-time web search, reasoning, and research through Perplexity's API",
6
+ "keywords": [
7
+ "ai",
8
+ "perplexity",
9
+ "mcp",
10
+ "modelcontextprotocol"
11
+ ],
12
+ "homepage": "https://docs.perplexity.ai/guides/mcp-server",
13
+ "bugs": {
14
+ "url": "https://github.com/perplexityai/modelcontextprotocol/issues"
15
+ },
9
16
  "repository": {
10
17
  "type": "git",
11
- "url": "git+https://github.com/perplexityai/perplexity-node.git",
12
- "directory": "packages/mcp-server"
18
+ "url": "git+https://github.com/perplexityai/modelcontextprotocol.git"
13
19
  },
14
- "homepage": "https://github.com/perplexityai/perplexity-node/tree/main/packages/mcp-server#readme",
15
- "license": "Apache-2.0",
16
- "packageManager": "yarn@1.22.22",
17
- "private": false,
20
+ "license": "MIT",
21
+ "author": "Perplexity <>",
18
22
  "publishConfig": {
19
23
  "access": "public"
20
24
  },
25
+ "type": "module",
26
+ "main": "dist/server.js",
27
+ "types": "dist/server.d.ts",
28
+ "exports": {
29
+ ".": {
30
+ "types": "./dist/server.d.ts",
31
+ "default": "./dist/server.js"
32
+ },
33
+ "./package.json": "./package.json"
34
+ },
35
+ "bin": {
36
+ "perplexity-mcp": "dist/index.js"
37
+ },
38
+ "files": [
39
+ "dist/*.js",
40
+ "dist/*.d.ts",
41
+ "!dist/*.test.js",
42
+ "!dist/*.test.d.ts",
43
+ "!dist/vitest.config.js",
44
+ "!dist/vitest.config.d.ts",
45
+ "README.md",
46
+ ".claude-plugin"
47
+ ],
21
48
  "scripts": {
22
- "test": "jest",
23
- "build": "bash ./build",
24
- "format": "prettier --write --cache --cache-strategy metadata . !dist",
25
- "tsn": "ts-node -r tsconfig-paths/register",
26
- "lint": "eslint --ext ts,js .",
27
- "fix": "eslint --fix --ext ts,js ."
49
+ "build": "tsc && shx chmod +x dist/*.js",
50
+ "prepare": "npm run build",
51
+ "watch": "tsc --watch",
52
+ "start": "node dist/index.js",
53
+ "start:http": "node dist/http.js",
54
+ "start:http:UNSAFE-public": "BIND_ADDRESS=0.0.0.0 ALLOWED_ORIGINS=* node dist/http.js",
55
+ "dev": "tsx src/index.ts",
56
+ "dev:http": "tsx src/http.ts",
57
+ "dev:http:UNSAFE-public": "BIND_ADDRESS=0.0.0.0 ALLOWED_ORIGINS=* tsx src/http.ts",
58
+ "test": "vitest run",
59
+ "test:watch": "vitest",
60
+ "test:coverage": "vitest run --coverage"
28
61
  },
29
62
  "dependencies": {
30
- "@perplexity-ai/perplexity_ai": "^0.14.0",
31
- "@cloudflare/cabidela": "^0.2.4",
32
- "@modelcontextprotocol/sdk": "^1.11.5",
33
- "@valtown/deno-http-worker": "^0.0.21",
63
+ "@modelcontextprotocol/sdk": "^1.29.0",
34
64
  "cors": "^2.8.5",
35
- "express": "^5.1.0",
36
- "jq-web": "https://github.com/stainless-api/jq-web/releases/download/v0.8.6/jq-web.tar.gz",
37
- "qs": "^6.14.0",
38
- "yargs": "^17.7.2",
39
- "zod": "^3.25.20",
40
- "zod-to-json-schema": "^3.24.5",
41
- "zod-validation-error": "^4.0.1"
42
- },
43
- "bin": {
44
- "mcp-server": "./index.js"
65
+ "express": "^4.21.2",
66
+ "undici": "^6.20.0",
67
+ "zod": "^3.25.46"
45
68
  },
46
- "imports": {
47
- "@perplexity-ai/mcp-server": ".",
48
- "@perplexity-ai/mcp-server/*": "./src/*"
69
+ "devDependencies": {
70
+ "@types/cors": "^2.8.17",
71
+ "@types/express": "^5.0.0",
72
+ "@types/node": "^20",
73
+ "@vitest/coverage-v8": "^4.0.5",
74
+ "shx": "^0.4.0",
75
+ "tsx": "^4.19.4",
76
+ "typescript": "^5.9.3",
77
+ "vitest": "^4.0.5"
49
78
  },
50
- "exports": {
51
- ".": {
52
- "require": {
53
- "types": "./index.d.ts",
54
- "default": "./index.js"
55
- },
56
- "types": "./index.d.mts",
57
- "default": "./index.mjs"
58
- },
59
- "./compat": {
60
- "import": "./compat.mjs",
61
- "require": "./compat.js"
62
- },
63
- "./compat.js": {
64
- "default": "./compat.js"
65
- },
66
- "./compat.mjs": {
67
- "default": "./compat.mjs"
68
- },
69
- "./dynamic-tools": {
70
- "import": "./dynamic-tools.mjs",
71
- "require": "./dynamic-tools.js"
72
- },
73
- "./dynamic-tools.js": {
74
- "default": "./dynamic-tools.js"
75
- },
76
- "./dynamic-tools.mjs": {
77
- "default": "./dynamic-tools.mjs"
78
- },
79
- "./filtering": {
80
- "import": "./filtering.mjs",
81
- "require": "./filtering.js"
82
- },
83
- "./filtering.js": {
84
- "default": "./filtering.js"
85
- },
86
- "./filtering.mjs": {
87
- "default": "./filtering.mjs"
88
- },
89
- "./headers": {
90
- "import": "./headers.mjs",
91
- "require": "./headers.js"
92
- },
93
- "./headers.js": {
94
- "default": "./headers.js"
95
- },
96
- "./headers.mjs": {
97
- "default": "./headers.mjs"
98
- },
99
- "./http": {
100
- "import": "./http.mjs",
101
- "require": "./http.js"
102
- },
103
- "./http.js": {
104
- "default": "./http.js"
105
- },
106
- "./http.mjs": {
107
- "default": "./http.mjs"
108
- },
109
- "./index": {
110
- "import": "./index.mjs",
111
- "require": "./index.js"
112
- },
113
- "./index.js": {
114
- "default": "./index.js"
115
- },
116
- "./index.mjs": {
117
- "default": "./index.mjs"
118
- },
119
- "./options": {
120
- "import": "./options.mjs",
121
- "require": "./options.js"
122
- },
123
- "./options.js": {
124
- "default": "./options.js"
125
- },
126
- "./options.mjs": {
127
- "default": "./options.mjs"
128
- },
129
- "./server": {
130
- "import": "./server.mjs",
131
- "require": "./server.js"
132
- },
133
- "./server.js": {
134
- "default": "./server.js"
135
- },
136
- "./server.mjs": {
137
- "default": "./server.mjs"
138
- },
139
- "./stdio": {
140
- "import": "./stdio.mjs",
141
- "require": "./stdio.js"
142
- },
143
- "./stdio.js": {
144
- "default": "./stdio.js"
145
- },
146
- "./stdio.mjs": {
147
- "default": "./stdio.mjs"
148
- },
149
- "./tools/*.mjs": {
150
- "default": "./tools/*.mjs"
151
- },
152
- "./tools/*.js": {
153
- "default": "./tools/*.js"
154
- },
155
- "./tools/*": {
156
- "import": "./tools/*.mjs",
157
- "require": "./tools/*.js"
158
- },
159
- "./tools": {
160
- "import": "./tools.mjs",
161
- "require": "./tools.js"
162
- },
163
- "./tools.js": {
164
- "default": "./tools.js"
165
- },
166
- "./tools.mjs": {
167
- "default": "./tools.mjs"
168
- }
79
+ "engines": {
80
+ "node": ">=18"
169
81
  }
170
- }
82
+ }
package/compat.d.mts DELETED
@@ -1,58 +0,0 @@
1
- import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
- import { z } from 'zod';
3
- import { Endpoint } from "./tools.mjs";
4
- export interface ClientCapabilities {
5
- topLevelUnions: boolean;
6
- validJson: boolean;
7
- refs: boolean;
8
- unions: boolean;
9
- formats: boolean;
10
- toolNameLength: number | undefined;
11
- }
12
- export declare const defaultClientCapabilities: ClientCapabilities;
13
- export declare const ClientType: z.ZodEnum<["openai-agents", "claude", "claude-code", "cursor", "infer"]>;
14
- export type ClientType = z.infer<typeof ClientType>;
15
- export declare const knownClients: Record<Exclude<ClientType, 'infer'>, ClientCapabilities>;
16
- /**
17
- * Attempts to parse strings into JSON objects
18
- */
19
- export declare function parseEmbeddedJSON(args: Record<string, unknown>, schema: Record<string, unknown>): Record<string, unknown>;
20
- export type JSONSchema = {
21
- type?: string;
22
- properties?: Record<string, JSONSchema>;
23
- required?: string[];
24
- anyOf?: JSONSchema[];
25
- $ref?: string;
26
- $defs?: Record<string, JSONSchema>;
27
- [key: string]: any;
28
- };
29
- /**
30
- * Truncates tool names to the specified length while ensuring uniqueness.
31
- * If truncation would cause duplicate names, appends a number to make them unique.
32
- */
33
- export declare function truncateToolNames(names: string[], maxLength: number): Map<string, string>;
34
- /**
35
- * Removes top-level unions from a tool by splitting it into multiple tools,
36
- * one for each variant in the union.
37
- */
38
- export declare function removeTopLevelUnions(tool: Tool): Tool[];
39
- declare function findUsedDefs(schema: JSONSchema, defs: Record<string, JSONSchema>, visited?: Set<string>): Record<string, JSONSchema>;
40
- export { findUsedDefs };
41
- /**
42
- * Inlines all $refs in a schema, eliminating $defs.
43
- * If a circular reference is detected, the circular property is removed.
44
- */
45
- export declare function inlineRefs(schema: JSONSchema): JSONSchema;
46
- /**
47
- * Removes anyOf fields from a schema, using only the first variant.
48
- */
49
- export declare function removeAnyOf(schema: JSONSchema): JSONSchema;
50
- /**
51
- * Removes format fields from a schema and appends them to the description.
52
- */
53
- export declare function removeFormats(schema: JSONSchema, formatsCapability: boolean): JSONSchema;
54
- /**
55
- * Applies all compatibility transformations to the endpoints based on the provided capabilities.
56
- */
57
- export declare function applyCompatibilityTransformations(endpoints: Endpoint[], capabilities: ClientCapabilities): Endpoint[];
58
- //# sourceMappingURL=compat.d.mts.map
package/compat.d.mts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"compat.d.mts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,CAAC,EAAE,MAAM,KAAK;OAChB,EAAE,QAAQ,EAAE;AAEnB,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,kBAOvC,CAAC;AAEF,eAAO,MAAM,UAAU,0EAAwE,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAKpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAiCjF,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,O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at.d.ts DELETED
@@ -1,58 +0,0 @@
1
- import { Tool } from '@modelcontextprotocol/sdk/types.js';
2
- import { z } from 'zod';
3
- import { Endpoint } from "./tools.js";
4
- export interface ClientCapabilities {
5
- topLevelUnions: boolean;
6
- validJson: boolean;
7
- refs: boolean;
8
- unions: boolean;
9
- formats: boolean;
10
- toolNameLength: number | undefined;
11
- }
12
- export declare const defaultClientCapabilities: ClientCapabilities;
13
- export declare const ClientType: z.ZodEnum<["openai-agents", "claude", "claude-code", "cursor", "infer"]>;
14
- export type ClientType = z.infer<typeof ClientType>;
15
- export declare const knownClients: Record<Exclude<ClientType, 'infer'>, ClientCapabilities>;
16
- /**
17
- * Attempts to parse strings into JSON objects
18
- */
19
- export declare function parseEmbeddedJSON(args: Record<string, unknown>, schema: Record<string, unknown>): Record<string, unknown>;
20
- export type JSONSchema = {
21
- type?: string;
22
- properties?: Record<string, JSONSchema>;
23
- required?: string[];
24
- anyOf?: JSONSchema[];
25
- $ref?: string;
26
- $defs?: Record<string, JSONSchema>;
27
- [key: string]: any;
28
- };
29
- /**
30
- * Truncates tool names to the specified length while ensuring uniqueness.
31
- * If truncation would cause duplicate names, appends a number to make them unique.
32
- */
33
- export declare function truncateToolNames(names: string[], maxLength: number): Map<string, string>;
34
- /**
35
- * Removes top-level unions from a tool by splitting it into multiple tools,
36
- * one for each variant in the union.
37
- */
38
- export declare function removeTopLevelUnions(tool: Tool): Tool[];
39
- declare function findUsedDefs(schema: JSONSchema, defs: Record<string, JSONSchema>, visited?: Set<string>): Record<string, JSONSchema>;
40
- export { findUsedDefs };
41
- /**
42
- * Inlines all $refs in a schema, eliminating $defs.
43
- * If a circular reference is detected, the circular property is removed.
44
- */
45
- export declare function inlineRefs(schema: JSONSchema): JSONSchema;
46
- /**
47
- * Removes anyOf fields from a schema, using only the first variant.
48
- */
49
- export declare function removeAnyOf(schema: JSONSchema): JSONSchema;
50
- /**
51
- * Removes format fields from a schema and appends them to the description.
52
- */
53
- export declare function removeFormats(schema: JSONSchema, formatsCapability: boolean): JSONSchema;
54
- /**
55
- * Applies all compatibility transformations to the endpoints based on the provided capabilities.
56
- */
57
- export declare function applyCompatibilityTransformations(endpoints: Endpoint[], capabilities: ClientCapabilities): Endpoint[];
58
- //# sourceMappingURL=compat.d.ts.map
package/compat.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"compat.d.ts","sourceRoot":"","sources":["src/compat.ts"],"names":[],"mappings":"OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC;OAClD,EAAE,CAAC,EAAE,MAAM,KAAK;OAChB,EAAE,QAAQ,EAAE;AAEnB,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CACpC;AAED,eAAO,MAAM,yBAAyB,EAAE,kBAOvC,CAAC;AAEF,eAAO,MAAM,UAAU,0EAAwE,CAAC;AAChG,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAKpD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,kBAAkB,CAiCjF,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,2BAwB/F;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,UAAU,EA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