{"_id":"@agent-os/shared","_rev":"3-b8561ee0fa15cf1b18dcda85bd1026d8","name":"@agent-os/shared","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@agent-os/shared","version":"1.0.0","keywords":["agentos","shared","types"],"author":{"name":"AgentOS Team"},"license":"ISC","_id":"@agent-os/shared@1.0.0","maintainers":[{"name":"richardhendrix","email":"haraldluckow@gmail.com"}],"homepage":"https://github.com/your-org/agentos#readme","bugs":{"url":"https://github.com/your-org/agentos/issues"},"dist":{"shasum":"36978b2b6be7a09ea3562ef2c4d9b42459539a06","tarball":"https://registry.npmjs.org/@agent-os/shared/-/shared-1.0.0.tgz","fileCount":30,"integrity":"sha512-GKuduANu4atjSC90z+nrMTpAJgbrT294M7I05eLPRHSF1chhhFvW2UXNEfe7+FNeHaICoBADXhqFdViZebWHgw==","signatures":[{"sig":"MEYCIQDsjwKOxkuqxSdM78xbY1E2hcN1BQ2qEMXsSv3lcyhXZQIhAKFZ+4cVbQ4cT7VN/ubIhUu/qP1PgNwfQ+euVjrLDY6u","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24177},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"ab529cd503b1e88d23a287f8b518a8951827b39c","scripts":{"build":"tsc","watch":"tsc -w","prepublishOnly":"yarn build"},"_npmUser":{"name":"richardhendrix","actor":{"name":"richardhendrix","type":"user","email":"haraldluckow@gmail.com"},"email":"haraldluckow@gmail.com"},"repository":{"url":"git+https://github.com/your-org/agentos.git","type":"git","directory":"packages/shared"},"_npmVersion":"10.2.4","description":"Shared types and utilities for AgentOS platform","directories":{},"_nodeVersion":"18.19.1","dependencies":{},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.8.3","@types/node":"^20.11.24"},"_npmOperationalInternal":{"tmp":"tmp/shared_1.0.0_1750868019158_0.6938540122832566","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@agent-os/shared","version":"1.0.2","_id":"@agent-os/shared@1.0.2","maintainers":[{"name":"richardhendrix","email":"haraldluckow@gmail.com"}],"dist":{"shasum":"59ba0ddcc75ef0197015172569dc581bfa81a318","tarball":"https://registry.npmjs.org/@agent-os/shared/-/shared-1.0.2.tgz","fileCount":36,"integrity":"sha512-v4PvZezCobIs/hgNtHrNhBMQl6nvXx8rtjzJ2+XsHcARxrcNvCFt1UDch9CHPVex7UV9+D3Zs8wXzuZRtspinw==","signatures":[{"sig":"MEUCICr/MaRr+HLztc+/0bgvQckrQrpBYXRlpIwfD/WKtl8GAiEAsTM4y/rHxebqNQXXCVwZS1YjBxF6Z0dOVR+1O6J0gLU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38023},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"a543ff540427ddd11a73d024d8fcd192ad2e7404","private":false,"scripts":{"build":"tsc","watch":"tsc -w"},"_npmUser":{"name":"richardhendrix","actor":{"name":"richardhendrix","type":"user","email":"haraldluckow@gmail.com"},"email":"haraldluckow@gmail.com"},"_npmVersion":"10.7.0","description":"TypeScript types and utilities shared between the mobile app and backend API, ensuring type safety across the entire monorepo.","directories":{},"_nodeVersion":"18.20.4","dependencies":{"typescript":"^5.8.3","@types/node":"^20.11.24"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/shared_1.0.2_1750944448082_0.215951254481205","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@agent-os/shared","version":"1.0.3","private":false,"type":"module","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","watch":"tsc -w"},"dependencies":{"@types/node":"^20.11.24","typescript":"^5.8.3"},"_id":"@agent-os/shared@1.0.3","gitHead":"e1ebae0aefa5330096abd4623fa3770d82cb83b4","description":"TypeScript types and utilities shared between the mobile app and backend API, ensuring type safety across the entire monorepo.","_nodeVersion":"18.20.4","_npmVersion":"10.7.0","dist":{"integrity":"sha512-H/RK0eRVq/1kEKPLAPzrg2c0if6LNVLaVN3ZkGO3OXPvmmXCm7VwZVZZxA6oaFdNm9acxaqNQDLiPawQO65m+Q==","shasum":"7cdd6103bcd00fadf3fd19b37698b2ab80e78844","tarball":"https://registry.npmjs.org/@agent-os/shared/-/shared-1.0.3.tgz","fileCount":39,"unpackedSize":42857,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDpyL7c+y1fJv9yIyI2aHYUdRHQRu3r+uWA/GgG2DQ0DwIgGZ07dgOXIkINts0VSeYcLIvPUefgkY1qIS49DMLs/Pg="}]},"_npmUser":{"name":"richardhendrix","email":"haraldluckow@gmail.com"},"directories":{},"maintainers":[{"name":"richardhendrix","email":"haraldluckow@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/shared_1.0.3_1752270934054_0.11450407715961242"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-25T16:13:39.048Z","modified":"2025-07-11T21:55:34.469Z","1.0.0":"2025-06-25T16:13:39.353Z","1.0.2":"2025-06-26T13:27:28.238Z","1.0.3":"2025-07-11T21:55:34.252Z"},"description":"TypeScript types and utilities shared between the mobile app and backend API, ensuring type safety across the entire monorepo.","maintainers":[{"name":"richardhendrix","email":"haraldluckow@gmail.com"}],"readme":"# AgentOS Shared Package\n\nTypeScript types and utilities shared between the mobile app and backend API, ensuring type safety across the entire monorepo.\n\n## 📦 Overview\n\nThe `@agentos/shared` package serves as the single source of truth for all TypeScript types, interfaces, enums, and shared utilities used across the AgentOS platform. This ensures consistency between the React Native mobile app and Express.js backend.\n\n## 🏗️ Structure\n\n```\nsrc/\n├── types/                  # TypeScript type definitions\n│   ├── auth.ts            # Authentication types\n│   ├── user.ts            # User and profile types\n│   ├── agency.ts          # Agency and member types\n│   ├── customer.ts        # Customer and contact types\n│   ├── job.ts             # Job-related types\n│   ├── booking.ts         # Booking and status types\n│   ├── expense.ts         # Expense tracking types\n│   ├── timeEntry.ts       # Time tracking types\n│   ├── calendar.ts        # Calendar and availability types\n│   └── common.ts          # Shared utility types\n├── enums/                 # Shared enumerations\n│   ├── roles.ts           # User role enums\n│   ├── status.ts          # Various status enums\n│   └── permissions.ts     # Permission enums\n├── utils/                 # Shared utility functions\n│   └── calendarUtils.ts   # Calendar helper functions\n└── index.ts              # Main export file\n```\n\n## 🔧 Installation\n\nThe shared package is automatically available in the monorepo workspace:\n\n```json\n// In backend/package.json or mobile/package.json\n{\n  \"dependencies\": {\n    \"@agentos/shared\": \"*\"\n  }\n}\n```\n\n## 📝 Type Definitions\n\n### Core Domain Types\n\n#### User Types\n\n```typescript\nexport interface User {\n  id: string;\n  email: string;\n  firstName: string;\n  lastName: string;\n  phone?: string;\n  profileImageUrl?: string;\n  isEmailVerified: boolean;\n  createdAt: Date;\n  updatedAt: Date;\n}\n\nexport interface UserProfile extends User {\n  bankAccounts: BankAccount[];\n  agencyMemberships: AgencyMember[];\n  unavailableDates: UnavailableDate[];\n}\n```\n\n#### Agency Types\n\n```typescript\nexport interface Agency {\n  id: string;\n  name: string;\n  description?: string;\n  logoUrl?: string;\n  createdAt: Date;\n  updatedAt: Date;\n}\n\nexport interface AgencyMember {\n  id: string;\n  userId: string;\n  agencyId: string;\n  role: AgencyRole;\n  privileges: string[];\n  user?: User;\n  agency?: Agency;\n  talentCategories: TalentCategory[];\n}\n\nexport enum AgencyRole {\n  OWNER = 'OWNER',\n  AGENT = 'AGENT',\n  ARTIST = 'ARTIST',\n}\n```\n\n#### Job & Booking Types\n\n```typescript\nexport interface Job {\n  id: string;\n  title: string;\n  description?: string;\n  customerId: string;\n  customerContactId?: string;\n  agencyId: string;\n  startDate: Date;\n  endDate: Date;\n  status: JobStatus;\n  notes?: string;\n  customer?: Customer;\n  bookings?: Booking[];\n}\n\nexport enum JobStatus {\n  DRAFT = 'DRAFT',\n  PUBLISHED = 'PUBLISHED',\n  FILLED = 'FILLED',\n  COMPLETED = 'COMPLETED',\n  CANCELLED = 'CANCELLED',\n}\n\nexport interface Booking {\n  id: string;\n  jobId: string;\n  agencyMemberId: string;\n  talentCategoryId?: string;\n  status: BookingStatus;\n  notes?: string;\n  dates: BookingDate[];\n  agencyMember?: AgencyMember;\n  job?: Job;\n}\n\nexport enum BookingStatus {\n  INVITED = 'INVITED',\n  CONFIRMED = 'CONFIRMED',\n  COMPLETED = 'COMPLETED',\n  CANCELLED = 'CANCELLED',\n}\n```\n\n#### Customer Types\n\n```typescript\nexport interface Customer {\n  id: string;\n  name: string;\n  email?: string;\n  phone?: string;\n  address?: string;\n  notes?: string;\n  agencyId: string;\n  contacts: CustomerContact[];\n}\n\nexport interface CustomerContact {\n  id: string;\n  customerId: string;\n  firstName: string;\n  lastName: string;\n  email?: string;\n  phone?: string;\n  position?: string;\n  isPrimary: boolean;\n}\n```\n\n#### Expense Types\n\n```typescript\nexport interface Expense {\n  id: string;\n  expenseAccountId: string;\n  agencyMemberId: string;\n  bookingId?: string;\n  amount: number;\n  description: string;\n  date: Date;\n  receiptUrl?: string;\n  status: ExpenseStatus;\n  approvedBy?: string;\n  approvedAt?: Date;\n}\n\nexport enum ExpenseStatus {\n  PENDING = 'PENDING',\n  APPROVED = 'APPROVED',\n  REJECTED = 'REJECTED',\n}\n\nexport interface ExpenseAccount {\n  id: string;\n  name: string;\n  description?: string;\n  agencyId: string;\n  isActive: boolean;\n}\n```\n\n#### Time Entry Types\n\n```typescript\nexport interface TimeEntry {\n  id: string;\n  bookingId: string;\n  agencyMemberId: string;\n  date: Date;\n  hours: number;\n  description?: string;\n  status: TimeEntryStatus;\n}\n\nexport enum TimeEntryStatus {\n  DRAFT = 'DRAFT',\n  SUBMITTED = 'SUBMITTED',\n  APPROVED = 'APPROVED',\n  REJECTED = 'REJECTED',\n}\n```\n\n### API Types\n\n#### Request/Response Types\n\n```typescript\nexport interface LoginRequest {\n  email: string;\n  password: string;\n}\n\nexport interface LoginResponse {\n  user: User;\n  token: string;\n  refreshToken: string;\n}\n\nexport interface CreateJobRequest {\n  title?: string; // Optional - can be empty\n  description?: string;\n  customerId: string;\n  customerContactId?: string;\n  startDate: string;\n  endDate: string;\n  status: JobStatus;\n  notes?: string;\n}\n\nexport interface PaginatedResponse<T> {\n  data: T[];\n  total: number;\n  page: number;\n  pageSize: number;\n  totalPages: number;\n}\n```\n\n### Utility Types\n\n```typescript\n// Common utility types\nexport type ID = string;\n\nexport interface Timestamped {\n  createdAt: Date;\n  updatedAt: Date;\n}\n\nexport interface SoftDeletable {\n  deletedAt?: Date | null;\n}\n\n// Generic API error\nexport interface ApiError {\n  message: string;\n  code?: string;\n  field?: string;\n}\n```\n\n## 🛠️ Utilities\n\n### Calendar Utilities\n\n```typescript\n// Calendar helper functions\nexport function getWeekDates(date: Date): Date[];\nexport function formatDateRange(start: Date, end: Date): string;\nexport function isDateAvailable(date: Date, unavailableDates: UnavailableDate[]): boolean;\nexport function getMonthBookings(month: Date, bookings: Booking[]): BookingDate[];\n```\n\n## 📋 Usage Examples\n\n### Backend Usage\n\n```typescript\nimport { User, CreateJobRequest, JobStatus } from '@agentos/shared';\n\n// In controller\nexport const createJob = async (req: Request<{}, {}, CreateJobRequest>, res: Response) => {\n  const jobData: CreateJobRequest = req.body;\n  // Type-safe job creation\n};\n```\n\n### Mobile App Usage\n\n```typescript\nimport { Job, BookingStatus, useGetJobsQuery } from '@agentos/shared';\n\n// In component\nconst JobCard: React.FC<{ job: Job }> = ({ job }) => {\n  // Type-safe job rendering\n};\n\n// With RTK Query\nconst { data: jobs } = useGetJobsQuery<Job[]>();\n```\n\n### Type Guards\n\n```typescript\n// Check user role\nexport function isAgencyOwner(member: AgencyMember): boolean {\n  return member.role === AgencyRole.OWNER;\n}\n\n// Check booking status\nexport function isBookingActive(booking: Booking): boolean {\n  return booking.status === BookingStatus.CONFIRMED;\n}\n```\n\n## 🔄 Development Workflow\n\n### Adding New Types\n\n1. Create type definition in appropriate file:\n\n```typescript\n// In src/types/invoice.ts\nexport interface Invoice {\n  id: string;\n  agencyId: string;\n  customerId: string;\n  amount: number;\n  // ... other fields\n}\n```\n\n2. Export from index:\n\n```typescript\n// In src/index.ts\nexport * from './types/invoice';\n```\n\n3. Build the package:\n\n```bash\ncd packages/shared\nnpm run build\n```\n\n4. Use in consuming packages:\n\n```typescript\nimport { Invoice } from '@agentos/shared';\n```\n\n### Updating Types\n\nWhen updating types:\n\n1. Make changes in shared package\n2. Run `npm run build` in shared package\n3. TypeScript will automatically pick up changes in consuming packages\n\n## 🧪 Type Testing\n\nEnsure types are correctly defined:\n\n```typescript\n// Type tests\nimport { User, Agency } from '@agentos/shared';\n\n// This should compile\nconst user: User = {\n  id: '123',\n  email: 'test@example.com',\n  firstName: 'John',\n  lastName: 'Doe',\n  isEmailVerified: true,\n  createdAt: new Date(),\n  updatedAt: new Date(),\n};\n\n// This should fail TypeScript compilation\nconst invalidUser: User = {\n  id: '123',\n  // Missing required fields\n};\n```\n\n## 📦 Build Configuration\n\nThe package uses TypeScript compiler directly:\n\n```json\n{\n  \"scripts\": {\n    \"build\": \"tsc\",\n    \"watch\": \"tsc --watch\",\n    \"clean\": \"rm -rf dist\"\n  }\n}\n```\n\nTypeScript configuration:\n\n```json\n{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"module\": \"NodeNext\",\n    \"declaration\": true,\n    \"outDir\": \"./dist\",\n    \"strict\": true,\n    \"esModuleInterop\": true\n  }\n}\n```\n\n## 🔍 Best Practices\n\n1. **Keep Types Focused**: Each type file should contain related types\n2. **Use Enums**: For fixed sets of values (statuses, roles, etc.)\n3. **Document Complex Types**: Add JSDoc comments for clarity\n4. **Avoid Circular Dependencies**: Structure imports carefully\n5. **Version Carefully**: Breaking changes affect all consumers\n6. **Test Type Changes**: Ensure changes don't break consumers\n\n## 🚀 Future Enhancements\n\n- [ ] Add validation schemas (Zod) that match types\n- [ ] Generate types from Prisma schema automatically\n- [ ] Add more utility functions for common operations\n- [ ] Create type guards for runtime type checking\n- [ ] Add OpenAPI schema generation\n\n## 📄 License\n\nThis package is part of the AgentOS platform. All rights reserved.\n\n---\n\nKeeping frontend and backend in perfect sync with TypeScript! 🔗\n","readmeFilename":"README.md"}