{"_id":"@apiclient.xyz/bookstack","_rev":"3-4fc3b808f81d3fe4c270283a94fc5656","name":"@apiclient.xyz/bookstack","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.1":{"name":"@apiclient.xyz/bookstack","version":"1.0.1","keywords":["bookstack","api client","TypeScript","wiki","documentation","books","pages","chapters"],"author":{"name":"Lossless GmbH"},"license":"MIT","_id":"@apiclient.xyz/bookstack@1.0.1","maintainers":[{"name":"lossless","email":"hello@lossless.com"}],"dist":{"shasum":"a54289b3819d45c1f3a46e33baaacc5e0a3f5c72","tarball":"https://registry.npmjs.org/@apiclient.xyz/bookstack/-/bookstack-1.0.1.tgz","fileCount":32,"integrity":"sha512-UhHGFhHhG5Espvye2qGYDZbhHjmEvMeUON49lc6/Wo2zPYc2bj4iQwSDNvNa90VDCLypkKX96xQD5MvzZeNctQ==","signatures":[{"sig":"MEUCIQD18kt7HAlxp/rftMZZM6KQaGUGCVAE0hqYpeCc8doyWQIgBEFtx93r/+Woz3m4GZ/TY3NKwFwRUk6tnezwTj/2xH0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":129172},"main":"dist_ts/index.js","type":"module","gitHead":"cc743a562fe91e86016e2b5460ae91c9e288323b","private":false,"scripts":{"test":"(tstest test/ --verbose --timeout 600)","build":"(tsbuild --web --allowimplicitany)"},"typings":"dist_ts/index.d.ts","_npmUser":{"name":"lossless","email":"hello@lossless.com"},"repository":{"url":"https://code.foss.global/apiclient.xyz/bookstack.git","type":"git"},"_npmVersion":"11.7.0","description":"A TypeScript API client for BookStack, providing easy access to books, chapters, pages, shelves, and more.","directories":{},"_nodeVersion":"25.2.1","browserslist":["last 1 chrome versions"],"dependencies":{"@push.rocks/smartlog":"^3.2.1","@push.rocks/smartrequest":"^5.0.1"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.15.3","@git.zone/tsrun":"^2.0.0","@git.zone/tstest":"^2.8.2","@push.rocks/qenv":"^6.1.3","@git.zone/tsbuild":"^3.1.0","@push.rocks/tapbundle":"^5.6.0"},"_npmOperationalInternal":{"tmp":"tmp/bookstack_1.0.1_1774689441533_0.009460075687783842","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@apiclient.xyz/bookstack","version":"1.1.0","keywords":["bookstack","api client","TypeScript","wiki","documentation","books","pages","chapters"],"author":{"name":"Lossless GmbH"},"license":"MIT","_id":"@apiclient.xyz/bookstack@1.1.0","maintainers":[{"name":"lossless","email":"hello@lossless.com"}],"dist":{"shasum":"b196fc663156fa2e7ae3b74ca796bb8f3473d5e2","tarball":"https://registry.npmjs.org/@apiclient.xyz/bookstack/-/bookstack-1.1.0.tgz","fileCount":34,"integrity":"sha512-LJGZKMAkV6ZiwiuDB1wEiofzxO+MeRIk0GqrA1u0DhnpmocO1HANZh6U0kNYZPxZcidlK/XFSXjYMVIVedIYnw==","signatures":[{"sig":"MEUCIQDLLxpYtZMCU4TnJP4lhuoCzCUtgzDUDIEI6pBFfUzNTwIgdKwM5fSfBPyn9BuVTPwTZ1fC7VWjinGfPpy+Ie3tADQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139834},"main":"dist_ts/index.js","type":"module","gitHead":"d27d5e35376bc304bc4ae6561afce5f26a1c8dfb","private":false,"scripts":{"test":"(tstest test/ --verbose --timeout 600)","build":"(tsbuild --allowimplicitany)"},"typings":"dist_ts/index.d.ts","_npmUser":{"name":"lossless","email":"hello@lossless.com"},"repository":{"url":"https://code.foss.global/apiclient.xyz/bookstack.git","type":"git"},"_npmVersion":"11.7.0","description":"A TypeScript API client for BookStack, providing easy access to books, chapters, pages, shelves, and more.","directories":{},"_nodeVersion":"25.2.1","browserslist":["last 1 chrome versions"],"dependencies":{"@push.rocks/smartlog":"^3.2.1","@push.rocks/smartrequest":"^5.0.1"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^22.15.3","@git.zone/tsrun":"^2.0.2","@git.zone/tstest":"^3.6.3","@push.rocks/qenv":"^6.1.3","@git.zone/tsbuild":"^4.4.0","@push.rocks/tapbundle":"^6.0.3"},"_npmOperationalInternal":{"tmp":"tmp/bookstack_1.1.0_1774689645340_0.9062420684336165","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@apiclient.xyz/bookstack","version":"1.1.1","private":false,"description":"A TypeScript API client for BookStack, providing easy access to books, chapters, pages, shelves, and more.","main":"dist_ts/index.js","typings":"dist_ts/index.d.ts","type":"module","scripts":{"test":"(tstest test/ --verbose --timeout 600)","build":"(tsbuild --allowimplicitany)"},"repository":{"type":"git","url":"https://code.foss.global/apiclient.xyz/bookstack.git"},"keywords":["bookstack","api client","TypeScript","wiki","documentation","books","pages","chapters"],"author":{"name":"Lossless GmbH"},"license":"MIT","dependencies":{"@push.rocks/smartrequest":"^5.0.1","@push.rocks/smartlog":"^3.2.1"},"devDependencies":{"@git.zone/tsbuild":"^4.4.0","@git.zone/tsrun":"^2.0.2","@git.zone/tstest":"^3.6.3","@push.rocks/qenv":"^6.1.3","@push.rocks/tapbundle":"^6.0.3","@types/node":"^22.15.3"},"browserslist":["last 1 chrome versions"],"gitHead":"a4411fbd36aa8714f0e468eeee6ea5703bc4ab87","_id":"@apiclient.xyz/bookstack@1.1.1","_nodeVersion":"25.2.1","_npmVersion":"11.7.0","dist":{"integrity":"sha512-veHVYAANw8bRGp0nyBVWTWwu/t0jydvXYTd1e/8Sbix2ccP9UM2r2WsoYrhGi3DZV+QYU1A0Us4hB4ewvaj31g==","shasum":"fcf2793aec66c8954bb244938329908dc919b0e8","tarball":"https://registry.npmjs.org/@apiclient.xyz/bookstack/-/bookstack-1.1.1.tgz","fileCount":34,"unpackedSize":143472,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB+WaE/3dDnRPekj/by3QqyjpzOiv/Lz2XVp7fZdhK2WAiAMhI57KTS72pcSx3IOsLCrume6yWA7B2xNGUqOuraQJQ=="}]},"_npmUser":{"name":"lossless","email":"hello@lossless.com"},"directories":{},"maintainers":[{"name":"lossless","email":"hello@lossless.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bookstack_1.1.1_1774694581593_0.4538903507668641"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-28T09:17:21.464Z","modified":"2026-03-28T10:43:02.164Z","1.0.1":"2026-03-28T09:17:21.675Z","1.1.0":"2026-03-28T09:20:45.514Z","1.1.1":"2026-03-28T10:43:01.736Z"},"author":{"name":"Lossless GmbH"},"license":"MIT","keywords":["bookstack","api client","TypeScript","wiki","documentation","books","pages","chapters"],"repository":{"type":"git","url":"https://code.foss.global/apiclient.xyz/bookstack.git"},"description":"A TypeScript API client for BookStack, providing easy access to books, chapters, pages, shelves, and more.","maintainers":[{"name":"lossless","email":"hello@lossless.com"}],"readme":"# @apiclient.xyz/bookstack\n\nA fully-typed TypeScript API client for [BookStack](https://www.bookstackapp.com/) — the open-source wiki and documentation platform. Covers the entire BookStack REST API with rich domain objects, auto-pagination, and export support.\n\n## Issue Reporting and Security\n\nFor reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.\n\n## Install\n\n```bash\npnpm install @apiclient.xyz/bookstack\n```\n\n## Quick Start\n\n```typescript\nimport { BookStackAccount } from '@apiclient.xyz/bookstack';\n\nconst bookstack = new BookStackAccount(\n  'https://your-bookstack-instance.com',\n  'your-token-id',\n  'your-token-secret',\n);\n\n// 🔌 Test the connection\nconst result = await bookstack.testConnection();\nconsole.log(result); // { ok: true }\n\n// 📚 List all books\nconst books = await bookstack.getBooks();\n\n// 📄 Create a page\nconst page = await bookstack.createPage({\n  name: 'Getting Started',\n  book_id: 1,\n  markdown: '# Welcome\\nThis is your first page.',\n});\n```\n\n## Authentication\n\nBookStack uses token-based authentication. Generate an API token from your BookStack user profile under **API Tokens**. You'll get a **Token ID** and a **Token Secret** — pass both to the constructor:\n\n```typescript\nconst bookstack = new BookStackAccount(\n  'https://wiki.example.com',  // Your BookStack instance URL\n  'Fpa7dZR2uJcAT86RmoyLrn5',  // Token ID\n  'OjrMXAjjvxndbhk2hYAuUJk',  // Token Secret\n);\n```\n\nThe user must have the **\"Access System API\"** role permission enabled in BookStack.\n\n## 📖 Content Hierarchy\n\nBookStack organizes content in a clear hierarchy. The client mirrors this with rich domain objects:\n\n```\n📚 Shelves\n └── 📕 Books\n      └── 📂 Chapters (optional)\n           └── 📄 Pages\n      └── 📄 Pages (directly in book)\n```\n\nEach entity class holds a reference back to the account, so you can navigate the hierarchy fluently.\n\n## API Reference\n\n### 📕 Books\n\n```typescript\n// List all books (auto-paginated)\nconst books = await bookstack.getBooks();\n\n// Get a single book\nconst book = await bookstack.getBook(1);\n\n// Create a book\nconst newBook = await bookstack.createBook({\n  name: 'Engineering Docs',\n  description: 'Internal engineering documentation',\n  tags: [{ name: 'team', value: 'backend' }],\n});\n\n// Update & delete (via the domain object)\nconst updated = await book.update({ name: 'Updated Title' });\nawait book.delete();\n\n// Navigate to children\nconst chapters = await book.getChapters();\nconst pages = await book.getPages();\n\n// Export\nconst html = await book.export('html');       // string\nconst pdf = await book.export('pdf');          // Uint8Array\nconst markdown = await book.export('markdown'); // string\n```\n\n### 📂 Chapters\n\n```typescript\nconst chapters = await bookstack.getChapters();\nconst chapter = await bookstack.getChapter(1);\n\nconst newChapter = await bookstack.createChapter({\n  book_id: 1,\n  name: 'Architecture',\n  description: 'System architecture docs',\n});\n\n// Navigate to pages within this chapter\nconst pages = await chapter.getPages();\nconst page = await chapter.createPage({\n  name: 'Overview',\n  markdown: '# Architecture Overview',\n});\n\n// Export\nconst text = await chapter.export('plaintext');\n```\n\n### 📄 Pages\n\n```typescript\nconst pages = await bookstack.getPages();\nconst page = await bookstack.getPage(1);\n\n// Create in a book or chapter\nconst page1 = await bookstack.createPage({\n  book_id: 1,\n  name: 'Quick Start',\n  markdown: '# Getting Started\\n...',\n});\n\nconst page2 = await bookstack.createPage({\n  chapter_id: 3,\n  name: 'API Reference',\n  html: '<h1>API Reference</h1><p>...</p>',\n});\n\n// Update content\nconst updated = await page.update({\n  markdown: '# Updated Content',\n});\n\n// Comments\nconst comments = await page.getComments();\nawait page.addComment({ html: '<p>Looks good!</p>' });\n\n// Export\nconst md = await page.export('markdown');\n```\n\n### 📚 Shelves\n\n```typescript\nconst shelves = await bookstack.getShelves();\nconst shelf = await bookstack.getShelf(1);\n\nconst newShelf = await bookstack.createShelf({\n  name: 'Backend Services',\n  description: 'All backend service documentation',\n  books: [1, 2, 3], // Array of book IDs\n});\n\n// Get books on this shelf\nconst books = await shelf.getBooks();\n\n// Update book assignments\nawait shelf.update({ books: [1, 2, 3, 4] });\n```\n\n### 🔍 Search\n\n```typescript\nconst results = await bookstack.search('deployment guide');\n// Returns: IBookStackSearchResult[] with id, name, type, url, preview_html\n```\n\n### 📎 Attachments\n\n```typescript\nconst attachments = await bookstack.getAttachments();\nconst attachment = await bookstack.getAttachment(1);\n\n// Create a link attachment\nconst link = await bookstack.createAttachment({\n  name: 'External Reference',\n  uploaded_to: 1, // Page ID\n  link: 'https://example.com/docs',\n});\n\nawait bookstack.updateAttachment(1, { name: 'Renamed' });\nawait bookstack.deleteAttachment(1);\n```\n\n### 💬 Comments\n\n```typescript\nconst comments = await bookstack.getComments();\nconst comment = await bookstack.getComment(1);\n\nawait bookstack.createComment({\n  page_id: 1,\n  html: '<p>Great article!</p>',\n  reply_to: 2, // Reply to comment with local_id 2\n});\n\nawait bookstack.updateComment(1, { html: '<p>Updated comment</p>' });\nawait bookstack.deleteComment(1);\n```\n\n### 🖼️ Image Gallery\n\n```typescript\nconst images = await bookstack.getImages();\nconst image = await bookstack.getImage(1);\nawait bookstack.updateImage(1, { name: 'diagram-v2' });\nawait bookstack.deleteImage(1);\n```\n\n### 👥 Users & Roles\n\n```typescript\n// Users\nconst users = await bookstack.getUsers();\nconst user = await bookstack.getUser(1);\nconst newUser = await bookstack.createUser({\n  name: 'Jane Doe',\n  email: 'jane@example.com',\n  roles: [1, 2],\n  send_invite: true,\n});\nawait bookstack.updateUser(1, { name: 'Jane Smith' });\nawait bookstack.deleteUser(1, { migrate_ownership_id: 2 });\n\n// Roles\nconst roles = await bookstack.getRoles();\nconst role = await bookstack.getRole(1);\nawait bookstack.createRole({\n  display_name: 'Editor',\n  description: 'Can edit content',\n  permissions: ['page-update', 'chapter-update'],\n});\n```\n\n### 📊 Admin Endpoints\n\n```typescript\n// System info\nconst info = await bookstack.getSystemInfo();\n// { version, instance_id, app_name, base_url }\n\n// Audit log\nconst logs = await bookstack.getAuditLog();\n\n// Recycle bin\nconst deleted = await bookstack.getRecycleBinItems();\nawait bookstack.restoreRecycleBinItem(1);  // { restore_count: 3 }\nawait bookstack.destroyRecycleBinItem(1);  // { delete_count: 3 }\n\n// Content permissions\nconst perms = await bookstack.getContentPermissions('book', 1);\nawait bookstack.updateContentPermissions('book', 1, {\n  owner_id: 2,\n  role_permissions: [\n    { role_id: 1, view: true, create: true, update: true, delete: false },\n  ],\n  fallback_permissions: { inheriting: true },\n});\n```\n\n## Auto-Pagination\n\nAll list methods automatically paginate through results. BookStack uses offset-based pagination (max 500 per request). The client handles this transparently:\n\n```typescript\n// Gets ALL books, regardless of how many exist\nconst allBooks = await bookstack.getBooks();\n\n// Pass options to control pagination behavior\nconst firstPage = await bookstack.getBooks({ offset: 0, count: 10 });\n\n// Sort and filter\nconst filtered = await bookstack.getBooks({\n  sort: '+name',\n  filter: { 'name:like': '%Guide%' },\n});\n```\n\n## Exported Types\n\nAll interfaces are exported for use in your own code:\n\n```typescript\nimport type {\n  IBookStackBook,\n  IBookStackChapter,\n  IBookStackPage,\n  IBookStackShelf,\n  IBookStackAttachment,\n  IBookStackComment,\n  IBookStackUser,\n  IBookStackRole,\n  IBookStackSearchResult,\n  IBookStackTag,\n  IBookStackListParams,\n  TBookStackExportFormat,\n} from '@apiclient.xyz/bookstack';\n```\n\n## License and Legal Information\n\nThis repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [license](./license) file.\n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH or third parties, and are not included within the scope of the MIT license granted herein.\n\nUse of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.\n\n### Company Information\n\nTask Venture Capital GmbH\nRegistered at District Court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n","readmeFilename":"readme.md"}