@e22m4u/ts-rest-router 0.6.1 → 0.6.2

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.
@@ -965,6 +965,16 @@ var _RestRouter = class _RestRouter extends DebuggableService {
965
965
  this.getService(ControllerRegistry).addController(ctor, options);
966
966
  return this;
967
967
  }
968
+ /**
969
+ * Add hook.
970
+ *
971
+ * @param type
972
+ * @param hook
973
+ */
974
+ addHook(type, hook) {
975
+ this.getService(import_js_trie_router3.TrieRouter).addHook(type, hook);
976
+ return this;
977
+ }
968
978
  };
969
979
  __name(_RestRouter, "RestRouter");
970
980
  var RestRouter = _RestRouter;
@@ -1,4 +1,6 @@
1
1
  import { Constructor } from './types.js';
2
+ import { HookType } from '@e22m4u/js-trie-router';
3
+ import { RouterHook } from '@e22m4u/js-trie-router';
2
4
  import { DebuggableService } from './debuggable-service.js';
3
5
  import { ControllerRootOptions } from './controller-registry.js';
4
6
  /**
@@ -16,4 +18,11 @@ export declare class RestRouter extends DebuggableService {
16
18
  * @param options
17
19
  */
18
20
  addController<T extends object>(ctor: Constructor<T>, options?: ControllerRootOptions): this;
21
+ /**
22
+ * Add hook.
23
+ *
24
+ * @param type
25
+ * @param hook
26
+ */
27
+ addHook(type: HookType, hook: RouterHook): this;
19
28
  }
@@ -21,4 +21,14 @@ export class RestRouter extends DebuggableService {
21
21
  this.getService(ControllerRegistry).addController(ctor, options);
22
22
  return this;
23
23
  }
24
+ /**
25
+ * Add hook.
26
+ *
27
+ * @param type
28
+ * @param hook
29
+ */
30
+ addHook(type, hook) {
31
+ this.getService(TrieRouter).addHook(type, hook);
32
+ return this;
33
+ }
24
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e22m4u/ts-rest-router",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Декларативный REST-маршрутизатор на основе контроллеров для TypeScript",
5
5
  "author": "Mikhail Evstropov <e22m4u@yandex.ru>",
6
6
  "license": "MIT",
@@ -1,4 +1,6 @@
1
1
  import {Constructor} from './types.js';
2
+ import {HookType} from '@e22m4u/js-trie-router';
3
+ import {RouterHook} from '@e22m4u/js-trie-router';
2
4
  import {TrieRouter} from '@e22m4u/js-trie-router';
3
5
  import {DebuggableService} from './debuggable-service.js';
4
6
  import {ControllerRegistry} from './controller-registry.js';
@@ -28,4 +30,15 @@ export class RestRouter extends DebuggableService {
28
30
  this.getService(ControllerRegistry).addController(ctor, options);
29
31
  return this;
30
32
  }
33
+
34
+ /**
35
+ * Add hook.
36
+ *
37
+ * @param type
38
+ * @param hook
39
+ */
40
+ addHook(type: HookType, hook: RouterHook) {
41
+ this.getService(TrieRouter).addHook(type, hook);
42
+ return this;
43
+ }
31
44
  }