Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
b81fc5a
fix(cli): cokidar bug
vinayak25 Jan 25, 2025
db96eb0
chore(core): update package dependencies and improve module exports
vinayak25 Mar 22, 2025
b44273e
feat(cli): migrate to ES modules and enhance build process
vinayak25 Mar 22, 2025
95d8b2d
feat(sample-app): migrate to ES modules, update dependencies, and enh…
vinayak25 Mar 22, 2025
964937a
feat(sample-app): refactor server and console initialization, update …
vinayak25 Mar 23, 2025
558ca00
feat(sample-app): enhance type checking and update response handling
vinayak25 Mar 23, 2025
de9da08
feat(sample-app): refactor imports and enhance module structure
vinayak25 Mar 23, 2025
15662b6
fix(core): update hostname default value and version increment
vinayak25 Mar 23, 2025
aca7ef4
feat(core): update dependencies and refactor imports
vinayak25 Mar 23, 2025
be3d792
feat(commitlint): add custom rules for line length enforcement
vinayak25 Mar 23, 2025
8ee97f7
feat(dependencies): update package versions and add peer dependency
vinayak25 Mar 23, 2025
89f5519
feat(sample-app): enhance logging and database migration structure
vinayak25 Mar 23, 2025
c263639
chore(core): increment version to 0.1.46-alpha.3
vinayak25 Mar 23, 2025
9f70d09
chore(cli): bump version to 0.0.18-alpha.1 and clean up dependencies
vinayak25 Mar 23, 2025
35ada64
chore(cli): bump version to 0.0.18-alpha.2 and remove unused dependency
vinayak25 Mar 23, 2025
b00d2c7
chore(sample-app): remove tsconfig.build.json and update tsconfig.jso…
vinayak25 Mar 23, 2025
2c72903
refactor(tsconfig-loader): remove unused TSCONFIG_BUILD_JSON import
vinayak25 Mar 23, 2025
647dc9c
chore(tooling): add @intentjs/tooling package and update sample app d…
vinayak25 Mar 23, 2025
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
8 changes: 8 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ const Configuration = {
* Referenced packages must be installed
*/
extends: ["@commitlint/config-conventional"],

// Add custom rules
rules: {
// Increase max line length (default is 100)
"body-max-line-length": [2, "always", 200],
// Increase header length (default is 100)
"header-max-length": [2, "always", 100],
},
};

module.exports = Configuration;
8 changes: 0 additions & 8 deletions integrations/sample-app/.intentrc

This file was deleted.

6 changes: 3 additions & 3 deletions integrations/sample-app/app/boot/container.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import config from '#config/index';
import { IntentAppContainer, IntentProvidersFactory } from '@intentjs/core';
import { AppServiceProvider } from './sp/app';
import { ConsoleServiceProvider } from './sp/console';
import config from 'config';
import { AppServiceProvider } from '#boot/sp/app';
import { ConsoleServiceProvider } from '#boot/sp/console';

export class ApplicationContainer extends IntentAppContainer {
build() {
Expand Down
11 changes: 5 additions & 6 deletions integrations/sample-app/app/boot/sp/app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { IntentApplicationContext, ServiceProvider } from '@intentjs/core';
import { OrderPlacedListener } from 'app/events/listeners/sample-listener';
import { IntentController } from 'app/http/controllers/icon';
import { QueueJobs } from 'app/jobs/job';
import { UserDbRepository } from 'app/repositories/userDbRepository';
import { UserService } from 'app/services';
import { AuthService } from 'app/services/auth';
import { OrderPlacedListener } from '#events/listeners/sample-listener';
import { QueueJobs } from '#jobs/job';
import { UserDbRepository } from '#repositories/userDbRepository';
import { UserService } from '#services/index';
import { AuthService } from '#services/auth';

export class AppServiceProvider extends ServiceProvider {
/**
Expand Down
23 changes: 16 additions & 7 deletions integrations/sample-app/app/boot/sp/console.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { IntentApplicationContext, ServiceProvider } from '@intentjs/core';
import { TestCacheConsoleCommand } from 'app/console/cache';
import { GreetingCommand } from 'app/console/greeting';
import { TestLogConsoleCommand } from 'app/console/log';
import { TestMailConsoleCommand } from 'app/console/mailer';
import { TestQueueConsoleCommand } from 'app/console/queue';
import { TestStorageConsoleCommand } from 'app/console/storage';
import { TestCacheConsoleCommand } from '#console/cache';
import { GreetingCommand } from '#console/greeting';
import { TestLogConsoleCommand } from '#console/log';
import { TestMailConsoleCommand } from '#console/mailer';
import { TestQueueConsoleCommand } from '#console/queue';
import { TestStorageConsoleCommand } from '#console/storage';
import { Dispatch } from '@intentjs/core/queue';

export class ConsoleServiceProvider extends ServiceProvider {
/**
Expand All @@ -23,5 +24,13 @@ export class ConsoleServiceProvider extends ServiceProvider {
*
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
boot(app: IntentApplicationContext) {}
boot(app: IntentApplicationContext) {
let i = 0;
setInterval(async () => {
await Dispatch({
job: 'redis_job',
data: { count: i++ },
});
}, 1000);
}
}
3 changes: 2 additions & 1 deletion integrations/sample-app/app/console/cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Cache, Command, ConsoleIO } from '@intentjs/core';
import { Cache } from '@intentjs/core/cache';
import { Command, ConsoleIO } from '@intentjs/core/console';

@Command('test:cache', { desc: 'Command to test the cache drivers' })
export class TestCacheConsoleCommand {
Expand Down
2 changes: 1 addition & 1 deletion integrations/sample-app/app/console/greeting.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Command, ConsoleIO } from '@intentjs/core';
import { Command, ConsoleIO } from '@intentjs/core/console';

/**
* Sample command, feel free to remove this file.
Expand Down
4 changes: 3 additions & 1 deletion integrations/sample-app/app/console/log.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { Command, ConsoleIO, log } from '@intentjs/core';
import { Command, ConsoleIO } from '@intentjs/core/console';
import { disposeLogger, log } from '@intentjs/core/logger';

@Command('test:log', { desc: 'Command to test the log' })
export class TestLogConsoleCommand {
async handle(_cli: ConsoleIO) {
_cli.info('Testing the log');
log('Hello world!!');
return true;
}
}
4 changes: 3 additions & 1 deletion integrations/sample-app/app/console/mailer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Command, ConsoleIO, log, Mail, MailMessage } from '@intentjs/core';
import { Command, ConsoleIO } from '@intentjs/core/console';
import { Mail, MailMessage } from '@intentjs/core/mail';
import { log } from '@intentjs/core/logger';

@Command('test:mail', { desc: 'Command to test the log' })
export class TestMailConsoleCommand {
Expand Down
3 changes: 2 additions & 1 deletion integrations/sample-app/app/console/queue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Command, ConsoleIO, Dispatch } from '@intentjs/core';
import { Command, ConsoleIO } from '@intentjs/core/console';
import { Dispatch } from '@intentjs/core/queue';

@Command('test:queue', { desc: 'Command to test the queue drivers' })
export class TestQueueConsoleCommand {
Expand Down
3 changes: 2 additions & 1 deletion integrations/sample-app/app/console/storage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Command, ConsoleIO, Storage } from '@intentjs/core';
import { Command, ConsoleIO } from '@intentjs/core/console';
import { Storage } from '@intentjs/core/storage';

@Command('test:storage', { desc: 'Command to test the storage drivers' })
export class TestStorageConsoleCommand {
Expand Down
13 changes: 5 additions & 8 deletions integrations/sample-app/app/errors/filter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
ConfigService,
ExecutionContext,
HttpException,
IntentExceptionFilter,
Type,
} from '@intentjs/core';
import { Type } from '@intentjs/core';
import { ConfigService } from '@intentjs/core/config';
import { ExceptionHandler, HttpException } from '@intentjs/core/errors';
import { ExecutionContext } from '@intentjs/core/http';

export class ApplicationExceptionFilter extends IntentExceptionFilter {
export class ApplicationExceptionHandler extends ExceptionHandler {
constructor(private config: ConfigService) {
super();
}
Expand Down
2 changes: 1 addition & 1 deletion integrations/sample-app/app/events/events/sample-event.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EmitsEvent, Event } from '@intentjs/core';
import { EmitsEvent, Event } from '@intentjs/core/events';

@Event('order_placed')
export class OrderPlacedEvent extends EmitsEvent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Injectable, ListensTo } from '@intentjs/core';
import { Injectable } from '@intentjs/core';
import { ListensTo } from '@intentjs/core/events';

@Injectable()
export class OrderPlacedListener {
Expand Down
19 changes: 13 additions & 6 deletions integrations/sample-app/app/http/controllers/app.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import { Controller, Get, Req } from '@intentjs/core';
import { OrderPlacedEvent } from 'app/events/events/sample-event';
import { UserService } from 'app/services';
import { OrderPlacedEvent } from '#events/events/sample-event';
import { UserService } from '#services/index';
import {
Controller,
Get,
Req,
Request,
Res,
Response,
} from '@intentjs/core/http';

@Controller('blogs')
@Controller('')
export class UserController {
constructor(private readonly service: UserService) {}

@Get()
async getHello(@Req() req: Request) {
return { hello: 'Intent' };
async getHello(@Req() req: Request, @Res() res: Response) {
return res.json({ hello: 'Intent2' });
}

@Get('hello/')
Expand Down
18 changes: 6 additions & 12 deletions integrations/sample-app/app/http/controllers/auth.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
import {
Body,
Controller,
Get,
Post,
Transformable,
Validate,
} from '@intentjs/core';
import { AuthService } from 'app/services/auth';
import { UserTransformer } from 'app/transformers/user';
import { Body, Controller, Get, Post } from '@intentjs/core/http';
import { AuthService } from '#services/auth';
import { UserTransformer } from '#transformers/user';
import {
LoginDto,
RegisterDto,
RequestPasswordChangeOtpDto,
VerifyEmailDto,
} from 'app/validators/auth';

} from '#validators/auth';
import { Transformable } from '@intentjs/core';
import { Validate } from '@intentjs/core/validator';
@Controller('auth')
export class AuthController extends Transformable {
constructor(private auth: AuthService) {
Expand Down
18 changes: 7 additions & 11 deletions integrations/sample-app/app/http/controllers/icon.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { CustomGuard } from '#http/guards/custom';
import { createReadStream } from 'fs';
import { join } from 'path';
import { LoginDto } from '#validators/auth';
import {
Accepts,
BufferBody,
Controller,
Dto,
File,
findProjectRoot,
Get,
Header,
Host,
Expand All @@ -14,17 +16,11 @@ import {
Query,
Req,
Res,
Response,
StreamableFile,
UseGuards,
UserAgent,
Validate,
} from '@intentjs/core';
import { CustomGuard } from '../guards/custom';
import { Request, UploadedFile } from '@intentjs/hyper-express';
import { createReadStream } from 'fs';
import { join } from 'path';
import { LoginDto } from 'app/validators/auth';
} from '@intentjs/core/http';
import { findProjectRoot } from '@intentjs/core';

@Controller('/icon')
@UseGuards(CustomGuard)
Expand Down Expand Up @@ -109,7 +105,7 @@ export class IntentController {
@BufferBody() bufferBody: Promise<Buffer>,
@UserAgent() userAgent: string,
@Header() headers: Record<string, any>,
@File('file') file: UploadedFile,
// @File('file') file: UploadedFile,
@Res() res: Response,
) {
// console.log(
Expand Down
3 changes: 2 additions & 1 deletion integrations/sample-app/app/http/decorators/custom-param.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createParamDecorator, ExecutionContext } from '@intentjs/core';
import { ExecutionContext } from '@intentjs/core/http';
import { createParamDecorator } from '@intentjs/core/http';

export const CustomParam = createParamDecorator(
(data: any, ctx: ExecutionContext, argIndex: number) => {
Expand Down
5 changes: 3 additions & 2 deletions integrations/sample-app/app/http/guards/custom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ExecutionContext, Injectable, IntentGuard } from '@intentjs/core';
import { Injectable } from '@intentjs/core';
import { ExecutionContext, HttpGuard } from '@intentjs/core/http';

@Injectable()
export class CustomGuard extends IntentGuard {
export class CustomGuard extends HttpGuard {
async guard(ctx: ExecutionContext): Promise<boolean> {
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions integrations/sample-app/app/http/guards/global.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ExecutionContext, Injectable, IntentGuard } from '@intentjs/core';
import { Injectable } from '@intentjs/core';
import { ExecutionContext, HttpGuard } from '@intentjs/core/http';

@Injectable()
export class GlobalGuard extends IntentGuard {
export class GlobalGuard extends HttpGuard {
async guard(ctx: ExecutionContext): Promise<boolean> {
return true;
}
Expand Down
26 changes: 13 additions & 13 deletions integrations/sample-app/app/http/kernel.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { UserController } from '#http/controllers/app';
import { AuthController } from '#http/controllers/auth';
import { SampleMiddleware } from '#http/middlewares/sample';
import { IntentController } from '#http/controllers/icon';
import { GlobalMiddleware } from '#http/middlewares/global';
import { Server } from '@intentjs/hyper-express';
import { GlobalGuard } from '#http/guards/global';
import {
CorsMiddleware,
HttpGuard,
HttpMethods,
IntentGuard,
IntentMiddleware,
HttpMiddleware,
Kernel,
MiddlewareConfigurator,
Type,
} from '@intentjs/core';
import { UserController } from './controllers/app';
import { AuthController } from './controllers/auth';
import { SampleMiddleware } from './middlewares/sample';
import { IntentController } from './controllers/icon';
import { GlobalMiddleware } from './middlewares/global';
import { Server } from '@intentjs/hyper-express';
import { GlobalGuard } from './guards/global';
} from '@intentjs/core/http';
import { Type } from '@intentjs/core';

export class HttpKernel extends Kernel {
/**
Expand All @@ -31,7 +31,7 @@ export class HttpKernel extends Kernel {
*
* Read more - https://tryintent.com/docs/middlewares
*/
public middlewares(): Type<IntentMiddleware>[] {
public middlewares(): Type<HttpMiddleware>[] {
return [GlobalMiddleware, CorsMiddleware];
}

Expand Down Expand Up @@ -61,7 +61,7 @@ export class HttpKernel extends Kernel {
*
* Read more - https://tryintent.com/docs/guards
*/
public guards(): Type<IntentGuard>[] {
public guards(): Type<HttpGuard>[] {
return [GlobalGuard];
}

Expand Down
6 changes: 4 additions & 2 deletions integrations/sample-app/app/http/middlewares/global.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { ConfigService, Injectable, IntentMiddleware } from '@intentjs/core';
import { ConfigService } from '@intentjs/core/config';
import { Injectable } from '@intentjs/core';
import { HttpMiddleware } from '@intentjs/core/http';
import { MiddlewareNext, Request, Response } from '@intentjs/hyper-express';

@Injectable()
export class GlobalMiddleware extends IntentMiddleware {
export class GlobalMiddleware extends HttpMiddleware {
constructor(private readonly config: ConfigService) {
super();
}
Expand Down
4 changes: 2 additions & 2 deletions integrations/sample-app/app/http/middlewares/sample.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IntentMiddleware, MiddlewareNext } from '@intentjs/core';
import { Request, Response } from '@intentjs/hyper-express';
import { HttpMiddleware, MiddlewareNext } from '@intentjs/core/http';

export class SampleMiddleware extends IntentMiddleware {
export class SampleMiddleware extends HttpMiddleware {
use(req: Request, res: Response, next: MiddlewareNext): void | Promise<void> {
// console.log(req.isHttp(), req.httpHost(), req.all(), req.bearerToken());
next();
Expand Down
5 changes: 3 additions & 2 deletions integrations/sample-app/app/jobs/job.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Injectable, Job } from '@intentjs/core';
import { Injectable } from '@intentjs/core';
import { Job } from '@intentjs/core/queue';

@Injectable()
export class QueueJobs {
@Job('db_job')
async handleDbJob(data: Record<string, any>) {
console.log(data);
console.log('db job ===> ', data);
}

@Job('redis_job', { connection: 'redis' })
Expand Down
14 changes: 0 additions & 14 deletions integrations/sample-app/app/main.ts

This file was deleted.

Loading
Loading