Skip to content

Commit

Permalink
Publish notion: new version
Browse files Browse the repository at this point in the history
  • Loading branch information
harshithmullapudi committed Jul 17, 2023
1 parent 015a9fe commit a48a942
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 20 deletions.
2 changes: 1 addition & 1 deletion engine-idk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poozle/engine-idk",
"version": "0.1.22",
"version": "0.1.24",
"description": "Used to develop integrations for Poozle",
"license": "MIT",
"author": "Poozle <[email protected]>",
Expand Down
2 changes: 2 additions & 0 deletions engine-idk/src/common_models/documentation/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface Block {

export enum BlockType {
bookmark = 'bookmark',
bookmark_text = 'bookmark_text',
breadcrumb = 'breadcrumb',
bulleted_list_item = 'bulleted_list_item',
callout = 'callout',
Expand All @@ -48,6 +49,7 @@ export enum BlockType {
table = 'table',
table_of_contents = 'table_of_contents',
table_row = 'table_row',
table_cell = 'table_cell',
template = 'template',
to_do = 'to_do',
toggle = 'toggle',
Expand Down
4 changes: 2 additions & 2 deletions integration_definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
"name": "Notion",
"key": "notion",
"icon": "notion.svg",
"version": "0.1.7",
"version": "0.1.8",
"releaseStage": "ALPHA",
"sourceUrl": "https://raw.githubusercontent.com/poozlehq/build-artifacts/main/documentation/notion/0.1.7/index.js",
"sourceUrl": "https://raw.githubusercontent.com/poozlehq/build-artifacts/main/documentation/notion/0.1.8/index.js",
"integrationType": "DOCUMENTATION"
},
{
Expand Down
2 changes: 1 addition & 1 deletion integrations/documentation/notion/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"access": "public"
},
"dependencies": {
"@poozle/engine-idk": "^0.1.23",
"@poozle/engine-idk": "^0.1.24",
"axios": "^1.4.0"
},
"browserslist": {
Expand Down
2 changes: 1 addition & 1 deletion integrations/documentation/notion/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import { BaseIntegration, CheckResponse, Config, SpecificationResponse } from '@poozle/engine-idk';
import axios from 'axios';
import { ProxyPath } from 'proxy';

import { BlocksPath } from 'models/block/blocks.path';
import { PagePath } from 'models/page/page.path';
import { PagesPath } from 'models/page/pages.path';
import { ProxyPath } from 'proxy';

import spec from './spec';

Expand Down
35 changes: 24 additions & 11 deletions integrations/documentation/notion/src/models/block/block.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export async function fetchPageBlocks(
};
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function extractContent(data: any): Content[] {
const type = data.type;
switch (type) {
Expand Down Expand Up @@ -184,7 +185,8 @@ export function extractContent(data: any): Content[] {

default:
return 'rich_text' in data[type]
? data[type]?.rich_text?.map((richtext: any) => {
? // eslint-disable-next-line @typescript-eslint/no-explicit-any
data[type]?.rich_text?.map((richtext: any) => {
return {
annotations: {
bold: richtext.annotations.bold ?? '',
Expand All @@ -206,11 +208,13 @@ export function extractChildrenData(data: SingleBlockResponse): Block[] {
if (data.type === BlockType.table_row) {
const cells = data[data.type].cells ? data[data.type].cells : [];

// eslint-disable-next-line @typescript-eslint/no-explicit-any
return cells.map((cell: any) => ({
id: data.id,
parent_id: data.parent?.type ? data.parent[data.parent.type] : '',
block_type: BlockType.table_cell,
content: [
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...cell?.map((richtext: any) => ({
annotations: {
bold: richtext.annotations.bold ?? '',
Expand All @@ -230,17 +234,26 @@ export function extractChildrenData(data: SingleBlockResponse): Block[] {

const caption = data[data.type].caption ? data[data.type].caption : [];

// eslint-disable-next-line @typescript-eslint/no-explicit-any
return caption.map((richtext: any) => ({
annotations: {
bold: richtext.annotations.bold ?? '',
italic: richtext.annotations.italic ?? '',
strikethrough: richtext.annotations.strikethrough ?? '',
underline: richtext.annotations.underline ?? '',
code: richtext.annotations.code ?? '',
color: richtext.annotations.color ?? '',
},
plain_text: richtext.plain_text,
href: richtext.href,
id: data.id,
parent_id: data.parent?.type ? data.parent[data.parent.type] : '',
block_type: BlockType.bookmark_text,
content: [
{
annotations: {
bold: richtext.annotations.bold ?? '',
italic: richtext.annotations.italic ?? '',
strikethrough: richtext.annotations.strikethrough ?? '',
underline: richtext.annotations.underline ?? '',
code: richtext.annotations.code ?? '',
color: richtext.annotations.color ?? '',
},
plain_text: richtext.plain_text,
href: richtext.href,
},
],
children: [],
}));
}

Expand Down
8 changes: 4 additions & 4 deletions integrations/documentation/notion/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1109,10 +1109,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@poozle/engine-idk@^0.1.23":
version "0.1.23"
resolved "https://registry.yarnpkg.com/@poozle/engine-idk/-/engine-idk-0.1.23.tgz#aa60e925df06f08b35874a69cfb94ced3df99f8b"
integrity sha512-DVLYwiEqdBGJbMtFC89AZjr8RQZcREt+Uhinf2kF96oIJuzblprhZ6kVBuGMlUHFWwqWEFNfkFXnOSL3y9mOig==
"@poozle/engine-idk@^0.1.24":
version "0.1.24"
resolved "https://registry.yarnpkg.com/@poozle/engine-idk/-/engine-idk-0.1.24.tgz#9dce7e45d16cbbf8bf8e2b42225872c0aa59d13d"
integrity sha512-yO4JS+zcQj/v9nvF3FriZGTdeQytcqAQQXF/Qd+dx9QtCah2SoBD93zy2pYtpoXPCZuw1z2WPQWcxhsyom5BDA==
dependencies:
axios "^1.3.2"
qs "^6.11.2"
Expand Down

0 comments on commit a48a942

Please sign in to comment.