Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nylas

Package Overview
Dependencies
Maintainers
11
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nylas - npm Package Compare versions

Comparing version 7.0.0-canary.4 to 7.0.0

lib/cjs/apiClient.js

76

package.json
{
"name": "nylas",
"version": "7.0.0-canary.4",
"version": "7.0.0",
"description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
"main": "lib/nylas.js",
"types": "lib/nylas.d.ts",
"main": "lib/cjs/nylas.js",
"types": "lib/types/nylas.d.ts",
"module": "lib/esm/nylas.js",
"files": [
"lib"
],
"engines": {
"node": ">=16"
},
"scripts": {
"test": "jest",
"test:coverage": "npm run test -- --coverage",
"lint": "eslint --ext .js,.ts -f visualstudio .",

@@ -17,21 +22,12 @@ "lint:fix": "npm run lint -- --fix",

"lint:prettier:check": "prettier --check '**/*.{ts,js}'",
"build": "tsc",
"export-version": "node scripts/exportVersion.js",
"generate-lib-package-json": "node scripts/generateLibPackageJson.js",
"prebuild": "npm run export-version",
"build": "rm -rf lib && npm run build-esm && npm run build-cjs && npm run generate-lib-package-json",
"build-esm": "tsc -p tsconfig.esm.json",
"build-cjs": "tsc -p tsconfig.cjs.json",
"prepare": "npm run build",
"watch": "nodemon -w src --exec npm run build"
"build:docs": "typedoc --out docs",
"version": "npm run export-version && git add src/version.ts"
},
"jest": {
"preset": "ts-jest/presets/js-with-ts",
"globals": {
"ts-jest": {
"tsConfig": "tsconfig.test.json"
}
},
"coverageThreshold": {
"global": {
"functions": 80,
"lines": 80,
"statements": 80
}
}
},
"keywords": [

@@ -46,26 +42,17 @@ "email",

"dependencies": {
"abort-controller": "^3.0.0",
"backoff": "^2.5.0",
"change-case": "^4.1.2",
"eslint-plugin-import": "^2.28.1",
"form-data": "^4.0.0",
"JSONStream": "^1.3.5",
"node-fetch": "^2.6.1",
"express": "^4.17.13",
"body-parser": "^1.20.0",
"uuid": "^8.3.2",
"websocket": "^1.0.34"
"mime-types": "^2.1.35",
"node-fetch": "^2.6.12",
"uuid": "^8.3.2"
},
"devDependencies": {
"@babel/cli": "^7.13.16",
"@babel/core": "^7.3.3",
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
"@babel/preset-env": "^7.3.1",
"@types/backoff": "^2.5.1",
"@types/jest": "^25.1.4",
"@types/node-fetch": "^2.5.8",
"@types/jest": "^29.5.2",
"@types/mime-types": "^2.1.2",
"@types/node-fetch": "^2.6.4",
"@types/uuid": "^8.3.4",
"@types/websocket": "^1.0.5",
"@types/express": "^4.17.13",
"@typescript-eslint/eslint-plugin": "^2.25.0",
"@typescript-eslint/parser": "^2.25.0",
"babel-eslint": "^10.0.1",
"eslint": "^5.14.0",

@@ -75,7 +62,9 @@ "eslint-config-prettier": "^4.0.0",

"eslint-plugin-prettier": "^3.0.1",
"jest": "^24.9.0",
"eslint-plugin-import": "^2.28.1",
"jest": "^29.6.1",
"prettier": "^1.19.1",
"pretty-format": "^25.2.6",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
"ts-jest": "^29.1.1",
"typedoc": "^0.24.8",
"typedoc-plugin-rename-defaults": "^0.6.5",
"typescript": "^4.9.5"
},

@@ -85,3 +74,8 @@ "repository": {

"url": "https://github.com/nylas/nylas-nodejs.git"
},
"exports": {
"import": "./lib/esm/nylas.js",
"require": "./lib/cjs/nylas.js",
"types": "./lib/types/nylas.d.ts"
}
}

@@ -0,6 +1,12 @@

<a href="https://www.nylas.com/">
<img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" />
</a>
# Nylas Node.js SDK
[![Travis build status](https://travis-ci.org/nylas/nylas-nodejs.svg?branch=master)](https://travis-ci.org/nylas/nylas-nodejs)
[![npm](https://img.shields.io/npm/v/nylas)
](https://www.npmjs.com/package/nylas)
[![codecov](https://codecov.io/gh/nylas/nylas-nodejs/branch/main/graph/badge.svg?token=94IMGU4F09)](https://codecov.io/gh/nylas/nylas-nodejs)
This is the GitHub repository for the Nylas Node SDK and this repo is primarily for anyone who wants to make contributions to the SDK or install it from source. If you are looking to use Node to access the Nylas Email, Calendar, or Contacts API you should refer to our official [Node SDK Quickstart Guide](https://developer.nylas.com/docs/developer-tools/sdk/node-sdk/).
This is the GitHub repository for the Nylas Node SDK. This repo is primarily for anyone who wants to make contributions to the SDK, or install it from source. If you are looking to use Node to access the Nylas Email, Calendar, or Contacts API you should refer to our official [Node SDK Quickstart Guide](https://developer.nylas.com/docs/developer-tools/sdk/node-sdk/).

@@ -11,16 +17,24 @@ The Nylas Communications Platform provides REST APIs for [Email](https://developer.nylas.com/docs/connectivity/email/), [Calendar](https://developer.nylas.com/docs/connectivity/calendar/), and [Contacts](https://developer.nylas.com/docs/connectivity/contacts/), and the Node SDK is the quickest way to build your integration using JavaScript.

- [Nylas SDK Tutorials](https://developer.nylas.com/docs/the-basics/tutorials/nodejs/)
- [Quickstart](https://developer.nylas.com/docs/the-basics/quickstart/)
- [Sign up for your free Nylas account](https://dashboard.nylas.com/register)
- [Sign up for the Nylas v3 Beta program to access the v3 Dashboard](https://info.nylas.com/apiv3betasignup.html?utm_source=github&utm_medium=devrel-surfaces&utm_campaign=&utm_content=node-sdk-upgrade)
- [Nylas API v3 Quickstart Guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/)
- [Nylas SDK Reference](https://nylas-nodejs-sdk-reference.pages.dev/)
- [Nylas API Reference](https://developer.nylas.com/docs/api/)
- [Nylas Samples repo for code samples and example applications](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=javascript)
## ⚙️ Install
# Install
**Note:** The Nylas Node SDK requires Node.js v16 or later.
To install the Nylas Node SDK, you will first need to have [Node](https://nodejs.org/en/download/) and [npm](https://www.npmjs.com/get-npm) installed on your machine.
### Set up using npm
To run the Nylas Node SDK, first install [Node](https://nodejs.org/en/download/) and [npm](https://www.npmjs.com/get-npm) on your machine.
Then, head to the nearest command line and run the following:
`npm install nylas`
Alternatively, if you prefer to use [Yarn](https://yarnpkg.com/en/), you can install the Nylas Node SDK with `yarn add nylas`
Alternatively, you can use [Yarn](https://yarnpkg.com/en/) to install the Nylas Node SDK by running the `yarn add nylas` command.
### Build from source
To install this package from source, clone this repo and run `npm install` from inside the project directory.

@@ -34,38 +48,46 @@

# Usage
## ⚡️ Usage
The SDK entrypoint and application resources (i.e., application accounts, authentication, webhooks) is accessed via an instance of `Nylas`. You can initialize a `Nylas` instance with your `clientId` and `clientSecret`.
To use this SDK, you must first [get a free Nylas account](https://dashboard.nylas.com/register).
```javascript
const Nylas = require('nylas');
Then, follow the Quickstart guide to [set up your first app and get your API keys](https://developer.nylas.com/docs/v3-beta/v3-quickstart/).
const nylasClient = new Nylas({
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
For code examples that demonstrate how to use this SDK, take a look at our [Node repos in the Nylas Samples collection](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=javascript&sort=).
### 🚀 Making Your First Request
You access Nylas resources (messages, calendars, events, contacts) through an instance of `Nylas`. The `Nylas` object must be initialized with your Nylas API key, and you can provide other additional configurations such as the Nylas API url and the timeout.
```typescript
import Nylas from "nylas";
const nylas = new Nylas({
apiKey: "NYLAS_API_KEY",
});
```
Every account resource (i.e., messages, events, contacts) is accessed via an instance of `NylasConnection`. To initialize an instance of `NylasConnection`, call `with` on your `Nylas` instance and pass it your `accessToken`.
Once initialized you can use the object to make requests for a given account's resources, for example to list all the calendars for a given account:
```javascript
const nylasConnection = nylasClient.with(ACCESS_TOKEN);
```
Then, you can use Nylas to access information about a user's account:
```javascript
nylasConnection.threads.list().then(threads => {
console.log(threads.length);
```typescript
nylas.calendars.list({ identifier: "GRANT_ID" }).then(calendars => {
console.log(calendars);
});
```
For more information about how to use the Nylas Node SDK, [take a look at our quickstart guide](https://developer.nylas.com/docs/developer-tools/sdk/node-sdk/).
## 📚 Documentation
# Contributing
Nylas maintains a [reference guide for the Node SDK](https://nylas-nodejs-sdk-reference.pages.dev/) to help you get familiar with the available methods and classes.
Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.
## ✨ Upgrading from 6.x
# License
See [UPGRADE.md](UPGRADE.md) for instructions on upgrading from 6.x to 7.x.
This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE.txt) for the full terms.
**Note**: The Node SDK v7.x is not compatible with the Nylas API earlier than v3-beta.
## 💙 Contributing
Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.
## 📝 License
This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE.txt) for the full terms.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc