@opra/nestjs 0.23.2 → 0.24.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.
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common_1 = require("@nestjs/common");
4
+ const common_2 = require("@opra/common");
5
+ /*
6
+ Overrides Collection decorator function to call NestJS's Injectable() when Collection decorator called
7
+ */
8
+ const oldCollectionDecorator = common_2.Collection[common_2.DECORATOR];
9
+ common_2.Collection[common_2.DECORATOR] = function CollectionDecorator(...args) {
10
+ const collectionDecorator = oldCollectionDecorator(...args);
11
+ const injectableDecorator = (0, common_1.Injectable)();
12
+ return (target) => {
13
+ collectionDecorator(target);
14
+ injectableDecorator(target);
15
+ };
16
+ };
17
+ /*
18
+ Overrides Singleton decorator function to call NestJS's Injectable() when Singleton decorator called
19
+ */
20
+ const oldSingletonDecorator = common_2.Singleton[common_2.DECORATOR];
21
+ common_2.Singleton[common_2.DECORATOR] = function SingletonDecorator(...args) {
22
+ const singletonDecorator = oldSingletonDecorator(...args);
23
+ const injectableDecorator = (0, common_1.Injectable)();
24
+ return (target) => {
25
+ singletonDecorator(target);
26
+ injectableDecorator(target);
27
+ };
28
+ };
29
+ /*
30
+ Overrides Singleton decorator function to call NestJS's Injectable() when Singleton decorator called
31
+ */
32
+ const oldStorageDecorator = common_2.Storage[common_2.DECORATOR];
33
+ common_2.Storage[common_2.DECORATOR] = function StorageDecorator(...args) {
34
+ const storageDecorator = oldStorageDecorator(...args);
35
+ const injectableDecorator = (0, common_1.Injectable)();
36
+ return (target) => {
37
+ storageDecorator(target);
38
+ injectableDecorator(target);
39
+ };
40
+ };
@@ -5,14 +5,12 @@ const tslib_1 = require("tslib");
5
5
  const lodash_head_1 = tslib_1.__importDefault(require("lodash.head"));
6
6
  const common_1 = require("@nestjs/common");
7
7
  const core_1 = require("@nestjs/core");
8
- const external_context_creator_1 = require("@nestjs/core/helpers/external-context-creator");
9
8
  const injector_1 = require("@nestjs/core/injector/injector");
10
9
  const internal_core_module_1 = require("@nestjs/core/injector/internal-core-module");
11
10
  const request_constants_1 = require("@nestjs/core/router/request/request-constants");
12
11
  const common_2 = require("@opra/common");
13
12
  const constants_js_1 = require("../constants.js");
14
13
  const handler_paramtype_enum_js_1 = require("../enums/handler-paramtype.enum.js");
15
- const nest_explorer_js_1 = require("../services/nest-explorer.js");
16
14
  const function_utils_js_1 = require("../utils/function.utils.js");
17
15
  const params_factory_js_1 = require("./params.factory.js");
18
16
  const noOpFunction = () => void 0;
@@ -30,36 +28,35 @@ let OpraApiFactory = exports.OpraApiFactory = class OpraApiFactory {
30
28
  version: common_2.OpraSchema.SpecVersion,
31
29
  info,
32
30
  types: [],
33
- resources,
31
+ resources
34
32
  };
35
33
  /*
36
34
  * Walk through modules and add Resource instances to the api schema
37
35
  */
38
- const wrappers = this.explorerService.exploreResourceWrappers(rootModule);
36
+ const wrappers = this.explorerService.exploreSourceWrappers(rootModule);
39
37
  for (const wrapper of wrappers) {
40
38
  const instance = wrapper.instance;
41
39
  const ctor = instance.constructor;
42
- const metadata = Reflect.getMetadata(common_2.METADATA_KEY, ctor);
43
- if (common_2.OpraSchema.isResource(metadata))
40
+ const metadata = Reflect.getMetadata(common_2.SOURCE_METADATA, ctor);
41
+ if (common_2.OpraSchema.isSource(metadata))
44
42
  resources.push(instance);
45
43
  }
46
44
  for (const wrapper of wrappers) {
47
45
  const instance = wrapper.instance;
48
46
  const ctor = instance.constructor;
49
- const resourceDef = Reflect.getMetadata(common_2.METADATA_KEY, ctor);
47
+ const sourceDef = Reflect.getMetadata(common_2.SOURCE_METADATA, ctor);
50
48
  /* istanbul ignore next */
51
- if (!resourceDef)
49
+ if (!sourceDef)
52
50
  continue;
53
51
  resources.push(instance);
54
52
  /* Wrap resolver functions */
55
53
  const isRequestScoped = !wrapper.isDependencyTreeStatic();
56
- // const methodsToWrap = OpraSchema.isCollectionResource(resourceDef) ? collectionMethods : [];
57
- if ((common_2.OpraSchema.isCollection(resourceDef) || common_2.OpraSchema.isSingleton(resourceDef)) && resourceDef.operations) {
58
- for (const methodName of Object.keys(resourceDef.operations)) {
59
- const operationFunction = instance[methodName];
54
+ if ((common_2.OpraSchema.isCollection(sourceDef) || common_2.OpraSchema.isSingleton(sourceDef)) && sourceDef.operations) {
55
+ for (const methodName of Object.keys(sourceDef.operations)) {
56
+ const endpointFunction = instance[methodName];
60
57
  const nestHandlerName = methodName + '_nestjs';
61
- // Skip patch if controller do not have function for operation or already patched before
62
- if (typeof operationFunction !== 'function')
58
+ // Skip patch if controller do not have function for endpoint or already patched before
59
+ if (typeof endpointFunction !== 'function')
63
60
  continue;
64
61
  // NestJs requires calling handler function in different order than Opra.
65
62
  // In NestJS, handler functions must be called with these parameters (req, res, next)
@@ -70,14 +67,14 @@ let OpraApiFactory = exports.OpraApiFactory = class OpraApiFactory {
70
67
  const hasParamsArgs = !!paramArgsMetadata;
71
68
  const patchedFn = instance[nestHandlerName] = function (...args) {
72
69
  if (hasParamsArgs)
73
- return operationFunction.apply(this, args);
74
- return operationFunction.call(this, args[3]);
70
+ return endpointFunction.apply(this, args);
71
+ return endpointFunction.call(this, args[3]);
75
72
  };
76
73
  if (paramArgsMetadata)
77
74
  Reflect.defineMetadata(constants_js_1.PARAM_ARGS_METADATA, paramArgsMetadata, instance.constructor, nestHandlerName);
78
75
  // Copy all metadata from old Function to new one
79
- Reflect.getMetadataKeys(operationFunction).forEach(k => {
80
- const m = Reflect.getMetadata(k, operationFunction);
76
+ Reflect.getMetadataKeys(endpointFunction).forEach(k => {
77
+ const m = Reflect.getMetadata(k, endpointFunction);
81
78
  Reflect.defineMetadata(k, m, patchedFn);
82
79
  });
83
80
  this._createContextCallback(instance, wrapper, rootModule, methodName, isRequestScoped, contextType);
@@ -174,16 +171,13 @@ let OpraApiFactory = exports.OpraApiFactory = class OpraApiFactory {
174
171
  }
175
172
  };
176
173
  tslib_1.__decorate([
177
- (0, common_1.Inject)(),
178
- tslib_1.__metadata("design:type", core_1.ModulesContainer)
174
+ (0, common_1.Inject)()
179
175
  ], OpraApiFactory.prototype, "modulesContainer", void 0);
180
176
  tslib_1.__decorate([
181
- (0, common_1.Inject)(),
182
- tslib_1.__metadata("design:type", external_context_creator_1.ExternalContextCreator)
177
+ (0, common_1.Inject)()
183
178
  ], OpraApiFactory.prototype, "externalContextCreator", void 0);
184
179
  tslib_1.__decorate([
185
- (0, common_1.Inject)(),
186
- tslib_1.__metadata("design:type", nest_explorer_js_1.NestExplorer)
180
+ (0, common_1.Inject)()
187
181
  ], OpraApiFactory.prototype, "explorerService", void 0);
188
182
  exports.OpraApiFactory = OpraApiFactory = tslib_1.__decorate([
189
183
  (0, common_1.Injectable)()
package/cjs/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  require("reflect-metadata");
5
+ require("./augmentation/common-decorator.augmentation.js");
5
6
  tslib_1.__exportStar(require("./opra.module.js"), exports);
6
7
  tslib_1.__exportStar(require("./decorators/context.decorator.js"), exports);
7
8
  tslib_1.__exportStar(require("./interfaces/opra-module-options.interface.js"), exports);
8
- // export * as Api from './decorators/api.ns.js';
@@ -5,7 +5,6 @@ exports.OpraCoreModule = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const crypto = tslib_1.__importStar(require("crypto"));
7
7
  const common_1 = require("@nestjs/common");
8
- const core_1 = require("@nestjs/core");
9
8
  const metadata_scanner_1 = require("@nestjs/core/metadata-scanner");
10
9
  const constants_js_1 = require("./constants.js");
11
10
  const opra_api_factory_js_1 = require("./factories/opra-api.factory.js");
@@ -116,7 +115,5 @@ exports.OpraCoreModule = OpraCoreModule = OpraCoreModule_1 = tslib_1.__decorate(
116
115
  ]
117
116
  }),
118
117
  tslib_1.__param(2, (0, common_1.Inject)(constants_js_1.OPRA_MODULE_OPTIONS)),
119
- tslib_1.__param(3, (0, common_1.Inject)(constants_js_1.OPRA_INITIALIZER)),
120
- tslib_1.__metadata("design:paramtypes", [core_1.HttpAdapterHost,
121
- core_1.ModulesContainer, Object, opra_api_loader_js_1.OpraApiLoader])
118
+ tslib_1.__param(3, (0, common_1.Inject)(constants_js_1.OPRA_INITIALIZER))
122
119
  ], OpraCoreModule);
@@ -23,12 +23,12 @@ class NestExplorer {
23
23
  scanModules(rootModule);
24
24
  return Array.from(wrappers.values());
25
25
  }
26
- exploreResourceWrappers(rootModule) {
26
+ exploreSourceWrappers(rootModule) {
27
27
  return this.exploreProviders(rootModule, (wrapper) => {
28
28
  return !!(wrapper.instance
29
29
  && typeof wrapper.instance === 'object'
30
30
  && wrapper.instance.constructor
31
- && common_1.OpraSchema.isResource(Reflect.getMetadata(common_1.METADATA_KEY, wrapper.instance.constructor)));
31
+ && common_1.OpraSchema.isSource(Reflect.getMetadata(common_1.SOURCE_METADATA, wrapper.instance.constructor)));
32
32
  });
33
33
  }
34
34
  }
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OpraApiLoader = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const common_1 = require("@nestjs/common");
6
- const core_1 = require("@nestjs/core");
7
6
  const common_2 = require("@opra/common");
8
- const core_2 = require("@opra/core");
7
+ const core_1 = require("@opra/core");
9
8
  const constants_js_1 = require("../constants.js");
10
- const opra_api_factory_js_1 = require("../factories/opra-api.factory.js");
11
9
  class OpraApiLoader {
12
10
  constructor() {
13
11
  this.logger = new common_1.Logger(OpraApiLoader.name, { timestamp: true });
@@ -28,7 +26,7 @@ class OpraApiLoader {
28
26
  try {
29
27
  const serviceHost = await this.opraFactory.generateService(rootModule, options, 'http');
30
28
  if (!serviceHost.resources.size) {
31
- this.logger.warn(`No resources found (${name})`);
29
+ this.logger.warn(`No Sources found (${name})`);
32
30
  return;
33
31
  }
34
32
  if (platformName === 'express') {
@@ -55,7 +53,7 @@ class OpraApiLoader {
55
53
  return;
56
54
  const app = httpAdapter.getInstance();
57
55
  const logger = moduleOptions.logger || new common_1.Logger(service.info.title);
58
- return await core_2.ExpressAdapter.create(app, service, {
56
+ return await core_1.ExpressAdapter.create(app, service, {
59
57
  ...moduleOptions,
60
58
  logger,
61
59
  });
@@ -63,18 +61,14 @@ class OpraApiLoader {
63
61
  }
64
62
  exports.OpraApiLoader = OpraApiLoader;
65
63
  tslib_1.__decorate([
66
- (0, common_1.Inject)(),
67
- tslib_1.__metadata("design:type", core_1.HttpAdapterHost)
64
+ (0, common_1.Inject)()
68
65
  ], OpraApiLoader.prototype, "httpAdapterHost", void 0);
69
66
  tslib_1.__decorate([
70
- (0, common_1.Inject)(),
71
- tslib_1.__metadata("design:type", core_1.ApplicationConfig)
67
+ (0, common_1.Inject)()
72
68
  ], OpraApiLoader.prototype, "applicationConfig", void 0);
73
69
  tslib_1.__decorate([
74
- (0, common_1.Inject)(),
75
- tslib_1.__metadata("design:type", opra_api_factory_js_1.OpraApiFactory)
70
+ (0, common_1.Inject)()
76
71
  ], OpraApiLoader.prototype, "opraFactory", void 0);
77
72
  tslib_1.__decorate([
78
- (0, common_1.Inject)(constants_js_1.OPRA_MODULE_OPTIONS),
79
- tslib_1.__metadata("design:type", Object)
73
+ (0, common_1.Inject)(constants_js_1.OPRA_MODULE_OPTIONS)
80
74
  ], OpraApiLoader.prototype, "opraModuleOptions", void 0);
@@ -0,0 +1,38 @@
1
+ import { Injectable } from '@nestjs/common';
2
+ import { Collection, DECORATOR, Singleton, Storage } from '@opra/common';
3
+ /*
4
+ Overrides Collection decorator function to call NestJS's Injectable() when Collection decorator called
5
+ */
6
+ const oldCollectionDecorator = Collection[DECORATOR];
7
+ Collection[DECORATOR] = function CollectionDecorator(...args) {
8
+ const collectionDecorator = oldCollectionDecorator(...args);
9
+ const injectableDecorator = Injectable();
10
+ return (target) => {
11
+ collectionDecorator(target);
12
+ injectableDecorator(target);
13
+ };
14
+ };
15
+ /*
16
+ Overrides Singleton decorator function to call NestJS's Injectable() when Singleton decorator called
17
+ */
18
+ const oldSingletonDecorator = Singleton[DECORATOR];
19
+ Singleton[DECORATOR] = function SingletonDecorator(...args) {
20
+ const singletonDecorator = oldSingletonDecorator(...args);
21
+ const injectableDecorator = Injectable();
22
+ return (target) => {
23
+ singletonDecorator(target);
24
+ injectableDecorator(target);
25
+ };
26
+ };
27
+ /*
28
+ Overrides Singleton decorator function to call NestJS's Injectable() when Singleton decorator called
29
+ */
30
+ const oldStorageDecorator = Storage[DECORATOR];
31
+ Storage[DECORATOR] = function StorageDecorator(...args) {
32
+ const storageDecorator = oldStorageDecorator(...args);
33
+ const injectableDecorator = Injectable();
34
+ return (target) => {
35
+ storageDecorator(target);
36
+ injectableDecorator(target);
37
+ };
38
+ };
@@ -1,15 +1,13 @@
1
- import { __decorate, __metadata } from "tslib";
1
+ import { __decorate } from "tslib";
2
2
  import head from 'lodash.head';
3
3
  import { Inject, Injectable } from '@nestjs/common';
4
- import { ContextIdFactory, createContextId, ModulesContainer, REQUEST } from '@nestjs/core';
5
- import { ExternalContextCreator } from '@nestjs/core/helpers/external-context-creator';
4
+ import { ContextIdFactory, createContextId, REQUEST } from '@nestjs/core';
6
5
  import { Injector } from '@nestjs/core/injector/injector';
7
6
  import { InternalCoreModule } from '@nestjs/core/injector/internal-core-module';
8
7
  import { REQUEST_CONTEXT_ID } from '@nestjs/core/router/request/request-constants';
9
- import { DocumentFactory, METADATA_KEY, OpraSchema } from '@opra/common';
8
+ import { DocumentFactory, OpraSchema, SOURCE_METADATA } from '@opra/common';
10
9
  import { PARAM_ARGS_METADATA } from '../constants.js';
11
10
  import { HandlerParamType } from '../enums/handler-paramtype.enum.js';
12
- import { NestExplorer } from '../services/nest-explorer.js';
13
11
  import { getNumberOfArguments } from '../utils/function.utils.js';
14
12
  import { OpraParamsFactory } from './params.factory.js';
15
13
  const noOpFunction = () => void 0;
@@ -27,36 +25,35 @@ export let OpraApiFactory = class OpraApiFactory {
27
25
  version: OpraSchema.SpecVersion,
28
26
  info,
29
27
  types: [],
30
- resources,
28
+ resources
31
29
  };
32
30
  /*
33
31
  * Walk through modules and add Resource instances to the api schema
34
32
  */
35
- const wrappers = this.explorerService.exploreResourceWrappers(rootModule);
33
+ const wrappers = this.explorerService.exploreSourceWrappers(rootModule);
36
34
  for (const wrapper of wrappers) {
37
35
  const instance = wrapper.instance;
38
36
  const ctor = instance.constructor;
39
- const metadata = Reflect.getMetadata(METADATA_KEY, ctor);
40
- if (OpraSchema.isResource(metadata))
37
+ const metadata = Reflect.getMetadata(SOURCE_METADATA, ctor);
38
+ if (OpraSchema.isSource(metadata))
41
39
  resources.push(instance);
42
40
  }
43
41
  for (const wrapper of wrappers) {
44
42
  const instance = wrapper.instance;
45
43
  const ctor = instance.constructor;
46
- const resourceDef = Reflect.getMetadata(METADATA_KEY, ctor);
44
+ const sourceDef = Reflect.getMetadata(SOURCE_METADATA, ctor);
47
45
  /* istanbul ignore next */
48
- if (!resourceDef)
46
+ if (!sourceDef)
49
47
  continue;
50
48
  resources.push(instance);
51
49
  /* Wrap resolver functions */
52
50
  const isRequestScoped = !wrapper.isDependencyTreeStatic();
53
- // const methodsToWrap = OpraSchema.isCollectionResource(resourceDef) ? collectionMethods : [];
54
- if ((OpraSchema.isCollection(resourceDef) || OpraSchema.isSingleton(resourceDef)) && resourceDef.operations) {
55
- for (const methodName of Object.keys(resourceDef.operations)) {
56
- const operationFunction = instance[methodName];
51
+ if ((OpraSchema.isCollection(sourceDef) || OpraSchema.isSingleton(sourceDef)) && sourceDef.operations) {
52
+ for (const methodName of Object.keys(sourceDef.operations)) {
53
+ const endpointFunction = instance[methodName];
57
54
  const nestHandlerName = methodName + '_nestjs';
58
- // Skip patch if controller do not have function for operation or already patched before
59
- if (typeof operationFunction !== 'function')
55
+ // Skip patch if controller do not have function for endpoint or already patched before
56
+ if (typeof endpointFunction !== 'function')
60
57
  continue;
61
58
  // NestJs requires calling handler function in different order than Opra.
62
59
  // In NestJS, handler functions must be called with these parameters (req, res, next)
@@ -67,14 +64,14 @@ export let OpraApiFactory = class OpraApiFactory {
67
64
  const hasParamsArgs = !!paramArgsMetadata;
68
65
  const patchedFn = instance[nestHandlerName] = function (...args) {
69
66
  if (hasParamsArgs)
70
- return operationFunction.apply(this, args);
71
- return operationFunction.call(this, args[3]);
67
+ return endpointFunction.apply(this, args);
68
+ return endpointFunction.call(this, args[3]);
72
69
  };
73
70
  if (paramArgsMetadata)
74
71
  Reflect.defineMetadata(PARAM_ARGS_METADATA, paramArgsMetadata, instance.constructor, nestHandlerName);
75
72
  // Copy all metadata from old Function to new one
76
- Reflect.getMetadataKeys(operationFunction).forEach(k => {
77
- const m = Reflect.getMetadata(k, operationFunction);
73
+ Reflect.getMetadataKeys(endpointFunction).forEach(k => {
74
+ const m = Reflect.getMetadata(k, endpointFunction);
78
75
  Reflect.defineMetadata(k, m, patchedFn);
79
76
  });
80
77
  this._createContextCallback(instance, wrapper, rootModule, methodName, isRequestScoped, contextType);
@@ -171,16 +168,13 @@ export let OpraApiFactory = class OpraApiFactory {
171
168
  }
172
169
  };
173
170
  __decorate([
174
- Inject(),
175
- __metadata("design:type", ModulesContainer)
171
+ Inject()
176
172
  ], OpraApiFactory.prototype, "modulesContainer", void 0);
177
173
  __decorate([
178
- Inject(),
179
- __metadata("design:type", ExternalContextCreator)
174
+ Inject()
180
175
  ], OpraApiFactory.prototype, "externalContextCreator", void 0);
181
176
  __decorate([
182
- Inject(),
183
- __metadata("design:type", NestExplorer)
177
+ Inject()
184
178
  ], OpraApiFactory.prototype, "explorerService", void 0);
185
179
  OpraApiFactory = __decorate([
186
180
  Injectable()
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata';
2
+ import './augmentation/common-decorator.augmentation.js';
2
3
  export * from './opra.module.js';
3
4
  export * from './decorators/context.decorator.js';
4
5
  export * from './interfaces/opra-module-options.interface.js';
5
- // export * as Api from './decorators/api.ns.js';
@@ -1,8 +1,7 @@
1
1
  var OpraCoreModule_1;
2
- import { __decorate, __metadata, __param } from "tslib";
2
+ import { __decorate, __param } from "tslib";
3
3
  import * as crypto from 'crypto';
4
4
  import { Inject, Module } from '@nestjs/common';
5
- import { HttpAdapterHost, ModulesContainer } from '@nestjs/core';
6
5
  import { MetadataScanner } from '@nestjs/core/metadata-scanner';
7
6
  import { OPRA_INITIALIZER, OPRA_MODULE_ID, OPRA_MODULE_OPTIONS } from './constants.js';
8
7
  import { OpraApiFactory } from './factories/opra-api.factory.js';
@@ -113,7 +112,5 @@ OpraCoreModule = OpraCoreModule_1 = __decorate([
113
112
  ]
114
113
  }),
115
114
  __param(2, Inject(OPRA_MODULE_OPTIONS)),
116
- __param(3, Inject(OPRA_INITIALIZER)),
117
- __metadata("design:paramtypes", [HttpAdapterHost,
118
- ModulesContainer, Object, OpraApiLoader])
115
+ __param(3, Inject(OPRA_INITIALIZER))
119
116
  ], OpraCoreModule);
@@ -1,4 +1,4 @@
1
- import { METADATA_KEY, OpraSchema } from '@opra/common';
1
+ import { OpraSchema, SOURCE_METADATA } from '@opra/common';
2
2
  export class NestExplorer {
3
3
  exploreProviders(rootModule, predicate) {
4
4
  const modules = new Set();
@@ -20,12 +20,12 @@ export class NestExplorer {
20
20
  scanModules(rootModule);
21
21
  return Array.from(wrappers.values());
22
22
  }
23
- exploreResourceWrappers(rootModule) {
23
+ exploreSourceWrappers(rootModule) {
24
24
  return this.exploreProviders(rootModule, (wrapper) => {
25
25
  return !!(wrapper.instance
26
26
  && typeof wrapper.instance === 'object'
27
27
  && wrapper.instance.constructor
28
- && OpraSchema.isResource(Reflect.getMetadata(METADATA_KEY, wrapper.instance.constructor)));
28
+ && OpraSchema.isSource(Reflect.getMetadata(SOURCE_METADATA, wrapper.instance.constructor)));
29
29
  });
30
30
  }
31
31
  }
@@ -1,10 +1,8 @@
1
- import { __decorate, __metadata } from "tslib";
1
+ import { __decorate } from "tslib";
2
2
  import { Inject, Logger } from '@nestjs/common';
3
- import { ApplicationConfig, HttpAdapterHost } from '@nestjs/core';
4
3
  import { OpraURLPath } from '@opra/common';
5
4
  import { ExpressAdapter } from '@opra/core';
6
5
  import { OPRA_MODULE_OPTIONS } from '../constants.js';
7
- import { OpraApiFactory } from '../factories/opra-api.factory.js';
8
6
  export class OpraApiLoader {
9
7
  constructor() {
10
8
  this.logger = new Logger(OpraApiLoader.name, { timestamp: true });
@@ -25,7 +23,7 @@ export class OpraApiLoader {
25
23
  try {
26
24
  const serviceHost = await this.opraFactory.generateService(rootModule, options, 'http');
27
25
  if (!serviceHost.resources.size) {
28
- this.logger.warn(`No resources found (${name})`);
26
+ this.logger.warn(`No Sources found (${name})`);
29
27
  return;
30
28
  }
31
29
  if (platformName === 'express') {
@@ -59,18 +57,14 @@ export class OpraApiLoader {
59
57
  }
60
58
  }
61
59
  __decorate([
62
- Inject(),
63
- __metadata("design:type", HttpAdapterHost)
60
+ Inject()
64
61
  ], OpraApiLoader.prototype, "httpAdapterHost", void 0);
65
62
  __decorate([
66
- Inject(),
67
- __metadata("design:type", ApplicationConfig)
63
+ Inject()
68
64
  ], OpraApiLoader.prototype, "applicationConfig", void 0);
69
65
  __decorate([
70
- Inject(),
71
- __metadata("design:type", OpraApiFactory)
66
+ Inject()
72
67
  ], OpraApiLoader.prototype, "opraFactory", void 0);
73
68
  __decorate([
74
- Inject(OPRA_MODULE_OPTIONS),
75
- __metadata("design:type", Object)
69
+ Inject(OPRA_MODULE_OPTIONS)
76
70
  ], OpraApiLoader.prototype, "opraModuleOptions", void 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/nestjs",
3
- "version": "0.23.2",
3
+ "version": "0.24.0",
4
4
  "description": "Opra NestJS module",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -25,19 +25,19 @@
25
25
  "clean:cover": "rimraf ../../coverage/nestjs"
26
26
  },
27
27
  "dependencies": {
28
- "@opra/common": "^0.23.2",
29
- "@opra/core": "^0.23.2",
28
+ "@opra/common": "^0.24.0",
29
+ "@opra/core": "^0.24.0",
30
30
  "fast-tokenizer": "^1.2.2",
31
31
  "lodash.head": "^4.0.1",
32
32
  "lodash.identity": "^3.0.0",
33
33
  "reflect-metadata": "^0.1.13"
34
34
  },
35
35
  "peerDependencies": {
36
- "@nestjs/common": "^10.1.3"
36
+ "@nestjs/common": "^10.2.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@nestjs/platform-express": "^10.1.3",
40
- "@nestjs/testing": "^10.1.3",
39
+ "@nestjs/platform-express": "^10.2.0",
40
+ "@nestjs/testing": "^10.2.0",
41
41
  "@types/lodash": "^4.14.197",
42
42
  "filedirname": "^2.7.0",
43
43
  "ts-gems": "^2.4.1"
package/types/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import 'reflect-metadata';
2
+ import './augmentation/common-decorator.augmentation.js';
2
3
  export * from './opra.module.js';
3
4
  export * from './decorators/context.decorator.js';
4
5
  export * from './interfaces/opra-module-options.interface.js';
@@ -2,5 +2,5 @@ import { InstanceWrapper } from '@nestjs/core/injector/instance-wrapper';
2
2
  import { Module } from '@nestjs/core/injector/module';
3
3
  export declare class NestExplorer {
4
4
  exploreProviders(rootModule: Module, predicate: (wrapper: InstanceWrapper) => boolean): InstanceWrapper<any>[];
5
- exploreResourceWrappers(rootModule: Module): InstanceWrapper[];
5
+ exploreSourceWrappers(rootModule: Module): InstanceWrapper[];
6
6
  }