nylas 6.4.2 → 6.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/lib/models/event-participant.js +0 -1
- package/lib/models/event.d.ts +10 -2
- package/lib/models/event.js +18 -0
- package/lib/models/job-status.d.ts +2 -0
- package/lib/models/job-status.js +3 -0
- package/lib/models/scheduler.d.ts +3 -0
- package/lib/models/scheduler.js +15 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
<a href="https://www.nylas.com/">
|
|
2
|
+
<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" />
|
|
3
|
+
</a>
|
|
4
|
+
|
|
1
5
|
# Nylas Node.js SDK
|
|
2
6
|
|
|
3
7
|
[](https://travis-ci.org/nylas/nylas-nodejs)
|
|
8
|
+
[](https://codecov.io/gh/nylas/nylas-nodejs)
|
|
4
9
|
|
|
5
10
|
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/).
|
|
6
11
|
|
|
@@ -13,7 +18,7 @@ Here are some resources to help you get started:
|
|
|
13
18
|
- [Nylas API Reference](https://developer.nylas.com/docs/api/)
|
|
14
19
|
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
## ⚙️ Install
|
|
17
22
|
|
|
18
23
|
To run 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.
|
|
19
24
|
|
|
@@ -30,7 +35,7 @@ cd nylas-nodejs
|
|
|
30
35
|
npm install
|
|
31
36
|
```
|
|
32
37
|
|
|
33
|
-
|
|
38
|
+
## ⚡️ Usage
|
|
34
39
|
|
|
35
40
|
Every resource (i.e., messages, events, contacts) is accessed via an instance of `Nylas`. Before making any requests, be sure to call `config` and initialize the `Nylas` instance with your `clientId` and `clientSecret`. Then, call `with` and pass it your `accessToken`. The `accessToken` allows `Nylas` to make requests for a given account's resources.
|
|
36
41
|
|
|
@@ -54,11 +59,11 @@ nylas.threads.list({}).then(threads => {
|
|
|
54
59
|
|
|
55
60
|
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/).
|
|
56
61
|
|
|
57
|
-
|
|
62
|
+
## 💙 Contributing
|
|
58
63
|
|
|
59
64
|
Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.
|
|
60
65
|
|
|
61
|
-
|
|
66
|
+
## 📝 License
|
|
62
67
|
|
|
63
68
|
This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE.txt) for the full terms.
|
|
64
69
|
|
package/lib/models/event.d.ts
CHANGED
|
@@ -37,13 +37,17 @@ export declare type EventProperties = {
|
|
|
37
37
|
timezone: string;
|
|
38
38
|
};
|
|
39
39
|
masterEventId?: string;
|
|
40
|
-
originalStartTime?:
|
|
40
|
+
originalStartTime?: Date;
|
|
41
41
|
capacity?: number;
|
|
42
42
|
conferencing?: EventConferencingProperties;
|
|
43
43
|
notifications?: EventNotificationProperties[];
|
|
44
44
|
roundRobinOrder?: string[];
|
|
45
45
|
metadata?: object;
|
|
46
46
|
jobStatusId?: string;
|
|
47
|
+
organizerEmail?: string;
|
|
48
|
+
organizerName?: string;
|
|
49
|
+
visibility?: string;
|
|
50
|
+
customerEventId?: string;
|
|
47
51
|
};
|
|
48
52
|
export default class Event extends RestfulModel {
|
|
49
53
|
calendarId: string;
|
|
@@ -64,7 +68,7 @@ export default class Event extends RestfulModel {
|
|
|
64
68
|
timezone: string;
|
|
65
69
|
};
|
|
66
70
|
masterEventId?: string;
|
|
67
|
-
originalStartTime?:
|
|
71
|
+
originalStartTime?: Date;
|
|
68
72
|
capacity?: number;
|
|
69
73
|
conferencing?: EventConferencing;
|
|
70
74
|
reminderMinutes?: string;
|
|
@@ -72,6 +76,10 @@ export default class Event extends RestfulModel {
|
|
|
72
76
|
roundRobinOrder?: string[];
|
|
73
77
|
metadata?: object;
|
|
74
78
|
jobStatusId?: string;
|
|
79
|
+
organizerEmail?: string;
|
|
80
|
+
organizerName?: string;
|
|
81
|
+
visibility?: string;
|
|
82
|
+
customerEventId?: string;
|
|
75
83
|
static collectionName: string;
|
|
76
84
|
static attributes: Record<string, Attribute>;
|
|
77
85
|
constructor(connection: NylasConnection, props?: EventProperties);
|
package/lib/models/event.js
CHANGED
|
@@ -143,6 +143,10 @@ var Event = /** @class */ (function (_super) {
|
|
|
143
143
|
if (!this.notifications) {
|
|
144
144
|
delete json.notifications;
|
|
145
145
|
}
|
|
146
|
+
// Participant status cannot be updated
|
|
147
|
+
if (this.id && json.participants) {
|
|
148
|
+
json.participants.forEach(function (participant) { return delete participant.status; });
|
|
149
|
+
}
|
|
146
150
|
return json;
|
|
147
151
|
};
|
|
148
152
|
Event.prototype.rsvp = function (status, comment, callback) {
|
|
@@ -273,6 +277,20 @@ var Event = /** @class */ (function (_super) {
|
|
|
273
277
|
modelKey: 'jobStatusId',
|
|
274
278
|
jsonKey: 'job_status_id',
|
|
275
279
|
readOnly: true,
|
|
280
|
+
}), organizerEmail: attributes_1.default.String({
|
|
281
|
+
modelKey: 'organizerEmail',
|
|
282
|
+
jsonKey: 'organizer_email',
|
|
283
|
+
readOnly: true,
|
|
284
|
+
}), organizerName: attributes_1.default.String({
|
|
285
|
+
modelKey: 'organizerName',
|
|
286
|
+
jsonKey: 'organizer_name',
|
|
287
|
+
readOnly: true,
|
|
288
|
+
}), visibility: attributes_1.default.String({
|
|
289
|
+
modelKey: 'visibility',
|
|
290
|
+
readOnly: true,
|
|
291
|
+
}), customerEventId: attributes_1.default.String({
|
|
292
|
+
modelKey: 'customerEventId',
|
|
293
|
+
jsonKey: 'customer_event_id',
|
|
276
294
|
}) });
|
|
277
295
|
return Event;
|
|
278
296
|
}(restful_model_1.default));
|
|
@@ -8,6 +8,7 @@ export declare type JobStatusProperties = {
|
|
|
8
8
|
jobStatusId?: string;
|
|
9
9
|
status?: string;
|
|
10
10
|
originalData?: Message;
|
|
11
|
+
metadata?: object;
|
|
11
12
|
};
|
|
12
13
|
export default class JobStatus extends RestfulModel implements JobStatusProperties {
|
|
13
14
|
action?: string;
|
|
@@ -15,6 +16,7 @@ export default class JobStatus extends RestfulModel implements JobStatusProperti
|
|
|
15
16
|
jobStatusId?: string;
|
|
16
17
|
status?: string;
|
|
17
18
|
originalData?: Message;
|
|
19
|
+
metadata?: object;
|
|
18
20
|
static collectionName: string;
|
|
19
21
|
static attributes: Record<string, Attribute>;
|
|
20
22
|
constructor(connection: NylasConnection, props?: JobStatusProperties);
|
package/lib/models/job-status.js
CHANGED
|
@@ -59,6 +59,9 @@ var JobStatus = /** @class */ (function (_super) {
|
|
|
59
59
|
modelKey: 'originalData',
|
|
60
60
|
jsonKey: 'original_data',
|
|
61
61
|
readOnly: true,
|
|
62
|
+
}), metadata: attributes_1.default.Object({
|
|
63
|
+
modelKey: 'metadata',
|
|
64
|
+
readOnly: true,
|
|
62
65
|
}) });
|
|
63
66
|
return JobStatus;
|
|
64
67
|
}(restful_model_1.default));
|
|
@@ -104,6 +104,7 @@ export declare type SchedulerBookingProperties = {
|
|
|
104
104
|
minBookingNotice?: number;
|
|
105
105
|
minBuffer?: number;
|
|
106
106
|
minCancellationNotice?: number;
|
|
107
|
+
intervalMinutes?: number;
|
|
107
108
|
nameFieldHidden?: boolean;
|
|
108
109
|
openingHours?: SchedulerBookingOpeningHoursProperties[];
|
|
109
110
|
schedulingMethod?: string;
|
|
@@ -120,6 +121,7 @@ export declare class SchedulerBooking extends Model implements SchedulerBookingP
|
|
|
120
121
|
minBookingNotice?: number;
|
|
121
122
|
minBuffer?: number;
|
|
122
123
|
minCancellationNotice?: number;
|
|
124
|
+
intervalMinutes?: number;
|
|
123
125
|
nameFieldHidden?: boolean;
|
|
124
126
|
openingHours?: SchedulerBookingOpeningHours[];
|
|
125
127
|
schedulingMethod?: string;
|
|
@@ -220,4 +222,5 @@ export default class Scheduler extends RestfulModel implements SchedulerProperti
|
|
|
220
222
|
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
221
223
|
getAvailableCalendars(): Promise<SchedulerAvailableCalendars[]>;
|
|
222
224
|
uploadImage(contentType: string, objectName: string): Promise<SchedulerUploadImageResponse>;
|
|
225
|
+
private validate;
|
|
223
226
|
}
|
package/lib/models/scheduler.js
CHANGED
|
@@ -178,7 +178,7 @@ var SchedulerBookingOpeningHours = /** @class */ (function (_super) {
|
|
|
178
178
|
return _this;
|
|
179
179
|
}
|
|
180
180
|
SchedulerBookingOpeningHours.attributes = {
|
|
181
|
-
|
|
181
|
+
accountId: attributes_1.default.String({
|
|
182
182
|
modelKey: 'accountId',
|
|
183
183
|
jsonKey: 'account_id',
|
|
184
184
|
}),
|
|
@@ -230,7 +230,7 @@ var SchedulerBooking = /** @class */ (function (_super) {
|
|
|
230
230
|
}),
|
|
231
231
|
confirmationEmailToHost: attributes_1.default.Boolean({
|
|
232
232
|
modelKey: 'confirmationEmailToHost',
|
|
233
|
-
jsonKey: '
|
|
233
|
+
jsonKey: 'confirmation_emails_to_host',
|
|
234
234
|
}),
|
|
235
235
|
confirmationMethod: attributes_1.default.String({
|
|
236
236
|
modelKey: 'confirmationMethod',
|
|
@@ -248,6 +248,10 @@ var SchedulerBooking = /** @class */ (function (_super) {
|
|
|
248
248
|
modelKey: 'minCancellationNotice',
|
|
249
249
|
jsonKey: 'min_cancellation_notice',
|
|
250
250
|
}),
|
|
251
|
+
intervalMinutes: attributes_1.default.Number({
|
|
252
|
+
modelKey: 'intervalMinutes',
|
|
253
|
+
jsonKey: 'interval_minutes',
|
|
254
|
+
}),
|
|
251
255
|
nameFieldHidden: attributes_1.default.Boolean({
|
|
252
256
|
modelKey: 'nameFieldHidden',
|
|
253
257
|
jsonKey: 'name_field_hidden',
|
|
@@ -356,6 +360,7 @@ var Scheduler = /** @class */ (function (_super) {
|
|
|
356
360
|
}
|
|
357
361
|
Scheduler.prototype.save = function (params, callback) {
|
|
358
362
|
if (params === void 0) { params = {}; }
|
|
363
|
+
this.validate();
|
|
359
364
|
return _super.prototype.save.call(this, params, callback);
|
|
360
365
|
};
|
|
361
366
|
Scheduler.prototype.getAvailableCalendars = function () {
|
|
@@ -396,6 +401,14 @@ var Scheduler = /** @class */ (function (_super) {
|
|
|
396
401
|
baseUrl: this.baseUrl,
|
|
397
402
|
});
|
|
398
403
|
};
|
|
404
|
+
Scheduler.prototype.validate = function () {
|
|
405
|
+
var _a, _b;
|
|
406
|
+
var bookingIntervalMinutes = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.booking) === null || _b === void 0 ? void 0 : _b.intervalMinutes;
|
|
407
|
+
if (bookingIntervalMinutes !== undefined &&
|
|
408
|
+
(bookingIntervalMinutes <= 0 || bookingIntervalMinutes % 5 != 0)) {
|
|
409
|
+
throw new Error('SchedulerBooking.intervalMinutes must be a non-zero positive integer, divisible by 5.');
|
|
410
|
+
}
|
|
411
|
+
};
|
|
399
412
|
Scheduler.collectionName = 'manage/pages';
|
|
400
413
|
Scheduler.attributes = __assign(__assign({}, restful_model_1.default.attributes), { accessTokens: attributes_1.default.StringList({
|
|
401
414
|
modelKey: 'accessTokens',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nylas",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1",
|
|
4
4
|
"description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
|
|
5
5
|
"main": "lib/nylas.js",
|
|
6
6
|
"types": "lib/nylas.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "jest",
|
|
12
|
+
"test:coverage": "npm run test -- --coverage",
|
|
12
13
|
"lint": "eslint --ext .js,.ts -f visualstudio .",
|
|
13
14
|
"lint:fix": "npm run lint -- --fix",
|
|
14
15
|
"lint:ci": "npm run lint:fix -- --quiet",
|