Comparing version 6.2.0 to 6.2.1
import Model from './model'; | ||
import RestfulModel from './restful-model'; | ||
declare type AnyModel = new (...args: any[]) => Model; | ||
export declare abstract class Attribute { | ||
@@ -21,3 +21,3 @@ modelKey: string; | ||
jsonKey?: string; | ||
itemClass?: typeof Model | typeof RestfulModel; | ||
itemClass?: AnyModel; | ||
readOnly?: boolean; | ||
@@ -62,8 +62,8 @@ }); | ||
jsonKey?: string; | ||
itemClass: typeof Model | typeof RestfulModel; | ||
itemClass: AnyModel; | ||
readOnly?: boolean; | ||
}); | ||
toJSON(vals: any, saveRequestBody?: boolean): unknown[]; | ||
fromJSON(json: unknown[], _parent: any): typeof Model[] | typeof RestfulModel[] | unknown[]; | ||
saveRequestBody(val: any): unknown; | ||
toJSON(vals: any, saveRequestBody?: boolean): AnyModel[]; | ||
fromJSON(json: unknown[], _parent: any): AnyModel[]; | ||
saveRequestBody(val: any): AnyModel[] | undefined; | ||
} | ||
@@ -126,3 +126,3 @@ declare class AttributeEnum extends Attribute { | ||
jsonKey?: string | undefined; | ||
itemClass: typeof Model | typeof RestfulModel; | ||
itemClass: AnyModel; | ||
readOnly?: boolean | undefined; | ||
@@ -138,3 +138,3 @@ }): AttributeCollection; | ||
jsonKey?: string | undefined; | ||
itemClass?: typeof Model | typeof RestfulModel | undefined; | ||
itemClass?: AnyModel | undefined; | ||
readOnly?: boolean | undefined; | ||
@@ -141,0 +141,0 @@ }): AttributeObject; |
@@ -22,11 +22,7 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var restful_model_1 = __importDefault(require("./restful-model")); | ||
// The Attribute class represents a single model attribute, like 'namespace_id' | ||
// Subclasses of Attribute like AttributeDateTime know how to covert between | ||
// the JSON representation of that type and the javascript representation. | ||
// The Attribute class also exposes convenience methods for generating Matchers. | ||
function isRestfulModel(cls) { | ||
// A 'RestfulModel' has 'endpointName' and 'collectionName' unlike 'Model' | ||
return cls.endpointName !== undefined && cls.collectionName !== undefined; | ||
} | ||
var Attribute = /** @class */ (function () { | ||
@@ -72,4 +68,4 @@ function Attribute(_a) { | ||
} | ||
if (this.itemClass.prototype instanceof restful_model_1.default) { | ||
return new this.itemClass(_parent.connection).fromJSON(val); | ||
if (isRestfulModel(this.itemClass)) { | ||
return new this.itemClass(_parent.connection, val).fromJSON(val); | ||
} | ||
@@ -244,4 +240,4 @@ return new this.itemClass(val).fromJSON(val); | ||
var obj = void 0; | ||
if (this.itemClass.prototype instanceof restful_model_1.default) { | ||
obj = new this.itemClass(_parent.connection).fromJSON(objJSON); | ||
if (isRestfulModel(this.itemClass)) { | ||
obj = new this.itemClass(_parent.connection, objJSON).fromJSON(objJSON); | ||
} | ||
@@ -248,0 +244,0 @@ else { |
@@ -37,2 +37,3 @@ import RestfulModel, { SaveCallback } from './restful-model'; | ||
showTimezoneOptions?: boolean; | ||
showWeekView?: boolean; | ||
submitText?: string; | ||
@@ -51,2 +52,3 @@ thankYouRedirect?: string; | ||
showTimezoneOptions?: boolean; | ||
showWeekView?: boolean; | ||
submitText?: string; | ||
@@ -83,3 +85,3 @@ thankYouRedirect?: string; | ||
accountId?: string; | ||
days?: string; | ||
days?: string[]; | ||
end?: string; | ||
@@ -90,3 +92,3 @@ start?: string; | ||
accountId?: string; | ||
days?: string; | ||
days?: string[]; | ||
end?: string; | ||
@@ -99,2 +101,3 @@ start?: string; | ||
additionalFields?: SchedulerBookingAdditionalFieldsProperties[]; | ||
additionalGuestsHidden?: boolean; | ||
availableDaysInFuture?: number; | ||
@@ -115,2 +118,3 @@ calendarInviteToGuests?: boolean; | ||
additionalFields?: SchedulerBookingAdditionalFields[]; | ||
additionalGuestsHidden?: boolean; | ||
availableDaysInFuture?: number; | ||
@@ -188,2 +192,3 @@ calendarInviteToGuests?: boolean; | ||
}; | ||
disableEmails?: boolean; | ||
locale?: string; | ||
@@ -190,0 +195,0 @@ localeForGuests?: string; |
@@ -111,2 +111,6 @@ "use strict"; | ||
}), | ||
showWeekView: attributes_1.default.Boolean({ | ||
modelKey: 'showWeekView', | ||
jsonKey: 'show_week_view', | ||
}), | ||
submitText: attributes_1.default.String({ | ||
@@ -182,3 +186,3 @@ modelKey: 'submitText', | ||
}), | ||
days: attributes_1.default.String({ | ||
days: attributes_1.default.StringList({ | ||
modelKey: 'days', | ||
@@ -209,2 +213,6 @@ }), | ||
}), | ||
additionalGuestsHidden: attributes_1.default.Boolean({ | ||
modelKey: 'additionalGuestsHidden', | ||
jsonKey: 'additional_guests_hidden', | ||
}), | ||
availableDaysInFuture: attributes_1.default.Number({ | ||
@@ -322,2 +330,6 @@ modelKey: 'availableDaysInFuture', | ||
}), | ||
disableEmails: attributes_1.default.Boolean({ | ||
modelKey: 'disableEmails', | ||
jsonKey: 'disable_emails', | ||
}), | ||
locale: attributes_1.default.String({ | ||
@@ -324,0 +336,0 @@ modelKey: 'locale', |
@@ -22,2 +22,7 @@ /// <reference types="node" /> | ||
import DeltaCollection from './models/delta-collection'; | ||
import Outbox from './models/outbox'; | ||
export declare enum AuthMethod { | ||
BASIC = 0, | ||
BEARER = 1 | ||
} | ||
export declare type RequestOptions = { | ||
@@ -34,2 +39,3 @@ path: string; | ||
url?: URL; | ||
authMethod?: AuthMethod; | ||
}; | ||
@@ -58,2 +64,3 @@ export declare type FormDataType = { | ||
scheduler: SchedulerRestfulModelCollection; | ||
outbox: Outbox; | ||
neural: Neural; | ||
@@ -60,0 +67,0 @@ constructor(accessToken: string | null | undefined, { clientId }: { |
@@ -47,5 +47,11 @@ "use strict"; | ||
var delta_collection_1 = __importDefault(require("./models/delta-collection")); | ||
var outbox_1 = __importDefault(require("./models/outbox")); | ||
var PACKAGE_JSON = require('../package.json'); | ||
var SDK_VERSION = PACKAGE_JSON.version; | ||
var SUPPORTED_API_VERSION = '2.3'; | ||
var SUPPORTED_API_VERSION = '2.5'; | ||
var AuthMethod; | ||
(function (AuthMethod) { | ||
AuthMethod[AuthMethod["BASIC"] = 0] = "BASIC"; | ||
AuthMethod[AuthMethod["BEARER"] = 1] = "BEARER"; | ||
})(AuthMethod = exports.AuthMethod || (exports.AuthMethod = {})); | ||
var NylasConnection = /** @class */ (function () { | ||
@@ -69,2 +75,3 @@ function NylasConnection(accessToken, _a) { | ||
this.scheduler = new scheduler_restful_model_collection_1.default(this); | ||
this.outbox = new outbox_1.default(this); | ||
this.neural = new neural_1.default(this); | ||
@@ -112,4 +119,9 @@ this.accessToken = accessToken; | ||
if (user) { | ||
headers['authorization'] = | ||
'Basic ' + Buffer.from(user + ":", 'utf8').toString('base64'); | ||
if (options.authMethod === AuthMethod.BEARER) { | ||
headers['authorization'] = "Bearer " + user; | ||
} | ||
else { | ||
headers['authorization'] = | ||
'Basic ' + Buffer.from(user + ":", 'utf8').toString('base64'); | ||
} | ||
} | ||
@@ -215,2 +227,6 @@ if (!headers['User-Agent']) { | ||
} | ||
else if (response.headers.get('content-length') && | ||
Number(response.headers.get('content-length')) == 0) { | ||
return resolve(); | ||
} | ||
else if (response.headers.get('Content-Type') === 'message/rfc822') { | ||
@@ -217,0 +233,0 @@ return resolve(response.text()); |
{ | ||
"name": "nylas", | ||
"version": "6.2.0", | ||
"version": "6.2.1", | ||
"description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.", | ||
@@ -5,0 +5,0 @@ "main": "lib/nylas.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
365229
121
9311