{"_id":"@aavanamkit/engine","name":"@aavanamkit/engine","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"@aavanamkit/engine","version":"1.0.1","description":"The headless Node.js engine for AavanamKit document generation.","main":"src/index.js","publishConfig":{"access":"public"},"scripts":{"test":"jest"},"keywords":["aavanamkit","pdf","docx","document-generation","headless","nodejs"],"author":{"name":"The AavanamKit Project Contributors"},"license":"MIT","type":"commonjs","devDependencies":{"jest":"^30.0.5"},"dependencies":{"axios":"^1.11.0","canvas":"^3.1.2","colornames":"^1.1.1","docx":"^9.5.1","jsbarcode":"^3.12.1","pdfkit":"^0.17.1"},"_id":"@aavanamkit/engine@1.0.1","gitHead":"dce32d27763f27887b0a93245a350ad89d4c2e76","_nodeVersion":"22.14.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-TbtKRdTEjdj+2Sk3n+TZdf8eSWAwEmuDvkL/8VkWzHDrIJJZdalRj7byh3MnyCWdhCoXMwx+mVllW69Xn47+uw==","shasum":"bcfbe1f687b426f68458b32cff84b87c46a5d115","tarball":"https://registry.npmjs.org/@aavanamkit/engine/-/engine-1.0.1.tgz","fileCount":9,"unpackedSize":30434,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICYCp1WDO08n3GlkfRN/gpLhA9lonYuHnUCA2u3mGwdJAiEAhIKlCeWxWCKlSbjkOJQYwzQcUkbsivOBd7pg08Wb4Zk="}]},"_npmUser":{"name":"jafranjemal","email":"jafranjemal1995@gmail.com"},"directories":{},"maintainers":[{"name":"jafranjemal","email":"jafranjemal1995@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/engine_1.0.1_1754718200203_0.7401163387520444"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-09T05:43:20.110Z","1.0.1":"2025-08-09T05:43:20.465Z","modified":"2025-08-09T05:43:20.761Z"},"maintainers":[{"name":"jafranjemal","email":"jafranjemal1995@gmail.com"}],"description":"The headless Node.js engine for AavanamKit document generation.","keywords":["aavanamkit","pdf","docx","document-generation","headless","nodejs"],"author":{"name":"The AavanamKit Project Contributors"},"license":"MIT","readme":"# @aavanamkit/engine\r\n\r\nA professional, headless Node.js engine for generating data-driven documents from AavanamKit templates.\r\n\r\n## ✨ About The Engine\r\n\r\n`@aavanamkit/engine` is the server-side counterpart to the `@aavanamkit/designer`. It is a pure Node.js library with zero browser dependencies, designed for automated, high-performance document generation.\r\n\r\nThis engine takes the `template.json` created by the visual designer, merges it with your live application data, and produces pixel-perfect documents in multiple formats. It's the \"construction crew\" that reads the architect's blueprint and builds the final product.\r\n\r\n## 🚀 Core Features\r\n\r\n- **Headless Generation**: Built for the backend. Perfect for automated workflows, API responses, or scheduled jobs.\r\n- **Multi-Format Export**: Generate PDF, DOCX, and HTML files from the same template.\r\n- **Advanced Table Pagination**: Replicates the designer's layout-aware, fixed-position table pagination for professional, multi-page documents.\r\n- **Full Style Parity**: Accurately renders all advanced styling for fonts, colors, and tables defined in the designer.\r\n- **Robust & Forgiving**: Intelligently uses default values for any missing template properties, preventing crashes from incomplete templates.\r\n\r\n## 📦 Installation\r\n\r\nInstall the engine in your Node.js project using npm:\r\n\r\n```bash\r\nnpm install @aavanamkit/engine\r\n```\r\n\r\n## 📄 Usage\r\n\r\nThe engine exposes a single `generate` function. You provide the template, data, and desired output type, and it returns the final document as a buffer.\r\n\r\n```js\r\nimport { generate } from '@aavanamkit/engine';\r\nimport fs from 'fs';\r\n\r\n// 1. Load your saved template object from your database or a file\r\nimport template from './templates/invoice.json';\r\n\r\n// 2. Fetch the live data for the document you want to create\r\nconst liveData = {\r\n  customer: { name: \"John Doe\", address: \"123 Main St, Anytown\" },\r\n  invoiceNumber: \"INV-2025-001\",\r\n  totalAmount: 450.00,\r\n  items: [\r\n    { description: \"Screen Repair\", qty: 1, total: 250.00 },\r\n    { description: \"Battery Replacement\", qty: 1, total: 200.00 },\r\n  ]\r\n};\r\n\r\n// 3. Call the generate function\r\nasync function createInvoice() {\r\n  try {\r\n    const pdfBuffer = await generate({\r\n      template: template,\r\n      data: liveData,\r\n      outputType: 'pdf' \r\n    });\r\n\r\n    // 4. Do something with the output buffer\r\n    fs.writeFileSync('invoice-001.pdf', pdfBuffer);\r\n    console.log('Successfully generated invoice-001.pdf!');\r\n\r\n  } catch (error) {\r\n    console.error('Error generating document:', error);\r\n  }\r\n}\r\n\r\ncreateInvoice();\r\n```\r\n\r\n## 🧾 API Reference\r\n\r\n### `generate({ template, data, outputType })`\r\n\r\nThis is an asynchronous function that returns a Promise.\r\n\r\n**Parameters:**\r\n\r\n- `template` (object) - **Required.** The complete template object saved from the `@aavanamkit/designer`. It must include `pageSettings` and `pages` properties.\r\n- `data` (object) - **Required.** The live data object to populate the template. Its structure should match the `dataSchema` defined within the template.\r\n- `outputType` (string) - **Required.** The desired output format. Must be one of the following strings:\r\n  - `'pdf'`\r\n  - `'docx'`\r\n  - `'html'`\r\n\r\n**Returns:**\r\n\r\nA Promise that resolves to:\r\n\r\n- A `Buffer` for `pdf` and `docx` output types.\r\n- A `string` for the `html` output type.\r\n\r\n## 🤝 Contributing\r\n\r\nThe AavanamKit Project is a community-driven, open-source initiative and we welcome contributions of all kinds. Please read our CONTRIBUTING.md guide for details.\r\n\r\n## 🪪 License\r\n\r\nThis project is licensed under the MIT License. See the LICENSE file for details.\r\n\r\n---\r\n\r\n**The AavanamKit Project - Founded by JJSOFT GLOBAL**","readmeFilename":"README.md","_rev":"1-2621b4635c2b6ab4c6d0eb4aa12c58a2"}