@tjoc/types
v4.9.0
Published
Shared TypeScript types for TJOC platform
Downloads
1,438
Maintainers
Readme
@tjoc/types
Shared TypeScript types for the tjoc.dev portfolio. Zero runtime dependencies — pure types and enums, dual CJS/ESM.
Installation
pnpm add @tjoc/typesNode ≥18. Published to npm.
Quick start
import { User, UserRole, Status, PaginatedResponse, ApiResponse, ErrorCode } from '@tjoc/types';
const user: User = {
id: 'usr_123',
email: '[email protected]',
firstName: 'Joe',
lastName: 'Smith',
role: UserRole.USER,
status: Status.ACTIVE,
emailVerified: true,
createdAt: new Date(),
updatedAt: new Date(),
};Date convention
All timestamp fields are TypeScript Date objects (createdAt, updatedAt, deletedAt, processedAt, etc.). Serialization to ISO string and parsing back to Date is a runtime concern — do it at your API boundary, not in shared types.
Module exports
common
| Export | Description |
|---|---|
| Status | Entity status: ACTIVE \| INACTIVE \| PENDING \| SUSPENDED \| DELETED |
| Environment | development \| staging \| production |
| PaginationParams | { page, limit } |
| PaginatedResponse<T> | { items, total, page, limit, hasMore, totalPages } |
| ApiResponse<T> | { success, data?, error? } |
| ErrorResponse | { message, code, details? } |
| TimestampFields | { createdAt, updatedAt, deletedAt? } |
user
| Export | Description |
|---|---|
| UserRole | ADMIN \| USER |
| User | Core user entity |
| UserSettings | Theme, notification prefs, locale prefs |
| CreateUserPayload | Post-Cognito user record creation (no password — auth is Cognito's job) |
| UpdateUserPayload | Partial user update |
enums
| Enum | Values |
|---|---|
| TierType | FREE \| BASIC \| PRO \| ENTERPRISE |
| BillingCycle | monthly \| yearly \| lifetime |
| Currency | USD \| EUR \| GBP \| NGN \| CAD \| AUD |
| PaymentStatus | pending \| completed \| failed \| cancelled \| refunded \| processing |
| PaymentProvider | stripe \| paystack \| conchpay |
| TransactionType | subscription \| one_time \| upgrade \| refund |
| JobStatus | SAVED \| APPLIED \| INTERVIEW \| OFFER \| REJECTED \| WITHDRAWN |
| JobType | full_time \| part_time \| contract \| freelance \| internship \| temporary |
| WorkLocation | remote \| on_site \| hybrid |
| ExperienceLevel | entry \| junior \| mid \| senior \| lead \| executive |
| SkillLevel | beginner \| intermediate \| advanced \| expert |
| EducationLevel | high_school \| associate \| bachelor \| master \| doctorate \| certificate \| diploma |
| NotificationType | email \| push \| sms \| in_app |
| NotificationPriority | low \| medium \| high \| urgent |
| NotificationCategory | system \| account \| payment \| security \| marketing |
| FileType | PDF, DOCX, DOC, TXT, RTF MIME types |
| UploadStatus | pending \| uploading \| processing \| completed \| failed |
| ErrorCode | VALIDATION_ERROR, AUTHENTICATION_ERROR, NOT_FOUND, CONFLICT, etc. |
| LogLevel | debug \| info \| warn \| error \| fatal |
| Theme | light \| dark \| system |
| Language | en \| es \| fr \| de \| it \| pt \| zh \| ja \| ko \| ar |
| Timezone | UTC, EST, PST, GMT, CET, JST, AEST, WAT |
| LoadingState | idle \| loading \| success \| error |
| ComponentSize | xs \| sm \| md \| lg \| xl |
| ComponentVariant | default \| primary \| secondary \| success \| warning \| error \| info |
payments
Wallet, Transaction, WithdrawalRequest, SubscriptionPlan, PaymentMethod and their create/update/search payloads. TransactionStatus: PENDING \| COMPLETED \| FAILED \| CANCELLED \| PROCESSING.
api
HttpMethod, HttpStatus, ApiErrorCode, ApiError, RequestMetadata, WebSocketEvent, WebSocketPayloads, WebSocketEventPayload<T>.
firebaseToken
FirebaseToken, FirebaseTokenChannel (WEB \| MOBILE), create/update payloads. Used by @tjoc/notifications FCM integration.
v4.0.0 breaking changes
These were removed. If you were importing them, the replacement is noted.
| Removed | Replacement |
|---|---|
| UserRole.INSTRUCTOR | Products define their own extended roles |
| LoginPayload, RegisterPayload, AuthResponse, etc. | Use @tjoc/auth/cognito — Cognito handles auth |
| trivia.ts, achievements.ts, categoryPerformance.ts | Move to product repos |
| JobApplicationStatus, ResumeStatus | Move to product repos |
| FeatureType, UsageAction | Move to product repos |
| TriviaTransactionType | Move to product repos |
| ApiEndpoints, RouteConfig | Products own their route contracts |
| zod dependency | Removed — package is now zero-dependency |
| password, referralCode in CreateUserPayload | Cognito handles passwords; referral is product-specific |
Development
pnpm build # tsup → dist/
pnpm test # jest (21 tests)
pnpm typecheck # tsc --noEmit