@myko.pk/response 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/response.constants.ts","../src/builders/response.builder.ts","../src/filters/global-exception.filter.ts","../src/filters/validation.filter.ts","../src/filters/http-exception.filter.ts","../src/filters/database.filter.ts","../src/filters/auth.filter.ts","../src/decorators/skip-response-wrapper.decorator.ts","../src/decorators/response-message.decorator.ts","../src/response.context.ts","../src/interceptors/response.interceptor.ts","../src/request-context/request-context.interceptor.ts","../src/dto/paginated-query.dto.ts","../src/swagger/api-response-envelope.decorator.ts","../src/validation/validation-formatter.ts","../src/views-path.ts","../src/response.module.ts"],"names":["Logger","Catch","BadRequestException","HttpException","SetMetadata","Injectable","__filename","__dirname"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAO,IAAM,gBAAA,GAAmB;AAAA,EAC9B,MAAA,EAAQ,QAAA;AAAA,EACR,UAAA,EAAY,YAAA;AAAA,EACZ,IAAA,EAAM,MAAA;AAAA,EACN,QAAA,EAAU,UAAA;AAAA,EACV,IAAA,EAAM;AACR;AAEO,IAAM,WAAA,GAAc;AAAA,EACzB,EAAA,EAAI,GAAA;AAAA,EACJ,OAAA,EAAS,GAAA;AAAA,EACT,QAAA,EAAU,GAAA;AAAA,EACV,UAAA,EAAY,GAAA;AAAA,EACZ,YAAA,EAAc,GAAA;AAAA,EACd,KAAA,EAAO,GAAA;AAAA,EACP,WAAA,EAAa;AACf;AAEO,IAAM,iBAAA,GAAoB;AAAA,EAC/B,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,sBAAA;AAAA,EACT,QAAA,EAAU,kBAAA;AAAA,EACV,UAAA,EAAY,YAAA;AAAA,EACZ,OAAA,EAAS,sBAAA;AAAA,EACT,OAAA,EAAS,sBAAA;AAAA,EACT,eAAA,EAAiB,sBAAA;AAAA,EACjB,WAAA,EAAa,aAAA;AAAA,EAC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","file":"index.js","sourcesContent":["export const RESPONSE_FILTERS = {\n GLOBAL: 'global',\n VALIDATION: 'validation',\n HTTP: 'http',\n DATABASE: 'database',\n AUTH: 'auth',\n} as const;\n\nexport const HTTP_STATUS = {\n OK: 200,\n CREATED: 201,\n ACCEPTED: 202,\n NO_CONTENT: 204,\n MULTI_STATUS: 207,\n FOUND: 302,\n BAD_REQUEST: 400,\n} as const;\n\nexport const RESPONSE_MESSAGES = {\n SUCCESS: 'Success',\n CREATED: 'Created successfully',\n ACCEPTED: 'Request accepted',\n NO_CONTENT: 'No content',\n UPDATED: 'Updated successfully',\n DELETED: 'Deleted successfully',\n PARTIAL_SUCCESS: 'Partially successful',\n REDIRECTING: 'Redirecting',\n FILE_READY: 'File ready for download',\n} as const;\n","import { ApiResponse, PaginatedResponse, CursorPaginatedResponse } from '../types';\nimport { HTTP_STATUS, RESPONSE_MESSAGES } from '../response.constants';\nimport { responseContext } from '../response.context';\n\nexport class ResponseBuilder {\n /**\n * Build a success response\n * @template T - Type of response data\n * @param data - Response data\n * @param message - Success message\n * @param statusCode - HTTP status code\n * @param requestId - Request tracking ID for correlation\n * @returns ApiResponse with success data\n */\n static success<T = any>(\n data: T,\n message: string = RESPONSE_MESSAGES.SUCCESS,\n statusCode: number = HTTP_STATUS.OK,\n requestId?: string\n ): ApiResponse<T> {\n return {\n success: true,\n statusCode,\n message,\n data,\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Shorthand success response with no data payload (e.g. status-only endpoints)\n * @param message - Success message\n * @param statusCode - HTTP status code\n * @param requestId - Request tracking ID for correlation\n * @returns ApiResponse with no data field\n */\n static ok(\n message: string = RESPONSE_MESSAGES.SUCCESS,\n statusCode: number = HTTP_STATUS.OK,\n requestId?: string\n ): ApiResponse {\n return {\n success: true,\n statusCode,\n message,\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Build an error response\n * @param message - Error message\n * @param code - Error code for categorization\n * @param statusCode - HTTP status code\n * @param details - Additional error details\n * @param requestId - Request tracking ID for correlation\n * @returns ApiResponse with error information\n */\n static error(\n message: string,\n code: string,\n statusCode: number = HTTP_STATUS.BAD_REQUEST,\n details?: string,\n requestId?: string\n ): ApiResponse {\n return {\n success: false,\n statusCode,\n message,\n error: {\n code,\n details,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Build a paginated response\n * @template T - Type of array items\n * @param data - Array of items\n * @param total - Total number of items available\n * @param page - Current page number\n * @param limit - Items per page\n * @param message - Success message\n * @param statusCode - HTTP status code\n * @param requestId - Request tracking ID for correlation\n * @returns PaginatedResponse with pagination metadata\n */\n static paginated<T = any>(\n data: T[],\n total: number,\n page: number,\n limit: number,\n message: string = RESPONSE_MESSAGES.SUCCESS,\n statusCode: number = HTTP_STATUS.OK,\n requestId?: string\n ): PaginatedResponse<T> {\n const pages = Math.ceil(total / limit);\n return {\n success: true,\n statusCode,\n message,\n data,\n pagination: {\n total,\n page,\n limit,\n pages,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Build a cursor-based paginated response for infinite-scroll / \"load more\" patterns\n * @template T - Type of array items\n * @param data - Array of items for the current page\n * @param total - Total number of items available\n * @param nextCursor - Cursor string for the next page\n * @param hasNextPage - Whether more items exist after this page\n * @param limit - Items per page\n * @param message - Success message\n * @param statusCode - HTTP status code\n * @param requestId - Request tracking ID for correlation\n * @returns CursorPaginatedResponse with cursor metadata\n */\n static cursorPaginated<T = any>(\n data: T[],\n total: number,\n nextCursor: string | undefined,\n hasNextPage: boolean,\n limit: number,\n previousCursor?: string,\n hasPreviousPage?: boolean,\n message: string = RESPONSE_MESSAGES.SUCCESS,\n statusCode: number = HTTP_STATUS.OK,\n requestId?: string\n ): CursorPaginatedResponse<T> {\n return {\n success: true,\n statusCode,\n message,\n data,\n pagination: {\n total,\n nextCursor,\n previousCursor,\n hasNextPage,\n hasPreviousPage: hasPreviousPage ?? false,\n limit,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Build a created (201) response\n * @template T - Type of response data\n * @param data - Created resource data\n * @param message - Success message\n * @param requestId - Request tracking ID for correlation\n * @returns ApiResponse with 201 status code\n */\n static created<T = any>(\n data: T,\n message: string = RESPONSE_MESSAGES.CREATED,\n requestId?: string\n ): ApiResponse<T> {\n return this.success(data, message, HTTP_STATUS.CREATED, requestId);\n }\n\n /**\n * Build an accepted (202) response for async operations\n * @template T - Type of response data\n * @param data - Response data (optional)\n * @param message - Success message\n * @param requestId - Request tracking ID for correlation\n * @returns ApiResponse with 202 status code\n */\n static accepted<T = any>(\n data: T,\n message: string = RESPONSE_MESSAGES.ACCEPTED,\n requestId?: string\n ): ApiResponse<T> {\n return this.success(data, message, HTTP_STATUS.ACCEPTED, requestId);\n }\n\n /**\n * Build a no content (204) response\n * @param message - Success message\n * @param requestId - Request tracking ID for correlation\n * @returns ApiResponse with 204 status code\n */\n static noContent(\n message: string = RESPONSE_MESSAGES.NO_CONTENT,\n requestId?: string\n ): ApiResponse {\n return {\n success: true,\n statusCode: HTTP_STATUS.NO_CONTENT,\n message,\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Response for successful update operations\n * @param data - Updated resource data\n * @param message - Success message\n * @param requestId - Request tracking ID\n */\n static updated<T = any>(\n data: T,\n message: string = RESPONSE_MESSAGES.UPDATED,\n requestId?: string\n ): ApiResponse<T> {\n return this.success(data, message, HTTP_STATUS.OK, requestId);\n }\n\n /**\n * Response for successful delete operations\n * @param message - Success message\n * @param requestId - Request tracking ID\n */\n static deleted(\n message: string = RESPONSE_MESSAGES.DELETED,\n requestId?: string\n ): ApiResponse {\n return {\n success: true,\n statusCode: HTTP_STATUS.OK,\n message,\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Response for bulk operations (create, update, delete multiple)\n * @param succeeded - Number of successful operations\n * @param failed - Number of failed operations\n * @param total - Total operations attempted\n * @param requestId - Request tracking ID\n */\n static bulkOperation(\n succeeded: number,\n failed: number,\n total: number,\n requestId?: string\n ): ApiResponse {\n const message = failed === 0\n ? `All ${total} operations completed successfully`\n : `${succeeded} succeeded, ${failed} failed out of ${total} operations`;\n\n return {\n success: failed === 0,\n statusCode: failed === 0 ? HTTP_STATUS.OK : HTTP_STATUS.MULTI_STATUS,\n message,\n data: {\n succeeded,\n failed,\n total,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Response for partial success scenarios\n * @param data - Partial data that was processed\n * @param message - Message describing the partial success\n * @param requestId - Request tracking ID\n */\n static partialSuccess<T = any>(\n data: T,\n message: string = RESPONSE_MESSAGES.PARTIAL_SUCCESS,\n requestId?: string\n ): ApiResponse<T> {\n return {\n success: true,\n statusCode: HTTP_STATUS.MULTI_STATUS,\n message,\n data,\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Response for redirect operations\n * @param url - Redirect URL\n * @param statusCode - HTTP status code (301, 302, 307, 308)\n * @param message - Redirect message\n * @param requestId - Request tracking ID\n */\n static redirect(\n url: string,\n statusCode: number = HTTP_STATUS.FOUND,\n message: string = RESPONSE_MESSAGES.REDIRECTING,\n requestId?: string\n ): ApiResponse {\n return {\n success: true,\n statusCode,\n message,\n data: { url },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Response for file download operations\n * @param filename - Name of the file being downloaded\n * @param size - File size in bytes\n * @param mimeType - MIME type of the file\n * @param requestId - Request tracking ID\n */\n static fileDownload(\n filename: string,\n size: number,\n mimeType: string,\n requestId?: string\n ): ApiResponse {\n return {\n success: true,\n statusCode: HTTP_STATUS.OK,\n message: RESPONSE_MESSAGES.FILE_READY,\n data: {\n filename,\n size,\n mimeType,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n\n /**\n * Response for import/export operations\n * @param processed - Number of records processed\n * @param imported - Number of records imported\n * @param skipped - Number of records skipped\n * @param errors - Array of error messages\n * @param requestId - Request tracking ID\n */\n static importExport(\n processed: number,\n imported: number,\n skipped: number,\n errors: string[] = [],\n requestId?: string\n ): ApiResponse {\n const hasErrors = errors.length > 0;\n const message = hasErrors\n ? `Imported ${imported} records with ${errors.length} errors`\n : `Successfully imported ${imported} records`;\n\n return {\n success: !hasErrors,\n statusCode: hasErrors ? HTTP_STATUS.MULTI_STATUS : HTTP_STATUS.OK,\n message,\n data: {\n processed,\n imported,\n skipped,\n errors: hasErrors ? errors : undefined,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n }\n}\n","import { ExceptionFilter, Catch, ArgumentsHost, HttpException, HttpStatus, BadRequestException } from '@nestjs/common';\nimport { Logger } from '@myko.pk/logger';\nimport { Request, Response } from 'express';\n\nconst ERROR_TITLES: Record<number, string> = {\n 400: 'Bad Request',\n 401: 'Unauthorized',\n 403: 'Forbidden',\n 404: 'Page Not Found',\n 405: 'Method Not Allowed',\n 408: 'Request Timeout',\n 409: 'Conflict',\n 410: 'Gone',\n 422: 'Unprocessable Entity',\n 429: 'Too Many Requests',\n 500: 'Internal Server Error',\n 502: 'Bad Gateway',\n 503: 'Service Unavailable',\n 504: 'Gateway Timeout',\n};\n\nconst ERROR_DESCRIPTIONS: Record<number, string> = {\n 400: 'The request could not be processed due to invalid data. Please check your input and try again.',\n 401: 'You need to be signed in to access this page. Please sign in and try again.',\n 403: \"You don't have permission to access this page. If you believe this is a mistake, contact support.\",\n 404: \"The page you're looking for doesn't exist or has been moved. Check the URL and try again.\",\n 405: 'This page does not support the request method used.',\n 408: 'The server timed out waiting for your request. Please try again.',\n 409: 'The request could not be completed due to a conflict with the current state of the resource.',\n 422: 'The submitted data could not be processed. Please review your input and try again.',\n 429: 'Too many requests. Please wait a moment before trying again.',\n 500: 'Something went wrong on our end. Please try again later.',\n 502: 'The server received an invalid response from an upstream server. Please try again later.',\n 503: 'The server is temporarily unavailable. Please try again later.',\n 504: 'The server timed out waiting for an upstream server. Please try again later.',\n};\n\nfunction getErrorTitle(statusCode: number): string {\n return ERROR_TITLES[statusCode] || 'Something Went Wrong';\n}\n\nfunction getErrorDescription(statusCode: number): string {\n return ERROR_DESCRIPTIONS[statusCode] || 'An unexpected error occurred. Please try again later.';\n}\n\nfunction isBrowserRequest(request: Request): boolean {\n const accept = request.headers?.accept;\n return typeof accept === 'string' && accept.includes('text/html');\n}\n\n@Catch()\nexport class GlobalExceptionFilter implements ExceptionFilter {\n private readonly logger = new Logger(GlobalExceptionFilter.name);\n\n catch(exception: any, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest<Request>();\n const requestId = request.headers['x-request-id'] as string | undefined;\n\n let statusCode = HttpStatus.INTERNAL_SERVER_ERROR;\n let message = 'Internal server error';\n let errorCode = 'INTERNAL_ERROR';\n let details: any = undefined;\n\n if (exception instanceof HttpException) {\n statusCode = exception.getStatus();\n const exceptionResponse = exception.getResponse();\n\n if (typeof exceptionResponse === 'object') {\n const responseObj = exceptionResponse as any;\n message = responseObj.message || exception.message;\n details = responseObj.error || responseObj.errors;\n errorCode = responseObj.code || exception.constructor.name.replace('Exception', '').toUpperCase();\n\n if (exception instanceof BadRequestException && !responseObj.code) {\n errorCode = 'VALIDATION_ERROR';\n message = 'Validation failed';\n }\n } else {\n message = exceptionResponse as string;\n errorCode = exception.constructor.name.replace('Exception', '').toUpperCase();\n }\n } else if (exception instanceof Error) {\n message = exception.message;\n errorCode = exception.name || 'ERROR';\n }\n\n const errorResponse = {\n success: false,\n statusCode,\n message,\n error: {\n code: errorCode,\n details: details,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n\n // Log error with appropriate level\n const logContext = {\n statusCode,\n message,\n method: request.method,\n url: request.url,\n ip: request.ip,\n userAgent: request.headers['user-agent'],\n errorCode,\n };\n\n if (statusCode >= 500) {\n this.logger.error(`[${requestId}] ${errorCode}:`, logContext);\n } else if (statusCode >= 400) {\n this.logger.warn(`[${requestId}] ${errorCode}:`, logContext);\n } else {\n this.logger.debug(`[${requestId}] ${errorCode}:`, logContext);\n }\n\n if (response.headersSent) return;\n\n // Render error page for browser requests, JSON for API requests\n if (isBrowserRequest(request)) {\n const showMessage = statusCode < 500 || process.env.NODE_ENV !== 'production';\n const renderOptions = {\n statusCode,\n title: getErrorTitle(statusCode),\n description: getErrorDescription(statusCode),\n message: showMessage ? message : 'Something went wrong. Please try again later.',\n errorCode,\n showMessage,\n };\n\n response.setHeader('Content-Security-Policy',\n \"default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:; font-src 'self'; connect-src 'self'\",\n );\n\n response.status(statusCode);\n response.render('error', renderOptions, (renderErr: any, html: string) => {\n if (renderErr) {\n this.logger.error(`[${requestId}] Failed to render error page:`, renderErr);\n return response.json(errorResponse);\n }\n response.send(html);\n });\n } else {\n response.status(statusCode).json(errorResponse);\n }\n }\n}\n","import { ExceptionFilter, Catch, ArgumentsHost, BadRequestException } from '@nestjs/common';\nimport { Logger } from '@myko.pk/logger';\nimport { Response } from 'express';\n\n/**\n * Validation Exception Filter\n * Handles validation errors from class-validator and pipes\n * Formats validation errors in a user-friendly way\n */\n@Catch(BadRequestException)\nexport class ValidationExceptionFilter implements ExceptionFilter {\n private readonly logger = new Logger(ValidationExceptionFilter.name);\n\n catch(exception: BadRequestException, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest();\n const requestId = request.headers['x-request-id'];\n\n const exceptionResponse = exception.getResponse() as any;\n const rawErrors = exceptionResponse.message;\n const errors = Array.isArray(rawErrors) ? rawErrors : typeof rawErrors === 'string' ? [rawErrors] : [];\n\n // Format validation errors\n const formattedErrors = this.formatValidationErrors(errors);\n\n const errorResponse = {\n success: false,\n statusCode: 400,\n message: 'Validation failed',\n error: {\n code: 'VALIDATION_ERROR',\n details: formattedErrors,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n\n this.logger.warn(`[${requestId}] Validation error:`, {\n method: request.method,\n url: request.url,\n errors: formattedErrors,\n });\n\n response.status(400).json(errorResponse);\n }\n\n /**\n * Format validation errors from class-validator\n */\n private formatValidationErrors(errors: any[]): string[] {\n const messages: string[] = [];\n\n if (Array.isArray(errors)) {\n errors.forEach((error) => {\n if (typeof error === 'string') {\n messages.push(error);\n } else if (error?.constraints) {\n messages.push(...Object.values(error.constraints) as string[]);\n }\n });\n }\n\n return messages;\n }\n}\n","import { ExceptionFilter, Catch, ArgumentsHost, HttpException } from '@nestjs/common';\nimport { Logger } from '@myko.pk/logger';\nimport { Response } from 'express';\n\n/**\n * HTTP Exception Filter\n * Handles all HTTP exceptions with consistent formatting\n */\n@Catch(HttpException)\nexport class HttpExceptionFilter implements ExceptionFilter {\n private readonly logger = new Logger(HttpExceptionFilter.name);\n\n catch(exception: HttpException, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest();\n const requestId = request.headers['x-request-id'];\n\n const statusCode = exception.getStatus();\n const exceptionResponse = exception.getResponse() as any;\n\n const message = typeof exceptionResponse === 'string' \n ? exceptionResponse \n : exceptionResponse.message || exception.message;\n\n const errorCode = this.getErrorCode(exception, statusCode);\n\n const errorResponse = {\n success: false,\n statusCode,\n message,\n error: {\n code: errorCode,\n details: exceptionResponse.error || exceptionResponse.errors,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n\n // Log based on status code\n const logContext = {\n statusCode,\n message,\n method: request.method,\n url: request.url,\n ip: request.ip,\n };\n\n if (statusCode >= 500) {\n this.logger.error(`[${requestId}] ${errorCode}:`, logContext);\n } else if (statusCode >= 400) {\n this.logger.warn(`[${requestId}] ${errorCode}:`, logContext);\n }\n\n response.status(statusCode).json(errorResponse);\n }\n\n /**\n * Get error code from exception type\n */\n private getErrorCode(exception: HttpException, statusCode: number): string {\n const exceptionName = exception.constructor.name;\n \n // Map common exceptions to error codes\n const errorCodeMap: Record<number, string> = {\n 400: 'BAD_REQUEST',\n 401: 'UNAUTHORIZED',\n 403: 'FORBIDDEN',\n 404: 'NOT_FOUND',\n 409: 'CONFLICT',\n 422: 'UNPROCESSABLE_ENTITY',\n 429: 'TOO_MANY_REQUESTS',\n 500: 'INTERNAL_SERVER_ERROR',\n 502: 'BAD_GATEWAY',\n 503: 'SERVICE_UNAVAILABLE',\n };\n\n return errorCodeMap[statusCode] || exceptionName.replace('Exception', '').toUpperCase();\n }\n}\n","import { ExceptionFilter, Catch, ArgumentsHost } from '@nestjs/common';\nimport { Logger } from '@myko.pk/logger';\nimport { Response } from 'express';\n\n/**\n * Database Exception Filter\n * Handles database errors (TypeORM, Prisma, etc.)\n * Prevents sensitive database information from leaking\n */\n@Catch()\nexport class DatabaseExceptionFilter implements ExceptionFilter {\n private readonly logger = new Logger(DatabaseExceptionFilter.name);\n\n catch(exception: any, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest();\n const requestId = request.headers['x-request-id'];\n\n // Check if it's a database error\n if (!this.isDatabaseError(exception)) {\n throw exception; // Let other filters handle it\n }\n\n const { statusCode, message, errorCode } = this.parseError(exception);\n\n const errorResponse = {\n success: false,\n statusCode,\n message,\n error: {\n code: errorCode,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n\n this.logger.error(`[${requestId}] Database error:`, {\n statusCode,\n message,\n errorCode,\n method: request.method,\n url: request.url,\n // Log full error details in development only\n ...(process.env.NODE_ENV !== 'production' && { details: exception.message }),\n });\n\n response.status(statusCode).json(errorResponse);\n }\n\n /**\n * Check if exception is a database error\n */\n private isDatabaseError(exception: any): boolean {\n const errorName = exception.constructor.name;\n const errorMessage = exception.message || '';\n\n // TypeORM errors\n if (errorName.includes('QueryFailedError') || errorName.includes('EntityNotFound')) {\n return true;\n }\n\n // Prisma errors\n if (errorName.includes('PrismaClientKnownRequestError') || errorName.includes('PrismaClientValidationError')) {\n return true;\n }\n\n // Generic database error indicators\n if (\n errorMessage.includes('UNIQUE constraint failed') ||\n errorMessage.includes('Foreign key constraint') ||\n errorMessage.includes('Duplicate entry') ||\n errorMessage.includes('violates unique constraint')\n ) {\n return true;\n }\n\n return false;\n }\n\n /**\n * Parse database error and return user-friendly message\n */\n private parseError(exception: any): { statusCode: number; message: string; errorCode: string } {\n const errorMessage = exception.message || '';\n const errorCode = exception.code || 'DATABASE_ERROR';\n\n // Unique constraint violation\n if (\n errorMessage.includes('UNIQUE constraint failed') ||\n errorMessage.includes('Duplicate entry') ||\n errorMessage.includes('violates unique constraint') ||\n errorCode === 'P2002'\n ) {\n return {\n statusCode: 409,\n message: 'This record already exists',\n errorCode: 'DUPLICATE_ENTRY',\n };\n }\n\n // Foreign key constraint\n if (\n errorMessage.includes('Foreign key constraint') ||\n errorMessage.includes('FOREIGN KEY constraint failed') ||\n errorCode === 'P2003'\n ) {\n return {\n statusCode: 400,\n message: 'Invalid reference to related record',\n errorCode: 'INVALID_REFERENCE',\n };\n }\n\n // Record not found\n if (errorMessage.includes('No entity found') || errorCode === 'P2025') {\n return {\n statusCode: 404,\n message: 'Record not found',\n errorCode: 'NOT_FOUND',\n };\n }\n\n // Validation error\n if (errorMessage.includes('Validation failed') || errorCode === 'P2007') {\n return {\n statusCode: 400,\n message: 'Invalid data provided',\n errorCode: 'VALIDATION_ERROR',\n };\n }\n\n // Generic database error\n return {\n statusCode: 500,\n message: 'Database operation failed',\n errorCode: 'DATABASE_ERROR',\n };\n }\n}\n","import { ExceptionFilter, Catch, ArgumentsHost, UnauthorizedException, ForbiddenException } from '@nestjs/common';\nimport { Logger } from '@myko.pk/logger';\nimport { Response } from 'express';\n\n/**\n * Authentication & Authorization Exception Filter\n * Handles auth-related errors with appropriate responses\n */\n@Catch(UnauthorizedException, ForbiddenException)\nexport class AuthExceptionFilter implements ExceptionFilter {\n private readonly logger = new Logger(AuthExceptionFilter.name);\n\n catch(exception: UnauthorizedException | ForbiddenException, host: ArgumentsHost) {\n const ctx = host.switchToHttp();\n const response = ctx.getResponse<Response>();\n const request = ctx.getRequest();\n const requestId = request.headers['x-request-id'];\n\n const statusCode = exception.getStatus();\n const exceptionResponse = exception.getResponse() as any;\n const message = typeof exceptionResponse === 'string' \n ? exceptionResponse \n : exceptionResponse.message || exception.message;\n\n const errorCode = statusCode === 401 ? 'UNAUTHORIZED' : 'FORBIDDEN';\n\n const errorResponse = {\n success: false,\n statusCode,\n message,\n error: {\n code: errorCode,\n },\n timestamp: new Date().toISOString(),\n requestId,\n };\n\n this.logger.warn(`[${requestId}] Auth error:`, {\n statusCode,\n message,\n errorCode,\n method: request.method,\n url: request.url,\n ip: request.ip,\n });\n\n response.status(statusCode).json(errorResponse);\n }\n}\n","import { SetMetadata } from '@nestjs/common';\n\nexport const SKIP_RESPONSE_WRAPPER = 'SKIP_RESPONSE_WRAPPER';\n\nexport const SkipResponseWrapper = () => SetMetadata(SKIP_RESPONSE_WRAPPER, true);\n","import { SetMetadata } from '@nestjs/common';\n\nexport const RESPONSE_MESSAGE = 'RESPONSE_MESSAGE';\n\nexport const ResponseMessage = (message: string) => SetMetadata(RESPONSE_MESSAGE, message);\n","import { AsyncLocalStorage } from 'async_hooks';\n\nexport interface ResponseContext {\n requestId?: string;\n path?: string;\n method?: string;\n}\n\nexport const responseContext = new AsyncLocalStorage<ResponseContext>();\n","import {\n Injectable,\n NestInterceptor,\n ExecutionContext,\n CallHandler,\n} from '@nestjs/common';\nimport { Reflector } from '@nestjs/core';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\nimport { ResponseBuilder } from '../builders/response.builder';\nimport { ApiResponse } from '../types';\nimport { SKIP_RESPONSE_WRAPPER } from '../decorators/skip-response-wrapper.decorator';\nimport { RESPONSE_MESSAGE } from '../decorators/response-message.decorator';\nimport { responseContext } from '../response.context';\n\n@Injectable()\nexport class ResponseInterceptor<T> implements NestInterceptor<T, any> {\n constructor(private readonly reflector: Reflector) {}\n\n intercept(context: ExecutionContext, next: CallHandler<T>): Observable<any> {\n const skip = this.reflector.getAllAndOverride<boolean>(SKIP_RESPONSE_WRAPPER, [\n context.getHandler(),\n context.getClass(),\n ]);\n\n if (skip) return next.handle();\n\n const customMessage = this.reflector.getAllAndOverride<string>(RESPONSE_MESSAGE, [\n context.getHandler(),\n context.getClass(),\n ]);\n\n return next.handle().pipe(\n map((data) => {\n const response = context.switchToHttp().getResponse();\n if (response.headersSent) return data;\n\n if (data && typeof data === 'object' && 'success' in data && 'statusCode' in data) {\n return data;\n }\n\n const requestId =\n context.switchToHttp().getRequest().headers['x-request-id'] as string ??\n responseContext.getStore()?.requestId;\n\n return ResponseBuilder.success(data, customMessage ?? 'Success', response.statusCode, requestId);\n }),\n );\n }\n}\n","import {\n Injectable,\n NestInterceptor,\n ExecutionContext,\n CallHandler,\n} from '@nestjs/common';\nimport { Observable } from 'rxjs';\nimport { randomUUID } from 'crypto';\nimport { responseContext } from '../response.context';\n\n@Injectable()\nexport class RequestContextInterceptor implements NestInterceptor {\n intercept(context: ExecutionContext, next: CallHandler): Observable<any> {\n const request = context.switchToHttp().getRequest();\n const requestId = request.headers['x-request-id'] as string ?? randomUUID();\n\n return responseContext.run(\n { requestId, path: request.path, method: request.method },\n () => next.handle(),\n );\n }\n}\n","import { IsOptional, IsInt, Min, IsString, Max } from 'class-validator';\nimport { Type } from 'class-transformer';\n\nexport class PaginatedQueryDto {\n @IsOptional()\n @Type(() => Number)\n @IsInt()\n @Min(1)\n page?: number = 1;\n\n @IsOptional()\n @Type(() => Number)\n @IsInt()\n @Min(1)\n @Max(100)\n limit?: number = 20;\n}\n\nexport class CursorPaginatedQueryDto {\n @IsOptional()\n @IsString()\n cursor?: string;\n\n @IsOptional()\n @Type(() => Number)\n @IsInt()\n @Min(1)\n @Max(100)\n limit?: number = 20;\n}\n","import { applyDecorators, Type } from '@nestjs/common';\nimport { ApiOkResponse, ApiExtraModels, getSchemaPath } from '@nestjs/swagger';\n\nexport const ApiResponseEnvelope = <TModel extends Type<any>>(model: TModel) =>\n applyDecorators(\n ApiExtraModels(model),\n ApiOkResponse({\n schema: {\n type: 'object',\n properties: {\n success: { type: 'boolean' },\n statusCode: { type: 'number' },\n message: { type: 'string' },\n data: { $ref: getSchemaPath(model) },\n error: {\n type: 'object',\n properties: {\n code: { type: 'string' },\n details: { type: 'string' },\n },\n },\n timestamp: { type: 'string', format: 'date-time' },\n requestId: { type: 'string' },\n },\n },\n }),\n );\n","import { ValidationError } from '@nestjs/common';\n\nexport interface FormattedValidationError {\n field: string;\n constraints: string[];\n children?: FormattedValidationError[];\n}\n\nexport function formatValidationErrors(errors: ValidationError[]): FormattedValidationError[] {\n return errors.map((error) => {\n const formatted: FormattedValidationError = {\n field: error.property,\n constraints: error.constraints ? Object.values(error.constraints) : [],\n };\n\n if (error.children?.length) {\n formatted.children = formatValidationErrors(error.children);\n }\n\n return formatted;\n });\n}\n","import { fileURLToPath } from 'url';\nimport { dirname, join } from 'path';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport const ERROR_VIEWS_DIR = join(__dirname, 'views');\n","import { Module, DynamicModule, Provider } from '@nestjs/common';\nimport { APP_FILTER, APP_INTERCEPTOR } from '@nestjs/core';\nimport { GlobalExceptionFilter } from './filters/global-exception.filter';\nimport { ValidationExceptionFilter } from './filters/validation.filter';\nimport { HttpExceptionFilter } from './filters/http-exception.filter';\nimport { DatabaseExceptionFilter } from './filters/database.filter';\nimport { AuthExceptionFilter } from './filters/auth.filter';\nimport { ResponseInterceptor } from './interceptors/response.interceptor';\nimport { RequestContextInterceptor } from './request-context/request-context.interceptor';\nimport { RESPONSE_FILTERS } from './response.constants';\n\nexport interface ResponseModuleOptions {\n filters?: Array<keyof typeof RESPONSE_FILTERS>;\n enableResponseWrapper?: boolean;\n enableRequestContext?: boolean;\n}\n\nconst FILTER_MAP: Record<keyof typeof RESPONSE_FILTERS, Provider> = {\n GLOBAL: { provide: APP_FILTER, useClass: GlobalExceptionFilter },\n VALIDATION: { provide: APP_FILTER, useClass: ValidationExceptionFilter },\n HTTP: { provide: APP_FILTER, useClass: HttpExceptionFilter },\n DATABASE: { provide: APP_FILTER, useClass: DatabaseExceptionFilter },\n AUTH: { provide: APP_FILTER, useClass: AuthExceptionFilter },\n};\n\n@Module({})\nexport class ResponseModule {\n static forRoot(options?: ResponseModuleOptions): DynamicModule {\n const providers: Provider[] = [];\n\n const filterKeys = options?.filters ?? Object.keys(FILTER_MAP) as Array<keyof typeof RESPONSE_FILTERS>;\n for (const key of filterKeys) {\n providers.push(FILTER_MAP[key]);\n }\n\n if (options?.enableRequestContext) {\n providers.push({\n provide: APP_INTERCEPTOR,\n useClass: RequestContextInterceptor,\n });\n }\n\n if (options?.enableResponseWrapper) {\n providers.push({\n provide: APP_INTERCEPTOR,\n useClass: ResponseInterceptor,\n });\n }\n\n return {\n module: ResponseModule,\n providers,\n };\n }\n}\n"]}
@@ -0,0 +1,180 @@
1
+ interface ApiResponse<T = any> {
2
+ success: boolean;
3
+ statusCode: number;
4
+ message: string;
5
+ data?: T;
6
+ error?: {
7
+ code: string;
8
+ details?: string;
9
+ };
10
+ timestamp: string;
11
+ requestId?: string;
12
+ }
13
+ interface PaginatedResponse<T = any> {
14
+ success: boolean;
15
+ statusCode: number;
16
+ message: string;
17
+ data: T[];
18
+ pagination: {
19
+ total: number;
20
+ page: number;
21
+ limit: number;
22
+ pages: number;
23
+ };
24
+ timestamp: string;
25
+ requestId?: string;
26
+ }
27
+ interface CursorPaginatedResponse<T = any> {
28
+ success: boolean;
29
+ statusCode: number;
30
+ message: string;
31
+ data: T[];
32
+ pagination: {
33
+ total: number;
34
+ nextCursor?: string;
35
+ previousCursor?: string;
36
+ hasNextPage: boolean;
37
+ hasPreviousPage: boolean;
38
+ limit: number;
39
+ };
40
+ timestamp: string;
41
+ requestId?: string;
42
+ }
43
+
44
+ declare class ResponseBuilder {
45
+ /**
46
+ * Build a success response
47
+ * @template T - Type of response data
48
+ * @param data - Response data
49
+ * @param message - Success message
50
+ * @param statusCode - HTTP status code
51
+ * @param requestId - Request tracking ID for correlation
52
+ * @returns ApiResponse with success data
53
+ */
54
+ static success<T = any>(data: T, message?: string, statusCode?: number, requestId?: string): ApiResponse<T>;
55
+ /**
56
+ * Shorthand success response with no data payload (e.g. status-only endpoints)
57
+ * @param message - Success message
58
+ * @param statusCode - HTTP status code
59
+ * @param requestId - Request tracking ID for correlation
60
+ * @returns ApiResponse with no data field
61
+ */
62
+ static ok(message?: string, statusCode?: number, requestId?: string): ApiResponse;
63
+ /**
64
+ * Build an error response
65
+ * @param message - Error message
66
+ * @param code - Error code for categorization
67
+ * @param statusCode - HTTP status code
68
+ * @param details - Additional error details
69
+ * @param requestId - Request tracking ID for correlation
70
+ * @returns ApiResponse with error information
71
+ */
72
+ static error(message: string, code: string, statusCode?: number, details?: string, requestId?: string): ApiResponse;
73
+ /**
74
+ * Build a paginated response
75
+ * @template T - Type of array items
76
+ * @param data - Array of items
77
+ * @param total - Total number of items available
78
+ * @param page - Current page number
79
+ * @param limit - Items per page
80
+ * @param message - Success message
81
+ * @param statusCode - HTTP status code
82
+ * @param requestId - Request tracking ID for correlation
83
+ * @returns PaginatedResponse with pagination metadata
84
+ */
85
+ static paginated<T = any>(data: T[], total: number, page: number, limit: number, message?: string, statusCode?: number, requestId?: string): PaginatedResponse<T>;
86
+ /**
87
+ * Build a cursor-based paginated response for infinite-scroll / "load more" patterns
88
+ * @template T - Type of array items
89
+ * @param data - Array of items for the current page
90
+ * @param total - Total number of items available
91
+ * @param nextCursor - Cursor string for the next page
92
+ * @param hasNextPage - Whether more items exist after this page
93
+ * @param limit - Items per page
94
+ * @param message - Success message
95
+ * @param statusCode - HTTP status code
96
+ * @param requestId - Request tracking ID for correlation
97
+ * @returns CursorPaginatedResponse with cursor metadata
98
+ */
99
+ static cursorPaginated<T = any>(data: T[], total: number, nextCursor: string | undefined, hasNextPage: boolean, limit: number, previousCursor?: string, hasPreviousPage?: boolean, message?: string, statusCode?: number, requestId?: string): CursorPaginatedResponse<T>;
100
+ /**
101
+ * Build a created (201) response
102
+ * @template T - Type of response data
103
+ * @param data - Created resource data
104
+ * @param message - Success message
105
+ * @param requestId - Request tracking ID for correlation
106
+ * @returns ApiResponse with 201 status code
107
+ */
108
+ static created<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
109
+ /**
110
+ * Build an accepted (202) response for async operations
111
+ * @template T - Type of response data
112
+ * @param data - Response data (optional)
113
+ * @param message - Success message
114
+ * @param requestId - Request tracking ID for correlation
115
+ * @returns ApiResponse with 202 status code
116
+ */
117
+ static accepted<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
118
+ /**
119
+ * Build a no content (204) response
120
+ * @param message - Success message
121
+ * @param requestId - Request tracking ID for correlation
122
+ * @returns ApiResponse with 204 status code
123
+ */
124
+ static noContent(message?: string, requestId?: string): ApiResponse;
125
+ /**
126
+ * Response for successful update operations
127
+ * @param data - Updated resource data
128
+ * @param message - Success message
129
+ * @param requestId - Request tracking ID
130
+ */
131
+ static updated<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
132
+ /**
133
+ * Response for successful delete operations
134
+ * @param message - Success message
135
+ * @param requestId - Request tracking ID
136
+ */
137
+ static deleted(message?: string, requestId?: string): ApiResponse;
138
+ /**
139
+ * Response for bulk operations (create, update, delete multiple)
140
+ * @param succeeded - Number of successful operations
141
+ * @param failed - Number of failed operations
142
+ * @param total - Total operations attempted
143
+ * @param requestId - Request tracking ID
144
+ */
145
+ static bulkOperation(succeeded: number, failed: number, total: number, requestId?: string): ApiResponse;
146
+ /**
147
+ * Response for partial success scenarios
148
+ * @param data - Partial data that was processed
149
+ * @param message - Message describing the partial success
150
+ * @param requestId - Request tracking ID
151
+ */
152
+ static partialSuccess<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
153
+ /**
154
+ * Response for redirect operations
155
+ * @param url - Redirect URL
156
+ * @param statusCode - HTTP status code (301, 302, 307, 308)
157
+ * @param message - Redirect message
158
+ * @param requestId - Request tracking ID
159
+ */
160
+ static redirect(url: string, statusCode?: number, message?: string, requestId?: string): ApiResponse;
161
+ /**
162
+ * Response for file download operations
163
+ * @param filename - Name of the file being downloaded
164
+ * @param size - File size in bytes
165
+ * @param mimeType - MIME type of the file
166
+ * @param requestId - Request tracking ID
167
+ */
168
+ static fileDownload(filename: string, size: number, mimeType: string, requestId?: string): ApiResponse;
169
+ /**
170
+ * Response for import/export operations
171
+ * @param processed - Number of records processed
172
+ * @param imported - Number of records imported
173
+ * @param skipped - Number of records skipped
174
+ * @param errors - Array of error messages
175
+ * @param requestId - Request tracking ID
176
+ */
177
+ static importExport(processed: number, imported: number, skipped: number, errors?: string[], requestId?: string): ApiResponse;
178
+ }
179
+
180
+ export { type ApiResponse as A, type CursorPaginatedResponse as C, type PaginatedResponse as P, ResponseBuilder as R };
@@ -0,0 +1,180 @@
1
+ interface ApiResponse<T = any> {
2
+ success: boolean;
3
+ statusCode: number;
4
+ message: string;
5
+ data?: T;
6
+ error?: {
7
+ code: string;
8
+ details?: string;
9
+ };
10
+ timestamp: string;
11
+ requestId?: string;
12
+ }
13
+ interface PaginatedResponse<T = any> {
14
+ success: boolean;
15
+ statusCode: number;
16
+ message: string;
17
+ data: T[];
18
+ pagination: {
19
+ total: number;
20
+ page: number;
21
+ limit: number;
22
+ pages: number;
23
+ };
24
+ timestamp: string;
25
+ requestId?: string;
26
+ }
27
+ interface CursorPaginatedResponse<T = any> {
28
+ success: boolean;
29
+ statusCode: number;
30
+ message: string;
31
+ data: T[];
32
+ pagination: {
33
+ total: number;
34
+ nextCursor?: string;
35
+ previousCursor?: string;
36
+ hasNextPage: boolean;
37
+ hasPreviousPage: boolean;
38
+ limit: number;
39
+ };
40
+ timestamp: string;
41
+ requestId?: string;
42
+ }
43
+
44
+ declare class ResponseBuilder {
45
+ /**
46
+ * Build a success response
47
+ * @template T - Type of response data
48
+ * @param data - Response data
49
+ * @param message - Success message
50
+ * @param statusCode - HTTP status code
51
+ * @param requestId - Request tracking ID for correlation
52
+ * @returns ApiResponse with success data
53
+ */
54
+ static success<T = any>(data: T, message?: string, statusCode?: number, requestId?: string): ApiResponse<T>;
55
+ /**
56
+ * Shorthand success response with no data payload (e.g. status-only endpoints)
57
+ * @param message - Success message
58
+ * @param statusCode - HTTP status code
59
+ * @param requestId - Request tracking ID for correlation
60
+ * @returns ApiResponse with no data field
61
+ */
62
+ static ok(message?: string, statusCode?: number, requestId?: string): ApiResponse;
63
+ /**
64
+ * Build an error response
65
+ * @param message - Error message
66
+ * @param code - Error code for categorization
67
+ * @param statusCode - HTTP status code
68
+ * @param details - Additional error details
69
+ * @param requestId - Request tracking ID for correlation
70
+ * @returns ApiResponse with error information
71
+ */
72
+ static error(message: string, code: string, statusCode?: number, details?: string, requestId?: string): ApiResponse;
73
+ /**
74
+ * Build a paginated response
75
+ * @template T - Type of array items
76
+ * @param data - Array of items
77
+ * @param total - Total number of items available
78
+ * @param page - Current page number
79
+ * @param limit - Items per page
80
+ * @param message - Success message
81
+ * @param statusCode - HTTP status code
82
+ * @param requestId - Request tracking ID for correlation
83
+ * @returns PaginatedResponse with pagination metadata
84
+ */
85
+ static paginated<T = any>(data: T[], total: number, page: number, limit: number, message?: string, statusCode?: number, requestId?: string): PaginatedResponse<T>;
86
+ /**
87
+ * Build a cursor-based paginated response for infinite-scroll / "load more" patterns
88
+ * @template T - Type of array items
89
+ * @param data - Array of items for the current page
90
+ * @param total - Total number of items available
91
+ * @param nextCursor - Cursor string for the next page
92
+ * @param hasNextPage - Whether more items exist after this page
93
+ * @param limit - Items per page
94
+ * @param message - Success message
95
+ * @param statusCode - HTTP status code
96
+ * @param requestId - Request tracking ID for correlation
97
+ * @returns CursorPaginatedResponse with cursor metadata
98
+ */
99
+ static cursorPaginated<T = any>(data: T[], total: number, nextCursor: string | undefined, hasNextPage: boolean, limit: number, previousCursor?: string, hasPreviousPage?: boolean, message?: string, statusCode?: number, requestId?: string): CursorPaginatedResponse<T>;
100
+ /**
101
+ * Build a created (201) response
102
+ * @template T - Type of response data
103
+ * @param data - Created resource data
104
+ * @param message - Success message
105
+ * @param requestId - Request tracking ID for correlation
106
+ * @returns ApiResponse with 201 status code
107
+ */
108
+ static created<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
109
+ /**
110
+ * Build an accepted (202) response for async operations
111
+ * @template T - Type of response data
112
+ * @param data - Response data (optional)
113
+ * @param message - Success message
114
+ * @param requestId - Request tracking ID for correlation
115
+ * @returns ApiResponse with 202 status code
116
+ */
117
+ static accepted<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
118
+ /**
119
+ * Build a no content (204) response
120
+ * @param message - Success message
121
+ * @param requestId - Request tracking ID for correlation
122
+ * @returns ApiResponse with 204 status code
123
+ */
124
+ static noContent(message?: string, requestId?: string): ApiResponse;
125
+ /**
126
+ * Response for successful update operations
127
+ * @param data - Updated resource data
128
+ * @param message - Success message
129
+ * @param requestId - Request tracking ID
130
+ */
131
+ static updated<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
132
+ /**
133
+ * Response for successful delete operations
134
+ * @param message - Success message
135
+ * @param requestId - Request tracking ID
136
+ */
137
+ static deleted(message?: string, requestId?: string): ApiResponse;
138
+ /**
139
+ * Response for bulk operations (create, update, delete multiple)
140
+ * @param succeeded - Number of successful operations
141
+ * @param failed - Number of failed operations
142
+ * @param total - Total operations attempted
143
+ * @param requestId - Request tracking ID
144
+ */
145
+ static bulkOperation(succeeded: number, failed: number, total: number, requestId?: string): ApiResponse;
146
+ /**
147
+ * Response for partial success scenarios
148
+ * @param data - Partial data that was processed
149
+ * @param message - Message describing the partial success
150
+ * @param requestId - Request tracking ID
151
+ */
152
+ static partialSuccess<T = any>(data: T, message?: string, requestId?: string): ApiResponse<T>;
153
+ /**
154
+ * Response for redirect operations
155
+ * @param url - Redirect URL
156
+ * @param statusCode - HTTP status code (301, 302, 307, 308)
157
+ * @param message - Redirect message
158
+ * @param requestId - Request tracking ID
159
+ */
160
+ static redirect(url: string, statusCode?: number, message?: string, requestId?: string): ApiResponse;
161
+ /**
162
+ * Response for file download operations
163
+ * @param filename - Name of the file being downloaded
164
+ * @param size - File size in bytes
165
+ * @param mimeType - MIME type of the file
166
+ * @param requestId - Request tracking ID
167
+ */
168
+ static fileDownload(filename: string, size: number, mimeType: string, requestId?: string): ApiResponse;
169
+ /**
170
+ * Response for import/export operations
171
+ * @param processed - Number of records processed
172
+ * @param imported - Number of records imported
173
+ * @param skipped - Number of records skipped
174
+ * @param errors - Array of error messages
175
+ * @param requestId - Request tracking ID
176
+ */
177
+ static importExport(processed: number, imported: number, skipped: number, errors?: string[], requestId?: string): ApiResponse;
178
+ }
179
+
180
+ export { type ApiResponse as A, type CursorPaginatedResponse as C, type PaginatedResponse as P, ResponseBuilder as R };
@@ -0,0 +1,111 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" data-theme="light">
3
+ <head>
4
+ <script>(function(){var t=localStorage.getItem('LoginTheme');if(!t){t=window.matchMedia('(prefers-color-scheme:dark)').matches?'dark':'light'}document.documentElement.setAttribute('data-theme',t);var l=localStorage.getItem('MykoLang');if(l==='ur'||l==='ar')document.documentElement.setAttribute('dir','rtl')})()</script>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
7
+ <title>{{title}} — MYKO</title>
8
+ <link rel="preload" href="/public/fonts/montserrat.css" as="style">
9
+ <link href="/public/fonts/montserrat.css" rel="stylesheet">
10
+ <link rel="icon" type="image/x-icon" href="/public/icons/favicon.ico">
11
+ <link rel="icon" type="image/png" sizes="32x32" href="/public/icons/favicon-32x32.png">
12
+ <link rel="icon" type="image/png" sizes="16x16" href="/public/icons/favicon-16x16.png">
13
+ <link rel="apple-touch-icon" sizes="180x180" href="/public/icons/apple-touch-icon.png">
14
+ <link rel="icon" type="image/png" sizes="192x192" href="/public/icons/android-chrome-192x192.png">
15
+ <link rel="icon" type="image/png" sizes="512x512" href="/public/icons/android-chrome-512x512.png">
16
+ <style>
17
+ *,*::before,*::after{margin:0;padding:0;box-sizing:border-box}
18
+ html,body{height:100%}
19
+ body{
20
+ font-family:'Montserrat',-apple-system,sans-serif;
21
+ background:var(--r-bg);
22
+ color:var(--r-text);
23
+ transition:background .3s,color .3s;
24
+ }
25
+ html{--r-bg:#f5f5f7;--r-card-bg:#fafafa;--r-text:#1c1c1e;--r-text-secondary:#6e6e73;--r-text-muted:#8e8e93;--r-border:#e5e5ea;--r-bg-secondary:#f5f5f5;--r-hover-bg:rgba(0,0,0,.04);--r-link:#007aff}
26
+ html[data-theme=dark]{--r-bg:#121214;--r-card-bg:#1c1c1e;--r-text:#f0f0f2;--r-text-secondary:#8e8e93;--r-text-muted:#636366;--r-border:#38383a;--r-bg-secondary:#2c2c2e;--r-hover-bg:rgba(255,255,255,.06);--r-link:#0a84ff}
27
+ .split{display:flex;flex-direction:column;height:100vh}
28
+ .page-header{position:absolute;top:0;left:0;right:0;padding:24px 40px;z-index:10}
29
+ .page-header-top{display:flex;align-items:center;justify-content:space-between}
30
+ .page-header-logo{display:flex;align-items:center;gap:12px}
31
+ .page-header-icon{width:52px;height:52px;border-radius:12px;object-fit:cover}
32
+ .page-header-name{font-size:22px;font-weight:700;color:var(--r-text);letter-spacing:-.5px}
33
+ .page-header-end{display:flex;flex-direction:column;align-items:flex-end;gap:2px}
34
+ .page-header-domain{font-size:12px;font-weight:500;color:var(--r-text-muted)}
35
+ .page-header-credit{font-size:9px;font-weight:500;color:var(--r-text-muted);letter-spacing:.5px;text-transform:uppercase;opacity:.6}
36
+ .right-panel{
37
+ flex:1;
38
+ background:var(--r-bg);
39
+ display:flex;flex-direction:column;align-items:center;justify-content:center;
40
+ position:relative;
41
+ padding:100px 24px 80px;
42
+ }
43
+ .error-content{text-align:center;max-width:520px}
44
+ .error-code{font-size:120px;font-weight:800;color:#ff5018;line-height:1;margin-bottom:4px;letter-spacing:-4px}
45
+ .error-title{font-size:28px;font-weight:700;margin-bottom:16px}
46
+ .error-description{font-size:15px;color:var(--r-text-secondary);line-height:1.6;margin-bottom:20px}
47
+ .error-tag{
48
+ display:inline-block;
49
+ padding:5px 14px;
50
+ border-radius:20px;
51
+ background:var(--r-bg-secondary);
52
+ font-size:11px;font-weight:600;color:var(--r-text-muted);
53
+ letter-spacing:.3px;
54
+ text-transform:uppercase;
55
+ }
56
+ .right-footer{
57
+ position:absolute;bottom:24px;left:40px;right:40px;
58
+ display:flex;align-items:center;justify-content:space-between;
59
+ }
60
+ .footer-links{display:flex;align-items:center;gap:6px}
61
+ .footer-links a{font-size:11px;color:var(--r-text-muted);text-decoration:none;transition:color .2s}
62
+ .footer-links a:hover{color:var(--r-text)}
63
+ .footer-dot{font-size:10px;color:var(--r-border)}
64
+ .right-footer-end{display:flex;align-items:center;gap:8px}
65
+
66
+ @media(max-width:768px){
67
+ .right-panel{padding:80px 20px 100px;justify-content:flex-start}
68
+ .page-header{padding:16px 20px}
69
+ .error-code{font-size:88px;letter-spacing:-3px}
70
+ .error-title{font-size:22px}
71
+ .error-description{font-size:14px}
72
+ .right-footer{position:static;margin-top:auto;padding:16px 20px 24px;flex-wrap:wrap;gap:8px}
73
+ }
74
+ </style>
75
+ </head>
76
+ <body>
77
+ <div class="split">
78
+ <div class="page-header">
79
+ <div class="page-header-top">
80
+ <div class="page-header-logo">
81
+ <img src="https://cdn.myko.pk/appassets/appstore.png" alt="MYKO" class="page-header-icon" loading="lazy">
82
+ <span class="page-header-name">MYKO</span>
83
+ </div>
84
+ <div class="page-header-end">
85
+ <span class="page-header-domain">myko.pk</span>
86
+ <span class="page-header-credit">Powered by EO</span>
87
+ </div>
88
+ </div>
89
+ </div>
90
+ <div class="right-panel">
91
+ <div class="error-content">
92
+ <div class="error-code">{{statusCode}}</div>
93
+ <div class="error-title">{{title}}</div>
94
+ <div class="error-description">{{description}}</div>
95
+ {{#if errorCode}}
96
+ <div class="error-tag">{{errorCode}}</div>
97
+ {{/if}}
98
+ </div>
99
+ <div class="right-footer">
100
+ <div class="footer-links">
101
+ <a href="#">Privacy Policy</a>
102
+ <span class="footer-dot">·</span>
103
+ <a href="#">Terms of Service</a>
104
+ <span class="footer-dot">·</span>
105
+ <a href="#">Help</a>
106
+ </div>
107
+ </div>
108
+ </div>
109
+ </div>
110
+ </body>
111
+ </html>