New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@compas/code-gen

Package Overview
Dependencies
Maintainers
0
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compas/code-gen - npm Package Compare versions

Comparing version 0.15.5 to 0.15.6

4

package.json
{
"name": "@compas/code-gen",
"version": "0.15.5",
"version": "0.15.6",
"description": "Generate various boring parts of your server",

@@ -22,3 +22,3 @@ "exports": {

"dependencies": {
"@compas/stdlib": "0.15.5"
"@compas/stdlib": "0.15.6"
},

@@ -25,0 +25,0 @@ "author": {

@@ -177,2 +177,10 @@ import { fileBlockEnd, fileBlockStart } from "../file/block.js";

if (
generateContext.options.generators.apiClient?.target.targetRuntime ===
"node.js"
) {
importCollector.destructure("@compas/stdlib", "AppError");
importCollector.raw(`import FormData from "form-data";`);
}
return file;

@@ -224,3 +232,13 @@ }

// Allow overwriting any request config
args.push(`requestConfig?: AxiosRequestConfig`);
if (
generateContext.options.generators.apiClient?.target.targetRuntime ===
"node.js" &&
route.response
) {
args.push(
`requestConfig?: AxiosRequestConfig & { skipResponseValidation?: boolean }`,
);
} else {
args.push(`requestConfig?: AxiosRequestConfig`);
}

@@ -341,4 +359,34 @@ fileContextRemoveLinePrefix(file, 3);

fileWrite(file, `return response.data;`);
if (
route.response &&
generateContext.options.generators.apiClient?.target.targetRuntime ===
"node.js"
) {
fileBlockStart(file, `if (requestConfig?.skipResponseValidation)`);
fileWrite(file, `return response.data;`);
fileBlockEnd(file);
fileWrite(
file,
`const { value, error } = ${contextNames.responseValidator}(response.data);`,
);
fileBlockStart(file, `if (error)`);
fileWrite(
file,
`throw AppError.validationError("validator.error", {
route: { group: "${route.group}", name: "${route.name}", },
error,
});`,
);
fileBlockEnd(file);
fileBlockStart(file, `else`);
fileWrite(file, `return value;`);
fileBlockEnd(file);
} else {
fileWrite(file, `return response.data;`);
}
fileBlockEnd(file);

@@ -345,0 +393,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc