{"_id":"@dmitryrechkin/message-nylas","_rev":"1-798d1d90fc1d2211cee60184047d6d9a","name":"@dmitryrechkin/message-nylas","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@dmitryrechkin/message-nylas","version":"1.0.0","_id":"@dmitryrechkin/message-nylas@1.0.0","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"dist":{"shasum":"9cfea88e64a5aac985f1ec925b6b0dc053bc347f","tarball":"https://registry.npmjs.org/@dmitryrechkin/message-nylas/-/message-nylas-1.0.0.tgz","fileCount":23,"integrity":"sha512-uxuTRy9JhyNr2u3++9Wr4I/+UMOj8a10+z4iq6C5H1n1el4y/KoX7K1WrKiCzAQPHGVDPpOot5EO0uYk2IHgMA==","signatures":[{"sig":"MEUCIQDE7iUnlQNtZ11J7LoEK4+aitgysxd2zsVejchbQz59FgIgf92u2YkzzYxlrz9ifcFfVJGFhWSkVjNKcYvzF+UJO1Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74274},"main":"dist/index.js","type":"module","_from":"file:dmitryrechkin-message-nylas-1.0.0.tgz","types":"dist/index.d.ts","scripts":{"lint":"eslint .","test":"vitest run","build":"shx rm -rf dist && tsc && fix-esm-import-path dist","check":"tsc --noEmit","format":"eslint --fix .","package:publish":"pnpm publish --access public"},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"_resolved":"/private/var/folders/67/qcbb1q556vbfzygwbkm5glcr0000gn/T/50f9a4d96e0fa20e171f3d9438d599e4/dmitryrechkin-message-nylas-1.0.0.tgz","_integrity":"sha512-uxuTRy9JhyNr2u3++9Wr4I/+UMOj8a10+z4iq6C5H1n1el4y/KoX7K1WrKiCzAQPHGVDPpOot5EO0uYk2IHgMA==","_npmVersion":"10.8.2","description":"**Message Nylas is a TypeScript library that integrates with the Nylas API to manage messages, attachments, and webhooks.** This package provides a set of tools and actions to interact with Nylas messages, making it easy to send messages, handle webhooks,","directories":{},"_nodeVersion":"22.5.1","dependencies":{"zod":"^3.23.8","html-to-text":"^9.0.5","@dmitryrechkin/base64":"1.0.0","@dmitryrechkin/message-core":"^1.0.0","@dmitryrechkin/foundation-core":"^1.0.0","@dmitryrechkin/request-sender-core":"^1.0.0","@dmitryrechkin/request-sender-nylas":"^1.0.0","@dmitryrechkin/text-email-body-parser":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.3.4","dotenv":"^16.4.5","eslint":"^8.0.0","vitest":"^0.24.5","typescript":"^5.5.3","tsconfig-paths":"^4.2.0","@types/html-to-text":"^9.0.4","fix-esm-import-path":"^1.0.1","eslint-plugin-unused-imports":"^3.0.0","@dmitryrechkin/eslint-standard":"^1.0.7"},"_npmOperationalInternal":{"tmp":"tmp/message-nylas_1.0.0_1724876174736_0.601252379673191","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@dmitryrechkin/message-nylas","type":"module","version":"1.0.1","main":"dist/index.js","types":"dist/index.d.ts","devDependencies":{"@types/html-to-text":"^9.0.4","fix-esm-import-path":"^1.0.1","@dmitryrechkin/eslint-standard":"^1.0.7","dotenv":"^16.4.5","eslint":"^8.0.0","eslint-plugin-unused-imports":"^3.0.0","tsconfig-paths":"^4.2.0","typescript":"^5.5.3","vitest":"^0.24.5","shx":"^0.3.4"},"dependencies":{"zod":"^3.23.8","html-to-text":"^9.0.5","@dmitryrechkin/base64":"1.0.0","@dmitryrechkin/text-email-body-parser":"^1.0.0","@dmitryrechkin/foundation-core":"^1.0.0","@dmitryrechkin/message-core":"^1.0.1","@dmitryrechkin/request-sender-core":"^1.0.0","@dmitryrechkin/request-sender-nylas":"^1.0.0"},"scripts":{"lint":"eslint .","format":"eslint --fix .","test":"vitest run","check":"tsc --noEmit","build":"shx rm -rf dist && tsc && fix-esm-import-path dist","package:publish":"pnpm publish --access public"},"_id":"@dmitryrechkin/message-nylas@1.0.1","description":"**Message Nylas is a TypeScript library that integrates with the Nylas API to manage messages, attachments, and webhooks.** This package provides a set of tools and actions to interact with Nylas messages, making it easy to send messages, handle webhooks,","_integrity":"sha512-y1nXbVyLxE8Juarmwq+IgF70XVBZhSDVlW1OJ1WPoz2+UBenupxIUvkkEsKhmmS53fz1J+e4WWavOUkMEFE5gA==","_resolved":"/private/var/folders/67/qcbb1q556vbfzygwbkm5glcr0000gn/T/d3460e741a943558fa4906ed306c47fb/dmitryrechkin-message-nylas-1.0.1.tgz","_from":"file:dmitryrechkin-message-nylas-1.0.1.tgz","_nodeVersion":"22.5.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-y1nXbVyLxE8Juarmwq+IgF70XVBZhSDVlW1OJ1WPoz2+UBenupxIUvkkEsKhmmS53fz1J+e4WWavOUkMEFE5gA==","shasum":"71daa2d62a6dd856c618d32a5de64bb81fde739f","tarball":"https://registry.npmjs.org/@dmitryrechkin/message-nylas/-/message-nylas-1.0.1.tgz","fileCount":23,"unpackedSize":74279,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFieD6MrpBpuCbbL5PGU7T9RaKL4dKxfLNVq8x0o+BmUAiBfKdB86YLyXVxD6bfmPe5yXZVJKB23UHLvPcRpYM682w=="}]},"_npmUser":{"name":"dmitryrechkin","email":"rechkin@gmail.com"},"directories":{},"maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/message-nylas_1.0.1_1724989112870_0.35533457904960497"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-28T20:16:14.620Z","modified":"2024-08-30T03:38:33.173Z","1.0.0":"2024-08-28T20:16:14.919Z","1.0.1":"2024-08-30T03:38:33.010Z"},"description":"**Message Nylas is a TypeScript library that integrates with the Nylas API to manage messages, attachments, and webhooks.** This package provides a set of tools and actions to interact with Nylas messages, making it easy to send messages, handle webhooks,","maintainers":[{"name":"dmitryrechkin","email":"rechkin@gmail.com"}],"readme":"# Message Nylas\n\n**Message Nylas is a TypeScript library that integrates with the Nylas API to manage messages, attachments, and webhooks.** This package provides a set of tools and actions to interact with Nylas messages, making it easy to send messages, handle webhooks, and manage attachments within the Nylas ecosystem.\n\n## Installation\n\nInstall the package using pnpm:\n\n```bash\npnpm add @dmitryrechkin/message-nylas\n```\n\n## Features\n\n- **Message Management**: Send and manage messages within the Nylas platform.\n- **Attachment Handling**: Download and manage attachments associated with messages.\n- **Webhook Integration**: Seamlessly handle webhooks for incoming messages and other events.\n- **Nylas API Integration**: Directly interact with the Nylas API using platform-independent code, ensuring compatibility with serverless environments like Cloudflare Workers.\n- **Action-Based Design**: Perform specific message operations using dedicated actions, promoting clean and modular code.\n\n## Usage\n\n### Sending a Message\n\n```typescript\nimport { SendMessageAction } from '@dmitryrechkin/message-nylas';\nimport { NylasRequestSender } from '@dmitryrechkin/request-sender-nylas';\nimport { TypeNylasAuthentication } from '@dmitryrechkin/request-sender-nylas';\n\nconst auth: TypeNylasAuthentication = {\n    apiKey: 'your-nylas-api-key',\n    apiUrl: 'https://api.nylas.com',\n    grantId: 'your-grant-id'\n};\n\nconst nylasSender = new NylasRequestSender(auth);\nconst sendMessageAction = new SendMessageAction(nylasSender);\n\nconst messageData = {\n    to: ['recipient@example.com'],\n    subject: 'Meeting Reminder',\n    body: 'This is a reminder for our meeting tomorrow at 10 AM.'\n};\n\nconst response = await sendMessageAction.execute(messageData);\nconsole.log('Sent message ID:', response.data?.id);\n```\n\n### Handling a Webhook\n\n```typescript\nimport { HandleMessageWebhookAction } from '@dmitryrechkin/message-nylas';\nimport { NylasRequestSender } from '@dmitryrechkin/request-sender-nylas';\n\nconst nylasSender = new NylasRequestSender(auth);\nconst handleWebhookAction = new HandleMessageWebhookAction(nylasSender);\n\nconst webhookData = {\n    message_id: 'message-id',\n    event: 'message.created',\n    payload: {/* webhook payload */}\n};\n\nconst response = await handleWebhookAction.execute(webhookData);\nconsole.log('Handled webhook for message ID:', webhookData.message_id);\n```\n\n### Downloading an Attachment\n\n```typescript\nimport { DownloadAttachmentAction } from '@dmitryrechkin/message-nylas';\nimport { NylasRequestSender } from '@dmitryrechkin/request-sender-nylas';\n\nconst nylasSender = new NylasRequestSender(auth);\nconst downloadAttachmentAction = new DownloadAttachmentAction(nylasSender);\n\nconst attachmentData = {\n    attachment_id: 'attachment-id',\n};\n\nconst response = await downloadAttachmentAction.execute(attachmentData);\nconsole.log('Downloaded attachment:', response.data);\n```\n\n## When to Use\n\n`Message Nylas` is perfect for applications that need to integrate with Nylas for managing messages, handling webhooks, and processing attachments. It provides a clean, action-based API that simplifies the complexities of interacting with Nylas, allowing you to focus on building features rather than managing API calls.\n\n## Installation & Setup\n\nInstall the package using pnpm:\n\n```bash\npnpm add @dmitryrechkin/message-nylas\n```\n\nEnsure your project is set up to handle TypeScript and supports ES modules, as this library is built with modern JavaScript standards.\n\n## Rationale\n\n### Platform Independence for Serverless Environments\n\nThe `Message Nylas` library was created to address the limitations of the original Nylas package, which depends heavily on Node.js-specific modules, making it incompatible with serverless environments such as Cloudflare Workers. This library is platform-independent, ensuring that it can be used in serverless platforms without any issues, making it an ideal choice for modern cloud-based applications.\n\n### Action-Based Design for Clean Code\n\nThe `Message Nylas` library is designed with an action-based approach, meaning each message operation is encapsulated within a specific action class. This design promotes clean, modular code, making it easier to maintain and extend your application.\n\n- **Focused Actions**: Each action class focuses on a specific operation, such as sending messages or handling webhooks, making your code more readable and maintainable.\n- **Seamless Integration**: By leveraging the `NylasRequestSender` class from `Request Sender Nylas`, you can easily handle authentication and request sending without writing boilerplate code.\n- **Scalable and Extensible**: The action-based architecture allows you to easily add new message-related features as your application grows.\n\n## Contributing\n\nContributions are welcome! Feel free to fork this project and submit pull requests. Before submitting, please ensure your code passes all linting and unit tests.\n\nYou can run unit tests using:\n\n```bash\npnpm test\n```","readmeFilename":"README.md"}