Socket
Socket
Sign inDemoInstall

@nestjs/common

Package Overview
Dependencies
Maintainers
1
Versions
364
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestjs/common - npm Package Compare versions

Comparing version 9.3.0-beta.3 to 9.3.0

file-stream/interfaces/index.d.ts

2

cache/decorators/cache-ttl.decorator.d.ts

@@ -13,4 +13,4 @@ import { ExecutionContext } from '../../interfaces/features/execution-context.interface';

*/
declare type CacheTTLFactory = (ctx: ExecutionContext) => Promise<number> | number;
type CacheTTLFactory = (ctx: ExecutionContext) => Promise<number> | number;
export declare const CacheTTL: (ttl: number | CacheTTLFactory) => import("../../decorators").CustomDecorator<string>;
export {};

@@ -6,2 +6,7 @@ import { Observable } from 'rxjs';

}
/**
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @publicApi
*/
export declare class CacheInterceptor implements NestInterceptor {

@@ -8,0 +13,0 @@ protected readonly cacheManager: any;

@@ -13,2 +13,7 @@ "use strict";

const REFLECTOR = 'Reflector';
/**
* @see [Caching](https://docs.nestjs.com/techniques/caching)
*
* @publicApi
*/
let CacheInterceptor = class CacheInterceptor {

@@ -15,0 +20,0 @@ constructor(cacheManager, reflector) {

@@ -43,3 +43,3 @@ export interface LiteralObject {

*/
export interface CacheStoreFactory {
export type CacheStoreFactory = {
/**

@@ -52,3 +52,3 @@ * Return a configured cache store.

create(args: LiteralObject): CacheStore;
}
} | ((args: LiteralObject) => CacheStore | Promise<CacheStore>);
/**

@@ -55,0 +55,0 @@ * Interface defining Cache Manager configuration options.

import { Provider, Type } from '../../interfaces';
import { ConfigurableModuleAsyncOptions } from '../../module-utils';
import { CacheManagerOptions } from './cache-manager.interface';
export declare type CacheModuleOptions<StoreConfig extends Record<any, any> = Record<string, any>> = CacheManagerOptions & StoreConfig & {
export type CacheModuleOptions<StoreConfig extends Record<any, any> = Record<string, any>> = CacheManagerOptions & StoreConfig & {
/**

@@ -6,0 +6,0 @@ * If "true', register `CacheModule` as a global module.

@@ -34,3 +34,3 @@ export declare const MODULE_METADATA: {

};
export declare type EnhancerSubtype = typeof ENHANCER_KEY_TO_SUBTYPE_MAP[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
export type EnhancerSubtype = typeof ENHANCER_KEY_TO_SUBTYPE_MAP[keyof typeof ENHANCER_KEY_TO_SUBTYPE_MAP];
export declare const RENDER_METADATA = "__renderTemplate__";

@@ -37,0 +37,0 @@ export declare const HTTP_CODE_METADATA = "__httpCode__";

export declare function flatten<T extends Array<unknown> = any>(arr: T): T extends Array<infer R> ? R : never;
/**
* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
*
* @publicApi
*/
export declare const Dependencies: (...dependencies: Array<unknown>) => ClassDecorator;

@@ -12,2 +12,4 @@ "use strict";

* Decorator that sets required dependencies (required with a vanilla JavaScript objects)
*
* @publicApi
*/

@@ -14,0 +16,0 @@ const Dependencies = (...dependencies) => {

@@ -30,2 +30,2 @@ /**

*/
export declare function Inject<T = any>(token?: T): (target: object, key: string | symbol, index?: number) => void;
export declare function Inject<T = any>(token?: T): (target: object, key: string | symbol | undefined, index?: number) => void;

@@ -10,3 +10,3 @@ import { ScopeOptions } from '../../interfaces/scope-options.interface';

*/
export declare type InjectableOptions = ScopeOptions;
export type InjectableOptions = ScopeOptions;
/**

@@ -41,2 +41,5 @@ * Decorator that marks a class as a [provider](https://docs.nestjs.com/providers).

export declare function Injectable(options?: InjectableOptions): ClassDecorator;
/**
* @publicApi
*/
export declare function mixin<T>(mixinClass: Type<T>): Type<T>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mixin = exports.Injectable = void 0;
const uuid_1 = require("uuid");
const uid_1 = require("uid");
const constants_1 = require("../../constants");

@@ -41,5 +41,8 @@ /**

exports.Injectable = Injectable;
/**
* @publicApi
*/
function mixin(mixinClass) {
Object.defineProperty(mixinClass, 'name', {
value: (0, uuid_1.v4)(),
value: (0, uid_1.uid)(21),
});

@@ -46,0 +49,0 @@ Injectable()(mixinClass);

@@ -14,2 +14,2 @@ /**

*/
export declare function Optional(): (target: object, key: string | symbol, index?: number) => void;
export declare function Optional(): (target: object, key: string | symbol | undefined, index?: number) => void;

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

export declare type CustomDecorator<TKey = string> = MethodDecorator & ClassDecorator & {
export type CustomDecorator<TKey = string> = MethodDecorator & ClassDecorator & {
KEY: TKey;

@@ -3,0 +3,0 @@ };

import { PipeTransform } from '../../index';
import { Type } from '../../interfaces';
import { CustomParamFactory } from '../../interfaces/features/custom-route-param-factory.interface';
export declare type ParamDecoratorEnhancer = ParameterDecorator;
export type ParamDecoratorEnhancer = ParameterDecorator;
/**

@@ -9,3 +9,5 @@ * Defines HTTP route param decorator

* @param factory
*
* @publicApi
*/
export declare function createParamDecorator<FactoryData = any, FactoryInput = any, FactoryOutput = any>(factory: CustomParamFactory<FactoryData, FactoryInput, FactoryOutput>, enhancers?: ParamDecoratorEnhancer[]): (...dataOrPipes: (Type<PipeTransform> | PipeTransform | FactoryData)[]) => ParameterDecorator;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createParamDecorator = void 0;
const uuid_1 = require("uuid");
const uid_1 = require("uid");
const constants_1 = require("../../constants");

@@ -12,5 +12,7 @@ const assign_custom_metadata_util_1 = require("../../utils/assign-custom-metadata.util");

* @param factory
*
* @publicApi
*/
function createParamDecorator(factory, enhancers = []) {
const paramtype = (0, uuid_1.v4)();
const paramtype = (0, uid_1.uid)(21);
return (data, ...pipes) => (target, key, index) => {

@@ -17,0 +19,0 @@ const args = Reflect.getMetadata(constants_1.ROUTE_ARGS_METADATA, target.constructor, key) || {};

@@ -16,3 +16,3 @@ import { PipeTransform } from '../../index';

}
export declare type ParamData = object | string | number;
export type ParamData = object | string | number;
export interface RouteParamMetadata {

@@ -19,0 +19,0 @@ index: number;

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

/**
* @publicApi
*/
export declare enum HttpStatus {

@@ -2,0 +5,0 @@ CONTINUE = 100,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpStatus = void 0;
/**
* @publicApi
*/
var HttpStatus;

@@ -5,0 +8,0 @@ (function (HttpStatus) {

@@ -79,2 +79,3 @@ "use strict";

initMessage() {
var _a, _b;
if ((0, shared_utils_1.isString)(this.response)) {

@@ -88,5 +89,4 @@ this.message = this.response;

else if (this.constructor) {
this.message = this.constructor.name
.match(/[A-Z][a-z]+|[0-9]+/g)
.join(' ');
this.message = (_b = (_a = this.constructor.name
.match(/[A-Z][a-z]+|[0-9]+/g)) === null || _a === void 0 ? void 0 : _a.join(' ')) !== null && _b !== void 0 ? _b : 'Error';
}

@@ -93,0 +93,0 @@ }

/// <reference types="node" />
import { Readable } from 'stream';
import { StreamableFileOptions } from './streamable-options.interface';
export interface StreamableHandlerResponse {
destroyed: boolean;
statusCode: number;
send: (msg: string) => void;
}
import { StreamableFileOptions, StreamableHandlerResponse } from './interfaces';
/**
* @see [Streaming files](https://docs.nestjs.com/techniques/streaming-files)
*
* @publicApi
*/
export declare class StreamableFile {

@@ -10,0 +10,0 @@ readonly options: StreamableFileOptions;

@@ -6,3 +6,9 @@ "use strict";

const util_1 = require("util");
const enums_1 = require("../enums");
const shared_utils_1 = require("../utils/shared.utils");
/**
* @see [Streaming files](https://docs.nestjs.com/techniques/streaming-files)
*
* @publicApi
*/
class StreamableFile {

@@ -14,6 +20,11 @@ constructor(bufferOrReadStream, options = {}) {

this.handleError = (err, res) => {
if (!res.destroyed) {
res.statusCode = 400;
res.send(err.message);
if (res.destroyed) {
return;
}
if (res.headersSent) {
res.end();
return;
}
res.statusCode = enums_1.HttpStatus.BAD_REQUEST;
res.send(err.message);
};

@@ -20,0 +31,0 @@ if (util_1.types.isUint8Array(bufferOrReadStream)) {

@@ -1,1 +0,1 @@

export declare type Controller = object;
export type Controller = object;

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

declare type StaticOrigin = boolean | string | RegExp | (string | RegExp)[];
type StaticOrigin = boolean | string | RegExp | (string | RegExp)[];
/**

@@ -11,3 +11,3 @@ * Set origin to a function implementing some custom logic. The function takes the

*/
export declare type CustomOrigin = (requestOrigin: string, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
export type CustomOrigin = (requestOrigin: string, callback: (err: Error | null, origin?: StaticOrigin) => void) => void;
/**

@@ -14,0 +14,0 @@ * Interface describing CORS options that can be set.

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

export declare type ContextType = 'http' | 'ws' | 'rpc';
export type ContextType = 'http' | 'ws' | 'rpc';
/**

@@ -3,0 +3,0 @@ * Methods to obtain request and response objects.

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

export declare type CustomParamFactory<TData = any, TInput = any, TOutput = any> = (data: TData, input: TInput) => TOutput;
/**
* @publicApi
*/
export type CustomParamFactory<TData = any, TInput = any, TOutput = any> = (data: TData, input: TInput) => TOutput;

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

export declare type Paramtype = 'body' | 'query' | 'param' | 'custom';
/**
* @publicApi
*/
export type Paramtype = 'body' | 'query' | 'param' | 'custom';
import { Type } from '../type.interface';
import { Paramtype } from './paramtype.interface';
export declare type Transform<T = any> = (value: T, metadata: ArgumentMetadata) => any;
export type Transform<T = any> = (value: T, metadata: ArgumentMetadata) => any;
/**

@@ -5,0 +5,0 @@ * Interface describing a pipe implementation's `transform()` method metadata argument.

@@ -5,7 +5,8 @@ import { RequestMethod } from '../../enums';

import { VersioningOptions, VersionValue } from '../version-options.interface';
export declare type ErrorHandler<TRequest = any, TResponse = any> = (error: any, req: TRequest, res: TResponse, next?: Function) => any;
export declare type RequestHandler<TRequest = any, TResponse = any> = (req: TRequest, res: TResponse, next?: Function) => any;
export type ErrorHandler<TRequest = any, TResponse = any> = (error: any, req: TRequest, res: TResponse, next?: Function) => any;
export type RequestHandler<TRequest = any, TResponse = any> = (req: TRequest, res: TResponse, next?: Function) => any;
export interface HttpServer<TRequest = any, TResponse = any> {
use(handler: RequestHandler<TRequest, TResponse> | ErrorHandler<TRequest, TResponse>): any;
use(path: string, handler: RequestHandler<TRequest, TResponse> | ErrorHandler<TRequest, TResponse>): any;
useBodyParser?(...args: any[]): any;
get(handler: RequestHandler<TRequest, TResponse>): any;

@@ -12,0 +13,0 @@ get(path: string, handler: RequestHandler<TRequest, TResponse>): any;

/// <reference types="node" />
export declare type RawBodyRequest<T> = T & {
/**
* @publicApi
*/
export type RawBodyRequest<T> = T & {
rawBody?: Buffer;
};

@@ -1,1 +0,1 @@

export declare type Injectable = unknown;
export type Injectable = unknown;

@@ -0,3 +1,6 @@

/**
* @publicApi
*/
export interface NestHybridApplicationOptions {
inheritAppConfig?: boolean;
}
import { NestApplicationContextOptions } from '../nest-application-context-options.interface';
export declare type NestMicroserviceOptions = NestApplicationContextOptions;
/**
* @publicApi
*/
export type NestMicroserviceOptions = NestApplicationContextOptions;
import { Type } from '../type.interface';
import { RouteInfo } from './middleware-configuration.interface';
import { MiddlewareConsumer } from './middleware-consumer.interface';
/**
* @publicApi
*/
export interface MiddlewareConfigProxy {

@@ -5,0 +8,0 @@ /**

@@ -0,3 +1,8 @@

/**
* @see [Middleware](https://docs.nestjs.com/middleware)
*
* @publicApi
*/
export interface NestMiddleware<TRequest = any, TResponse = any> {
use(req: TRequest, res: TResponse, next: (error?: Error | any) => void): any;
}
import { Abstract } from '../abstract.interface';
import { Type } from '../type.interface';
export declare type InjectionToken = string | symbol | Type<any> | Abstract<any> | Function;
/**
* @publicApi
*/
export type InjectionToken = string | symbol | Type<any> | Abstract<any> | Function;
import { MiddlewareConsumer } from '../middleware/middleware-consumer.interface';
/**
* @publicApi
*/
export interface NestModule {
configure(consumer: MiddlewareConsumer): any;
}
import { InjectionToken } from './injection-token.interface';
export declare type OptionalFactoryDependency = {
/**
* @publicApi
*/
export type OptionalFactoryDependency = {
token: InjectionToken;
optional: boolean;
};

@@ -9,3 +9,3 @@ import { Scope } from '../scope-options.interface';

*/
export declare type Provider<T = any> = Type<any> | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider<T>;
export type Provider<T = any> = Type<any> | ClassProvider<T> | ValueProvider<T> | FactoryProvider<T> | ExistingProvider<T>;
/**

@@ -12,0 +12,0 @@ * Interface defining a *Class* type provider.

@@ -8,6 +8,9 @@ import { VersioningType } from '../enums/version-type.enum';

export declare const VERSION_NEUTRAL: unique symbol;
export declare type VersionValue = string | typeof VERSION_NEUTRAL | Array<string | typeof VERSION_NEUTRAL>;
/**
* @publicApi
*/
export type VersionValue = string | typeof VERSION_NEUTRAL | Array<string | typeof VERSION_NEUTRAL>;
/**
* @publicApi
*/
export interface VersionOptions {

@@ -25,2 +28,5 @@ /**

}
/**
* @publicApi
*/
export interface HeaderVersioningOptions {

@@ -33,2 +39,5 @@ type: VersioningType.HEADER;

}
/**
* @publicApi
*/
export interface UriVersioningOptions {

@@ -45,2 +54,5 @@ type: VersioningType.URI;

}
/**
* @publicApi
*/
export interface MediaTypeVersioningOptions {

@@ -55,2 +67,5 @@ type: VersioningType.MEDIA_TYPE;

}
/**
* @publicApi
*/
export interface CustomVersioningOptions {

@@ -68,2 +83,5 @@ type: VersioningType.CUSTOM;

}
/**
* @publicApi
*/
interface VersioningCommonOptions {

@@ -79,3 +97,3 @@ /**

*/
export declare type VersioningOptions = VersioningCommonOptions & (HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions | CustomVersioningOptions);
export type VersioningOptions = VersioningCommonOptions & (HeaderVersioningOptions | UriVersioningOptions | MediaTypeVersioningOptions | CustomVersioningOptions);
export {};
import { Observable } from 'rxjs';
/**
* @publicApi
*/
export interface WsMessageHandler<T = string> {

@@ -6,2 +9,5 @@ message: T;

}
/**
* @publicApi
*/
export interface WebSocketAdapter<TServer = any, TClient = any, TOptions = any> {

@@ -8,0 +14,0 @@ create(port: number, options?: TOptions): TServer;

@@ -9,3 +9,3 @@ import { FactoryProvider, ModuleMetadata, Provider, Type } from '../../interfaces';

*/
export declare type ConfigurableModuleOptionsFactory<ModuleOptions, FactoryClassMethodKey extends string> = Record<`${FactoryClassMethodKey}`, () => Promise<ModuleOptions> | ModuleOptions>;
export type ConfigurableModuleOptionsFactory<ModuleOptions, FactoryClassMethodKey extends string> = Record<`${FactoryClassMethodKey}`, () => Promise<ModuleOptions> | ModuleOptions>;
/**

@@ -12,0 +12,0 @@ * Interface that represents the module async options object

@@ -11,4 +11,4 @@ import { DynamicModule } from '../../interfaces';

*/
export declare type ConfigurableModuleCls<ModuleOptions, MethodKey extends string = typeof DEFAULT_METHOD_KEY, FactoryClassMethodKey extends string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY, ExtraModuleDefinitionOptions = {}> = {
export type ConfigurableModuleCls<ModuleOptions, MethodKey extends string = typeof DEFAULT_METHOD_KEY, FactoryClassMethodKey extends string = typeof DEFAULT_FACTORY_CLASS_METHOD_KEY, ExtraModuleDefinitionOptions = {}> = {
new (): any;
} & Record<`${MethodKey}`, (options: ModuleOptions & Partial<ExtraModuleDefinitionOptions>) => DynamicModule> & Record<`${MethodKey}Async`, (options: ConfigurableModuleAsyncOptions<ModuleOptions, FactoryClassMethodKey> & Partial<ExtraModuleDefinitionOptions>) => DynamicModule>;
{
"name": "@nestjs/common",
"version": "9.3.0-beta.3",
"version": "9.3.0",
"description": "Nest - modern, fast, powerful node.js web framework (@common)",

@@ -22,3 +22,3 @@ "author": "Kamil Mysliwiec",

"tslib": "2.4.1",
"uuid": "9.0.0"
"uid": "2.0.1"
},

@@ -25,0 +25,0 @@ "peerDependencies": {

import { FileValidator } from './file-validator.interface';
export declare type FileTypeValidatorOptions = {
export type FileTypeValidatorOptions = {
fileType: string | RegExp;

@@ -4,0 +4,0 @@ };

/**
* Interface describing FileValidators, which can be added to a {@link ParseFilePipe}.
*
* @publicApi
*/

@@ -4,0 +6,0 @@ export declare abstract class FileValidator<TValidationOptions = Record<string, any>> {

@@ -6,2 +6,4 @@ "use strict";

* Interface describing FileValidators, which can be added to a {@link ParseFilePipe}.
*
* @publicApi
*/

@@ -8,0 +10,0 @@ class FileValidator {

import { FileValidator } from './file-validator.interface';
export declare type MaxFileSizeValidatorOptions = {
export type MaxFileSizeValidatorOptions = {
maxSize: number;

@@ -4,0 +4,0 @@ };

import { ErrorHttpStatusCode } from '../../utils/http-error-by-code.util';
import { FileValidator } from './file-validator.interface';
/**
* @publicApi
*/
export interface ParseFileOptions {

@@ -4,0 +7,0 @@ validators?: FileValidator[];

@@ -6,2 +6,5 @@ import { FileTypeValidatorOptions } from './file-type.validator';

import { ParseFilePipe } from './parse-file.pipe';
/**
* @publicApi
*/
export declare class ParseFilePipeBuilder {

@@ -8,0 +11,0 @@ private validators;

@@ -7,2 +7,5 @@ "use strict";

const parse_file_pipe_1 = require("./parse-file.pipe");
/**
* @publicApi
*/
class ParseFilePipeBuilder {

@@ -9,0 +12,0 @@ constructor() {

@@ -20,2 +20,4 @@ import { PipeTransform } from '../../interfaces/features/pipe-transform.interface';

transform(value: any): Promise<any>;
private validateFiles;
private thereAreNoFilesIn;
protected validate(file: any): Promise<any>;

@@ -22,0 +24,0 @@ private validateOrThrow;

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

const tslib_1 = require("tslib");
const shared_utils_1 = require("../../utils/shared.utils");
const core_1 = require("../../decorators/core");
const enums_1 = require("../../enums");
const http_error_by_code_util_1 = require("../../utils/http-error-by-code.util");
const class_validator_1 = require("class-validator");
/**

@@ -30,3 +30,3 @@ * Defines the built-in ParseFile Pipe. This pipe can be used to validate incoming files

async transform(value) {
if ((0, shared_utils_1.isUndefined)(value)) {
if (this.thereAreNoFilesIn(value)) {
if (this.fileIsRequired) {

@@ -38,6 +38,22 @@ throw this.exceptionFactory('File is required');

if (this.validators.length) {
await this.validate(value);
if (Array.isArray(value)) {
await this.validateFiles(value);
}
else {
await this.validate(value);
}
}
return value;
}
validateFiles(files) {
return Promise.all(files.map(f => this.validate(f)));
}
thereAreNoFilesIn(value) {
if (Array.isArray(value)) {
return value.length === 0;
}
else {
return (0, class_validator_1.isEmpty)(value);
}
}
async validate(file) {

@@ -44,0 +60,0 @@ for (const validator of this.validators) {

import { Type } from '../interfaces';
import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
import { ValidationPipe, ValidationPipeOptions } from './validation.pipe';
/**
* @publicApi
*/
export interface ParseArrayOptions extends Omit<ValidationPipeOptions, 'transform' | 'validateCustomDecorators' | 'exceptionFactory'> {

@@ -5,0 +8,0 @@ items?: Type<unknown>;

import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
/**
* @publicApi
*/
export interface ParseBoolPipeOptions {

@@ -4,0 +7,0 @@ errorHttpStatusCode?: ErrorHttpStatusCode;

import { ArgumentMetadata } from '../index';
import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
/**
* @publicApi
*/
export interface ParseEnumPipeOptions {

@@ -5,0 +8,0 @@ errorHttpStatusCode?: ErrorHttpStatusCode;

import { ArgumentMetadata } from '../index';
import { PipeTransform } from '../interfaces/features/pipe-transform.interface';
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
/**
* @publicApi
*/
export interface ParseFloatPipeOptions {

@@ -5,0 +8,0 @@ errorHttpStatusCode?: ErrorHttpStatusCode;

import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
/**
* @publicApi
*/
export interface ParseIntPipeOptions {

@@ -4,0 +7,0 @@ errorHttpStatusCode?: ErrorHttpStatusCode;

import { ArgumentMetadata, PipeTransform } from '../interfaces/features/pipe-transform.interface';
import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
/**
* @publicApi
*/
export interface ParseUUIDPipeOptions {

@@ -8,2 +11,9 @@ version?: '3' | '4' | '5';

}
/**
* Defines the built-in ParseUUID Pipe
*
* @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
*
* @publicApi
*/
export declare class ParseUUIDPipe implements PipeTransform<string> {

@@ -10,0 +20,0 @@ protected static uuidRegExps: {

@@ -11,2 +11,9 @@ "use strict";

const shared_utils_1 = require("../utils/shared.utils");
/**
* Defines the built-in ParseUUID Pipe
*
* @see [Built-in Pipes](https://docs.nestjs.com/pipes#built-in-pipes)
*
* @publicApi
*/
let ParseUUIDPipe = ParseUUIDPipe_1 = class ParseUUIDPipe {

@@ -13,0 +20,0 @@ constructor(options) {

@@ -9,2 +9,5 @@ import { ClassTransformOptions } from '../interfaces/external/class-transform-options.interface';

import { ErrorHttpStatusCode } from '../utils/http-error-by-code.util';
/**
* @publicApi
*/
export interface ValidationPipeOptions extends ValidatorOptions {

@@ -21,2 +24,7 @@ transform?: boolean;

}
/**
* @see [Validation](https://docs.nestjs.com/techniques/validation)
*
* @publicApi
*/
export declare class ValidationPipe implements PipeTransform<any> {

@@ -23,0 +31,0 @@ protected isTransformEnabled: boolean;

@@ -15,2 +15,7 @@ "use strict";

let classTransformer = {};
/**
* @see [Validation](https://docs.nestjs.com/techniques/validation)
*
* @publicApi
*/
let ValidationPipe = class ValidationPipe {

@@ -17,0 +22,0 @@ constructor(options) {

@@ -9,5 +9,11 @@ import { ClassSerializerContextOptions } from './class-serializer.interfaces';

}
/**
* @publicApi
*/
export interface ClassSerializerInterceptorOptions extends ClassTransformOptions {
transformerPackage?: TransformerPackage;
}
/**
* @publicApi
*/
export declare class ClassSerializerInterceptor implements NestInterceptor {

@@ -14,0 +20,0 @@ protected readonly reflector: any;

@@ -16,2 +16,5 @@ "use strict";

const REFLECTOR = 'Reflector';
/**
* @publicApi
*/
let ClassSerializerInterceptor = class ClassSerializerInterceptor {

@@ -18,0 +21,0 @@ constructor(reflector, defaultOptions = {}) {

import { ClassTransformOptions } from '../interfaces/external/class-transform-options.interface';
import { Type } from '../interfaces';
/**
* @publicApi
*/
export interface ClassSerializerContextOptions extends ClassTransformOptions {
type?: Type<any>;
}
import { ClassSerializerContextOptions } from '../class-serializer.interfaces';
/**
* @publicApi
*/
export declare const SerializeOptions: (options: ClassSerializerContextOptions) => import("../../decorators").CustomDecorator<string>;

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

const class_serializer_constants_1 = require("../class-serializer.constants");
/**
* @publicApi
*/
const SerializeOptions = (options) => (0, decorators_1.SetMetadata)(class_serializer_constants_1.CLASS_SERIALIZER_OPTIONS, options);
exports.SerializeOptions = SerializeOptions;

@@ -17,2 +17,10 @@ "use strict";

];
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
day: '2-digit',
month: '2-digit',
});
let ConsoleLogger = ConsoleLogger_1 = class ConsoleLogger {

@@ -106,11 +114,3 @@ constructor(context, options = {}) {

getTimestamp() {
const localeStringOptions = {
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
day: '2-digit',
month: '2-digit',
};
return new Date(Date.now()).toLocaleString(undefined, localeStringOptions);
return dateTimeFormatter.format(Date.now());
}

@@ -117,0 +117,0 @@ printMessages(messages, context = '', logLevel = 'log', writeStreamType) {

@@ -1,2 +0,8 @@

export declare type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose';
/**
* @publicApi
*/
export type LogLevel = 'log' | 'error' | 'warn' | 'debug' | 'verbose';
/**
* @publicApi
*/
export interface LoggerService {

@@ -39,2 +45,5 @@ /**

}
/**
* @publicApi
*/
export declare class Logger implements LoggerService {

@@ -41,0 +50,0 @@ protected context?: string;

@@ -6,4 +6,3 @@ "use strict";

const tslib_1 = require("tslib");
const injectable_decorator_1 = require("../decorators/core/injectable.decorator");
const optional_decorator_1 = require("../decorators/core/optional.decorator");
const core_1 = require("../decorators/core");
const shared_utils_1 = require("../utils/shared.utils");

@@ -13,2 +12,13 @@ const console_logger_service_1 = require("./console-logger.service");

const DEFAULT_LOGGER = new console_logger_service_1.ConsoleLogger();
const dateTimeFormatter = new Intl.DateTimeFormat(undefined, {
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
day: '2-digit',
month: '2-digit',
});
/**
* @publicApi
*/
let Logger = Logger_1 = class Logger {

@@ -34,3 +44,3 @@ constructor(context, options = {}) {

optionalParams = this.context
? optionalParams.concat(this.context)
? (optionalParams.length ? optionalParams : [undefined]).concat(this.context)
: optionalParams;

@@ -110,11 +120,3 @@ (_a = this.localInstance) === null || _a === void 0 ? void 0 : _a.error(message, ...optionalParams);

static getTimestamp() {
const localeStringOptions = {
year: 'numeric',
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
day: '2-digit',
month: '2-digit',
};
return new Date(Date.now()).toLocaleString(undefined, localeStringOptions);
return dateTimeFormatter.format(Date.now());
}

@@ -231,7 +233,7 @@ static overrideLogger(logger) {

Logger = Logger_1 = tslib_1.__decorate([
(0, injectable_decorator_1.Injectable)(),
tslib_1.__param(0, (0, optional_decorator_1.Optional)()),
tslib_1.__param(1, (0, optional_decorator_1.Optional)()),
(0, core_1.Injectable)(),
tslib_1.__param(0, (0, core_1.Optional)()),
tslib_1.__param(1, (0, core_1.Optional)()),
tslib_1.__metadata("design:paramtypes", [String, Object])
], Logger);
exports.Logger = Logger;
import { ForwardReference } from '../interfaces/modules/forward-reference.interface';
/**
* @publicApi
*/
export declare const forwardRef: (fn: () => any) => ForwardReference;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.forwardRef = void 0;
/**
* @publicApi
*/
const forwardRef = (fn) => ({

@@ -5,0 +8,0 @@ forwardRef: fn,

import { HttpStatus } from '../enums';
import { Type } from '../interfaces';
export declare type ErrorHttpStatusCode = HttpStatus.BAD_GATEWAY | HttpStatus.BAD_REQUEST | HttpStatus.CONFLICT | HttpStatus.FORBIDDEN | HttpStatus.GATEWAY_TIMEOUT | HttpStatus.GONE | HttpStatus.I_AM_A_TEAPOT | HttpStatus.INTERNAL_SERVER_ERROR | HttpStatus.METHOD_NOT_ALLOWED | HttpStatus.NOT_ACCEPTABLE | HttpStatus.NOT_FOUND | HttpStatus.NOT_IMPLEMENTED | HttpStatus.PAYLOAD_TOO_LARGE | HttpStatus.PRECONDITION_FAILED | HttpStatus.REQUEST_TIMEOUT | HttpStatus.SERVICE_UNAVAILABLE | HttpStatus.UNAUTHORIZED | HttpStatus.UNPROCESSABLE_ENTITY | HttpStatus.UNSUPPORTED_MEDIA_TYPE;
export type ErrorHttpStatusCode = HttpStatus.BAD_GATEWAY | HttpStatus.BAD_REQUEST | HttpStatus.CONFLICT | HttpStatus.FORBIDDEN | HttpStatus.GATEWAY_TIMEOUT | HttpStatus.GONE | HttpStatus.I_AM_A_TEAPOT | HttpStatus.INTERNAL_SERVER_ERROR | HttpStatus.METHOD_NOT_ALLOWED | HttpStatus.NOT_ACCEPTABLE | HttpStatus.NOT_FOUND | HttpStatus.NOT_IMPLEMENTED | HttpStatus.PAYLOAD_TOO_LARGE | HttpStatus.PRECONDITION_FAILED | HttpStatus.REQUEST_TIMEOUT | HttpStatus.SERVICE_UNAVAILABLE | HttpStatus.UNAUTHORIZED | HttpStatus.UNPROCESSABLE_ENTITY | HttpStatus.UNSUPPORTED_MEDIA_TYPE;
export declare const HttpErrorByCode: Record<ErrorHttpStatusCode, Type<unknown>>;

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

export declare type Constructor<T> = new (...args: any[]) => T;
export type Constructor<T> = new (...args: any[]) => T;
export declare const MergeWithValues: <T extends Constructor<{}>>(data: {
[param: string]: any;
}) => (Metatype: T) => any;

@@ -1,1 +0,1 @@

export declare const randomStringGenerator: () => any;
export declare const randomStringGenerator: () => string;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.randomStringGenerator = void 0;
const uuid_1 = require("uuid");
const randomStringGenerator = () => (0, uuid_1.v4)();
const uid_1 = require("uid");
const randomStringGenerator = () => (0, uid_1.uid)(21);
exports.randomStringGenerator = randomStringGenerator;
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