Skip to content

Commit 7808b81

Browse files
authored
chore: update dependencies & @feathersjs/feathers as peerDependency (#721)
* chore: update dependencies & @feathersjs/feathers as peerDependency * chore: update dependencies & replace devDependency feathers-memory with @feathersjs/memory
1 parent eeb167a commit 7808b81

14 files changed

+1769
-1184
lines changed

package-lock.json

Lines changed: 1710 additions & 1093 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"release:major": "npm version major && npm publish",
2626
"changelog": "github_changelog_generator --max-issues 200 -u feathersjs-ecosystem -p feathers-hooks-common && git add CHANGELOG.md && git commit -am \"Updating changelog\"",
2727
"lint": "eslint src/**/*.ts test/**/*.ts --fix",
28-
"update-dependencies": "ncu -u -x ajv,mongodb",
28+
"update-dependencies": "ncu -u -x ajv",
2929
"mocha": "mocha --require ts-node/register",
3030
"coverage": "c8 npm run mocha",
3131
"test": "npm run lint && npm run coverage"
@@ -62,53 +62,54 @@
6262
"dist/**"
6363
],
6464
"dependencies": {
65-
"@feathers-plus/batch-loader": "^0.3.6",
66-
"@feathersjs/commons": "^5.0.1",
67-
"@feathersjs/errors": "^5.0.1",
68-
"@feathersjs/feathers": "^5.0.1",
65+
"@feathersjs/errors": "^5.0.6",
6966
"ajv": "^6.12.6",
7067
"debug": "^4.3.4",
7168
"graphql": "^16.6.0",
7269
"lodash": "^4.17.21",
7370
"traverse": "^0.6.7"
7471
},
7572
"devDependencies": {
73+
"@feathers-plus/batch-loader": "^0.3.6",
7674
"@feathers-plus/cache": "^1.4.0",
7775
"@feathers-plus/graphql": "^1.10.0",
78-
"@feathersjs/authentication": "^5.0.1",
79-
"@feathersjs/authentication-local": "^5.0.1",
80-
"@feathersjs/client": "^5.0.2",
81-
"@feathersjs/express": "^5.0.1",
82-
"@feathersjs/socketio": "^5.0.1",
83-
"@feathersjs/socketio-client": "^5.0.2",
84-
"@types/chai": "^4.3.4",
76+
"@feathersjs/authentication": "^5.0.6",
77+
"@feathersjs/authentication-local": "^5.0.6",
78+
"@feathersjs/client": "^5.0.6",
79+
"@feathersjs/express": "^5.0.6",
80+
"@feathersjs/memory": "^5.0.6",
81+
"@feathersjs/socketio": "^5.0.6",
82+
"@feathersjs/socketio-client": "^5.0.6",
83+
"@types/chai": "^4.3.5",
8584
"@types/clone": "^2.1.1",
86-
"@types/debug": "^4.1.7",
87-
"@types/lodash": "^4.14.192",
85+
"@types/debug": "^4.1.8",
86+
"@types/lodash": "^4.14.195",
8887
"@types/mocha": "^10.0.1",
89-
"@types/node": "^18.15.11",
88+
"@types/node": "^20.3.1",
9089
"@types/traverse": "^0.6.32",
91-
"@typescript-eslint/eslint-plugin": "^5.57.0",
92-
"@typescript-eslint/parser": "^5.57.0",
93-
"c8": "^7.13.0",
90+
"@typescript-eslint/eslint-plugin": "^5.59.11",
91+
"@typescript-eslint/parser": "^5.59.11",
92+
"c8": "^8.0.0",
9493
"chai": "^4.3.7",
9594
"clone": "^2.1.2",
96-
"eslint": "^8.37.0",
95+
"eslint": "^8.42.0",
9796
"eslint-config-prettier": "^8.8.0",
9897
"eslint-plugin-import": "^2.27.5",
9998
"eslint-plugin-prefer-arrow": "^1.2.3",
10099
"eslint-plugin-prettier": "^4.2.1",
101-
"feathers-memory": "^4.1.0",
102100
"mocha": "^10.2.0",
103-
"mongodb": "^5.0.1",
104-
"npm-check-updates": "^16.9.0",
105-
"prettier": "^2.8.7",
101+
"mongodb": "^5.6.0",
102+
"npm-check-updates": "^16.10.12",
103+
"prettier": "^2.8.8",
106104
"shx": "^0.3.4",
107105
"sift": "^17.0.1",
108106
"ts-node": "^10.9.1",
109107
"tsup": "^6.7.0",
110-
"typescript": "^5.0.3",
111-
"vitepress": "^1.0.0-alpha.64"
108+
"typescript": "^5.1.3",
109+
"vitepress": "^1.0.0-beta.2"
110+
},
111+
"peerDependencies": {
112+
"@feathersjs/feathers": "^5.0.0"
112113
},
113114
"engines": {
114115
"node": ">= 14"

src/hooks/set-field.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,7 @@ export function setField<H extends HookContext = HookContext>({
2828
}
2929

3030
return (context: H) => {
31-
const { params, app } = context;
32-
33-
if (app.version < '4.0.0') {
34-
throw new Error(
35-
"The 'setField' hook only works with Feathers 4 and the latest database adapters"
36-
);
37-
}
31+
const { params } = context;
3832

3933
checkContext(context, 'before', null, 'setField');
4034

src/hooks/soft-delete.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { GeneralError } from '@feathersjs/errors';
21
import type { HookContext } from '@feathersjs/feathers';
32
import { checkContext } from '../utils/check-context';
43

@@ -28,14 +27,10 @@ export function softDelete<H extends HookContext = HookContext>({
2827
removeData = defaultData,
2928
}: SoftDeleteOptions<H> = {}) {
3029
return async (context: H) => {
31-
const { service, method, params, app } = context;
30+
const { service, method, params } = context;
3231
// @ts-ignore
3332
const { disableSoftDelete, query = {} } = params;
3433

35-
if (app.version < '4.0.0') {
36-
throw new GeneralError('The softDelete hook requires Feathers 4.0.0 or later');
37-
}
38-
3934
checkContext(context, 'before', null, 'softDelete');
4035

4136
if (disableSoftDelete) {

test/helpers/config-app.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { feathers } from '@feathersjs/feathers';
2-
import memory from 'feathers-memory';
2+
import { MemoryService } from '@feathersjs/memory';
33
import getInitDb from './get-init-db';
44

55
export default function (dbNames: any) {
@@ -21,18 +21,18 @@ export default function (dbNames: any) {
2121
}
2222

2323
function users(this: any) {
24-
this.use('users', memory(getInitDb('users')));
24+
this.use('users', new MemoryService(getInitDb('users')));
2525
}
2626

2727
function comments(this: any) {
28-
this.use('comments', memory(getInitDb('comments')));
28+
this.use('comments', new MemoryService(getInitDb('comments')));
2929
}
3030

3131
function posts(this: any) {
32-
this.use('posts', memory(getInitDb('posts')));
32+
this.use('posts', new MemoryService(getInitDb('posts')));
3333
}
3434

3535
function recommendation(this: any) {
36-
this.use('recommendation', memory(getInitDb('recommendation')));
36+
this.use('recommendation', new MemoryService(getInitDb('recommendation')));
3737
}
3838
}

test/hooks/fast-join-cache.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { feathers } from '@feathersjs/feathers';
33
import BatchLoader from '@feathers-plus/batch-loader';
44
// @ts-ignore
55
import CacheMap from '@feathers-plus/cache';
6-
import { Service } from 'feathers-memory';
6+
import { MemoryService } from '@feathersjs/memory';
77
import { cache, fastJoin, iff, makeCallingParams } from '../../src';
88

99
const { getResultsByKey, getUniqueKeys } = BatchLoader;
@@ -54,7 +54,7 @@ function postsService(this: any) {
5454
const app = this;
5555
const store = clone(postsStoreInit);
5656

57-
class PostsService extends Service {
57+
class PostsService extends MemoryService {
5858
foo: boolean;
5959

6060
constructor(...args: any[]) {
@@ -81,7 +81,7 @@ function usersService(this: any) {
8181
const app = this;
8282
const store = clone(usersStoreInit);
8383

84-
class UsersService extends Service {
84+
class UsersService extends MemoryService {
8585
junk: boolean;
8686
constructor(...args: any[]) {
8787
super(...args);

test/hooks/populate-misc.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { assert } from 'chai';
22
import { feathers } from '@feathersjs/feathers';
3-
import memory from 'feathers-memory';
3+
import { MemoryService } from '@feathersjs/memory';
44
import { iff, populate } from '../../src';
55

66
const userId = 6;
@@ -147,7 +147,7 @@ function user(this: any) {
147147

148148
app.use(
149149
'/users',
150-
memory({
150+
new MemoryService({
151151
store: clone(userInit),
152152
startId: userId,
153153
paginate: {
@@ -173,7 +173,7 @@ function team(this: any) {
173173

174174
app.use(
175175
'/teams',
176-
memory({
176+
new MemoryService({
177177
store: clone(teamInit),
178178
startId: teamId,
179179
})

test/hooks/populate-relations.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,13 @@ import { populate } from '../../src';
111111
},
112112
commentsInfo: [
113113
{
114+
id: 1,
114115
title: 'Comment 1',
115116
content: 'Lorem ipsum dolor sit amet 1',
116117
postId: 1,
117118
},
118119
{
120+
id: 3,
119121
title: 'Comment 3',
120122
content: 'Lorem ipsum dolor sit amet 3',
121123
postId: 1,
@@ -177,11 +179,13 @@ import { populate } from '../../src';
177179
},
178180
commentsInfo: [
179181
{
182+
id: 1,
180183
title: 'Comment 1',
181184
content: 'Lorem ipsum dolor sit amet 1',
182185
postId: 1,
183186
},
184187
{
188+
id: 3,
185189
title: 'Comment 3',
186190
content: 'Lorem ipsum dolor sit amet 3',
187191
postId: 1,
@@ -229,6 +233,7 @@ import { populate } from '../../src';
229233
},
230234
commentsInfo: [
231235
{
236+
id: 2,
232237
title: 'Comment 2',
233238
content: 'Lorem ipsum dolor sit amet 2',
234239
postId: 2,
@@ -276,11 +281,13 @@ import { populate } from '../../src';
276281
},
277282
commentsInfo: [
278283
{
284+
id: 1,
279285
title: 'Comment 1',
280286
content: 'Lorem ipsum dolor sit amet 1',
281287
postId: 1,
282288
},
283289
{
290+
id: 3,
284291
title: 'Comment 3',
285292
content: 'Lorem ipsum dolor sit amet 3',
286293
postId: 1,

test/hooks/set-field.test.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'assert';
22
import { feathers } from '@feathersjs/feathers';
3-
import memory from 'feathers-memory';
3+
import { MemoryService } from '@feathersjs/memory';
44
import { setField } from '../../src';
55

66
import type { Application } from '@feathersjs/feathers';
@@ -15,7 +15,7 @@ describe('setField', () => {
1515

1616
beforeEach(async () => {
1717
app = feathers();
18-
app.use('/messages', memory());
18+
app.use('/messages', new MemoryService());
1919
app.service('messages').hooks({
2020
before: {
2121
all: [
@@ -65,19 +65,6 @@ describe('setField', () => {
6565
);
6666
});
6767

68-
it('errors when used with wrong app version', async () => {
69-
app.version = '3.2.1';
70-
71-
await assert.rejects(
72-
async () => {
73-
await app.service('messages').get('testing');
74-
},
75-
{
76-
message: "The 'setField' hook only works with Feathers 4 and the latest database adapters",
77-
}
78-
);
79-
});
80-
8168
it('find queries with user information, does not modify original objects', async () => {
8269
const query = {};
8370
// @ts-ignore

test/hooks/soft-delete.test.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'assert';
22
import { feathers } from '@feathersjs/feathers';
3-
import memory from 'feathers-memory';
3+
import { MemoryService } from '@feathersjs/memory';
44
import { softDelete } from '../../src';
55

66
const initialUsers = [
@@ -18,7 +18,7 @@ describe('services softDelete', () => {
1818
beforeEach(() => {
1919
const app = feathers().use(
2020
'/users',
21-
memory({
21+
new MemoryService({
2222
multi: ['create', 'patch', 'remove'],
2323
})
2424
);
@@ -33,22 +33,6 @@ describe('services softDelete', () => {
3333
userService.create(initialUsers);
3434
});
3535

36-
it('throws error on wrong app version', async () => {
37-
const app = feathers().use('/users', memory());
38-
39-
app.service('users').hooks({
40-
before: {
41-
all: [softDelete()],
42-
},
43-
});
44-
45-
app.version = '3.1.4';
46-
47-
await assert.rejects(() => app.service('users').find(), {
48-
message: 'The softDelete hook requires Feathers 4.0.0 or later',
49-
});
50-
});
51-
5236
describe('find', () => {
5337
it('does not return deleted items', async () => {
5438
const users = await userService.find();
@@ -223,7 +207,7 @@ describe('services softDelete', () => {
223207
beforeEach(() => {
224208
const app = feathers().use(
225209
'/people',
226-
memory({
210+
new MemoryService({
227211
multi: ['create', 'patch', 'remove'],
228212
})
229213
);

0 commit comments

Comments
 (0)