@orpc/openapi 0.0.0-next.6083cd9 → 0.0.0-next.67ca77c
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/{chunk-OXOO6JP7.js → chunk-WNX6GP4X.js} +46 -34
- package/dist/fetch.js +1 -1
- package/dist/index.js +1 -1
- package/dist/node.js +1 -1
- package/package.json +4 -4
|
@@ -351,41 +351,53 @@ var OpenAPIPayloadCodec = class {
|
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
353
|
async decode(re) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
const contentType = re.headers.get("content-type");
|
|
358
|
-
const contentDisposition = re.headers.get("content-disposition");
|
|
359
|
-
const fileName = contentDisposition ? cd.parse(contentDisposition).parameters.filename : void 0;
|
|
360
|
-
if (fileName) {
|
|
361
|
-
const blob2 = await re.blob();
|
|
362
|
-
const file = new File([blob2], fileName, {
|
|
363
|
-
type: blob2.type
|
|
364
|
-
});
|
|
365
|
-
return file;
|
|
366
|
-
}
|
|
367
|
-
if (!contentType || contentType.startsWith("application/json")) {
|
|
368
|
-
if (!re.body) {
|
|
369
|
-
return void 0;
|
|
354
|
+
try {
|
|
355
|
+
if (re instanceof Headers || re instanceof URLSearchParams || re instanceof FormData) {
|
|
356
|
+
return deserialize([...re.entries()]);
|
|
370
357
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
358
|
+
const contentType = re.headers.get("content-type");
|
|
359
|
+
const contentDisposition = re.headers.get("content-disposition");
|
|
360
|
+
const fileName = contentDisposition ? cd.parse(contentDisposition).parameters.filename : void 0;
|
|
361
|
+
if (fileName) {
|
|
362
|
+
const blob2 = await re.blob();
|
|
363
|
+
const file = new File([blob2], fileName, {
|
|
364
|
+
type: blob2.type
|
|
365
|
+
});
|
|
366
|
+
return file;
|
|
367
|
+
}
|
|
368
|
+
if (!contentType || contentType.startsWith("application/json")) {
|
|
369
|
+
if (!re.body) {
|
|
370
|
+
return void 0;
|
|
371
|
+
}
|
|
372
|
+
const text = await re.text();
|
|
373
|
+
if (!text) {
|
|
374
|
+
return void 0;
|
|
375
|
+
}
|
|
376
|
+
return JSON.parse(text);
|
|
377
|
+
}
|
|
378
|
+
if (contentType.startsWith("application/x-www-form-urlencoded")) {
|
|
379
|
+
const params = new URLSearchParams(await re.text());
|
|
380
|
+
return this.decode(params);
|
|
381
|
+
}
|
|
382
|
+
if (contentType.startsWith("text/")) {
|
|
383
|
+
const text = await re.text();
|
|
384
|
+
return text;
|
|
385
|
+
}
|
|
386
|
+
if (contentType.startsWith("multipart/form-data")) {
|
|
387
|
+
const form = await re.formData();
|
|
388
|
+
return this.decode(form);
|
|
389
|
+
}
|
|
390
|
+
const blob = await re.blob();
|
|
391
|
+
return new File([blob], "blob", {
|
|
392
|
+
type: blob.type
|
|
393
|
+
});
|
|
394
|
+
} catch (e) {
|
|
395
|
+
throw new ORPCError({
|
|
396
|
+
code: "BAD_REQUEST",
|
|
397
|
+
message: "Cannot parse request/response. Please check the request/response body and Content-Type header.",
|
|
398
|
+
cause: e
|
|
399
|
+
});
|
|
384
400
|
}
|
|
385
|
-
const blob = await re.blob();
|
|
386
|
-
return new File([blob], "blob", {
|
|
387
|
-
type: blob.type
|
|
388
|
-
});
|
|
389
401
|
}
|
|
390
402
|
};
|
|
391
403
|
|
|
@@ -637,4 +649,4 @@ export {
|
|
|
637
649
|
CompositeSchemaCoercer,
|
|
638
650
|
OpenAPIHandler
|
|
639
651
|
};
|
|
640
|
-
//# sourceMappingURL=chunk-
|
|
652
|
+
//# sourceMappingURL=chunk-WNX6GP4X.js.map
|
package/dist/fetch.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -426,7 +426,7 @@ var OpenAPIGenerator = class {
|
|
|
426
426
|
content: this.contentBuilder.build(bodySchema)
|
|
427
427
|
} : void 0;
|
|
428
428
|
const successResponse = {
|
|
429
|
-
description: "
|
|
429
|
+
description: fallbackToGlobalConfig2("defaultSuccessDescription", def.route?.successDescription),
|
|
430
430
|
content: resBodySchema !== void 0 ? this.contentBuilder.build(resBodySchema, {
|
|
431
431
|
example: def.outputExample
|
|
432
432
|
}) : void 0,
|
package/dist/node.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/openapi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.67ca77c",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"json-schema-typed": "^8.0.1",
|
|
50
50
|
"openapi3-ts": "^4.4.0",
|
|
51
51
|
"wildcard-match": "^5.1.3",
|
|
52
|
-
"@orpc/
|
|
53
|
-
"@orpc/
|
|
54
|
-
"@orpc/
|
|
52
|
+
"@orpc/contract": "0.0.0-next.67ca77c",
|
|
53
|
+
"@orpc/server": "0.0.0-next.67ca77c",
|
|
54
|
+
"@orpc/shared": "0.0.0-next.67ca77c"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@readme/openapi-parser": "^2.6.0",
|