@upmind-automation/types
v0.0.17
Published
Shared TypeScript type definitions, enums, and interfaces for the Upmind platform.
Downloads
291
Readme
@upmind-automation/types
Shared TypeScript type definitions, enums, and interfaces for the Upmind platform.
What Is This?
This package is the single source of truth for all TypeScript types used across the Upmind monorepo. It provides:
- Enums - Standardized constants for API values, statuses, and configuration options
- Models - TypeScript interfaces matching API response shapes
- Constants - Shared constant values used across packages
Installation
pnpm add @upmind-automation/typesUsage
// Import enums
import { AccessRoleTypes, PaymentStatus, ProductTypes } from "@upmind-automation/types";
// Use in type annotations
const role: AccessRoleTypes = AccessRoleTypes.CLIENT;
// Import model interfaces
import type { IClient, IProduct, IBasket } from "@upmind-automation/types";
function processClient(client: IClient) {
// ...
}Package Structure
src/
├── data/
│ ├── constants.ts # Shared constant values
│ ├── enums.ts # General enums
│ ├── iso4217.ts # Currency codes
│ └── enums/ # Domain-specific enums
│ ├── auth.ts
│ ├── brand.ts
│ ├── payments.ts
│ ├── products.ts
│ └── ...
├── models/ # TypeScript interfaces
│ ├── accounts.ts
│ ├── basket.ts
│ ├── client.ts
│ ├── product.ts
│ └── ...
└── store/ # Store-related typesKey Exports
Enums
| Category | Examples |
|----------|----------|
| Auth | AccessRoleTypes, OAuthGrantTypes, TwoFactorTypes |
| Payments | PaymentStatus, PaymentMethodTypes, GatewayTypes |
| Products | ProductTypes, BillingCycleTypes, PricingTypes |
| Brand | BrandConfigKeys, ThemeTypes, LayoutTypes |
| Clients | ClientStatus, AddressTypes, PhoneTypes |
Models
| Category | Examples |
|----------|----------|
| Core | IClient, IBasket, IProduct, IToken |
| Billing | IInvoice, IPayment, IPaymentMethod |
| Config | IBrand, ISystemSettings, ITheme |
Best Practices
Always use enums, not string literals
// ✅ Correct
if (user.role === AccessRoleTypes.STAFF) { ... }
// ❌ Wrong - brittle, no type safety
if (user.role === "staff") { ... }Import types with import type
// ✅ Correct - tree-shakes properly
import type { IClient } from "@upmind-automation/types";
import { AccessRoleTypes } from "@upmind-automation/types";
// ❌ Wrong - mixes values and types
import { IClient, AccessRoleTypes } from "@upmind-automation/types";Related Packages
| Package | Relationship |
|---------|--------------|
| @upmind-automation/headless | Consumes types for composables and services |
| @upmind-automation/client-vue | Re-exports types for Vue consumers |
| @upmind-automation/upmind-ui | Uses types for component props |
