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

@nestjs/config

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/config - npm Package Compare versions

Comparing version 0.6.3 to 1.0.0

dist/types/config-object.type.d.ts

12

dist/config.service.d.ts

@@ -1,6 +0,9 @@

import { NoInferType } from './types';
import { NoInferType, Path, PathValue } from './types';
export interface ConfigGetOptions {
infer: true;
}
export declare class ConfigService<K = Record<string, any>> {
private readonly internalConfig;
get isCacheEnabled(): boolean;
set isCacheEnabled(value: boolean);
private set isCacheEnabled(value);
private get isCacheEnabled();
private readonly cache;

@@ -10,3 +13,5 @@ private _isCacheEnabled;

get<T = any>(propertyPath: keyof K): T | undefined;
get<T = K, P extends Path<T> = any, R = PathValue<T, P>>(propertyPath: P, options: ConfigGetOptions): R | undefined;
get<T = any>(propertyPath: keyof K, defaultValue: NoInferType<T>): T;
get<T = K, P extends Path<T> = any, R = PathValue<T, P>>(propertyPath: P, defaultValue: NoInferType<R>, options: ConfigGetOptions): R | undefined;
private getFromCache;

@@ -17,2 +22,3 @@ private getFromValidatedEnv;

private setInCacheIfDefined;
private isGetOptionsObject;
}

@@ -20,6 +20,6 @@ "use strict";

const common_1 = require("@nestjs/common");
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
const lodash_get_1 = __importDefault(require("lodash.get"));
const lodash_has_1 = __importDefault(require("lodash.has"));
const lodash_set_1 = __importDefault(require("lodash.set"));
const util_1 = require("util");
const config_constants_1 = require("./config.constants");

@@ -32,19 +32,22 @@ let ConfigService = class ConfigService {

}
set isCacheEnabled(value) {
this._isCacheEnabled = value;
}
get isCacheEnabled() {
return this._isCacheEnabled;
}
set isCacheEnabled(value) {
this._isCacheEnabled = value;
}
get(propertyPath, defaultValue) {
get(propertyPath, defaultValueOrOptions, options) {
const validatedEnvValue = this.getFromValidatedEnv(propertyPath);
if (!util_1.isUndefined(validatedEnvValue)) {
if (!shared_utils_1.isUndefined(validatedEnvValue)) {
return validatedEnvValue;
}
const defaultValue = this.isGetOptionsObject(defaultValueOrOptions) && !options
? undefined
: defaultValueOrOptions;
const processEnvValue = this.getFromProcessEnv(propertyPath, defaultValue);
if (!util_1.isUndefined(processEnvValue)) {
if (!shared_utils_1.isUndefined(processEnvValue)) {
return processEnvValue;
}
const internalValue = this.getFromInternalConfig(propertyPath);
if (!util_1.isUndefined(internalValue)) {
if (!shared_utils_1.isUndefined(internalValue)) {
return internalValue;

@@ -56,3 +59,3 @@ }

const cachedValue = lodash_get_1.default(this.cache, propertyPath);
return util_1.isUndefined(cachedValue)
return shared_utils_1.isUndefined(cachedValue)
? defaultValue

@@ -69,3 +72,3 @@ : cachedValue;

const cachedValue = this.getFromCache(propertyPath, defaultValue);
return !util_1.isUndefined(cachedValue) ? cachedValue : defaultValue;
return !shared_utils_1.isUndefined(cachedValue) ? cachedValue : defaultValue;
}

@@ -86,2 +89,5 @@ const processValue = lodash_get_1.default(process.env, propertyPath);

}
isGetOptionsObject(options) {
return options && (options === null || options === void 0 ? void 0 : options.infer) && Object.keys(options).length === 1;
}
};

@@ -88,0 +94,0 @@ ConfigService = __decorate([

@@ -1,3 +0,4 @@

declare type ConfigFactoryReturnValue = Record<string, any> | Promise<Record<string, any>>;
export declare type ConfigFactory<T extends ConfigFactoryReturnValue = ConfigFactoryReturnValue> = () => T;
import { ConfigObject } from '../types';
declare type ConfigFactoryReturnValue<T extends ConfigObject> = T | Promise<T>;
export declare type ConfigFactory<T extends ConfigObject = ConfigObject> = () => ConfigFactoryReturnValue<T>;
export {};

@@ -0,2 +1,4 @@

export * from './config-object.type';
export * from './config.type';
export * from './no-infer.type';
export * from './path-value.type';

@@ -13,3 +13,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./config-object.type"), exports);
__exportStar(require("./config.type"), exports);
__exportStar(require("./no-infer.type"), exports);
__exportStar(require("./path-value.type"), exports);
import { ConfigFactory } from '../interfaces';
import { ConfigObject } from '../types';
export declare type ConfigFactoryKeyHost = {
KEY: string;
};
export declare function registerAs<T extends ConfigFactory = ConfigFactory>(token: string, configFactory: T): T & ConfigFactoryKeyHost;
export declare function registerAs<TConfig extends ConfigObject, TFactory extends ConfigFactory = ConfigFactory<TConfig>>(token: string, configFactory: TFactory): TFactory & ConfigFactoryKeyHost;
{
"name": "@nestjs/config",
"version": "0.6.3",
"version": "1.0.0",
"description": "Nest - modern, fast, powerful node.js web framework (@config)",

@@ -10,2 +10,3 @@ "author": "Kamil Mysliwiec",

"build": "rimraf -rf dist && tsc -p tsconfig.json",
"format": "prettier --write \"{lib,test}/**/*.ts\"",
"lint": "eslint 'lib/**/*.ts' --fix",

@@ -21,3 +22,3 @@ "prepublish:npm": "npm run build",

"dependencies": {
"dotenv": "8.2.0",
"dotenv": "10.0.0",
"dotenv-expand": "5.1.0",

@@ -30,36 +31,35 @@ "lodash.get": "4.4.2",

"devDependencies": {
"@commitlint/cli": "11.0.0",
"@commitlint/config-angular": "11.0.0",
"@hapi/joi": "17.1.1",
"@nestjs/common": "7.6.8",
"@nestjs/core": "7.6.8",
"@nestjs/platform-express": "7.6.8",
"@nestjs/testing": "7.6.8",
"@types/hapi__joi": "17.1.6",
"@types/jest": "26.0.20",
"@commitlint/cli": "12.1.4",
"@commitlint/config-angular": "12.1.4",
"@nestjs/common": "8.0.0",
"@nestjs/core": "8.0.0",
"@nestjs/platform-express": "8.0.0",
"@nestjs/testing": "8.0.0",
"@types/jest": "26.0.24",
"@types/lodash.get": "4.4.6",
"@types/lodash.has": "4.5.6",
"@types/lodash.set": "4.3.6",
"@types/node": "7.10.8",
"@types/uuid": "8.3.0",
"@typescript-eslint/eslint-plugin": "4.14.2",
"@typescript-eslint/parser": "4.14.2",
"eslint": "7.19.0",
"eslint-config-prettier": "7.2.0",
"eslint-plugin-import": "2.22.1",
"husky": "4.3.8",
"jest": "26.6.3",
"lint-staged": "10.5.3",
"prettier": "2.2.1",
"@types/node": "16.0.0",
"@types/uuid": "8.3.1",
"@typescript-eslint/eslint-plugin": "4.28.2",
"@typescript-eslint/parser": "4.28.2",
"eslint": "7.30.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.23.4",
"husky": "7.0.1",
"jest": "27.0.6",
"joi": "17.4.0",
"lint-staged": "11.0.0",
"prettier": "2.3.2",
"reflect-metadata": "0.1.13",
"release-it": "14.2.2",
"release-it": "14.10.0",
"rimraf": "3.0.2",
"rxjs": "6.6.3",
"ts-jest": "26.5.0",
"typescript": "4.1.3"
"rxjs": "7.2.0",
"ts-jest": "27.0.3",
"typescript": "4.3.5"
},
"peerDependencies": {
"@nestjs/common": "^6.10.0 || ^7.0.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^6.0.0"
"@nestjs/common": "^7.0.0 || ^8.0.0",
"reflect-metadata": "^0.1.13",
"rxjs": "^6.0.0 || ^7.2.0"
},

@@ -66,0 +66,0 @@ "lint-staged": {

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