@e22m4u/ts-rest-router 0.6.2 → 0.6.4

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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
  аргументам методов.
19
19
  - **Встроенная валидация**
20
20
  Использование схем данных из
21
- [@e22m4u/ts-data-schema](https://www.npmjs.com/package/@e22m4u/ts-data-schema)
21
+ [@e22m4u/js-data-schema](https://www.npmjs.com/package/@e22m4u/js-data-schema)
22
22
  для описания сложных правил проверки.
23
23
  - **Хуки (`@beforeAction`, `@afterAction`)**
24
24
  Поддержка хуков для выполнения сквозной логики (например, аутентификация
@@ -326,7 +326,7 @@ class SystemController {
326
326
  ## Валидация и схемы данных
327
327
 
328
328
  Модуль интегрирован с
329
- [@e22m4u/ts-data-schema](https://www.npmjs.com/package/@e22m4u/ts-data-schema)
329
+ [@e22m4u/js-data-schema](https://www.npmjs.com/package/@e22m4u/js-data-schema)
330
330
  для гибкой проверки данных. Это дает возможность определять типы данных
331
331
  и сложные правила.
332
332
 
@@ -16,7 +16,6 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
20
 
22
21
  // dist/esm/index.js
@@ -33,6 +32,7 @@ __export(index_exports, {
33
32
  RESPONSE_BODY_METADATA_KEY: () => RESPONSE_BODY_METADATA_KEY,
34
33
  REST_ACTIONS_METADATA_KEY: () => REST_ACTIONS_METADATA_KEY,
35
34
  REST_CONTROLLER_METADATA_KEY: () => REST_CONTROLLER_METADATA_KEY,
35
+ RequestContext: () => import_js_trie_router4.RequestContext,
36
36
  RequestContextReflector: () => RequestContextReflector,
37
37
  RequestDataReflector: () => RequestDataReflector,
38
38
  RequestDataSource: () => RequestDataSource,
@@ -67,7 +67,6 @@ __export(index_exports, {
67
67
  restController: () => restController
68
68
  });
69
69
  module.exports = __toCommonJS(index_exports);
70
- __reExport(index_exports, require("@e22m4u/js-trie-router"), module.exports);
71
70
 
72
71
  // dist/esm/rest-router.js
73
72
  var import_js_trie_router3 = require("@e22m4u/js-trie-router");
@@ -93,8 +92,8 @@ var DebuggableService = _DebuggableService;
93
92
  // dist/esm/controller-registry.js
94
93
  var import_js_format2 = require("@e22m4u/js-format");
95
94
  var import_js_trie_router2 = require("@e22m4u/js-trie-router");
96
- var import_ts_data_schema2 = require("@e22m4u/ts-data-schema");
97
- var import_ts_data_schema3 = require("@e22m4u/ts-data-schema");
95
+ var import_js_data_schema2 = require("@e22m4u/js-data-schema");
96
+ var import_js_data_schema3 = require("@e22m4u/js-data-schema");
98
97
 
99
98
  // dist/esm/errors/not-a-controller-error.js
100
99
  var import_js_format = require("@e22m4u/js-format");
@@ -211,7 +210,7 @@ var RequestDataSource;
211
210
  var REQUEST_DATA_METADATA_KEY = new import_ts_reflector5.MetadataKey("requestDataMetadataKey");
212
211
 
213
212
  // dist/esm/decorators/request-data/request-data-decorator.js
214
- var import_ts_data_schema = require("@e22m4u/ts-data-schema");
213
+ var import_js_data_schema = require("@e22m4u/js-data-schema");
215
214
  var import_ts_reflector7 = require("@e22m4u/ts-reflector");
216
215
  var import_ts_reflector8 = require("@e22m4u/ts-reflector");
217
216
 
@@ -264,7 +263,7 @@ function createRequestDataDecoratorWithSource(source) {
264
263
  } else if (typeof schemaInput === "string") {
265
264
  schema = { type: schemaInput };
266
265
  } else {
267
- schema = { type: import_ts_data_schema.DataType.ANY };
266
+ schema = { type: import_js_data_schema.DataType.ANY };
268
267
  }
269
268
  return requestData({ schema, source });
270
269
  };
@@ -272,7 +271,7 @@ function createRequestDataDecoratorWithSource(source) {
272
271
  __name(createRequestDataDecoratorWithSource, "createRequestDataDecoratorWithSource");
273
272
  function createRequestDataPropertyDecoratorWithSource(source) {
274
273
  return function(propertyKey, schemaInput) {
275
- const rootSchema = { type: import_ts_data_schema.DataType.OBJECT };
274
+ const rootSchema = { type: import_js_data_schema.DataType.OBJECT };
276
275
  const properties = {};
277
276
  let schemaOrFactory = rootSchema;
278
277
  if (typeof schemaInput === "function") {
@@ -288,7 +287,7 @@ function createRequestDataPropertyDecoratorWithSource(source) {
288
287
  properties[propertyKey] = { type: schemaInput };
289
288
  rootSchema.properties = properties;
290
289
  } else {
291
- properties[propertyKey] = { type: import_ts_data_schema.DataType.ANY };
290
+ properties[propertyKey] = { type: import_js_data_schema.DataType.ANY };
292
291
  rootSchema.properties = properties;
293
292
  }
294
293
  return requestData({
@@ -579,7 +578,7 @@ function requestContainer() {
579
578
  __name(requestContainer, "requestContainer");
580
579
 
581
580
  // dist/esm/controller-registry.js
582
- var import_ts_data_schema4 = require("@e22m4u/ts-data-schema");
581
+ var import_js_data_schema4 = require("@e22m4u/js-data-schema");
583
582
  var _ControllerRegistry = class _ControllerRegistry extends DebuggableService {
584
583
  /**
585
584
  * Controller map.
@@ -860,9 +859,9 @@ var _ControllerRegistry = class _ControllerRegistry extends DebuggableService {
860
859
  const requestContextMetadataMap = RequestContextReflector.getMetadata(controllerCtor, actionName);
861
860
  const requestDataMetadataMap = RequestDataReflector.getMetadata(controllerCtor, actionName);
862
861
  const argsNumber = controllerCtor.prototype[actionName].length;
863
- const defaultsApplier = this.getService(import_ts_data_schema4.DefaultValuesApplier);
864
- const dataTypeCaster = this.getService(import_ts_data_schema3.DataTypeCaster);
865
- const dataValidator = this.getService(import_ts_data_schema2.DataValidator);
862
+ const defaultsApplier = this.getService(import_js_data_schema4.DefaultValuesApplier);
863
+ const dataTypeCaster = this.getService(import_js_data_schema3.DataTypeCaster);
864
+ const dataValidator = this.getService(import_js_data_schema2.DataValidator);
866
865
  return (requestContext2) => {
867
866
  debug("Executing route handler for %s.%s.", controllerCtor.name, actionName);
868
867
  const args = Array(argsNumber).fill(void 0).map((_, index) => {
@@ -978,6 +977,9 @@ var _RestRouter = class _RestRouter extends DebuggableService {
978
977
  };
979
978
  __name(_RestRouter, "RestRouter");
980
979
  var RestRouter = _RestRouter;
980
+
981
+ // dist/esm/index.js
982
+ var import_js_trie_router4 = require("@e22m4u/js-trie-router");
981
983
  // Annotate the CommonJS export names for ESM import in node:
982
984
  0 && (module.exports = {
983
985
  AFTER_ACTION_METADATA_KEY,
@@ -991,6 +993,7 @@ var RestRouter = _RestRouter;
991
993
  RESPONSE_BODY_METADATA_KEY,
992
994
  REST_ACTIONS_METADATA_KEY,
993
995
  REST_CONTROLLER_METADATA_KEY,
996
+ RequestContext,
994
997
  RequestContextReflector,
995
998
  RequestDataReflector,
996
999
  RequestDataSource,
@@ -1022,6 +1025,5 @@ var RestRouter = _RestRouter;
1022
1025
  requestQuery,
1023
1026
  responseBody,
1024
1027
  restAction,
1025
- restController,
1026
- ...require("@e22m4u/js-trie-router")
1028
+ restController
1027
1029
  });
@@ -1,14 +1,14 @@
1
1
  import { Errorf } from '@e22m4u/js-format';
2
2
  import { TrieRouter } from '@e22m4u/js-trie-router';
3
- import { DataValidator } from '@e22m4u/ts-data-schema';
4
- import { DataTypeCaster } from '@e22m4u/ts-data-schema';
3
+ import { DataValidator } from '@e22m4u/js-data-schema';
4
+ import { DataTypeCaster } from '@e22m4u/js-data-schema';
5
5
  import { NotAControllerError } from './errors/index.js';
6
6
  import { RequestDataSource } from './decorators/index.js';
7
7
  import { DebuggableService } from './debuggable-service.js';
8
8
  import { RestActionReflector } from './decorators/index.js';
9
9
  import { RequestDataReflector } from './decorators/index.js';
10
10
  import { AfterActionReflector } from './decorators/index.js';
11
- import { DefaultValuesApplier } from '@e22m4u/ts-data-schema';
11
+ import { DefaultValuesApplier } from '@e22m4u/js-data-schema';
12
12
  import { BeforeActionReflector } from './decorators/index.js';
13
13
  import { RestControllerReflector } from './decorators/index.js';
14
14
  import { RequestContextReflector } from './decorators/index.js';
@@ -1,5 +1,5 @@
1
- import { DataType } from '@e22m4u/ts-data-schema';
2
- import { DataSchema } from '@e22m4u/ts-data-schema';
1
+ import { DataType } from '@e22m4u/js-data-schema';
2
+ import { DataSchema } from '@e22m4u/js-data-schema';
3
3
  import { ServiceContainer } from '@e22m4u/js-service';
4
4
  /**
5
5
  * Data schema factory.
@@ -10,6 +10,6 @@ export type DataSchemaFactory = (container: ServiceContainer) => DataSchema;
10
10
  */
11
11
  export type DataSchemaOrFactory = DataSchema | DataSchemaFactory;
12
12
  /**
13
- * Data schema input.
13
+ * Data schema decorator input.
14
14
  */
15
- export type DataSchemaInput = DataSchemaOrFactory | DataType;
15
+ export type DataSchemaDecoratorInput = DataSchemaOrFactory | DataType;
@@ -1,6 +1,6 @@
1
1
  import { Prototype } from '../../types.js';
2
- import { DataSchemaInput } from '../../data-schema-types.js';
3
2
  import { RequestDataMetadata } from './request-data-metadata.js';
3
+ import { DataSchemaDecoratorInput } from '../../data-schema-types.js';
4
4
  /**
5
5
  * Request data options.
6
6
  */
@@ -14,13 +14,13 @@ export declare function requestData<T extends object>(options: RequestDataOption
14
14
  /**
15
15
  * Decorator aliases.
16
16
  */
17
- export declare const requestParams: (schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
18
- export declare const requestParam: (propertyKey: string, schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
19
- export declare const requestQueries: (schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
20
- export declare const requestQuery: (propertyKey: string, schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
21
- export declare const requestHeaders: (schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
22
- export declare const requestHeader: (propertyKey: string, schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
23
- export declare const requestCookies: (schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
24
- export declare const requestCookie: (propertyKey: string, schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
25
- export declare const requestBody: (schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
26
- export declare const requestField: (propertyKey: string, schemaInput?: DataSchemaInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
17
+ export declare const requestParams: (schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
18
+ export declare const requestParam: (propertyKey: string, schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
19
+ export declare const requestQueries: (schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
20
+ export declare const requestQuery: (propertyKey: string, schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
21
+ export declare const requestHeaders: (schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
22
+ export declare const requestHeader: (propertyKey: string, schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
23
+ export declare const requestCookies: (schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
24
+ export declare const requestCookie: (propertyKey: string, schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
25
+ export declare const requestBody: (schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
26
+ export declare const requestField: (propertyKey: string, schemaInput?: DataSchemaDecoratorInput) => (target: Prototype<object>, propertyKey: string, index: number) => void;
@@ -1,4 +1,4 @@
1
- import { DataType } from '@e22m4u/ts-data-schema';
1
+ import { DataType } from '@e22m4u/js-data-schema';
2
2
  import { DecoratorTargetType } from '@e22m4u/ts-reflector';
3
3
  import { getDecoratorTargetType } from '@e22m4u/ts-reflector';
4
4
  import { RequestDataSource } from './request-data-metadata.js';
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  };
13
13
  /* eslint-disable @typescript-eslint/no-unused-vars */
14
14
  import { expect } from 'chai';
15
- import { DataType } from '@e22m4u/ts-data-schema';
15
+ import { DataType } from '@e22m4u/js-data-schema';
16
16
  import { requestData } from './request-data-decorator.js';
17
17
  import { requestBody } from './request-data-decorator.js';
18
18
  import { requestField } from './request-data-decorator.js';
@@ -1,8 +1,8 @@
1
1
  import { Prototype } from '../../types.js';
2
- import { DataSchemaInput } from '../../data-schema-types.js';
2
+ import { DataSchemaDecoratorInput } from '../../data-schema-types.js';
3
3
  /**
4
4
  * Response body decorator.
5
5
  *
6
6
  * @param schemaOrType
7
7
  */
8
- export declare function responseBody<T extends object>(schemaInput?: DataSchemaInput): (target: Prototype<T>, propertyKey: string, descriptor: PropertyDescriptor) => void;
8
+ export declare function responseBody<T extends object>(schemaInput?: DataSchemaDecoratorInput): (target: Prototype<T>, propertyKey: string, descriptor: PropertyDescriptor) => void;
@@ -8,7 +8,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
10
  import { expect } from 'chai';
11
- import { DataType } from '@e22m4u/ts-data-schema';
11
+ import { DataType } from '@e22m4u/js-data-schema';
12
12
  import { responseBody } from './response-body-decorator.js';
13
13
  import { ResponseBodyReflector } from './response-body-reflector.js';
14
14
  describe('responseBody', function () {
@@ -1,6 +1,9 @@
1
- export * from '@e22m4u/js-trie-router';
2
1
  export * from './rest-router.js';
3
2
  export * from './errors/index.js';
4
3
  export * from './decorators/index.js';
5
4
  export * from './data-schema-types.js';
6
5
  export * from './controller-registry.js';
6
+ export { RouteHandler } from '@e22m4u/js-trie-router';
7
+ export { RequestContext } from '@e22m4u/js-trie-router';
8
+ export { RoutePreHandler } from '@e22m4u/js-trie-router';
9
+ export { RoutePostHandler } from '@e22m4u/js-trie-router';
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export * from '@e22m4u/js-trie-router';
2
1
  export * from './rest-router.js';
3
2
  export * from './errors/index.js';
4
3
  export * from './decorators/index.js';
5
4
  export * from './data-schema-types.js';
6
5
  export * from './controller-registry.js';
6
+ export { RequestContext } from '@e22m4u/js-trie-router';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e22m4u/ts-rest-router",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Декларативный REST-маршрутизатор на основе контроллеров для TypeScript",
5
5
  "author": "Mikhail Evstropov <e22m4u@yandex.ru>",
6
6
  "license": "MIT",
@@ -43,9 +43,9 @@
43
43
  "dependencies": {
44
44
  "@e22m4u/js-debug": "~0.3.1",
45
45
  "@e22m4u/js-format": "~0.2.0",
46
- "@e22m4u/js-service": "~0.4.2",
47
- "@e22m4u/js-trie-router": "~0.3.1",
48
- "@e22m4u/ts-data-schema": "~0.4.4",
46
+ "@e22m4u/js-service": "~0.4.3",
47
+ "@e22m4u/js-trie-router": "~0.3.2",
48
+ "@e22m4u/js-data-schema": "~0.4.6",
49
49
  "@e22m4u/ts-reflector": "~0.1.8",
50
50
  "http-errors": "~2.0.0"
51
51
  },
@@ -57,7 +57,7 @@
57
57
  "@types/debug": "~4.1.12",
58
58
  "@types/http-errors": "~2.0.5",
59
59
  "@types/mocha": "~10.0.10",
60
- "@types/node": "~24.7.0",
60
+ "@types/node": "~24.7.2",
61
61
  "c8": "~10.1.3",
62
62
  "chai": "~6.2.0",
63
63
  "esbuild": "~0.25.10",
@@ -71,6 +71,6 @@
71
71
  "rimraf": "~6.0.1",
72
72
  "tsx": "~4.20.6",
73
73
  "typescript": "~5.9.3",
74
- "typescript-eslint": "~8.46.0"
74
+ "typescript-eslint": "~8.46.1"
75
75
  }
76
76
  }
@@ -34,7 +34,7 @@ import {
34
34
 
35
35
  import {expect} from 'chai';
36
36
  import {Service} from '@e22m4u/js-service';
37
- import {DataType} from '@e22m4u/ts-data-schema';
37
+ import {DataType} from '@e22m4u/js-data-schema';
38
38
  import {ServiceContainer} from '@e22m4u/js-service';
39
39
  import {DataSchemaFactory} from './data-schema-types.js';
40
40
  import {ControllerRegistry} from './controller-registry.js';
@@ -2,10 +2,10 @@ import {AnyObject} from './types.js';
2
2
  import {Constructor} from './types.js';
3
3
  import {Errorf} from '@e22m4u/js-format';
4
4
  import {TrieRouter} from '@e22m4u/js-trie-router';
5
- import {DataSchema} from '@e22m4u/ts-data-schema';
5
+ import {DataSchema} from '@e22m4u/js-data-schema';
6
6
  import {RouteHandler} from '@e22m4u/js-trie-router';
7
- import {DataValidator} from '@e22m4u/ts-data-schema';
8
- import {DataTypeCaster} from '@e22m4u/ts-data-schema';
7
+ import {DataValidator} from '@e22m4u/js-data-schema';
8
+ import {DataTypeCaster} from '@e22m4u/js-data-schema';
9
9
  import {NotAControllerError} from './errors/index.js';
10
10
  import {RequestContext} from '@e22m4u/js-trie-router';
11
11
  import {RoutePreHandler} from '@e22m4u/js-trie-router';
@@ -15,7 +15,7 @@ import {DebuggableService} from './debuggable-service.js';
15
15
  import {RestActionReflector} from './decorators/index.js';
16
16
  import {RequestDataReflector} from './decorators/index.js';
17
17
  import {AfterActionReflector} from './decorators/index.js';
18
- import {DefaultValuesApplier} from '@e22m4u/ts-data-schema';
18
+ import {DefaultValuesApplier} from '@e22m4u/js-data-schema';
19
19
  import {BeforeActionReflector} from './decorators/index.js';
20
20
  import {RestControllerReflector} from './decorators/index.js';
21
21
  import {RequestContextReflector} from './decorators/index.js';
@@ -1,5 +1,5 @@
1
- import {DataType} from '@e22m4u/ts-data-schema';
2
- import {DataSchema} from '@e22m4u/ts-data-schema';
1
+ import {DataType} from '@e22m4u/js-data-schema';
2
+ import {DataSchema} from '@e22m4u/js-data-schema';
3
3
  import {ServiceContainer} from '@e22m4u/js-service';
4
4
 
5
5
  /**
@@ -13,6 +13,6 @@ export type DataSchemaFactory = (container: ServiceContainer) => DataSchema;
13
13
  export type DataSchemaOrFactory = DataSchema | DataSchemaFactory;
14
14
 
15
15
  /**
16
- * Data schema input.
16
+ * Data schema decorator input.
17
17
  */
18
- export type DataSchemaInput = DataSchemaOrFactory | DataType;
18
+ export type DataSchemaDecoratorInput = DataSchemaOrFactory | DataType;
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
  import {expect} from 'chai';
3
- import {DataType} from '@e22m4u/ts-data-schema';
3
+ import {DataType} from '@e22m4u/js-data-schema';
4
4
  import {ServiceContainer} from '@e22m4u/js-service';
5
5
  import {requestData} from './request-data-decorator.js';
6
6
  import {requestBody} from './request-data-decorator.js';
@@ -1,15 +1,15 @@
1
1
  import {NoUndef} from '../../types.js';
2
2
  import {Prototype} from '../../types.js';
3
3
  import {Constructor} from '../../types.js';
4
- import {DataType} from '@e22m4u/ts-data-schema';
5
- import {DataSchema} from '@e22m4u/ts-data-schema';
4
+ import {DataType} from '@e22m4u/js-data-schema';
5
+ import {DataSchema} from '@e22m4u/js-data-schema';
6
6
  import {DecoratorTargetType} from '@e22m4u/ts-reflector';
7
- import {DataSchemaInput} from '../../data-schema-types.js';
8
7
  import {getDecoratorTargetType} from '@e22m4u/ts-reflector';
9
8
  import {RequestDataSource} from './request-data-metadata.js';
10
9
  import {RequestDataMetadata} from './request-data-metadata.js';
11
10
  import {DataSchemaOrFactory} from '../../data-schema-types.js';
12
11
  import {RequestDataReflector} from './request-data-reflector.js';
12
+ import {DataSchemaDecoratorInput} from '../../data-schema-types.js';
13
13
 
14
14
  /**
15
15
  * Request data options.
@@ -44,7 +44,7 @@ export function requestData<T extends object>(options: RequestDataOptions) {
44
44
  * @param source
45
45
  */
46
46
  function createRequestDataDecoratorWithSource(source: RequestDataSource) {
47
- return function (schemaInput?: DataSchemaInput) {
47
+ return function (schemaInput?: DataSchemaDecoratorInput) {
48
48
  let schema: DataSchemaOrFactory;
49
49
  if (typeof schemaInput === 'function' || typeof schemaInput === 'object') {
50
50
  schema = schemaInput;
@@ -65,7 +65,10 @@ function createRequestDataDecoratorWithSource(source: RequestDataSource) {
65
65
  function createRequestDataPropertyDecoratorWithSource(
66
66
  source: RequestDataSource,
67
67
  ) {
68
- return function (propertyKey: string, schemaInput?: DataSchemaInput) {
68
+ return function (
69
+ propertyKey: string,
70
+ schemaInput?: DataSchemaDecoratorInput,
71
+ ) {
69
72
  const rootSchema: DataSchema = {type: DataType.OBJECT};
70
73
  const properties = {} as NoUndef<DataSchema['properties']>;
71
74
  let schemaOrFactory: DataSchemaOrFactory = rootSchema;
@@ -1,5 +1,5 @@
1
1
  import {expect} from 'chai';
2
- import {DataType} from '@e22m4u/ts-data-schema';
2
+ import {DataType} from '@e22m4u/js-data-schema';
3
3
  import {responseBody} from './response-body-decorator.js';
4
4
  import {ResponseBodyReflector} from './response-body-reflector.js';
5
5
 
@@ -1,17 +1,19 @@
1
1
  import {Prototype} from '../../types.js';
2
2
  import {Constructor} from '../../types.js';
3
3
  import {DecoratorTargetType} from '@e22m4u/ts-reflector';
4
- import {DataSchemaInput} from '../../data-schema-types.js';
5
4
  import {getDecoratorTargetType} from '@e22m4u/ts-reflector';
6
5
  import {DataSchemaOrFactory} from '../../data-schema-types.js';
7
6
  import {ResponseBodyReflector} from './response-body-reflector.js';
7
+ import {DataSchemaDecoratorInput} from '../../data-schema-types.js';
8
8
 
9
9
  /**
10
10
  * Response body decorator.
11
11
  *
12
12
  * @param schemaOrType
13
13
  */
14
- export function responseBody<T extends object>(schemaInput?: DataSchemaInput) {
14
+ export function responseBody<T extends object>(
15
+ schemaInput?: DataSchemaDecoratorInput,
16
+ ) {
15
17
  return function (
16
18
  target: Prototype<T>,
17
19
  propertyKey: string,
package/src/index.ts CHANGED
@@ -1,7 +1,10 @@
1
- export * from '@e22m4u/js-trie-router';
2
-
3
1
  export * from './rest-router.js';
4
2
  export * from './errors/index.js';
5
3
  export * from './decorators/index.js';
6
4
  export * from './data-schema-types.js';
7
5
  export * from './controller-registry.js';
6
+
7
+ export {RouteHandler} from '@e22m4u/js-trie-router';
8
+ export {RequestContext} from '@e22m4u/js-trie-router';
9
+ export {RoutePreHandler} from '@e22m4u/js-trie-router';
10
+ export {RoutePostHandler} from '@e22m4u/js-trie-router';