@feathersjs/feathers 5.0.0-pre.18 → 5.0.0-pre.20
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 +23 -0
- package/lib/declarations.d.ts +30 -30
- package/lib/events.d.ts +1 -1
- package/lib/hooks/index.d.ts +1 -1
- package/lib/hooks/regular.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +8 -8
- package/src/declarations.ts +33 -33
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-pre.20](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.19...v5.0.0-pre.20) (2022-05-04)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [5.0.0-pre.19](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.18...v5.0.0-pre.19) (2022-05-01)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **typescript:** Improve adapter typings ([#2605](https://github.com/feathersjs/feathers/issues/2605)) ([3b2ca0a](https://github.com/feathersjs/feathers/commit/3b2ca0a6a8e03e8390272c4d7e930b4bffdaacf5))
|
|
23
|
+
* **typescript:** Improve params and query typeability ([#2600](https://github.com/feathersjs/feathers/issues/2600)) ([df28b76](https://github.com/feathersjs/feathers/commit/df28b7619161f1df5e700326f52cca1a92dc5d28))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
# [5.0.0-pre.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
|
|
7
30
|
|
|
8
31
|
|
package/lib/declarations.d.ts
CHANGED
|
@@ -17,38 +17,38 @@ export interface ServiceOptions {
|
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
export interface ServiceMethods<T = any, D = Partial<T
|
|
21
|
-
find(params?:
|
|
22
|
-
get(id: Id, params?:
|
|
23
|
-
create(data: D, params?:
|
|
24
|
-
update(id: NullableId, data: D, params?:
|
|
25
|
-
patch(id: NullableId, data: D, params?:
|
|
26
|
-
remove(id: NullableId, params?:
|
|
27
|
-
setup(app: Application, path: string): Promise<void>;
|
|
28
|
-
teardown(app: Application, path: string): Promise<void>;
|
|
20
|
+
export interface ServiceMethods<T = any, D = Partial<T>, P = Params> {
|
|
21
|
+
find(params?: P): Promise<T | T[]>;
|
|
22
|
+
get(id: Id, params?: P): Promise<T>;
|
|
23
|
+
create(data: D, params?: P): Promise<T>;
|
|
24
|
+
update(id: NullableId, data: D, params?: P): Promise<T | T[]>;
|
|
25
|
+
patch(id: NullableId, data: D, params?: P): Promise<T | T[]>;
|
|
26
|
+
remove(id: NullableId, params?: P): Promise<T | T[]>;
|
|
27
|
+
setup?(app: Application, path: string): Promise<void>;
|
|
28
|
+
teardown?(app: Application, path: string): Promise<void>;
|
|
29
29
|
}
|
|
30
|
-
export interface ServiceOverloads<T = any, D = Partial<T
|
|
31
|
-
create?(data: D[], params?:
|
|
32
|
-
update?(id: Id, data: D, params?:
|
|
33
|
-
update?(id: null, data: D, params?:
|
|
34
|
-
patch?(id: Id, data: D, params?:
|
|
35
|
-
patch?(id: null, data: D, params?:
|
|
36
|
-
remove?(id: Id, params?:
|
|
37
|
-
remove?(id: null, params?:
|
|
30
|
+
export interface ServiceOverloads<T = any, D = Partial<T>, P = Params> {
|
|
31
|
+
create?(data: D[], params?: P): Promise<T[]>;
|
|
32
|
+
update?(id: Id, data: D, params?: P): Promise<T>;
|
|
33
|
+
update?(id: null, data: D, params?: P): Promise<T[]>;
|
|
34
|
+
patch?(id: Id, data: D, params?: P): Promise<T>;
|
|
35
|
+
patch?(id: null, data: D, params?: P): Promise<T[]>;
|
|
36
|
+
remove?(id: Id, params?: P): Promise<T>;
|
|
37
|
+
remove?(id: null, params?: P): Promise<T[]>;
|
|
38
38
|
}
|
|
39
|
-
export declare type Service<T = any, D = Partial<T
|
|
40
|
-
export declare type ServiceInterface<T = any, D = Partial<T
|
|
39
|
+
export declare type Service<T = any, D = Partial<T>, P = Params> = ServiceMethods<T, D, P> & ServiceOverloads<T, D, P>;
|
|
40
|
+
export declare type ServiceInterface<T = any, D = Partial<T>, P = Params> = Partial<ServiceMethods<T, D, P>>;
|
|
41
41
|
export interface ServiceAddons<A = Application, S = Service> extends EventEmitter {
|
|
42
42
|
id?: string;
|
|
43
43
|
hooks(options: HookOptions<A, S>): this;
|
|
44
44
|
}
|
|
45
|
-
export interface ServiceHookOverloads<S> {
|
|
46
|
-
find(params:
|
|
47
|
-
get(id: Id, params:
|
|
48
|
-
create(data: ServiceGenericData<S> | ServiceGenericData<S>[], params:
|
|
49
|
-
update(id: NullableId, data: ServiceGenericData<S>, params:
|
|
50
|
-
patch(id: NullableId, data: ServiceGenericData<S>, params:
|
|
51
|
-
remove(id: NullableId, params:
|
|
45
|
+
export interface ServiceHookOverloads<S, P = Params> {
|
|
46
|
+
find(params: P, context: HookContext): Promise<HookContext>;
|
|
47
|
+
get(id: Id, params: P, context: HookContext): Promise<HookContext>;
|
|
48
|
+
create(data: ServiceGenericData<S> | ServiceGenericData<S>[], params: P, context: HookContext): Promise<HookContext>;
|
|
49
|
+
update(id: NullableId, data: ServiceGenericData<S>, params: P, context: HookContext): Promise<HookContext>;
|
|
50
|
+
patch(id: NullableId, data: ServiceGenericData<S>, params: P, context: HookContext): Promise<HookContext>;
|
|
51
|
+
remove(id: NullableId, params: P, context: HookContext): Promise<HookContext>;
|
|
52
52
|
}
|
|
53
53
|
export declare type FeathersService<A = FeathersApplication, S = Service> = S & ServiceAddons<A, S> & OptionalPick<ServiceHookOverloads<S>, keyof S>;
|
|
54
54
|
export declare type CustomMethods<T extends {
|
|
@@ -59,6 +59,7 @@ export declare type CustomMethods<T extends {
|
|
|
59
59
|
export declare type ServiceMixin<A> = (service: FeathersService<A>, path: string, options: ServiceOptions) => void;
|
|
60
60
|
export declare type ServiceGenericType<S> = S extends ServiceInterface<infer T> ? T : any;
|
|
61
61
|
export declare type ServiceGenericData<S> = S extends ServiceInterface<infer _T, infer D> ? D : any;
|
|
62
|
+
export declare type ServiceGenericParams<S> = S extends ServiceInterface<infer _T, infer _D, infer P> ? P : any;
|
|
62
63
|
export interface FeathersApplication<Services = any, Settings = any> {
|
|
63
64
|
/**
|
|
64
65
|
* The Feathers application version
|
|
@@ -160,8 +161,8 @@ export declare type NullableId = Id | null;
|
|
|
160
161
|
export interface Query {
|
|
161
162
|
[key: string]: any;
|
|
162
163
|
}
|
|
163
|
-
export interface Params {
|
|
164
|
-
query?:
|
|
164
|
+
export interface Params<Q = Query> {
|
|
165
|
+
query?: Q;
|
|
165
166
|
provider?: string;
|
|
166
167
|
route?: {
|
|
167
168
|
[key: string]: any;
|
|
@@ -169,7 +170,6 @@ export interface Params {
|
|
|
169
170
|
headers?: {
|
|
170
171
|
[key: string]: any;
|
|
171
172
|
};
|
|
172
|
-
[key: string]: any;
|
|
173
173
|
}
|
|
174
174
|
export interface Http {
|
|
175
175
|
/**
|
|
@@ -237,7 +237,7 @@ export interface HookContext<A = Application, S = any> extends BaseHookContext<S
|
|
|
237
237
|
* A writeable property that contains the service method parameters (including
|
|
238
238
|
* params.query).
|
|
239
239
|
*/
|
|
240
|
-
params:
|
|
240
|
+
params: ServiceGenericParams<S>;
|
|
241
241
|
/**
|
|
242
242
|
* A writeable property containing the result of the successful service method call.
|
|
243
243
|
* It is only available in after hooks.
|
package/lib/events.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { NextFunction } from './dependencies';
|
|
2
2
|
import { HookContext, FeathersService } from './declarations';
|
|
3
3
|
export declare function eventHook(context: HookContext, next: NextFunction): Promise<void>;
|
|
4
|
-
export declare function eventMixin<A>(service: FeathersService<A>): FeathersService<A, import("./declarations").Service<any, Partial<any>>>;
|
|
4
|
+
export declare function eventMixin<A>(service: FeathersService<A>): FeathersService<A, import("./declarations").Service<any, Partial<any>, import("./declarations").Params<import("./declarations").Query>>>;
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export declare class FeathersHookManager<A> extends HookManager {
|
|
|
10
10
|
initializeContext(self: any, args: any[], context: HookContext): import("@feathersjs/hooks/types/base").HookContext<any, any>;
|
|
11
11
|
middleware(mw: Middleware[]): this;
|
|
12
12
|
}
|
|
13
|
-
export declare function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions): FeathersService<A, Service<any, Partial<any>>>;
|
|
13
|
+
export declare function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions): FeathersService<A, Service<any, Partial<any>, import("../declarations").Params<import("../declarations").Query>>>;
|
package/lib/hooks/regular.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export declare function fromAfterHooks<A, S>(hooks: RegularHookFunction<A, S>[])
|
|
|
7
7
|
export declare function fromErrorHooks<A, S>(hooks: RegularHookFunction<A, S>[]): HookFunction<unknown, unknown>;
|
|
8
8
|
export declare function collectRegularHooks(target: any, method: string): any;
|
|
9
9
|
export declare function convertHookData(input: any): {
|
|
10
|
-
[method: string]: RegularHookFunction<import("../declarations").Application<any, any>, import("../declarations").Service<any, Partial<any>>>[];
|
|
10
|
+
[method: string]: RegularHookFunction<import("../declarations").Application<any, any>, import("../declarations").Service<any, Partial<any>, import("../declarations").Params<import("../declarations").Query>>>[];
|
|
11
11
|
};
|
|
12
12
|
export declare function enableRegularHooks(object: any, methods?: string[]): (this: any, input: RegularHookMap<any, any>) => any;
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "5.0.0-pre.
|
|
1
|
+
declare const _default: "5.0.0-pre.20";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/feathers",
|
|
3
3
|
"description": "A framework for real-time applications and REST API with JavaScript and TypeScript",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.20",
|
|
5
5
|
"homepage": "http://feathersjs.com",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
61
|
-
"@feathersjs/hooks": "^0.7.
|
|
60
|
+
"@feathersjs/commons": "^5.0.0-pre.20",
|
|
61
|
+
"@feathersjs/hooks": "^0.7.4",
|
|
62
62
|
"events": "^3.3.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@types/mocha": "^9.1.
|
|
66
|
-
"@types/node": "^17.0.
|
|
67
|
-
"mocha": "^
|
|
65
|
+
"@types/mocha": "^9.1.1",
|
|
66
|
+
"@types/node": "^17.0.31",
|
|
67
|
+
"mocha": "^10.0.0",
|
|
68
68
|
"shx": "^0.3.4",
|
|
69
69
|
"ts-node": "^10.7.0",
|
|
70
|
-
"typescript": "^4.6.
|
|
70
|
+
"typescript": "^4.6.4"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "54de749a0b392c7da726c668002b50cafaca530c"
|
|
73
73
|
}
|
package/src/declarations.ts
CHANGED
|
@@ -21,87 +21,87 @@ export interface ServiceOptions {
|
|
|
21
21
|
routeParams?: { [key: string]: any };
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export interface ServiceMethods<T = any, D = Partial<T
|
|
25
|
-
find (params?:
|
|
24
|
+
export interface ServiceMethods<T = any, D = Partial<T>, P = Params> {
|
|
25
|
+
find (params?: P): Promise<T | T[]>;
|
|
26
26
|
|
|
27
|
-
get (id: Id, params?:
|
|
27
|
+
get (id: Id, params?: P): Promise<T>;
|
|
28
28
|
|
|
29
|
-
create (data: D, params?:
|
|
29
|
+
create (data: D, params?: P): Promise<T>;
|
|
30
30
|
|
|
31
|
-
update (id: NullableId, data: D, params?:
|
|
31
|
+
update (id: NullableId, data: D, params?: P): Promise<T | T[]>;
|
|
32
32
|
|
|
33
|
-
patch (id: NullableId, data: D, params?:
|
|
33
|
+
patch (id: NullableId, data: D, params?: P): Promise<T | T[]>;
|
|
34
34
|
|
|
35
|
-
remove (id: NullableId, params?:
|
|
35
|
+
remove (id: NullableId, params?: P): Promise<T | T[]>;
|
|
36
36
|
|
|
37
|
-
setup (app: Application, path: string): Promise<void>;
|
|
37
|
+
setup? (app: Application, path: string): Promise<void>;
|
|
38
38
|
|
|
39
|
-
teardown (app: Application, path: string): Promise<void>;
|
|
39
|
+
teardown? (app: Application, path: string): Promise<void>;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export interface ServiceOverloads<T = any, D = Partial<T
|
|
43
|
-
create? (data: D[], params?:
|
|
42
|
+
export interface ServiceOverloads<T = any, D = Partial<T>, P = Params> {
|
|
43
|
+
create? (data: D[], params?: P): Promise<T[]>;
|
|
44
44
|
|
|
45
|
-
update? (id: Id, data: D, params?:
|
|
45
|
+
update? (id: Id, data: D, params?: P): Promise<T>;
|
|
46
46
|
|
|
47
|
-
update? (id: null, data: D, params?:
|
|
47
|
+
update? (id: null, data: D, params?: P): Promise<T[]>;
|
|
48
48
|
|
|
49
|
-
patch? (id: Id, data: D, params?:
|
|
49
|
+
patch? (id: Id, data: D, params?: P): Promise<T>;
|
|
50
50
|
|
|
51
|
-
patch? (id: null, data: D, params?:
|
|
51
|
+
patch? (id: null, data: D, params?: P): Promise<T[]>;
|
|
52
52
|
|
|
53
|
-
remove? (id: Id, params?:
|
|
53
|
+
remove? (id: Id, params?: P): Promise<T>;
|
|
54
54
|
|
|
55
|
-
remove? (id: null, params?:
|
|
55
|
+
remove? (id: null, params?: P): Promise<T[]>;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export type Service<T = any, D = Partial<T
|
|
59
|
-
ServiceMethods<T, D> &
|
|
60
|
-
ServiceOverloads<T, D>;
|
|
58
|
+
export type Service<T = any, D = Partial<T>, P = Params> =
|
|
59
|
+
ServiceMethods<T, D, P> &
|
|
60
|
+
ServiceOverloads<T, D, P>;
|
|
61
61
|
|
|
62
|
-
export type ServiceInterface<T = any, D = Partial<T
|
|
63
|
-
Partial<ServiceMethods<T, D>>;
|
|
62
|
+
export type ServiceInterface<T = any, D = Partial<T>, P = Params> =
|
|
63
|
+
Partial<ServiceMethods<T, D, P>>;
|
|
64
64
|
|
|
65
65
|
export interface ServiceAddons<A = Application, S = Service> extends EventEmitter {
|
|
66
66
|
id?: string;
|
|
67
67
|
hooks (options: HookOptions<A, S>): this;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export interface ServiceHookOverloads<S> {
|
|
70
|
+
export interface ServiceHookOverloads<S, P = Params> {
|
|
71
71
|
find (
|
|
72
|
-
params:
|
|
72
|
+
params: P,
|
|
73
73
|
context: HookContext
|
|
74
74
|
): Promise<HookContext>;
|
|
75
75
|
|
|
76
76
|
get (
|
|
77
77
|
id: Id,
|
|
78
|
-
params:
|
|
78
|
+
params: P,
|
|
79
79
|
context: HookContext
|
|
80
80
|
): Promise<HookContext>;
|
|
81
81
|
|
|
82
82
|
create (
|
|
83
83
|
data: ServiceGenericData<S> | ServiceGenericData<S>[],
|
|
84
|
-
params:
|
|
84
|
+
params: P,
|
|
85
85
|
context: HookContext
|
|
86
86
|
): Promise<HookContext>;
|
|
87
87
|
|
|
88
88
|
update (
|
|
89
89
|
id: NullableId,
|
|
90
90
|
data: ServiceGenericData<S>,
|
|
91
|
-
params:
|
|
91
|
+
params: P,
|
|
92
92
|
context: HookContext
|
|
93
93
|
): Promise<HookContext>;
|
|
94
94
|
|
|
95
95
|
patch (
|
|
96
96
|
id: NullableId,
|
|
97
97
|
data: ServiceGenericData<S>,
|
|
98
|
-
params:
|
|
98
|
+
params: P,
|
|
99
99
|
context: HookContext
|
|
100
100
|
): Promise<HookContext>;
|
|
101
101
|
|
|
102
102
|
remove (
|
|
103
103
|
id: NullableId,
|
|
104
|
-
params:
|
|
104
|
+
params: P,
|
|
105
105
|
context: HookContext
|
|
106
106
|
): Promise<HookContext>;
|
|
107
107
|
}
|
|
@@ -117,6 +117,7 @@ export type ServiceMixin<A> = (service: FeathersService<A>, path: string, option
|
|
|
117
117
|
|
|
118
118
|
export type ServiceGenericType<S> = S extends ServiceInterface<infer T> ? T : any;
|
|
119
119
|
export type ServiceGenericData<S> = S extends ServiceInterface<infer _T, infer D> ? D : any;
|
|
120
|
+
export type ServiceGenericParams<S> = S extends ServiceInterface<infer _T, infer _D, infer P> ? P : any;
|
|
120
121
|
|
|
121
122
|
export interface FeathersApplication<Services = any, Settings = any> {
|
|
122
123
|
/**
|
|
@@ -246,12 +247,11 @@ export interface Query {
|
|
|
246
247
|
[key: string]: any;
|
|
247
248
|
}
|
|
248
249
|
|
|
249
|
-
export interface Params {
|
|
250
|
-
query?:
|
|
250
|
+
export interface Params<Q = Query> {
|
|
251
|
+
query?: Q;
|
|
251
252
|
provider?: string;
|
|
252
253
|
route?: { [key: string]: any };
|
|
253
254
|
headers?: { [key: string]: any };
|
|
254
|
-
[key: string]: any; // (JL) not sure if we want this
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
export interface Http {
|
|
@@ -319,7 +319,7 @@ export interface HookContext<A = Application, S = any> extends BaseHookContext<S
|
|
|
319
319
|
* A writeable property that contains the service method parameters (including
|
|
320
320
|
* params.query).
|
|
321
321
|
*/
|
|
322
|
-
params:
|
|
322
|
+
params: ServiceGenericParams<S>;
|
|
323
323
|
/**
|
|
324
324
|
* A writeable property containing the result of the successful service method call.
|
|
325
325
|
* It is only available in after hooks.
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '5.0.0-pre.
|
|
1
|
+
export default '5.0.0-pre.20';
|