@mutagent/sdk 0.2.29 → 0.2.33
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/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/jsr.json +1 -1
- package/package.json +2 -3
- package/scripts/fix-openapi.ts +138 -18
- package/src/lib/config.ts +2 -2
- package/examples/node_modules/.package-lock.json +0 -174
- package/examples/node_modules/@esbuild/darwin-arm64/package.json +0 -20
- package/examples/node_modules/@types/node/assert/strict.d.ts +0 -8
- package/examples/node_modules/@types/node/assert.d.ts +0 -1062
- package/examples/node_modules/@types/node/async_hooks.d.ts +0 -605
- package/examples/node_modules/@types/node/buffer.buffer.d.ts +0 -471
- package/examples/node_modules/@types/node/buffer.d.ts +0 -1936
- package/examples/node_modules/@types/node/child_process.d.ts +0 -1475
- package/examples/node_modules/@types/node/cluster.d.ts +0 -577
- package/examples/node_modules/@types/node/compatibility/disposable.d.ts +0 -16
- package/examples/node_modules/@types/node/compatibility/index.d.ts +0 -9
- package/examples/node_modules/@types/node/compatibility/indexable.d.ts +0 -20
- package/examples/node_modules/@types/node/compatibility/iterators.d.ts +0 -21
- package/examples/node_modules/@types/node/console.d.ts +0 -452
- package/examples/node_modules/@types/node/constants.d.ts +0 -21
- package/examples/node_modules/@types/node/crypto.d.ts +0 -4590
- package/examples/node_modules/@types/node/dgram.d.ts +0 -597
- package/examples/node_modules/@types/node/diagnostics_channel.d.ts +0 -578
- package/examples/node_modules/@types/node/dns/promises.d.ts +0 -479
- package/examples/node_modules/@types/node/dns.d.ts +0 -871
- package/examples/node_modules/@types/node/domain.d.ts +0 -170
- package/examples/node_modules/@types/node/events.d.ts +0 -977
- package/examples/node_modules/@types/node/fs/promises.d.ts +0 -1270
- package/examples/node_modules/@types/node/fs.d.ts +0 -4375
- package/examples/node_modules/@types/node/globals.d.ts +0 -172
- package/examples/node_modules/@types/node/globals.typedarray.d.ts +0 -38
- package/examples/node_modules/@types/node/http.d.ts +0 -2049
- package/examples/node_modules/@types/node/http2.d.ts +0 -2631
- package/examples/node_modules/@types/node/https.d.ts +0 -578
- package/examples/node_modules/@types/node/index.d.ts +0 -93
- package/examples/node_modules/@types/node/inspector.generated.d.ts +0 -3966
- package/examples/node_modules/@types/node/module.d.ts +0 -539
- package/examples/node_modules/@types/node/net.d.ts +0 -1012
- package/examples/node_modules/@types/node/os.d.ts +0 -506
- package/examples/node_modules/@types/node/package.json +0 -140
- package/examples/node_modules/@types/node/path.d.ts +0 -200
- package/examples/node_modules/@types/node/perf_hooks.d.ts +0 -961
- package/examples/node_modules/@types/node/process.d.ts +0 -1966
- package/examples/node_modules/@types/node/punycode.d.ts +0 -117
- package/examples/node_modules/@types/node/querystring.d.ts +0 -152
- package/examples/node_modules/@types/node/readline/promises.d.ts +0 -162
- package/examples/node_modules/@types/node/readline.d.ts +0 -589
- package/examples/node_modules/@types/node/repl.d.ts +0 -430
- package/examples/node_modules/@types/node/sea.d.ts +0 -153
- package/examples/node_modules/@types/node/stream/consumers.d.ts +0 -38
- package/examples/node_modules/@types/node/stream/promises.d.ts +0 -90
- package/examples/node_modules/@types/node/stream/web.d.ts +0 -533
- package/examples/node_modules/@types/node/stream.d.ts +0 -1675
- package/examples/node_modules/@types/node/string_decoder.d.ts +0 -67
- package/examples/node_modules/@types/node/test.d.ts +0 -1787
- package/examples/node_modules/@types/node/timers/promises.d.ts +0 -108
- package/examples/node_modules/@types/node/timers.d.ts +0 -286
- package/examples/node_modules/@types/node/tls.d.ts +0 -1259
- package/examples/node_modules/@types/node/trace_events.d.ts +0 -197
- package/examples/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +0 -468
- package/examples/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -34
- package/examples/node_modules/@types/node/ts5.6/index.d.ts +0 -93
- package/examples/node_modules/@types/node/tty.d.ts +0 -208
- package/examples/node_modules/@types/node/url.d.ts +0 -964
- package/examples/node_modules/@types/node/util.d.ts +0 -2331
- package/examples/node_modules/@types/node/v8.d.ts +0 -809
- package/examples/node_modules/@types/node/vm.d.ts +0 -1001
- package/examples/node_modules/@types/node/wasi.d.ts +0 -181
- package/examples/node_modules/@types/node/web-globals/abortcontroller.d.ts +0 -34
- package/examples/node_modules/@types/node/web-globals/domexception.d.ts +0 -68
- package/examples/node_modules/@types/node/web-globals/events.d.ts +0 -97
- package/examples/node_modules/@types/node/web-globals/fetch.d.ts +0 -46
- package/examples/node_modules/@types/node/worker_threads.d.ts +0 -715
- package/examples/node_modules/@types/node/zlib.d.ts +0 -540
- package/examples/node_modules/dotenv/config.d.ts +0 -1
- package/examples/node_modules/dotenv/config.js +0 -9
- package/examples/node_modules/dotenv/lib/cli-options.js +0 -17
- package/examples/node_modules/dotenv/lib/env-options.js +0 -28
- package/examples/node_modules/dotenv/lib/main.d.ts +0 -162
- package/examples/node_modules/dotenv/lib/main.js +0 -386
- package/examples/node_modules/dotenv/package.json +0 -62
- package/examples/node_modules/esbuild/install.js +0 -289
- package/examples/node_modules/esbuild/lib/main.d.ts +0 -716
- package/examples/node_modules/esbuild/lib/main.js +0 -2242
- package/examples/node_modules/esbuild/package.json +0 -49
- package/examples/node_modules/fsevents/fsevents.d.ts +0 -46
- package/examples/node_modules/fsevents/fsevents.js +0 -83
- package/examples/node_modules/fsevents/package.json +0 -62
- package/examples/node_modules/get-tsconfig/dist/index.mjs +0 -7
- package/examples/node_modules/get-tsconfig/package.json +0 -46
- package/examples/node_modules/resolve-pkg-maps/dist/index.mjs +0 -1
- package/examples/node_modules/resolve-pkg-maps/package.json +0 -42
- package/examples/node_modules/tsx/dist/cjs/api/index.mjs +0 -1
- package/examples/node_modules/tsx/dist/cjs/index.mjs +0 -1
- package/examples/node_modules/tsx/dist/cli.mjs +0 -55
- package/examples/node_modules/tsx/dist/client-BQVF1NaW.mjs +0 -1
- package/examples/node_modules/tsx/dist/esm/api/index.mjs +0 -1
- package/examples/node_modules/tsx/dist/esm/index.mjs +0 -2
- package/examples/node_modules/tsx/dist/get-pipe-path-BHW2eJdv.mjs +0 -1
- package/examples/node_modules/tsx/dist/index-7AaEi15b.mjs +0 -14
- package/examples/node_modules/tsx/dist/index-gbaejti9.mjs +0 -1
- package/examples/node_modules/tsx/dist/lexer-DQCqS3nf.mjs +0 -3
- package/examples/node_modules/tsx/dist/loader.mjs +0 -1
- package/examples/node_modules/tsx/dist/node-features-_8ZFwP_x.mjs +0 -1
- package/examples/node_modules/tsx/dist/package-CeBgXWuR.mjs +0 -1
- package/examples/node_modules/tsx/dist/patch-repl.mjs +0 -1
- package/examples/node_modules/tsx/dist/preflight.mjs +0 -1
- package/examples/node_modules/tsx/dist/register-B7jrtLTO.mjs +0 -1
- package/examples/node_modules/tsx/dist/register-CFH5oNdT.mjs +0 -4
- package/examples/node_modules/tsx/dist/repl.mjs +0 -3
- package/examples/node_modules/tsx/dist/require-DQxpCAr4.mjs +0 -1
- package/examples/node_modules/tsx/dist/suppress-warnings.mjs +0 -1
- package/examples/node_modules/tsx/dist/temporary-directory-CwHp0_NW.mjs +0 -1
- package/examples/node_modules/tsx/dist/types-Cxp8y2TL.d.ts +0 -5
- package/examples/node_modules/tsx/package.json +0 -68
- package/examples/node_modules/undici-types/agent.d.ts +0 -31
- package/examples/node_modules/undici-types/api.d.ts +0 -43
- package/examples/node_modules/undici-types/balanced-pool.d.ts +0 -29
- package/examples/node_modules/undici-types/cache.d.ts +0 -36
- package/examples/node_modules/undici-types/client.d.ts +0 -108
- package/examples/node_modules/undici-types/connector.d.ts +0 -34
- package/examples/node_modules/undici-types/content-type.d.ts +0 -21
- package/examples/node_modules/undici-types/cookies.d.ts +0 -28
- package/examples/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
- package/examples/node_modules/undici-types/dispatcher.d.ts +0 -256
- package/examples/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
- package/examples/node_modules/undici-types/errors.d.ts +0 -149
- package/examples/node_modules/undici-types/eventsource.d.ts +0 -61
- package/examples/node_modules/undici-types/fetch.d.ts +0 -209
- package/examples/node_modules/undici-types/file.d.ts +0 -39
- package/examples/node_modules/undici-types/filereader.d.ts +0 -54
- package/examples/node_modules/undici-types/formdata.d.ts +0 -108
- package/examples/node_modules/undici-types/global-dispatcher.d.ts +0 -9
- package/examples/node_modules/undici-types/global-origin.d.ts +0 -7
- package/examples/node_modules/undici-types/handlers.d.ts +0 -15
- package/examples/node_modules/undici-types/header.d.ts +0 -4
- package/examples/node_modules/undici-types/index.d.ts +0 -71
- package/examples/node_modules/undici-types/interceptors.d.ts +0 -17
- package/examples/node_modules/undici-types/mock-agent.d.ts +0 -50
- package/examples/node_modules/undici-types/mock-client.d.ts +0 -25
- package/examples/node_modules/undici-types/mock-errors.d.ts +0 -12
- package/examples/node_modules/undici-types/mock-interceptor.d.ts +0 -93
- package/examples/node_modules/undici-types/mock-pool.d.ts +0 -25
- package/examples/node_modules/undici-types/package.json +0 -55
- package/examples/node_modules/undici-types/patch.d.ts +0 -33
- package/examples/node_modules/undici-types/pool-stats.d.ts +0 -19
- package/examples/node_modules/undici-types/pool.d.ts +0 -39
- package/examples/node_modules/undici-types/proxy-agent.d.ts +0 -28
- package/examples/node_modules/undici-types/readable.d.ts +0 -65
- package/examples/node_modules/undici-types/retry-agent.d.ts +0 -8
- package/examples/node_modules/undici-types/retry-handler.d.ts +0 -116
- package/examples/node_modules/undici-types/util.d.ts +0 -18
- package/examples/node_modules/undici-types/webidl.d.ts +0 -228
- package/examples/node_modules/undici-types/websocket.d.ts +0 -150
|
@@ -35,8 +35,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
35
35
|
export declare const SDK_METADATA: {
|
|
36
36
|
readonly language: "typescript";
|
|
37
37
|
readonly openapiDocVersion: "2.0.0";
|
|
38
|
-
readonly sdkVersion: "0.2.
|
|
38
|
+
readonly sdkVersion: "0.2.33";
|
|
39
39
|
readonly genVersion: "2.814.0";
|
|
40
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.2.
|
|
40
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.2.33 2.814.0 2.0.0 @mutagent/sdk";
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -31,8 +31,8 @@ function serverURLFromOptions(options) {
|
|
|
31
31
|
exports.SDK_METADATA = {
|
|
32
32
|
language: "typescript",
|
|
33
33
|
openapiDocVersion: "2.0.0",
|
|
34
|
-
sdkVersion: "0.2.
|
|
34
|
+
sdkVersion: "0.2.33",
|
|
35
35
|
genVersion: "2.814.0",
|
|
36
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
36
|
+
userAgent: "speakeasy-sdk/typescript 0.2.33 2.814.0 2.0.0 @mutagent/sdk",
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=config.js.map
|
package/dist/esm/lib/config.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
35
35
|
export declare const SDK_METADATA: {
|
|
36
36
|
readonly language: "typescript";
|
|
37
37
|
readonly openapiDocVersion: "2.0.0";
|
|
38
|
-
readonly sdkVersion: "0.2.
|
|
38
|
+
readonly sdkVersion: "0.2.33";
|
|
39
39
|
readonly genVersion: "2.814.0";
|
|
40
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.2.
|
|
40
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.2.33 2.814.0 2.0.0 @mutagent/sdk";
|
|
41
41
|
};
|
|
42
42
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/esm/lib/config.js
CHANGED
|
@@ -27,8 +27,8 @@ export function serverURLFromOptions(options) {
|
|
|
27
27
|
export const SDK_METADATA = {
|
|
28
28
|
language: "typescript",
|
|
29
29
|
openapiDocVersion: "2.0.0",
|
|
30
|
-
sdkVersion: "0.2.
|
|
30
|
+
sdkVersion: "0.2.33",
|
|
31
31
|
genVersion: "2.814.0",
|
|
32
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
32
|
+
userAgent: "speakeasy-sdk/typescript 0.2.33 2.814.0 2.0.0 @mutagent/sdk",
|
|
33
33
|
};
|
|
34
34
|
//# sourceMappingURL=config.js.map
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutagent/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.33",
|
|
4
4
|
"author": "Speakeasy",
|
|
5
5
|
"tshy": {
|
|
6
6
|
"sourceDialects": [
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/architech-printworks/mutagent-monorepo.git"
|
|
26
|
-
"directory": "mutagent-sdk"
|
|
25
|
+
"url": "https://github.com/architech-printworks/mutagent-monorepo.git"
|
|
27
26
|
},
|
|
28
27
|
"scripts": {
|
|
29
28
|
"lint": "eslint --cache --max-warnings=0 src",
|
package/scripts/fix-openapi.ts
CHANGED
|
@@ -106,43 +106,159 @@ function removeWebsocketPaths(spec: OpenAPISpec): string[] {
|
|
|
106
106
|
// MISSING RESPONSE HANDLING
|
|
107
107
|
// =============================================================================
|
|
108
108
|
|
|
109
|
-
function addMissingResponses(spec: OpenAPISpec): number {
|
|
109
|
+
function addMissingResponses(spec: OpenAPISpec): { noResponseCount: number; noSuccessCount: number } {
|
|
110
110
|
/**
|
|
111
111
|
* Add default responses to operations missing them.
|
|
112
112
|
*
|
|
113
|
-
* Problem: Some Elysia routes don't have response schemas defined,
|
|
113
|
+
* Problem 1: Some Elysia routes don't have any response schemas defined,
|
|
114
114
|
* which is required by OpenAPI spec.
|
|
115
115
|
*
|
|
116
|
-
*
|
|
116
|
+
* Problem 2: SSE/streaming endpoints may have error responses from
|
|
117
|
+
* detail.responses but no 2xx success response, which Speakeasy flags as
|
|
118
|
+
* `style-operation-success-response`.
|
|
119
|
+
*
|
|
120
|
+
* Solution: Add a generic 200 response where needed.
|
|
117
121
|
*/
|
|
118
|
-
const
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"type": "object"
|
|
125
|
-
}
|
|
122
|
+
const defaultSuccessResponse = {
|
|
123
|
+
"description": "Successful response",
|
|
124
|
+
"content": {
|
|
125
|
+
"application/json": {
|
|
126
|
+
"schema": {
|
|
127
|
+
"type": "object"
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
}
|
|
129
131
|
};
|
|
130
132
|
|
|
131
|
-
let
|
|
132
|
-
|
|
133
|
+
let noResponseCount = 0;
|
|
134
|
+
let noSuccessCount = 0;
|
|
135
|
+
if (!spec.paths) return { noResponseCount, noSuccessCount };
|
|
133
136
|
|
|
134
137
|
for (const [path, methods] of Object.entries(spec.paths)) {
|
|
135
138
|
for (const [method, operation] of Object.entries(methods)) {
|
|
136
139
|
if (['get', 'post', 'put', 'patch', 'delete'].includes(method)) {
|
|
137
140
|
if (!operation.responses || Object.keys(operation.responses).length === 0) {
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
// No responses at all - add default 200
|
|
142
|
+
operation.responses = { "200": JSON.parse(JSON.stringify(defaultSuccessResponse)) };
|
|
143
|
+
noResponseCount++;
|
|
144
|
+
} else {
|
|
145
|
+
// Has responses but check if missing any 2xx/3xx
|
|
146
|
+
const codes = Object.keys(operation.responses);
|
|
147
|
+
const hasSuccess = codes.some(c => {
|
|
148
|
+
const num = Number(c);
|
|
149
|
+
return num >= 200 && num < 400;
|
|
150
|
+
});
|
|
151
|
+
if (!hasSuccess) {
|
|
152
|
+
// Has only error responses (e.g., SSE/streaming endpoints) - add 200
|
|
153
|
+
operation.responses["200"] = JSON.parse(JSON.stringify(defaultSuccessResponse));
|
|
154
|
+
noSuccessCount++;
|
|
155
|
+
}
|
|
140
156
|
}
|
|
141
157
|
}
|
|
142
158
|
}
|
|
143
159
|
}
|
|
144
160
|
|
|
145
|
-
return
|
|
161
|
+
return { noResponseCount, noSuccessCount };
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// =============================================================================
|
|
165
|
+
// INJECT STANDARD ERROR RESPONSES
|
|
166
|
+
// =============================================================================
|
|
167
|
+
|
|
168
|
+
function injectStandardErrorResponses(spec: OpenAPISpec): { getCount: number; mutationCount: number } {
|
|
169
|
+
/**
|
|
170
|
+
* Inject standard error responses (4xx/5xx) for operations missing them.
|
|
171
|
+
*
|
|
172
|
+
* Problem: Elysia's `detail.responses` (standardErrorResponses / standardMutationErrorResponses)
|
|
173
|
+
* are NOT merged into the generated OpenAPI spec when the route uses a shorthand
|
|
174
|
+
* `response: 'SomeModel'` instead of explicit per-status-code response mapping.
|
|
175
|
+
* This means routes that define `detail: { responses: standardErrorResponses }` in
|
|
176
|
+
* their route config still only produce a 200 response in the OpenAPI output.
|
|
177
|
+
* Speakeasy flags these as `generator-missing-error-response` hints.
|
|
178
|
+
*
|
|
179
|
+
* Solution: For each operation that only has 2xx responses, inject the standard
|
|
180
|
+
* error response schemas based on the HTTP method:
|
|
181
|
+
* - GET/HEAD: 400, 401, 403, 404, 500 (standardErrorResponses)
|
|
182
|
+
* - POST/PATCH/PUT/DELETE: 400, 401, 403, 404, 409, 500 (standardMutationErrorResponses)
|
|
183
|
+
*
|
|
184
|
+
* These match the exact schemas defined in mutagent/src/shared/error-responses.ts.
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
const errorSchema = {
|
|
188
|
+
type: 'object',
|
|
189
|
+
properties: {
|
|
190
|
+
error: { type: 'string' },
|
|
191
|
+
message: { type: 'string' },
|
|
192
|
+
},
|
|
193
|
+
required: ['error', 'message'],
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const errorWithStatusSchema = {
|
|
197
|
+
type: 'object',
|
|
198
|
+
properties: {
|
|
199
|
+
error: { type: 'string' },
|
|
200
|
+
message: { type: 'string' },
|
|
201
|
+
statusCode: { type: 'number' },
|
|
202
|
+
},
|
|
203
|
+
required: ['error', 'message', 'statusCode'],
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const makeErrorResponse = (description: string, schema: AnyValue) => ({
|
|
207
|
+
description,
|
|
208
|
+
content: { 'application/json': { schema: JSON.parse(JSON.stringify(schema)) } },
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
// Standard error responses for GET routes
|
|
212
|
+
const standardErrors: Record<string, AnyValue> = {
|
|
213
|
+
'400': makeErrorResponse('Bad Request', errorSchema),
|
|
214
|
+
'401': makeErrorResponse('Unauthorized', errorSchema),
|
|
215
|
+
'403': makeErrorResponse('Forbidden', errorSchema),
|
|
216
|
+
'404': makeErrorResponse('Not Found', errorSchema),
|
|
217
|
+
'500': makeErrorResponse('Internal Server Error', errorWithStatusSchema),
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Mutation error responses add 409 Conflict
|
|
221
|
+
const mutationErrors: Record<string, AnyValue> = {
|
|
222
|
+
...standardErrors,
|
|
223
|
+
'409': makeErrorResponse('Conflict', errorWithStatusSchema),
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
let getCount = 0;
|
|
227
|
+
let mutationCount = 0;
|
|
228
|
+
|
|
229
|
+
if (!spec.paths) return { getCount, mutationCount };
|
|
230
|
+
|
|
231
|
+
for (const [_path, methods] of Object.entries(spec.paths)) {
|
|
232
|
+
for (const [method, operation] of Object.entries(methods)) {
|
|
233
|
+
if (!['get', 'post', 'put', 'patch', 'delete', 'head'].includes(method)) continue;
|
|
234
|
+
if (!operation.responses) continue;
|
|
235
|
+
|
|
236
|
+
const responseCodes = Object.keys(operation.responses);
|
|
237
|
+
const hasErrorResponse = responseCodes.some(code => Number(code) >= 400);
|
|
238
|
+
|
|
239
|
+
// Skip if already has error responses
|
|
240
|
+
if (hasErrorResponse) continue;
|
|
241
|
+
|
|
242
|
+
// Determine which error set to use based on HTTP method
|
|
243
|
+
const isMutation = ['post', 'put', 'patch', 'delete'].includes(method);
|
|
244
|
+
const errorsToInject = isMutation ? mutationErrors : standardErrors;
|
|
245
|
+
|
|
246
|
+
// Inject error responses
|
|
247
|
+
for (const [code, response] of Object.entries(errorsToInject)) {
|
|
248
|
+
if (!operation.responses[code]) {
|
|
249
|
+
operation.responses[code] = JSON.parse(JSON.stringify(response));
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (isMutation) {
|
|
254
|
+
mutationCount++;
|
|
255
|
+
} else {
|
|
256
|
+
getCount++;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return { getCount, mutationCount };
|
|
146
262
|
}
|
|
147
263
|
|
|
148
264
|
// =============================================================================
|
|
@@ -925,8 +1041,12 @@ async function main() {
|
|
|
925
1041
|
console.log(` Removed ${wsPaths.length} WebSocket paths: ${JSON.stringify(wsPaths)}`);
|
|
926
1042
|
|
|
927
1043
|
console.log("3. Adding missing responses...");
|
|
928
|
-
const
|
|
929
|
-
console.log(` Added
|
|
1044
|
+
const responseResult = addMissingResponses(spec);
|
|
1045
|
+
console.log(` Added default 200 to ${responseResult.noResponseCount} operations with no responses, ${responseResult.noSuccessCount} operations missing 2xx success`);
|
|
1046
|
+
|
|
1047
|
+
console.log("3b. Injecting standard error responses...");
|
|
1048
|
+
const errorResponseResult = injectStandardErrorResponses(spec);
|
|
1049
|
+
console.log(` Injected error responses: ${errorResponseResult.getCount} GET, ${errorResponseResult.mutationCount} mutation operations`);
|
|
930
1050
|
|
|
931
1051
|
console.log("4. Removing patternProperties...");
|
|
932
1052
|
spec = removePatternProperties(spec);
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "2.0.0",
|
|
68
|
-
sdkVersion: "0.2.
|
|
68
|
+
sdkVersion: "0.2.33",
|
|
69
69
|
genVersion: "2.814.0",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.2.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.2.33 2.814.0 2.0.0 @mutagent/sdk",
|
|
71
71
|
} as const;
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@mutagent/sdk-examples",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"..": {
|
|
8
|
-
"name": "@mutagent/sdk",
|
|
9
|
-
"version": "0.1.1",
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"zod": "^3.25.65 || ^4.0.0"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"@eslint/js": "^9.26.0",
|
|
15
|
-
"eslint": "^9.26.0",
|
|
16
|
-
"globals": "^15.14.0",
|
|
17
|
-
"tshy": "^2.0.0",
|
|
18
|
-
"typescript": "~5.8.3",
|
|
19
|
-
"typescript-eslint": "^8.26.0"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"node_modules/@esbuild/darwin-arm64": {
|
|
23
|
-
"version": "0.27.2",
|
|
24
|
-
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz",
|
|
25
|
-
"integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==",
|
|
26
|
-
"cpu": [
|
|
27
|
-
"arm64"
|
|
28
|
-
],
|
|
29
|
-
"dev": true,
|
|
30
|
-
"license": "MIT",
|
|
31
|
-
"optional": true,
|
|
32
|
-
"os": [
|
|
33
|
-
"darwin"
|
|
34
|
-
],
|
|
35
|
-
"engines": {
|
|
36
|
-
"node": ">=18"
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"node_modules/@mutagent/sdk": {
|
|
40
|
-
"resolved": "..",
|
|
41
|
-
"link": true
|
|
42
|
-
},
|
|
43
|
-
"node_modules/@types/node": {
|
|
44
|
-
"version": "20.19.31",
|
|
45
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.31.tgz",
|
|
46
|
-
"integrity": "sha512-5jsi0wpncvTD33Sh1UCgacK37FFwDn+EG7wCmEvs62fCvBL+n8/76cAYDok21NF6+jaVWIqKwCZyX7Vbu8eB3A==",
|
|
47
|
-
"dev": true,
|
|
48
|
-
"license": "MIT",
|
|
49
|
-
"dependencies": {
|
|
50
|
-
"undici-types": "~6.21.0"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"node_modules/dotenv": {
|
|
54
|
-
"version": "16.6.1",
|
|
55
|
-
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
|
|
56
|
-
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
|
|
57
|
-
"dev": true,
|
|
58
|
-
"license": "BSD-2-Clause",
|
|
59
|
-
"engines": {
|
|
60
|
-
"node": ">=12"
|
|
61
|
-
},
|
|
62
|
-
"funding": {
|
|
63
|
-
"url": "https://dotenvx.com"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"node_modules/esbuild": {
|
|
67
|
-
"version": "0.27.2",
|
|
68
|
-
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz",
|
|
69
|
-
"integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==",
|
|
70
|
-
"dev": true,
|
|
71
|
-
"hasInstallScript": true,
|
|
72
|
-
"license": "MIT",
|
|
73
|
-
"bin": {
|
|
74
|
-
"esbuild": "bin/esbuild"
|
|
75
|
-
},
|
|
76
|
-
"engines": {
|
|
77
|
-
"node": ">=18"
|
|
78
|
-
},
|
|
79
|
-
"optionalDependencies": {
|
|
80
|
-
"@esbuild/aix-ppc64": "0.27.2",
|
|
81
|
-
"@esbuild/android-arm": "0.27.2",
|
|
82
|
-
"@esbuild/android-arm64": "0.27.2",
|
|
83
|
-
"@esbuild/android-x64": "0.27.2",
|
|
84
|
-
"@esbuild/darwin-arm64": "0.27.2",
|
|
85
|
-
"@esbuild/darwin-x64": "0.27.2",
|
|
86
|
-
"@esbuild/freebsd-arm64": "0.27.2",
|
|
87
|
-
"@esbuild/freebsd-x64": "0.27.2",
|
|
88
|
-
"@esbuild/linux-arm": "0.27.2",
|
|
89
|
-
"@esbuild/linux-arm64": "0.27.2",
|
|
90
|
-
"@esbuild/linux-ia32": "0.27.2",
|
|
91
|
-
"@esbuild/linux-loong64": "0.27.2",
|
|
92
|
-
"@esbuild/linux-mips64el": "0.27.2",
|
|
93
|
-
"@esbuild/linux-ppc64": "0.27.2",
|
|
94
|
-
"@esbuild/linux-riscv64": "0.27.2",
|
|
95
|
-
"@esbuild/linux-s390x": "0.27.2",
|
|
96
|
-
"@esbuild/linux-x64": "0.27.2",
|
|
97
|
-
"@esbuild/netbsd-arm64": "0.27.2",
|
|
98
|
-
"@esbuild/netbsd-x64": "0.27.2",
|
|
99
|
-
"@esbuild/openbsd-arm64": "0.27.2",
|
|
100
|
-
"@esbuild/openbsd-x64": "0.27.2",
|
|
101
|
-
"@esbuild/openharmony-arm64": "0.27.2",
|
|
102
|
-
"@esbuild/sunos-x64": "0.27.2",
|
|
103
|
-
"@esbuild/win32-arm64": "0.27.2",
|
|
104
|
-
"@esbuild/win32-ia32": "0.27.2",
|
|
105
|
-
"@esbuild/win32-x64": "0.27.2"
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"node_modules/fsevents": {
|
|
109
|
-
"version": "2.3.3",
|
|
110
|
-
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
|
111
|
-
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
|
112
|
-
"dev": true,
|
|
113
|
-
"hasInstallScript": true,
|
|
114
|
-
"license": "MIT",
|
|
115
|
-
"optional": true,
|
|
116
|
-
"os": [
|
|
117
|
-
"darwin"
|
|
118
|
-
],
|
|
119
|
-
"engines": {
|
|
120
|
-
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"node_modules/get-tsconfig": {
|
|
124
|
-
"version": "4.13.1",
|
|
125
|
-
"resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.1.tgz",
|
|
126
|
-
"integrity": "sha512-EoY1N2xCn44xU6750Sx7OjOIT59FkmstNc3X6y5xpz7D5cBtZRe/3pSlTkDJgqsOk3WwZPkWfonhhUJfttQo3w==",
|
|
127
|
-
"dev": true,
|
|
128
|
-
"license": "MIT",
|
|
129
|
-
"dependencies": {
|
|
130
|
-
"resolve-pkg-maps": "^1.0.0"
|
|
131
|
-
},
|
|
132
|
-
"funding": {
|
|
133
|
-
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
"node_modules/resolve-pkg-maps": {
|
|
137
|
-
"version": "1.0.0",
|
|
138
|
-
"resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
|
|
139
|
-
"integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
|
|
140
|
-
"dev": true,
|
|
141
|
-
"license": "MIT",
|
|
142
|
-
"funding": {
|
|
143
|
-
"url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
"node_modules/tsx": {
|
|
147
|
-
"version": "4.21.0",
|
|
148
|
-
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz",
|
|
149
|
-
"integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==",
|
|
150
|
-
"dev": true,
|
|
151
|
-
"license": "MIT",
|
|
152
|
-
"dependencies": {
|
|
153
|
-
"esbuild": "~0.27.0",
|
|
154
|
-
"get-tsconfig": "^4.7.5"
|
|
155
|
-
},
|
|
156
|
-
"bin": {
|
|
157
|
-
"tsx": "dist/cli.mjs"
|
|
158
|
-
},
|
|
159
|
-
"engines": {
|
|
160
|
-
"node": ">=18.0.0"
|
|
161
|
-
},
|
|
162
|
-
"optionalDependencies": {
|
|
163
|
-
"fsevents": "~2.3.3"
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"node_modules/undici-types": {
|
|
167
|
-
"version": "6.21.0",
|
|
168
|
-
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
|
169
|
-
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
|
170
|
-
"dev": true,
|
|
171
|
-
"license": "MIT"
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@esbuild/darwin-arm64",
|
|
3
|
-
"version": "0.27.2",
|
|
4
|
-
"description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/evanw/esbuild.git"
|
|
8
|
-
},
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"preferUnplugged": true,
|
|
11
|
-
"engines": {
|
|
12
|
-
"node": ">=18"
|
|
13
|
-
},
|
|
14
|
-
"os": [
|
|
15
|
-
"darwin"
|
|
16
|
-
],
|
|
17
|
-
"cpu": [
|
|
18
|
-
"arm64"
|
|
19
|
-
]
|
|
20
|
-
}
|