Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@easy-breezy/generator-api

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@easy-breezy/generator-api - npm Package Compare versions

Comparing version 2.0.19 to 2.0.20

18

dist/ast/create-endpoint/index.js

@@ -20,2 +20,8 @@ import ts from 'typescript';

parameters = ts.factory.createTypeReferenceNode(ts.factory.createQualifiedName(ts.factory.createIdentifier(options.importName), ts.factory.createIdentifier('IParameters')), undefined);
if (!options.schemas.body?.required?.length && !options.schemas.query?.required?.length && !options.schemas.path?.required?.length && !options.schemas.header?.required?.length) {
parameters = ts.factory.createUnionTypeNode([
parameters,
ts.factory.createKeywordTypeNode(ts.SyntaxKind.VoidKeyword)
]);
}
args.push(ts.factory.createParameterDeclaration(undefined, undefined, ts.factory.createIdentifier('params'), undefined, undefined, undefined));

@@ -50,6 +56,10 @@ }

returnObject.push(ts.factory.createPropertyAssignment(ts.factory.createIdentifier(MAP[schemaKey]), ts.factory.createObjectLiteralExpression(keys.map((key) => {
let access = ts.factory.createPropertyAccessExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('params'), ts.factory.createIdentifier(schemaKey)), ts.factory.createIdentifier(key));
if (!options.schemas.query?.required?.includes(key)) {
access = ts.factory.createPropertyAccessChain(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('params'), ts.factory.createIdentifier(schemaKey)), ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), ts.factory.createIdentifier(key));
let paramsAccess = ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('params'), ts.factory.createIdentifier(schemaKey));
if (!options.schemas[schemaKey]?.required?.length) {
paramsAccess = ts.factory.createPropertyAccessChain(ts.factory.createIdentifier('params'), ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), ts.factory.createIdentifier(schemaKey));
}
let access = ts.factory.createPropertyAccessExpression(paramsAccess, ts.factory.createIdentifier(key));
if (!options.schemas[schemaKey]?.required?.includes(key)) {
access = ts.factory.createPropertyAccessChain(paramsAccess, ts.factory.createToken(ts.SyntaxKind.QuestionDotToken), ts.factory.createIdentifier(key));
}
return ts.factory.createPropertyAssignment(ts.factory.createIdentifier(key), access);

@@ -69,3 +79,3 @@ }), true)));

]));
const sourceFile = ts.createSourceFile('extension.ts', '', ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
const sourceFile = ts.createSourceFile('endpoint.ts', '', ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
const printer = ts.createPrinter();

@@ -72,0 +82,0 @@ return {

{
"name": "@easy-breezy/generator-api",
"version": "2.0.19",
"version": "2.0.20",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "type": "module",

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