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

nylas

Package Overview
Dependencies
Maintainers
5
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 5.3.0 to 5.3.1

lib/config.d.ts

5

CHANGELOG.md
# Changelog
### 5.3.1 / 2020-11-20
* Drop async dependency for smaller package fingerprint. Async is replaced with promises.
* Remove circular dependency in nylas-connection.ts
* Update readme with syntax highlighting
### 5.3.0 / 2020-09-23

@@ -4,0 +9,0 @@ * Fix bug where setting event.start and event.end did not set event.when if event.when didn't exist

0

lib/models/account.d.ts

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from "./restful-model";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Calendar from './calendar';

@@ -0,0 +0,0 @@ import RestfulModel, { SaveCallback } from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import NylasConnection from '../nylas-connection';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Contact } from './contact';

@@ -0,0 +0,0 @@ import RestfulModel, { SaveCallback } from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Message from './message';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel, { SaveCallback } from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel, { SaveCallback } from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ManagementModel from './management-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ManagementModel from './management-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel, { SaveCallback } from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import RestfulModel from './restful-model';

@@ -0,0 +0,0 @@ "use strict";

8

lib/models/restful-model-collection.d.ts

@@ -10,3 +10,3 @@ import NylasConnection from '../nylas-connection';

[key: string]: any;
} | undefined, eachCallback: (item: T) => void, completeCallback?: (err?: Error | null | undefined) => void): void | Promise<never>;
} | undefined, eachCallback: (item: T) => void, completeCallback?: (err?: Error | null | undefined) => void): Promise<never> | undefined;
count(params?: {

@@ -20,3 +20,3 @@ [key: string]: any;

[key: string]: any;
}, callback?: (error: Error | null, obj?: T[]) => void): Promise<T[]>;
}, callback?: (error: Error | null, obj?: T[]) => void): Promise<void | T[]>;
find(id: string, paramsArg?: {

@@ -29,3 +29,3 @@ [key: string]: any;

[key: string]: any;
}, callback?: (error: Error | null) => void): Promise<T[]>;
}, callback?: (error: Error | null) => void): Promise<void | T[]>;
delete(itemOrId: T | string, params?: {

@@ -49,3 +49,3 @@ [key: string]: any;

path?: string;
}): Promise<T[]>;
}): Promise<void | T[]>;
_getItems(params: {

@@ -52,0 +52,0 @@ [key: string]: any;

@@ -17,3 +17,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var async_1 = __importDefault(require("async"));
var message_1 = __importDefault(require("./message"));

@@ -45,4 +44,3 @@ var nylas_connection_1 = __importDefault(require("../nylas-connection"));

var offset = 0;
var finished = false;
return async_1.default.until(function () { return finished; }, function (callback) {
var iteratee = function () {
return _this._getItems(params, offset, REQUEST_CHUNK_SIZE).then(function (items) {

@@ -54,5 +52,12 @@ for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {

offset += items.length;
finished = items.length < REQUEST_CHUNK_SIZE;
return callback();
var finished = items.length < REQUEST_CHUNK_SIZE;
if (finished === false) {
return iteratee();
}
});
};
iteratee().then(function () {
if (completeCallback) {
completeCallback();
}
}, function (err) {

@@ -249,31 +254,26 @@ if (completeCallback) {

var _b = _a.params, params = _b === void 0 ? {} : _b, _c = _a.offset, offset = _c === void 0 ? 0 : _c, _d = _a.limit, limit = _d === void 0 ? 100 : _d, callback = _a.callback, path = _a.path;
return new Promise(function (resolve, reject) {
var accumulated = [];
var finished = false;
return async_1.default.until(function () { return finished; }, function (chunkCallback) {
var chunkOffset = offset + accumulated.length;
var chunkLimit = Math.min(REQUEST_CHUNK_SIZE, limit - accumulated.length);
return _this._getItems(params, chunkOffset, chunkLimit, path)
.then(function (items) {
accumulated = accumulated.concat(items);
finished =
items.length < REQUEST_CHUNK_SIZE ||
accumulated.length >= limit;
return chunkCallback();
})
.catch(function (err) { return reject(err); });
}, function (err) {
if (err) {
if (callback) {
callback(err);
}
return reject(err);
var accumulated = [];
var iteratee = function () {
var chunkOffset = offset + accumulated.length;
var chunkLimit = Math.min(REQUEST_CHUNK_SIZE, limit - accumulated.length);
return _this._getItems(params, chunkOffset, chunkLimit, path).then(function (items) {
accumulated = accumulated.concat(items);
var finished = items.length < REQUEST_CHUNK_SIZE || accumulated.length >= limit;
if (finished === false) {
return iteratee();
}
else {
if (callback) {
callback(null, accumulated);
}
return resolve(accumulated);
}
});
};
// do not return rejected promise when callback is provided
// to prevent unhandled rejection warning
return iteratee().then(function () {
if (callback) {
return callback(null, accumulated);
}
return accumulated;
}, function (err) {
if (callback) {
return callback(err);
}
throw err;
});

@@ -280,0 +280,0 @@ };

@@ -0,0 +0,0 @@ import NylasConnection from '../nylas-connection';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Attribute } from './attributes';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Message from './message';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import ManagementModel from './management-model';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import request from 'request';

@@ -16,4 +16,12 @@ "use strict";

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var request_1 = __importDefault(require("request"));
var config = __importStar(require("./config"));
var restful_model_collection_1 = __importDefault(require("./models/restful-model-collection"));

@@ -60,3 +68,2 @@ var calendar_restful_model_collection_1 = __importDefault(require("./models/calendar-restful-model-collection"));

options = __assign({}, options);
var Nylas = require('./nylas');
if (!options.method) {

@@ -67,3 +74,3 @@ options.method = 'GET';

if (!options.url) {
options.url = "" + Nylas.apiServer + options.path;
options.url = "" + config.apiServer + options.path;
}

@@ -91,3 +98,3 @@ }

var user = options.path.substr(0, 3) === '/a/'
? Nylas.clientSecret
? config.clientSecret
: this.accessToken;

@@ -94,0 +101,0 @@ if (user) {

@@ -10,13 +10,13 @@ import NylasConnection from './nylas-connection';

static clientId: string;
static clientSecret: string;
static apiServer?: string | null;
static get clientSecret(): string;
static set clientSecret(newClientSecret: string);
static get apiServer(): string | null;
static set apiServer(newApiServer: string | null);
static accounts?: ManagementModelCollection<ManagementAccount> | RestfulModelCollection<Account>;
static connect?: Connect;
static webhooks?: ManagementModelCollection<Webhook>;
static config({ clientId, clientSecret, apiServer, appId, appSecret }: {
static config({ clientId, clientSecret, apiServer, }: {
clientId: string;
clientSecret: string;
apiServer?: string;
appId?: string;
appSecret?: string;
}): typeof Nylas;

@@ -23,0 +23,0 @@ static clientCredentials(): boolean;

@@ -5,3 +5,11 @@ "use strict";

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var request_1 = __importDefault(require("request"));
var config = __importStar(require("./config"));
var nylas_connection_1 = __importDefault(require("./nylas-connection"));

@@ -17,4 +25,24 @@ var management_account_1 = __importDefault(require("./models/management-account"));

}
Object.defineProperty(Nylas, "clientSecret", {
get: function () {
return config.clientSecret;
},
set: function (newClientSecret) {
config.setClientSecret(newClientSecret);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Nylas, "apiServer", {
get: function () {
return config.apiServer;
},
set: function (newApiServer) {
config.setApiServer(newApiServer);
},
enumerable: true,
configurable: true
});
Nylas.config = function (_a) {
var clientId = _a.clientId, clientSecret = _a.clientSecret, apiServer = _a.apiServer, appId = _a.appId, appSecret = _a.appSecret;
var clientId = _a.clientId, clientSecret = _a.clientSecret, apiServer = _a.apiServer;
if (apiServer && apiServer.indexOf('://') === -1) {

@@ -65,7 +93,9 @@ throw new Error('Please specify a fully qualified URL for the API Server.');

var connection = new nylas_connection_1.default(null, { clientId: this.clientId });
var requestOptions = { path: "/a/" + this.clientId };
var requestOptions = {
path: "/a/" + this.clientId,
};
if (options) {
requestOptions.body = {
application_name: options.applicationName || options.application_name,
redirect_uris: options.redirectUris || options.redirect_uris
redirect_uris: options.redirectUris || options.redirect_uris,
};

@@ -139,6 +169,4 @@ requestOptions.method = 'PUT';

Nylas.clientId = '';
Nylas.clientSecret = '';
Nylas.apiServer = null;
return Nylas;
}());
module.exports = Nylas;

@@ -0,0 +0,0 @@ The MIT License (MIT)

{
"name": "nylas",
"version": "5.3.0",
"version": "5.3.1",
"description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",

@@ -47,3 +47,2 @@ "main": "lib/nylas.js",

"JSONStream": "^1.3.5",
"async": "^2.6.2",
"backoff": "^2.5.0",

@@ -57,3 +56,2 @@ "request": "^2.88.0"

"@babel/preset-env": "^7.3.1",
"@types/async": "^3.0.8",
"@types/backoff": "^2.5.1",

@@ -60,0 +58,0 @@ "@types/jest": "^25.1.4",

@@ -28,3 +28,3 @@ # Nylas Node.js SDK

```
```bash
git clone https://github.com/nylas/nylas-nodejs.git

@@ -38,3 +38,3 @@ cd nylas-nodejs

```
```javascript
const Nylas = require('nylas');

@@ -51,3 +51,3 @@

Then, you can use Nylas to access information about a user's account:
```
```javascript
nylas.threads.list({}).then(threads => {

@@ -54,0 +54,0 @@ console.log(threads.length);

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