Skip to content

Commit b39fa41

Browse files
authored
Merge branch 'master' into fix/postgres-upsert
2 parents 4f9e3a9 + 35ca51a commit b39fa41

198 files changed

Lines changed: 25970 additions & 36792 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/FUNDING.yml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
11
# These are supported funding model platforms
22

3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4-
patreon: # Replace with a single Patreon username
53
open_collective: typeorm
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
custom: # Replace with a single custom sponsorship URL

‎.github/copilot-instructions.md‎

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,17 @@ TypeORM is a TypeScript-based Object-Relational Mapping (ORM) library that suppo
3939
### Code Style
4040

4141
- **Formatting**: Use Prettier with these settings:
42-
- No semicolons (`"semi": false`)
43-
- Arrow function parentheses always (`"arrowParens": "always"`)
44-
- Trailing commas everywhere (`"trailingComma": "all"`)
42+
- No semicolons (`"semi": false`)
4543
- **Linting**: ESLint with TypeScript support
46-
- Use `@typescript-eslint` rules
47-
- Warnings allowed for some `@typescript-eslint/no-*` rules
48-
- Unused variables starting with `_` are ignored
44+
- Use `@typescript-eslint` rules
45+
- Warnings allowed for some `@typescript-eslint/no-*` rules
46+
- Unused variables starting with `_` are ignored
4947
- **Naming Conventions**:
50-
- Classes: PascalCase (e.g., `DataSource`, `EntityManager`)
51-
- Interfaces: PascalCase (e.g., `ColumnOptions`, `RelationOptions`)
52-
- Variables/functions: camelCase
53-
- Constants: UPPER_SNAKE_CASE for true constants
54-
- Private members: Use standard camelCase (no underscore prefix)
48+
- Classes: PascalCase (e.g., `DataSource`, `EntityManager`)
49+
- Interfaces: PascalCase (e.g., `ColumnOptions`, `RelationOptions`)
50+
- Variables/functions: camelCase
51+
- Constants: UPPER_SNAKE_CASE for true constants
52+
- Private members: Use standard camelCase (no underscore prefix)
5553

5654
### TypeScript Patterns
5755

@@ -67,6 +65,7 @@ TypeORM is a TypeScript-based Object-Relational Mapping (ORM) library that suppo
6765
### Test Structure
6866

6967
Tests are organized in `test/` directory:
68+
7069
- **`test/functional/`** - Feature and integration tests organized by functionality (preferred)
7170
- **`test/github-issues/`** - Tests for specific GitHub issues
7271
- **`test/unit/`** - Unit tests for individual components
@@ -77,50 +76,62 @@ Tests are organized in `test/` directory:
7776
### Test Writing Guidelines
7877

7978
1. **Use the standard test template**:
79+
8080
```typescript
81+
import { expect } from "chai"
8182
import "reflect-metadata"
82-
import { createTestingConnections, closeTestingConnections, reloadTestingDatabases } from "../../utils/test-utils"
83+
import {
84+
closeTestingConnections,
85+
createTestingConnections,
86+
reloadTestingDatabases,
87+
} from "../../utils/test-utils"
8388
import { DataSource } from "../../../src/data-source/DataSource"
84-
import { expect } from "chai"
8589

8690
describe("description of functionality", () => {
8791
let dataSources: DataSource[]
88-
before(async () => dataSources = await createTestingConnections({
89-
entities: [__dirname + "/entity/*{.js,.ts}"],
90-
schemaCreate: true,
91-
dropSchema: true,
92-
}))
92+
before(
93+
async () =>
94+
(dataSources = await createTestingConnections({
95+
entities: [__dirname + "/entity/*{.js,.ts}"],
96+
schemaCreate: true,
97+
dropSchema: true,
98+
})),
99+
)
93100
beforeEach(() => reloadTestingDatabases(dataSources))
94101
after(() => closeTestingConnections(dataSources))
95102

96-
it("should do something specific", () => Promise.all(dataSources.map(async dataSource => {
97-
// Test implementation
98-
})))
103+
it("should do something specific", () =>
104+
Promise.all(
105+
dataSources.map(async (dataSource) => {
106+
// Test implementation
107+
}),
108+
))
99109
})
100110
```
101111

102112
2. **Test Configuration**:
103-
- Tests run against multiple databases (as configured in `ormconfig.json`)
104-
- Each test should work across all supported databases unless database-specific
105-
- Place entity files in `./entity/` relative to test file for automatic loading
106-
- Use `Promise.all(dataSources.map(...))` pattern to test against all databases
113+
- Tests run against multiple databases (as configured in `ormconfig.json`)
114+
- Each test should work across all supported databases unless database-specific
115+
- Place entity files in `./entity/` relative to test file for automatic loading
116+
- Use `Promise.all(dataSources.map(...))` pattern to test against all databases
107117

108118
3. **Test Naming**:
109-
- Use descriptive `describe()` blocks for features
110-
- Use "should..." format for `it()` descriptions
111-
- Reference GitHub issue numbers when fixing specific issues
119+
- Use descriptive `describe()` blocks for features
120+
- Use "should..." format for `it()` descriptions
121+
- Reference GitHub issue numbers when fixing specific issues
112122

113123
4. **Running Tests**:
114-
- Full test suite: `npm test` (compiles then runs tests)
115-
- Fast iteration: `npm run test:fast` (runs without recompiling)
116-
- Specific tests: `npm run test:fast -- --grep "pattern"`
117-
- Watch mode: `npm run compile -- --watch` + `npm run test:fast`
124+
- Full test suite: `pnpm run test` (compiles then runs tests)
125+
- Fast iteration: `pnpm run test:fast` (runs without recompiling)
126+
- Specific tests: `pnpm run test:fast -- --grep "pattern"`
127+
- Watch mode: `pnpm run compile -- --watch` + `pnpm run test:fast`
118128

119129
## Database-Specific Considerations
120130

121131
### Multi-Database Support
122132

123133
When writing code or tests:
134+
124135
- Ensure compatibility across all supported databases
125136
- Use driver-specific code only in `src/driver/` directory
126137
- Test database-agnostic code against multiple databases
@@ -130,6 +141,7 @@ When writing code or tests:
130141
### Driver Implementation
131142

132143
Each driver in `src/driver/` implements common interfaces:
144+
133145
- Connection management
134146
- Query execution
135147
- Schema synchronization
@@ -168,20 +180,20 @@ Each driver in `src/driver/` implements common interfaces:
168180

169181
### Commands
170182

171-
- **Build**: `npm run compile` - Compiles TypeScript to `build/compiled/`
172-
- **Package**: `npm run package` - Creates distribution in `build/package/`
173-
- **Pack**: `npm run pack` - Creates `.tgz` file in `build/`
174-
- **Test**: `npm test` - Compile and run all tests
175-
- **Lint**: `npm run lint` - Run ESLint
176-
- **Format**: `npm run format` - Run Prettier
177-
- **Watch**: `npm run watch` - Watch mode for TypeScript compilation
183+
- **Build**: `pnpm run compile` - Compiles TypeScript to `build/compiled/`
184+
- **Package**: `pnpm run package` - Creates distribution in `build/package/`
185+
- **Pack**: `pnpm pack` - Creates `.tgz` file in `build/`
186+
- **Test**: `pnpm run test` - Compile and run all tests
187+
- **Lint**: `pnpm run lint` - Run ESLint
188+
- **Format**: `pnpm run format` - Run Prettier
189+
- **Watch**: `pnpm run watch` - Watch mode for TypeScript compilation
178190

179191
### Development Setup
180192

181-
1. Install dependencies: `npm install`
193+
1. Install dependencies: `pnpm install`
182194
2. Copy config: `cp ormconfig.sample.json ormconfig.json`
183195
3. Configure database connections in `ormconfig.json`
184-
4. Optionally use Docker: `docker-compose up` for database services
196+
4. Optionally use Docker: `docker compose up` for database services
185197

186198
### Pre-commit Hooks
187199

@@ -194,6 +206,7 @@ Each driver in `src/driver/` implements common interfaces:
194206
### Commit Message Format
195207

196208
Follow conventional commits:
209+
197210
```
198211
<type>: <subject>
199212
@@ -204,7 +217,8 @@ Follow conventional commits:
204217

205218
**Types**: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `chore`, `revert`
206219

207-
**Subject**:
220+
**Subject**:
221+
208222
- Use imperative, present tense
209223
- Don't capitalize first letter
210224
- No period at the end
@@ -232,7 +246,7 @@ export class User {
232246
@Column()
233247
name: string
234248

235-
@OneToMany(() => Photo, photo => photo.user)
249+
@OneToMany(() => Photo, (photo) => photo.user)
236250
photos: Photo[]
237251
}
238252
```

‎.github/workflows/codeql.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@v5
26+
uses: actions/checkout@v6
2727

2828
- name: Initialize CodeQL
2929
uses: github/codeql-action/init@v3

‎.github/workflows/docsearch.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ name: Index docs to Typesense
33
on:
44
push:
55
branches:
6-
- master
6+
- v0.3
77

88
jobs:
99
index-docs:
1010
if: ${{ !github.event.repository.fork }}
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v5
14+
- uses: actions/checkout@v6
1515
- name: Delete unaliased collections
1616
env:
1717
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: mutation-testing
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 1 * *"
7+
8+
jobs:
9+
mutation-testing:
10+
runs-on: ubuntu-latest
11+
12+
services:
13+
mysql:
14+
image: mysql:5.7.37
15+
ports:
16+
- "3306:3306"
17+
env:
18+
MYSQL_ROOT_PASSWORD: "admin"
19+
MYSQL_USER: "test"
20+
MYSQL_PASSWORD: "test"
21+
MYSQL_DATABASE: "test"
22+
mariadb:
23+
image: mariadb:10.10.3
24+
ports:
25+
- "3307:3306"
26+
env:
27+
MYSQL_ROOT_PASSWORD: "admin"
28+
MYSQL_USER: "test"
29+
MYSQL_PASSWORD: "test"
30+
MYSQL_DATABASE: "test"
31+
postgres:
32+
image: ghcr.io/naorpeled/typeorm-postgres:pg17-postgis3-pgvectorv0.8.0
33+
ports:
34+
- "5432:5432"
35+
env:
36+
POSTGRES_USERNAME: postgres
37+
POSTGRES_PASSWORD: postgres
38+
POSTGRES_DB: postgres
39+
options: >-
40+
--health-cmd pg_isready
41+
--health-interval 10s
42+
--health-timeout 5s
43+
--health-retries 5
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: pnpm/action-setup@v4
48+
- uses: actions/setup-node@v6
49+
with:
50+
node-version: 24
51+
cache: "pnpm"
52+
- run: pnpm install
53+
- run: cp .github/workflows/test/mutation-testing.ormconfig.json ormconfig.json
54+
- run: pnpm exec stryker run
55+
env:
56+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
57+
58+
- uses: actions/upload-artifact@v4
59+
with:
60+
name: mutation-testing
61+
path: ./reports/mutation/mutation.html
62+

‎.github/workflows/preview.yml‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,15 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
steps:
18-
- uses: actions/checkout@v5
18+
- uses: actions/checkout@v6
1919
with:
2020
fetch-depth: 0
21-
22-
- name: Use Node.js
23-
uses: actions/setup-node@v5
21+
- uses: pnpm/action-setup@v4
22+
- uses: actions/setup-node@v6
2423
with:
25-
node-version-file: .nvmrc
26-
27-
- name: Install dependencies
28-
run: npm ci
29-
30-
- name: Build
31-
run: npm run package
24+
node-version: 20
25+
cache: "pnpm"
3226

33-
- name: Release preview version
34-
run: npm run publish:preview
27+
- run: pnpm install
28+
- run: pnpm run package
29+
- run: pnpm run publish:preview

‎.github/workflows/publish-package.yml‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ jobs:
1111
contents: read
1212
id-token: write
1313
steps:
14-
- uses: actions/checkout@v5
15-
- uses: actions/setup-node@v5
14+
- uses: actions/checkout@v6
15+
- uses: pnpm/action-setup@v4
16+
- uses: actions/setup-node@v6
1617
with:
17-
node-version-file: .nvmrc
18+
node-version: 20
1819
registry-url: "https://registry.npmjs.org"
19-
- run: npm ci
20-
- run: npm run package
20+
cache: "pnpm"
21+
22+
- run: pnpm install
23+
- run: pnpm run package
2124
- run: |
2225
cd build/package
23-
npm publish --provenance --access public
26+
pnpm publish --provenance --access public
2427
env:
2528
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[
2+
{
3+
"skip": false,
4+
"name": "better-sqlite3",
5+
"type": "better-sqlite3",
6+
"database": "./temp/better-sqlite3db.db",
7+
"logging": false
8+
},
9+
{
10+
"skip": false,
11+
"name": "mysql",
12+
"type": "mysql",
13+
"host": "localhost",
14+
"port": 3306,
15+
"username": "root",
16+
"password": "admin",
17+
"database": "test",
18+
"logging": false
19+
},
20+
{
21+
"skip": false,
22+
"name": "mariadb",
23+
"type": "mariadb",
24+
"host": "localhost",
25+
"port": 3307,
26+
"username": "root",
27+
"password": "admin",
28+
"database": "test",
29+
"logging": false
30+
},
31+
{
32+
"skip": false,
33+
"name": "postgres",
34+
"type": "postgres",
35+
"host": "localhost",
36+
"port": 5432,
37+
"username": "postgres",
38+
"password": "postgres",
39+
"database": "postgres",
40+
"logging": false
41+
},
42+
{
43+
"skip": false,
44+
"name": "sqlite",
45+
"type": "sqlite",
46+
"database": "./temp/sqlitedb-1.db",
47+
"logging": false,
48+
"relationLoadStrategy": "join"
49+
},
50+
{
51+
"skip": false,
52+
"name": "sqljs",
53+
"type": "sqljs",
54+
"logging": false
55+
}
56+
]

0 commit comments

Comments
 (0)