{"_id":"@dulysse1/prisma-name-mapper","_rev":"3-be976544ad97c7c9b326a9710ed32d1d","name":"@dulysse1/prisma-name-mapper","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@dulysse1/prisma-name-mapper","version":"1.0.0","keywords":["prisma","generator","typescript"],"author":{"name":"ealexandros"},"license":"MIT","_id":"@dulysse1/prisma-name-mapper@1.0.0","maintainers":[{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"}],"homepage":"https://github.com/ealexandros/prisma-name-mapper#readme","bugs":{"url":"https://github.com/ealexandros/prisma-name-mapper/issues"},"bin":{"prisma-name-mapper":"index.js"},"dist":{"shasum":"4571cd8bcedf2b4de2fc312d7d7cfe33a1ce07b4","tarball":"https://registry.npmjs.org/@dulysse1/prisma-name-mapper/-/prisma-name-mapper-1.0.0.tgz","fileCount":8,"integrity":"sha512-R1L+TvjwE7B7DgaflpDAsd45BIi8V84Z5eFsIivLCYbMQ/j9bfHtBn9CE+bP0RJo1AsdK3A7NVEBGJmVTp2dTA==","signatures":[{"sig":"MEQCIGCP5/Soa9qqcfGApqcY7tfs9SQ/+7eAY5VjEkVnP4GgAiBI+1ECkFeGLH8Uu2NP94cG4aN3a8j4wbjkAA9Bpp5Puw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10154},"main":"./dist/index.js","type":"commonjs","types":"dist/index.d.ts","gitHead":"d2b50e7ba47e6844805f01eadca476272ae9d87b","scripts":{"build":"tsc","prepare":"husky","prepublishOnly":"bun run build","prettier:check":"bunx prettier --check .","prettier:write":"bunx prettier --write ."},"_npmUser":{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"},"repository":{"url":"git+https://github.com/ealexandros/prisma-name-mapper.git","type":"git"},"_npmVersion":"11.4.2","description":"A Prisma generator that outputs a TypeScript map of model and field names to their database names.","directories":{},"lint-staged":{"*.{json,js,jsx,ts,tsx}":["bun run prettier:write"]},"_nodeVersion":"22.14.0","dependencies":{"@prisma/generator-helper":"^6.13.0"},"_hasShrinkwrap":false,"packageManager":"^bun@1.2.19","devDependencies":{"husky":"^9.1.7","eslint":"^9.32.0","prettier":"^3.6.2","@types/node":"^24.1.0","lint-staged":"^16.1.2"},"peerDependencies":{"prisma":"^6.13","typescript":"^5.9.2","@prisma/client":"^6.13"},"_npmOperationalInternal":{"tmp":"tmp/prisma-name-mapper_1.0.0_1785231457265_0.685103605898707","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dulysse1/prisma-name-mapper","version":"1.0.1","keywords":["prisma","generator","typescript"],"author":{"name":"ealexandros"},"license":"MIT","_id":"@dulysse1/prisma-name-mapper@1.0.1","maintainers":[{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"}],"homepage":"https://github.com/ealexandros/prisma-name-mapper#readme","bugs":{"url":"https://github.com/ealexandros/prisma-name-mapper/issues"},"bin":{"prisma-name-mapper":"index.js"},"dist":{"shasum":"73bd74378f5ae828641b25c55ba44e335d087c29","tarball":"https://registry.npmjs.org/@dulysse1/prisma-name-mapper/-/prisma-name-mapper-1.0.1.tgz","fileCount":8,"integrity":"sha512-ZtOc9YycWZsnrugjE2btHBBvoEUGKyDEipmpbUPXnCok5kQBKDnR47zjNwStn8+21hpHJFpi+bc113AJj6AWSA==","signatures":[{"sig":"MEUCIBYe0JSfQW0hn5V78t3C8ucpeEB8R5zTzcu0rRHEwO/KAiEAoYpdEym4Gt/CtkZLyAgejLc9f3r9IlO/zotJPHLcsqI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10234},"main":"./dist/index.js","type":"commonjs","types":"dist/index.d.ts","gitHead":"bf5354b4ba176fc81fd02f24808d55823326a3b2","scripts":{"build":"tsc","prepare":"husky","prepublishOnly":"bun run build","prettier:check":"bunx prettier --check .","prettier:write":"bunx prettier --write ."},"_npmUser":{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"},"repository":{"url":"git+https://github.com/ealexandros/prisma-name-mapper.git","type":"git"},"_npmVersion":"11.4.2","description":"A Prisma generator that outputs a TypeScript map of model and field names to their database names.","directories":{},"lint-staged":{"*.{json,js,jsx,ts,tsx}":["bun run prettier:write"]},"_nodeVersion":"22.14.0","dependencies":{"@prisma/generator-helper":"^6.13.0"},"_hasShrinkwrap":false,"packageManager":"^bun@1.2.19","devDependencies":{"husky":"^9.1.7","eslint":"^9.32.0","prettier":"^3.6.2","@types/node":"^24.1.0","lint-staged":"^16.1.2"},"peerDependencies":{"prisma":"^6.13","typescript":"^5.9.2","@prisma/client":"^6.13"},"_npmOperationalInternal":{"tmp":"tmp/prisma-name-mapper_1.0.1_1785233208799_0.11353343150907191","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@dulysse1/prisma-name-mapper","version":"1.0.2","description":"A Prisma generator that outputs a TypeScript map of model and field names to their database names.","author":{"name":"ealexandros"},"license":"MIT","homepage":"https://github.com/Dulysse/prisma-name-mapper#readme","bugs":{"url":"https://github.com/Dulysse/prisma-name-mapper/issues"},"repository":{"type":"git","url":"git+https://github.com/Dulysse/prisma-name-mapper.git"},"types":"dist/index.d.ts","type":"commonjs","main":"./dist/index.js","bin":{"prisma-name-mapper":"index.js"},"scripts":{"build":"tsc","prettier:check":"bunx prettier --check .","prettier:write":"bunx prettier --write .","prepare":"husky","prepublishOnly":"bun run build"},"keywords":["prisma","generator","typescript"],"devDependencies":{"@types/node":"^24.1.0","eslint":"^9.32.0","husky":"^9.1.7","lint-staged":"^16.1.2","prettier":"^3.6.2"},"peerDependencies":{"@prisma/client":"^6.13","prisma":"^6.13","typescript":"^5.9.2"},"dependencies":{"@prisma/generator-helper":"^6.13.0"},"lint-staged":{"*.{json,js,jsx,ts,tsx}":["bun run prettier:write"]},"packageManager":"^bun@1.2.19","_id":"@dulysse1/prisma-name-mapper@1.0.2","gitHead":"410af4d04c77b285779ab51421b259ffa246e38d","_nodeVersion":"22.14.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-WDv1iV3RelSZdXysauJrVjpMTqrZHRfvBuIJi5Chi7drGjzQ7O1guehwcT3BDaYyawJSbwGsadUi0HJMLg7wDw==","shasum":"756572669e57b8c9951c5008322e03c3037ea259","tarball":"https://registry.npmjs.org/@dulysse1/prisma-name-mapper/-/prisma-name-mapper-1.0.2.tgz","fileCount":8,"unpackedSize":10214,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEouhQG7x1DruaE6tiZwMUEgOOEaeaI4v8UxhFBFUORZAiAgzA2rb1UiLzEQOStzChRFlLtcfia/YYuL3xQdZsGYog=="}]},"_npmUser":{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"},"directories":{},"maintainers":[{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/prisma-name-mapper_1.0.2_1785233494654_0.7307242565201484"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-28T09:37:37.041Z","modified":"2026-07-28T10:11:34.977Z","1.0.0":"2026-07-28T09:37:37.410Z","1.0.1":"2026-07-28T10:06:49.004Z","1.0.2":"2026-07-28T10:11:34.794Z"},"bugs":{"url":"https://github.com/Dulysse/prisma-name-mapper/issues"},"author":{"name":"ealexandros"},"license":"MIT","homepage":"https://github.com/Dulysse/prisma-name-mapper#readme","keywords":["prisma","generator","typescript"],"repository":{"type":"git","url":"git+https://github.com/Dulysse/prisma-name-mapper.git"},"description":"A Prisma generator that outputs a TypeScript map of model and field names to their database names.","maintainers":[{"name":"dulysse1","email":"ulyssedupont2707@gmail.com"}],"readme":"<h1 align=\"center\">\n  🧭 Prisma Name Mapper 🧭\n</h1>\n\n<div align=\"center\">\n  <img src=\"https://img.shields.io/badge/Prisma-0F172A?&logo=prisma\" />\n  <img src=\"https://shields.io/badge/TypeScript-0F172A?logo=TypeScript&logoColor=06B6D4\" />\n</div>\n\n<br />\n\n<p align=\"center\">A custom Prisma generator that creates a TypeScript mapping of your model and field names to their database-level names. Stop guessing and start knowing exactly what your database columns are called.\n\nThis repo is a fork of https://github.com/ealexandros/prisma-name-mapper including prisma enums in exported fields\n\n</p>\n\n## 🤔 What is this?\n\nWhen you use Prisma, you often define your models in camelCase and your database tables and columns in snake_case using @@map and @map. This is great for your code, but what happens when you need to write a raw SQL query, create a migration script, or build a data utility? You end up guessing the database names or constantly checking your schema.prisma file.\n\nPrisma Name Mapper solves this by automatically generating a TypeScript object that maps your Prisma model and field names to their corresponding database names.\n\n## 🚀 Getting Started\n\n#### 1. Installation\n\nInstall the package as a development dependency in your project.\n\n```bash\n# Using npm\n$ npm install -D @dulysse1/prisma-name-mapper\n\n# Using pnpm\n$ pnpm add -D @dulysse1/prisma-name-mapper\n\n# Using bun\n$ bun add -d @dulysse1/prisma-name-mapper\n```\n\n#### 2. Configuration\n\nIn your schema.prisma file, add the dbnames generator:\n\n```prisma\n// schema.prisma\n\ngenerator dbnames {\n  provider = \"prisma-name-mapper\"\n  // (Required) Define a custom output path.\n  output = \"../generated/mapper.ts\"\n}\n\nmodel User {\n  // ... your models\n}\n```\n\n#### 3. Generate the Map\n\nRun the prisma generate command. The mapper file will be created at your specified output path.\n\n```bash\n$ bunx prisma generate\n```\n\n## 📦 Example Output\n\nGiven a Prisma schema like this:\n\n```prisma\n// schema.prisma\n\nenum UserType {\n  ADMIN\n  USER\n\n  @@map(\"user_type\")\n}\n\nmodel User {\n  id        String   @id @default(cuid()) @map(\"user_id\")\n  fullName  String   @map(\"full_name\")\n  createdAt DateTime @map(\"created_at\")\n\n  type UserType // new: support enums!\n\n  @@map(\"users\")\n}\n```\n\nThis generator will create the following file, giving you type-safe access to your database names:\n\n```typescript\n// 🔴 AUTO-GENERATED FILE — DO NOT EDIT! 🔴\n//\n// This file is automatically generated by prisma-name-mapper.\n// Do not edit this file directly.\n\nexport const PrismaNameMapper = {\n  User: {\n    tableName: \"users\",\n    schema: null,\n    fields: {\n      id: \"user_id\",\n      fullName: \"full_name\",\n      createdAt: \"created_at\",\n      type: \"type\", // new: support enums!\n    },\n  },\n} as const;\n```\n\n## ✨ Why Use It?\n\nThis utility becomes incredibly useful in a variety of scenarios:\n\n- Raw SQL Queries: Write type-safe raw SQL queries without hardcoding table or column names.\n\n```typescript\nimport { PrismaNameMapper } from \"@/prisma/generated/mapper\";\nimport { prisma } from \"@/lib/prisma/client\";\n\nconst userId = \"some-user-id\";\nconst userTable = Prisma.raw(PrismaNameMapper.User.tableName);\nconst userIdCol = Prisma.raw(PrismaNameMapper.User.fields.id);\n\nconst query = Prisma.sql`\n  SELECT * FROM ${userTable} WHERE ${userIdCol} = $1\n`;\nconst users = await prisma.$queryRaw(query userId);\n```\n\n- Database Utilities & Seeding: Build scripts for migrations, seeding, or data manipulation with confidence.\n\n```typescript\n// A script to count users\n\nconst userTable = PrismaNameMapper.User.tableName;\nconsole.log(`There are ${count} rows in the ${userTable} table.`);\n```\n\n- Logging & Auditing: Create detailed logs that reference the exact database columns being modified.\n\n- Dynamic APIs: Build dynamic API endpoints or data services that need to know about the underlying database schema.\n\n## 🤝 Contributing\n\nContributions are welcome! If you have a feature request, bug report, or want to improve the code, please open an issue or submit a pull request.\n\n## 📜 License\n\nThis project is licensed under the MIT License. See the [LICENSE](https://github.com/ealexandros/prisma-name-mapper/blob/main/LICENSE) file for details.\n\nMade with ❤️ – Built for the Community 🤲\n","readmeFilename":"README.md"}