@feathersjs/koa 5.0.0-pre.6 → 5.0.0

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 CHANGED
@@ -3,36 +3,199 @@
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.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
6
+ # [5.0.0](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.38...v5.0.0) (2023-02-24)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **koa:** Make Koa app inspectable ([#3069](https://github.com/feathersjs/feathers/issues/3069)) ([4fbbfff](https://github.com/feathersjs/feathers/commit/4fbbfff2a3c625f8e6929e5a09e2cf7b739ffe11))
7
11
 
12
+ # [5.0.0-pre.38](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.37...v5.0.0-pre.38) (2023-02-17)
8
13
 
9
14
  ### Bug Fixes
10
15
 
11
- * **koa:** Throw a NotFound Feathers error on missing paths ([#2415](https://github.com/feathersjs/feathers/issues/2415)) ([e013f98](https://github.com/feathersjs/feathers/commit/e013f98315d550ced6eacffd615c61bb0912b4ba))
16
+ - **koa:** Fix missing dependency on feathers ([#3061](https://github.com/feathersjs/feathers/issues/3061)) ([80dc95f](https://github.com/feathersjs/feathers/commit/80dc95ff85c9074b8f70e3ff71562f18863ef2be))
12
17
 
18
+ # [5.0.0-pre.37](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.36...v5.0.0-pre.37) (2023-02-09)
13
19
 
20
+ **Note:** Version bump only for package @feathersjs/koa
14
21
 
22
+ # [5.0.0-pre.36](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.35...v5.0.0-pre.36) (2023-01-29)
15
23
 
24
+ ### Bug Fixes
16
25
 
17
- # [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
26
+ - Update all dependencies ([#3024](https://github.com/feathersjs/feathers/issues/3024)) ([283dc47](https://github.com/feathersjs/feathers/commit/283dc4798d85584bc031e6e54b83b4ea77d1edd0))
27
+
28
+ # [5.0.0-pre.35](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.34...v5.0.0-pre.35) (2023-01-12)
29
+
30
+ ### Features
31
+
32
+ - **generators:** Move core code generators to shared generators package ([#2982](https://github.com/feathersjs/feathers/issues/2982)) ([0328d22](https://github.com/feathersjs/feathers/commit/0328d2292153870bc43958f73d2c6f288a8cec17))
33
+
34
+ # [5.0.0-pre.34](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.33...v5.0.0-pre.34) (2022-12-14)
35
+
36
+ **Note:** Version bump only for package @feathersjs/koa
37
+
38
+ # [5.0.0-pre.33](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.32...v5.0.0-pre.33) (2022-11-08)
18
39
 
40
+ **Note:** Version bump only for package @feathersjs/koa
41
+
42
+ # [5.0.0-pre.32](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.31...v5.0.0-pre.32) (2022-10-26)
19
43
 
20
44
  ### Bug Fixes
21
45
 
22
- * **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74))
46
+ - **transports:** Add remaining middleware for generated apps to Koa and Express ([#2796](https://github.com/feathersjs/feathers/issues/2796)) ([0d5781a](https://github.com/feathersjs/feathers/commit/0d5781a5c72a0cbb2ec8211bfa099f0aefe115a2))
47
+
48
+ # [5.0.0-pre.31](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.30...v5.0.0-pre.31) (2022-10-12)
49
+
50
+ ### Bug Fixes
23
51
 
52
+ - **koa:** Only set error code for Feathers errors ([#2793](https://github.com/feathersjs/feathers/issues/2793)) ([d3ee41e](https://github.com/feathersjs/feathers/commit/d3ee41e27b0ea5d29b344d6584ab03e48d16e2b4))
24
53
 
25
54
  ### Features
26
55
 
27
- * **adapter-commons:** Add support for params.adapter option and move memory adapter to @feathersjs/memory ([#2367](https://github.com/feathersjs/feathers/issues/2367)) ([a43e7da](https://github.com/feathersjs/feathers/commit/a43e7da22b6b981a96d1321736ea9a0cb924fb4f))
56
+ - **cli:** Generate full client test suite and improve typed client ([#2788](https://github.com/feathersjs/feathers/issues/2788)) ([57119b6](https://github.com/feathersjs/feathers/commit/57119b6bb2797f7297cf054268a248c093ecd538))
57
+
58
+ # [5.0.0-pre.30](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.29...v5.0.0-pre.30) (2022-10-07)
59
+
60
+ ### Bug Fixes
28
61
 
62
+ - **core:** Ensure setup and teardown can be overriden and maintain hook functionality ([#2779](https://github.com/feathersjs/feathers/issues/2779)) ([ab580cb](https://github.com/feathersjs/feathers/commit/ab580cbcaa68d19144d86798c13bf564f9d424a6))
29
63
 
64
+ ### Features
30
65
 
66
+ - **core:** Allow to unregister services at runtime ([#2756](https://github.com/feathersjs/feathers/issues/2756)) ([d16601f](https://github.com/feathersjs/feathers/commit/d16601f2277dca5357866ffdefba2a611f6dc7fa))
31
67
 
68
+ # [5.0.0-pre.29](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.28...v5.0.0-pre.29) (2022-09-16)
32
69
 
33
- # [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
70
+ ### Features
71
+
72
+ - Add CORS support to oAuth, Express, Koa and generated application ([#2744](https://github.com/feathersjs/feathers/issues/2744)) ([fd218f2](https://github.com/feathersjs/feathers/commit/fd218f289f8ca4c101e9938e8683e2efef6e8131))
73
+
74
+ # [5.0.0-pre.28](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.27...v5.0.0-pre.28) (2022-08-03)
75
+
76
+ ### Bug Fixes
77
+
78
+ - **cli:** Improve generated application and client ([#2701](https://github.com/feathersjs/feathers/issues/2701)) ([bd55ffb](https://github.com/feathersjs/feathers/commit/bd55ffb812e89bf215f4515e7f137656ea888c3f))
79
+
80
+ # [5.0.0-pre.27](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.26...v5.0.0-pre.27) (2022-07-13)
81
+
82
+ **Note:** Version bump only for package @feathersjs/koa
83
+
84
+ # [5.0.0-pre.26](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.25...v5.0.0-pre.26) (2022-06-22)
85
+
86
+ **Note:** Version bump only for package @feathersjs/koa
87
+
88
+ # [5.0.0-pre.25](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.24...v5.0.0-pre.25) (2022-06-22)
89
+
90
+ **Note:** Version bump only for package @feathersjs/koa
91
+
92
+ # [5.0.0-pre.24](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.23...v5.0.0-pre.24) (2022-06-21)
93
+
94
+ ### Features
95
+
96
+ - **cli:** Add support for JavaScript to the new CLI ([#2668](https://github.com/feathersjs/feathers/issues/2668)) ([ebac587](https://github.com/feathersjs/feathers/commit/ebac587f7d00dc7607c3f546352d79f79b89a5d4))
97
+ - **cli:** Initial Feathers v5 CLI and Pinion generator ([#2578](https://github.com/feathersjs/feathers/issues/2578)) ([7f59ae7](https://github.com/feathersjs/feathers/commit/7f59ae7f1471895ba8a82aa4702f1a23f71b7682))
98
+
99
+ # [5.0.0-pre.23](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.22...v5.0.0-pre.23) (2022-06-06)
100
+
101
+ **Note:** Version bump only for package @feathersjs/koa
102
+
103
+ # [5.0.0-pre.22](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.21...v5.0.0-pre.22) (2022-05-24)
104
+
105
+ **Note:** Version bump only for package @feathersjs/koa
106
+
107
+ # [5.0.0-pre.21](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.20...v5.0.0-pre.21) (2022-05-23)
108
+
109
+ **Note:** Version bump only for package @feathersjs/koa
110
+
111
+ # [5.0.0-pre.20](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.19...v5.0.0-pre.20) (2022-05-04)
112
+
113
+ ### Bug Fixes
114
+
115
+ - **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
116
+
117
+ # [5.0.0-pre.19](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.18...v5.0.0-pre.19) (2022-05-01)
34
118
 
119
+ **Note:** Version bump only for package @feathersjs/koa
120
+
121
+ # [5.0.0-pre.18](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.17...v5.0.0-pre.18) (2022-04-11)
122
+
123
+ ### Features
124
+
125
+ - **core:** Add app.teardown functionality ([#2570](https://github.com/feathersjs/feathers/issues/2570)) ([fcdf524](https://github.com/feathersjs/feathers/commit/fcdf524ae1995bb59265d39f12e98b7794bed023))
126
+ - **core:** Finalize app.teardown() functionality ([#2584](https://github.com/feathersjs/feathers/issues/2584)) ([1a166f3](https://github.com/feathersjs/feathers/commit/1a166f3ded811ecacf0ae8cb67880bc9fa2eeafa))
127
+ - **transport-commons:** add `context.http.response` ([#2524](https://github.com/feathersjs/feathers/issues/2524)) ([5bc9d44](https://github.com/feathersjs/feathers/commit/5bc9d447043c2e2b742c73ed28ecf3b3264dd9e5))
128
+
129
+ # [5.0.0-pre.17](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.16...v5.0.0-pre.17) (2022-02-15)
130
+
131
+ **Note:** Version bump only for package @feathersjs/koa
132
+
133
+ # [5.0.0-pre.16](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.15...v5.0.0-pre.16) (2022-01-12)
134
+
135
+ ### Features
136
+
137
+ - **express, koa:** make transports similar ([#2486](https://github.com/feathersjs/feathers/issues/2486)) ([26aa937](https://github.com/feathersjs/feathers/commit/26aa937c114fb8596dfefc599b1f53cead69c159))
138
+
139
+ # [5.0.0-pre.15](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.14...v5.0.0-pre.15) (2021-11-27)
140
+
141
+ ### Bug Fixes
142
+
143
+ - **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
144
+
145
+ ### Features
146
+
147
+ - **core:** add `context.http` and move `statusCode` there ([#2496](https://github.com/feathersjs/feathers/issues/2496)) ([b701bf7](https://github.com/feathersjs/feathers/commit/b701bf77fb83048aa1dffa492b3d77dd53f7b72b))
148
+
149
+ # [5.0.0-pre.14](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.13...v5.0.0-pre.14) (2021-10-13)
150
+
151
+ **Note:** Version bump only for package @feathersjs/koa
152
+
153
+ # [5.0.0-pre.13](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.12...v5.0.0-pre.13) (2021-10-13)
154
+
155
+ **Note:** Version bump only for package @feathersjs/koa
156
+
157
+ # [5.0.0-pre.12](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.11...v5.0.0-pre.12) (2021-10-12)
158
+
159
+ **Note:** Version bump only for package @feathersjs/koa
160
+
161
+ # [5.0.0-pre.11](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.10...v5.0.0-pre.11) (2021-10-06)
162
+
163
+ **Note:** Version bump only for package @feathersjs/koa
164
+
165
+ # [5.0.0-pre.10](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.9...v5.0.0-pre.10) (2021-09-19)
166
+
167
+ **Note:** Version bump only for package @feathersjs/koa
168
+
169
+ # [5.0.0-pre.9](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.8...v5.0.0-pre.9) (2021-08-09)
170
+
171
+ **Note:** Version bump only for package @feathersjs/koa
172
+
173
+ # [5.0.0-pre.8](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.7...v5.0.0-pre.8) (2021-08-09)
174
+
175
+ **Note:** Version bump only for package @feathersjs/koa
176
+
177
+ # [5.0.0-pre.7](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.6...v5.0.0-pre.7) (2021-08-09)
178
+
179
+ **Note:** Version bump only for package @feathersjs/koa
180
+
181
+ # [5.0.0-pre.6](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.5...v5.0.0-pre.6) (2021-08-08)
182
+
183
+ ### Bug Fixes
184
+
185
+ - **koa:** Throw a NotFound Feathers error on missing paths ([#2415](https://github.com/feathersjs/feathers/issues/2415)) ([e013f98](https://github.com/feathersjs/feathers/commit/e013f98315d550ced6eacffd615c61bb0912b4ba))
186
+
187
+ # [5.0.0-pre.5](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.4...v5.0.0-pre.5) (2021-06-23)
188
+
189
+ ### Bug Fixes
190
+
191
+ - **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74))
192
+
193
+ ### Features
194
+
195
+ - **adapter-commons:** Add support for params.adapter option and move memory adapter to @feathersjs/memory ([#2367](https://github.com/feathersjs/feathers/issues/2367)) ([a43e7da](https://github.com/feathersjs/feathers/commit/a43e7da22b6b981a96d1321736ea9a0cb924fb4f))
196
+
197
+ # [5.0.0-pre.4](https://github.com/feathersjs/feathers/compare/v5.0.0-pre.3...v5.0.0-pre.4) (2021-05-13)
35
198
 
36
199
  ### Features
37
200
 
38
- * **koa:** KoaJS transport adapter ([#2315](https://github.com/feathersjs/feathers/issues/2315)) ([2554b57](https://github.com/feathersjs/feathers/commit/2554b57cf05731df58feeba9c12faab18e442107))
201
+ - **koa:** KoaJS transport adapter ([#2315](https://github.com/feathersjs/feathers/issues/2315)) ([2554b57](https://github.com/feathersjs/feathers/commit/2554b57cf05731df58feeba9c12faab18e442107))
package/README.md CHANGED
@@ -1,6 +1,23 @@
1
1
  # @feathersjs/koa
2
2
 
3
- [![Dependency Status](https://img.shields.io/david/feathersjs/feathers.svg?style=flat-square&path=packages/koa)](https://david-dm.org/feathersjs/feathers?path=packages/koa)
3
+ [![CI](https://github.com/feathersjs/feathers/workflows/CI/badge.svg)](https://github.com/feathersjs/feathers/actions?query=workflow%3ACI)
4
4
  [![Download Status](https://img.shields.io/npm/dm/@feathersjs/koa.svg?style=flat-square)](https://www.npmjs.com/package/@feathersjs/koa)
5
+ [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/qa8kez8QBx)
5
6
 
6
7
  > Feathers KoaJS framework bindings and REST provider
8
+
9
+ ## Installation
10
+
11
+ ```
12
+ npm install @feathersjs/koa --save
13
+ ```
14
+
15
+ ## Documentation
16
+
17
+ Refer to the [Feathers Koa API documentation](https://docs.feathersjs.com/api/koa.html) for more details.
18
+
19
+ ## License
20
+
21
+ Copyright (c) 2023 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
22
+
23
+ Licensed under the [MIT license](LICENSE).
@@ -0,0 +1,7 @@
1
+ import { Middleware } from './declarations';
2
+ export type AuthenticationSettings = {
3
+ service?: string;
4
+ strategies?: string[];
5
+ };
6
+ export declare function parseAuthentication(settings?: AuthenticationSettings): Middleware;
7
+ export declare function authenticate(settings: string | AuthenticationSettings, ...strategies: string[]): Middleware;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authenticate = exports.parseAuthentication = void 0;
4
+ const commons_1 = require("@feathersjs/commons");
5
+ const authentication_1 = require("@feathersjs/authentication");
6
+ const debug = (0, commons_1.createDebug)('@feathersjs/koa/authentication');
7
+ function parseAuthentication(settings = {}) {
8
+ return async (ctx, next) => {
9
+ var _a;
10
+ const app = ctx.app;
11
+ const service = (_a = app.defaultAuthentication) === null || _a === void 0 ? void 0 : _a.call(app, settings.service);
12
+ if (!service) {
13
+ return next();
14
+ }
15
+ const config = service.configuration;
16
+ const authStrategies = settings.strategies || config.parseStrategies || config.authStrategies || [];
17
+ if (authStrategies.length === 0) {
18
+ debug('No `authStrategies` or `parseStrategies` found in authentication configuration');
19
+ return next();
20
+ }
21
+ const authentication = await service.parse(ctx.req, ctx.res, ...authStrategies);
22
+ if (authentication) {
23
+ debug('Parsed authentication from HTTP header', authentication);
24
+ ctx.feathers = { ...ctx.feathers, authentication };
25
+ }
26
+ return next();
27
+ };
28
+ }
29
+ exports.parseAuthentication = parseAuthentication;
30
+ function authenticate(settings, ...strategies) {
31
+ const hook = (0, authentication_1.authenticate)(settings, ...strategies);
32
+ return async (ctx, next) => {
33
+ const app = ctx.app;
34
+ const params = ctx.feathers;
35
+ const context = { app, params };
36
+ await hook(context);
37
+ ctx.feathers = context.params;
38
+ return next();
39
+ };
40
+ }
41
+ exports.authenticate = authenticate;
42
+ //# sourceMappingURL=authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":";;;AACA,iDAAiD;AACjD,+DAA6E;AAI7E,MAAM,KAAK,GAAG,IAAA,qBAAW,EAAC,gCAAgC,CAAC,CAAA;AAO3D,SAAgB,mBAAmB,CAAC,WAAmC,EAAE;IACvE,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;;QACzB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;QACnB,MAAM,OAAO,GAAG,MAAA,GAAG,CAAC,qBAAqB,oDAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;QAE7D,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,IAAI,EAAE,CAAA;SACd;QAED,MAAM,MAAM,GAAG,OAAO,CAAC,aAAa,CAAA;QACpC,MAAM,cAAc,GAAG,QAAQ,CAAC,UAAU,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,cAAc,IAAI,EAAE,CAAA;QAEnG,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;YAC/B,KAAK,CAAC,gFAAgF,CAAC,CAAA;YACvF,OAAO,IAAI,EAAE,CAAA;SACd;QAED,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,cAAc,CAAC,CAAA;QAE/E,IAAI,cAAc,EAAE;YAClB,KAAK,CAAC,wCAAwC,EAAE,cAAc,CAAC,CAAA;YAC/D,GAAG,CAAC,QAAQ,GAAG,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,cAAc,EAAE,CAAA;SACnD;QAED,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AA1BD,kDA0BC;AAED,SAAgB,YAAY,CAAC,QAAyC,EAAE,GAAG,UAAoB;IAC7F,MAAM,IAAI,GAAG,IAAA,6BAAgB,EAAC,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAA;IAEtD,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAkB,CAAA;QAClC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAA;QAC3B,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,MAAM,EAAiB,CAAA;QAE9C,MAAM,IAAI,CAAC,OAAO,CAAC,CAAA;QAEnB,GAAG,CAAC,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAA;QAE7B,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAdD,oCAcC"}
@@ -1,13 +1,30 @@
1
1
  /// <reference types="node" />
2
- /// <reference types="koa-bodyparser" />
3
- import Koa from 'koa';
2
+ import Koa, { Next } from 'koa';
4
3
  import { Server } from 'http';
5
- import { Application as FeathersApplication } from '@feathersjs/feathers';
4
+ import { Application as FeathersApplication, HookContext, Params, RouteLookup } from '@feathersjs/feathers';
6
5
  import '@feathersjs/authentication';
7
- export declare type ApplicationAddons = {
6
+ export type ApplicationAddons = {
7
+ server: Server;
8
8
  listen(port?: number, ...args: any[]): Promise<Server>;
9
9
  };
10
- export declare type Application<T = any, C = any> = Omit<Koa, 'listen'> & FeathersApplication<T, C> & ApplicationAddons;
11
- export declare type FeathersKoaContext<A = Application> = Koa.Context & {
10
+ export type Application<T = any, C = any> = Omit<Koa, 'listen'> & FeathersApplication<T, C> & ApplicationAddons;
11
+ export type FeathersKoaContext<A = Application> = Koa.Context & {
12
12
  app: A;
13
13
  };
14
+ export type Middleware<A = Application> = (context: FeathersKoaContext<A>, next: Next) => any;
15
+ declare module '@feathersjs/feathers/lib/declarations' {
16
+ interface ServiceOptions {
17
+ koa?: {
18
+ before?: Middleware[];
19
+ after?: Middleware[];
20
+ composed?: Middleware;
21
+ };
22
+ }
23
+ }
24
+ declare module 'koa' {
25
+ interface ExtendableContext {
26
+ feathers?: Partial<Params>;
27
+ lookup?: RouteLookup;
28
+ hook?: HookContext;
29
+ }
30
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":";;AAGA,sCAAoC"}
1
+ {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":";;AAGA,sCAAmC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.errorHandler = void 0;
4
+ const errors_1 = require("@feathersjs/errors");
5
+ const errorHandler = () => async (ctx, next) => {
6
+ try {
7
+ await next();
8
+ if (ctx.body === undefined) {
9
+ throw new errors_1.NotFound(`Path ${ctx.path} not found`);
10
+ }
11
+ }
12
+ catch (error) {
13
+ ctx.response.status = error instanceof errors_1.FeathersError ? error.code : 500;
14
+ ctx.body =
15
+ typeof error.toJSON === 'function'
16
+ ? error.toJSON()
17
+ : {
18
+ message: error.message
19
+ };
20
+ }
21
+ };
22
+ exports.errorHandler = errorHandler;
23
+ //# sourceMappingURL=handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAGrD,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAuB,EAAE,IAAwB,EAAE,EAAE;IAC5F,IAAI;QACF,MAAM,IAAI,EAAE,CAAA;QAEZ,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;YAC1B,MAAM,IAAI,iBAAQ,CAAC,QAAQ,GAAG,CAAC,IAAI,YAAY,CAAC,CAAA;SACjD;KACF;IAAC,OAAO,KAAU,EAAE;QACnB,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,YAAY,sBAAa,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAA;QACvE,GAAG,CAAC,IAAI;YACN,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU;gBAChC,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;gBAChB,CAAC,CAAC;oBACE,OAAO,EAAE,KAAK,CAAC,OAAO;iBACvB,CAAA;KACR;AACH,CAAC,CAAA;AAhBY,QAAA,YAAY,gBAgBxB"}
package/lib/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import Koa from 'koa';
2
- import bodyParser from 'koa-bodyparser';
3
2
  import { Application as FeathersApplication } from '@feathersjs/feathers';
3
+ import bodyParser from 'koa-bodyparser';
4
+ import cors from '@koa/cors';
5
+ import serveStatic from 'koa-static';
4
6
  import { Application } from './declarations';
5
- import { errorHandler } from './error-handler';
7
+ export { Koa, bodyParser, cors, serveStatic };
8
+ export * from './authentication';
6
9
  export * from './declarations';
7
- export * from './authenticate';
8
- export { rest } from './rest';
9
- export { Koa, bodyParser, errorHandler };
10
- export declare function koa(_app?: FeathersApplication): Application<any>;
10
+ export * from './handlers';
11
+ export * from './rest';
12
+ export declare function koa<S = any, C = any>(feathersApp?: FeathersApplication<S, C>, koaApp?: Koa): Application<S, C>;
package/lib/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -9,76 +13,86 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
- return new (P || (P = Promise))(function (resolve, reject) {
15
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
- step((generator = generator.apply(thisArg, _arguments || [])).next());
19
- });
20
- };
21
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
22
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
23
18
  };
24
19
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.koa = exports.errorHandler = exports.bodyParser = exports.Koa = exports.rest = void 0;
20
+ exports.koa = exports.serveStatic = exports.cors = exports.bodyParser = exports.Koa = void 0;
26
21
  const koa_1 = __importDefault(require("koa"));
27
22
  exports.Koa = koa_1.default;
28
- const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
29
- exports.bodyParser = koa_bodyparser_1.default;
30
23
  const koa_qs_1 = __importDefault(require("koa-qs"));
31
24
  const transport_commons_1 = require("@feathersjs/transport-commons");
32
25
  const commons_1 = require("@feathersjs/commons");
33
- const error_handler_1 = require("./error-handler");
34
- Object.defineProperty(exports, "errorHandler", { enumerable: true, get: function () { return error_handler_1.errorHandler; } });
35
- const debug = commons_1.createDebug('@feathersjs/koa');
26
+ const koa_bodyparser_1 = __importDefault(require("koa-bodyparser"));
27
+ exports.bodyParser = koa_bodyparser_1.default;
28
+ const cors_1 = __importDefault(require("@koa/cors"));
29
+ exports.cors = cors_1.default;
30
+ const koa_static_1 = __importDefault(require("koa-static"));
31
+ exports.serveStatic = koa_static_1.default;
32
+ __exportStar(require("./authentication"), exports);
36
33
  __exportStar(require("./declarations"), exports);
37
- __exportStar(require("./authenticate"), exports);
38
- var rest_1 = require("./rest");
39
- Object.defineProperty(exports, "rest", { enumerable: true, get: function () { return rest_1.rest; } });
40
- function koa(_app) {
41
- const koaApp = new koa_1.default();
42
- if (!_app) {
34
+ __exportStar(require("./handlers"), exports);
35
+ __exportStar(require("./rest"), exports);
36
+ const debug = (0, commons_1.createDebug)('@feathersjs/koa');
37
+ function koa(feathersApp, koaApp = new koa_1.default()) {
38
+ if (!feathersApp) {
43
39
  return koaApp;
44
40
  }
45
- if (typeof _app.setup !== 'function') {
41
+ if (typeof feathersApp.setup !== 'function') {
46
42
  throw new Error('@feathersjs/koa requires a valid Feathers application instance');
47
43
  }
48
- const app = _app;
44
+ const app = feathersApp;
49
45
  const { listen: koaListen, use: koaUse } = koaApp;
50
- const oldUse = app.use;
46
+ const { use: feathersUse, teardown: feathersTeardown } = feathersApp;
51
47
  Object.assign(app, {
52
48
  use(location, ...args) {
53
49
  if (typeof location === 'string') {
54
- return oldUse.call(this, location, ...args);
50
+ return feathersUse.call(this, location, ...args);
55
51
  }
56
52
  return koaUse.call(this, location);
57
53
  },
58
- listen(port, ...args) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- const server = koaListen.call(this, port, ...args);
61
- yield this.setup(server);
62
- debug('Feathers application listening');
63
- return server;
64
- });
54
+ async listen(port, ...args) {
55
+ const server = koaListen.call(this, port, ...args);
56
+ this.server = server;
57
+ await this.setup(server);
58
+ debug('Feathers application listening');
59
+ return server;
60
+ },
61
+ async teardown(server) {
62
+ return feathersTeardown
63
+ .call(this, server)
64
+ .then(() => new Promise((resolve, reject) => this.server.close((e) => (e ? reject(e) : resolve(this)))));
65
65
  }
66
66
  });
67
- const feathersDescriptors = Object.assign(Object.assign({}, Object.getOwnPropertyDescriptors(Object.getPrototypeOf(app))), Object.getOwnPropertyDescriptors(app));
68
- const koaDescriptors = Object.assign(Object.assign({}, Object.getOwnPropertyDescriptors(Object.getPrototypeOf(koaApp))), Object.getOwnPropertyDescriptors(koaApp));
67
+ const appDescriptors = {
68
+ ...Object.getOwnPropertyDescriptors(Object.getPrototypeOf(app)),
69
+ ...Object.getOwnPropertyDescriptors(app)
70
+ };
71
+ const newDescriptors = {
72
+ ...Object.getOwnPropertyDescriptors(Object.getPrototypeOf(koaApp)),
73
+ ...Object.getOwnPropertyDescriptors(koaApp)
74
+ };
69
75
  // Copy all non-existing properties (including non-enumerables)
70
76
  // that don't already exist on the Express app
71
- Object.keys(koaDescriptors).forEach(prop => {
72
- const feathersProp = feathersDescriptors[prop];
73
- const koaProp = koaDescriptors[prop];
74
- if (koaProp !== undefined && feathersProp === undefined) {
75
- Object.defineProperty(app, prop, koaProp);
77
+ Object.keys(newDescriptors).forEach((prop) => {
78
+ const appProp = appDescriptors[prop];
79
+ const newProp = newDescriptors[prop];
80
+ if (appProp === undefined && newProp !== undefined) {
81
+ Object.defineProperty(app, prop, newProp);
76
82
  }
77
83
  });
78
- koa_qs_1.default(app);
79
- app.configure(transport_commons_1.routing());
84
+ (0, koa_qs_1.default)(app);
85
+ Object.getOwnPropertySymbols(koaApp).forEach((symbol) => {
86
+ const target = app;
87
+ const source = koaApp;
88
+ target[symbol] = source[symbol];
89
+ });
90
+ // This reinitializes hooks
91
+ app.setup = feathersApp.setup;
92
+ app.teardown = feathersApp.teardown;
93
+ app.configure((0, transport_commons_1.routing)());
80
94
  app.use((ctx, next) => {
81
- ctx.feathers = { provider: 'rest' };
95
+ ctx.feathers = { ...ctx.feathers, provider: 'rest' };
82
96
  return next();
83
97
  });
84
98
  return app;
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAsB;AAeb,cAfF,aAAG,CAeE;AAdZ,oEAAwC;AAc1B,qBAdP,wBAAU,CAcO;AAbxB,oDAA2B;AAE3B,qEAAwD;AACxD,iDAAkD;AAGlD,mDAA+C;AAOrB,6FAPjB,4BAAY,OAOiB;AALtC,MAAM,KAAK,GAAG,qBAAW,CAAC,iBAAiB,CAAC,CAAC;AAE7C,iDAA+B;AAC/B,iDAA+B;AAC/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AAGb,SAAgB,GAAG,CAAE,IAA0B;IAC7C,MAAM,MAAM,GAAG,IAAI,aAAG,EAAE,CAAC;IAEzB,IAAI,CAAC,IAAI,EAAE;QACT,OAAO,MAAqC,CAAC;KAC9C;IAED,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,UAAU,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;KACnF;IAED,MAAM,GAAG,GAAG,IAAmB,CAAC;IAChC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAClD,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC;IAEvB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;QACjB,GAAG,CAAE,QAA+B,EAAE,GAAG,IAAW;YAClD,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;gBAChC,OAAQ,MAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,CAAC;aACtD;YAED,OA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C,cAAc,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;QACpC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;QAEpC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE;YAClD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;SAC1C;IACH,CAAC,CAAC,CAAA;IAEF,IAAA,gBAAK,EAAC,GAAU,CAAC,CAAA;IAEjB,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,GAAU,CAAA;QACzB,MAAM,MAAM,GAAG,MAAa,CAAA;QAE5B,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,2BAA2B;IAC3B,GAAG,CAAC,KAAK,GAAG,WAAW,CAAC,KAAY,CAAA;IACpC,GAAG,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAe,CAAA;IAE1C,GAAG,CAAC,SAAS,CAAC,IAAA,2BAAO,GAAS,CAAC,CAAA;IAC/B,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACpB,GAAG,CAAC,QAAQ,GAAG,EAAE,GAAG,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAA;QACpD,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC;AApFD,kBAoFC"}
package/lib/rest.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- import { Next } from 'koa';
2
- import { FeathersKoaContext } from './declarations';
3
- export declare function rest(): (ctx: FeathersKoaContext, next: Next) => Promise<any>;
1
+ import { Application, Middleware } from './declarations';
2
+ import { AuthenticationSettings } from './authentication';
3
+ export declare const formatter: Middleware;
4
+ export type RestOptions = {
5
+ formatter?: Middleware;
6
+ authentication?: AuthenticationSettings;
7
+ };
8
+ export declare const rest: (options?: RestOptions | Middleware) => (app: Application) => void;