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

nodejs-backpack

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodejs-backpack - npm Package Compare versions

Comparing version 1.0.13 to 1.0.14

534

index.js
#!/usr/bin/env node
const fs = require("fs-extra");
const path = require("path");
var clc = require("cli-color");
const { loadSchemaFromFile, modelsParams, capitalize } = require("./helper");
const command = process.argv[2]; // Get the command name from the command line arguments
const fileName = process.argv[3]; // Get the file name from the command line arguments
if (command === "sample:files") {
// Define the path to the root directory of the project
const projectRootPath = process.cwd();
/*CREATE SAMPLE_APP FILE*/
const destinationAppJsFilePath = path.join(projectRootPath, `sample-app.js`);
let sampleAppJsContent = fs.readFileSync(
path.join(__dirname, "sample-app.js"),
"utf8"
);
fs.writeFileSync(destinationAppJsFilePath, sampleAppJsContent);
/*CREATE SAMPLE_ENV FILE*/
const destinationEnvFilePath = path.join(projectRootPath, `.sample-env`);
let sampleEnvContent = fs.readFileSync(
path.join(__dirname, ".sample-env"),
"utf8"
);
fs.writeFileSync(destinationEnvFilePath, sampleEnvContent);
/*CREATE SAMPLE_PACKAGE.JSON FILE*/
const destinationPackageJsonFilePath = path.join(
projectRootPath,
`sample-package.json`
);
let samplePackageJsonContent = fs.readFileSync(
path.join(__dirname, "sample-package.json"),
"utf8"
);
fs.writeFileSync(destinationPackageJsonFilePath, samplePackageJsonContent);
console.log(
clc.green(
`"sample-app.js", "sample-package.json" & ".sample-env" file created in the root directory.`
)
);
} else if (command === "make:schema") {
// Define the path to the root directory of the project
const projectRootPath = process.cwd();
// Define the path to the models folder in the project root directory
const modelsFolderPath = path.join(projectRootPath, "models");
// Check if the models folder exists
if (!fs.existsSync(modelsFolderPath)) {
// Create the models folder if it doesn't exist
fs.mkdirSync(modelsFolderPath);
}
// Define the destination file path inside the models folder
const destinationFilePath = path.join(modelsFolderPath, `${fileName}.js`);
// Read the sample schema file content
let sampleSchemaContent = fs.readFileSync(
path.join(__dirname, "sample-schema.js"),
"utf8"
);
// Replace ${fileContent} placeholder with the desired content
sampleSchemaContent = sampleSchemaContent.replace(
/\${fileContent}/g,
fileName
);
// Create the file with the desired content
fs.writeFileSync(destinationFilePath, sampleSchemaContent);
console.log(clc.green(`"${fileName}.js" file created in the models folder.`));
} else if (command === "make:apis") {
const apiUrlOption = process.argv.find((arg) => arg.startsWith("--url="));
const schemaOption = process.argv.find((arg) => arg.startsWith("--schema="));
// console.error([apiUrlOption, schemaOption, process.argv]);
if (
(apiUrlOption === -1 && schemaOption === -1) ||
(apiUrlOption === undefined && schemaOption === undefined)
) {
console.error(
clc.bgRed(
"Missing parameters. Please provide --url=<api_url> and --schema=<schema_name>."
)
);
process.exit(1);
} else if (apiUrlOption === -1 || apiUrlOption === undefined) {
console.error(
clc.bgRed("Missing parameters. Please provide --url=<api_url>.")
);
process.exit(1);
} else if (schemaOption === -1 || schemaOption === undefined) {
console.error(
clc.bgRed("Missing parameters. Please provide --schema=<schema_name>.")
);
process.exit(1);
}
// Extract the values of the --url and --schema parameters
const apiUrl = apiUrlOption.split("=")[1];
const schemaName = schemaOption.split("=")[1];
// Define the path to the root directory of the project
const projectRootPath = process.cwd();
// Check if the schema file exists
const schemaFilePath = path.join(
projectRootPath,
"models",
`${schemaName}.js`
);
if (!fs.existsSync(schemaFilePath)) {
console.error(
clc.bgRed(
`Schema file "${schemaName}.js" does not exist in '/models/${schemaName}.js'.`
)
);
process.exit(1);
}
// Define the path to the routes and controllers folders in the project root directory
const routesFolderPath = path.join(projectRootPath, "routes");
const helperFolderPath = path.join(projectRootPath, "helpers");
const validationRequestFolderPath = path.join(
routesFolderPath,
"validationRequest"
);
const customRequestFolderPath = path.join(
validationRequestFolderPath,
`${fileName}`
);
const controllersFolderPath = path.join(projectRootPath, "controllers");
// Check if the routes folder exists
if (!fs.existsSync(routesFolderPath)) {
// Create the routes folder if it doesn't exist
fs.mkdirSync(routesFolderPath);
}
// Check if the validationRequest folder exists
if (!fs.existsSync(validationRequestFolderPath)) {
// Create the validationRequest folder if it doesn't exist
fs.mkdirSync(validationRequestFolderPath);
}
// Check if the custom validation Request folder exists
if (!fs.existsSync(customRequestFolderPath)) {
// Create the custom validation Request folder if it doesn't exist
fs.mkdirSync(customRequestFolderPath);
}
// Check if the controllers folder exists
if (!fs.existsSync(controllersFolderPath)) {
// Create the controllers folder if it doesn't exist
fs.mkdirSync(controllersFolderPath);
}
// Check if the Helpers folder exists
if (!fs.existsSync(helperFolderPath)) {
// Create the Helpers folder if it doesn't exist
fs.mkdirSync(helperFolderPath);
}
// Define the destination file paths inside the routes and controllers folders
controllerFileCreate(controllersFolderPath, fileName, schemaName);
indexRouteFileCreate(routesFolderPath, fileName);
validationFileCreate(schemaFilePath, schemaName, customRequestFolderPath);
newRouteFileCreate(routesFolderPath, fileName, apiUrl, schemaName);
helperFileCreate(helperFolderPath);
} else {
console.error(clc.bgRed(`Unknown command: ${command}`));
}
/*Dedicated functions created*/
async function indexRouteFileCreate(routesFolderPath, fileName) {
const filePath = path.join(routesFolderPath, "IndexRoute.js");
try {
const exists = await fileExists(filePath);
if (!exists) {
const sampleIndexContent = fs.readFileSync(
path.join(__dirname, "sample-index-route.js"),
"utf8"
);
fs.writeFileSync(filePath, sampleIndexContent);
console.log(clc.green("\nIndexRoute.js file created successfully!"));
}
let data = await readFile(filePath, "utf8");
const searchInsertString = `const ${fileName}Route = require("./${fileName}Route");`;
const insertionIndex = data.indexOf("const router = express.Router();");
if (insertionIndex !== -1 && !data.includes(searchInsertString)) {
const newData =
data.slice(0, insertionIndex) +
searchInsertString +
"\n" +
data.slice(insertionIndex);
await writeFile(filePath, newData, "utf8");
console.log(
clc.green(
`const ${fileName}Route = require("./${fileName}Route"); imported into IndexRoute.js successfully!`
)
);
} else {
console.log(
clc.yellow(
`const ${fileName}Route = require("./${fileName}Route"); already imported in IndexRoute.js!`
)
);
}
data = await readFile(filePath, "utf8");
const routeUseString = `router.use("/", ${fileName}Route);`;
const routerExportIndex = data.indexOf("module.exports = router;");
if (routerExportIndex !== -1 && !data.includes(routeUseString)) {
const newData =
data.slice(0, routerExportIndex) +
routeUseString +
"\n" +
data.slice(routerExportIndex);
await writeFile(filePath, newData, "utf8");
console.log(
clc.green(
`router.use("/", ${fileName}Route); appended into IndexRoute.js successfully!`
)
);
} else {
console.log(
clc.yellow(
`router.use("/", ${fileName}Route); already exists in IndexRoute.js!`
)
);
}
} catch (err) {
console.error(err);
}
}
function fileExists(filePath) {
return new Promise((resolve, reject) => {
fs.access(filePath, fs.constants.F_OK, (err) => {
if (err) {
resolve(false);
} else {
resolve(true);
}
});
});
}
function readFile(filePath, encoding) {
return new Promise((resolve, reject) => {
fs.readFile(filePath, encoding, (err, data) => {
if (err) {
reject(err);
} else {
resolve(data);
}
});
});
}
function writeFile(filePath, data, encoding) {
return new Promise((resolve, reject) => {
fs.writeFile(filePath, data, encoding, (err) => {
if (err) {
reject(err);
} else {
resolve();
}
});
});
}
async function controllerFileCreate(
controllersFolderPath,
fileName,
schemaName
) {
const controllerFilePath = path.join(
controllersFolderPath,
`${fileName}Controller.js`
);
const controllerFileExists = await fileExists(controllerFilePath);
if (!controllerFileExists) {
// Read the sample Controller file content
let sampleControllerContent = fs.readFileSync(
path.join(__dirname, "sample-controller.js"),
"utf8"
);
// Replace ${fileContent} placeholder with the desired content
sampleControllerContent = sampleControllerContent.replace(
/\${fileName}/g,
fileName
);
sampleControllerContent = sampleControllerContent.replace(
/\${schemaName}/g,
schemaName
);
// Create the controller file with the desired content
fs.writeFileSync(controllerFilePath, sampleControllerContent);
console.log(
clc.green(
`\n${fileName}Controller.js file created successfully in the '/controllers/${fileName}Controller.js' folder.!`
)
);
} else {
console.log(
clc.bgRed(
`\n${fileName}Controller.js file already exist!, Kindly delete existing and try again.`
)
);
}
}
async function validationFileCreate(
schemaFilePath,
schemaName,
customRequestFolderPath
) {
const schema = loadSchemaFromFile(schemaFilePath);
//
var formFields = modelsParams(schema);
var uploadFieldArray = [];
var searchFields = [];
if (
formFields &&
formFields?.filteredFormFields &&
formFields?.filteredFormFields.length
) {
const tempFields = formFields?.filteredFormFields;
for (let key in tempFields) {
if (tempFields[key]) {
uploadFieldArray.push({ name: tempFields[key] });
}
}
searchFields = formFields?.filteredFormFields;
}
let validationString = "";
if (formFields?.requiredFields && formFields?.requiredFields?.length > 0) {
formFields?.requiredFields.forEach((field) => {
validationString += `\n\tcheck("${field}").custom((value, { req }) => {
const fs=require("fs-extra"),path=require("path");var clc=require("cli-color");const{loadSchemaFromFile,modelsParams,capitalize}=require("./helper"),command=process.argv[2],fileName=process.argv[3];if("sample:files"===command){const a=process.cwd(),b=path.join(a,"sample-app.js");let e=fs.readFileSync(path.join(__dirname,"sample-app.js"),"utf8");fs.writeFileSync(b,e);const d=path.join(a,".sample-env");let i=fs.readFileSync(path.join(__dirname,".sample-env"),"utf8");fs.writeFileSync(d,i);const f=path.join(a,"sample-package.json");let s=fs.readFileSync(path.join(__dirname,"sample-package.json"),"utf8");fs.writeFileSync(f,s),console.log(clc.green('"sample-app.js", "sample-package.json" & ".sample-env" file created in the root directory.'))}else if("make:schema"===command){const h=process.cwd(),i=path.join(h,"models"),j=(fs.existsSync(i)||fs.mkdirSync(i),path.join(i,fileName+".js"));let e=fs.readFileSync(path.join(__dirname,"sample-schema.js"),"utf8");e=e.replace(/\${fileContent}/g,fileName),fs.writeFileSync(j,e),console.log(clc.green(`"${fileName}.js" file created in the models folder.`))}else if("make:apis"===command){const l=process.argv.find(e=>e.startsWith("--url=")),m=process.argv.find(e=>e.startsWith("--schema=")),n=(-1===l&&-1===m||void 0===l&&void 0===m?(console.error(clc.bgRed("Missing parameters. Please provide --url=<api_url> and --schema=<schema_name>.")),process.exit(1)):-1===l||void 0===l?(console.error(clc.bgRed("Missing parameters. Please provide --url=<api_url>.")),process.exit(1)):-1!==m&&void 0!==m||(console.error(clc.bgRed("Missing parameters. Please provide --schema=<schema_name>.")),process.exit(1)),l.split("=")[1]),o=m.split("=")[1],p=process.cwd(),q=path.join(p,"models",o+".js"),r=(fs.existsSync(q)||(console.error(clc.bgRed(`Schema file "${o}.js" does not exist in '/models/${o}.js'.`)),process.exit(1)),path.join(p,"routes")),s=path.join(p,"helpers"),t=path.join(r,"validationRequest"),u=path.join(t,""+fileName),v=path.join(p,"controllers");fs.existsSync(r)||fs.mkdirSync(r),fs.existsSync(t)||fs.mkdirSync(t),fs.existsSync(u)||fs.mkdirSync(u),fs.existsSync(v)||fs.mkdirSync(v),fs.existsSync(s)||fs.mkdirSync(s),controllerFileCreate(v,fileName,o),indexRouteFileCreate(r,fileName),validationFileCreate(q,o,u),newRouteFileCreate(r,fileName,n,o),helperFileCreate(s)}else console.error(clc.bgRed("Unknown command: "+command));async function indexRouteFileCreate(i,s){var t,i=path.join(i,"IndexRoute.js");try{await fileExists(i)||(t=fs.readFileSync(path.join(__dirname,"sample-index-route.js"),"utf8"),fs.writeFileSync(i,t),console.log(clc.green("\nIndexRoute.js file created successfully!")));let e=await readFile(i,"utf8");var a=`const ${s}Route = require("./${s}Route");`,r=e.indexOf("const router = express.Router();"),l=(-1===r||e.includes(a)?console.log(clc.yellow(`const ${s}Route = require("./${s}Route"); already imported in IndexRoute.js!`)):(await writeFile(i,e.slice(0,r)+a+"\n"+e.slice(r),"utf8"),console.log(clc.green(`const ${s}Route = require("./${s}Route"); imported into IndexRoute.js successfully!`))),e=await readFile(i,"utf8"),`router.use("/", ${s}Route);`),o=e.indexOf("module.exports = router;");-1===o||e.includes(l)?console.log(clc.yellow(`router.use("/", ${s}Route); already exists in IndexRoute.js!`)):(await writeFile(i,e.slice(0,o)+l+"\n"+e.slice(o),"utf8"),console.log(clc.green(`router.use("/", ${s}Route); appended into IndexRoute.js successfully!`)))}catch(e){console.error(e)}}function fileExists(s){return new Promise((i,e)=>{fs.access(s,fs.constants.F_OK,e=>{i(!e)})})}function readFile(e,i){return new Promise((s,t)=>{fs.readFile(e,i,(e,i)=>{e?t(e):s(i)})})}function writeFile(e,t,a){return new Promise((i,s)=>{fs.writeFile(e,t,a,e=>{e?s(e):i()})})}async function controllerFileCreate(i,s,t){i=path.join(i,s+"Controller.js");if(await fileExists(i))console.log(clc.bgRed(`
${s}Controller.js file already exist!, Kindly delete existing and try again.`));else{let e=fs.readFileSync(path.join(__dirname,"sample-controller.js"),"utf8");e=(e=e.replace(/\${fileName}/g,s)).replace(/\${schemaName}/g,t),fs.writeFileSync(i,e),console.log(clc.green(`
${s}Controller.js file created successfully in the '/controllers/${s}Controller.js' folder.!`))}}async function validationFileCreate(e,t,a){var e=loadSchemaFromFile(e),e=modelsParams(e),i=[];if(e&&e?.filteredFormFields&&e?.filteredFormFields.length){var s,r=e?.filteredFormFields;for(s in r)r[s]&&i.push({name:r[s]});e?.filteredFormFields}let l="";e?.requiredFields&&0<e?.requiredFields?.length&&e?.requiredFields.forEach(e=>{l+=`
check("${e}").custom((value, { req }) => {
const fileExists =
req.files && req.files.some((obj) => obj.fieldname === "${field}");
const ${field}Exists = req.body && req.body.${field};
req.files && req.files.some((obj) => obj.fieldname === "${e}");
const ${e}Exists = req.body && req.body.${e};
if (fileExists || ${field}Exists) {
if (fileExists || ${e}Exists) {
return true;
} else {
throw new Error("${capitalize(field)} is required.");
throw new Error("${capitalize(e)} is required.");
}
}),`;
});
}
/*Validation file created*/
const validationTypeList = [
"List",
"GetDetail",
"Store",
"Update",
"Destroy",
];
validationTypeList.forEach(async (type) => {
// Read the sample Route file content
let sampleModelValidationContent = fs.readFileSync(
path.join(__dirname, "sample-validation.js"),
"utf8"
);
// Replace ${fileContent} placeholder with the desired content
sampleModelValidationContent = sampleModelValidationContent.replace(
/\${schemaName}/g,
schemaName
);
var typeString = validationString;
if (type === "Update") {
typeString += `\n\tparam("id").custom((value, { req }) => {
return ${schemaName}.findOne({ _id: value }).then((${schemaName}Data) => {
if (!${schemaName}Data) {
}),`});["List","GetDetail","Store","Update","Destroy"].forEach(async e=>{let i=fs.readFileSync(path.join(__dirname,"sample-validation.js"),"utf8");i=i.replace(/\${schemaName}/g,t);var s=l,s=("Update"===e?s+=`
param("id").custom((value, { req }) => {
return ${t}.findOne({ _id: value }).then((${t}Data) => {
if (!${t}Data) {
return Promise.reject("Invalid ID! The provided ID does not exist in the database.");
}
});
}),`;
} else if (type === "GetDetail" || type === "Destroy") {
typeString = `\n\tparam("id").custom((value, { req }) => {
return ${schemaName}.findOne({ _id: value }).then((${schemaName}Data) => {
if (!${schemaName}Data) {
}),`:"GetDetail"===e||"Destroy"===e?s=`
param("id").custom((value, { req }) => {
return ${t}.findOne({ _id: value }).then((${t}Data) => {
if (!${t}Data) {
return Promise.reject("Invalid ID! The provided ID does not exist in the database.");
}
});
}),`;
} else if (type === "List") {
typeString = ``;
}
typeString += `\n`;
sampleModelValidationContent = sampleModelValidationContent.replace(
/\__validation__dynamic__code__/g,
typeString
);
const customRequestFilePath = path.join(
customRequestFolderPath,
`${type}ValidationRequest.js`
);
const controllerFileExists = await fileExists(customRequestFilePath);
if (!controllerFileExists) {
// Create the route file with the desired content
fs.writeFileSync(customRequestFilePath, sampleModelValidationContent);
console.log(
clc.green(
`"${type}ValidationRequest.js" file created in the '/routes/validationRequest/${type}ValidationRequest.js' folder.`
)
);
} else {
console.log(
clc.bgRed(
`${type}ValidationRequest.js file already exist!, Kindly delete existing and try again.`
)
);
}
});
}
async function newRouteFileCreate(
routesFolderPath,
fileName,
apiUrl,
schemaName
) {
const routeFilePath = path.join(routesFolderPath, `${fileName}Route.js`);
const exists = await fileExists(routeFilePath);
if (!exists) {
// Read the sample Route file content
let sampleRouteContent = fs.readFileSync(
path.join(__dirname, "sample-route.js"),
"utf8"
);
// Replace ${fileContent} placeholder with the desired content
sampleRouteContent = sampleRouteContent.replace(/\${fileName}/g, fileName);
sampleRouteContent = sampleRouteContent.replace(/\${apiUrl}/g, apiUrl);
sampleRouteContent = sampleRouteContent.replace(
/\${schemaName}/g,
schemaName
);
// Create the route file with the desired content
fs.writeFileSync(routeFilePath, sampleRouteContent);
console.log(
clc.green(
`"${fileName}Route.js" file created in the '/routes/${fileName}Route.js' folders.`
)
);
} else {
console.log(
clc.bgRed(
`\n${fileName}Route.js file already exist!, Kindly delete existing and try again.`
)
);
}
}
async function helperFileCreate(helperFolderPath) {
/*CREATE HELPER FILE*/
const destinationHelperFilePath = path.join(helperFolderPath, `helper.js`);
const exists = await fileExists(destinationHelperFilePath);
if (!exists) {
let sampleHelperContent = fs.readFileSync(
path.join(__dirname, "sample-helper.js"),
"utf8"
);
fs.writeFileSync(destinationHelperFilePath, sampleHelperContent);
}
/*CREATE HELPER FILE*/
const destinationFileUploaderPath = path.join(
helperFolderPath,
`fileUploader.js`
);
const fileUploaderExists = await fileExists(destinationFileUploaderPath);
if (!fileUploaderExists) {
let sampleFileUploaderContent = fs.readFileSync(
path.join(__dirname, "sample-file-uploader.js"),
"utf8"
);
fs.writeFileSync(destinationFileUploaderPath, sampleFileUploaderContent);
}
/*CREATE HELPER FILE*/
const destinationFormParserPath = path.join(
helperFolderPath,
`formParser.js`
);
const formParserExists = await fileExists(destinationFormParserPath);
if (!formParserExists) {
let sampleFormParserContent = fs.readFileSync(
path.join(__dirname, "sample-form-parser.js"),
"utf8"
);
fs.writeFileSync(destinationFormParserPath, sampleFormParserContent);
}
}
}),`:"List"===e&&(s=""),s+=`
`,i=i.replace(/\__validation__dynamic__code__/g,s),path.join(a,e+"ValidationRequest.js"));await fileExists(s)?console.log(clc.bgRed(e+"ValidationRequest.js file already exist!, Kindly delete existing and try again.")):(fs.writeFileSync(s,i),console.log(clc.green(`"${e}ValidationRequest.js" file created in the '/routes/validationRequest/${e}ValidationRequest.js' folder.`)))})}async function newRouteFileCreate(e,i,s,t){e=path.join(e,i+"Route.js");let a=fs.readFileSync(path.join(__dirname,"sample-route.js"),"utf8");a=(a=(a=a.replace(/\${fileName}/g,i)).replace(/\${apiUrl}/g,s)).replace(/\${schemaName}/g,t),fs.writeFileSync(e,a),console.log(clc.green(`"${i}Route.js" file created in the '/routes/${i}Route.js' folders.`))}async function helperFileCreate(e){var i,s=path.join(e,"helper.js"),s=(await fileExists(s)||(i=fs.readFileSync(path.join(__dirname,"sample-helper.js"),"utf8"),fs.writeFileSync(s,i)),path.join(e,"fileUploader.js")),s=(await fileExists(s)||(i=fs.readFileSync(path.join(__dirname,"sample-file-uploader.js"),"utf8"),fs.writeFileSync(s,i)),path.join(e,"formParser.js"));await fileExists(s)||(i=fs.readFileSync(path.join(__dirname,"sample-form-parser.js"),"utf8"),fs.writeFileSync(s,i))}

2

package.json
{
"name": "nodejs-backpack",
"version": "1.0.13",
"version": "1.0.14",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -52,6 +52,6 @@ # NodeJs Backpack

- **Rename sample files** to "**`app.js`**", "**`package.json`**" & "**`.env`**" which are created in the root directory.
![](https://github.com/GohilJaykumar/sharable/blob/main/typing.gif)
- Update .env > **`DB=mongodb+srv...`** with valid connection.
<img src="https://github.com/GohilJaykumar/sharable/blob/main/typing.gif" width="40" height="40" />
```bash

@@ -58,0 +58,0 @@ PORT=3000

@@ -20,5 +20,5 @@ {

"multer": "^1.4.5-lts.1",
"nodejs-backpack": "^0.0.427",
"node-backpack": "^0.0.427",
"rest-api-response-npm": "^0.1.4"
}
}

@@ -11,2 +11,3 @@ const express = require('express');

const formParser = require('../helpers/formParser');
const ${schemaName} = require("../models/${schemaName}");

@@ -13,0 +14,0 @@ const prefix = '${apiUrl}';

@@ -22,29 +22,2 @@ const mongoose = require("mongoose");

const ${fileContent}Model = mongoose.model("${fileContent}", ${fileContent});
// Created a change stream. The 'change' event gets emitted when there's a change in the database
/*
${fileContent}Model.watch().on("change", (data) => {
const timestamp = new Date();
const operationType = data.operationType;
switch (operationType) {
case "insert":
// TODO Logic Code...
console.log(timestamp, "Document created:", data.fullDocument);
break;
case "update":
// TODO Logic Code...
console.log(timestamp, "Document updated:", data.updateDescription);
break;
case "delete":
// TODO Logic Code...
console.log(timestamp, "Document deleted:", data.documentKey);
break;
default:
console.log(timestamp, "Unknown operation type:", operationType);
}
});
*/
module.exports = ${fileContent}Model;
module.exports = mongoose.model("${fileContent}", ${fileContent});
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