Socket
Socket
Sign inDemoInstall

nestia

Package Overview
Dependencies
Maintainers
1
Versions
222
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nestia - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

package.json
{
"name": "nestia",
"version": "0.1.5",
"version": "0.1.6",
"description": "Automatic SDK and Document generator for the NestJS",

@@ -5,0 +5,0 @@ "main": "src/index.ts",

@@ -109,3 +109,6 @@ import * as path from "path";

imports,
controller: `${controller.name}.${func.name}()`
symbol: `${controller.name}.${func.name}()`,
comments: signature.getDocumentationComment(undefined),
tags: signature.getJsDocTags()
};

@@ -112,0 +115,0 @@ }

@@ -0,2 +1,5 @@

import type * as tsc from "typescript";
import { Pair } from "tstl/utility/Pair";
import { Vector } from "tstl/container/Vector";
import { Fetcher } from "../bundle/__internal/Fetcher";

@@ -67,12 +70,58 @@ import { IRoute } from "../structures/IRoute";

{
const parameters: string = route.parameters.map(param =>
//----
// CONSTRUCT COMMENT
//----
// MAIN DESCRIPTION
let comment: string = route.comments.map(comment => comment.text).join("\n\n");
if (comment !== "")
comment += "\n\n";
// FILTER TAGS (VULNERABLE PARAMETERS WOULD BE REMOVED)
const tags: tsc.JSDocTagInfo[] = route.tags.filter(tag =>
{
const type: string = (param === query || param === input)
? `Primitive<${route.name}.${param === query ? "Query" : "Input"}>`
: param.type
return `${param.name}: ${type}`;
}).join(", ");
if (tag.name === "param")
{
if (tag.text === undefined)
return false;
const variable: string = tag.text.split(" ")[0];
return route.parameters.find(param => variable === param.name) !== undefined;
}
return true;
});
if (tags.length !== 0)
{
const index: number = tags.findIndex(t => t.name === "param");
if (index !== -1)
{
const capsule: Vector<tsc.JSDocTagInfo> = Vector.wrap(tags);
capsule.insert(capsule.nth(index), {
name: "param",
text: "connection Information of the remote HTTP(s) server with headers (+encryption password)"
});
}
comment += tags.map(t => `@${t.name} ${t.text ? t.text : ""}`).join("\n") + "\n\n";
}
// COMPLETE THE COMMENT
comment += `@controller ${route.symbol}\n`;
comment += `@path ${route.method} ${route.path}`;
return `// ${route.method} ${route.path}\n`
+ `// ${route.controller}\n`
//----
// FINALIZATION
//----
// REFORM PARAMETERS TEXT
const parameters: string = route.parameters.map(param =>
{
const type: string = (param === query || param === input)
? `Primitive<${route.name}.${param === query ? "Query" : "Input"}>`
: param.type
return `${param.name}: ${type}`;
}).join(", ");
// RETURNS WITH CONSTRUCTION
return ""
+ "/**\n"
+ comment.split("\r\n").join("\n").split("\n").map(str => ` * ${str}`).join("\n") + "\n"
+ " */\n"
+ `export function ${route.name}(connection: IConnection, ${parameters}): Promise<${route.name}.Output>\n`

@@ -79,0 +128,0 @@ + "{";

@@ -0,1 +1,2 @@

import type * as tsc from "typescript";
import { ParamCategory } from "./ParamCategory";

@@ -9,2 +10,3 @@

encrypted: boolean;
parameters: IRoute.IParameter[];

@@ -14,6 +16,5 @@ imports: [string, string[]][];

/**
* @internal
*/
controller: string;
symbol: string;
comments: tsc.SymbolDisplayPart[];
tags: tsc.JSDocTagInfo[];
}

@@ -20,0 +21,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