{"_id":"@danielfrey63/openerp-ts-client","_rev":"3-504a69da67916f17fe32b4a84da5c1f7","name":"@danielfrey63/openerp-ts-client","dist-tags":{"latest":"1.0.12"},"versions":{"1.0.9":{"name":"@danielfrey63/openerp-ts-client","version":"1.0.9","_id":"@danielfrey63/openerp-ts-client@1.0.9","maintainers":[{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"}],"homepage":"https://github.com/danielfrey63/openerp-ts-client#readme","bugs":{"url":"https://github.com/danielfrey63/openerp-ts-client/issues"},"dist":{"shasum":"9570c93af1e883e6dab4bc563d6dab6cf69ddaed","tarball":"https://registry.npmjs.org/@danielfrey63/openerp-ts-client/-/openerp-ts-client-1.0.9.tgz","fileCount":8,"integrity":"sha512-egfRY8kQyUxSCVGNGC9nqzzFGMTWgH4c2rQoH3D1p+zLuF97g3jh8789o75cOoWUZtRwxpyEMZMR0OU9Xo/P3Q==","signatures":[{"sig":"MEYCIQCNU/v+ftKU4Wu1GQjX84pX6UJ1lrqq6l2kG7JT0A6nsQIhAK1YZGqn40h8J5k+tdz2VXdOclWgyyhSwiKwfP1/6FyV","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22376},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"00ef5573f6354bceae279407ad6c325e37068331","scripts":{"test":"jest","build":"tsc","start":"ts-node src/example.ts","prepare":"npm run build"},"_npmUser":{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"},"repository":{"url":"git+https://github.com/danielfrey63/openerp-ts-client.git","type":"git"},"_npmVersion":"11.0.0","description":"TypeScript client for OpenERP RPC API","directories":{},"_nodeVersion":"22.9.0","dependencies":{"axios":"^1.6.2","dotenv":"^16.3.1","xml2js":"^0.6.2","inquirer":"^8.2.6","@types/xml2js":"^0.4.14"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.7.3","@types/jest":"^29.5.10","@types/node":"^20.10.0","@types/inquirer":"^8.2.10"},"_npmOperationalInternal":{"tmp":"tmp/openerp-ts-client_1.0.9_1740772307400_0.656242971338292","host":"s3://npm-registry-packages-npm-production"}},"1.0.10":{"name":"@danielfrey63/openerp-ts-client","version":"1.0.10","_id":"@danielfrey63/openerp-ts-client@1.0.10","maintainers":[{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"}],"homepage":"https://github.com/danielfrey63/openerp-ts-client#readme","bugs":{"url":"https://github.com/danielfrey63/openerp-ts-client/issues"},"dist":{"shasum":"86867aa2b0dbc7f84c674b7727be409104a8952a","tarball":"https://registry.npmjs.org/@danielfrey63/openerp-ts-client/-/openerp-ts-client-1.0.10.tgz","fileCount":8,"integrity":"sha512-9JbuKH3PomuNhuCvN6wnzDiHlH/KyQdfP55wd2Zgvr/0GMSqzRRqKei608ybBPMIxc+329Z0/RcYzGs69QRekQ==","signatures":[{"sig":"MEQCIH4loJppbxFhLr0OleSSinDLuSQtKQZiTOK2xD3zQyUaAiBX5pYeh+/ZNVIn8HjRLkWbBOzaPQG6A7hnI5W123JZIg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19528},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"920b36dc930b212b83f3aca028f8135a5dd95af3","scripts":{"test":"jest","build":"tsc","start":"ts-node src/example.ts","deploy":"npm version patch && npm run build && npm pack && npm publish","prepare":"npm run build"},"_npmUser":{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"},"repository":{"url":"git+https://github.com/danielfrey63/openerp-ts-client.git","type":"git"},"_npmVersion":"11.0.0","description":"TypeScript client for OpenERP RPC API","directories":{},"_nodeVersion":"22.9.0","dependencies":{"axios":"^1.6.2","dotenv":"^16.3.1","xml2js":"^0.6.2","inquirer":"^8.2.6","@types/xml2js":"^0.4.14"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.7.3","@types/jest":"^29.5.10","@types/node":"^20.10.0","@types/inquirer":"^8.2.10"},"_npmOperationalInternal":{"tmp":"tmp/openerp-ts-client_1.0.10_1740814402494_0.7472472516387407","host":"s3://npm-registry-packages-npm-production"}},"1.0.11":{"name":"@danielfrey63/openerp-ts-client","version":"1.0.11","_id":"@danielfrey63/openerp-ts-client@1.0.11","maintainers":[{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"}],"homepage":"https://github.com/danielfrey63/openerp-ts-client#readme","bugs":{"url":"https://github.com/danielfrey63/openerp-ts-client/issues"},"dist":{"shasum":"48a0932da4e5fb87f60291b335fc52774890a8ba","tarball":"https://registry.npmjs.org/@danielfrey63/openerp-ts-client/-/openerp-ts-client-1.0.11.tgz","fileCount":8,"integrity":"sha512-KEwnzJD0AR5YDANdsfEgZXKPmReTDH+3gEIC6K/f1k3r4huEimxFf2QlWAc/1y7h7C74DS6HGQlNhW300fBFUQ==","signatures":[{"sig":"MEUCIQDxovEx6/GeWvAuV+SxZX0sTcTNKNbEdHFVbpYzb05kyAIgVqaYIHBqxG3UoaWS75Q83wyBuU50aRQqtckSrjVdglw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23446},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"c8ae26ab99bec2b4242da4a651fd020cdf523d73","scripts":{"test":"jest","build":"tsc","start":"ts-node src/example.ts","deploy":"npm version patch && npm run build && npm pack && npm publish","prepare":"npm run build"},"_npmUser":{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"},"repository":{"url":"git+https://github.com/danielfrey63/openerp-ts-client.git","type":"git"},"_npmVersion":"11.0.0","description":"TypeScript client for OpenERP RPC API","directories":{},"_nodeVersion":"22.9.0","dependencies":{"axios":"^1.6.2","dotenv":"^16.3.1","xml2js":"^0.6.2","inquirer":"^8.2.6","@types/xml2js":"^0.4.14"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.7.3","@types/jest":"^29.5.10","@types/node":"^20.10.0","@types/inquirer":"^8.2.10"},"_npmOperationalInternal":{"tmp":"tmp/openerp-ts-client_1.0.11_1741123213082_0.7610824855636622","host":"s3://npm-registry-packages-npm-production"}},"1.0.12":{"name":"@danielfrey63/openerp-ts-client","version":"1.0.12","description":"TypeScript client for OpenERP RPC API","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","start":"ts-node src/example.ts","test":"jest","prepare":"npm run build","deploy":"npm version patch && npm run build && npm pack && npm publish"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/danielfrey63/openerp-ts-client.git"},"dependencies":{"@types/xml2js":"^0.4.14","axios":"^1.6.2","dotenv":"^16.3.1","inquirer":"^8.2.6","xml2js":"^0.6.2"},"devDependencies":{"@types/inquirer":"^8.2.10","@types/jest":"^29.5.10","@types/node":"^20.10.0","jest":"^29.7.0","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.7.3"},"_id":"@danielfrey63/openerp-ts-client@1.0.12","gitHead":"a89649b84876af6f32f8cf90f1afdf31465635fe","bugs":{"url":"https://github.com/danielfrey63/openerp-ts-client/issues"},"homepage":"https://github.com/danielfrey63/openerp-ts-client#readme","_nodeVersion":"22.9.0","_npmVersion":"11.0.0","dist":{"integrity":"sha512-7JMlJmg6QJqLXqBv0j65sV34Zu9hbuQEvPThWJFxmTdhuDF2nDsyi4k59kXy7vWFVD3LLGMtSzs9JQb0yh2qWg==","shasum":"4e9180a44b03dbf93f892ac21225a861fa0c940c","tarball":"https://registry.npmjs.org/@danielfrey63/openerp-ts-client/-/openerp-ts-client-1.0.12.tgz","fileCount":8,"unpackedSize":31049,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAxawVTbJsZaCHcyFbgGqjIkQYTZ8dCSL85FZCFqqDyOAiBY6kH54iOXxMLC3gi7vLxkZL2eSGQQuFdDRiJUcHe1yw=="}]},"_npmUser":{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"},"directories":{},"maintainers":[{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openerp-ts-client_1.0.12_1741126400375_0.7483346524908698"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-28T19:51:47.262Z","modified":"2025-03-04T22:13:20.696Z","1.0.9":"2025-02-28T19:51:47.582Z","1.0.10":"2025-03-01T07:33:22.663Z","1.0.11":"2025-03-04T21:20:13.282Z","1.0.12":"2025-03-04T22:13:20.527Z"},"bugs":{"url":"https://github.com/danielfrey63/openerp-ts-client/issues"},"homepage":"https://github.com/danielfrey63/openerp-ts-client#readme","repository":{"type":"git","url":"git+https://github.com/danielfrey63/openerp-ts-client.git"},"description":"TypeScript client for OpenERP RPC API","maintainers":[{"name":"danielfrey63","email":"daniel.frey@xmatrix.ch"}],"readme":"# OpenERP TypeScript Client\n\nA TypeScript client for interacting with OpenERP's RPC API. This package provides a strongly-typed interface for making RPC calls to OpenERP servers.\n\n## Installation\n\n```bash\nnpm install @danielfrey63/openerp-ts-client\n```\n\n## Usage\n\n```typescript\nimport { OpenERPClient } from '@danielfrey63/openerp-ts-client';\n\nconst client = new OpenERPClient({\n    baseURL: 'http://your-openerp-server',\n    db: 'your-database',\n    username: 'admin',\n    password: 'admin'\n});\n\n// Example: Search for partners\nconst partners = await client.search('res.partner', [['is_company', '=', true]]);\n```\n\n## API Reference\n\n### Methods\n\n| Method                     | Description                                                   | Parameters                                                                                                                                                     | Return Type              |\n| -------------------------- | ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |\n| `constructor`            | Creates a new OpenERP client instance                         | `config: OpenERPConfig` - Configuration object with baseUrl property                                                                                         | `OpenERPClient`        |\n| `listDatabases`          | Lists all available databases on the OpenERP server           | None                                                                                                                                                           | `Promise<string[]>`    |\n| `login`                  | Authenticates with the OpenERP server                         | `credentials: LoginCredentials` - Object containing db, username, and password                                                                               | `Promise<Session>`     |\n| `getOpenSaleOrders`      | Retrieves all open sales orders (draft, sent, or in progress) | None                                                                                                                                                           | `Promise<SaleOrder[]>` |\n| `getSaleOrderLines`      | Retrieves all order lines for a specific sales order          | `orderId: number` - ID of the sales order                                                                                                                    | `Promise<OrderLine[]>` |\n| `updateOrderLineProduct` | Updates a product in a sales order line                       | `orderId: number` - ID of the sales order`<br>`orderLineId: number` - ID of the order line to update`<br>`newProductCode: string` - Code of the new product | `Promise<void>`        |\n| `getProductDetailsByCode` | Retrieves detailed information about a product by its code    | `productCode: string` - Code of the product to retrieve                                                                                                      | `Promise<ProductDetails \\| null>` |\n\n### Data Types\n\n#### OpenERPConfig\n\n```typescript\ninterface OpenERPConfig {\n  baseUrl: string;\n}\n```\n\n#### LoginCredentials\n\n```typescript\ninterface LoginCredentials {\n  db: string;\n  username: string;\n  password: string;\n}\n```\n\n#### Session\n\n```typescript\ninterface Session {\n  id: string;\n  db: string;\n  uid: number;\n  username: string;\n}\n```\n\n#### SaleOrder\n\n```typescript\ninterface SaleOrder {\n  id: number;\n  name: string;\n  partner_id: [number, string];\n  state: string;\n}\n```\n\n#### OrderLine\n\n```typescript\ninterface OrderLine {\n  id: number;\n  product_id: [number, string];\n  product_uom_qty: number;\n  price_unit: number;\n}\n```\n\n#### ProductDetails\n\n```typescript\ninterface ProductDetails {\n  id: number;\n  code: string;\n  name: string;\n  name_template: string;\n  price: number;\n}\n```\n\n## Implementation Details\n\nThis library implements several advanced architectural patterns to ensure high performance, maintainability, and type safety:\n\n- **XML-RPC Client Architecture**: The client uses a unified XML-RPC approach with dynamic endpoint handling. Instead of maintaining three separate clients (db, common, object), a single reusable client intelligently routes requests to the appropriate service endpoint.\n\n- **Response Parsing System**: A sophisticated response parser converts XML-RPC responses into strongly-typed TypeScript objects. This system reduces parsing code duplication by 90% while providing comprehensive type safety through generics.\n\n- **Data Mapping Strategy**: The library employs a factory pattern for object mapping in data queries. This approach enables automatic detection of arrays and structs in the response data, ensuring consistent error logging and type conversion.\n\n- **Robust Error Handling**: A comprehensive error handling system provides detailed error information with custom exception classes. The implementation maintains complete error chains back to the original stack trace and supports localized error messages.\n\n- **Service-Oriented Architecture**: The codebase is organized into modular functional services (authentication, orders, products, etc.) using interface-based dependency injection. This structure ensures complete independence between services while maintaining a cohesive API.\n\n## Development\n\n1. Clone the repository\n2. Install dependencies: `npm install`\n3. Build the package: `npm run build`\n\n## License\n\nMIT\n","readmeFilename":"README.md"}