New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

notion-types

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notion-types - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

api-extractor.json

309

build/index.d.ts

@@ -1,308 +0,1 @@

export declare type ID = string;
/** Block colors supported by Notion */
export declare type Color = 'gray' | 'brown' | 'orange' | 'yellow' | 'teal' | 'blue' | 'purple' | 'pink' | 'red' | 'gray_background' | 'brown_background' | 'orange_background' | 'yellow_background' | 'teal_background' | 'blue_background' | 'purple_background' | 'pink_background' | 'red_background';
/** Types of structured data supported by Notion collections */
export declare type PropertyType = 'title' | 'text' | 'number' | 'select' | 'multi_select' | 'date' | 'person' | 'file' | 'checkbox' | 'url' | 'email' | 'phone_number';
/** Types of number formatting supported by Notion */
export declare type NumberFormat = 'number_with_commas' | 'percent' | 'dollar' | 'euro' | 'pound' | 'yen' | 'rupee' | 'won' | 'yuan';
/** Types of collection views supported by Notion */
export declare type CollectionViewType = 'table' | 'gallery' | 'list' | 'board' | 'calendar';
declare type BoldFormat = ['b'];
declare type ItalicFormat = ['i'];
declare type StrikeFormat = ['s'];
declare type CodeFormat = ['c'];
declare type LinkFormat = ['a', string];
declare type ColorFormat = ['h', Color];
declare type UserFormat = ['u', string];
declare type PageFormat = ['p', string];
declare type DateFormat = ['d', {
type: 'date' | 'daterange';
start_date: string;
end_date?: string;
date_format: string;
}];
declare type SubDecoration = BoldFormat | ItalicFormat | StrikeFormat | CodeFormat | LinkFormat | ColorFormat | DateFormat | UserFormat | PageFormat;
declare type BaseDecoration = [string];
declare type AdditionalDecoration = [string, SubDecoration[]];
export declare type Decoration = BaseDecoration | AdditionalDecoration;
/**
* Base properties shared by all block types.
*/
interface BaseBlock {
id: ID;
version: number;
created_time: number;
last_edited_time: number;
parent_id: ID;
parent_table: string;
alive: boolean;
created_by_table: string;
created_by_id: ID;
last_edited_by_table: string;
last_edited_by_id: ID;
space_id?: ID;
properties?: any;
content?: ID[];
}
interface BaseTextBlock extends BaseBlock {
properties?: {
title: Decoration[];
};
format?: {
block_color: Color;
};
}
interface BaseContentBlock extends BaseBlock {
properties: {
source: string[][];
caption?: Decoration[];
};
format: {
block_width: number;
block_height: number;
display_source: string;
block_full_width: boolean;
block_page_width: boolean;
block_aspect_ratio: number;
block_preserve_scale: boolean;
};
file_ids?: string[];
}
export interface PageBlock extends BaseBlock {
type: 'page';
properties?: {
title: Decoration[];
};
format: {
page_full_width?: boolean;
page_small_text?: boolean;
page_cover_position?: number;
block_locked?: boolean;
block_locked_by?: string;
page_cover?: string;
page_icon?: string;
};
permissions: {
role: string;
type: string;
}[];
file_ids?: string[];
}
export interface BookmarkBlock extends BaseBlock {
type: 'bookmark';
properties: {
link: Decoration[];
title: Decoration[];
description: Decoration[];
};
format: {
block_color?: string;
bookmark_icon: string;
bookmark_cover: string;
};
}
export interface TextBlock extends BaseTextBlock {
type: 'text';
}
export interface BulletedListBlock extends BaseTextBlock {
type: 'bulleted_list';
}
export interface NumberedListBlock extends BaseTextBlock {
type: 'numbered_list';
}
export interface HeaderBlock extends BaseTextBlock {
type: 'header';
}
export interface SubHeaderBlock extends BaseTextBlock {
type: 'sub_header';
}
export interface SubSubHeaderBlock extends BaseTextBlock {
type: 'sub_sub_header';
}
export interface QuoteBlock extends BaseTextBlock {
type: 'quote';
}
export interface TodoBlock extends BaseTextBlock {
type: 'to_do';
properties: {
title: Decoration[];
checked: (['Yes'] | ['No'])[];
};
}
export interface DividerBlock extends BaseBlock {
type: 'divider';
}
export interface ColumnListBlock extends BaseBlock {
type: 'column_list';
}
export interface ColumnBlock extends BaseBlock {
type: 'column';
format: {
column_ratio: number;
};
}
export interface CalloutBlock extends BaseBlock {
type: 'callout';
format: {
page_icon: string;
block_color: Color;
};
properties: {
title: Decoration[];
};
}
export interface ToggleBlock extends BaseBlock {
type: 'toggle';
properties: {
title: Decoration[];
};
}
export interface ImageBlock extends BaseContentBlock {
type: 'image';
}
export interface EmbedBlock extends BaseContentBlock {
type: 'embed';
}
export interface VideoBlock extends BaseContentBlock {
type: 'video';
}
export interface CodeBlock extends BaseBlock {
type: 'code';
properties: {
title: Decoration[];
language: Decoration[];
};
}
export interface CollectionBlock extends BaseContentBlock {
type: 'collection_view';
collection_id: ID;
view_ids: ID[];
}
/** The different block values a block can have. */
export declare type Block = TextBlock | PageBlock | BulletedListBlock | NumberedListBlock | HeaderBlock | SubHeaderBlock | SubSubHeaderBlock | TodoBlock | DividerBlock | ColumnListBlock | ColumnBlock | QuoteBlock | CodeBlock | ImageBlock | VideoBlock | EmbedBlock | CalloutBlock | BookmarkBlock | ToggleBlock | CollectionBlock;
export interface User {
id: ID;
version: number;
email: string;
given_name: string;
family_name: string;
profile_photo: string;
onboarding_completed: boolean;
mobile_onboarding_completed: boolean;
}
export interface SelectOption {
id: ID;
color: Color;
value: string;
}
export interface CollectionPropertySchema {
name: string;
type: PropertyType;
options?: SelectOption[];
number_format?: NumberFormat;
}
export interface CollectionPropertySchemaMap {
[key: string]: CollectionPropertySchema;
}
export interface Collection {
id: ID;
version: number;
name: string[][];
schema: CollectionPropertySchemaMap;
icon: string;
parent_id: ID;
parent_table: string;
alive: boolean;
copied_from: string;
}
export declare type CollectionPropertyID = 'string';
export interface BaseCollectionView {
id: ID;
type: CollectionViewType;
name: string;
format: any;
version: number;
alive: boolean;
parent_id: ID;
parent_table: string;
query2: {
aggregations?: object[];
group_by: CollectionPropertyID;
};
}
export interface TableCollectionView extends BaseCollectionView {
type: 'table';
format: {
table_wrap: boolean;
table_properties: Array<{
property: CollectionPropertyID;
visible: boolean;
width: number;
}>;
};
page_sort: ID[];
}
export interface GalleryCollectionView extends BaseCollectionView {
type: 'gallery';
format: {
gallery_cover: {
type: 'page_cover' | 'page_content';
};
gallery_cover_size: 'medium';
gallery_cover_aspect: 'cover';
gallery_properties: Array<{
property: CollectionPropertyID;
visible: boolean;
}>;
};
}
export interface ListCollectionView extends BaseCollectionView {
type: 'list';
format: {
list_properties: Array<{
property: CollectionPropertyID;
visible: boolean;
}>;
};
}
export interface BoardCollectionView extends BaseCollectionView {
type: 'board';
format: {
board_properties: Array<{
property: CollectionPropertyID;
visible: boolean;
}>;
board_groups2: Array<{
property: CollectionPropertyID;
hidden: boolean;
value: {
type: PropertyType;
value: string;
};
}>;
};
}
export interface CalendarCollectionView extends BaseCollectionView {
type: 'calendar';
}
export declare type CollectionView = TableCollectionView | GalleryCollectionView | ListCollectionView | BoardCollectionView | CalendarCollectionView;
export interface NotionMap<T> {
[key: string]: T;
}
export declare type BlockMap = NotionMap<Block>;
export declare type UserMap = NotionMap<User>;
export declare type CollectionMap = NotionMap<Collection>;
export declare type CollectionViewMap = NotionMap<CollectionView>;
export interface ACLWrapper<T> {
role: string;
value: T;
}
export declare type ACLBlock = ACLWrapper<Block>;
export declare type ACLUser = ACLWrapper<User>;
export declare type ACLCollection = ACLWrapper<Collection>;
export declare type ACLCollectionView = ACLWrapper<CollectionView>;
export declare type ACLBlockMap = NotionMap<ACLWrapper<Block>>;
export declare type ACLUserMap = NotionMap<ACLWrapper<User>>;
export declare type ACLCollectionMap = NotionMap<ACLWrapper<Collection>>;
export declare type ACLCollectionViewMap = NotionMap<ACLWrapper<CollectionView>>;
export {};
export * from './notion-types';
"use strict";
// Base Types
// ----------------------------------------------------------------------------
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./notion-types"), exports);
//# sourceMappingURL=index.js.map
{
"name": "notion-types",
"version": "0.1.0",
"version": "0.2.0",
"description": "TypeScript types for core Notion data structures.",

@@ -12,3 +12,4 @@ "repository": "saasify-sh/notion",

"node": ">=10"
}
},
"gitHead": "29962763b5c03bfe3aa577fbb2f1423fd8cf50a3"
}

@@ -1,465 +0,1 @@

// Base Types
// ----------------------------------------------------------------------------
export type ID = string
/** Block colors supported by Notion */
export type Color =
| 'gray'
| 'brown'
| 'orange'
| 'yellow'
| 'teal'
| 'blue'
| 'purple'
| 'pink'
| 'red'
| 'gray_background'
| 'brown_background'
| 'orange_background'
| 'yellow_background'
| 'teal_background'
| 'blue_background'
| 'purple_background'
| 'pink_background'
| 'red_background'
/** Types of structured data supported by Notion collections */
export type PropertyType =
| 'title'
| 'text'
| 'number'
| 'select'
| 'multi_select'
| 'date'
| 'person'
| 'file'
| 'checkbox'
| 'url'
| 'email'
| 'phone_number'
/** Types of number formatting supported by Notion */
export type NumberFormat =
| 'number_with_commas'
| 'percent'
| 'dollar'
| 'euro'
| 'pound'
| 'yen'
| 'rupee'
| 'won'
| 'yuan'
/** Types of collection views supported by Notion */
export type CollectionViewType =
| 'table'
| 'gallery'
| 'list'
| 'board'
| 'calendar'
type BoldFormat = ['b']
type ItalicFormat = ['i']
type StrikeFormat = ['s']
type CodeFormat = ['c']
type LinkFormat = ['a', string]
type ColorFormat = ['h', Color]
type UserFormat = ['u', string]
type PageFormat = ['p', string]
type DateFormat = [
'd',
{
type: 'date' | 'daterange'
start_date: string
end_date?: string
date_format: string
}
]
type SubDecoration =
| BoldFormat
| ItalicFormat
| StrikeFormat
| CodeFormat
| LinkFormat
| ColorFormat
| DateFormat
| UserFormat
| PageFormat
type BaseDecoration = [string]
type AdditionalDecoration = [string, SubDecoration[]]
export type Decoration = BaseDecoration | AdditionalDecoration
// Block Types
// ----------------------------------------------------------------------------
/**
* Base properties shared by all block types.
*/
interface BaseBlock {
id: ID
version: number
created_time: number
last_edited_time: number
parent_id: ID
parent_table: string
alive: boolean
created_by_table: string
created_by_id: ID
last_edited_by_table: string
last_edited_by_id: ID
space_id?: ID
properties?: any
content?: ID[]
}
interface BaseTextBlock extends BaseBlock {
properties?: {
title: Decoration[]
}
format?: {
block_color: Color
}
}
interface BaseContentBlock extends BaseBlock {
properties: {
source: string[][]
caption?: Decoration[]
}
format: {
block_width: number
block_height: number
display_source: string
block_full_width: boolean
block_page_width: boolean
block_aspect_ratio: number
block_preserve_scale: boolean
}
file_ids?: string[]
}
export interface PageBlock extends BaseBlock {
type: 'page'
properties?: {
title: Decoration[]
}
format: {
page_full_width?: boolean
page_small_text?: boolean
page_cover_position?: number
block_locked?: boolean
block_locked_by?: string
page_cover?: string
page_icon?: string
}
permissions: { role: string; type: string }[]
file_ids?: string[]
}
export interface BookmarkBlock extends BaseBlock {
type: 'bookmark'
properties: {
link: Decoration[]
title: Decoration[]
description: Decoration[]
}
format: {
block_color?: string
bookmark_icon: string
bookmark_cover: string
}
}
export interface TextBlock extends BaseTextBlock {
type: 'text'
}
export interface BulletedListBlock extends BaseTextBlock {
type: 'bulleted_list'
}
export interface NumberedListBlock extends BaseTextBlock {
type: 'numbered_list'
}
export interface HeaderBlock extends BaseTextBlock {
type: 'header'
}
export interface SubHeaderBlock extends BaseTextBlock {
type: 'sub_header'
}
export interface SubSubHeaderBlock extends BaseTextBlock {
type: 'sub_sub_header'
}
export interface QuoteBlock extends BaseTextBlock {
type: 'quote'
}
// TODO
export interface TodoBlock extends BaseTextBlock {
type: 'to_do'
properties: {
title: Decoration[]
checked: (['Yes'] | ['No'])[]
}
}
export interface DividerBlock extends BaseBlock {
type: 'divider'
}
export interface ColumnListBlock extends BaseBlock {
type: 'column_list'
}
export interface ColumnBlock extends BaseBlock {
type: 'column'
format: {
column_ratio: number
}
}
export interface CalloutBlock extends BaseBlock {
type: 'callout'
format: {
page_icon: string
block_color: Color
}
properties: {
title: Decoration[]
}
}
export interface ToggleBlock extends BaseBlock {
type: 'toggle'
properties: {
title: Decoration[]
}
}
export interface ImageBlock extends BaseContentBlock {
type: 'image'
}
export interface EmbedBlock extends BaseContentBlock {
type: 'embed'
}
export interface VideoBlock extends BaseContentBlock {
type: 'video'
}
export interface CodeBlock extends BaseBlock {
type: 'code'
properties: {
title: Decoration[]
language: Decoration[]
}
}
export interface CollectionBlock extends BaseContentBlock {
type: 'collection_view'
collection_id: ID
view_ids: ID[]
}
/** The different block values a block can have. */
export type Block =
| TextBlock
| PageBlock
| BulletedListBlock
| NumberedListBlock
| HeaderBlock
| SubHeaderBlock
| SubSubHeaderBlock
| TodoBlock
| DividerBlock
| ColumnListBlock
| ColumnBlock
| QuoteBlock
| CodeBlock
| ImageBlock
| VideoBlock
| EmbedBlock
| CalloutBlock
| BookmarkBlock
| ToggleBlock
| CollectionBlock
// Users
// ----------------------------------------------------------------------------
export interface User {
id: ID
version: number
email: string
given_name: string
family_name: string
profile_photo: string
onboarding_completed: boolean
mobile_onboarding_completed: boolean
}
// Collections
// ----------------------------------------------------------------------------
export interface SelectOption {
id: ID
color: Color
value: string
}
export interface CollectionPropertySchema {
name: string
type: PropertyType
options?: SelectOption[]
number_format?: NumberFormat
}
export interface CollectionPropertySchemaMap {
[key: string]: CollectionPropertySchema
}
export interface Collection {
id: ID
version: number
name: string[][]
schema: CollectionPropertySchemaMap
icon: string
parent_id: ID
parent_table: string
alive: boolean
copied_from: string
}
// Collection Views
// ----------------------------------------------------------------------------
export type CollectionPropertyID = 'string'
export interface BaseCollectionView {
id: ID
type: CollectionViewType
name: string
format: any
version: number
alive: boolean
parent_id: ID
parent_table: string
query2: {
// TODO
aggregations?: object[]
group_by: CollectionPropertyID
}
}
export interface TableCollectionView extends BaseCollectionView {
type: 'table'
format: {
table_wrap: boolean
table_properties: Array<{
property: CollectionPropertyID
visible: boolean
width: number
}>
}
page_sort: ID[]
}
export interface GalleryCollectionView extends BaseCollectionView {
type: 'gallery'
format: {
gallery_cover: {
type: 'page_cover' | 'page_content'
}
gallery_cover_size: 'medium'
gallery_cover_aspect: 'cover'
gallery_properties: Array<{
property: CollectionPropertyID
visible: boolean
}>
}
}
export interface ListCollectionView extends BaseCollectionView {
type: 'list'
format: {
list_properties: Array<{
property: CollectionPropertyID
visible: boolean
}>
}
}
export interface BoardCollectionView extends BaseCollectionView {
type: 'board'
format: {
board_properties: Array<{
property: CollectionPropertyID
visible: boolean
}>
board_groups2: Array<{
property: CollectionPropertyID
hidden: boolean
value: {
type: PropertyType
value: string
// TODO: needs testing for more cases
}
}>
}
}
export interface CalendarCollectionView extends BaseCollectionView {
type: 'calendar'
// TODO
}
export type CollectionView =
| TableCollectionView
| GalleryCollectionView
| ListCollectionView
| BoardCollectionView
| CalendarCollectionView
// Convenience map types
// ----------------------------------------------------------------------------
export interface NotionMap<T> {
[key: string]: T
}
export type BlockMap = NotionMap<Block>
export type UserMap = NotionMap<User>
export type CollectionMap = NotionMap<Collection>
export type CollectionViewMap = NotionMap<CollectionView>
// ACL wrappers
// ----------------------------------------------------------------------------
export interface ACLWrapper<T> {
role: string
value: T
}
export type ACLBlock = ACLWrapper<Block>
export type ACLUser = ACLWrapper<User>
export type ACLCollection = ACLWrapper<Collection>
export type ACLCollectionView = ACLWrapper<CollectionView>
export type ACLBlockMap = NotionMap<ACLWrapper<Block>>
export type ACLUserMap = NotionMap<ACLWrapper<User>>
export type ACLCollectionMap = NotionMap<ACLWrapper<Collection>>
export type ACLCollectionViewMap = NotionMap<ACLWrapper<CollectionView>>
export * from './notion-types'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc