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

mongoose-tsgen

Package Overview
Dependencies
Maintainers
1
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-tsgen - npm Package Compare versions

Comparing version 7.1.1 to 7.1.2

15

lib/helpers/tsReader.js

@@ -12,3 +12,3 @@ "use strict";

function findTypesInFile(sourceFile, modelTypes) {
var _a, _b, _c, _d, _e, _f;
var _a, _b, _c, _d, _e, _f, _g;
const schemaModelMapping = {};

@@ -100,11 +100,4 @@ Object.keys(modelTypes).forEach((modelName) => {

continue;
const funcExpr = callExpr.getFirstChildByKind(ts_morph_1.SyntaxKind.FunctionExpression);
// this was an attempt to get return types that are explicitely specified on the .get function (sometimes the current
// method we use below gives us `void` incorrectly). This method currently gives us undefiend but by looking at the Typescript
// AST tree visualizer it should return the missing info we need. More testing needs to go into this.
// const typeRef = funcExpr?.getFirstChildByKind(SyntaxKind.TypeReference);
// console.log("return type: ", typeRef?.getFirstChildByKind(SyntaxKind.Identifier)?.getText());
const type = (_e = funcExpr === null || funcExpr === void 0 ? void 0 : funcExpr.getType()) === null || _e === void 0 ? void 0 : _e.getText(funcExpr);
// another way to get return type, seems less consistent though
// console.log(funcExpr?.getReturnType().getText(funcExpr))
const funcExpr = (_e = propAccessExpr === null || propAccessExpr === void 0 ? void 0 : propAccessExpr.getParent()) === null || _e === void 0 ? void 0 : _e.getFirstChildByKind(ts_morph_1.SyntaxKind.FunctionExpression);
const type = (_f = funcExpr === null || funcExpr === void 0 ? void 0 : funcExpr.getType()) === null || _f === void 0 ? void 0 : _f.getText(funcExpr);
const callExpr2 = propAccessExpr.getFirstChildByKind(ts_morph_1.SyntaxKind.CallExpression);

@@ -116,3 +109,3 @@ const stringLiteral = callExpr2 === null || callExpr2 === void 0 ? void 0 : callExpr2.getArguments()[0];

const virtualName = stringLiteral === null || stringLiteral === void 0 ? void 0 : stringLiteral.getText();
let returnType = (_f = type === null || type === void 0 ? void 0 : type.split("=> ")) === null || _f === void 0 ? void 0 : _f[1];
let returnType = (_g = type === null || type === void 0 ? void 0 : type.split("=> ")) === null || _g === void 0 ? void 0 : _g[1];
if (!returnType || !virtualName)

@@ -119,0 +112,0 @@ continue;

{
"name": "mongoose-tsgen",
"description": "A Typescript interface generator for Mongoose that works out of the box.",
"version": "7.1.1",
"version": "7.1.2",
"author": "Francesco Virga @francescov1",

@@ -6,0 +6,0 @@ "bin": {

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