New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-calendly

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-calendly - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

lib/Logger.d.ts

6

lib/endpoints/CalendlyApiEndpoint.d.ts

@@ -7,2 +7,7 @@ export declare type Options = {

};
export declare type RequestOptions = {
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
headers?: any;
body?: any;
};
export default class CalendlyApiEndpoint {

@@ -14,3 +19,4 @@ protected ACCESS_TOKEN: string;

protected fetchPost(url: string, body: string): Promise<any>;
protected request(uri: string, options: RequestOptions): Promise<any>;
}
//# sourceMappingURL=CalendlyApiEndpoint.d.ts.map

78

lib/endpoints/CalendlyApiEndpoint.js

@@ -21,2 +21,5 @@ "use strict";

const stopcock_1 = __importDefault(require("stopcock"));
const Logger_1 = require("../Logger");
const logger = Logger_1.LogHandler.newInstance();
const LOG_NAMESPACE = 'API CALL';
class CalendlyApiEndpoint {

@@ -31,8 +34,20 @@ constructor(ACCESS_TOKEN, params) {

this.ACCESS_TOKEN = ACCESS_TOKEN;
this.fetchGet = (0, stopcock_1.default)(this.fetchGet, this.options);
this.fetchPost = (0, stopcock_1.default)(this.fetchPost, this.options);
// this.fetchGet = stopcock(this.fetchGet, this.options);
// this.fetchPost = stopcock(this.fetchPost, this.options);
this.request = (0, stopcock_1.default)(this.request, this.options);
}
fetchGet(url) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield fetch(url, {
// const response = await fetch(url, {
// method: 'GET',
// headers: {
// Authorization: `Bearer ${this.ACCESS_TOKEN}`,
// 'Content-Type': 'application/json'
// }
// });
// const data = await response.json();
// if (data && data.message)
// throw new Error(data.title + ': ' + data.message);
// return data;
return this.request(url, {
method: 'GET',

@@ -44,6 +59,2 @@ headers: {

});
const data = yield response.json();
if (data && data.message)
throw new Error(data.title + ': ' + data.message);
return data;
});

@@ -53,3 +64,15 @@ }

return __awaiter(this, void 0, void 0, function* () {
const response = yield fetch(url, {
// const response = await fetch(url, {
// method: 'POST',
// headers: {
// 'Content-Type': 'application/json',
// Authorization: `Bearer ${this.ACCESS_TOKEN}`
// },
// body
// });
// const data = await response.json();
// if (data && data.message)
// throw new Error(data.title + ': ' + data.message);
// return data;
return this.request(url, {
method: 'POST',

@@ -62,10 +85,41 @@ headers: {

});
const data = yield response.json();
if (data && data.message)
throw new Error(data.title + ': ' + data.message);
return data;
});
}
request(uri, options) {
return __awaiter(this, void 0, void 0, function* () {
return new Promise((resolve, reject) => {
fetch(uri, options)
.then((response) => {
// console.log(response.headers);
if (response.status === 429) {
reject('Too many requests');
}
else if (!response.ok) {
logger.error(`Error fetching data. Response status ${response.status}`, LOG_NAMESPACE, 'request');
console.error(uri, response.status, response.statusText);
if (Logger_1.DEBUG_LEVEL === 'debug')
console.error(options);
}
if (response.status === 202) {
return null;
}
return response.json().catch((error) => {
logger.error(`Error parsing response: ${error}`, LOG_NAMESPACE, 'request');
return null;
});
})
.then((data) => {
if (data === null) {
resolve(null);
}
resolve(data);
})
.catch((error) => {
reject(error);
});
});
});
}
}
exports.default = CalendlyApiEndpoint;
//# sourceMappingURL=CalendlyApiEndpoint.js.map

5

package.json
{
"name": "node-calendly",
"version": "1.0.7",
"version": "1.0.8",
"description": "Node module to access calendly api.",

@@ -59,4 +59,5 @@ "main": "./lib/Calendly.js",

"dependencies": {
"stopcock": "^1.1.0"
"stopcock": "^1.1.0",
"winston": "^3.10.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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