Initial commit: add .gitignore and README

This commit is contained in:
defiQUG
2026-02-09 21:51:55 -08:00
commit d904c04c2d
52 changed files with 1613 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
{
"name": "@workspace/shared-types",
"version": "1.0.0",
"description": "Common TypeScript types and interfaces",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"test": "vitest",
"lint": "eslint src",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist"
},
"devDependencies": {
"typescript": "^5.5.4",
"vitest": "^1.2.0"
},
"files": [
"dist"
],
"publishConfig": {
"access": "restricted"
}
}

View File

@@ -0,0 +1,29 @@
/**
* API-related types
*/
export interface PaginationParams {
page: number;
limit: number;
offset?: number;
}
export interface PaginatedResponse<T> {
data: T[];
pagination: {
page: number;
limit: number;
total: number;
totalPages: number;
};
}
export interface SortParams {
field: string;
order: 'asc' | 'desc';
}
export interface FilterParams {
[key: string]: unknown;
}

View File

@@ -0,0 +1,33 @@
/**
* Configuration-related types
*/
export interface DatabaseConfig {
host: string;
port: number;
database: string;
username: string;
password: string;
ssl?: boolean;
pool?: {
min?: number;
max?: number;
};
}
export interface ServerConfig {
port: number;
host: string;
env: 'development' | 'staging' | 'production';
cors?: {
origin: string | string[];
credentials?: boolean;
};
}
export interface LoggingConfig {
level: 'debug' | 'info' | 'warn' | 'error';
format: 'json' | 'text';
destination?: string;
}

View File

@@ -0,0 +1,20 @@
/**
* Database-related types
*/
export interface BaseEntity {
id: string;
createdAt: Date;
updatedAt: Date;
deletedAt?: Date | null;
}
export interface SoftDeletable {
deletedAt: Date | null;
}
export interface Timestamped {
createdAt: Date;
updatedAt: Date;
}

View File

@@ -0,0 +1,54 @@
/**
* @workspace/shared-types
* Common TypeScript types and interfaces
*/
// API Response Types
export interface ApiResponse<T> {
data: T;
status: number;
message?: string;
}
export interface ApiError {
code: string;
message: string;
details?: unknown;
}
// Database Types
export interface BaseEntity {
id: string;
createdAt: Date;
updatedAt: Date;
}
// Configuration Types
export interface DatabaseConfig {
host: string;
port: number;
database: string;
username: string;
password: string;
}
export interface ServerConfig {
port: number;
host: string;
env: 'development' | 'staging' | 'production';
}
// Common Utility Types
export type Nullable<T> = T | null;
export type Optional<T> = T | undefined;
export type Maybe<T> = T | null | undefined;
// Status Types
export type Status = 'active' | 'inactive' | 'pending' | 'archived';
export type Priority = 'low' | 'medium' | 'high' | 'critical';
// Export all types
export * from './api';
export * from './database';
export * from './config';

View File

@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"lib": ["ES2022"],
"declaration": true,
"declarationMap": true,
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts"]
}