notion-client
Advanced tools
Comparing version 2.2.3 to 2.3.0
@@ -53,3 +53,3 @@ "use strict"; | ||
exports.__esModule = true; | ||
var got_1 = __importDefault(require("got")); | ||
var node_fetch_1 = __importDefault(require("node-fetch")); | ||
var p_map_1 = __importDefault(require("p-map")); | ||
@@ -337,3 +337,5 @@ var notion_utils_1 = require("notion-utils"); | ||
return __generator(this, function (_b) { | ||
headers = {}; | ||
headers = { | ||
'Content-Type': 'application/json' | ||
}; | ||
if (this._authToken) { | ||
@@ -343,10 +345,8 @@ headers.cookie = "token_v2=" + this._authToken; | ||
url = this._apiBaseUrl + "/" + endpoint; | ||
console.log('got', { url: url }); | ||
return [2 /*return*/, got_1["default"] | ||
.post(url, { | ||
// prefixUrl: this._apiBaseUrl, | ||
json: body, | ||
console.log('notion fetch', url); | ||
return [2 /*return*/, node_fetch_1["default"](url, { | ||
method: 'post', | ||
body: JSON.stringify(body), | ||
headers: headers | ||
}) | ||
.json()]; | ||
}).then(function (res) { return res.json(); })]; | ||
}); | ||
@@ -353,0 +353,0 @@ }); |
@@ -48,3 +48,3 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
import got from 'got'; | ||
import fetch from 'node-fetch'; | ||
import pMap from 'p-map'; | ||
@@ -332,3 +332,5 @@ import { parsePageId, getPageContentBlockIds, uuidToId } from 'notion-utils'; | ||
return __generator(this, function (_b) { | ||
headers = {}; | ||
headers = { | ||
'Content-Type': 'application/json' | ||
}; | ||
if (this._authToken) { | ||
@@ -338,10 +340,8 @@ headers.cookie = "token_v2=" + this._authToken; | ||
url = this._apiBaseUrl + "/" + endpoint; | ||
console.log('got', { url: url }); | ||
return [2 /*return*/, got | ||
.post(url, { | ||
// prefixUrl: this._apiBaseUrl, | ||
json: body, | ||
console.log('notion fetch', url); | ||
return [2 /*return*/, fetch(url, { | ||
method: 'post', | ||
body: JSON.stringify(body), | ||
headers: headers | ||
}) | ||
.json()]; | ||
}).then(function (res) { return res.json(); })]; | ||
}); | ||
@@ -348,0 +348,0 @@ }); |
{ | ||
"name": "notion-client", | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "Robust TypeScript client for the unofficial Notion API.", | ||
@@ -18,3 +18,3 @@ "repository": "NotionX/notion-kit", | ||
"dependencies": { | ||
"got": "^11.6.0", | ||
"node-fetch": "^2.6.1", | ||
"notion-types": "^2.2.1", | ||
@@ -25,5 +25,6 @@ "notion-utils": "^2.2.3", | ||
"devDependencies": { | ||
"@types/node-fetch": "^2.5.7", | ||
"ava": "^3.11.1" | ||
}, | ||
"gitHead": "5f022591c762a285e015b31444a6488b6a3a81c7" | ||
"gitHead": "f3a245c4a01ca0f213908af27c03f7200a4833c5" | ||
} |
@@ -1,2 +0,2 @@ | ||
import got from 'got' | ||
import fetch from 'node-fetch' | ||
import pMap from 'p-map' | ||
@@ -362,3 +362,5 @@ | ||
}): Promise<T> { | ||
const headers: any = {} | ||
const headers: any = { | ||
'Content-Type': 'application/json' | ||
} | ||
@@ -370,11 +372,10 @@ if (this._authToken) { | ||
const url = `${this._apiBaseUrl}/${endpoint}` | ||
console.log('got', { url }) | ||
return got | ||
.post(url, { | ||
// prefixUrl: this._apiBaseUrl, | ||
json: body, | ||
headers | ||
}) | ||
.json() | ||
console.log('notion fetch', url) | ||
return fetch(url, { | ||
method: 'post', | ||
body: JSON.stringify(body), | ||
headers | ||
}).then((res) => res.json()) | ||
} | ||
} |
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
Sorry, the diff of this file is not supported yet
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
758735
2
1
+ Addednode-fetch@^2.6.1
+ Addednode-fetch@2.7.0(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
- Removedgot@^11.6.0
- Removed@sindresorhus/is@4.6.0(transitive)
- Removed@szmarczak/http-timer@4.0.6(transitive)
- Removed@types/cacheable-request@6.0.3(transitive)
- Removed@types/http-cache-semantics@4.0.4(transitive)
- Removed@types/keyv@3.1.4(transitive)
- Removed@types/node@22.13.0(transitive)
- Removed@types/responselike@1.0.3(transitive)
- Removedcacheable-lookup@5.0.4(transitive)
- Removedcacheable-request@7.0.4(transitive)
- Removedclone-response@1.0.3(transitive)
- Removeddecompress-response@6.0.0(transitive)
- Removeddefer-to-connect@2.0.1(transitive)
- Removedend-of-stream@1.4.4(transitive)
- Removedget-stream@5.2.0(transitive)
- Removedgot@11.8.6(transitive)
- Removedhttp-cache-semantics@4.1.1(transitive)
- Removedhttp2-wrapper@1.0.3(transitive)
- Removedjson-buffer@3.0.1(transitive)
- Removedkeyv@4.5.4(transitive)
- Removedlowercase-keys@2.0.0(transitive)
- Removedmimic-response@1.0.13.1.0(transitive)
- Removednormalize-url@6.1.0(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-cancelable@2.1.1(transitive)
- Removedpump@3.0.2(transitive)
- Removedquick-lru@5.1.1(transitive)
- Removedresolve-alpn@1.2.1(transitive)
- Removedresponselike@2.0.1(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedwrappy@1.0.2(transitive)