diff --git a/src/file-extension/database/index.ts b/src/file-extension/database/index.ts new file mode 100644 index 0000000..4dd2d77 --- /dev/null +++ b/src/file-extension/database/index.ts @@ -0,0 +1,7 @@ +export * from "./connection.ts"; + +export class DatabaseIndex { + static getAllConnections() { + return ["Connection"]; + } +} \ No newline at end of file diff --git a/src/file-extension/spec/another/very/deep/nested/path/file.ts b/src/file-extension/spec/another/very/deep/nested/path/file.ts index f7cce0d..8c4f14a 100644 --- a/src/file-extension/spec/another/very/deep/nested/path/file.ts +++ b/src/file-extension/spec/another/very/deep/nested/path/file.ts @@ -7,4 +7,6 @@ export class AnotherDeepClass { static getInfo(): AnotherDeepType { return { name: "another", description: "deep nested file" }; } -} \ No newline at end of file +} + +export const AnotherDeep = AnotherDeepClass; \ No newline at end of file diff --git a/src/file-extension/spec/config/app.ts b/src/file-extension/spec/config/app.ts index 9cd39e8..1c2cd99 100644 --- a/src/file-extension/spec/config/app.ts +++ b/src/file-extension/spec/config/app.ts @@ -18,4 +18,6 @@ export const Config: AppConfig = { port: 5432, name: "test_db", }, -}; \ No newline at end of file +}; + +export type ConfigType = typeof Config; \ No newline at end of file diff --git a/src/file-extension/spec/config/database/connection.ts b/src/file-extension/spec/config/database/connection.ts new file mode 100644 index 0000000..fbbf5c3 --- /dev/null +++ b/src/file-extension/spec/config/database/connection.ts @@ -0,0 +1,19 @@ +export interface DatabaseConfig { + host: string; + port: number; + database: string; + username: string; + password: string; +} + +export class Connection { + constructor(private config: DatabaseConfig) {} + + async connect(): Promise { + console.log("Database connected"); + } + + async disconnect(): Promise { + console.log("Database disconnected"); + } +} \ No newline at end of file diff --git a/src/file-extension/spec/models/user.ts b/src/file-extension/spec/models/user.ts index b256be5..4520803 100644 --- a/src/file-extension/spec/models/user.ts +++ b/src/file-extension/spec/models/user.ts @@ -2,10 +2,13 @@ export interface User { id: string; name: string; email: string; + findById(id: string): Promise; } export class UserService { async findById(id: string): Promise { return { id, name: "Test User", email: "test@example.com" }; } -} \ No newline at end of file +} + +export const User = UserService; \ No newline at end of file diff --git a/src/file-extension/spec/services/auth.ts b/src/file-extension/spec/services/auth.ts new file mode 100644 index 0000000..70a002e --- /dev/null +++ b/src/file-extension/spec/services/auth.ts @@ -0,0 +1,16 @@ +export interface AuthSettings { + secret: string; + expiresIn: string; +} + +export class AuthService { + constructor(private settings: AuthSettings) {} + + async authenticate(token: string): Promise { + return token === "valid-token"; + } + + async generateToken(userId: string): Promise { + return `token-${userId}`; + } +} \ No newline at end of file diff --git a/src/file-extension/spec/services/auth/auth-service.ts b/src/file-extension/spec/services/auth/auth-service.ts new file mode 100644 index 0000000..7184d3e --- /dev/null +++ b/src/file-extension/spec/services/auth/auth-service.ts @@ -0,0 +1,16 @@ +export interface AuthServiceConfig { + tokenExpiry: string; + refreshExpiry: string; +} + +export class AuthService { + constructor(private config: AuthServiceConfig) {} + + async validateUser(credentials: any): Promise { + return true; + } + + async createToken(userId: string): Promise { + return `auth-token-${userId}`; + } +} \ No newline at end of file diff --git a/src/file-extension/spec/types/index.ts b/src/file-extension/spec/types/index.ts new file mode 100644 index 0000000..4fcddae --- /dev/null +++ b/src/file-extension/spec/types/index.ts @@ -0,0 +1,7 @@ +export * from "./user.ts"; + +export class TypesIndex { + static getAllTypes() { + return ["UserProfile", "UserRole", "UserPermissions"]; + } +} \ No newline at end of file diff --git a/src/file-extension/spec/types/user/user-types.ts b/src/file-extension/spec/types/user/user-types.ts new file mode 100644 index 0000000..cb35d8d --- /dev/null +++ b/src/file-extension/spec/types/user/user-types.ts @@ -0,0 +1,18 @@ +export type UserStatus = "active" | "inactive" | "pending"; + +export interface UserMetadata { + lastLogin: Date; + loginCount: number; + preferences: Record; +} + +export interface UserTypes { + status: UserStatus; + metadata: UserMetadata; +} + +export class UserTypeHelper { + static isActiveUser(status: UserStatus): boolean { + return status === "active"; + } +} \ No newline at end of file diff --git a/src/file-extension/spec/utils/helpers/string-utils.ts b/src/file-extension/spec/utils/helpers/string-utils.ts new file mode 100644 index 0000000..274bfcc --- /dev/null +++ b/src/file-extension/spec/utils/helpers/string-utils.ts @@ -0,0 +1,25 @@ +export interface StringHelperOptions { + trim: boolean; + lowercase: boolean; + removeSpecialChars: boolean; +} + +export class StringUtils { + static format(input: string, options: Partial = {}): string { + let result = input; + + if (options.trim) { + result = result.trim(); + } + + if (options.lowercase) { + result = result.toLowerCase(); + } + + return result; + } + + static validate(input: string): boolean { + return input.length > 0; + } +} \ No newline at end of file diff --git a/src/file-extension/spec/utils/logger/logger.ts b/src/file-extension/spec/utils/logger/logger.ts new file mode 100644 index 0000000..f930854 --- /dev/null +++ b/src/file-extension/spec/utils/logger/logger.ts @@ -0,0 +1,16 @@ +export interface LoggerConfig { + level: "debug" | "info" | "warn" | "error"; + output: "console" | "file"; +} + +export class Logger { + constructor(private config: LoggerConfig) {} + + info(message: string, meta?: any): void { + console.log(`[INFO] ${message}`, meta || ""); + } + + error(message: string, meta?: any): void { + console.error(`[ERROR] ${message}`, meta || ""); + } +} \ No newline at end of file diff --git a/src/file-extension/spec/very/deep/nested/path/file.ts b/src/file-extension/spec/very/deep/nested/path/file.ts index a938d37..7aecf87 100644 --- a/src/file-extension/spec/very/deep/nested/path/file.ts +++ b/src/file-extension/spec/very/deep/nested/path/file.ts @@ -7,4 +7,6 @@ export class DeepNestedClass { static getData(): DeepNestedType { return { id: "deep", value: "nested" }; } -} \ No newline at end of file +} + +export const DeepNested = DeepNestedClass; \ No newline at end of file diff --git a/src/file-extension/spec/yet/another/very/deep/nested/path/file.ts b/src/file-extension/spec/yet/another/very/deep/nested/path/file.ts index 7b9c27a..2d860ed 100644 --- a/src/file-extension/spec/yet/another/very/deep/nested/path/file.ts +++ b/src/file-extension/spec/yet/another/very/deep/nested/path/file.ts @@ -7,4 +7,6 @@ export class YetAnotherDeepClass { static process(): YetAnotherDeepType { return { key: "yet-another", metadata: { depth: "very deep" } }; } -} \ No newline at end of file +} + +export const YetAnother = YetAnotherDeepClass; \ No newline at end of file diff --git a/src/services/index.ts b/src/services/index.ts new file mode 100644 index 0000000..d15b9c4 --- /dev/null +++ b/src/services/index.ts @@ -0,0 +1,7 @@ +export * from "./auth.ts"; + +export class ServicesIndex { + static getAllServices() { + return ["AuthService"]; + } +} \ No newline at end of file