nylas 6.11.0 → 6.11.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.
@@ -86,8 +86,9 @@ export default class Event extends RestfulModel {
86
86
  organizerEmail?: string;
87
87
  organizerName?: string;
88
88
  hideParticipants?: boolean;
89
- visibility?: string;
90
89
  customerEventId?: string;
90
+ private _visibility?;
91
+ private visibilityIsDirty;
91
92
  static collectionName: string;
92
93
  static attributes: Record<string, Attribute>;
93
94
  constructor(connection: NylasConnection, props?: EventProperties);
@@ -95,10 +96,13 @@ export default class Event extends RestfulModel {
95
96
  set start(val: string | number | undefined);
96
97
  get end(): string | number | undefined;
97
98
  set end(val: string | number | undefined);
99
+ get visibility(): string | undefined;
100
+ set visibility(val: string | undefined);
98
101
  deleteRequestQueryString(params?: Record<string, unknown>): Record<string, unknown>;
99
102
  save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
100
103
  saveRequestBody(): Record<string, unknown>;
101
- rsvp(status: string, comment: string, callback?: (error: Error | null, data?: Event) => void): Promise<Event>;
104
+ rsvp(status: string, comment?: string, callback?: (error: Error | null, data?: Event) => void): Promise<Event>;
102
105
  generateICS(options?: ICSOptions): Promise<string>;
106
+ fromJSON(json: Record<string, unknown>): this;
103
107
  private validate;
104
108
  }
@@ -49,7 +49,9 @@ var Event = /** @class */ (function (_super) {
49
49
  var _this = _super.call(this, connection, props) || this;
50
50
  _this.calendarId = '';
51
51
  _this.when = new when_1.default();
52
+ _this.visibilityIsDirty = false;
52
53
  _this.initAttributes(props);
54
+ _this.visibilityIsDirty = false;
53
55
  return _this;
54
56
  }
55
57
  Object.defineProperty(Event.prototype, "start", {
@@ -126,6 +128,19 @@ var Event = /** @class */ (function (_super) {
126
128
  enumerable: true,
127
129
  configurable: true
128
130
  });
131
+ Object.defineProperty(Event.prototype, "visibility", {
132
+ get: function () {
133
+ return this._visibility;
134
+ },
135
+ set: function (val) {
136
+ if (val !== this._visibility) {
137
+ this.visibilityIsDirty = true;
138
+ }
139
+ this._visibility = val;
140
+ },
141
+ enumerable: true,
142
+ configurable: true
143
+ });
129
144
  Event.prototype.deleteRequestQueryString = function (params) {
130
145
  if (params === void 0) { params = {}; }
131
146
  var qs = {};
@@ -148,7 +163,8 @@ var Event = /** @class */ (function (_super) {
148
163
  if (this.id && json.participants) {
149
164
  json.participants.forEach(function (participant) { return delete participant.status; });
150
165
  }
151
- if (this.visibility !== undefined && this.visibility === '') {
166
+ if ((this.visibility !== undefined && this.visibility === '') ||
167
+ !this.visibilityIsDirty) {
152
168
  delete json.visibility;
153
169
  }
154
170
  return json;
@@ -200,6 +216,11 @@ var Event = /** @class */ (function (_super) {
200
216
  return response.ics;
201
217
  });
202
218
  };
219
+ Event.prototype.fromJSON = function (json) {
220
+ var model = _super.prototype.fromJSON.call(this, json);
221
+ model.visibilityIsDirty = false;
222
+ return model;
223
+ };
203
224
  Event.prototype.validate = function () {
204
225
  if (this.conferencing &&
205
226
  this.conferencing.details &&
@@ -301,7 +322,8 @@ var Event = /** @class */ (function (_super) {
301
322
  modelKey: 'hideParticipants',
302
323
  jsonKey: 'hide_participants',
303
324
  }), visibility: attributes_1.default.String({
304
- modelKey: 'visibility',
325
+ modelKey: '_visibility',
326
+ jsonKey: 'visibility',
305
327
  }), customerEventId: attributes_1.default.String({
306
328
  modelKey: 'customerEventId',
307
329
  jsonKey: 'customer_event_id',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "6.11.0",
3
+ "version": "6.11.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",