Initial commit - Event Planner application

This commit is contained in:
mberlin
2026-03-18 14:55:56 -03:00
commit 86d779eb4d
7548 changed files with 1006324 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
export declare class DeterministicUuidRegistry {
private static readonly registry;
static get(str: string, inc?: number): any;
static clear(): void;
private static hashCode;
}

View File

@@ -0,0 +1,24 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DeterministicUuidRegistry = void 0;
class DeterministicUuidRegistry {
static get(str, inc = 0) {
const id = inc ? this.hashCode(`${str}_${inc}`) : this.hashCode(str);
if (this.registry.has(id)) {
return this.get(str, inc + 1);
}
this.registry.set(id, true);
return id;
}
static clear() {
this.registry.clear();
}
static hashCode(s) {
let h = 0;
for (let i = 0; i < s.length; i++)
h = (Math.imul(31, h) + s.charCodeAt(i)) | 0;
return h.toString();
}
}
exports.DeterministicUuidRegistry = DeterministicUuidRegistry;
DeterministicUuidRegistry.registry = new Map();

View File

@@ -0,0 +1,26 @@
import { NestContainer } from '../injector/container';
import { InstanceWrapper } from '../injector/instance-wrapper';
import { Module } from '../injector/module';
import { EnhancerMetadataCacheEntry } from './interfaces/enhancer-metadata-cache-entry.interface';
import { Entrypoint } from './interfaces/entrypoint.interface';
import { OrphanedEnhancerDefinition } from './interfaces/extras.interface';
import { Node } from './interfaces/node.interface';
export declare class GraphInspector {
private readonly container;
private readonly graph;
private readonly enhancersMetadataCache;
constructor(container: NestContainer);
inspectModules(modules?: Map<string, Module>): void;
registerPartial(error: unknown): void;
inspectInstanceWrapper<T = any>(source: InstanceWrapper<T>, moduleRef: Module): void;
insertEnhancerMetadataCache(entry: EnhancerMetadataCacheEntry): void;
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
insertAttachedEnhancer(wrapper: InstanceWrapper): void;
insertEntrypointDefinition<T>(definition: Entrypoint<T>, parentId: string): void;
insertClassNode(moduleRef: Module, wrapper: InstanceWrapper, type: Exclude<Node['metadata']['type'], 'module'>): void;
private insertModuleNode;
private insertModuleToModuleEdges;
private insertEnhancerEdge;
private insertClassToClassEdge;
private insertClassNodes;
}

166
node_modules/@nestjs/core/inspector/graph-inspector.js generated vendored Normal file
View File

@@ -0,0 +1,166 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphInspector = void 0;
const unknown_dependencies_exception_1 = require("../errors/exceptions/unknown-dependencies.exception");
const deterministic_uuid_registry_1 = require("./deterministic-uuid-registry");
const partial_graph_host_1 = require("./partial-graph.host");
class GraphInspector {
constructor(container) {
this.container = container;
this.enhancersMetadataCache = new Array();
this.graph = container.serializedGraph;
}
inspectModules(modules = this.container.getModules()) {
for (const moduleRef of modules.values()) {
this.insertModuleNode(moduleRef);
this.insertClassNodes(moduleRef);
this.insertModuleToModuleEdges(moduleRef);
}
this.enhancersMetadataCache.forEach(entry => this.insertEnhancerEdge(entry));
deterministic_uuid_registry_1.DeterministicUuidRegistry.clear();
}
registerPartial(error) {
this.graph.status = 'partial';
if (error instanceof unknown_dependencies_exception_1.UnknownDependenciesException) {
this.graph.metadata = {
cause: {
type: 'unknown-dependencies',
context: error.context,
moduleId: error.moduleRef?.id,
nodeId: error.metadata?.id,
},
};
}
else {
this.graph.metadata = {
cause: {
type: 'unknown',
error,
},
};
}
partial_graph_host_1.PartialGraphHost.register(this.graph);
}
inspectInstanceWrapper(source, moduleRef) {
const ctorMetadata = source.getCtorMetadata();
ctorMetadata?.forEach((target, index) => this.insertClassToClassEdge(source, target, moduleRef, index, 'constructor'));
const propertiesMetadata = source.getPropertiesMetadata();
propertiesMetadata?.forEach(({ key, wrapper: target }) => this.insertClassToClassEdge(source, target, moduleRef, key, 'property'));
}
insertEnhancerMetadataCache(entry) {
this.enhancersMetadataCache.push(entry);
}
insertOrphanedEnhancer(entry) {
this.graph.insertOrphanedEnhancer({
...entry,
ref: entry.ref?.constructor?.name ?? 'Object',
});
}
insertAttachedEnhancer(wrapper) {
const existingNode = this.graph.getNodeById(wrapper.id);
existingNode.metadata.global = true;
this.graph.insertAttachedEnhancer(existingNode.id);
}
insertEntrypointDefinition(definition, parentId) {
definition = {
...definition,
id: `${definition.classNodeId}_${definition.methodName}`,
};
this.graph.insertEntrypoint(definition, parentId);
}
insertClassNode(moduleRef, wrapper, type) {
this.graph.insertNode({
id: wrapper.id,
label: wrapper.name,
parent: moduleRef.id,
metadata: {
type,
internal: wrapper.metatype === moduleRef.metatype,
sourceModuleName: moduleRef.name,
durable: wrapper.isDependencyTreeDurable(),
static: wrapper.isDependencyTreeStatic(),
scope: wrapper.scope,
transient: wrapper.isTransient,
exported: moduleRef.exports.has(wrapper.token),
token: wrapper.token,
subtype: wrapper.subtype,
initTime: wrapper.initTime,
},
});
}
insertModuleNode(moduleRef) {
const dynamicMetadata = this.container.getDynamicMetadataByToken(moduleRef.token);
const node = {
id: moduleRef.id,
label: moduleRef.name,
metadata: {
type: 'module',
global: moduleRef.isGlobal,
dynamic: !!dynamicMetadata,
internal: moduleRef.name === 'InternalCoreModule',
},
};
this.graph.insertNode(node);
}
insertModuleToModuleEdges(moduleRef) {
for (const targetModuleRef of moduleRef.imports) {
this.graph.insertEdge({
source: moduleRef.id,
target: targetModuleRef.id,
metadata: {
type: 'module-to-module',
sourceModuleName: moduleRef.name,
targetModuleName: targetModuleRef.name,
},
});
}
}
insertEnhancerEdge(entry) {
const moduleRef = this.container.getModuleByKey(entry.moduleToken);
const sourceInstanceWrapper = moduleRef.controllers.get(entry.classRef) ??
moduleRef.providers.get(entry.classRef);
const existingSourceNode = this.graph.getNodeById(sourceInstanceWrapper.id);
const enhancers = existingSourceNode.metadata.enhancers ?? [];
if (entry.enhancerInstanceWrapper) {
this.insertClassToClassEdge(sourceInstanceWrapper, entry.enhancerInstanceWrapper, moduleRef, undefined, 'decorator');
enhancers.push({
id: entry.enhancerInstanceWrapper.id,
methodKey: entry.methodKey,
subtype: entry.subtype,
});
}
else {
const name = entry.enhancerRef.constructor?.name ??
entry.enhancerRef.name;
enhancers.push({
name,
methodKey: entry.methodKey,
subtype: entry.subtype,
});
}
existingSourceNode.metadata.enhancers = enhancers;
}
insertClassToClassEdge(source, target, moduleRef, keyOrIndex, injectionType) {
this.graph.insertEdge({
source: source.id,
target: target.id,
metadata: {
type: 'class-to-class',
sourceModuleName: moduleRef.name,
sourceClassName: source.name,
targetClassName: target.name,
sourceClassToken: source.token,
targetClassToken: target.token,
targetModuleName: target.host?.name,
keyOrIndex,
injectionType,
},
});
}
insertClassNodes(moduleRef) {
moduleRef.providers.forEach(value => this.insertClassNode(moduleRef, value, 'provider'));
moduleRef.injectables.forEach(value => this.insertClassNode(moduleRef, value, 'injectable'));
moduleRef.controllers.forEach(value => this.insertClassNode(moduleRef, value, 'controller'));
}
}
exports.GraphInspector = GraphInspector;

4
node_modules/@nestjs/core/inspector/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
export * from './graph-inspector';
export * from './initialize-on-preview.allowlist';
export * from './partial-graph.host';
export * from './serialized-graph';

7
node_modules/@nestjs/core/inspector/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./graph-inspector"), exports);
tslib_1.__exportStar(require("./initialize-on-preview.allowlist"), exports);
tslib_1.__exportStar(require("./partial-graph.host"), exports);
tslib_1.__exportStar(require("./serialized-graph"), exports);

View File

@@ -0,0 +1,6 @@
import { Type } from '@nestjs/common';
export declare class InitializeOnPreviewAllowlist {
private static readonly allowlist;
static add(type: Type): void;
static has(type: Type): boolean;
}

View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.InitializeOnPreviewAllowlist = void 0;
class InitializeOnPreviewAllowlist {
static add(type) {
this.allowlist.set(type, true);
}
static has(type) {
return this.allowlist.has(type);
}
}
exports.InitializeOnPreviewAllowlist = InitializeOnPreviewAllowlist;
InitializeOnPreviewAllowlist.allowlist = new WeakMap();

View File

@@ -0,0 +1,28 @@
import { InjectionToken } from '@nestjs/common';
type CommonEdgeMetadata = {
sourceModuleName: string;
targetModuleName: string;
};
type ModuleToModuleEdgeMetadata = {
type: 'module-to-module';
} & CommonEdgeMetadata;
type ClassToClassEdgeMetadata = {
type: 'class-to-class';
sourceClassName: string;
targetClassName: string;
sourceClassToken: InjectionToken;
targetClassToken: InjectionToken;
injectionType: 'constructor' | 'property' | 'decorator';
keyOrIndex?: string | number | symbol;
/**
* If true, indicates that this edge represents an internal providers connection
*/
internal?: boolean;
} & CommonEdgeMetadata;
export interface Edge {
id: string;
source: string;
target: string;
metadata: ModuleToModuleEdgeMetadata | ClassToClassEdgeMetadata;
}
export {};

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,12 @@
import { Type } from '@nestjs/common';
import { EnhancerSubtype } from '@nestjs/common/constants';
import { InstanceWrapper } from '../../injector/instance-wrapper';
export interface EnhancerMetadataCacheEntry {
targetNodeId?: string;
moduleToken: string;
classRef: Type;
methodKey: string | undefined;
enhancerRef?: unknown;
enhancerInstanceWrapper?: InstanceWrapper;
subtype: EnhancerSubtype;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,23 @@
import { RequestMethod } from '@nestjs/common';
import { VersionValue } from '@nestjs/common/interfaces';
export type HttpEntrypointMetadata = {
path: string;
requestMethod: keyof typeof RequestMethod;
methodVersion?: VersionValue;
controllerVersion?: VersionValue;
};
export type MiddlewareEntrypointMetadata = {
path: string;
requestMethod: keyof typeof RequestMethod;
version?: VersionValue;
};
export type Entrypoint<T> = {
id?: string;
type: string;
methodName: string;
className: string;
classNodeId: string;
metadata: {
key: string;
} & T;
};

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,18 @@
import { EnhancerSubtype } from '@nestjs/common/constants';
/**
* Enhancers attached through APP_PIPE, APP_GUARD, APP_INTERCEPTOR, and APP_FILTER tokens.
*/
export interface AttachedEnhancerDefinition {
nodeId: string;
}
/**
* Enhancers registered through "app.useGlobalPipes()", "app.useGlobalGuards()", "app.useGlobalInterceptors()", and "app.useGlobalFilters()" methods.
*/
export interface OrphanedEnhancerDefinition {
subtype: EnhancerSubtype;
ref: unknown;
}
export interface Extras {
orphanedEnhancers: Array<OrphanedEnhancerDefinition>;
attachedEnhancers: Array<AttachedEnhancerDefinition>;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,48 @@
import { InjectionToken, Scope } from '@nestjs/common';
import { EnhancerSubtype } from '@nestjs/common/constants';
export type ModuleNode = {
metadata: {
type: 'module';
global: boolean;
dynamic: boolean;
internal: boolean;
};
};
export type ClassNode = {
parent: string;
metadata: {
type: 'provider' | 'controller' | 'middleware' | 'injectable';
subtype?: EnhancerSubtype;
sourceModuleName: string;
durable: boolean;
static: boolean;
transient: boolean;
exported: boolean;
scope: Scope;
token: InjectionToken;
initTime: number;
/**
* Enhancers metadata collection
*/
enhancers?: Array<{
id: string;
subtype: EnhancerSubtype;
} | {
name: string;
methodKey?: string;
subtype: EnhancerSubtype;
}>;
/**
* If true, node is a globally registered enhancer
*/
global?: boolean;
/**
* If true, indicates that this node represents an internal provider
*/
internal?: boolean;
};
};
export type Node = {
id: string;
label: string;
} & (ClassNode | ModuleNode);

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,14 @@
import { SerializedGraphStatus } from '../serialized-graph';
import { Edge } from './edge.interface';
import { Entrypoint } from './entrypoint.interface';
import { Extras } from './extras.interface';
import { Node } from './node.interface';
import { SerializedGraphMetadata } from './serialized-graph-metadata.interface';
export interface SerializedGraphJson {
nodes: Record<string, Node>;
edges: Record<string, Edge>;
entrypoints: Record<string, Entrypoint<unknown>[]>;
extras: Extras;
status?: SerializedGraphStatus;
metadata?: SerializedGraphMetadata;
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,10 @@
import { InjectorDependencyContext } from '../../injector/injector';
export interface SerializedGraphMetadata {
cause: {
type: 'unknown-dependencies' | 'unknown';
context?: InjectorDependencyContext;
moduleId?: string;
nodeId?: string;
error?: any;
};
}

View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

View File

@@ -0,0 +1,2 @@
import { GraphInspector } from './graph-inspector';
export declare const NoopGraphInspector: GraphInspector;

View File

@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NoopGraphInspector = void 0;
const graph_inspector_1 = require("./graph-inspector");
const noop = () => { };
exports.NoopGraphInspector = new Proxy(graph_inspector_1.GraphInspector.prototype, {
get: () => noop,
});

View File

@@ -0,0 +1,7 @@
import { SerializedGraph } from './serialized-graph';
export declare class PartialGraphHost {
private static partialGraph;
static toJSON(): import("./interfaces/serialized-graph-json.interface").SerializedGraphJson;
static toString(): string;
static register(partialGraph: SerializedGraph): void;
}

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PartialGraphHost = void 0;
class PartialGraphHost {
static toJSON() {
return this.partialGraph?.toJSON();
}
static toString() {
return this.partialGraph?.toString();
}
static register(partialGraph) {
this.partialGraph = partialGraph;
}
}
exports.PartialGraphHost = PartialGraphHost;

View File

@@ -0,0 +1,52 @@
import { InjectionToken } from '@nestjs/common';
import { Edge } from './interfaces/edge.interface';
import { Entrypoint } from './interfaces/entrypoint.interface';
import { OrphanedEnhancerDefinition } from './interfaces/extras.interface';
import { Node } from './interfaces/node.interface';
import { SerializedGraphJson } from './interfaces/serialized-graph-json.interface';
import { SerializedGraphMetadata } from './interfaces/serialized-graph-metadata.interface';
export type SerializedGraphStatus = 'partial' | 'complete';
type WithOptionalId<T extends Record<'id', string>> = Omit<T, 'id'> & Partial<Pick<T, 'id'>>;
export declare class SerializedGraph {
private readonly nodes;
private readonly edges;
private readonly entrypoints;
private readonly extras;
private _status;
private _metadata?;
private static readonly INTERNAL_PROVIDERS;
set status(status: SerializedGraphStatus);
set metadata(metadata: SerializedGraphMetadata);
insertNode(nodeDefinition: Node): Node | undefined;
insertEdge(edgeDefinition: WithOptionalId<Edge>): {
id: string;
source: string;
target: string;
metadata: ({
type: "module-to-module";
} & {
sourceModuleName: string;
targetModuleName: string;
}) | ({
type: "class-to-class";
sourceClassName: string;
targetClassName: string;
sourceClassToken: InjectionToken;
targetClassToken: InjectionToken;
injectionType: "constructor" | "property" | "decorator";
keyOrIndex?: string | number | symbol;
internal?: boolean;
} & {
sourceModuleName: string;
targetModuleName: string;
});
};
insertEntrypoint<T>(definition: Entrypoint<T>, parentId: string): void;
insertOrphanedEnhancer(entry: OrphanedEnhancerDefinition): void;
insertAttachedEnhancer(nodeId: string): void;
getNodeById(id: string): Node | undefined;
toJSON(): SerializedGraphJson;
toString(): string;
private generateUuidByEdgeDefinition;
}
export {};

124
node_modules/@nestjs/core/inspector/serialized-graph.js generated vendored Normal file
View File

@@ -0,0 +1,124 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SerializedGraph = void 0;
const application_config_1 = require("../application-config");
const external_context_creator_1 = require("../helpers/external-context-creator");
const http_adapter_host_1 = require("../helpers/http-adapter-host");
const inquirer_constants_1 = require("../injector/inquirer/inquirer-constants");
const lazy_module_loader_1 = require("../injector/lazy-module-loader/lazy-module-loader");
const module_ref_1 = require("../injector/module-ref");
const modules_container_1 = require("../injector/modules-container");
const request_constants_1 = require("../router/request/request-constants");
const reflector_service_1 = require("../services/reflector.service");
const deterministic_uuid_registry_1 = require("./deterministic-uuid-registry");
class SerializedGraph {
constructor() {
this.nodes = new Map();
this.edges = new Map();
this.entrypoints = new Map();
this.extras = {
orphanedEnhancers: [],
attachedEnhancers: [],
};
this._status = 'complete';
}
set status(status) {
this._status = status;
}
set metadata(metadata) {
this._metadata = metadata;
}
insertNode(nodeDefinition) {
if (nodeDefinition.metadata.type === 'provider' &&
SerializedGraph.INTERNAL_PROVIDERS.includes(nodeDefinition.metadata.token)) {
nodeDefinition.metadata = {
...nodeDefinition.metadata,
internal: true,
};
}
if (this.nodes.has(nodeDefinition.id)) {
return this.nodes.get(nodeDefinition.id);
}
this.nodes.set(nodeDefinition.id, nodeDefinition);
return nodeDefinition;
}
insertEdge(edgeDefinition) {
if (edgeDefinition.metadata.type === 'class-to-class' &&
(SerializedGraph.INTERNAL_PROVIDERS.includes(edgeDefinition.metadata.sourceClassToken) ||
SerializedGraph.INTERNAL_PROVIDERS.includes(edgeDefinition.metadata.targetClassToken))) {
edgeDefinition.metadata = {
...edgeDefinition.metadata,
internal: true,
};
}
const id = edgeDefinition.id ?? this.generateUuidByEdgeDefinition(edgeDefinition);
const edge = {
...edgeDefinition,
id,
};
this.edges.set(id, edge);
return edge;
}
insertEntrypoint(definition, parentId) {
if (this.entrypoints.has(parentId)) {
const existingCollection = this.entrypoints.get(parentId);
existingCollection.push(definition);
}
else {
this.entrypoints.set(parentId, [definition]);
}
}
insertOrphanedEnhancer(entry) {
this.extras.orphanedEnhancers.push(entry);
}
insertAttachedEnhancer(nodeId) {
this.extras.attachedEnhancers.push({
nodeId,
});
}
getNodeById(id) {
return this.nodes.get(id);
}
toJSON() {
const json = {
nodes: Object.fromEntries(this.nodes),
edges: Object.fromEntries(this.edges),
entrypoints: Object.fromEntries(this.entrypoints),
extras: this.extras,
};
if (this._status) {
json['status'] = this._status;
}
if (this._metadata) {
json['metadata'] = this._metadata;
}
return json;
}
toString() {
const replacer = (key, value) => {
if (typeof value === 'symbol') {
return value.toString();
}
return typeof value === 'function' ? (value.name ?? 'Function') : value;
};
return JSON.stringify(this.toJSON(), replacer, 2);
}
generateUuidByEdgeDefinition(edgeDefinition) {
return deterministic_uuid_registry_1.DeterministicUuidRegistry.get(JSON.stringify(edgeDefinition));
}
}
exports.SerializedGraph = SerializedGraph;
SerializedGraph.INTERNAL_PROVIDERS = [
application_config_1.ApplicationConfig,
module_ref_1.ModuleRef,
http_adapter_host_1.HttpAdapterHost,
lazy_module_loader_1.LazyModuleLoader,
external_context_creator_1.ExternalContextCreator,
modules_container_1.ModulesContainer,
reflector_service_1.Reflector,
SerializedGraph,
http_adapter_host_1.HttpAdapterHost.name,
reflector_service_1.Reflector.name,
request_constants_1.REQUEST,
inquirer_constants_1.INQUIRER,
];

View File

@@ -0,0 +1,9 @@
export declare enum UuidFactoryMode {
Random = "random",
Deterministic = "deterministic"
}
export declare class UuidFactory {
private static _mode;
static set mode(value: UuidFactoryMode);
static get(key?: string): any;
}

22
node_modules/@nestjs/core/inspector/uuid-factory.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UuidFactory = exports.UuidFactoryMode = void 0;
const random_string_generator_util_1 = require("@nestjs/common/utils/random-string-generator.util");
const deterministic_uuid_registry_1 = require("./deterministic-uuid-registry");
var UuidFactoryMode;
(function (UuidFactoryMode) {
UuidFactoryMode["Random"] = "random";
UuidFactoryMode["Deterministic"] = "deterministic";
})(UuidFactoryMode || (exports.UuidFactoryMode = UuidFactoryMode = {}));
class UuidFactory {
static set mode(value) {
this._mode = value;
}
static get(key = '') {
return this._mode === UuidFactoryMode.Deterministic
? deterministic_uuid_registry_1.DeterministicUuidRegistry.get(key)
: (0, random_string_generator_util_1.randomStringGenerator)();
}
}
exports.UuidFactory = UuidFactory;
UuidFactory._mode = UuidFactoryMode.Random;