{"_id":"@bamtak/farmpro-api-contracts","name":"@bamtak/farmpro-api-contracts","dist-tags":{"latest":"1.0.8"},"versions":{"1.0.8":{"name":"@bamtak/farmpro-api-contracts","version":"1.0.8","description":"Type-safe API contracts for FarmPro agricultural platform","main":"dist/index.js","module":"dist/index.mjs","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./schemas":{"import":"./dist/schemas.mjs","require":"./dist/schemas.js"},"./contracts":{"import":"./dist/contracts.mjs","require":"./dist/contracts.js"}},"scripts":{"build":"tsup","build:watch":"tsup --watch","clean":"rm -rf dist","prepublishOnly":"npm run clean && npm run build","type-check":"tsc --noEmit","type-check:strict":"tsc --noEmit --strict","lint":"eslint . --ext .ts","lint:fix":"eslint . --ext .ts --fix","test:types":"tsd","test:runtime":"tsx examples/type-safety-tests.ts","validate":"npm run type-check","prepack":"npm run validate"},"keywords":["api","contracts","typescript","zod","ts-rest","agriculture","farming","farmpro"],"author":{"name":"DeepIntel Ltd"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/deepintel-ltd/farmpro-api-contracts.git"},"bugs":{"url":"https://github.com/deepintel-ltd/farmpro-api-contracts/issues"},"homepage":"https://github.com/deepintel-ltd/farmpro-api-contracts#readme","dependencies":{"@ts-rest/core":"^3.52.0","zod":"^3.23.8"},"devDependencies":{"@types/node":"^24.3.0","@typescript-eslint/eslint-plugin":"^8.41.0","@typescript-eslint/parser":"^8.41.0","eslint":"^8.57.1","tsd":"^0.28.0","tsup":"^8.0.1","tsx":"^4.7.0","typescript":"^5.9.2"},"peerDependencies":{"@ts-rest/core":"^3.52.0","zod":"^3.23.8"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_id":"@bamtak/farmpro-api-contracts@1.0.8","gitHead":"00e06f1d94814d6b7a1dd2a7d67dcb8fc76c1d2d","types":"./dist/index.d.ts","_nodeVersion":"20.19.3","_npmVersion":"10.8.2","dist":{"integrity":"sha512-4DD07iBGd97QSjjKKnBA5j2IHysy8PWI0FiIZoPfUDC8208alx+YVCAqndzi2tcVKmNDnmNkAGulCVPY57FIZQ==","shasum":"2fa05a94dbb8c460227a7a91661913282d6f8c52","tarball":"https://registry.npmjs.org/@bamtak/farmpro-api-contracts/-/farmpro-api-contracts-1.0.8.tgz","fileCount":23,"unpackedSize":28558517,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDCtCxHHEMN2MTUq7icJ+A9eRV6mA7OVAW693Y4mKfdkAIhANO8rgRq4sbzL2n1dfS0u4eUrYf89aVrX44yK9aKRZKx"}]},"_npmUser":{"name":"bamtak","email":"bamtak@hotmail.com"},"directories":{},"maintainers":[{"name":"bamtak","email":"bamtak@hotmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/farmpro-api-contracts_1.0.8_1759281460011_0.29298238121864184"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-01T01:17:39.884Z","1.0.8":"2025-10-01T01:17:40.274Z","modified":"2025-10-01T01:17:40.853Z"},"maintainers":[{"name":"bamtak","email":"bamtak@hotmail.com"}],"description":"Type-safe API contracts for FarmPro agricultural platform","homepage":"https://github.com/deepintel-ltd/farmpro-api-contracts#readme","keywords":["api","contracts","typescript","zod","ts-rest","agriculture","farming","farmpro"],"repository":{"type":"git","url":"git+https://github.com/deepintel-ltd/farmpro-api-contracts.git"},"author":{"name":"DeepIntel Ltd"},"bugs":{"url":"https://github.com/deepintel-ltd/farmpro-api-contracts/issues"},"license":"MIT","readme":"# FarmPro API Contracts\n\n[![npm version](https://badge.fury.io/js/%40deepintel-ltd%2Ffarmpro-api-contracts.svg)](https://badge.fury.io/js/%40deepintel-ltd%2Ffarmpro-api-contracts)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.9+-blue.svg)](https://www.typescriptlang.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nType-safe API contracts for the FarmPro agricultural platform. This package provides comprehensive TypeScript types, Zod schemas, and ts-rest contracts for building type-safe frontend applications.\n\n## Features\n\n- 🚀 **Type-Safe**: Full TypeScript support with strict typing\n- 📋 **JSON API Compliant**: Follows JSON API specification standards\n- 🔍 **Zod Validation**: Runtime validation with Zod schemas\n- 🛠 **ts-rest Integration**: Ready-to-use API contracts\n- 📦 **Tree-Shakable**: Optimized bundle size with tree-shaking\n- 🌾 **Agricultural Focus**: Built specifically for farming and agricultural use cases\n\n## Installation\n\n```bash\nnpm install @deepintel-ltd/farmpro-api-contracts\n# or\nyarn add @deepintel-ltd/farmpro-api-contracts\n# or\npnpm add @deepintel-ltd/farmpro-api-contracts\n```\n\n## Quick Start\n\n### Basic Usage\n\n```typescript\nimport { apiContract, farmContract } from '@deepintel-ltd/farmpro-api-contracts';\nimport { initClient } from '@ts-rest/core';\n\n// Initialize the API client\nconst client = initClient(apiContract, {\n  baseUrl: 'https://api.farmpro.com',\n  baseHeaders: {\n    'Content-Type': 'application/vnd.api+json',\n  },\n});\n\n// Use the client with full type safety\nconst farms = await client.farms.getFarms({\n  query: {\n    'page[number]': 1,\n    'page[size]': 10,\n    include: 'commodities',\n  },\n});\n```\n\n### Using Individual Contracts\n\n```typescript\nimport { farmContract, authContract } from '@deepintel-ltd/farmpro-api-contracts';\n\n// Use specific contracts\nconst farmClient = initClient(farmContract, { baseUrl: 'https://api.farmpro.com' });\nconst authClient = initClient(authContract, { baseUrl: 'https://api.farmpro.com' });\n```\n\n### Schema Validation\n\n```typescript\nimport { FarmSchema, CreateFarmRequestSchema } from '@deepintel-ltd/farmpro-api-contracts';\n\n// Validate data at runtime\nconst farmData = FarmSchema.parse({\n  name: 'Green Acres Farm',\n  location: {\n    latitude: 40.7128,\n    longitude: -74.0060,\n    address: '123 Farm Road, New York, NY 10001'\n  },\n  size: 100,\n  cropTypes: ['corn', 'wheat'],\n  establishedDate: '2020-01-01T00:00:00Z'\n});\n\n// Validate request data\nconst createRequest = CreateFarmRequestSchema.parse({\n  data: {\n    type: 'farms',\n    attributes: farmData\n  }\n});\n```\n\n## API Modules\n\n### Core Resources\n\n- **Farms**: Farm management and operations\n- **Commodities**: Agricultural product management\n- **Orders**: Order processing and fulfillment\n- **Users**: User management and profiles\n- **Organizations**: Multi-tenant organization support\n- **Inventory**: Inventory tracking and management\n\n### Authentication & Authorization\n\n- **Auth**: User authentication and session management\n- **RBAC**: Role-based access control\n- **OAuth**: Social login integration\n\n### Business Intelligence\n\n- **Analytics**: Data analytics and reporting\n- **Market**: Market data and pricing\n- **Intelligence**: AI-powered insights\n\n### Mobile & Field Operations\n\n- **Mobile Field**: Mobile app specific endpoints\n- **Activities**: Field activity tracking\n\n## TypeScript Support\n\nThis package is built with TypeScript and provides comprehensive type definitions:\n\n```typescript\nimport type { \n  Farm, \n  FarmResource, \n  CreateFarmRequest,\n  ApiContractType \n} from '@deepintel-ltd/farmpro-api-contracts';\n\n// Use types for type safety\nconst farm: Farm = {\n  name: 'My Farm',\n  // ... other properties with full type checking\n};\n```\n\n## JSON API Compliance\n\nAll endpoints follow the JSON API specification:\n\n```typescript\n// Request format\n{\n  \"data\": {\n    \"type\": \"farms\",\n    \"attributes\": {\n      \"name\": \"Green Acres Farm\",\n      \"size\": 100\n    }\n  }\n}\n\n// Response format\n{\n  \"data\": {\n    \"id\": \"123e4567-e89b-12d3-a456-426614174000\",\n    \"type\": \"farms\",\n    \"attributes\": {\n      \"name\": \"Green Acres Farm\",\n      \"size\": 100\n    },\n    \"relationships\": {\n      \"commodities\": {\n        \"data\": [\n          { \"type\": \"commodities\", \"id\": \"456e7890-e89b-12d3-a456-426614174001\" }\n        ]\n      }\n    }\n  },\n  \"included\": [\n    {\n      \"id\": \"456e7890-e89b-12d3-a456-426614174001\",\n      \"type\": \"commodities\",\n      \"attributes\": {\n        \"name\": \"Corn\",\n        \"category\": \"grain\"\n      }\n    }\n  ]\n}\n```\n\n## Error Handling\n\nThe package includes comprehensive error schemas:\n\n```typescript\nimport { JsonApiErrorResponseSchema } from '@deepintel-ltd/farmpro-api-contracts';\n\n// Error response format\n{\n  \"errors\": [\n    {\n      \"id\": \"123e4567-e89b-12d3-a456-426614174000\",\n      \"status\": \"400\",\n      \"code\": \"VALIDATION_ERROR\",\n      \"title\": \"Validation Failed\",\n      \"detail\": \"The name field is required\",\n      \"source\": {\n        \"pointer\": \"/data/attributes/name\"\n      }\n    }\n  ]\n}\n```\n\n## Query Parameters\n\nSupport for JSON API query parameters:\n\n```typescript\n// Pagination\n{ 'page[number]': 1, 'page[size]': 10 }\n\n// Field selection\n{ 'fields[farms]': 'name,size,location' }\n\n// Filtering\n{ 'filter[name]': 'Green Acres' }\n\n// Sorting\n{ 'sort': 'name,-created_at' }\n\n// Including related resources\n{ 'include': 'commodities,orders' }\n```\n\n## Development\n\n### Building\n\n```bash\nnpm run build\n```\n\n### Type Checking\n\n```bash\nnpm run type-check\n```\n\n### Linting\n\n```bash\nnpm run lint\nnpm run lint:fix\n```\n\n## Versioning\n\nThis package follows [Semantic Versioning](https://semver.org/):\n\n- **MAJOR**: Breaking changes to the API contracts\n- **MINOR**: New features and non-breaking additions\n- **PATCH**: Bug fixes and minor improvements\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests if applicable\n5. Submit a pull request\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## Support\n\n- 📧 Email: support@deepintel.com\n- 🐛 Issues: [GitHub Issues](https://github.com/deepintel-ltd/farmpro-api-contracts/issues)\n- 📖 Documentation: [API Documentation](https://docs.farmpro.com)\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a detailed list of changes.\n\n---\n\nBuilt with ❤️ by [DeepIntel Ltd](https://deepintel.com)\n","readmeFilename":"README.md","_rev":"1-72497ca7edc555b057ae5d1596715b4b"}