@pagenote/notion-database
Version:
make notion as a real-database for server
21 lines (20 loc) • 956 B
TypeScript
import { RichTextItemResponse } from '@notionhq/client/build/src/api-endpoints';
import { ObjectType, SupportNotionTypes } from '../types/notionType';
import { NotionObjectSchema, NotionDatabaseCreateSchema } from '../types/base';
/**
* 将notion富文本,转为纯字符串
* [{plain_text:"a"},{plain_text:"a"}] -> ab
*/
export declare function resolveNotionRichTextItemRequest(inputs: Array<RichTextItemResponse>): string;
/**
* 根据js 数据类型返回notion type
* 1 -> number
* "1" -> rich_text
* false -> checkbox
*/
export declare function getNotionTypeFromData(data: ObjectType): SupportNotionTypes;
/**
* 通过js对象,推断出 notion 官方的properties schema定义
* {age:10,name:"username",signed: false} ==> {age:{type: number}, name:{type:"rich_text"}, signed: {type: "checkbox"}}
*/
export declare function defineNotionPropertySchemaByData(data: NotionObjectSchema, setPrimaryKey?: boolean): NotionDatabaseCreateSchema;