notion-client
Advanced tools
Comparing version 4.7.9 to 4.7.10
@@ -38,2 +38,3 @@ import { OptionsOfJSONResponseBody } from 'got'; | ||
}): Promise<notion.CollectionInstance>; | ||
private getQuery; | ||
getUsers(userIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.RecordValues<notion.User>>; | ||
@@ -40,0 +41,0 @@ getBlocks(blockIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.PageChunk>; |
@@ -125,16 +125,17 @@ "use strict"; | ||
var _a; | ||
var _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var _b, _c, _d, _e; | ||
return __generator(this, function (_f) { | ||
switch (_f.label) { | ||
case 0: | ||
collectionId = collectionInstance.collectionId, collectionViewId = collectionInstance.collectionViewId; | ||
collectionView = (_b = recordMap.collection_view[collectionViewId]) === null || _b === void 0 ? void 0 : _b.value; | ||
_e.label = 1; | ||
_f.label = 1; | ||
case 1: | ||
_e.trys.push([1, 3, , 4]); | ||
_f.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.getCollectionData(collectionId, collectionViewId, { | ||
type: collectionView === null || collectionView === void 0 ? void 0 : collectionView.type, | ||
query: (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query2) || (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query), | ||
query: this.getQuery(collectionView), | ||
groups: ((_c = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _c === void 0 ? void 0 : _c.board_groups2) || | ||
((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups), | ||
((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups) || | ||
((_e = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _e === void 0 ? void 0 : _e.board_columns), | ||
gotOptions: gotOptions | ||
@@ -148,3 +149,3 @@ }) | ||
case 2: | ||
collectionData = _e.sent(); | ||
collectionData = _f.sent(); | ||
// await fs.writeFile( | ||
@@ -161,3 +162,3 @@ // `${collectionId}-${collectionViewId}.json`, | ||
case 3: | ||
err_2 = _e.sent(); | ||
err_2 = _f.sent(); | ||
// It's possible for public pages to link to private collections, in which case | ||
@@ -291,2 +292,14 @@ // Notion returns a 400 error | ||
}; | ||
//handle setting group_by for the query if it isn't already | ||
NotionAPI.prototype.getQuery = function (collectionView) { | ||
var _a, _b, _c; | ||
var query = (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query2) || (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query); | ||
var groupBy = ((_a = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _a === void 0 ? void 0 : _a.board_columns_by) | ||
? (_c = (_b = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _b === void 0 ? void 0 : _b.board_columns_by) === null || _c === void 0 ? void 0 : _c.property | ||
: undefined; | ||
if (groupBy) { | ||
query.group_by = groupBy; | ||
} | ||
return query; | ||
}; | ||
NotionAPI.prototype.getUsers = function (userIds, gotOptions) { | ||
@@ -293,0 +306,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -53,3 +53,4 @@ "use strict"; | ||
'https://www.notion.so/saasifysh/TransitiveBullsh-it-78fc5a4b88d74b0e824e29407e9f1ec1', | ||
'https://www.notion.so/saasifysh/About-8d0062776d0c4afca96eb1ace93a7538' | ||
'https://www.notion.so/saasifysh/About-8d0062776d0c4afca96eb1ace93a7538', | ||
'https://www.notion.so/potionsite/newest-board-a899b98b7cdc424585e5ddebbdae60cc' | ||
// collections stress test | ||
@@ -56,0 +57,0 @@ // NOTE: removing because of sporadic timeouts |
@@ -38,2 +38,3 @@ import { OptionsOfJSONResponseBody } from 'got'; | ||
}): Promise<notion.CollectionInstance>; | ||
private getQuery; | ||
getUsers(userIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.RecordValues<notion.User>>; | ||
@@ -40,0 +41,0 @@ getBlocks(blockIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.PageChunk>; |
@@ -119,16 +119,17 @@ var __assign = (this && this.__assign) || function () { | ||
var _a; | ||
var _b, _c, _d; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var _b, _c, _d, _e; | ||
return __generator(this, function (_f) { | ||
switch (_f.label) { | ||
case 0: | ||
collectionId = collectionInstance.collectionId, collectionViewId = collectionInstance.collectionViewId; | ||
collectionView = (_b = recordMap.collection_view[collectionViewId]) === null || _b === void 0 ? void 0 : _b.value; | ||
_e.label = 1; | ||
_f.label = 1; | ||
case 1: | ||
_e.trys.push([1, 3, , 4]); | ||
_f.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, this.getCollectionData(collectionId, collectionViewId, { | ||
type: collectionView === null || collectionView === void 0 ? void 0 : collectionView.type, | ||
query: (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query2) || (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query), | ||
query: this.getQuery(collectionView), | ||
groups: ((_c = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _c === void 0 ? void 0 : _c.board_groups2) || | ||
((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups), | ||
((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups) || | ||
((_e = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _e === void 0 ? void 0 : _e.board_columns), | ||
gotOptions: gotOptions | ||
@@ -142,3 +143,3 @@ }) | ||
case 2: | ||
collectionData = _e.sent(); | ||
collectionData = _f.sent(); | ||
// await fs.writeFile( | ||
@@ -155,3 +156,3 @@ // `${collectionId}-${collectionViewId}.json`, | ||
case 3: | ||
err_2 = _e.sent(); | ||
err_2 = _f.sent(); | ||
// It's possible for public pages to link to private collections, in which case | ||
@@ -285,2 +286,14 @@ // Notion returns a 400 error | ||
}; | ||
//handle setting group_by for the query if it isn't already | ||
NotionAPI.prototype.getQuery = function (collectionView) { | ||
var _a, _b, _c; | ||
var query = (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query2) || (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query); | ||
var groupBy = ((_a = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _a === void 0 ? void 0 : _a.board_columns_by) | ||
? (_c = (_b = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _b === void 0 ? void 0 : _b.board_columns_by) === null || _c === void 0 ? void 0 : _c.property | ||
: undefined; | ||
if (groupBy) { | ||
query.group_by = groupBy; | ||
} | ||
return query; | ||
}; | ||
NotionAPI.prototype.getUsers = function (userIds, gotOptions) { | ||
@@ -287,0 +300,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -48,3 +48,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
'https://www.notion.so/saasifysh/TransitiveBullsh-it-78fc5a4b88d74b0e824e29407e9f1ec1', | ||
'https://www.notion.so/saasifysh/About-8d0062776d0c4afca96eb1ace93a7538' | ||
'https://www.notion.so/saasifysh/About-8d0062776d0c4afca96eb1ace93a7538', | ||
'https://www.notion.so/potionsite/newest-board-a899b98b7cdc424585e5ddebbdae60cc' | ||
// collections stress test | ||
@@ -51,0 +52,0 @@ // NOTE: removing because of sporadic timeouts |
{ | ||
"name": "notion-client", | ||
"version": "4.7.9", | ||
"version": "4.7.10", | ||
"description": "Robust TypeScript client for the unofficial Notion API.", | ||
@@ -20,4 +20,4 @@ "repository": "NotionX/react-notion-x", | ||
"got": "^11.8.1", | ||
"notion-types": "^4.7.9", | ||
"notion-utils": "^4.7.9", | ||
"notion-types": "^4.7.10", | ||
"notion-utils": "^4.7.10", | ||
"p-map": "^4.0.0" | ||
@@ -29,3 +29,3 @@ }, | ||
}, | ||
"gitHead": "305c2d788a8bf7aa4adc23674d24d4f2e19bdb57" | ||
"gitHead": "40c2ff364a5697c328f0c4ec11a955a55ced3fba" | ||
} |
@@ -14,3 +14,4 @@ import test from 'ava' | ||
'https://www.notion.so/saasifysh/TransitiveBullsh-it-78fc5a4b88d74b0e824e29407e9f1ec1', | ||
'https://www.notion.so/saasifysh/About-8d0062776d0c4afca96eb1ace93a7538' | ||
'https://www.notion.so/saasifysh/About-8d0062776d0c4afca96eb1ace93a7538', | ||
'https://www.notion.so/potionsite/newest-board-a899b98b7cdc424585e5ddebbdae60cc' | ||
@@ -17,0 +18,0 @@ // collections stress test |
@@ -126,6 +126,7 @@ import got, { OptionsOfJSONResponseBody } from 'got' | ||
type: collectionView?.type, | ||
query: collectionView?.query2 || collectionView?.query, | ||
query: this.getQuery(collectionView), | ||
groups: | ||
collectionView?.format?.board_groups2 || | ||
collectionView?.format?.board_groups, | ||
collectionView?.format?.board_groups || | ||
collectionView?.format?.board_columns, | ||
gotOptions | ||
@@ -326,2 +327,14 @@ } | ||
//handle setting group_by for the query if it isn't already | ||
private getQuery(collectionView: notion.CollectionView | undefined) { | ||
let query = collectionView?.query2 || collectionView?.query | ||
const groupBy = collectionView?.format?.board_columns_by | ||
? collectionView?.format?.board_columns_by?.property | ||
: undefined | ||
if (groupBy) { | ||
query.group_by = groupBy | ||
} | ||
return query | ||
} | ||
public async getUsers( | ||
@@ -328,0 +341,0 @@ userIds: string[], |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
969813
11813
Updatednotion-types@^4.7.10
Updatednotion-utils@^4.7.10