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 9.4.0 to 9.4.1

9

lib/helpers/tsReader.js

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

const registerUserTs = (basePath) => {
var _a;
var _a, _b, _c;
const pathToSearch = basePath.endsWith(".json")

@@ -318,3 +318,3 @@ ? basePath

if ((_a = tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.paths) {
const baseUrl = process.cwd();
const baseUrl = path_1.default.join(process.cwd(), (_c = (_b = tsConfig === null || tsConfig === void 0 ? void 0 : tsConfig.compilerOptions) === null || _b === void 0 ? void 0 : _b.baseUrl) !== null && _c !== void 0 ? _c : "");
if (process.env.DEBUG) {

@@ -348,2 +348,7 @@ console.log("tsreader: Found paths field in tsconfig.json, registering project with tsconfig-paths using baseUrl " +

tsConfig.compilerOptions.paths = Object.assign(Object.assign({}, extendedConfig.compilerOptions.paths), tsConfig.compilerOptions.paths);
// We only want to set the base URL if its not already set, since the child tsconfig should always overwrite extended tsconfigs.
// So the first child we find with a base URL be the final base URL
if (extendedConfig.compilerOptions.baseUrl && !tsConfig.compilerOptions.baseUrl) {
tsConfig.compilerOptions.baseUrl = extendedConfig.compilerOptions.baseUrl;
}
}

@@ -350,0 +355,0 @@ return tsConfig;

@@ -5,3 +5,2 @@ /// <reference types="node" />

export declare const getSubdocName: (path: string, modelName?: string) => string;
export declare const convertToSingular: (str: string) => string;
export declare const isMapType: (val: any) => boolean;

@@ -8,0 +7,0 @@ export declare const convertBaseTypeToTs: ({ key, val, isDocument, noMongoose, datesAsStrings }: {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTypeFromKeyValue = exports.loadModels = exports.BASE_TYPES = exports.getShouldLeanIncludeVirtuals = exports.convertBaseTypeToTs = exports.isMapType = exports.convertToSingular = exports.getSubdocName = void 0;
exports.getTypeFromKeyValue = exports.loadModels = exports.BASE_TYPES = exports.getShouldLeanIncludeVirtuals = exports.convertBaseTypeToTs = exports.isMapType = exports.getSubdocName = void 0;
const tslib_1 = require("tslib");
const mongoose_1 = (0, tslib_1.__importDefault)(require("mongoose"));
const lodash_1 = (0, tslib_1.__importDefault)(require("lodash"));
const pluralize_1 = (0, tslib_1.__importDefault)(require("pluralize"));
const stringBuilder_1 = require("../writer/stringBuilder");

@@ -14,3 +15,3 @@ const getSubdocName = (path, modelName = "") => {

.join("");
subDocName = (0, exports.convertToSingular)(subDocName);
subDocName = pluralize_1.default.singular(subDocName);
// // If a user names a field "model", it will conflict with the model name, so we need to rename it.

@@ -26,13 +27,2 @@ // // https://github.com/francescov1/mongoose-tsgen/issues/128

exports.getSubdocName = getSubdocName;
const convertToSingular = (str) => {
if (str.endsWith("sses")) {
// https://github.com/francescov1/mongoose-tsgen/issues/79
return str.slice(0, -2);
}
if (str.endsWith("s") && !str.endsWith("ss")) {
return str.slice(0, -1);
}
return str;
};
exports.convertToSingular = convertToSingular;
const isMapType = (val) => {

@@ -39,0 +29,0 @@ return val === Map || val === mongoose_1.default.Schema.Types.Map;

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

@@ -20,2 +20,3 @@ "bin": {

"mkdirp": "^1.0.4",
"pluralize": "^8.0.0",
"prettier": "^2.5.1",

@@ -39,2 +40,3 @@ "strip-json-comments": "^3.1.1",

"@types/node": "^10.17.35",
"@types/pluralize": "^0.0.33",
"eslint": "^7.13.0",

@@ -41,0 +43,0 @@ "eslint-config-oclif": "^4.0.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