@texonom/ntypes 1.6.1 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +14 -19
- package/build/index.js.map +1 -1
- package/license +21 -0
- package/package.json +7 -4
package/build/index.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/core.ts
|
|
2
|
+
var e = (e) => e[0] === "a", t = (e) => e[0] === "‣", n = (e) => e[0] === "d", r = (e) => e[0] === "h", i = (e) => e[0] === "p", a = (e) => e[0] === "u", o = (e) => e.length === 1, s = (e) => e[0] === "‣", c = (e) => !s(e) && e.length === 2;
|
|
3
|
+
//#endregion
|
|
4
|
+
//#region src/collection.ts
|
|
5
|
+
function l(e) {
|
|
6
|
+
return !!(e != null && e.schema);
|
|
4
7
|
}
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/space.ts
|
|
10
|
+
function u(e) {
|
|
11
|
+
return !!(e != null && e.pages);
|
|
7
12
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
a as isColorFormat,
|
|
13
|
-
i as isDateFormat,
|
|
14
|
-
s as isExternalLinkFormat,
|
|
15
|
-
o as isLinkFormat,
|
|
16
|
-
n as isMentionDecoration,
|
|
17
|
-
e as isPageFormat,
|
|
18
|
-
F as isSpace,
|
|
19
|
-
r as isUserFormat
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
|
13
|
+
//#endregion
|
|
14
|
+
export { c as isAdditionalDecoration, o as isBaseDecoration, l as isCollection, r as isColorFormat, n as isDateFormat, t as isExternalLinkFormat, e as isLinkFormat, s as isMentionDecoration, i as isPageFormat, u as isSpace, a as isUserFormat };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/core.ts","../src/collection.ts","../src/space.ts"],"sourcesContent":["// Base Types\n// ----------------------------------------------------------------------------\n\n/** UUID */\nexport type ID = string\n\n/**\n * Unique identifier for collection properties representing the columns in a\n * traditional relational database.\n *\n * Either a 4-character hash like `o;Os` or `title` as a special, reserved\n * property ID for collection title properties.\n *\n * You can think of `title` properties as primary indexes that are guaranteed\n * to exist as in a traditional database.\n */\nexport type PropertyID = string\n\n/** Block colors supported by Notion */\nexport type Color =\n | 'gray'\n | 'brown'\n | 'orange'\n | 'yellow'\n | 'teal'\n | 'blue'\n | 'purple'\n | 'pink'\n | 'red'\n | 'gray_background'\n | 'brown_background'\n | 'orange_background'\n | 'yellow_background'\n | 'teal_background'\n | 'blue_background'\n | 'purple_background'\n | 'pink_background'\n | 'red_background'\n\n/** Types of structured data supported by Notion collections */\nexport type PropertyType =\n | 'title'\n | 'text'\n | 'number'\n | 'select'\n | 'multi_select'\n | 'date'\n | 'person'\n | 'file'\n | 'checkbox'\n | 'url'\n | 'email'\n | 'phone_number'\n | 'formula'\n | 'relation'\n | 'created_time'\n | 'created_by'\n | 'last_edited_time'\n | 'last_edited_by'\n\n/** Types of number formatting supported by Notion */\nexport type NumberFormat = 'number_with_commas' | 'percent' | 'dollar' | 'euro' | 'pound' | 'yen' | 'rupee' | 'won' | 'yuan'\n\nexport type Role = 'editor' | 'reader' | 'none' | 'read_and_write'\n\nexport type BoldFormat = ['b']\nexport type ItalicFormat = ['i']\nexport type StrikeFormat = ['s']\nexport type CodeFormat = ['c']\nexport type UnderlineFormat = ['_']\nexport type LinkFormat = ['a', string]\nexport type ExternalObjectInstanceFormat = ['eoi', string]\nexport type ColorFormat = ['h', Color]\nexport type UserFormat = ['u', string]\nexport type PageFormat = ['p', string] | ['p', string, string]\nexport type InlineEquationFormat = ['e', string]\nexport type DiscussionFormat = ['m', string]\nexport type ExternalLinkFormat = ['‣', [string, string]]\nexport type DateFormat = ['d', FormattedDate]\n\nexport interface FormattedDate {\n type: 'date' | 'daterange' | 'datetime' | 'datetimerange'\n start_date: string\n start_time?: string\n end_date?: string\n end_time?: string\n date_format?: string\n time_zone?: string\n}\n\nexport type SubDecoration =\n | BoldFormat\n | ItalicFormat\n | StrikeFormat\n | CodeFormat\n | UnderlineFormat\n | LinkFormat\n | ColorFormat\n | DateFormat\n | UserFormat\n | InlineEquationFormat\n | PageFormat\n | ExternalLinkFormat\n | DiscussionFormat\n | ExternalObjectInstanceFormat\n\nexport type BaseDecoration = [string]\nexport type MentionDecoration = ['‣', SubDecoration[]]\nexport type AdditionalDecoration = [string, SubDecoration[]]\n\nexport type Decoration = BaseDecoration | AdditionalDecoration | MentionDecoration\n\nexport const isLinkFormat = (format: SubDecoration): format is LinkFormat => format[0] === 'a'\nexport const isExternalLinkFormat = (format: SubDecoration): format is ExternalLinkFormat => format[0] === '‣'\nexport const isDateFormat = (format: SubDecoration): format is DateFormat => format[0] === 'd'\nexport const isColorFormat = (format: SubDecoration): format is ColorFormat => format[0] === 'h'\nexport const isPageFormat = (format: SubDecoration): format is PageFormat => format[0] === 'p'\nexport const isUserFormat = (format: SubDecoration): format is UserFormat => format[0] === 'u'\n\nexport const isBaseDecoration = (deco: Decoration): deco is BaseDecoration => deco.length === 1\nexport const isMentionDecoration = (deco: Decoration): deco is MentionDecoration => deco[0] === '‣'\nexport const isAdditionalDecoration = (deco: Decoration): deco is AdditionalDecoration =>\n !isMentionDecoration(deco) && deco.length === 2\n","import { Color, Decoration, ID, NumberFormat, PropertyID, PropertyType } from './core'\nimport { Formula } from './formula'\n\nexport interface SelectOption {\n id: ID\n color: Color\n value: string\n}\n\nexport interface CollectionPropertySchema {\n name: string\n type: PropertyType\n options?: SelectOption[]\n number_format?: NumberFormat\n formula?: Formula\n}\n\nexport interface CollectionPropertySchemaMap {\n [key: string]: CollectionPropertySchema\n}\n\nexport interface Collection {\n id: ID\n version: number\n name: Decoration[]\n schema: CollectionPropertySchemaMap\n icon: string\n parent_id: ID\n parent_table: string\n alive: boolean\n copied_from: string\n template_pages?: Array<ID>\n\n format?: {\n collection_page_properties?: Array<{\n property: PropertyID\n visible: boolean\n }>\n property_visibility?: Array<{\n property: PropertyID\n visibility: 'show' | 'hide'\n }>\n hide_linked_collection_name?: boolean\n }\n}\n\nexport function isCollection(obj: unknown): obj is Collection {\n return Boolean((obj as Collection)?.schema)\n}\n","import { ID } from './core'\n\nexport interface Space {\n id: ID\n version: number\n name: string\n permissions: [[unknown]]\n icon: string\n beta_enabled: boolean\n pages: ID[]\n disable_public_access: boolean\n disable_guests: boolean\n disable_move_to_space: boolean\n disable_export: boolean\n created_time: number\n last_edited_time: number\n created_by_table: string\n created_by_id: ID\n last_edited_by_table: string\n last_edited_by_id: ID\n plan_type: string\n invite_link_enabled: boolean\n disable_space_page_edits: boolean\n disable_public_access_requests: boolean\n public_home_page: ID\n disable_team_creation: boolean\n settings: {\n grant_awards: unknown[]\n in_ai_program: boolean\n enable_ai_feature: boolean\n disable_team_guests: boolean\n disable_membership_requests: boolean\n seen_guest_membership_requests: boolean\n disable_guest_membership_requests: boolean\n }\n subscription_tier: string\n}\n\nexport function isSpace(obj: unknown): obj is Space {\n return Boolean((obj as Space)?.pages)\n}\n"],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["isLinkFormat","format","isExternalLinkFormat","isDateFormat","isColorFormat","isPageFormat","isUserFormat","isBaseDecoration","deco","isMentionDecoration","isAdditionalDecoration","isCollection","obj","isSpace"],"sources":["../src/core.ts","../src/collection.ts","../src/space.ts"],"sourcesContent":["// Base Types\n// ----------------------------------------------------------------------------\n\n/** UUID */\nexport type ID = string\n\n/**\n * Unique identifier for collection properties representing the columns in a\n * traditional relational database.\n *\n * Either a 4-character hash like `o;Os` or `title` as a special, reserved\n * property ID for collection title properties.\n *\n * You can think of `title` properties as primary indexes that are guaranteed\n * to exist as in a traditional database.\n */\nexport type PropertyID = string\n\n/** Block colors supported by Notion */\nexport type Color =\n | 'gray'\n | 'brown'\n | 'orange'\n | 'yellow'\n | 'teal'\n | 'blue'\n | 'purple'\n | 'pink'\n | 'red'\n | 'gray_background'\n | 'brown_background'\n | 'orange_background'\n | 'yellow_background'\n | 'teal_background'\n | 'blue_background'\n | 'purple_background'\n | 'pink_background'\n | 'red_background'\n\n/** Types of structured data supported by Notion collections */\nexport type PropertyType =\n | 'title'\n | 'text'\n | 'number'\n | 'select'\n | 'multi_select'\n | 'date'\n | 'person'\n | 'file'\n | 'checkbox'\n | 'url'\n | 'email'\n | 'phone_number'\n | 'formula'\n | 'relation'\n | 'created_time'\n | 'created_by'\n | 'last_edited_time'\n | 'last_edited_by'\n\n/** Types of number formatting supported by Notion */\nexport type NumberFormat = 'number_with_commas' | 'percent' | 'dollar' | 'euro' | 'pound' | 'yen' | 'rupee' | 'won' | 'yuan'\n\nexport type Role = 'editor' | 'reader' | 'none' | 'read_and_write'\n\nexport type BoldFormat = ['b']\nexport type ItalicFormat = ['i']\nexport type StrikeFormat = ['s']\nexport type CodeFormat = ['c']\nexport type UnderlineFormat = ['_']\nexport type LinkFormat = ['a', string]\nexport type ExternalObjectInstanceFormat = ['eoi', string]\nexport type ColorFormat = ['h', Color]\nexport type UserFormat = ['u', string]\nexport type PageFormat = ['p', string] | ['p', string, string]\nexport type InlineEquationFormat = ['e', string]\nexport type DiscussionFormat = ['m', string]\nexport type ExternalLinkFormat = ['‣', [string, string]]\nexport type DateFormat = ['d', FormattedDate]\n\nexport interface FormattedDate {\n type: 'date' | 'daterange' | 'datetime' | 'datetimerange'\n start_date: string\n start_time?: string\n end_date?: string\n end_time?: string\n date_format?: string\n time_zone?: string\n}\n\nexport type SubDecoration =\n | BoldFormat\n | ItalicFormat\n | StrikeFormat\n | CodeFormat\n | UnderlineFormat\n | LinkFormat\n | ColorFormat\n | DateFormat\n | UserFormat\n | InlineEquationFormat\n | PageFormat\n | ExternalLinkFormat\n | DiscussionFormat\n | ExternalObjectInstanceFormat\n\nexport type BaseDecoration = [string]\nexport type MentionDecoration = ['‣', SubDecoration[]]\nexport type AdditionalDecoration = [string, SubDecoration[]]\n\nexport type Decoration = BaseDecoration | AdditionalDecoration | MentionDecoration\n\nexport const isLinkFormat = (format: SubDecoration): format is LinkFormat => format[0] === 'a'\nexport const isExternalLinkFormat = (format: SubDecoration): format is ExternalLinkFormat => format[0] === '‣'\nexport const isDateFormat = (format: SubDecoration): format is DateFormat => format[0] === 'd'\nexport const isColorFormat = (format: SubDecoration): format is ColorFormat => format[0] === 'h'\nexport const isPageFormat = (format: SubDecoration): format is PageFormat => format[0] === 'p'\nexport const isUserFormat = (format: SubDecoration): format is UserFormat => format[0] === 'u'\n\nexport const isBaseDecoration = (deco: Decoration): deco is BaseDecoration => deco.length === 1\nexport const isMentionDecoration = (deco: Decoration): deco is MentionDecoration => deco[0] === '‣'\nexport const isAdditionalDecoration = (deco: Decoration): deco is AdditionalDecoration =>\n !isMentionDecoration(deco) && deco.length === 2\n","import { Color, Decoration, ID, NumberFormat, PropertyID, PropertyType } from './core'\nimport { Formula } from './formula'\n\nexport interface SelectOption {\n id: ID\n color: Color\n value: string\n}\n\nexport interface CollectionPropertySchema {\n name: string\n type: PropertyType\n options?: SelectOption[]\n number_format?: NumberFormat\n formula?: Formula\n}\n\nexport interface CollectionPropertySchemaMap {\n [key: string]: CollectionPropertySchema\n}\n\nexport interface Collection {\n id: ID\n version: number\n name: Decoration[]\n schema: CollectionPropertySchemaMap\n icon: string\n parent_id: ID\n parent_table: string\n alive: boolean\n copied_from: string\n template_pages?: Array<ID>\n\n format?: {\n collection_page_properties?: Array<{\n property: PropertyID\n visible: boolean\n }>\n property_visibility?: Array<{\n property: PropertyID\n visibility: 'show' | 'hide'\n }>\n hide_linked_collection_name?: boolean\n }\n}\n\nexport function isCollection(obj: unknown): obj is Collection {\n return Boolean((obj as Collection)?.schema)\n}\n","import { ID } from './core'\n\nexport interface Space {\n id: ID\n version: number\n name: string\n permissions: [[unknown]]\n icon: string\n beta_enabled: boolean\n pages: ID[]\n disable_public_access: boolean\n disable_guests: boolean\n disable_move_to_space: boolean\n disable_export: boolean\n created_time: number\n last_edited_time: number\n created_by_table: string\n created_by_id: ID\n last_edited_by_table: string\n last_edited_by_id: ID\n plan_type: string\n invite_link_enabled: boolean\n disable_space_page_edits: boolean\n disable_public_access_requests: boolean\n public_home_page: ID\n disable_team_creation: boolean\n settings: {\n grant_awards: unknown[]\n in_ai_program: boolean\n enable_ai_feature: boolean\n disable_team_guests: boolean\n disable_membership_requests: boolean\n seen_guest_membership_requests: boolean\n disable_guest_membership_requests: boolean\n }\n subscription_tier: string\n}\n\nexport function isSpace(obj: unknown): obj is Space {\n return Boolean((obj as Space)?.pages)\n}\n"],"mappings":";AAgHA,IAAaA,KAAgB,MAAgDC,EAAO,OAAO,KAC9EC,KAAwB,MAAwDD,EAAO,OAAO,KAC9FE,KAAgB,MAAgDF,EAAO,OAAO,KAC9EG,KAAiB,MAAiDH,EAAO,OAAO,KAChFI,KAAgB,MAAgDJ,EAAO,OAAO,KAC9EK,KAAgB,MAAgDL,EAAO,OAAO,KAE9EM,KAAoB,MAA6CC,EAAK,WAAW,GACjFC,KAAuB,MAAgDD,EAAK,OAAO,KACnFE,KAA0B,MACrC,CAACD,EAAoBD,CAAI,KAAKA,EAAK,WAAW;;;AC5EhD,SAAgBG,EAAa,GAAiC;CAC5D,OAAO,GAAAC,KAAA,QAASA,EAAoB;AACtC;;;ACVA,SAAgBC,EAAQ,GAA4B;CAClD,OAAO,GAAAD,KAAA,QAASA,EAAe;AACjC"}
|
package/license
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Seonglae Cho
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@texonom/ntypes",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "TypeScript types for core Notion data structures.",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "texonom/notion-node"
|
|
9
|
+
},
|
|
7
10
|
"author": "Seonglae Cho <sungle3737@gmail.com>",
|
|
8
11
|
"license": "MIT",
|
|
9
12
|
"types": "./build/index.d.ts",
|
|
@@ -14,10 +17,10 @@
|
|
|
14
17
|
"build"
|
|
15
18
|
],
|
|
16
19
|
"engines": {
|
|
17
|
-
"node": ">=22.
|
|
20
|
+
"node": ">=22.23.3"
|
|
18
21
|
},
|
|
19
22
|
"devDependencies": {
|
|
20
|
-
"vite-plugin-dts": "^
|
|
23
|
+
"vite-plugin-dts": "^5.1.2"
|
|
21
24
|
},
|
|
22
25
|
"standard-version": {
|
|
23
26
|
"skip": {
|