Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@golevelup/nestjs-modules

Package Overview
Dependencies
Maintainers
3
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@golevelup/nestjs-modules - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

6

CHANGELOG.md

@@ -6,2 +6,8 @@ # Change Log

# [0.6.0](https://github.com/golevelup/nestjs/compare/@golevelup/nestjs-modules@0.5.0...@golevelup/nestjs-modules@0.6.0) (2022-07-16)
### Features
- **modules:** display compiler error on missing attributes at forRootAsync ([4fe3fec](https://github.com/golevelup/nestjs/commit/4fe3fecc98a249dbe23fb856493b34135064bef0))
# [0.5.0](https://github.com/golevelup/nestjs/compare/@golevelup/nestjs-modules@0.4.4...@golevelup/nestjs-modules@0.5.0) (2022-01-24)

@@ -8,0 +14,0 @@

12

lib/dynamicModules.d.ts

@@ -8,11 +8,13 @@ import { DynamicModule, Provider, Type } from '@nestjs/common';

}
export interface AsyncModuleConfig<T> extends Pick<ModuleMetadata, 'imports' | 'exports'> {
useExisting?: {
export declare type AsyncModuleConfig<T> = Pick<ModuleMetadata, 'imports' | 'exports'> & ({
useExisting: {
value: ModuleConfigFactory<T>;
provide?: InjectionToken;
};
useClass?: Type<ModuleConfigFactory<T>>;
useFactory?: (...args: any[]) => Promise<T> | T;
} | {
useClass: Type<ModuleConfigFactory<T>>;
} | {
useFactory: (...args: any[]) => Promise<T> | T;
inject?: any[];
}
});
export declare function createModuleConfigProvider<T>(provide: InjectionToken, options: AsyncModuleConfig<T>): Provider[];

@@ -19,0 +21,0 @@ export interface IConfigurableDynamicRootModule<T, U> {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConfigurableDynamicRootModule = exports.createModuleConfigProvider = void 0;
const lodash_1 = require("lodash");
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
function createModuleConfigProvider(provide, options) {
if (options.useFactory) {
var _a, _b;
if ('useFactory' in options) {
return [

@@ -13,7 +13,7 @@ {

useFactory: options.useFactory,
inject: options.inject || [],
inject: (_a = options.inject) !== null && _a !== void 0 ? _a : [],
},
];
}
const optionsProvider = {
const optionsProviderGenerator = (inject) => ({
provide,

@@ -23,10 +23,7 @@ useFactory: async (moduleConfigFactory) => {

},
inject: [
options.useClass ||
(0, lodash_1.get)(options, 'useExisting.provide', options.useExisting.value.constructor.name),
],
};
if (options.useClass) {
inject: [inject],
});
if ('useClass' in options) {
return [
optionsProvider,
optionsProviderGenerator(options.useClass),
{

@@ -38,5 +35,5 @@ provide: options.useClass,

}
if (options.useExisting) {
if ('useExisting' in options) {
return [
optionsProvider,
optionsProviderGenerator((_b = options.useExisting.provide) !== null && _b !== void 0 ? _b : options.useExisting.value.constructor.name),
{

@@ -43,0 +40,0 @@ provide: options.useExisting.provide ||

{
"name": "@golevelup/nestjs-modules",
"version": "0.5.0",
"version": "0.6.0",
"description": "Reusable utilties to help level up NestJS Modules",

@@ -56,3 +56,3 @@ "author": "Jesse Carter <jesse.r.carter@gmail.com>",

},
"gitHead": "94ca5b66d3377ebf69b6ff22c1f3f38197fc553d"
"gitHead": "2cc62bdaee59e7c4c7908475283c7d0b8765f2b4"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc