Skip to content

Commit 12f204d

Browse files
authored
Refactor: Remove fetch wrapper and update Node.js engine requirement (#680)
1 parent 336bc5f commit 12f204d

37 files changed

+20123
-1045
lines changed

.github/workflows/pull-reqeust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
node-version: [ 16.x, 18.x, 20.x ]
17+
node-version: [ 18.x, 20.x, 24.x, 25.x ]
1818
name: Nodejs ${{ matrix.node-version }}
1919
steps:
2020
- uses: actions/checkout@v2

examples/README.md

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,33 @@ This directory contains examples of how to use the Nylas Node.js SDK to interact
44

55
## Examples
66

7+
### Node.js Examples
8+
79
- [Grants](./grants/README.md) - Examples of how to fetch, list, sort, and filter grants (authenticated connections to email/calendar providers).
810
- [Notetakers](./notetakers/README.md) - Examples of how to use the Nylas Notetakers API to invite a Notetaker bot to meetings, get recordings and transcripts, and more.
911
- [Messages](./messages/README.md) - Examples of how to use the Nylas Messages API to list, find, send, update messages, and work with new features like tracking options and raw MIME data.
1012
- [Folders](./folders/README.md) - Examples of how to use the Nylas Folders API, including the new `singleLevel` parameter for Microsoft accounts.
13+
- [Calendars](./calendars/README.md) - Examples of how to use the Nylas Calendar API to create and manage calendar events with Notetaker integration.
14+
15+
### Cloudflare Workers Examples
16+
17+
- [Cloudflare Vite Calendars](./cloudflare-vite-calendars/README.md) - Modern Cloudflare Workers example using Vite for building a calendar event manager. Showcases listing and creating events with a beautiful web interface.
18+
- [Edge Environment](./edge-environment/README.md) - Standard Cloudflare Workers example for sending email attachments. Demonstrates file upload handling and email sending on the edge.
19+
20+
### AWS Lambda Examples
21+
22+
- [AWS Lambda Attachments](./aws-lambda/README.md) - AWS Lambda example for sending email attachments using the Nylas SDK. Demonstrates how to handle multiple file uploads (including 2+ attachments over 3MB total) without Lambda freezing. Includes interactive setup CLI and Serverless Framework deployment.
23+
24+
### Module System Examples
25+
26+
- [ESM Only](./esm-only/) - Example of using the SDK with ES Modules
27+
- [CJS Only](./cjs-only/) - Example of using the SDK with CommonJS
1128

1229
## Running the Examples
1330

14-
To run these examples, you'll need to:
31+
### Node.js Examples
32+
33+
To run the Node.js examples, you'll need to:
1534

1635
1. Install dependencies:
1736
```bash
@@ -52,6 +71,76 @@ To run these examples, you'll need to:
5271
node dist/messages/messages.js
5372
```
5473

74+
### Cloudflare Workers Examples
75+
76+
The Cloudflare Workers examples are self-contained and have their own setup:
77+
78+
1. Navigate to the example directory:
79+
```bash
80+
cd examples/cloudflare-vite-calendars
81+
# or
82+
cd examples/edge-environment
83+
```
84+
85+
2. Install dependencies:
86+
```bash
87+
npm install
88+
```
89+
90+
3. Set up environment variables (see each example's README for details):
91+
```bash
92+
cp .dev.vars.example .dev.vars
93+
# Edit .dev.vars with your Nylas credentials
94+
```
95+
96+
4. Run the development server:
97+
```bash
98+
npm run dev
99+
```
100+
101+
5. Deploy to Cloudflare (optional):
102+
```bash
103+
npm run deploy
104+
```
105+
106+
Each Cloudflare example has its own comprehensive README with detailed instructions.
107+
108+
### AWS Lambda Examples
109+
110+
The AWS Lambda example is self-contained and has its own setup:
111+
112+
1. Navigate to the example directory:
113+
```bash
114+
cd examples/aws-lambda
115+
```
116+
117+
2. Run the interactive setup:
118+
```bash
119+
npm run setup
120+
```
121+
122+
This will guide you through:
123+
- Prerequisites checking
124+
- Nylas credentials configuration
125+
- AWS credentials setup
126+
- Environment variable configuration
127+
- Optional immediate deployment
128+
129+
3. Or set up manually:
130+
```bash
131+
npm install
132+
# Create .env file with your Nylas credentials
133+
# Configure AWS credentials
134+
npm run deploy
135+
```
136+
137+
4. Test the deployed function:
138+
- Visit the API Gateway URL displayed after deployment
139+
- Upload multiple files and send emails
140+
- Test with files totaling over 3MB to verify the bug fix
141+
142+
The AWS Lambda example includes a comprehensive README with detailed instructions and troubleshooting.
143+
55144
## Documentation
56145

57146
For more information, see the [Nylas API Documentation](https://developer.nylas.com/).

examples/aws-lambda/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules/
2+
dist/
3+
.env
4+
.serverless/
5+
*.log
6+
.DS_Store
7+
lambda-package.zip

0 commit comments

Comments
 (0)