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,9 @@
import type { Type } from '@nestjs/common';
import { ReplFunction } from '../repl-function';
import type { ReplFnDefinition } from '../repl.interfaces';
export declare class DebugReplFn extends ReplFunction {
fnDefinition: ReplFnDefinition;
action(moduleCls?: Type<unknown> | string): void;
private printCtrlsAndProviders;
private printCollection;
}

View File

@@ -0,0 +1,46 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DebugReplFn = void 0;
const cli_colors_util_1 = require("@nestjs/common/utils/cli-colors.util");
const repl_function_1 = require("../repl-function");
class DebugReplFn extends repl_function_1.ReplFunction {
constructor() {
super(...arguments);
this.fnDefinition = {
name: 'debug',
description: 'Print all registered modules as a list together with their controllers and providers.\nIf the argument is passed in, for example, "debug(MyModule)" then it will only print components of this specific module.',
signature: '(moduleCls?: ClassRef | string) => void',
};
}
action(moduleCls) {
this.ctx.writeToStdout('\n');
if (moduleCls) {
const token = typeof moduleCls === 'function' ? moduleCls.name : moduleCls;
const moduleEntry = this.ctx.debugRegistry[token];
if (!moduleEntry) {
return this.logger.error(`"${token}" has not been found in the modules registry`);
}
this.printCtrlsAndProviders(token, moduleEntry);
}
else {
Object.keys(this.ctx.debugRegistry).forEach(moduleKey => {
this.printCtrlsAndProviders(moduleKey, this.ctx.debugRegistry[moduleKey]);
});
}
this.ctx.writeToStdout('\n');
}
printCtrlsAndProviders(moduleName, moduleDebugEntry) {
this.ctx.writeToStdout(`${cli_colors_util_1.clc.green(moduleName)}:\n`);
this.printCollection('controllers', moduleDebugEntry['controllers']);
this.printCollection('providers', moduleDebugEntry['providers']);
}
printCollection(title, collectionValue) {
const collectionEntries = Object.keys(collectionValue);
if (collectionEntries.length <= 0) {
return;
}
this.ctx.writeToStdout(` ${cli_colors_util_1.clc.yellow(`- ${title}`)}:\n`);
collectionEntries.forEach(provider => this.ctx.writeToStdout(` ${cli_colors_util_1.clc.green('◻')} ${provider}\n`));
}
}
exports.DebugReplFn = DebugReplFn;

View File

@@ -0,0 +1,7 @@
import type { Type } from '@nestjs/common';
import { ReplFunction } from '../repl-function';
import type { ReplFnDefinition } from '../repl.interfaces';
export declare class GetReplFn extends ReplFunction {
fnDefinition: ReplFnDefinition;
action(token: string | symbol | Function | Type<any>): any;
}

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetReplFn = void 0;
const repl_function_1 = require("../repl-function");
class GetReplFn extends repl_function_1.ReplFunction {
constructor() {
super(...arguments);
this.fnDefinition = {
name: 'get',
signature: '(token: InjectionToken) => any',
description: 'Retrieves an instance of either injectable or controller, otherwise, throws exception.',
aliases: ['$'],
};
}
action(token) {
return this.ctx.app.get(token);
}
}
exports.GetReplFn = GetReplFn;

View File

@@ -0,0 +1,7 @@
import { ReplFunction } from '../repl-function';
import type { ReplFnDefinition } from '../repl.interfaces';
export declare class HelpReplFn extends ReplFunction {
fnDefinition: ReplFnDefinition;
static buildHelpMessage: ({ name, description }: ReplFnDefinition) => string;
action(): void;
}

View File

@@ -0,0 +1,29 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.HelpReplFn = void 0;
const iterare_1 = require("iterare");
const cli_colors_util_1 = require("@nestjs/common/utils/cli-colors.util");
const repl_function_1 = require("../repl-function");
class HelpReplFn extends repl_function_1.ReplFunction {
constructor() {
super(...arguments);
this.fnDefinition = {
name: 'help',
signature: '() => void',
description: 'Display all available REPL native functions.',
};
}
action() {
const sortedNativeFunctions = (0, iterare_1.iterate)(this.ctx.nativeFunctions)
.map(([, nativeFunction]) => nativeFunction.fnDefinition)
.toArray()
.sort((a, b) => (a.name < b.name ? -1 : 1));
this.ctx.writeToStdout(`You can call ${cli_colors_util_1.clc.bold('.help')} on any function listed below (e.g.: ${cli_colors_util_1.clc.bold('help.help')}):\n\n` +
sortedNativeFunctions.map(HelpReplFn.buildHelpMessage).join('\n') +
// Without the following LF the last item won't be displayed
'\n');
}
}
exports.HelpReplFn = HelpReplFn;
HelpReplFn.buildHelpMessage = ({ name, description }) => cli_colors_util_1.clc.cyanBright(name) +
(description ? ` ${cli_colors_util_1.clc.bold('-')} ${description}` : '');

View File

@@ -0,0 +1,6 @@
export * from './help-repl-fn';
export * from './get-repl-fn';
export * from './resolve-repl-fn';
export * from './select-relp-fn';
export * from './debug-repl-fn';
export * from './methods-repl-fn';

View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./help-repl-fn"), exports);
tslib_1.__exportStar(require("./get-repl-fn"), exports);
tslib_1.__exportStar(require("./resolve-repl-fn"), exports);
tslib_1.__exportStar(require("./select-relp-fn"), exports);
tslib_1.__exportStar(require("./debug-repl-fn"), exports);
tslib_1.__exportStar(require("./methods-repl-fn"), exports);

View File

@@ -0,0 +1,8 @@
import type { Type } from '@nestjs/common';
import { ReplFunction } from '../repl-function';
import type { ReplFnDefinition } from '../repl.interfaces';
export declare class MethodsReplFn extends ReplFunction {
fnDefinition: ReplFnDefinition;
private readonly metadataScanner;
action(token: Type<unknown> | string): void;
}

View File

@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MethodsReplFn = void 0;
const cli_colors_util_1 = require("@nestjs/common/utils/cli-colors.util");
const metadata_scanner_1 = require("../../metadata-scanner");
const repl_function_1 = require("../repl-function");
class MethodsReplFn extends repl_function_1.ReplFunction {
constructor() {
super(...arguments);
this.fnDefinition = {
name: 'methods',
description: 'Display all public methods available on a given provider or controller.',
signature: '(token: ClassRef | string) => void',
};
this.metadataScanner = new metadata_scanner_1.MetadataScanner();
}
action(token) {
const proto = typeof token !== 'function'
? Object.getPrototypeOf(this.ctx.app.get(token))
: token?.prototype;
const methods = this.metadataScanner.getAllMethodNames(proto);
this.ctx.writeToStdout('\n');
this.ctx.writeToStdout(`${cli_colors_util_1.clc.green('Methods')}:\n`);
methods.forEach(methodName => this.ctx.writeToStdout(` ${cli_colors_util_1.clc.yellow('◻')} ${methodName}\n`));
this.ctx.writeToStdout('\n');
}
}
exports.MethodsReplFn = MethodsReplFn;

View File

@@ -0,0 +1,7 @@
import type { Type } from '@nestjs/common';
import { ReplFunction } from '../repl-function';
import type { ReplFnDefinition } from '../repl.interfaces';
export declare class ResolveReplFn extends ReplFunction {
fnDefinition: ReplFnDefinition;
action(token: string | symbol | Function | Type<any>, contextId: any): Promise<any>;
}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ResolveReplFn = void 0;
const repl_function_1 = require("../repl-function");
class ResolveReplFn extends repl_function_1.ReplFunction {
constructor() {
super(...arguments);
this.fnDefinition = {
name: 'resolve',
description: 'Resolves transient or request-scoped instance of either injectable or controller, otherwise, throws exception.',
signature: '(token: InjectionToken, contextId: any) => Promise<any>',
};
}
action(token, contextId) {
return this.ctx.app.resolve(token, contextId);
}
}
exports.ResolveReplFn = ResolveReplFn;

View File

@@ -0,0 +1,7 @@
import type { DynamicModule, INestApplicationContext, Type } from '@nestjs/common';
import { ReplFunction } from '../repl-function';
import type { ReplFnDefinition } from '../repl.interfaces';
export declare class SelectReplFn extends ReplFunction {
fnDefinition: ReplFnDefinition;
action(token: DynamicModule | Type<unknown>): INestApplicationContext;
}

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SelectReplFn = void 0;
const repl_function_1 = require("../repl-function");
class SelectReplFn extends repl_function_1.ReplFunction {
constructor() {
super(...arguments);
this.fnDefinition = {
name: 'select',
description: 'Allows navigating through the modules tree, for example, to pull out a specific instance from the selected module.',
signature: '(token: DynamicModule | ClassRef) => INestApplicationContext',
};
}
action(token) {
return this.ctx.app.select(token);
}
}
exports.SelectReplFn = SelectReplFn;