nexus-ai-pro 2.20.2 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/API_STABILITY.md +93 -0
- package/CHANGELOG.md +208 -1
- package/README.md +11 -6
- package/SECURITY.md +16 -2
- package/dist/adapter-kit/gather.d.ts +76 -0
- package/dist/adapter-kit/gather.js +147 -0
- package/dist/adapter-kit/index.d.ts +1 -0
- package/dist/adapter-kit/index.js +1 -0
- package/dist/adapter-kit/record.d.ts +3 -1
- package/dist/adapter-kit/record.js +20 -5
- package/dist/agent/openapi.d.ts +94 -8
- package/dist/agent/openapi.js +528 -32
- package/dist/cli/adapters.d.ts +4 -3
- package/dist/cli/adapters.js +71 -2
- package/dist/cli/doctor.js +3 -0
- package/dist/cli.js +3 -1
- package/dist/core/config-builder.d.ts +1 -0
- package/dist/core/config-builder.js +1 -0
- package/dist/core/defaults.d.ts +34 -0
- package/dist/core/defaults.js +39 -0
- package/dist/core/secure-stream.js +4 -1
- package/dist/decisions/completion.d.ts +10 -7
- package/dist/decisions/completion.js +82 -8
- package/dist/decisions/core.d.ts +88 -43
- package/dist/decisions/core.js +115 -28
- package/dist/decisions/errors.d.ts +25 -0
- package/dist/decisions/errors.js +12 -0
- package/dist/decisions/index.d.ts +6 -5
- package/dist/decisions/index.js +2 -1
- package/dist/decisions/integrations.d.ts +14 -5
- package/dist/decisions/integrations.js +16 -1
- package/dist/decisions/mock.d.ts +5 -3
- package/dist/decisions/mock.js +4 -1
- package/dist/decisions/pictures.d.ts +43 -0
- package/dist/decisions/pictures.js +103 -0
- package/dist/decisions/typesafe.d.ts +33 -5
- package/dist/decisions/typesafe.js +121 -8
- package/dist/doctor/index.d.ts +6 -9
- package/dist/doctor/index.js +41 -0
- package/dist/embeddings/adapters.d.ts +1 -1
- package/dist/embeddings/adapters.js +3 -3
- package/dist/embeddings/batch-google.d.ts +27 -8
- package/dist/embeddings/batch-google.js +112 -36
- package/dist/embeddings/batch-mock.js +1 -1
- package/dist/embeddings/batch.js +10 -4
- package/dist/embeddings/engine.js +14 -13
- package/dist/embeddings/index.d.ts +1 -1
- package/dist/embeddings/inputs.d.ts +26 -3
- package/dist/embeddings/inputs.js +84 -5
- package/dist/embeddings/mock.js +1 -1
- package/dist/embeddings/models.js +39 -4
- package/dist/loaders/csv.d.ts +23 -1
- package/dist/loaders/csv.js +125 -72
- package/dist/loaders/index.d.ts +7 -2
- package/dist/loaders/input.d.ts +6 -0
- package/dist/loaders/input.js +42 -1
- package/dist/loaders/json.d.ts +14 -3
- package/dist/loaders/json.js +171 -20
- package/dist/loaders/web.d.ts +55 -0
- package/dist/loaders/web.js +20 -1
- package/dist/mcp/client.d.ts +54 -5
- package/dist/mcp/client.js +171 -20
- package/dist/mcp/http.d.ts +45 -0
- package/dist/mcp/http.js +233 -0
- package/dist/mcp/index.d.ts +4 -2
- package/dist/mcp/index.js +3 -1
- package/dist/mcp/protocol.d.ts +107 -0
- package/dist/mcp/sampling.d.ts +41 -0
- package/dist/mcp/sampling.js +52 -0
- package/dist/mcp/server.d.ts +96 -14
- package/dist/mcp/server.js +274 -59
- package/dist/models/data.js +20 -1
- package/dist/operations/adapters.d.ts +1 -0
- package/dist/operations/adapters.js +3 -1
- package/dist/protocols/a2a-grpc.js +10 -3
- package/dist/protocols/a2a-signing.d.ts +65 -0
- package/dist/protocols/a2a-signing.js +133 -0
- package/dist/protocols/a2a.d.ts +14 -0
- package/dist/protocols/a2a.js +60 -5
- package/dist/providers/cohere.js +16 -2
- package/dist/providers/google.js +7 -1
- package/dist/providers/ollama.d.ts +1 -1
- package/dist/providers/ollama.js +35 -27
- package/dist/providers/openai.js +19 -2
- package/dist/rag/pinecone.d.ts +63 -2
- package/dist/rag/pinecone.js +80 -0
- package/dist/realtime/conversation.js +18 -0
- package/dist/realtime/gemini-live.transport.d.ts +28 -3
- package/dist/realtime/gemini-live.transport.js +170 -32
- package/dist/realtime/session.d.ts +2 -0
- package/dist/realtime/session.js +19 -4
- package/dist/realtime/types.d.ts +35 -3
- package/dist/security/output-guard.js +4 -1
- package/dist/server/auth.d.ts +263 -2
- package/dist/server/auth.js +432 -5
- package/dist/server/deployments.d.ts +3 -2
- package/dist/server/deployments.js +6 -1
- package/dist/telephony/index.d.ts +1 -1
- package/dist/telephony/manager.d.ts +8 -1
- package/dist/telephony/manager.js +13 -0
- package/dist/telephony/providers/telnyx.d.ts +18 -5
- package/dist/telephony/providers/telnyx.js +44 -7
- package/dist/telephony/providers/twilio.d.ts +3 -1
- package/dist/telephony/providers/twilio.js +16 -0
- package/dist/tracing/stores.d.ts +2 -0
- package/dist/tracing/stores.js +1 -0
- package/dist/tracing/tracer.d.ts +5 -2
- package/dist/tracing/tracer.js +6 -3
- package/dist/types/embeddings.d.ts +47 -5
- package/dist/types/messages.d.ts +7 -0
- package/dist/types/principal.d.ts +1 -1
- package/dist/types/response.d.ts +5 -0
- package/dist/types/telephony.d.ts +38 -0
- package/dist/types/tracing.d.ts +6 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/voice/providers/google.d.ts +44 -0
- package/dist/voice/providers/google.js +215 -0
- package/dist-cjs/adapter-kit/gather.d.ts +76 -0
- package/dist-cjs/adapter-kit/gather.js +152 -0
- package/dist-cjs/adapter-kit/index.d.ts +1 -0
- package/dist-cjs/adapter-kit/index.js +4 -1
- package/dist-cjs/adapter-kit/record.d.ts +3 -1
- package/dist-cjs/adapter-kit/record.js +20 -5
- package/dist-cjs/agent/openapi.d.ts +94 -8
- package/dist-cjs/agent/openapi.js +530 -32
- package/dist-cjs/cli/adapters.d.ts +4 -3
- package/dist-cjs/cli/adapters.js +70 -1
- package/dist-cjs/cli/doctor.js +3 -0
- package/dist-cjs/core/config-builder.d.ts +1 -0
- package/dist-cjs/core/config-builder.js +5 -1
- package/dist-cjs/core/defaults.d.ts +34 -0
- package/dist-cjs/core/defaults.js +44 -0
- package/dist-cjs/core/secure-stream.js +4 -1
- package/dist-cjs/decisions/completion.d.ts +10 -7
- package/dist-cjs/decisions/completion.js +81 -7
- package/dist-cjs/decisions/core.d.ts +88 -43
- package/dist-cjs/decisions/core.js +134 -46
- package/dist-cjs/decisions/errors.d.ts +25 -0
- package/dist-cjs/decisions/errors.js +16 -0
- package/dist-cjs/decisions/index.d.ts +6 -5
- package/dist-cjs/decisions/index.js +5 -1
- package/dist-cjs/decisions/integrations.d.ts +14 -5
- package/dist-cjs/decisions/integrations.js +16 -1
- package/dist-cjs/decisions/mock.d.ts +5 -3
- package/dist-cjs/decisions/mock.js +4 -1
- package/dist-cjs/decisions/pictures.d.ts +43 -0
- package/dist-cjs/decisions/pictures.js +109 -0
- package/dist-cjs/decisions/typesafe.d.ts +33 -5
- package/dist-cjs/decisions/typesafe.js +126 -13
- package/dist-cjs/doctor/index.d.ts +6 -9
- package/dist-cjs/doctor/index.js +41 -0
- package/dist-cjs/embeddings/adapters.d.ts +1 -1
- package/dist-cjs/embeddings/adapters.js +3 -3
- package/dist-cjs/embeddings/batch-google.d.ts +27 -8
- package/dist-cjs/embeddings/batch-google.js +112 -36
- package/dist-cjs/embeddings/batch-mock.js +1 -1
- package/dist-cjs/embeddings/batch.js +9 -3
- package/dist-cjs/embeddings/engine.js +13 -12
- package/dist-cjs/embeddings/index.d.ts +1 -1
- package/dist-cjs/embeddings/inputs.d.ts +26 -3
- package/dist-cjs/embeddings/inputs.js +89 -5
- package/dist-cjs/embeddings/mock.js +1 -1
- package/dist-cjs/embeddings/models.js +39 -4
- package/dist-cjs/loaders/csv.d.ts +23 -1
- package/dist-cjs/loaders/csv.js +126 -71
- package/dist-cjs/loaders/index.d.ts +7 -2
- package/dist-cjs/loaders/input.d.ts +6 -0
- package/dist-cjs/loaders/input.js +43 -1
- package/dist-cjs/loaders/json.d.ts +14 -3
- package/dist-cjs/loaders/json.js +170 -19
- package/dist-cjs/loaders/web.d.ts +55 -0
- package/dist-cjs/loaders/web.js +21 -1
- package/dist-cjs/mcp/client.d.ts +54 -5
- package/dist-cjs/mcp/client.js +171 -20
- package/dist-cjs/mcp/http.d.ts +45 -0
- package/dist-cjs/mcp/http.js +236 -0
- package/dist-cjs/mcp/index.d.ts +4 -2
- package/dist-cjs/mcp/index.js +5 -1
- package/dist-cjs/mcp/protocol.d.ts +107 -0
- package/dist-cjs/mcp/sampling.d.ts +41 -0
- package/dist-cjs/mcp/sampling.js +55 -0
- package/dist-cjs/mcp/server.d.ts +96 -14
- package/dist-cjs/mcp/server.js +273 -58
- package/dist-cjs/models/data.js +20 -1
- package/dist-cjs/operations/adapters.d.ts +1 -0
- package/dist-cjs/operations/adapters.js +3 -1
- package/dist-cjs/protocols/a2a-grpc.js +10 -3
- package/dist-cjs/protocols/a2a-signing.d.ts +65 -0
- package/dist-cjs/protocols/a2a-signing.js +140 -0
- package/dist-cjs/protocols/a2a.d.ts +14 -0
- package/dist-cjs/protocols/a2a.js +65 -6
- package/dist-cjs/providers/cohere.js +16 -2
- package/dist-cjs/providers/google.js +7 -1
- package/dist-cjs/providers/ollama.d.ts +1 -1
- package/dist-cjs/providers/ollama.js +35 -27
- package/dist-cjs/providers/openai.js +19 -2
- package/dist-cjs/rag/pinecone.d.ts +63 -2
- package/dist-cjs/rag/pinecone.js +81 -0
- package/dist-cjs/realtime/conversation.js +18 -0
- package/dist-cjs/realtime/gemini-live.transport.d.ts +28 -3
- package/dist-cjs/realtime/gemini-live.transport.js +170 -32
- package/dist-cjs/realtime/session.d.ts +2 -0
- package/dist-cjs/realtime/session.js +19 -4
- package/dist-cjs/realtime/types.d.ts +35 -3
- package/dist-cjs/security/output-guard.js +4 -1
- package/dist-cjs/server/auth.d.ts +263 -2
- package/dist-cjs/server/auth.js +437 -5
- package/dist-cjs/server/deployments.d.ts +3 -2
- package/dist-cjs/server/deployments.js +6 -1
- package/dist-cjs/telephony/index.d.ts +1 -1
- package/dist-cjs/telephony/manager.d.ts +8 -1
- package/dist-cjs/telephony/manager.js +13 -0
- package/dist-cjs/telephony/providers/telnyx.d.ts +18 -5
- package/dist-cjs/telephony/providers/telnyx.js +44 -7
- package/dist-cjs/telephony/providers/twilio.d.ts +3 -1
- package/dist-cjs/telephony/providers/twilio.js +16 -0
- package/dist-cjs/tracing/stores.d.ts +2 -0
- package/dist-cjs/tracing/stores.js +1 -0
- package/dist-cjs/tracing/tracer.d.ts +5 -2
- package/dist-cjs/tracing/tracer.js +6 -3
- package/dist-cjs/types/embeddings.d.ts +47 -5
- package/dist-cjs/types/messages.d.ts +7 -0
- package/dist-cjs/types/principal.d.ts +1 -1
- package/dist-cjs/types/response.d.ts +5 -0
- package/dist-cjs/types/telephony.d.ts +38 -0
- package/dist-cjs/types/tracing.d.ts +6 -0
- package/dist-cjs/version.d.ts +1 -1
- package/dist-cjs/version.js +1 -1
- package/dist-cjs/voice/providers/google.d.ts +44 -0
- package/dist-cjs/voice/providers/google.js +252 -0
- package/llms.txt +1 -1
- package/package.json +17 -1
|
@@ -161,7 +161,7 @@ export function compatibilityPage(records, options = {}) {
|
|
|
161
161
|
record,
|
|
162
162
|
status,
|
|
163
163
|
cells: [
|
|
164
|
-
record.adapter.repository
|
|
164
|
+
record.adapter.repository && /^https?:\/\//i.test(record.adapter.repository)
|
|
165
165
|
? { text: record.adapter.name, href: record.adapter.repository }
|
|
166
166
|
: { text: record.adapter.name },
|
|
167
167
|
{ text: record.adapter.kind },
|
|
@@ -187,7 +187,8 @@ export function compatibilityPage(records, options = {}) {
|
|
|
187
187
|
const cell = (item) => item.href ? `<a href="${escapeHtml(item.href)}">${escapeHtml(item.text)}</a>` : escapeHtml(item.text);
|
|
188
188
|
return [
|
|
189
189
|
'<!doctype html>',
|
|
190
|
-
`<html lang="en"><head><meta charset="utf-8"><title>${escapeHtml(title)}</title
|
|
190
|
+
`<html lang="en"><head><meta charset="utf-8"><title>${escapeHtml(title)}</title>`,
|
|
191
|
+
`<style>${STATE_STYLE}</style></head><body>`,
|
|
191
192
|
`<h1>${escapeHtml(title)}</h1>`,
|
|
192
193
|
...(options.intro ? [`<p>${escapeHtml(options.intro)}</p>`] : []),
|
|
193
194
|
`<p>States are judged against nexus-ai-pro ${escapeHtml(nexusVersion)}.</p>`,
|
|
@@ -207,9 +208,11 @@ export function compatibilityPage(records, options = {}) {
|
|
|
207
208
|
'',
|
|
208
209
|
].join('\n');
|
|
209
210
|
}
|
|
211
|
+
const literal = (text) => oneLine(text).replace(/[|[\]*_`\\]/g, (char) => `\\${char}`);
|
|
210
212
|
const cell = (item) => {
|
|
211
|
-
const text = item.text
|
|
212
|
-
|
|
213
|
+
const text = literal(item.text);
|
|
214
|
+
const href = item.href?.replace(/[|\s()]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase().padStart(2, '0')}`);
|
|
215
|
+
return href ? `[${text}](${href})` : text;
|
|
213
216
|
};
|
|
214
217
|
return [
|
|
215
218
|
`# ${title}`,
|
|
@@ -221,7 +224,10 @@ export function compatibilityPage(records, options = {}) {
|
|
|
221
224
|
`| ${headers.map(() => '---').join(' | ')} |`,
|
|
222
225
|
...rows.map((row) => `| ${row.cells.map(cell).join(' | ')} |`),
|
|
223
226
|
...(notes.length > 0
|
|
224
|
-
? [
|
|
227
|
+
? [
|
|
228
|
+
'',
|
|
229
|
+
...notes.map((row) => `- **${literal(row.record.adapter.name)}**: ${row.status.reasons.map(literal).join('; ')}`),
|
|
230
|
+
]
|
|
225
231
|
: []),
|
|
226
232
|
'',
|
|
227
233
|
].join('\n');
|
|
@@ -240,6 +246,15 @@ function runtimeName() {
|
|
|
240
246
|
function isRecord(value) {
|
|
241
247
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
242
248
|
}
|
|
249
|
+
const STATE_STYLE = [
|
|
250
|
+
'tr[data-state="passing"] td{color:#1a7f37}',
|
|
251
|
+
'tr[data-state="failing"] td{color:#cf222e;font-weight:600}',
|
|
252
|
+
'tr[data-state="incompatible"] td{color:#9a6700}',
|
|
253
|
+
'tr[data-state="stale"] td{color:#57606a}',
|
|
254
|
+
].join('');
|
|
255
|
+
function oneLine(text) {
|
|
256
|
+
return text.replace(/\s+/g, ' ').trim();
|
|
257
|
+
}
|
|
243
258
|
function escapeHtml(text) {
|
|
244
259
|
return text.replace(/[&<>"']/g, (char) => `&#${char.charCodeAt(0)};`);
|
|
245
260
|
}
|
package/dist/agent/openapi.d.ts
CHANGED
|
@@ -44,6 +44,38 @@ export interface OpenApiOperation {
|
|
|
44
44
|
tags: string[];
|
|
45
45
|
/** What it does to the service, read from its method: `read` for GET, HEAD, OPTIONS, and TRACE, `destructive` for DELETE, and `write` for the rest. */
|
|
46
46
|
access: 'read' | 'write' | 'destructive';
|
|
47
|
+
/**
|
|
48
|
+
* The security it asks for, as the document writes it: alternatives, any one of which will do, each
|
|
49
|
+
* the schemes it needs at once with their scopes. Empty when it asks for none.
|
|
50
|
+
*/
|
|
51
|
+
security: Array<Record<string, string[]>>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A credential for one of the API's security schemes: the API key, bearer token, or access token as
|
|
55
|
+
* text or `{ token }`; `{ username, password }` for HTTP basic; or `{ clientId, clientSecret }` for an
|
|
56
|
+
* OAuth 2.0 client-credentials flow, whose token is fetched and kept until it expires.
|
|
57
|
+
*/
|
|
58
|
+
export type OpenApiCredential = string | {
|
|
59
|
+
token: string;
|
|
60
|
+
} | {
|
|
61
|
+
username: string;
|
|
62
|
+
password: string;
|
|
63
|
+
} | {
|
|
64
|
+
clientId: string;
|
|
65
|
+
clientSecret: string;
|
|
66
|
+
};
|
|
67
|
+
/** A request or callback the API sends to the application, which no tool calls: its name and the body it carries. */
|
|
68
|
+
export interface OpenApiWebhook {
|
|
69
|
+
/** The webhook's name, or the operation and callback it belongs to. */
|
|
70
|
+
name: string;
|
|
71
|
+
/** `webhook` for one of the document's webhooks, `callback` for an operation's callback. */
|
|
72
|
+
source: 'webhook' | 'callback';
|
|
73
|
+
/** The HTTP method it arrives with, in capitals. */
|
|
74
|
+
method: string;
|
|
75
|
+
/** For a callback, the expression that names where it is sent, such as `{$request.body#/callbackUrl}`. */
|
|
76
|
+
expression?: string;
|
|
77
|
+
/** The JSON Schema of the body it carries, when it carries JSON. */
|
|
78
|
+
body?: Record<string, unknown>;
|
|
47
79
|
}
|
|
48
80
|
/** What a tool's headers are chosen from: the operation, and the call's context. */
|
|
49
81
|
export interface OpenApiHeadersRequest {
|
|
@@ -79,6 +111,15 @@ export interface OpenApiToolsOptions {
|
|
|
79
111
|
maxResponseBytes?: number;
|
|
80
112
|
/** Replaces the global `fetch`. */
|
|
81
113
|
fetch?: typeof globalThis.fetch;
|
|
114
|
+
/**
|
|
115
|
+
* Credentials for the API's own security schemes, by the name the document gives each, or a
|
|
116
|
+
* function choosing one per call, such as by its tenant. Each call sends those its operation asks
|
|
117
|
+
* for: the first of its alternatives every scheme of which has a credential, as an API key in its
|
|
118
|
+
* header, query, or cookie, HTTP basic or bearer, or an OAuth 2.0 or OpenID Connect token. With
|
|
119
|
+
* credentials given, a call whose operation asks for schemes none of which has one fails before it
|
|
120
|
+
* is sent. They win over `headers`.
|
|
121
|
+
*/
|
|
122
|
+
credentials?: Readonly<Record<string, OpenApiCredential | ((request: OpenApiHeadersRequest) => OpenApiCredential | Promise<OpenApiCredential>)>>;
|
|
82
123
|
}
|
|
83
124
|
/** An API's operations as tools, with what each returns. */
|
|
84
125
|
export interface OpenApiTools {
|
|
@@ -92,19 +133,26 @@ export interface OpenApiTools {
|
|
|
92
133
|
operations: OpenApiOperation[];
|
|
93
134
|
/** The JSON Schema of what each tool returns, by name: its first success response's. Pass it to `emulatedTools()` as `results`. */
|
|
94
135
|
results: Record<string, Record<string, unknown>>;
|
|
95
|
-
/**
|
|
136
|
+
/**
|
|
137
|
+
* Operations that could not become tools, and why.
|
|
138
|
+
*
|
|
139
|
+
* @deprecated Every operation becomes a tool since 2.22, its body sent whatever its type, so this is
|
|
140
|
+
* always empty. It is removed in 3.0.
|
|
141
|
+
*/
|
|
96
142
|
skipped: Array<{
|
|
97
143
|
method: string;
|
|
98
144
|
path: string;
|
|
99
145
|
reason: string;
|
|
100
146
|
}>;
|
|
147
|
+
/** What the API sends the application, which no tool calls: its webhooks and its operations' callbacks. */
|
|
148
|
+
webhooks: OpenApiWebhook[];
|
|
101
149
|
}
|
|
102
150
|
/** Why an API could not be read into tools, or a call to it failed. */
|
|
103
151
|
export declare class OpenApiError extends Error {
|
|
104
152
|
/**
|
|
105
153
|
* `OPENAPI_INVALID` for a malformed document or call, `OPENAPI_UNSUPPORTED` for one these tools
|
|
106
|
-
* cannot read, such as Swagger 2
|
|
107
|
-
* for a call the API refused or did not answer.
|
|
154
|
+
* cannot read, such as Swagger 1.2 or a reference outside the document not bundled first, and
|
|
155
|
+
* `OPENAPI_REQUEST` for a call the API refused or did not answer.
|
|
108
156
|
*/
|
|
109
157
|
readonly code: 'OPENAPI_INVALID' | 'OPENAPI_UNSUPPORTED' | 'OPENAPI_REQUEST';
|
|
110
158
|
/** The HTTP status the API answered with, when it did. */
|
|
@@ -112,8 +160,8 @@ export declare class OpenApiError extends Error {
|
|
|
112
160
|
constructor(message: string,
|
|
113
161
|
/**
|
|
114
162
|
* `OPENAPI_INVALID` for a malformed document or call, `OPENAPI_UNSUPPORTED` for one these tools
|
|
115
|
-
* cannot read, such as Swagger 2
|
|
116
|
-
* for a call the API refused or did not answer.
|
|
163
|
+
* cannot read, such as Swagger 1.2 or a reference outside the document not bundled first, and
|
|
164
|
+
* `OPENAPI_REQUEST` for a call the API refused or did not answer.
|
|
117
165
|
*/
|
|
118
166
|
code: 'OPENAPI_INVALID' | 'OPENAPI_UNSUPPORTED' | 'OPENAPI_REQUEST',
|
|
119
167
|
/** The HTTP status the API answered with, when it did. */
|
|
@@ -124,7 +172,10 @@ export declare class OpenApiError extends Error {
|
|
|
124
172
|
* method and path; described by its summary; its path, query, and header parameters, and the fields
|
|
125
173
|
* of a JSON body, as the tool's parameters. Each declares `api.read`, `api.write`, or
|
|
126
174
|
* `api.destructive` with the API's name and its own, as its method says, and `network` for the
|
|
127
|
-
* API's host when it runs. References within the document are followed; one outside it is refused
|
|
175
|
+
* API's host when it runs. References within the document are followed; one outside it is refused
|
|
176
|
+
* here, and followed by `loadOpenApiTools()` or `bundleOpenApiDocument()`. A Swagger 2.0 document is
|
|
177
|
+
* read as the OpenAPI 3 document it describes. Each call sends the credentials its operation's
|
|
178
|
+
* security asks for, from `credentials`.
|
|
128
179
|
*
|
|
129
180
|
* ```ts
|
|
130
181
|
* const shop = openApiTools(JSON.parse(await readFile('shop.openapi.json', 'utf8')), {
|
|
@@ -135,5 +186,40 @@ export declare class OpenApiError extends Error {
|
|
|
135
186
|
* ```
|
|
136
187
|
*/
|
|
137
188
|
export declare function openApiTools(document: OpenApiDocument | string, options?: OpenApiToolsOptions): OpenApiTools;
|
|
138
|
-
/**
|
|
139
|
-
|
|
189
|
+
/**
|
|
190
|
+
* Fetches an OpenAPI document, as JSON, and reads it into tools, resolving its servers against where
|
|
191
|
+
* it came from, and following its references to other documents on the same origin, or as
|
|
192
|
+
* `references` allows.
|
|
193
|
+
*/
|
|
194
|
+
export declare function loadOpenApiTools(url: string, options?: OpenApiToolsOptions & Pick<OpenApiBundleOptions, 'references' | 'maxDocuments' | 'maxBytes'>): Promise<OpenApiTools>;
|
|
195
|
+
/**
|
|
196
|
+
* A Swagger 2.0 document as the OpenAPI 3.0 document it describes: its host, base path, and schemes
|
|
197
|
+
* as a server; its definitions, parameters, responses, and security definitions as components; a
|
|
198
|
+
* body parameter, and form data, as a request body of what it consumes; and each response's schema as
|
|
199
|
+
* content of what it produces. Every reference is moved with what it names.
|
|
200
|
+
*/
|
|
201
|
+
export declare function swaggerToOpenApi(swagger: Record<string, unknown>): OpenApiDocument;
|
|
202
|
+
/** Options for `bundleOpenApiDocument()`. */
|
|
203
|
+
export interface OpenApiBundleOptions {
|
|
204
|
+
/** Where the document came from: references outside it are read relative to it. */
|
|
205
|
+
documentUrl: string;
|
|
206
|
+
/**
|
|
207
|
+
* Which documents a reference may name: `same-origin`, the default, only those on the document's
|
|
208
|
+
* own origin; `any`, any HTTP or HTTPS URL; or a function deciding each. A document never makes the
|
|
209
|
+
* tools fetch where it was not allowed to.
|
|
210
|
+
*/
|
|
211
|
+
references?: 'same-origin' | 'any' | ((url: string) => boolean);
|
|
212
|
+
/** The most documents read, the first included. Defaults to 50. */
|
|
213
|
+
maxDocuments?: number;
|
|
214
|
+
/** The largest document read, the first included, in bytes. Defaults to 5 MB. */
|
|
215
|
+
maxBytes?: number;
|
|
216
|
+
/** Replaces the global `fetch`. */
|
|
217
|
+
fetch?: typeof globalThis.fetch;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The document with every reference outside it read in its place: each other document fetched, as
|
|
221
|
+
* JSON, relative to the one that names it, its own references followed the same way, and a reference
|
|
222
|
+
* back to one still being read left as a description. `loadOpenApiTools()` does this before reading the
|
|
223
|
+
* document into tools.
|
|
224
|
+
*/
|
|
225
|
+
export declare function bundleOpenApiDocument(document: OpenApiDocument, options: OpenApiBundleOptions): Promise<OpenApiDocument>;
|