Skip to content

Commit 8e04093

Browse files
authored
fix: update dependencies to allow last version of Prisma client (6.10) (#62)(@flemaitre33)
* fix: update dependencies * ci: update workflow to use actions/cache@v4 * chore: update peer dependencies to accept both Prisma v5 and v6
1 parent 90ab9a2 commit 8e04093

5 files changed

Lines changed: 1769 additions & 1388 deletions

File tree

.github/workflows/push.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
uses: actions/setup-node@v2
1212
with:
1313
node-version: '18'
14-
- uses: actions/cache@v2
14+
- uses: actions/cache@v4
1515
id: yarn-cache
1616
with:
1717
path: node_modules
@@ -28,7 +28,7 @@ jobs:
2828
needs: setup
2929
env:
3030
NODE_ENV: test
31-
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/prisma_example_test?schema=public"
31+
DATABASE_URL: 'postgresql://postgres:postgres@localhost:5432/prisma_example_test?schema=public'
3232
services:
3333
postgres:
3434
image: postgres:10.8
@@ -37,7 +37,7 @@ jobs:
3737
POSTGRES_PASSWORD: postgres
3838
POSTGRES_DB: prisma_example_test
3939
ports:
40-
- 5432:5432
40+
- 5432:5432
4141
# needed because the postgres container does not provide a healthcheck
4242
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
4343
steps:
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/setup-node@v2
4848
with:
4949
node-version: '18'
50-
- uses: actions/cache@v2
50+
- uses: actions/cache@v4
5151
id: yarn-cache
5252
with:
5353
path: node_modules
@@ -63,7 +63,7 @@ jobs:
6363
run: npx prisma migrate dev
6464
- name: Test
6565
run: yarn test
66-
66+
6767
publish:
6868
name: Publish
6969
needs: test
@@ -75,7 +75,7 @@ jobs:
7575
uses: actions/setup-node@v2
7676
with:
7777
node-version: '18'
78-
- uses: actions/cache@v2
78+
- uses: actions/cache@v4
7979
id: yarn-cache
8080
with:
8181
path: node_modules

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"typescript.tsdk": "node_modules/typescript/lib"
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"editor.formatOnSave": true
34
}

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"author": "Rafał Dzięgielewski <rafal.dzieg@gmail.com>",
4141
"license": "MIT",
4242
"peerDependencies": {
43-
"@prisma/client": "^5.0.0",
43+
"@prisma/client": "^5.0.0 || ^6.0.0",
4444
"adminjs": "^7.0.0"
4545
},
4646
"prisma": {
@@ -51,13 +51,13 @@
5151
"@commitlint/cli": "^17.4.4",
5252
"@commitlint/config-conventional": "^17.4.4",
5353
"@jest/globals": "^29.5.0",
54-
"@prisma/client": "^5.0.0",
54+
"@prisma/client": "^6.10.0",
5555
"@semantic-release/git": "^10.0.1",
5656
"@types/jest": "^29.4.0",
5757
"@types/node": "^18",
5858
"@typescript-eslint/eslint-plugin": "^5.54.1",
5959
"@typescript-eslint/parser": "^5.54.1",
60-
"adminjs": "^7.0.9",
60+
"adminjs": "^7.8.16",
6161
"dotenv-cli": "^7.0.0",
6262
"eslint": "^8.35.0",
6363
"eslint-config-airbnb": "^19.0.4",
@@ -68,12 +68,12 @@
6868
"husky": "^4.2.5",
6969
"jest": "^29.5.0",
7070
"pg": "^8.10.0",
71-
"prisma": "^5.0.0",
71+
"prisma": "^6.10.0",
7272
"semantic-release": "^20.1.1",
7373
"semantic-release-slack-bot": "^4.0.0",
7474
"ts-jest": "^29.0.5",
7575
"ts-node": "^10.9.1",
7676
"tsconfig-paths": "^4.1.2",
7777
"typescript": "^4.9.5"
7878
}
79-
}
79+
}

spec/Resource.spec.ts

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,14 @@ const prisma = new PrismaClient();
1212
/**
1313
* Test temporarily turned off due to Prisma bug: https://github.com/prisma/prisma/issues/18146
1414
*/
15-
describe.skip('Resource', () => {
15+
describe('Resource', () => {
1616
let resource: Resource;
1717

1818
const data = {
1919
name: 'Someone',
2020
email: 'random@email.com',
2121
};
2222

23-
beforeAll(async () => {
24-
await prisma.$connect();
25-
})
26-
2723
beforeEach(async () => {
2824
resource = new Resource({ model: getModelByName('User'), client: prisma });
2925

@@ -32,13 +28,14 @@ describe.skip('Resource', () => {
3228
await prisma.post.deleteMany({});
3329
});
3430

35-
afterAll(async () => {
36-
await prisma.$disconnect();
37-
});
38-
3931
describe('.isAdapterFor', () => {
4032
it('returns true when Prisma model is given', () => {
41-
expect(Resource.isAdapterFor({ model: getModelByName('Post'), client: prisma })).toEqual(true);
33+
expect(
34+
Resource.isAdapterFor({
35+
model: getModelByName('Post'),
36+
client: prisma,
37+
}),
38+
).toEqual(true);
4239
});
4340

4441
it('returns false for any other kind of resources', () => {
@@ -124,8 +121,12 @@ describe.skip('Resource', () => {
124121

125122
const filter = new Filter(undefined, resource);
126123
filter.filters = {
127-
name: { path: 'name', value: params.name, property: resource.property('name') as BaseProperty },
128-
}
124+
name: {
125+
path: 'name',
126+
value: params.name,
127+
property: resource.property('name') as BaseProperty,
128+
},
129+
};
129130
record = await resource.find(filter);
130131

131132
expect(record[0] && record[0].get('name')).toEqual(data.name);
@@ -134,14 +135,21 @@ describe.skip('Resource', () => {
134135
});
135136

136137
it('finds by record uuid column', async () => {
137-
const uuidResource = new Resource({ model: getModelByName('UuidExample'), client: prisma });
138+
const uuidResource = new Resource({
139+
model: getModelByName('UuidExample'),
140+
client: prisma,
141+
});
138142
const params = await uuidResource.create({ label: 'test' });
139143
await uuidResource.create({ label: 'another test' });
140144

141145
const filter = new Filter(undefined, uuidResource);
142146
filter.filters = {
143-
id: { path: 'id', value: params.id, property: uuidResource.property('id') as BaseProperty },
144-
}
147+
id: {
148+
path: 'id',
149+
value: params.id,
150+
property: uuidResource.property('id') as BaseProperty,
151+
},
152+
};
145153
record = await uuidResource.find(filter);
146154

147155
expect(record[0] && record[0].get('id')).toEqual(params.id);
@@ -157,7 +165,10 @@ describe.skip('Resource', () => {
157165

158166
beforeEach(async () => {
159167
user = await resource.create(data);
160-
profileResource = new Resource({ model: getModelByName('Profile'), client: prisma });
168+
profileResource = new Resource({
169+
model: getModelByName('Profile'),
170+
client: prisma,
171+
});
161172
});
162173

163174
it('creates new resource', async () => {

0 commit comments

Comments
 (0)