Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add example tags before comment code blocks #183

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/nestjs-authentication/src/guards/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { FastifyAuthGuard } from './fastify-auth.guard';
/**
* A Guard to use passport for express or fastify
*
* @example
* ```ts
* @UseGuards(AuthGuard('local'))
* @Post('login')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AuthenticatedUserInterface } from '@concepta/ts-common';
* associated value if it exists (or undefined if it doesn't exist,
* or if the user object has not been created).
*
* @example
* ```ts
* @Get()
* async findOne(@AuthUser('firstName') firstName: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-event/src/events/event-async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Event } from './event';
*
* For synchronous events, see the {@link EventSync} abstract class.
*
* ### Example
* @example
* ```ts
* // event payload type
* type MyPayloadType = {id: number, active: boolean};
Expand Down
3 changes: 1 addition & 2 deletions packages/nestjs-event/src/events/event-sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Event } from './event';
*
* For asynchronous events, see the {@link EventAsync} abstract class.
*
* ### Example
* @example
* ```ts
* // event payload type
* type MyPayloadType = {id: number, active: boolean};
Expand All @@ -24,7 +24,6 @@ import { Event } from './event';
* // create an event
* const myEvent = new MyEvent({id: 1234, active: true});
* ```
*
*/
export abstract class EventSync<P = undefined>
extends Event<P, void>
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-event/src/events/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { EventInterface } from './interfaces/event.interface';
* sync and async event types for your convenience. They are {@link EventSync}
* and {@link EventAsync}.
*
* ### Example
* @example
* ```ts
* // event payload type
* type MyPayloadType = {id: number, active: boolean};
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-event/src/listeners/event-listener-on.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { EventListenOnOptionsInterface } from '../services/interfaces/event-list
* [listen]{@link EventListenerOn#listen} method. The [listen]{@link EventListenerOn#listen}
* method will receive the payload dispatched by {@link EventDispatchService}.
*
* ### Example
* @example
* ```ts
* // event payload type
* type MyPayloadType = {id: number, active: boolean};
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-event/src/listeners/event-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { EventInstance, EventReturnType } from '../event-types';
* There are additional abstract classes available which have implemented the basic types
* for you. So far we have {@link EventListenerOn}... more to come!
*
* ### Example
* @example
* ```ts
* // event payload type
* type MyEventPayload = {id: number, active: boolean};
Expand Down
3 changes: 2 additions & 1 deletion packages/nestjs-event/src/services/event-dispatch.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class EventDispatchService {
* Synchronously calls each of the listeners registered for the event,
* in the order they were registered, passing the event arguments to each.
*
* ### Example
* @example
* ```ts
* import { Injectable } from '@nestjs/common';
* import { EventDispatchService, EventSync } from '@concepta/nestjs-events';
Expand Down Expand Up @@ -70,6 +70,7 @@ export class EventDispatchService {
* Asynchronously calls each of the listeners registered for the event,
* in the order they were registered, passing the event arguments to each.
*
* @example
* ```ts
* import { Injectable } from '@nestjs/common';
* import { EventDispatchService, EventAsync } from '@concepta/nestjs-events';
Expand Down
8 changes: 4 additions & 4 deletions packages/nestjs-event/src/services/event-listen.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ export class EventListenService {
* See the [EventEmitter2.on](https://github.com/EventEmitter2/EventEmitter2#emitteronevent-listener-options-objectboolean)
* documentation for more details about the underlying emitter API.
*
* ### Example
* @example
* ```ts
* import { Injectable, OnModuleInit } from '@nestjs/common';
* import { EventListenService, EventListenerOn } from '@concepta/nestjs-events';
* import { TargetEvent } from 'target-module';
*
* class MyListener extends EventListenerOn<TargetEvent> {
* listen(event: TargetEvent) {
* console.log(event.payload);
* }
* listen(event: TargetEvent) {
* console.log(event.payload);
* }
* }
*
* @Injectable()
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-logger/src/config/logger.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type LoggerConfigFactory = ConfigFactory<LoggerSettingsInterface> &
/**
* Configuration for Logger.
*
* ### example
* @example
* ```ts
* @Module({
* imports: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { LogLevel } from '@nestjs/common';
* You can create a custom log method to submit the information to any
* 3rd party transport you want to implement
*
* ### Example
* @example
* ```ts
* @Injectable()
* export class LoggerSentryTransport implements LoggerTransportInterface {
* constructor() { }
* constructor() {}
*
* log(message: string, logLevel: LogLevel, error?: Error | string): void {
* // forward message to custom transport
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-logger/src/logger-transport.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LoggerTransportInterface } from './interfaces/logger-transport.interfac
* A transport service that will load all third party transport
* that will be used to log messages to external
*
* ### Example
* @example
* ```ts
* class TestTransport implements LoggerTransportInterface {
* log(): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/nestjs-logger/src/logger.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
* With classes for request interceptor and Exceptions filters
* where will automatically log for any request or unhandled exceptions.
*
* ### Example
* @example
* ```ts
* // app.module.ts
* @Module({
Expand Down
4 changes: 2 additions & 2 deletions packages/nestjs-logger/src/logger.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { LoggerTransportInterface } from './interfaces/logger-transport.interfac
* You will need to create a custom logger and we must ensure that at least one application module imports the LoggerService
* to trigger Nest to instantiate a singleton instance of our LoggerService class.
*
* ### Example
* @example
* ```ts
* // Initialize a module that have the LoggerService imported
* const app = await NestFactory.create(AppModule);
Expand All @@ -34,7 +34,7 @@ import { LoggerTransportInterface } from './interfaces/logger-transport.interfac
* app.useLogger(customLogger);
*
* await app.listen(3000);
*```
* ```
*/
@Injectable()
export class LoggerService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LoggerTransportInterface } from '../interfaces/logger-transport.interfa
* The transport that implements {@link LoggerTransportInterface}
* to be used on {@link LoggerService} to log external messages
*
* ### Example
* @example
* ```ts
* // Get the transport instance
* const sentry = app.get(LoggerSentryTransport);
Expand Down
Loading