{"_id":"@4lph4/nolog-core","_rev":"2-4f74b7d2450fd96c62c4f927a1424059","name":"@4lph4/nolog-core","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@4lph4/nolog-core","version":"1.0.0","_id":"@4lph4/nolog-core@1.0.0","maintainers":[{"name":"4lph4","email":"alpha030520@gmail.com"}],"dist":{"shasum":"116404c53ee84377d0fb98e27d404e51c980bc05","tarball":"https://registry.npmjs.org/@4lph4/nolog-core/-/nolog-core-1.0.0.tgz","fileCount":6,"integrity":"sha512-xvhlKaXvNI++2oxE1WekUJk7JJnGwk+E5FUv3QrGXYH/qRh0v4rooqo3cNfiZSWzh7XbpqixIE0MxtzQWlb2YA==","signatures":[{"sig":"MEUCIEsOZoc74km5ruHqlD3fvl2jAwJPUsxGiQ3cYAIYDEG0AiEAjMA4m1nretwWPj26wwb8teRUexBdswPTvGmXnbfd6vk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19962},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"d075a2ac7854477e0e1e517c64bcfa2216233fef","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","build":"tsup src/index.ts --format cjs,esm --dts"},"_npmUser":{"name":"4lph4","email":"alpha030520@gmail.com"},"_npmVersion":"11.8.0","description":"Core Notion SDK for NoLog.","directories":{},"_nodeVersion":"24.13.1","dependencies":{"@notionhq/client":"^5.20.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nolog-core_1.0.0_1777911721126_0.058180419237855885","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@4lph4/nolog-core","version":"1.0.1","description":"Core Notion SDK for NoLog.","main":"dist/index.js","module":"dist/index.mjs","types":"dist/index.d.ts","scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","dev":"tsup src/index.ts --format cjs,esm --dts --watch"},"dependencies":{"@notionhq/client":"^5.20.0"},"devDependencies":{"typescript":"^5.0.0","tsup":"^8.0.0"},"gitHead":"c325c3bd760f62b2de206c9e04fa48286ddd749d","_id":"@4lph4/nolog-core@1.0.1","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-RW02J/VA0NFhnIPDSjI6kGaodPX3H/ozSQSNzRE+5qTouNJM4i7bohD4m9eJkidnQnYKiQgKanHUTVfRjGX6EQ==","shasum":"cc1169ba59f23adad408f26aa5d24578f05a7b0a","tarball":"https://registry.npmjs.org/@4lph4/nolog-core/-/nolog-core-1.0.1.tgz","fileCount":6,"unpackedSize":19962,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICTmSwMtRKIRwxoQJeLebl8Hn8G5lVa8BMMnHXb2/YIMAiEA1ODtR+p7Ag74JrH0fefP0IJuqg9B4DdrxV8RZ2rQKGE="}]},"_npmUser":{"name":"4lph4","email":"alpha030520@gmail.com"},"directories":{},"maintainers":[{"name":"4lph4","email":"alpha030520@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nolog-core_1.0.1_1777915736491_0.022545501368584464"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-04T16:22:01.009Z","modified":"2026-05-04T17:28:56.768Z","1.0.0":"2026-05-04T16:22:01.268Z","1.0.1":"2026-05-04T17:28:56.642Z"},"description":"Core Notion SDK for NoLog.","maintainers":[{"name":"4lph4","email":"alpha030520@gmail.com"}],"readme":"# @4lph4/nolog-core\r\n\r\nThe core engine for the [NoLog](https://github.com/your-username/nolog) project. This package provides a pure, backend-compatible TypeScript SDK for interacting with a Notion database specifically configured for NoLog.\r\n\r\nThis library decouples the Notion API fetching and data mapping logic from the Next.js presentation layer, allowing you to use the NoLog engine in any Node.js environment (e.g., NestJS, Express, raw Node.js scripts).\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @4lph4/nolog-core\r\n```\r\n\r\n*(Note: Ensure you have your Notion Integration Token and Database ID ready.)*\r\n\r\n## Features\r\n\r\n- **Pure TypeScript:** No dependencies on React or Next.js.\r\n- **Built-in Type Definitions:** Provides the exact `Post` interface expected by NoLog frontends.\r\n- **Bypasses SDK Bugs:** Uses a direct REST API fallback for database queries to bypass known bugs in the official `@notionhq/client` (v5.20) regarding inline databases.\r\n\r\n## Usage\r\n\r\n### 1. Initialize the Client\r\n\r\n```typescript\r\nimport { NologClient } from '@4lph4/nolog-core';\r\n\r\nconst nolog = new NologClient({\r\n  token: 'ntn_your_notion_integration_token',\r\n  databaseId: 'your_notion_database_id',\r\n  // Optional: Pass custom fetch options (e.g., for Next.js caching)\r\n  // fetchOptions: { next: { revalidate: 60 } }\r\n});\r\n```\r\n\r\n### 2. Fetch Posts\r\n\r\n```typescript\r\nasync function fetchMyPosts() {\r\n  // Returns an array of mapped Post objects\r\n  const posts = await nolog.getPosts();\r\n  console.log(`Found ${posts.length} public posts.`);\r\n}\r\n```\r\n\r\n### 3. Fetch a Single Post\r\n\r\n```typescript\r\nasync function fetchSinglePost(pageId: string) {\r\n  // Returns a Post object or null if not found/not public\r\n  const post = await nolog.getPost(pageId);\r\n  console.log(post?.title);\r\n}\r\n```\r\n\r\n### 4. Fetch Categories\r\n\r\n```typescript\r\nasync function fetchUniqueCategories() {\r\n  // Returns an array of unique category strings used across all posts\r\n  const categories = await nolog.getCategories();\r\n  console.log(categories);\r\n}\r\n```\r\n\r\n### 5. Fetch Blocks (Content)\r\n\r\n```typescript\r\nasync function fetchPostContent(pageId: string) {\r\n  // Returns an array of Notion Block objects for rendering\r\n  const blocks = await nolog.getBlocks(pageId);\r\n  console.log(blocks);\r\n}\r\n```\r\n\r\n## Types\r\n\r\nThe SDK provides the `Post` interface which represents a mapped Notion page:\r\n\r\n```typescript\r\nexport interface Post {\r\n  id: string;\r\n  title: string;\r\n  summary: string;\r\n  thumbnail: string | null;\r\n  category: string;\r\n  tags: string[];\r\n  author: string;\r\n  createDate: string;\r\n  editDate: string;\r\n  status: string;\r\n}\r\n```\r\n\r\n## Contributing\r\n\r\nThis package is part of the NoLog monorepo. Changes to the core logic should be made within the `packages/core` directory.\r\n","readmeFilename":"README.md"}