{"_id":"@aerochain/node-sdk","_rev":"3-f5a20a9c34ab75013c31f6b2770a42b3","name":"@aerochain/node-sdk","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"@aerochain/node-sdk","version":"1.0.0","keywords":["aerochain","api","sdk","aviation","blockchain","aerospace","parts","traceability"],"author":{"name":"Aerochain"},"license":"MIT","_id":"@aerochain/node-sdk@1.0.0","maintainers":[{"name":"blackwhale","email":"victor.blackwhale@gmail.com"}],"homepage":"https://github.com/Wingleet/aerochain-node-sdk#readme","bugs":{"url":"https://github.com/Wingleet/aerochain-node-sdk/issues"},"dist":{"shasum":"b381aafb05bf2d1b956e03d4a45bfbadb2abc3b5","tarball":"https://registry.npmjs.org/@aerochain/node-sdk/-/node-sdk-1.0.0.tgz","fileCount":62,"integrity":"sha512-eVddTjhEd1533Uv54rt4mzzW9yq9kLBnPY+NGtsJDAKxbbVFZiZXV9uC6zKuDh20NSzUpH/iqHVbCE2gW9byFg==","signatures":[{"sig":"MEUCICRYIlnP8CesGL+Ejc8g910DxKeePXHHUCeaJtii/gn3AiEApXBCp9oCPoH2C7ZllgUI4OkE4vkgQPOkRGW0aNe8YGs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":271458},"icon":"assets/aerochain-icon.png","main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e55207598cb78e78b197ef171a846192396cc48d","scripts":{"lint":"tsc --noEmit","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","clean":"rimraf dist","format":"prettier --write \"src/**/*.ts\" \"examples/**/*.js\"","version":"npm run format && git add -A src examples","build:watch":"tsc --watch","format:check":"prettier --check \"src/**/*.ts\" \"examples/**/*.js\"","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"blackwhale","email":"victor.blackwhale@gmail.com"},"repository":{"url":"git+https://github.com/Wingleet/aerochain-node-sdk.git","type":"git"},"_npmVersion":"11.4.2","description":"Official Node.js SDK for the Aerochain API","directories":{},"_nodeVersion":"22.21.0","dependencies":{"axios":"^1.6.0","form-data":"^4.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.0","prettier":"^3.1.0","typescript":"^5.3.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/node-sdk_1.0.0_1773757712619_0.15455187889988964","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@aerochain/node-sdk","version":"1.0.1","keywords":["aerochain","api","sdk","aviation","blockchain","aerospace","parts","traceability"],"author":{"name":"Aerochain"},"license":"MIT","_id":"@aerochain/node-sdk@1.0.1","maintainers":[{"name":"blackwhale","email":"victor.blackwhale@gmail.com"}],"homepage":"https://github.com/Wingleet/aerochain-node-sdk#readme","bugs":{"url":"https://github.com/Wingleet/aerochain-node-sdk/issues"},"dist":{"shasum":"b5524e84025dfcdd4c38a80d7102bccb113587e2","tarball":"https://registry.npmjs.org/@aerochain/node-sdk/-/node-sdk-1.0.1.tgz","fileCount":63,"integrity":"sha512-+M0SbJrRBaXFlmBaQFSvhszzKgeK13EIpHS5SG88bo8SCr2zmzB06jRbIWA0Kzce8UYBZ4VBhajx/sNPJSqSYQ==","signatures":[{"sig":"MEUCIE0fMdf8v8g+uGUls1XtSirZ2VC9HHGcfQxGsq3vrIjcAiEAl/3g9aijw4FJclr7EzhA0br0QafjlZzyAH4yz39p/D8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":380480},"icon":"assets/aerochain-icon.png","main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"f67f2818202734248a635cc5c8b485dcf7331c31","scripts":{"lint":"tsc --noEmit","test":"echo \"Error: no test specified\" && exit 1","build":"tsc","clean":"rimraf dist","format":"prettier --write \"src/**/*.ts\" \"examples/**/*.js\"","version":"npm run format && git add -A src examples","build:watch":"tsc --watch","format:check":"prettier --check \"src/**/*.ts\" \"examples/**/*.js\"","prepublishOnly":"npm run clean && npm run build"},"_npmUser":{"name":"blackwhale","email":"victor.blackwhale@gmail.com"},"repository":{"url":"git+https://github.com/Wingleet/aerochain-node-sdk.git","type":"git"},"_npmVersion":"11.4.2","description":"Official Node.js SDK for the Aerochain API","directories":{},"_nodeVersion":"22.21.0","dependencies":{"axios":"^1.6.0","form-data":"^4.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"rimraf":"^5.0.0","prettier":"^3.1.0","typescript":"^5.3.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/node-sdk_1.0.1_1773758223853_0.9443146286232342","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@aerochain/node-sdk","version":"1.2.0","description":"Official Node.js SDK for the Aerochain API","type":"module","publishConfig":{"access":"public"},"main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","build:watch":"tsc --watch","clean":"rimraf dist","format":"prettier --write \"src/**/*.ts\" \"examples/**/*.js\"","format:check":"prettier --check \"src/**/*.ts\" \"examples/**/*.js\"","lint":"tsc --noEmit","prepublishOnly":"npm run clean && npm run build","test":"echo \"Error: no test specified\" && exit 1","version":"npm run format && git add -A src examples","release:patch":"npm version patch && git push && git push --tags && npm publish","release:minor":"npm version minor && git push && git push --tags && npm publish","release:major":"npm version major && git push && git push --tags && npm publish"},"keywords":["aerochain","api","sdk","aviation","blockchain","aerospace","parts","traceability"],"author":{"name":"Aerochain"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Wingleet/aerochain-node-sdk.git"},"bugs":{"url":"https://github.com/Wingleet/aerochain-node-sdk/issues"},"homepage":"https://github.com/Wingleet/aerochain-node-sdk#readme","icon":"assets/aerochain-icon.png","dependencies":{"axios":"^1.6.0","form-data":"^4.0.0"},"devDependencies":{"@types/node":"^20.0.0","prettier":"^3.1.0","rimraf":"^5.0.0","typescript":"^5.3.0"},"engines":{"node":">=18.0.0"},"_id":"@aerochain/node-sdk@1.2.0","gitHead":"e412e8719b9dbd6448a7137eb4d3c84f58697689","_nodeVersion":"22.21.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-NpQn97IOiSSeni/beo2Qxr17P1QYBhMII4Vk8eUH3vUKzk5GU26CpA8qhHBTB3nxOhbq8l05qS3cJw+nkgJMaQ==","shasum":"9210fa32204d1bf6cf20f36ddbf5537a222279c5","tarball":"https://registry.npmjs.org/@aerochain/node-sdk/-/node-sdk-1.2.0.tgz","fileCount":66,"unpackedSize":392376,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA+yDE1H/WwV659iPFDv10GjWaibs/PSUr1tI7+bIMxzAiBMX4ZKnxxiTfu7fyPbWg57s7ZfEZBbxROBfI2jVmgCgg=="}]},"_npmUser":{"name":"blackwhale","email":"victor.blackwhale@gmail.com"},"directories":{},"maintainers":[{"name":"blackwhale","email":"victor.blackwhale@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node-sdk_1.2.0_1773838046873_0.4186047871861094"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-17T14:28:32.491Z","modified":"2026-03-18T12:47:27.184Z","1.0.0":"2026-03-17T14:28:32.868Z","1.0.1":"2026-03-17T14:37:04.084Z","1.2.0":"2026-03-18T12:47:27.036Z"},"bugs":{"url":"https://github.com/Wingleet/aerochain-node-sdk/issues"},"author":{"name":"Aerochain"},"license":"MIT","homepage":"https://github.com/Wingleet/aerochain-node-sdk#readme","keywords":["aerochain","api","sdk","aviation","blockchain","aerospace","parts","traceability"],"repository":{"type":"git","url":"git+https://github.com/Wingleet/aerochain-node-sdk.git"},"description":"Official Node.js SDK for the Aerochain API","maintainers":[{"name":"blackwhale","email":"victor.blackwhale@gmail.com"}],"readme":"<div align=\"center\">\n  <img src=\"./assets/aerochain-logo.png\" alt=\"Aerochain\" height=\"100\" />\n  <span style=\"margin: 0 20px; font-size: 14px; color: #666;\">by</span>\n  <img src=\"./assets/wingleet-logo.png\" alt=\"Wingleet\" height=\"60\" />\n</div>\n\n# Aerochain Node SDK\n\n[![npm version](https://badge.fury.io/js/%40aerochain%2Fnode-sdk.svg)](https://www.npmjs.com/package/@aerochain/node-sdk)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Node.js Version](https://img.shields.io/node/v/@aerochain/node-sdk.svg)](https://nodejs.org)\n\nOfficial Node.js SDK for the Aerochain API - The blockchain-based aviation parts traceability platform.\n\n## Installation\n\n```bash\nnpm install @aerochain/node-sdk\n```\n\n## Quick Start\n\n### Authentication with Email/Password\n\n```typescript\nimport { AerochainClient } from '@aerochain/node-sdk';\n\nconst client = new AerochainClient({\n  baseURL: 'https://api.aerochain.com',\n  auth: {\n    type: 'credentials',\n    email: 'user@example.com',\n    password: 'your-password',\n  },\n});\n\nawait client.initialize();\n\nconst parts = await client.parts.list();\nconsole.log(parts);\n```\n\n### Authentication with API Key\n\n```typescript\nimport { AerochainClient } from '@aerochain/node-sdk';\n\nconst client = new AerochainClient({\n  baseURL: 'https://api.aerochain.com',\n  auth: {\n    type: 'apiKey',\n    apiKey: 'your-api-key',\n  },\n});\n\nconst parts = await client.parts.list();\nconsole.log(parts);\n```\n\n### Host Mode (Direct Gateway Access)\n\nFor hosts managing organizations directly through the gateway:\n\n```typescript\nimport { AerochainClient } from '@aerochain/node-sdk';\n\nconst client = new AerochainClient({\n  baseURL: 'https://api.aerochain.com',\n  auth: {\n    type: 'host',\n    hostApiKey: 'your-host-api-key',\n    organizationApiKey: 'organization-api-key',\n    gatewayURL: 'https://gateway.aerochain.com',\n  },\n});\n\nawait client.initialize();\n\n// Access gateway-specific endpoints\nif (client.gateway) {\n  // Process blockchain events\n  await client.gateway.processEvent({\n    entityType: 'part',\n    entityUidHex: '0x123...',\n    eventType: 'inspected',\n    eventDate: '2024-01-01',\n    eventData: { inspector: 'John Doe' },\n  });\n\n  // Grant access to events\n  await client.gateway.grantAccess({\n    entityType: 'part',\n    entityUidHex: '0x123...',\n    recipientBlockchainAddress: '0xabc...',\n    eventUidHexList: ['0xevent1...', '0xevent2...'],\n  });\n\n  // Bulk event share operations\n  await client.gateway.bulkOfferEventShare({\n    eventShares: [\n      {\n        entityType: 'part',\n        entityUidHex: '0x123...',\n        toOrganizationId: 'org-id',\n      },\n    ],\n  });\n}\n\n// Standard API endpoints still work\nconst parts = await client.parts.list();\n```\n\n## Features\n\n- ✅ **Dual Mode Support**: Organization mode (via API) or Host mode (direct gateway access)\n- ✅ Email/Password authentication with automatic JWT token renewal\n- ✅ API Key authentication\n- ✅ Host authentication with service tokens\n- ✅ Full TypeScript support\n- ✅ Automatic token refresh\n- ✅ Comprehensive API coverage\n- ✅ Gateway-specific operations for hosts (event processing, access grants, bulk operations)\n\n## API Reference\n\n### Client Initialization\n\n```typescript\nconst client = new AerochainClient(config);\nawait client.initialize(); // Required for credentials auth\n```\n\n### Parts\n\n```typescript\n// List parts\nconst parts = await client.parts.list({ page: 1, filters: { status: 'active' } });\n\n// Get single part\nconst part = await client.parts.get('part-id');\n\n// Create part\nconst newPart = await client.parts.create({\n  serialNumber: 'SN123',\n  partNumber: 'PN456',\n  manufacturer: 'org-id',\n});\n\n// Create part with event\nconst formData = new FormData();\nformData.append('serialNumber', 'SN123');\nformData.append('file', fileBuffer, 'document.pdf');\nconst partWithEvent = await client.parts.createWithEvent(formData);\n```\n\n### Event Shares\n\n```typescript\n// List event shares\nconst shares = await client.eventShares.list({\n  entityType: 'part',\n  status: 'pending',\n  direction: 'received',\n});\n\n// Create event share\nconst share = await client.eventShares.create({\n  entityType: 'part',\n  entityUidHex: '0x123...',\n  toOrganization: 'org-id',\n});\n\n// Accept event share\nawait client.eventShares.accept('share-id');\n\n// Decline event share\nawait client.eventShares.decline('share-id');\n\n// Cancel event share\nawait client.eventShares.cancel('share-id');\n```\n\n### Part Events\n\n```typescript\n// List part events\nconst events = await client.partEvents.list({ partId: 'part-id' });\n\n// Create part event\nconst event = await client.partEvents.create({\n  eventType: 'inspected',\n  eventDate: '2024-01-01',\n  partId: 'part-id',\n});\n```\n\n### Aircraft\n\n```typescript\n// List aircraft\nconst aircraft = await client.aircraft.list();\n\n// Get single aircraft\nconst plane = await client.aircraft.get('aircraft-id');\n\n// Create aircraft\nconst newAircraft = await client.aircraft.create({\n  registration: 'N12345',\n  msn: 'MSN123',\n  modelId: 'model-id',\n});\n```\n\n### Organizations\n\n```typescript\n// Get organization\nconst org = await client.organizations.get('org-id');\n```\n\n### Users\n\n```typescript\n// Get user\nconst user = await client.users.get('user-id');\n```\n\n## Error Handling\n\n```typescript\ntry {\n  const parts = await client.parts.list();\n} catch (error) {\n  if (error.response?.status === 401) {\n    console.error('Authentication failed');\n  } else if (error.response?.status === 422) {\n    console.error('Validation errors:', error.formErrors);\n  } else {\n    console.error('Error:', error.message);\n  }\n}\n```\n\n## TypeScript Support\n\nThis SDK is written in TypeScript and includes complete type definitions. All types are exported from the main package:\n\n```typescript\nimport { AerochainClient, Part, PartEvent, EventShare, Organization } from '@aerochain/node-sdk';\n```\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## Versioning\n\nThis project follows [Semantic Versioning](https://semver.org/). For the versions available, see the [tags on this repository](https://github.com/Wingleet/aerochain-node-sdk/tags).\n\nSee [CHANGELOG.md](CHANGELOG.md) for a detailed history of changes.\n\n## Support\n\n- **Documentation**: [FILTERS.md](FILTERS.md) for available filters\n- **Issues**: [GitHub Issues](https://github.com/Wingleet/aerochain-node-sdk/issues)\n- **Examples**: See the [examples](examples/) directory\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\nBuilt with ❤️ by the Aerochain team for the aviation industry.\n","readmeFilename":"README.md"}