@feathersjs/feathers 5.0.10 → 5.0.11

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,6 +3,13 @@
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.11](https://github.com/feathersjs/feathers/compare/v5.0.10...v5.0.11) (2023-10-11)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **core:** context.path is now typed correctly ([#3303](https://github.com/feathersjs/feathers/issues/3303)) ([ff18b3f](https://github.com/feathersjs/feathers/commit/ff18b3f8b7c8dbc97be588f699d539226785343a))
11
+ - **knex:** Update all dependencies and Knex peer ([#3308](https://github.com/feathersjs/feathers/issues/3308)) ([d2f9860](https://github.com/feathersjs/feathers/commit/d2f986036c4741cce2339d8abbcc6b2eb037a12a))
12
+
6
13
  ## [5.0.10](https://github.com/feathersjs/feathers/compare/v5.0.9...v5.0.10) (2023-10-03)
7
14
 
8
15
  **Note:** Version bump only for package @feathersjs/feathers
@@ -3,6 +3,10 @@ import { EventEmitter } from 'events';
3
3
  import { NextFunction, HookContext as BaseHookContext } from '@feathersjs/hooks';
4
4
  type SelfOrArray<S> = S | S[];
5
5
  type OptionalPick<T, K extends PropertyKey> = Pick<T, Extract<keyof T, K>>;
6
+ type Entries<T> = {
7
+ [K in keyof T]: [K, T[K]];
8
+ }[keyof T][];
9
+ type GetKeyByValue<Obj, Value> = Extract<Entries<Obj>[number], [PropertyKey, Value]>[0];
6
10
  export type { NextFunction };
7
11
  /**
8
12
  * The object returned from `.find` call by standard database adapters
@@ -260,6 +264,7 @@ export interface Http {
260
264
  location?: string;
261
265
  }
262
266
  export type HookType = 'before' | 'after' | 'error' | 'around';
267
+ type Serv<FA> = FA extends Application<infer S> ? S : never;
263
268
  export interface HookContext<A = Application, S = any> extends BaseHookContext<ServiceGenericType<S>> {
264
269
  /**
265
270
  * A read only property that contains the Feathers application object. This can be used to
@@ -275,7 +280,7 @@ export interface HookContext<A = Application, S = any> extends BaseHookContext<S
275
280
  * A read only property and contains the service name (or path) without leading or
276
281
  * trailing slashes.
277
282
  */
278
- readonly path: string;
283
+ path: 0 extends 1 & S ? keyof Serv<A> & string : GetKeyByValue<Serv<A>, S> & string;
279
284
  /**
280
285
  * A read only property and contains the service this hook currently runs on.
281
286
  */
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "5.0.10";
1
+ declare const _default: "5.0.11";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '5.0.10';
3
+ exports.default = '5.0.11';
4
4
  //# sourceMappingURL=version.js.map
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.10",
4
+ "version": "5.0.11",
5
5
  "homepage": "http://feathersjs.com",
6
6
  "repository": {
7
7
  "type": "git",
@@ -58,17 +58,17 @@
58
58
  "access": "public"
59
59
  },
60
60
  "dependencies": {
61
- "@feathersjs/commons": "^5.0.10",
61
+ "@feathersjs/commons": "^5.0.11",
62
62
  "@feathersjs/hooks": "^0.8.1",
63
63
  "events": "^3.3.0"
64
64
  },
65
65
  "devDependencies": {
66
66
  "@types/mocha": "^10.0.2",
67
- "@types/node": "^20.8.2",
67
+ "@types/node": "^20.8.4",
68
68
  "mocha": "^10.2.0",
69
69
  "shx": "^0.3.4",
70
70
  "ts-node": "^10.9.1",
71
71
  "typescript": "^5.2.2"
72
72
  },
73
- "gitHead": "463dedcd35b16e43bc55e04df877ca82ed38dcea"
73
+ "gitHead": "91294817845178ff0e9d4709127cb3e46d3562be"
74
74
  }
@@ -3,6 +3,10 @@ import { NextFunction, HookContext as BaseHookContext } from '@feathersjs/hooks'
3
3
 
4
4
  type SelfOrArray<S> = S | S[]
5
5
  type OptionalPick<T, K extends PropertyKey> = Pick<T, Extract<keyof T, K>>
6
+ type Entries<T> = {
7
+ [K in keyof T]: [K, T[K]]
8
+ }[keyof T][]
9
+ type GetKeyByValue<Obj, Value> = Extract<Entries<Obj>[number], [PropertyKey, Value]>[0]
6
10
 
7
11
  export type { NextFunction }
8
12
 
@@ -355,6 +359,8 @@ export interface Http {
355
359
 
356
360
  export type HookType = 'before' | 'after' | 'error' | 'around'
357
361
 
362
+ type Serv<FA> = FA extends Application<infer S> ? S : never
363
+
358
364
  export interface HookContext<A = Application, S = any> extends BaseHookContext<ServiceGenericType<S>> {
359
365
  /**
360
366
  * A read only property that contains the Feathers application object. This can be used to
@@ -370,7 +376,7 @@ export interface HookContext<A = Application, S = any> extends BaseHookContext<S
370
376
  * A read only property and contains the service name (or path) without leading or
371
377
  * trailing slashes.
372
378
  */
373
- readonly path: string
379
+ path: 0 extends 1 & S ? keyof Serv<A> & string : GetKeyByValue<Serv<A>, S> & string
374
380
  /**
375
381
  * A read only property and contains the service this hook currently runs on.
376
382
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '5.0.10'
1
+ export default '5.0.11'