diff --git a/engine-idk/package.json b/engine-idk/package.json index 6c4779be..56275494 100644 --- a/engine-idk/package.json +++ b/engine-idk/package.json @@ -1,6 +1,6 @@ { "name": "@poozle/engine-idk", - "version": "0.1.13", + "version": "0.1.17", "description": "Used to develop integrations for Poozle", "license": "MIT", "author": "Poozle ", diff --git a/engine-idk/src/bases/base_path.ts b/engine-idk/src/bases/base_path.ts index 1d2920c6..05f7e33a 100644 --- a/engine-idk/src/bases/base_path.ts +++ b/engine-idk/src/bases/base_path.ts @@ -40,28 +40,29 @@ export class BasePath { } async baseRun(method: string, headers: AxiosHeaders, params: Params, config: Config) { - const responseFromRun = await this.run(method, headers, params, config); + const responseFromRun: any = await this.run(method, headers, params, config); // if this is a request directly to the integration if (params.proxy) { return responseFromRun; } - if (Array.isArray(responseFromRun)) { - const data = responseFromRun.map((responseItem: any) => + if (responseFromRun.meta && Array.isArray(responseFromRun.data)) { + const data = responseFromRun.data.map((responseItem: any) => this.convertToModel( responseItem, params.queryParams?.raw === true || params.queryParams?.raw === 'true' ? true : false, ), ); - const meta = await this.getMetaParams(data, params); + const meta = await this.getMetaParams(responseFromRun, params); return { data, meta, }; } + return { data: this.convertToModel( responseFromRun, @@ -71,13 +72,19 @@ export class BasePath { } // Written by the integration - async getMetaParams(_data: any, _params: Params): Promise { + async getMetaParams(response: any, params: Params): Promise { + const current_cursor = + typeof params.queryParams?.cursor === 'string' ? params.queryParams?.cursor : ''; + + const next_cursor = response.meta ? response.meta.next_cursor : ''; + const before_cursor = response.meta ? response.meta.previous_cursor : ''; + return { limit: 0, cursors: { - before: '0', - current: '0', - next: '0', + before: before_cursor, + current: current_cursor, + next: next_cursor, }, }; } diff --git a/engine-idk/src/common_models/documentation/block.ts b/engine-idk/src/common_models/documentation/block.ts index 8932d5e8..4341eae1 100644 --- a/engine-idk/src/common_models/documentation/block.ts +++ b/engine-idk/src/common_models/documentation/block.ts @@ -89,7 +89,41 @@ export interface Content { export interface Block { id: string; parent_id: string; - block_type: string; + block_type: BlockType; content: Content[]; children: Block[]; } + +export const enum BlockType { + bookmark, + breadcrumb, + bulleted_list_item, + callout, + child_database, + child_page, + column, + column_list, + divider, + embed, + equation, + file, + heading_1, + heading_2, + heading_3, + image, + link_preview, + link_to_page, + numbered_list_item, + paragraph, + pdf, + quote, + synced_block, + table, + table_of_contents, + table_row, + template, + to_do, + toggle, + unsupported, + video, +} diff --git a/engine-idk/src/common_models/documentation/page.ts b/engine-idk/src/common_models/documentation/page.ts index 3d9db72f..b1df82ae 100644 --- a/engine-idk/src/common_models/documentation/page.ts +++ b/engine-idk/src/common_models/documentation/page.ts @@ -19,6 +19,10 @@ export const PageSchema = { type: 'string', default: '', }, + type: { + type: 'string', + default: '', + }, created_at: { type: 'string', default: '', @@ -34,6 +38,7 @@ export interface Page { id: string; parent_id: string; title: string; + type?: string; created_by: string; created_at: string; updated_at: string; diff --git a/engine-webapp/public/icons/google-calendar.svg b/engine-webapp/public/icons/google_calendar.svg similarity index 100% rename from engine-webapp/public/icons/google-calendar.svg rename to engine-webapp/public/icons/google_calendar.svg diff --git a/engine-webapp/public/icons/google-drive.svg b/engine-webapp/public/icons/google_drive.svg similarity index 100% rename from engine-webapp/public/icons/google-drive.svg rename to engine-webapp/public/icons/google_drive.svg