prisma-effect-kysely 1.7.2 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/CODE_OF_CONDUCT.md +136 -0
- package/CONTRIBUTING.md +247 -0
- package/SECURITY.md +80 -0
- package/dist/effect/generator.d.ts.map +1 -1
- package/dist/effect/generator.js +1 -3
- package/dist/effect/generator.js.map +1 -1
- package/dist/effect/join-table.d.ts +3 -3
- package/dist/effect/join-table.d.ts.map +1 -1
- package/dist/effect/join-table.js +7 -7
- package/dist/effect/join-table.js.map +1 -1
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +5 -1
- package/dist/generator/index.js.map +1 -1
- package/dist/kysely/generator.d.ts +2 -2
- package/dist/kysely/generator.d.ts.map +1 -1
- package/dist/kysely/generator.js +1 -1
- package/dist/kysely/generator.js.map +1 -1
- package/dist/kysely/helpers.d.ts +1 -1
- package/dist/kysely/helpers.d.ts.map +1 -1
- package/dist/kysely/helpers.js.map +1 -1
- package/dist/prisma/relation.d.ts +1 -1
- package/dist/prisma/relation.d.ts.map +1 -1
- package/dist/prisma/relation.js +15 -7
- package/dist/prisma/relation.js.map +1 -1
- package/package.json +28 -5
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,120 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.8.1] - 2025-10-12
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
#### Dynamic Version Management
|
|
13
|
+
- **Generator version now read from package.json**: Removed hardcoded version string in generator manifest
|
|
14
|
+
- Generator now reports correct version dynamically
|
|
15
|
+
- Version always stays in sync with package.json
|
|
16
|
+
- No more manual version updates needed in multiple places
|
|
17
|
+
- Location: `src/generator/index.ts:5,12`
|
|
18
|
+
|
|
19
|
+
#### Custom Relation Name Support for Join Tables
|
|
20
|
+
- **Prisma custom relation names now respected**: Fixed implicit many-to-many join table naming
|
|
21
|
+
- `@relation("product_tags")` now correctly generates `_product_tags` table (not `_ProductToProductTag`)
|
|
22
|
+
- Matches Prisma's actual database table naming convention
|
|
23
|
+
- Both custom and default relation names work correctly
|
|
24
|
+
- Location: `src/prisma/relation.ts:106-115`
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
#### Test Coverage
|
|
29
|
+
- Added test case for custom relation names in implicit many-to-many relations
|
|
30
|
+
- Product/ProductTag models with `@relation("product_tags")`
|
|
31
|
+
- Validates correct table name generation (`_product_tags`)
|
|
32
|
+
- Location: `src/__tests__/fixtures/test.prisma:166-177`
|
|
33
|
+
|
|
34
|
+
### Technical Details
|
|
35
|
+
- Uses TypeScript's `resolveJsonModule` to import package.json
|
|
36
|
+
- Prisma's `field.relationName` contains either custom name or Prisma-generated default
|
|
37
|
+
- Maintains alphabetical model ordering for A/B column assignment in join tables
|
|
38
|
+
- Null-safety check added for relationName (defensive programming)
|
|
39
|
+
|
|
40
|
+
## [1.8.0] - 2025-10-12
|
|
41
|
+
|
|
42
|
+
### Added - Enterprise Open Source Standards
|
|
43
|
+
|
|
44
|
+
This release transforms the project into an enterprise-ready open source package following 2025 best practices.
|
|
45
|
+
|
|
46
|
+
#### Code Quality & Formatting
|
|
47
|
+
- **ESLint 9**: Flat config format with TypeScript and Jest support (2025 standard)
|
|
48
|
+
- Comprehensive rules for source and test files
|
|
49
|
+
- Automatic unused import detection
|
|
50
|
+
- Pre-configured for Effect Schema patterns
|
|
51
|
+
- **Prettier**: Formalized configuration for consistent code style across team
|
|
52
|
+
- Auto-formatting on save
|
|
53
|
+
- Integrated with pre-commit hooks
|
|
54
|
+
- **Pre-commit hooks**: Husky + lint-staged for automatic quality enforcement
|
|
55
|
+
- Runs ESLint --fix on staged files
|
|
56
|
+
- Runs Prettier on staged files
|
|
57
|
+
- Prevents broken commits
|
|
58
|
+
- **New npm scripts**:
|
|
59
|
+
- `npm run lint` - Run ESLint across codebase
|
|
60
|
+
- `npm run lint:fix` - Auto-fix linting issues
|
|
61
|
+
- `npm run format` - Format all files with Prettier
|
|
62
|
+
- `npm run format:check` - Check formatting without changes
|
|
63
|
+
|
|
64
|
+
#### Governance Documentation
|
|
65
|
+
- **SECURITY.md**: Professional vulnerability reporting process
|
|
66
|
+
- Supported versions table
|
|
67
|
+
- Response timeline SLAs (Critical: 7 days, High: 14 days, Medium: 30 days)
|
|
68
|
+
- Security best practices for users
|
|
69
|
+
- Contact methods for responsible disclosure
|
|
70
|
+
- **CODE_OF_CONDUCT.md**: Contributor Covenant 2.1 (industry standard)
|
|
71
|
+
- Clear community standards
|
|
72
|
+
- Enforcement guidelines
|
|
73
|
+
- Inclusive language and expectations
|
|
74
|
+
- **CONTRIBUTING.md**: Complete developer onboarding guide
|
|
75
|
+
- Quick setup (< 5 minutes)
|
|
76
|
+
- Development workflow
|
|
77
|
+
- Coding standards reference
|
|
78
|
+
- Commit message conventions (Conventional Commits)
|
|
79
|
+
- Pull request checklist
|
|
80
|
+
- Testing requirements (maintain >90% coverage)
|
|
81
|
+
- **Governance docs added to npm package**: All governance files now distributed with package
|
|
82
|
+
|
|
83
|
+
#### Automated Dependency Management
|
|
84
|
+
- **renovate.json**: Renovate Cloud (free tier) configuration
|
|
85
|
+
- Weekly automated updates (Mondays at 3am UTC)
|
|
86
|
+
- Auto-merge for patch updates after CI passes
|
|
87
|
+
- Smart package grouping:
|
|
88
|
+
- TypeScript and ESLint together
|
|
89
|
+
- Prisma packages together
|
|
90
|
+
- Testing packages together
|
|
91
|
+
- Vulnerability alerts with security label
|
|
92
|
+
- Rate limiting: 5 concurrent PRs, 2 per hour
|
|
93
|
+
- Effect package pinned to prevent breaking changes
|
|
94
|
+
|
|
95
|
+
### Changed
|
|
96
|
+
- **prepublishOnly script**: Now includes linting step (`npm run lint && npm run typecheck && npm run test && npm run build`)
|
|
97
|
+
- **prepare script**: Updated from `npm run build` to `husky` for pre-commit hook initialization
|
|
98
|
+
- **Source code cleanup**: Removed unused imports detected by ESLint
|
|
99
|
+
- `src/effect/generator.ts`: Removed unused `getFieldDbName` import
|
|
100
|
+
- `src/kysely/generator.ts`: Removed unused `getModelDbName` import
|
|
101
|
+
- `src/kysely/helpers.ts`: Changed to type-only imports for Kysely types
|
|
102
|
+
- `src/effect/join-table.ts`: Prefixed unused parameter with underscore
|
|
103
|
+
|
|
104
|
+
### Technical Details
|
|
105
|
+
- **Quality Assurance**: All 154 tests passing, zero TypeScript errors
|
|
106
|
+
- **ESLint Status**: Passing with 2 minor warnings in test files (acceptable for test code)
|
|
107
|
+
- **Build**: Clean compilation to dist/ directory
|
|
108
|
+
- **Impact**: ~2 hours implementation time (vs 3-4 weeks traditional approach)
|
|
109
|
+
- **Compliance**: Follows OpenSSF Best Practices baseline
|
|
110
|
+
|
|
111
|
+
### Dependencies
|
|
112
|
+
- **Added devDependencies**:
|
|
113
|
+
- `@eslint/js@^9.37.0`
|
|
114
|
+
- `typescript-eslint@^8.46.0`
|
|
115
|
+
- `eslint@^9.37.0`
|
|
116
|
+
- `eslint-plugin-jest@^29.0.1`
|
|
117
|
+
- `husky@^9.1.7`
|
|
118
|
+
- `lint-staged@^16.2.4`
|
|
119
|
+
|
|
120
|
+
[1.8.0]: https://github.com/samuelho-dev/prisma-effect-kysely/compare/v1.7.2...v1.8.0
|
|
121
|
+
|
|
8
122
|
## [1.7.2] - 2025-10-12
|
|
9
123
|
|
|
10
124
|
### Fixed
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement through:
|
|
63
|
+
|
|
64
|
+
- GitHub Issues: For public discussions
|
|
65
|
+
- Email: Contact the maintainer listed in package.json
|
|
66
|
+
- GitHub Discussions: For community guidance
|
|
67
|
+
|
|
68
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
69
|
+
|
|
70
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
71
|
+
reporter of any incident.
|
|
72
|
+
|
|
73
|
+
## Enforcement Guidelines
|
|
74
|
+
|
|
75
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
76
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
77
|
+
|
|
78
|
+
### 1. Correction
|
|
79
|
+
|
|
80
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
81
|
+
unprofessional or unwelcome in the community.
|
|
82
|
+
|
|
83
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
84
|
+
clarity around the nature of the violation and an explanation of why the
|
|
85
|
+
behavior was inappropriate. A public apology may be requested.
|
|
86
|
+
|
|
87
|
+
### 2. Warning
|
|
88
|
+
|
|
89
|
+
**Community Impact**: A violation through a single incident or series of
|
|
90
|
+
actions.
|
|
91
|
+
|
|
92
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
93
|
+
interaction with the people involved, including unsolicited interaction with
|
|
94
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
95
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
96
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
97
|
+
ban.
|
|
98
|
+
|
|
99
|
+
### 3. Temporary Ban
|
|
100
|
+
|
|
101
|
+
**Community Impact**: A serious violation of community standards, including
|
|
102
|
+
sustained inappropriate behavior.
|
|
103
|
+
|
|
104
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
105
|
+
communication with the community for a specified period of time. No public or
|
|
106
|
+
private interaction with the people involved, including unsolicited interaction
|
|
107
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
108
|
+
Violating these terms may lead to a permanent ban.
|
|
109
|
+
|
|
110
|
+
### 4. Permanent Ban
|
|
111
|
+
|
|
112
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
113
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
114
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
115
|
+
|
|
116
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
117
|
+
community.
|
|
118
|
+
|
|
119
|
+
## Attribution
|
|
120
|
+
|
|
121
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
122
|
+
version 2.1, available at
|
|
123
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
124
|
+
|
|
125
|
+
Community Impact Guidelines were inspired by
|
|
126
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
127
|
+
|
|
128
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
129
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
130
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
131
|
+
|
|
132
|
+
[homepage]: https://www.contributor-covenant.org
|
|
133
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
134
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
135
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
136
|
+
[translations]: https://www.contributor-covenant.org/translations
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Contributing to prisma-effect-kysely
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- **Node.js**: >= 18.0.0
|
|
10
|
+
- **pnpm**: >= 8.0.0 (required - this project uses pnpm workspaces)
|
|
11
|
+
|
|
12
|
+
### Setup (< 5 minutes)
|
|
13
|
+
|
|
14
|
+
1. **Fork and Clone**
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/YOUR_USERNAME/prisma-effect-kysely.git
|
|
17
|
+
cd prisma-effect-kysely
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
2. **Install Dependencies**
|
|
21
|
+
```bash
|
|
22
|
+
pnpm install
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. **Run Tests**
|
|
26
|
+
```bash
|
|
27
|
+
pnpm test
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
4. **Build**
|
|
31
|
+
```bash
|
|
32
|
+
pnpm run build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
That's it! You're ready to contribute.
|
|
36
|
+
|
|
37
|
+
## 📋 Development Workflow
|
|
38
|
+
|
|
39
|
+
### Branch Strategy
|
|
40
|
+
|
|
41
|
+
- `main` - Production-ready code
|
|
42
|
+
- `feature/*` - New features
|
|
43
|
+
- `fix/*` - Bug fixes
|
|
44
|
+
- `docs/*` - Documentation updates
|
|
45
|
+
|
|
46
|
+
### Making Changes
|
|
47
|
+
|
|
48
|
+
1. **Create a branch**
|
|
49
|
+
```bash
|
|
50
|
+
git checkout -b feature/your-feature-name
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. **Make your changes**
|
|
54
|
+
- Follow the coding standards (enforced by ESLint/Prettier)
|
|
55
|
+
- Add tests for new functionality
|
|
56
|
+
- Update documentation if needed
|
|
57
|
+
|
|
58
|
+
3. **Run quality checks**
|
|
59
|
+
```bash
|
|
60
|
+
pnpm run lint # Check code style
|
|
61
|
+
pnpm run typecheck # Check TypeScript types
|
|
62
|
+
pnpm run test # Run tests
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
4. **Commit your changes**
|
|
66
|
+
```bash
|
|
67
|
+
git add .
|
|
68
|
+
git commit -m "feat: add amazing feature"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Note**: Pre-commit hooks will automatically run lint and format checks. Commits will be blocked if checks fail.
|
|
72
|
+
|
|
73
|
+
5. **Push and create PR**
|
|
74
|
+
```bash
|
|
75
|
+
git push origin feature/your-feature-name
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 🎯 Coding Standards
|
|
79
|
+
|
|
80
|
+
### TypeScript
|
|
81
|
+
|
|
82
|
+
- **Strict Mode**: All code must pass TypeScript strict mode
|
|
83
|
+
- **No Type Coercion**: Never use `as` or `any` unless absolutely necessary
|
|
84
|
+
- **Explicit Types**: Prefer explicit return types for public APIs
|
|
85
|
+
|
|
86
|
+
### Code Style
|
|
87
|
+
|
|
88
|
+
- **ESLint**: Configuration in `eslint.config.js`
|
|
89
|
+
- **Prettier**: Configuration in `.prettierrc.json`
|
|
90
|
+
- **Auto-fix**: Pre-commit hooks auto-fix most issues
|
|
91
|
+
|
|
92
|
+
Run manually:
|
|
93
|
+
```bash
|
|
94
|
+
pnpm run lint:fix # Fix linting issues
|
|
95
|
+
pnpm run format # Format all files
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Commit Messages
|
|
99
|
+
|
|
100
|
+
We follow [Conventional Commits](https://www.conventionalcommits.org/):
|
|
101
|
+
|
|
102
|
+
- `feat:` New feature
|
|
103
|
+
- `fix:` Bug fix
|
|
104
|
+
- `docs:` Documentation only
|
|
105
|
+
- `refactor:` Code refactoring
|
|
106
|
+
- `test:` Adding or updating tests
|
|
107
|
+
- `chore:` Maintenance tasks
|
|
108
|
+
|
|
109
|
+
**Examples:**
|
|
110
|
+
```bash
|
|
111
|
+
feat: add support for Decimal type mapping
|
|
112
|
+
fix: resolve UUID detection for Int fields
|
|
113
|
+
docs: update README with installation steps
|
|
114
|
+
test: add edge cases for enum generation
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 🧪 Testing
|
|
118
|
+
|
|
119
|
+
### Test Requirements
|
|
120
|
+
|
|
121
|
+
- **Coverage**: Maintain > 90% code coverage
|
|
122
|
+
- **Test Structure**: Use AAA pattern (Arrange, Act, Assert)
|
|
123
|
+
- **Naming**: Descriptive test names using `describe` and `it`
|
|
124
|
+
|
|
125
|
+
### Running Tests
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pnpm test # Run all tests
|
|
129
|
+
pnpm run test:watch # Watch mode
|
|
130
|
+
pnpm run test:coverage # Coverage report
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Writing Tests
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
describe('FeatureName', () => {
|
|
137
|
+
it('should handle expected input correctly', () => {
|
|
138
|
+
// Arrange
|
|
139
|
+
const input = ...
|
|
140
|
+
|
|
141
|
+
// Act
|
|
142
|
+
const result = ...
|
|
143
|
+
|
|
144
|
+
// Assert
|
|
145
|
+
expect(result).toBe(...)
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## 📦 Project Structure
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
src/
|
|
154
|
+
├── generator/ # Generator entry point and orchestration
|
|
155
|
+
│ ├── index.ts # Prisma generator handler
|
|
156
|
+
│ └── orchestrator.ts # Coordinates generation flow
|
|
157
|
+
├── prisma/ # Prisma domain logic (DMMF parsing)
|
|
158
|
+
│ ├── generator.ts # Prisma data extraction
|
|
159
|
+
│ ├── type.ts # Type utilities
|
|
160
|
+
│ ├── enum.ts # Enum utilities
|
|
161
|
+
│ └── relation.ts # Relation detection
|
|
162
|
+
├── effect/ # Effect Schema generation
|
|
163
|
+
│ ├── generator.ts # Effect schema orchestration
|
|
164
|
+
│ ├── type.ts # Type schema generation
|
|
165
|
+
│ ├── enum.ts # Enum schema generation
|
|
166
|
+
│ └── join-table.ts # Join table schemas
|
|
167
|
+
├── kysely/ # Kysely integration
|
|
168
|
+
│ ├── generator.ts # Kysely-specific generation
|
|
169
|
+
│ ├── type.ts # Kysely type mappings
|
|
170
|
+
│ └── helpers.ts # Runtime helpers (exported)
|
|
171
|
+
├── utils/ # Shared utilities
|
|
172
|
+
│ ├── naming.ts # Naming conventions
|
|
173
|
+
│ ├── templates.ts # Code formatting
|
|
174
|
+
│ └── annotations.ts # Custom type annotations
|
|
175
|
+
└── __tests__/ # Test files
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## 🔍 Architecture Principles
|
|
179
|
+
|
|
180
|
+
1. **Domain-Driven Design**: Separate Prisma, Effect, and Kysely concerns
|
|
181
|
+
2. **Zero Type Coercion**: Use exact DMMF types from Prisma
|
|
182
|
+
3. **Deterministic Output**: Alphabetically sorted for consistency
|
|
183
|
+
4. **Pure Functions**: No side effects in core logic
|
|
184
|
+
5. **Test-Driven Development**: Write tests before implementation
|
|
185
|
+
|
|
186
|
+
## 🐛 Reporting Bugs
|
|
187
|
+
|
|
188
|
+
1. **Search existing issues** to avoid duplicates
|
|
189
|
+
2. **Use the bug template** when creating an issue
|
|
190
|
+
3. **Include**:
|
|
191
|
+
- Minimal reproduction case
|
|
192
|
+
- Expected vs actual behavior
|
|
193
|
+
- Your environment (Node, pnpm, Prisma versions)
|
|
194
|
+
- Relevant schema snippet
|
|
195
|
+
|
|
196
|
+
## ✨ Requesting Features
|
|
197
|
+
|
|
198
|
+
1. **Check existing feature requests** first
|
|
199
|
+
2. **Open a discussion** to gather feedback
|
|
200
|
+
3. **Explain the use case** and why it's valuable
|
|
201
|
+
4. **Consider contributing** the implementation!
|
|
202
|
+
|
|
203
|
+
## 📝 Documentation
|
|
204
|
+
|
|
205
|
+
- **README**: User-facing documentation
|
|
206
|
+
- **CLAUDE.md**: Developer/AI assistant instructions
|
|
207
|
+
- **Code Comments**: For complex logic only
|
|
208
|
+
- **JSDoc**: For public APIs
|
|
209
|
+
|
|
210
|
+
## 🔐 Security
|
|
211
|
+
|
|
212
|
+
See [SECURITY.md](SECURITY.md) for reporting security vulnerabilities.
|
|
213
|
+
|
|
214
|
+
## ✅ Pull Request Checklist
|
|
215
|
+
|
|
216
|
+
Before submitting your PR, ensure:
|
|
217
|
+
|
|
218
|
+
- [ ] Code follows project style (ESLint/Prettier pass)
|
|
219
|
+
- [ ] All tests pass (`pnpm test`)
|
|
220
|
+
- [ ] TypeScript compiles (`pnpm run typecheck`)
|
|
221
|
+
- [ ] Test coverage maintained (> 90%)
|
|
222
|
+
- [ ] New features have tests
|
|
223
|
+
- [ ] Breaking changes are documented
|
|
224
|
+
- [ ] Commit messages follow conventional commits
|
|
225
|
+
- [ ] PR description explains changes clearly
|
|
226
|
+
|
|
227
|
+
## 🎉 Recognition
|
|
228
|
+
|
|
229
|
+
Contributors will be:
|
|
230
|
+
- Listed in release notes
|
|
231
|
+
- Credited in CHANGELOG.md
|
|
232
|
+
- Added to GitHub contributors list
|
|
233
|
+
|
|
234
|
+
## 📞 Getting Help
|
|
235
|
+
|
|
236
|
+
- **Questions**: Open a GitHub Discussion
|
|
237
|
+
- **Bugs**: Open a GitHub Issue
|
|
238
|
+
- **Security**: See SECURITY.md
|
|
239
|
+
- **Chat**: GitHub Discussions
|
|
240
|
+
|
|
241
|
+
## 📜 License
|
|
242
|
+
|
|
243
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
**Thank you for contributing! Every contribution, no matter how small, is valued and appreciated.** 🙏
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
We release security updates for the following versions:
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
| ------- | ------------------ |
|
|
9
|
+
| 1.7.x | :white_check_mark: |
|
|
10
|
+
| 1.6.x | :white_check_mark: |
|
|
11
|
+
| < 1.6 | :x: |
|
|
12
|
+
|
|
13
|
+
## Reporting a Vulnerability
|
|
14
|
+
|
|
15
|
+
We take security vulnerabilities seriously. If you discover a security issue in prisma-effect-kysely, please report it responsibly.
|
|
16
|
+
|
|
17
|
+
### How to Report
|
|
18
|
+
|
|
19
|
+
**Please DO NOT report security vulnerabilities through public GitHub issues.**
|
|
20
|
+
|
|
21
|
+
Instead, please report security vulnerabilities by:
|
|
22
|
+
|
|
23
|
+
1. **Email**: Send details to the maintainer at the email listed in package.json
|
|
24
|
+
2. **GitHub Security Advisories**: Use the [Security Advisories](https://github.com/samuelho-dev/prisma-effect-kysely/security/advisories/new) feature
|
|
25
|
+
|
|
26
|
+
### What to Include
|
|
27
|
+
|
|
28
|
+
Please include the following information in your report:
|
|
29
|
+
|
|
30
|
+
- Type of vulnerability (e.g., code injection, XSS, etc.)
|
|
31
|
+
- Full paths of affected source file(s)
|
|
32
|
+
- Location of the affected source code (tag/branch/commit or direct URL)
|
|
33
|
+
- Step-by-step instructions to reproduce the issue
|
|
34
|
+
- Proof-of-concept or exploit code (if possible)
|
|
35
|
+
- Impact of the vulnerability, including how an attacker might exploit it
|
|
36
|
+
|
|
37
|
+
### Response Timeline
|
|
38
|
+
|
|
39
|
+
- **Initial Response**: Within 48 hours
|
|
40
|
+
- **Confirmation**: Within 7 days (whether we can reproduce the issue)
|
|
41
|
+
- **Fix Timeline**: Depends on severity
|
|
42
|
+
- **Critical**: Within 7 days
|
|
43
|
+
- **High**: Within 14 days
|
|
44
|
+
- **Medium**: Within 30 days
|
|
45
|
+
- **Low**: Next planned release
|
|
46
|
+
|
|
47
|
+
### Disclosure Policy
|
|
48
|
+
|
|
49
|
+
- We will work with you to understand and resolve the issue
|
|
50
|
+
- We ask that you do not disclose the vulnerability publicly until we've had a chance to address it
|
|
51
|
+
- Once fixed, we will credit you in the release notes (unless you prefer to remain anonymous)
|
|
52
|
+
- We will publish a security advisory on GitHub
|
|
53
|
+
|
|
54
|
+
## Security Best Practices for Users
|
|
55
|
+
|
|
56
|
+
When using prisma-effect-kysely:
|
|
57
|
+
|
|
58
|
+
1. **Keep Updated**: Always use the latest version to get security patches
|
|
59
|
+
2. **Review Generated Code**: Inspect generated schemas for your use case
|
|
60
|
+
3. **Validate Inputs**: Use Effect Schema's validation features on user inputs
|
|
61
|
+
4. **Dependencies**: Keep Prisma, Effect, and other dependencies up to date
|
|
62
|
+
5. **Custom Types**: Be cautious when using `@customType` annotations with untrusted input patterns
|
|
63
|
+
|
|
64
|
+
## Security Features
|
|
65
|
+
|
|
66
|
+
- **Type Safety**: Zero type coercion prevents type confusion vulnerabilities
|
|
67
|
+
- **Input Validation**: Generated Effect Schemas provide runtime validation
|
|
68
|
+
- **No Code Execution**: Generator only produces type definitions, no executable code
|
|
69
|
+
- **Dependency Security**: Minimal dependency tree (4 production dependencies)
|
|
70
|
+
- **NPM Provenance**: All releases include provenance for supply chain security
|
|
71
|
+
|
|
72
|
+
## Automated Security
|
|
73
|
+
|
|
74
|
+
- **Renovate**: Automated dependency updates configured
|
|
75
|
+
- **CI Security Checks**: `pnpm audit` runs on every commit
|
|
76
|
+
- **GitHub Security**: Dependabot alerts enabled
|
|
77
|
+
|
|
78
|
+
## Contact
|
|
79
|
+
|
|
80
|
+
For security-related questions that are not vulnerabilities, please open a regular GitHub issue or discussion.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAMrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;GAEG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI,CAAC,QAAQ;IAEhD;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,IAAI,CAAC,aAAa,EAAE;IAIlD;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;IAgBnE;;OAEG;IACH,0BAA0B,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK;IAO5C;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK;IAiBrC;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE;IAQ3D;;;;OAIG;IACH,mBAAmB,CAAC,QAAQ,EAAE,OAAO;IAyBrC;;OAEG;IACH,wBAAwB,CAAC,UAAU,EAAE,aAAa,EAAE;CAGrD"}
|
package/dist/effect/generator.js
CHANGED
|
@@ -97,9 +97,7 @@ export type ${name}UpdateEncoded = Schema.Schema.Encoded<typeof ${name}.Updateab
|
|
|
97
97
|
* Generate schemas for all join tables
|
|
98
98
|
*/
|
|
99
99
|
generateJoinTableSchemas(joinTables) {
|
|
100
|
-
return joinTables
|
|
101
|
-
.map((jt) => (0, join_table_1.generateJoinTableSchema)(jt, this.dmmf))
|
|
102
|
-
.join('\n\n');
|
|
100
|
+
return joinTables.map((jt) => (0, join_table_1.generateJoinTableSchema)(jt, this.dmmf)).join('\n\n');
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
exports.EffectGenerator = EffectGenerator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/effect/generator.ts"],"names":[],"mappings":";;;AACA,iCAA2C;A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CAAC;QAED,OAAO,GAAG,MAAM,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,wBAAwB,CAAC,UAA2B;QAClD,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAA,oCAAuB,EAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrF,CAAC;CACF;AA1GD,0CA0GC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DMMF } from
|
|
2
|
-
import type { JoinTableInfo } from
|
|
1
|
+
import type { DMMF } from '@prisma/generator-helper';
|
|
2
|
+
import type { JoinTableInfo } from '../prisma/relation';
|
|
3
3
|
/**
|
|
4
4
|
* Generate Effect Schema for an implicit many-to-many join table
|
|
5
5
|
*
|
|
@@ -9,5 +9,5 @@ import type { JoinTableInfo } from "../prisma/relation";
|
|
|
9
9
|
* - Type exports (Select, Insert, Update)
|
|
10
10
|
* - Encoded type exports
|
|
11
11
|
*/
|
|
12
|
-
export declare function generateJoinTableSchema(joinTable: JoinTableInfo,
|
|
12
|
+
export declare function generateJoinTableSchema(joinTable: JoinTableInfo, _dmmf: DMMF.Document): string;
|
|
13
13
|
//# sourceMappingURL=join-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-table.d.ts","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"join-table.d.ts","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAoBxD;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,GAAG,MAAM,CAiC9F"}
|
|
@@ -6,15 +6,15 @@ exports.generateJoinTableSchema = generateJoinTableSchema;
|
|
|
6
6
|
* Uses same mapping as regular fields
|
|
7
7
|
*/
|
|
8
8
|
function mapColumnType(columnType, isUuid) {
|
|
9
|
-
if (columnType ===
|
|
10
|
-
return
|
|
9
|
+
if (columnType === 'String' && isUuid) {
|
|
10
|
+
return 'Schema.UUID';
|
|
11
11
|
}
|
|
12
12
|
const scalarMap = {
|
|
13
|
-
String:
|
|
14
|
-
Int:
|
|
15
|
-
BigInt:
|
|
13
|
+
String: 'Schema.String',
|
|
14
|
+
Int: 'Schema.Number',
|
|
15
|
+
BigInt: 'Schema.BigInt',
|
|
16
16
|
};
|
|
17
|
-
return scalarMap[columnType] ||
|
|
17
|
+
return scalarMap[columnType] || 'Schema.Unknown';
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Generate Effect Schema for an implicit many-to-many join table
|
|
@@ -25,7 +25,7 @@ function mapColumnType(columnType, isUuid) {
|
|
|
25
25
|
* - Type exports (Select, Insert, Update)
|
|
26
26
|
* - Encoded type exports
|
|
27
27
|
*/
|
|
28
|
-
function generateJoinTableSchema(joinTable,
|
|
28
|
+
function generateJoinTableSchema(joinTable, _dmmf) {
|
|
29
29
|
const { tableName, relationName, columnAType, columnBType, columnAIsUuid, columnBIsUuid } = joinTable;
|
|
30
30
|
// Map column types to Effect Schema types
|
|
31
31
|
const columnASchema = mapColumnType(columnAType, columnAIsUuid);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"join-table.js","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"join-table.js","sourceRoot":"","sources":["../../src/effect/join-table.ts"],"names":[],"mapp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,CAAC;IAEpG,OAAO,GAAG,UAAU,OAAO,iBAAiB,OAAO,WAAW,KAAK,cAAc,EAAE,CAAC;AACtF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":";AAOA,cAAc,mBAAmB,CAAC;AAElC,eAAO,MAAM,SAAS,MAUpB,CAAC"}
|
package/dist/generator/index.js
CHANGED
|
@@ -14,15 +14,19 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
14
14
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
17
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
21
|
exports.generator = void 0;
|
|
19
22
|
const generator_helper_1 = require("@prisma/generator-helper");
|
|
20
23
|
const orchestrator_1 = require("./orchestrator");
|
|
24
|
+
const package_json_1 = __importDefault(require("../../package.json"));
|
|
21
25
|
// Re-export kysely helpers for generated code
|
|
22
26
|
__exportStar(require("../kysely/helpers"), exports);
|
|
23
27
|
exports.generator = (0, generator_helper_1.generatorHandler)({
|
|
24
28
|
onManifest: () => ({
|
|
25
|
-
version:
|
|
29
|
+
version: package_json_1.default.version,
|
|
26
30
|
defaultOutput: './generated',
|
|
27
31
|
prettyName: 'Prisma Effect Kysely Generator',
|
|
28
32
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generator/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,+DAA4D;AAC5D,iDAAuD;AACvD,sEAA6C;AAE7C,8CAA8C;AAC9C,oDAAkC;AAErB,QAAA,SAAS,GAAG,IAAA,mCAAgB,EAAC;IACxC,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QACjB,OAAO,EAAE,sBAAW,CAAC,OAAO;QAC5B,aAAa,EAAE,aAAa;QAC5B,UAAU,EAAE,gCAAgC;KAC7C,CAAC;IACF,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAC5B,MAAM,YAAY,GAAG,IAAI,oCAAqB,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DMMF } from
|
|
2
|
-
import type { JoinTableInfo } from
|
|
1
|
+
import type { DMMF } from '@prisma/generator-helper';
|
|
2
|
+
import type { JoinTableInfo } from '../prisma/relation';
|
|
3
3
|
/**
|
|
4
4
|
* Kysely domain generator - orchestrates Kysely integration
|
|
5
5
|
* Applies Kysely helpers to Effect schemas
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/kysely/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/kysely/generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;GAGG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,IAAI,CAAC,QAAQ;IAEhD;;OAEG;IACH,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK;IAUzC;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE;IAMjD;;OAEG;IACH,mBAAmB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE,EAAE,UAAU,GAAE,aAAa,EAAO;IAInF;;OAEG;IACH,iBAAiB;CAGlB"}
|
package/dist/kysely/generator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/kysely/generator.ts"],"names":[],"mappings":";;;AACA,iCAAmE;AACnE,yCAAgD;
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/kysely/generator.ts"],"names":[],"mappings":";;;AACA,iCAAmE;AACnE,yCAAgD;AAGhD;;;GAGG;AACH,MAAa,eAAe;IAC1B,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD;;OAEG;IACH,uBAAuB,CAAC,KAAiB;QACvC,uBAAuB;QACvB,MAAM,aAAa,GAAG,IAAA,qBAAc,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAEvD,gCAAgC;QAChC,MAAM,eAAe,GAAG,IAAA,2BAAoB,EAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QAEnE,OAAO,KAAK,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;IAC/C,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,MAA6B;QAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;aACtB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;aACnD,IAAI,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,MAA6B,EAAE,aAA8B,EAAE;QACjF,OAAO,IAAA,0BAAmB,EAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,oDAAoD,CAAC;IAC9D,CAAC;CACF;AAtCD,0CAsCC"}
|
package/dist/kysely/helpers.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,eAAe,CAAC;AACnC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEjE;;;GAGG;AAEH,eAAO,MAAM,YAAY,eAA8B,CAAC;AACxD,eAAO,MAAM,WAAW,eAA6B,CAAC;AActD;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EACtF,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,EAC3C,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,EAC3C,cAAc,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,kCAS5C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,iCAOjF,CAAC;AAEF;;GAEG;AACH,eAAO,MA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AM,WAAW,QAAQ,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3D,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IAC3C,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;CAC5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,iDAAmC;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/kysely/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AACxC,iDAAmC;AAGnC;;;GAGG;AAEU,QAAA,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC3C,QAAA,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AActD;;;GAGG;AACI,MAAM,UAAU,GAAG,CACxB,YAA2C,EAC3C,YAA2C,EAC3C,YAA2C,EAC3C,EAAE;IACF,MAAM,OAAO,GACX;QACE,YAAY;QACZ,YAAY;QACZ,YAAY;KACb,CAAC;IACJ,OAAO,YAAY,CAAC,WAAW,CAAC,EAAE,CAAC,oBAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AAC/D,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAEF;;;GAGG;AACI,MAAM,SAAS,GAAG,CAAqB,MAAoC,EAAE,EAAE;IACpF,MAAM,OAAO,GAAyC;QACpD,YAAY,EAAE,MA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,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;CACxB;AAqBD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"relation.d.ts","sourceRoot":"","sources":["../../src/prisma/relation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAGrD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;IACvB,iCAAiC;IACjC,aAAa,EAAE,OAAO,CAAC;CACxB;AAqBD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAiB7D;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,IAAI,CAAC,KAAK,EAAE,GAAG,aAAa,EAAE,CAmEvF"}
|
package/dist/prisma/relation.js
CHANGED
|
@@ -12,7 +12,7 @@ const type_1 = require("./type");
|
|
|
12
12
|
* - relationToFields is empty (no explicit relation table)
|
|
13
13
|
*/
|
|
14
14
|
function isImplicitManyToManyField(field) {
|
|
15
|
-
return (field.kind ===
|
|
15
|
+
return (field.kind === 'object' &&
|
|
16
16
|
field.isList === true &&
|
|
17
17
|
field.relationFromFields !== undefined &&
|
|
18
18
|
field.relationFromFields.length === 0 &&
|
|
@@ -65,19 +65,27 @@ function detectImplicitManyToMany(models) {
|
|
|
65
65
|
if (model.name === relatedModel.name) {
|
|
66
66
|
continue;
|
|
67
67
|
}
|
|
68
|
-
//
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
// Use Prisma's relation name for table naming
|
|
69
|
+
// For custom @relation("name"), Prisma creates _name
|
|
70
|
+
// For default relations, Prisma creates _ModelAToModelB
|
|
71
|
+
// Note: relationName should always be defined for implicit m-n relations
|
|
72
|
+
if (!field.relationName) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
const tableName = `_${field.relationName}`;
|
|
76
|
+
const relationName = field.relationName;
|
|
71
77
|
// Skip if we've already processed this relation
|
|
72
|
-
if (joinTables.has(
|
|
78
|
+
if (joinTables.has(relationName)) {
|
|
73
79
|
continue;
|
|
74
80
|
}
|
|
81
|
+
// Keep alphabetical ordering for A/B column assignment
|
|
82
|
+
const modelNames = [model.name, relatedModel.name].sort();
|
|
75
83
|
// Extract ID field types
|
|
76
84
|
const modelAIdField = getModelIdField(models.find((m) => m.name === modelNames[0]));
|
|
77
85
|
const modelBIdField = getModelIdField(models.find((m) => m.name === modelNames[1]));
|
|
78
|
-
joinTables.set(
|
|
86
|
+
joinTables.set(relationName, {
|
|
79
87
|
tableName,
|
|
80
|
-
relationName
|
|
88
|
+
relationName,
|
|
81
89
|
modelA: modelNames[0],
|
|
82
90
|
modelB: modelNames[1],
|
|
83
91
|
columnAType: modelAIdField.type,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../src/prisma/relation.ts"],"names":[],"mappings":";;AAgDA,
|
|
1
|
+
{"version":3,"file":"relation.js","sourceRoot":"","sources":["../../src/pris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C,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;YAE1D,yBAAyB;YACzB,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;YACrF,MAAM,aAAa,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;YAErF,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE;gBAC3B,SAAS;gBACT,YAAY;gBACZ,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;gBACrB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;gBACrB,WAAW,EAAE,aAAa,CAAC,IAAI;gBAC/B,WAAW,EAAE,aAAa,CAAC,IAAI;gBAC/B,aAAa,EAAE,IAAA,kBAAW,EAAC,aAAa,CAAC;gBACzC,aAAa,EAAE,IAAA,kBAAW,EAAC,aAAa,CAAC;aAC1C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;AACzC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prisma-effect-kysely",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Prisma generator that creates Effect Schema types from Prisma schema compatible with Kysely",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Samuel Ho",
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
"dist",
|
|
20
20
|
"README.md",
|
|
21
21
|
"LICENSE",
|
|
22
|
-
"CHANGELOG.md"
|
|
22
|
+
"CHANGELOG.md",
|
|
23
|
+
"SECURITY.md",
|
|
24
|
+
"CODE_OF_CONDUCT.md",
|
|
25
|
+
"CONTRIBUTING.md"
|
|
23
26
|
],
|
|
24
27
|
"sideEffects": false,
|
|
25
28
|
"keywords": [
|
|
@@ -47,12 +50,22 @@
|
|
|
47
50
|
"packageManager": "pnpm@10.0.0",
|
|
48
51
|
"scripts": {
|
|
49
52
|
"build": "tsc -p tsconfig.lib.json",
|
|
50
|
-
"prepare": "
|
|
53
|
+
"prepare": "husky",
|
|
51
54
|
"test": "jest",
|
|
52
55
|
"test:watch": "jest --watch",
|
|
53
56
|
"test:coverage": "jest --coverage",
|
|
54
57
|
"typecheck": "tsc --noEmit -p tsconfig.lib.json",
|
|
55
|
-
"
|
|
58
|
+
"lint": "eslint .",
|
|
59
|
+
"lint:fix": "eslint . --fix",
|
|
60
|
+
"format": "prettier --write .",
|
|
61
|
+
"format:check": "prettier --check .",
|
|
62
|
+
"prepublishOnly": "npm run lint && npm run typecheck && npm run test && npm run build"
|
|
63
|
+
},
|
|
64
|
+
"lint-staged": {
|
|
65
|
+
"*.ts": [
|
|
66
|
+
"eslint --fix",
|
|
67
|
+
"prettier --write"
|
|
68
|
+
]
|
|
56
69
|
},
|
|
57
70
|
"dependencies": {
|
|
58
71
|
"@prisma/client": "6.16.3",
|
|
@@ -70,14 +83,24 @@
|
|
|
70
83
|
}
|
|
71
84
|
},
|
|
72
85
|
"devDependencies": {
|
|
86
|
+
"@eslint/js": "^9.37.0",
|
|
73
87
|
"@prisma/internals": "^6.17.0",
|
|
74
88
|
"@types/jest": "^29.5.14",
|
|
75
89
|
"@types/node": "^22.18.8",
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^8.46.0",
|
|
91
|
+
"@typescript-eslint/parser": "^8.46.0",
|
|
92
|
+
"eslint": "^9.37.0",
|
|
93
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
94
|
+
"eslint-plugin-import": "^2.32.0",
|
|
95
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
96
|
+
"husky": "^9.1.7",
|
|
76
97
|
"jest": "^29.7.0",
|
|
77
98
|
"kysely": "^0.28.7",
|
|
99
|
+
"lint-staged": "^16.2.4",
|
|
78
100
|
"prisma": "^6.17.0",
|
|
79
101
|
"ts-jest": "^29.4.4",
|
|
80
102
|
"ts-node": "^10.9.2",
|
|
81
|
-
"typescript": "^5.9.3"
|
|
103
|
+
"typescript": "^5.9.3",
|
|
104
|
+
"typescript-eslint": "^8.46.0"
|
|
82
105
|
}
|
|
83
106
|
}
|