@feathersjs/rest-client 5.0.0-pre.23 → 5.0.0-pre.24
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 +11 -0
- package/lib/index.d.ts +7 -20
- package/lib/index.js.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +12 -25
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.24](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.23...v5.0.0-pre.24) (2022-06-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **cli:** Add typed client to a generated app ([#2669](https://github.com/feathersjs/feathers/issues/2669)) ([5b801b5](https://github.com/feathersjs/feathers/commit/5b801b5017ddc3eaa95622b539f51d605916bc86))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [5.0.0-pre.23](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.22...v5.0.0-pre.23) (2022-06-06)
|
|
7
18
|
|
|
8
19
|
|
package/lib/index.d.ts
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
|
+
import { TransportConnection } from '@feathersjs/feathers';
|
|
1
2
|
import { Base } from './base';
|
|
2
3
|
import { AxiosClient } from './axios';
|
|
3
4
|
import { FetchClient } from './fetch';
|
|
4
5
|
import { SuperagentClient } from './superagent';
|
|
5
6
|
export { AxiosClient, FetchClient, SuperagentClient };
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Transport Service
|
|
13
|
-
*/
|
|
14
|
-
Service: any;
|
|
15
|
-
/**
|
|
16
|
-
* default Service
|
|
17
|
-
*/
|
|
18
|
-
service: any;
|
|
19
|
-
}
|
|
20
|
-
export declare type Handler = (connection: any, options?: any, Service?: any) => HandlerResult;
|
|
21
|
-
export interface Transport {
|
|
22
|
-
superagent: Handler;
|
|
23
|
-
fetch: Handler;
|
|
24
|
-
axios: Handler;
|
|
7
|
+
export declare type Handler<ServiceTypes> = (connection: any, options?: any, Service?: any) => TransportConnection<ServiceTypes>;
|
|
8
|
+
export interface Transport<ServiceTypes> {
|
|
9
|
+
superagent: Handler<ServiceTypes>;
|
|
10
|
+
fetch: Handler<ServiceTypes>;
|
|
11
|
+
axios: Handler<ServiceTypes>;
|
|
25
12
|
}
|
|
26
13
|
export declare type RestService<T = any, D = Partial<any>> = Base<T, D>;
|
|
27
|
-
export default function restClient(base?: string): Transport
|
|
14
|
+
export default function restClient<ServiceTypes = any>(base?: string): Transport<ServiceTypes>;
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8F;AAE9F,iCAA6B;AAC7B,mCAAqC;AAI5B,4FAJA,mBAAW,OAIA;AAHpB,mCAAqC;AAGf,4FAHb,mBAAW,OAGa;AAFjC,6CAA+C;AAEZ,iGAF1B,6BAAgB,OAE0B;AAEnD,MAAM,UAAU,GAAG;IACjB,UAAU,EAAE,6BAAgB;IAC5B,KAAK,EAAE,mBAAW;IAClB,KAAK,EAAE,mBAAW;CACnB,CAAA;AAgBD,SAAwB,UAAU,CAAqB,IAAI,GAAG,EAAE;IAC9D,MAAM,MAAM,GAAQ,EAAE,IAAI,EAAJ,WAAI,EAAE,CAAA;IAE5B,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACtC,MAAM,CAAC,GAAG,CAAC,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AC,CAAC,CAAA;IAEF,OAAO,MAAiC,CAAA;AAC1C,CAAC;AA1CD,6BA0CC;AAED,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;CAC3D"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/rest-client",
|
|
3
3
|
"description": "REST client services for different Ajax libraries",
|
|
4
|
-
"version": "5.0.0-pre.
|
|
4
|
+
"version": "5.0.0-pre.24",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
6
|
"main": "lib/",
|
|
7
7
|
"types": "lib/",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@feathersjs/commons": "^5.0.0-pre.
|
|
56
|
-
"@feathersjs/errors": "^5.0.0-pre.
|
|
57
|
-
"@feathersjs/feathers": "^5.0.0-pre.
|
|
55
|
+
"@feathersjs/commons": "^5.0.0-pre.24",
|
|
56
|
+
"@feathersjs/errors": "^5.0.0-pre.24",
|
|
57
|
+
"@feathersjs/feathers": "^5.0.0-pre.24",
|
|
58
58
|
"@types/superagent": "^4.1.15",
|
|
59
59
|
"qs": "^6.10.3"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@feathersjs/express": "^5.0.0-pre.
|
|
63
|
-
"@feathersjs/memory": "^5.0.0-pre.
|
|
64
|
-
"@feathersjs/tests": "^5.0.0-pre.
|
|
62
|
+
"@feathersjs/express": "^5.0.0-pre.24",
|
|
63
|
+
"@feathersjs/memory": "^5.0.0-pre.24",
|
|
64
|
+
"@feathersjs/tests": "^5.0.0-pre.24",
|
|
65
65
|
"@types/mocha": "^9.1.1",
|
|
66
66
|
"@types/node": "^17.0.40",
|
|
67
67
|
"@types/node-fetch": "^2.6.1",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"ts-node": "^10.8.1",
|
|
76
76
|
"typescript": "^4.7.3"
|
|
77
77
|
},
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "72779fa2938f43d7b345b6861ff0035481a07de3"
|
|
79
79
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Application, defaultServiceMethods } from '@feathersjs/feathers'
|
|
1
|
+
import { Application, TransportConnection, defaultServiceMethods } from '@feathersjs/feathers'
|
|
2
2
|
|
|
3
3
|
import { Base } from './base'
|
|
4
4
|
import { AxiosClient } from './axios'
|
|
@@ -13,34 +13,21 @@ const transports = {
|
|
|
13
13
|
axios: AxiosClient
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Transport Service
|
|
24
|
-
*/
|
|
25
|
-
Service: any
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* default Service
|
|
29
|
-
*/
|
|
30
|
-
service: any
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export type Handler = (connection: any, options?: any, Service?: any) => HandlerResult
|
|
16
|
+
export type Handler<ServiceTypes> = (
|
|
17
|
+
connection: any,
|
|
18
|
+
options?: any,
|
|
19
|
+
Service?: any
|
|
20
|
+
) => TransportConnection<ServiceTypes>
|
|
34
21
|
|
|
35
|
-
export interface Transport {
|
|
36
|
-
superagent: Handler
|
|
37
|
-
fetch: Handler
|
|
38
|
-
axios: Handler
|
|
22
|
+
export interface Transport<ServiceTypes> {
|
|
23
|
+
superagent: Handler<ServiceTypes>
|
|
24
|
+
fetch: Handler<ServiceTypes>
|
|
25
|
+
axios: Handler<ServiceTypes>
|
|
39
26
|
}
|
|
40
27
|
|
|
41
28
|
export type RestService<T = any, D = Partial<any>> = Base<T, D>
|
|
42
29
|
|
|
43
|
-
export default function restClient(base = '') {
|
|
30
|
+
export default function restClient<ServiceTypes = any>(base = '') {
|
|
44
31
|
const result: any = { Base }
|
|
45
32
|
|
|
46
33
|
Object.keys(transports).forEach((key) => {
|
|
@@ -81,7 +68,7 @@ export default function restClient(base = '') {
|
|
|
81
68
|
}
|
|
82
69
|
})
|
|
83
70
|
|
|
84
|
-
return result as Transport
|
|
71
|
+
return result as Transport<ServiceTypes>
|
|
85
72
|
}
|
|
86
73
|
|
|
87
74
|
if (typeof module !== 'undefined') {
|