Initial commit - Event Planner application
This commit is contained in:
1
node_modules/@nestjs/core/services/index.d.ts
generated
vendored
Normal file
1
node_modules/@nestjs/core/services/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './reflector.service';
|
||||
4
node_modules/@nestjs/core/services/index.js
generated
vendored
Normal file
4
node_modules/@nestjs/core/services/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
tslib_1.__exportStar(require("./reflector.service"), exports);
|
||||
111
node_modules/@nestjs/core/services/reflector.service.d.ts
generated
vendored
Normal file
111
node_modules/@nestjs/core/services/reflector.service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
import { CustomDecorator, Type } from '@nestjs/common';
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export interface CreateDecoratorOptions<TParam = any, TTransformed = TParam> {
|
||||
/**
|
||||
* The key for the metadata.
|
||||
* @default uid(21)
|
||||
*/
|
||||
key?: string;
|
||||
/**
|
||||
* The transform function to apply to the metadata value.
|
||||
* @default value => value
|
||||
*/
|
||||
transform?: (value: TParam) => TTransformed;
|
||||
}
|
||||
type CreateDecoratorWithTransformOptions<TParam, TTransformed = TParam> = CreateDecoratorOptions<TParam, TTransformed> & Required<Pick<CreateDecoratorOptions<TParam, TTransformed>, 'transform'>>;
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export type ReflectableDecorator<TParam, TTransformed = TParam> = ((opts?: TParam) => CustomDecorator) & {
|
||||
KEY: string;
|
||||
};
|
||||
/**
|
||||
* Helper class providing Nest reflection capabilities.
|
||||
*
|
||||
* @see [Reflection](https://docs.nestjs.com/guards#putting-it-all-together)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export declare class Reflector {
|
||||
/**
|
||||
* Creates a decorator that can be used to decorate classes and methods with metadata.
|
||||
* Can be used as a strongly-typed alternative to `@SetMetadata`.
|
||||
* @param options Decorator options.
|
||||
* @returns A decorator function.
|
||||
*/
|
||||
static createDecorator<TParam>(options?: CreateDecoratorOptions<TParam>): ReflectableDecorator<TParam>;
|
||||
static createDecorator<TParam, TTransformed>(options: CreateDecoratorWithTransformOptions<TParam, TTransformed>): ReflectableDecorator<TParam, TTransformed>;
|
||||
/**
|
||||
* Retrieve metadata for a reflectable decorator for a specified target.
|
||||
*
|
||||
* @example
|
||||
* `const roles = this.reflector.get(Roles, context.getHandler());`
|
||||
*
|
||||
* @param decorator reflectable decorator created through `Reflector.createDecorator`
|
||||
* @param target context (decorated object) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
get<T extends ReflectableDecorator<any>>(decorator: T, target: Type<any> | Function): T extends ReflectableDecorator<any, infer R> ? R : unknown;
|
||||
/**
|
||||
* Retrieve metadata for a specified key for a specified target.
|
||||
*
|
||||
* @example
|
||||
* `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
|
||||
*
|
||||
* @param metadataKey lookup key for metadata to retrieve
|
||||
* @param target context (decorated object) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
get<TResult = any, TKey = any>(metadataKey: TKey, target: Type<any> | Function): TResult;
|
||||
/**
|
||||
* Retrieve metadata for a specified decorator for a specified set of targets.
|
||||
*
|
||||
* @param decorator lookup decorator for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAll<TParam = any, TTransformed = TParam>(decorator: ReflectableDecorator<TParam, TTransformed>, targets: (Type<any> | Function)[]): TTransformed extends Array<any> ? TTransformed : TTransformed[];
|
||||
/**
|
||||
* Retrieve metadata for a specified key for a specified set of targets.
|
||||
*
|
||||
* @param metadataKey lookup key for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAll<TResult extends any[] = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
||||
/**
|
||||
* Retrieve metadata for a specified decorator for a specified set of targets and merge results.
|
||||
*
|
||||
* @param decorator lookup decorator for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAllAndMerge<TParam = any, TTransformed = TParam>(decorator: ReflectableDecorator<TParam, TTransformed>, targets: (Type<any> | Function)[]): TTransformed extends Array<any> ? TTransformed : TTransformed extends object ? TTransformed : TTransformed[];
|
||||
/**
|
||||
* Retrieve metadata for a specified key for a specified set of targets and merge results.
|
||||
*
|
||||
* @param metadataKey lookup key for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAllAndMerge<TResult extends any[] | object = any[], TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
||||
/**
|
||||
* Retrieve metadata for a specified decorator for a specified set of targets and return a first not undefined value.
|
||||
*
|
||||
* @param decorator lookup decorator for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAllAndOverride<TParam = any, TTransformed = TParam>(decorator: ReflectableDecorator<TParam, TTransformed>, targets: (Type<any> | Function)[]): TTransformed;
|
||||
/**
|
||||
* Retrieve metadata for a specified key for a specified set of targets and return a first not undefined value.
|
||||
*
|
||||
* @param metadataKey lookup key for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAllAndOverride<TResult = any, TKey = any>(metadataKey: TKey, targets: (Type<any> | Function)[]): TResult;
|
||||
}
|
||||
export {};
|
||||
100
node_modules/@nestjs/core/services/reflector.service.js
generated
vendored
Normal file
100
node_modules/@nestjs/core/services/reflector.service.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Reflector = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
||||
const uid_1 = require("uid");
|
||||
/**
|
||||
* Helper class providing Nest reflection capabilities.
|
||||
*
|
||||
* @see [Reflection](https://docs.nestjs.com/guards#putting-it-all-together)
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
class Reflector {
|
||||
static createDecorator(options = {}) {
|
||||
const metadataKey = options.key ?? (0, uid_1.uid)(21);
|
||||
const decoratorFn = (metadataValue) => (target, key, descriptor) => {
|
||||
const value = options.transform
|
||||
? options.transform(metadataValue)
|
||||
: metadataValue;
|
||||
(0, common_1.SetMetadata)(metadataKey, value ?? {})(target, key, descriptor);
|
||||
};
|
||||
decoratorFn.KEY = metadataKey;
|
||||
return decoratorFn;
|
||||
}
|
||||
/**
|
||||
* Retrieve metadata for a specified key or decorator for a specified target.
|
||||
*
|
||||
* @example
|
||||
* `const roles = this.reflector.get<string[]>('roles', context.getHandler());`
|
||||
*
|
||||
* @param metadataKey lookup key or decorator for metadata to retrieve
|
||||
* @param target context (decorated object) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
get(metadataKeyOrDecorator, target) {
|
||||
const metadataKey = metadataKeyOrDecorator.KEY ??
|
||||
metadataKeyOrDecorator;
|
||||
return Reflect.getMetadata(metadataKey, target);
|
||||
}
|
||||
/**
|
||||
* Retrieve metadata for a specified key or decorator for a specified set of targets.
|
||||
*
|
||||
* @param metadataKeyOrDecorator lookup key or decorator for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAll(metadataKeyOrDecorator, targets) {
|
||||
return (targets || []).map(target => this.get(metadataKeyOrDecorator, target));
|
||||
}
|
||||
/**
|
||||
* Retrieve metadata for a specified key or decorator for a specified set of targets and merge results.
|
||||
*
|
||||
* @param metadataKeyOrDecorator lookup key for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAllAndMerge(metadataKeyOrDecorator, targets) {
|
||||
const metadataCollection = this.getAll(metadataKeyOrDecorator, targets).filter(item => item !== undefined);
|
||||
if ((0, shared_utils_1.isEmpty)(metadataCollection)) {
|
||||
return metadataCollection;
|
||||
}
|
||||
if (metadataCollection.length === 1) {
|
||||
const value = metadataCollection[0];
|
||||
if ((0, shared_utils_1.isObject)(value)) {
|
||||
return value;
|
||||
}
|
||||
return metadataCollection;
|
||||
}
|
||||
return metadataCollection.reduce((a, b) => {
|
||||
if (Array.isArray(a)) {
|
||||
return a.concat(b);
|
||||
}
|
||||
if ((0, shared_utils_1.isObject)(a) && (0, shared_utils_1.isObject)(b)) {
|
||||
return {
|
||||
...a,
|
||||
...b,
|
||||
};
|
||||
}
|
||||
return [a, b];
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Retrieve metadata for a specified key or decorator for a specified set of targets and return a first not undefined value.
|
||||
*
|
||||
* @param metadataKeyOrDecorator lookup key or metadata for metadata to retrieve
|
||||
* @param targets context (decorated objects) to retrieve metadata from
|
||||
*
|
||||
*/
|
||||
getAllAndOverride(metadataKeyOrDecorator, targets) {
|
||||
for (const target of targets) {
|
||||
const result = this.get(metadataKeyOrDecorator, target);
|
||||
if (result !== undefined) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
exports.Reflector = Reflector;
|
||||
Reference in New Issue
Block a user