@feathersjs/koa 5.0.39 → 6.0.0-pre.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 +49 -0
- package/README.md +1 -1
- package/lib/authentication.d.ts +1 -1
- package/lib/authentication.js +6 -10
- package/lib/authentication.js.map +1 -1
- package/lib/declarations.d.ts +2 -2
- package/lib/declarations.js +1 -3
- package/lib/declarations.js.map +1 -1
- package/lib/handlers.d.ts +1 -1
- package/lib/handlers.js +4 -8
- package/lib/handlers.js.map +1 -1
- package/lib/index.d.ts +6 -6
- package/lib/index.js +14 -40
- package/lib/index.js.map +1 -1
- package/lib/rest.d.ts +2 -2
- package/lib/rest.js +21 -29
- package/lib/rest.js.map +1 -1
- package/package.json +13 -13
- package/src/authentication.ts +2 -3
- package/src/declarations.ts +7 -2
- package/src/handlers.ts +1 -1
- package/src/index.ts +6 -9
- package/src/rest.ts +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,55 @@
|
|
|
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
|
+
# 6.0.0-pre.0 (2026-01-31)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **cli:** Improve generated application and client ([#2701](https://github.com/feathersjs/feathers/issues/2701)) ([bd55ffb](https://github.com/feathersjs/feathers/commit/bd55ffb812e89bf215f4515e7f137656ea888c3f))
|
|
11
|
+
- **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))
|
|
12
|
+
- **core:** Update to latest feathersjs/hooks ([#3434](https://github.com/feathersjs/feathers/issues/3434)) ([1499ccc](https://github.com/feathersjs/feathers/commit/1499ccc41fb3ebba97b2c84e0cb19bc48ad3c651))
|
|
13
|
+
- **dependencies:** Lock monorepo package version numbers ([#2623](https://github.com/feathersjs/feathers/issues/2623)) ([5640c10](https://github.com/feathersjs/feathers/commit/5640c1020cc139994e695d658c08bad3494db507))
|
|
14
|
+
- **dependencies:** Update all dependencies ([#3139](https://github.com/feathersjs/feathers/issues/3139)) ([f24276e](https://github.com/feathersjs/feathers/commit/f24276e9a909e2e58a0730c730258ce1f70f4028))
|
|
15
|
+
- **dependencies:** Update all dependencies ([#3545](https://github.com/feathersjs/feathers/issues/3545)) ([221b92b](https://github.com/feathersjs/feathers/commit/221b92bb0ee5d54fb1036742968797cb02e56da2))
|
|
16
|
+
- **dependencies:** Update all dependencies ([#3625](https://github.com/feathersjs/feathers/issues/3625)) ([2698e4e](https://github.com/feathersjs/feathers/commit/2698e4e2996fbf479d82435938d907bc3d5b583a))
|
|
17
|
+
- **dependencies:** Update dependencies ([#3571](https://github.com/feathersjs/feathers/issues/3571)) ([ad611cb](https://github.com/feathersjs/feathers/commit/ad611cb6ffb1dc31d603ba5817331318c5a23217))
|
|
18
|
+
- **knex:** Update all dependencies and Knex peer ([#3308](https://github.com/feathersjs/feathers/issues/3308)) ([d2f9860](https://github.com/feathersjs/feathers/commit/d2f986036c4741cce2339d8abbcc6b2eb037a12a))
|
|
19
|
+
- **koa:** Ensure .teardown works without a server ([#3234](https://github.com/feathersjs/feathers/issues/3234)) ([818572d](https://github.com/feathersjs/feathers/commit/818572df98456bc3e1a300e879329aa8f849be64))
|
|
20
|
+
- **koa:** Fix missing dependency on feathers ([#3061](https://github.com/feathersjs/feathers/issues/3061)) ([80dc95f](https://github.com/feathersjs/feathers/commit/80dc95ff85c9074b8f70e3ff71562f18863ef2be))
|
|
21
|
+
- **koa:** Make Koa app inspectable ([#3069](https://github.com/feathersjs/feathers/issues/3069)) ([4fbbfff](https://github.com/feathersjs/feathers/commit/4fbbfff2a3c625f8e6929e5a09e2cf7b739ffe11))
|
|
22
|
+
- **koa:** Only set error code for Feathers errors ([#2793](https://github.com/feathersjs/feathers/issues/2793)) ([d3ee41e](https://github.com/feathersjs/feathers/commit/d3ee41e27b0ea5d29b344d6584ab03e48d16e2b4))
|
|
23
|
+
- **koa:** Replace koa-bodyparser with koa-body ([#3093](https://github.com/feathersjs/feathers/issues/3093)) ([2456bf8](https://github.com/feathersjs/feathers/commit/2456bf882c99ae2cddd1a39bffba7e61217fc055))
|
|
24
|
+
- **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))
|
|
25
|
+
- **koa:** Use extended query parser for compatibility ([#2397](https://github.com/feathersjs/feathers/issues/2397)) ([b2944ba](https://github.com/feathersjs/feathers/commit/b2944bac3ec6d5ecc80dc518cd4e58093692db74))
|
|
26
|
+
- Make sure all Readme files are up to date ([#3154](https://github.com/feathersjs/feathers/issues/3154)) ([a5f0b38](https://github.com/feathersjs/feathers/commit/a5f0b38bbf2a11486415a39533bcc6c67fb51e3e))
|
|
27
|
+
- **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))
|
|
28
|
+
- **typescript:** Overall typing improvements ([#2478](https://github.com/feathersjs/feathers/issues/2478)) ([b8eb804](https://github.com/feathersjs/feathers/commit/b8eb804158556d9651a8607e3c3fda15e0bfd110))
|
|
29
|
+
- Update all dependencies ([#3024](https://github.com/feathersjs/feathers/issues/3024)) ([283dc47](https://github.com/feathersjs/feathers/commit/283dc4798d85584bc031e6e54b83b4ea77d1edd0))
|
|
30
|
+
- Update all dependencies ([#3613](https://github.com/feathersjs/feathers/issues/3613)) ([5136bbd](https://github.com/feathersjs/feathers/commit/5136bbd2e2eeb4e6579e07c9e914006629542363))
|
|
31
|
+
- Update dependencies ([#3584](https://github.com/feathersjs/feathers/issues/3584)) ([119fa4e](https://github.com/feathersjs/feathers/commit/119fa4e1ade8b0078aa235083d566e2538b3a084))
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
- **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))
|
|
36
|
+
- 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))
|
|
37
|
+
- **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))
|
|
38
|
+
- **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))
|
|
39
|
+
- **cli:** Initial Feathers v5 CLI and Pinion generator ([#2578](https://github.com/feathersjs/feathers/issues/2578)) ([7f59ae7](https://github.com/feathersjs/feathers/commit/7f59ae7f1471895ba8a82aa4702f1a23f71b7682))
|
|
40
|
+
- **core:** add `context.http` and move `statusCode` there ([#2496](https://github.com/feathersjs/feathers/issues/2496)) ([b701bf7](https://github.com/feathersjs/feathers/commit/b701bf77fb83048aa1dffa492b3d77dd53f7b72b))
|
|
41
|
+
- **core:** Add app.teardown functionality ([#2570](https://github.com/feathersjs/feathers/issues/2570)) ([fcdf524](https://github.com/feathersjs/feathers/commit/fcdf524ae1995bb59265d39f12e98b7794bed023))
|
|
42
|
+
- **core:** Allow to unregister services at runtime ([#2756](https://github.com/feathersjs/feathers/issues/2756)) ([d16601f](https://github.com/feathersjs/feathers/commit/d16601f2277dca5357866ffdefba2a611f6dc7fa))
|
|
43
|
+
- **core:** Finalize app.teardown() functionality ([#2584](https://github.com/feathersjs/feathers/issues/2584)) ([1a166f3](https://github.com/feathersjs/feathers/commit/1a166f3ded811ecacf0ae8cb67880bc9fa2eeafa))
|
|
44
|
+
- ES module v5 compatibility layer for v6 ([#3607](https://github.com/feathersjs/feathers/issues/3607)) ([1dfff88](https://github.com/feathersjs/feathers/commit/1dfff8832eedca895eeaafd7f3acf0f8a27be23c))
|
|
45
|
+
- **express, koa:** make transports similar ([#2486](https://github.com/feathersjs/feathers/issues/2486)) ([26aa937](https://github.com/feathersjs/feathers/commit/26aa937c114fb8596dfefc599b1f53cead69c159))
|
|
46
|
+
- **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))
|
|
47
|
+
- **koa:** KoaJS transport adapter ([#2315](https://github.com/feathersjs/feathers/issues/2315)) ([2554b57](https://github.com/feathersjs/feathers/commit/2554b57cf05731df58feeba9c12faab18e442107))
|
|
48
|
+
- **transport-commons:** add `context.http.response` ([#2524](https://github.com/feathersjs/feathers/issues/2524)) ([5bc9d44](https://github.com/feathersjs/feathers/commit/5bc9d447043c2e2b742c73ed28ecf3b3264dd9e5))
|
|
49
|
+
- v5 compatibility layer for v6 ([7415d5a](https://github.com/feathersjs/feathers/commit/7415d5addbb9943cfaf8a7a942ca542c6d99bceb))
|
|
50
|
+
|
|
51
|
+
### BREAKING CHANGES
|
|
52
|
+
|
|
53
|
+
- All packages are now ES modules only
|
|
54
|
+
|
|
6
55
|
## [5.0.39](https://github.com/feathersjs/feathers/compare/v5.0.38...v5.0.39) (2026-01-31)
|
|
7
56
|
|
|
8
57
|
**Note:** Version bump only for package @feathersjs/koa
|
package/README.md
CHANGED
|
@@ -18,6 +18,6 @@ Refer to the [Feathers Koa API documentation](https://feathersjs.com/api/koa.htm
|
|
|
18
18
|
|
|
19
19
|
## License
|
|
20
20
|
|
|
21
|
-
Copyright (c)
|
|
21
|
+
Copyright (c) 2025 [Feathers contributors](https://github.com/feathersjs/feathers/graphs/contributors)
|
|
22
22
|
|
|
23
23
|
Licensed under the [MIT license](LICENSE).
|
package/lib/authentication.d.ts
CHANGED
package/lib/authentication.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const commons_1 = require("@feathersjs/commons");
|
|
6
|
-
const authentication_1 = require("@feathersjs/authentication");
|
|
7
|
-
const debug = (0, commons_1.createDebug)('@feathersjs/koa/authentication');
|
|
8
|
-
function parseAuthentication(settings = {}) {
|
|
1
|
+
import { createDebug } from '@feathersjs/commons';
|
|
2
|
+
import { authenticate as AuthenticateHook } from '@feathersjs/authentication';
|
|
3
|
+
const debug = createDebug('@feathersjs/koa/authentication');
|
|
4
|
+
export function parseAuthentication(settings = {}) {
|
|
9
5
|
return async (ctx, next) => {
|
|
10
6
|
var _a;
|
|
11
7
|
const app = ctx.app;
|
|
@@ -27,8 +23,8 @@ function parseAuthentication(settings = {}) {
|
|
|
27
23
|
return next();
|
|
28
24
|
};
|
|
29
25
|
}
|
|
30
|
-
function authenticate(settings, ...strategies) {
|
|
31
|
-
const hook = (
|
|
26
|
+
export function authenticate(settings, ...strategies) {
|
|
27
|
+
const hook = AuthenticateHook(settings, ...strategies);
|
|
32
28
|
return async (ctx, next) => {
|
|
33
29
|
const app = ctx.app;
|
|
34
30
|
const params = ctx.feathers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAG7E,MAAM,KAAK,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,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"}
|
package/lib/declarations.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Koa, { Next } from 'koa';
|
|
2
2
|
import { Server } from 'http';
|
|
3
|
-
import { Application as FeathersApplication, HookContext, Params, RouteLookup } from '@feathersjs/feathers';
|
|
3
|
+
import type { Application as FeathersApplication, HookContext, Params, RouteLookup } from '@feathersjs/feathers';
|
|
4
4
|
import '@feathersjs/authentication';
|
|
5
5
|
export type ApplicationAddons = {
|
|
6
6
|
server: Server;
|
|
@@ -11,7 +11,7 @@ export type FeathersKoaContext<A = Application> = Koa.Context & {
|
|
|
11
11
|
app: A;
|
|
12
12
|
};
|
|
13
13
|
export type Middleware<A = Application> = (context: FeathersKoaContext<A>, next: Next) => any;
|
|
14
|
-
declare module '@feathersjs/feathers
|
|
14
|
+
declare module '@feathersjs/feathers' {
|
|
15
15
|
interface ServiceOptions {
|
|
16
16
|
koa?: {
|
|
17
17
|
before?: Middleware[];
|
package/lib/declarations.js
CHANGED
package/lib/declarations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAQA,OAAO,4BAA4B,CAAA"}
|
package/lib/handlers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { FeathersKoaContext } from './declarations';
|
|
1
|
+
import { FeathersKoaContext } from './declarations.js';
|
|
2
2
|
export declare const errorHandler: () => (ctx: FeathersKoaContext, next: () => Promise<any>) => Promise<void>;
|
package/lib/handlers.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.errorHandler = void 0;
|
|
4
|
-
const errors_1 = require("@feathersjs/errors");
|
|
5
|
-
const errorHandler = () => async (ctx, next) => {
|
|
1
|
+
import { FeathersError, NotFound } from '@feathersjs/errors';
|
|
2
|
+
export const errorHandler = () => async (ctx, next) => {
|
|
6
3
|
try {
|
|
7
4
|
await next();
|
|
8
5
|
if (ctx.body === undefined) {
|
|
9
|
-
throw new
|
|
6
|
+
throw new NotFound(`Path ${ctx.path} not found`);
|
|
10
7
|
}
|
|
11
8
|
}
|
|
12
9
|
catch (error) {
|
|
13
|
-
ctx.response.status = error instanceof
|
|
10
|
+
ctx.response.status = error instanceof FeathersError ? error.code : 500;
|
|
14
11
|
ctx.body =
|
|
15
12
|
typeof error.toJSON === 'function'
|
|
16
13
|
? error.toJSON()
|
|
@@ -19,5 +16,4 @@ const errorHandler = () => async (ctx, next) => {
|
|
|
19
16
|
};
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
exports.errorHandler = errorHandler;
|
|
23
19
|
//# sourceMappingURL=handlers.js.map
|
package/lib/handlers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAG5D,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,KAAK,EAAE,GAAuB,EAAE,IAAwB,EAAE,EAAE;IAC5F,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAA;QAEZ,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,QAAQ,CAAC,QAAQ,GAAG,CAAC,IAAI,YAAY,CAAC,CAAA;QAClD,CAAC;IACH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,KAAK,YAAY,aAAa,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;IACT,CAAC;AACH,CAAC,CAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import Koa from 'koa';
|
|
2
|
-
import { Application as FeathersApplication } from '@feathersjs/feathers';
|
|
2
|
+
import type { Application as FeathersApplication } from '@feathersjs/feathers';
|
|
3
3
|
import { koaBody as bodyParser } from 'koa-body';
|
|
4
4
|
import cors from '@koa/cors';
|
|
5
5
|
import serveStatic from 'koa-static';
|
|
6
|
-
import { Application } from './declarations';
|
|
6
|
+
import type { Application } from './declarations.js';
|
|
7
7
|
export { Koa, bodyParser, cors, serveStatic };
|
|
8
|
-
export * from './authentication';
|
|
9
|
-
export * from './declarations';
|
|
10
|
-
export * from './handlers';
|
|
11
|
-
export * from './rest';
|
|
8
|
+
export * from './authentication.js';
|
|
9
|
+
export * from './declarations.js';
|
|
10
|
+
export * from './handlers.js';
|
|
11
|
+
export * from './rest.js';
|
|
12
12
|
export declare function koa<S = any, C = any>(feathersApp?: FeathersApplication<S, C>, koaApp?: Koa): Application<S, C>;
|
package/lib/index.js
CHANGED
|
@@ -1,41 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.serveStatic = exports.cors = exports.bodyParser = exports.Koa = void 0;
|
|
21
|
-
exports.koa = koa;
|
|
22
|
-
const koa_1 = __importDefault(require("koa"));
|
|
23
|
-
exports.Koa = koa_1.default;
|
|
24
|
-
const koa_qs_1 = __importDefault(require("koa-qs"));
|
|
25
|
-
const transport_commons_1 = require("@feathersjs/transport-commons");
|
|
26
|
-
const commons_1 = require("@feathersjs/commons");
|
|
27
|
-
const koa_body_1 = require("koa-body");
|
|
28
|
-
Object.defineProperty(exports, "bodyParser", { enumerable: true, get: function () { return koa_body_1.koaBody; } });
|
|
29
|
-
const cors_1 = __importDefault(require("@koa/cors"));
|
|
30
|
-
exports.cors = cors_1.default;
|
|
31
|
-
const koa_static_1 = __importDefault(require("koa-static"));
|
|
32
|
-
exports.serveStatic = koa_static_1.default;
|
|
33
|
-
__exportStar(require("./authentication"), exports);
|
|
34
|
-
__exportStar(require("./declarations"), exports);
|
|
35
|
-
__exportStar(require("./handlers"), exports);
|
|
36
|
-
__exportStar(require("./rest"), exports);
|
|
37
|
-
const debug = (0, commons_1.createDebug)('@feathersjs/koa');
|
|
38
|
-
function koa(feathersApp, koaApp = new koa_1.default()) {
|
|
1
|
+
import Koa from 'koa';
|
|
2
|
+
import koaQs from 'koa-qs';
|
|
3
|
+
import { createDebug } from '@feathersjs/commons';
|
|
4
|
+
import { koaBody as bodyParser } from 'koa-body';
|
|
5
|
+
import cors from '@koa/cors';
|
|
6
|
+
import serveStatic from 'koa-static';
|
|
7
|
+
export { Koa, bodyParser, cors, serveStatic };
|
|
8
|
+
export * from './authentication.js';
|
|
9
|
+
export * from './declarations.js';
|
|
10
|
+
export * from './handlers.js';
|
|
11
|
+
export * from './rest.js';
|
|
12
|
+
const debug = createDebug('@feathersjs/koa');
|
|
13
|
+
export function koa(feathersApp, koaApp = new Koa()) {
|
|
39
14
|
if (!feathersApp) {
|
|
40
15
|
return koaApp;
|
|
41
16
|
}
|
|
@@ -87,7 +62,7 @@ function koa(feathersApp, koaApp = new koa_1.default()) {
|
|
|
87
62
|
Object.defineProperty(app, prop, newProp);
|
|
88
63
|
}
|
|
89
64
|
});
|
|
90
|
-
(
|
|
65
|
+
koaQs(app);
|
|
91
66
|
Object.getOwnPropertySymbols(koaApp).forEach((symbol) => {
|
|
92
67
|
const target = app;
|
|
93
68
|
const source = koaApp;
|
|
@@ -96,7 +71,6 @@ function koa(feathersApp, koaApp = new koa_1.default()) {
|
|
|
96
71
|
// This reinitializes hooks
|
|
97
72
|
app.setup = feathersApp.setup;
|
|
98
73
|
app.teardown = feathersApp.teardown;
|
|
99
|
-
app.configure((0, transport_commons_1.routing)());
|
|
100
74
|
app.use((ctx, next) => {
|
|
101
75
|
ctx.feathers = { ...ctx.feathers, provider: 'rest' };
|
|
102
76
|
return next();
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAA;AACrB,OAAO,KAAK,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO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,IAAI,CAAC,CAAA;QAEpC,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YACnD,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QAC3C,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,KAAK,CAAC,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,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"}
|
package/lib/rest.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Application, Middleware } from './declarations';
|
|
2
|
-
import { AuthenticationSettings } from './authentication';
|
|
1
|
+
import type { Application, Middleware } from './declarations.js';
|
|
2
|
+
import { AuthenticationSettings } from './authentication.js';
|
|
3
3
|
export declare const formatter: Middleware;
|
|
4
4
|
export type RestOptions = {
|
|
5
5
|
formatter?: Middleware;
|
package/lib/rest.js
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const transport_commons_1 = require("@feathersjs/transport-commons");
|
|
9
|
-
const commons_1 = require("@feathersjs/commons");
|
|
10
|
-
const feathers_1 = require("@feathersjs/feathers");
|
|
11
|
-
const errors_1 = require("@feathersjs/errors");
|
|
12
|
-
const authentication_1 = require("./authentication");
|
|
13
|
-
const debug = (0, commons_1.createDebug)('@feathersjs/koa/rest');
|
|
1
|
+
import compose from 'koa-compose';
|
|
2
|
+
import { http } from '@feathersjs/transport-commons';
|
|
3
|
+
import { createDebug } from '@feathersjs/commons';
|
|
4
|
+
import { getServiceOptions, defaultServiceMethods, createContext } from '@feathersjs/feathers';
|
|
5
|
+
import { MethodNotAllowed } from '@feathersjs/errors';
|
|
6
|
+
import { parseAuthentication } from './authentication.js';
|
|
7
|
+
const debug = createDebug('@feathersjs/koa/rest');
|
|
14
8
|
const serviceMiddleware = () => {
|
|
15
9
|
return async (ctx, next) => {
|
|
16
10
|
const { query, headers, path, body: data, method: httpMethod } = ctx.request;
|
|
17
|
-
const methodOverride = ctx.request.headers[
|
|
11
|
+
const methodOverride = ctx.request.headers[http.METHOD_HEADER];
|
|
18
12
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
19
13
|
const { service, params: { __id: id = null, ...route } = {} } = ctx.lookup;
|
|
20
|
-
const method =
|
|
21
|
-
const { methods } =
|
|
14
|
+
const method = http.getServiceMethod(httpMethod, id, methodOverride);
|
|
15
|
+
const { methods } = getServiceOptions(service);
|
|
22
16
|
debug(`Found service for path ${path}, attempting to run '${method}' service method`);
|
|
23
|
-
if (!methods.includes(method) ||
|
|
24
|
-
const error = new
|
|
17
|
+
if (!methods.includes(method) || defaultServiceMethods.includes(methodOverride)) {
|
|
18
|
+
const error = new MethodNotAllowed(`Method \`${method}\` is not supported by this endpoint.`);
|
|
25
19
|
ctx.response.status = error.code;
|
|
26
20
|
throw error;
|
|
27
21
|
}
|
|
28
|
-
const createArguments =
|
|
22
|
+
const createArguments = http.argumentsFor[method] || http.argumentsFor.default;
|
|
29
23
|
const params = { query, headers, route, ...ctx.feathers };
|
|
30
24
|
const args = createArguments({ id, data, params });
|
|
31
|
-
const contextBase =
|
|
25
|
+
const contextBase = createContext(service, method, { http: {} });
|
|
32
26
|
ctx.hook = contextBase;
|
|
33
27
|
const context = await service[method](...args, contextBase);
|
|
34
28
|
ctx.hook = context;
|
|
35
|
-
const response =
|
|
29
|
+
const response = http.getResponse(context);
|
|
36
30
|
ctx.status = response.status;
|
|
37
31
|
ctx.set(response.headers);
|
|
38
32
|
ctx.body = response.body;
|
|
@@ -47,29 +41,27 @@ const servicesMiddleware = () => {
|
|
|
47
41
|
return next();
|
|
48
42
|
}
|
|
49
43
|
ctx.lookup = lookup;
|
|
50
|
-
const options =
|
|
44
|
+
const options = getServiceOptions(lookup.service);
|
|
51
45
|
const middleware = options.koa.composed;
|
|
52
46
|
return middleware(ctx, next);
|
|
53
47
|
};
|
|
54
48
|
};
|
|
55
49
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
56
|
-
const formatter = (_ctx, _next) => { };
|
|
57
|
-
|
|
58
|
-
const rest = (options) => {
|
|
50
|
+
export const formatter = (_ctx, _next) => { };
|
|
51
|
+
export const rest = (options) => {
|
|
59
52
|
options = typeof options === 'function' ? { formatter: options } : options || {};
|
|
60
|
-
const formatterMiddleware = options.formatter ||
|
|
53
|
+
const formatterMiddleware = options.formatter || formatter;
|
|
61
54
|
const authenticationOptions = options.authentication;
|
|
62
55
|
return (app) => {
|
|
63
|
-
app.use(
|
|
56
|
+
app.use(parseAuthentication(authenticationOptions));
|
|
64
57
|
app.use(servicesMiddleware());
|
|
65
58
|
app.mixins.push((_service, _path, options) => {
|
|
66
59
|
const { koa: { before = [], after = [] } = {} } = options;
|
|
67
60
|
const middlewares = [].concat(before, serviceMiddleware(), after, formatterMiddleware);
|
|
68
|
-
const middleware = (
|
|
61
|
+
const middleware = compose(middlewares);
|
|
69
62
|
options.koa || (options.koa = {});
|
|
70
63
|
options.koa.composed = middleware;
|
|
71
64
|
});
|
|
72
65
|
};
|
|
73
66
|
};
|
|
74
|
-
exports.rest = rest;
|
|
75
67
|
//# sourceMappingURL=rest.js.map
|
package/lib/rest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../src/rest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../src/rest.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,aAAa,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,EAA0B,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEjF,MAAM,KAAK,GAAG,WAAW,CAAC,sBAAsB,CAAC,CAAA;AAEjD,MAAM,iBAAiB,GAAG,GAAe,EAAE;IACzC,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACzB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,OAAc,CAAA;QACnF,MAAM,cAAc,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAuB,CAAA;QAEpF,oEAAoE;QACpE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,EAAE,GAAG,GAAG,CAAC,MAAO,CAAA;QAC3E,MAAM,MAAM,GAAG,IAAI,CAA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,CAAA;QACnD,GAAG,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAA;QAE7B,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YAC3C,MAAM,EAAE,GAAG,EAAE,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,OAAO,CAAA;YAEzD,MAAM,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAA;YACtF,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;YAEvC,OAAO,CAAC,GAAG,KAAX,OAAO,CAAC,GAAG,GAAK,EAAE,EAAA;YAClB,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAA;QACnC,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feathersjs/koa",
|
|
3
3
|
"description": "Feathers KoaJS framework bindings and REST provider",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "6.0.0-pre.0",
|
|
5
5
|
"homepage": "https://feathersjs.com",
|
|
6
|
-
"main": "lib/",
|
|
7
|
-
"
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"type": "module",
|
|
8
8
|
"keywords": [
|
|
9
9
|
"feathers",
|
|
10
10
|
"koajs"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/feathersjs/feathers/issues"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
28
|
+
"node": ">= 20"
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"CHANGELOG.md",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@feathersjs/authentication": "^
|
|
53
|
-
"@feathersjs/commons": "^
|
|
54
|
-
"@feathersjs/errors": "^
|
|
55
|
-
"@feathersjs/feathers": "^
|
|
56
|
-
"@feathersjs/transport-commons": "^
|
|
52
|
+
"@feathersjs/authentication": "^6.0.0-pre.0",
|
|
53
|
+
"@feathersjs/commons": "^6.0.0-pre.0",
|
|
54
|
+
"@feathersjs/errors": "^6.0.0-pre.0",
|
|
55
|
+
"@feathersjs/feathers": "^6.0.0-pre.0",
|
|
56
|
+
"@feathersjs/transport-commons": "^6.0.0-pre.0",
|
|
57
57
|
"@koa/cors": "^5.0.0",
|
|
58
58
|
"@types/koa": "^3.0.1",
|
|
59
59
|
"@types/koa-qs": "^2.0.5",
|
|
@@ -66,9 +66,9 @@
|
|
|
66
66
|
"koa-static": "^5.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@feathersjs/authentication-local": "^
|
|
70
|
-
"@feathersjs/memory": "^
|
|
71
|
-
"@feathersjs/tests": "^
|
|
69
|
+
"@feathersjs/authentication-local": "^6.0.0-pre.0",
|
|
70
|
+
"@feathersjs/memory": "^6.0.0-pre.0",
|
|
71
|
+
"@feathersjs/tests": "^6.0.0-pre.0",
|
|
72
72
|
"@types/koa-compose": "^3.2.9",
|
|
73
73
|
"@types/mocha": "^10.0.10",
|
|
74
74
|
"@types/node": "^25.1.0",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"ts-node": "^10.9.2",
|
|
79
79
|
"typescript": "^5.9.3"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "8fad4bb3d393794fb98fa5fe7cfc327661fedbd2"
|
|
82
82
|
}
|
package/src/authentication.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { Application, HookContext } from '@feathersjs/feathers'
|
|
1
|
+
import type { Application, HookContext } from '@feathersjs/feathers'
|
|
2
2
|
import { createDebug } from '@feathersjs/commons'
|
|
3
3
|
import { authenticate as AuthenticateHook } from '@feathersjs/authentication'
|
|
4
4
|
|
|
5
|
-
import { Middleware } from './declarations'
|
|
6
|
-
|
|
5
|
+
import type { Middleware } from './declarations.js'
|
|
7
6
|
const debug = createDebug('@feathersjs/koa/authentication')
|
|
8
7
|
|
|
9
8
|
export type AuthenticationSettings = {
|
package/src/declarations.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import Koa, { Next } from 'koa'
|
|
2
2
|
import { Server } from 'http'
|
|
3
|
-
import {
|
|
3
|
+
import type {
|
|
4
|
+
Application as FeathersApplication,
|
|
5
|
+
HookContext,
|
|
6
|
+
Params,
|
|
7
|
+
RouteLookup
|
|
8
|
+
} from '@feathersjs/feathers'
|
|
4
9
|
import '@feathersjs/authentication'
|
|
5
10
|
|
|
6
11
|
export type ApplicationAddons = {
|
|
@@ -18,7 +23,7 @@ export type FeathersKoaContext<A = Application> = Koa.Context & {
|
|
|
18
23
|
|
|
19
24
|
export type Middleware<A = Application> = (context: FeathersKoaContext<A>, next: Next) => any
|
|
20
25
|
|
|
21
|
-
declare module '@feathersjs/feathers
|
|
26
|
+
declare module '@feathersjs/feathers' {
|
|
22
27
|
interface ServiceOptions {
|
|
23
28
|
koa?: {
|
|
24
29
|
before?: Middleware[]
|
package/src/handlers.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FeathersError, NotFound } from '@feathersjs/errors'
|
|
2
|
-
import { FeathersKoaContext } from './declarations'
|
|
2
|
+
import { FeathersKoaContext } from './declarations.js'
|
|
3
3
|
|
|
4
4
|
export const errorHandler = () => async (ctx: FeathersKoaContext, next: () => Promise<any>) => {
|
|
5
5
|
try {
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import Koa from 'koa'
|
|
2
2
|
import koaQs from 'koa-qs'
|
|
3
|
-
import { Application as FeathersApplication } from '@feathersjs/feathers'
|
|
4
|
-
import { routing } from '@feathersjs/transport-commons'
|
|
3
|
+
import type { Application as FeathersApplication } from '@feathersjs/feathers'
|
|
5
4
|
import { createDebug } from '@feathersjs/commons'
|
|
6
5
|
import { koaBody as bodyParser } from 'koa-body'
|
|
7
6
|
import cors from '@koa/cors'
|
|
8
7
|
import serveStatic from 'koa-static'
|
|
9
8
|
|
|
10
|
-
import { Application } from './declarations'
|
|
11
|
-
|
|
9
|
+
import type { Application } from './declarations.js'
|
|
12
10
|
export { Koa, bodyParser, cors, serveStatic }
|
|
13
|
-
export * from './authentication'
|
|
14
|
-
export * from './declarations'
|
|
15
|
-
export * from './handlers'
|
|
16
|
-
export * from './rest'
|
|
11
|
+
export * from './authentication.js'
|
|
12
|
+
export * from './declarations.js'
|
|
13
|
+
export * from './handlers.js'
|
|
14
|
+
export * from './rest.js'
|
|
17
15
|
|
|
18
16
|
const debug = createDebug('@feathersjs/koa')
|
|
19
17
|
|
|
@@ -99,7 +97,6 @@ export function koa<S = any, C = any>(
|
|
|
99
97
|
app.setup = feathersApp.setup as any
|
|
100
98
|
app.teardown = feathersApp.teardown as any
|
|
101
99
|
|
|
102
|
-
app.configure(routing() as any)
|
|
103
100
|
app.use((ctx, next) => {
|
|
104
101
|
ctx.feathers = { ...ctx.feathers, provider: 'rest' }
|
|
105
102
|
return next()
|
package/src/rest.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { createDebug } from '@feathersjs/commons'
|
|
|
4
4
|
import { getServiceOptions, defaultServiceMethods, createContext } from '@feathersjs/feathers'
|
|
5
5
|
import { MethodNotAllowed } from '@feathersjs/errors'
|
|
6
6
|
|
|
7
|
-
import { Application, Middleware } from './declarations'
|
|
8
|
-
import { AuthenticationSettings, parseAuthentication } from './authentication'
|
|
7
|
+
import type { Application, Middleware } from './declarations.js'
|
|
8
|
+
import { AuthenticationSettings, parseAuthentication } from './authentication.js'
|
|
9
9
|
|
|
10
10
|
const debug = createDebug('@feathersjs/koa/rest')
|
|
11
11
|
|