@notionhq/client 2.2.13 → 2.2.14
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/package.json +1 -1
- package/build/src/api-endpoints.d.ts +246 -11
- package/build/src/api-endpoints.d.ts.map +1 -1
- package/build/src/api-endpoints.js.map +1 -1
- package/build/src/helpers.d.ts +17 -5
- package/build/src/helpers.d.ts.map +1 -1
- package/build/src/helpers.js +25 -4
- package/build/src/helpers.js.map +1 -1
- package/package.json +1 -1
package/build/src/helpers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BlockObjectResponse, CommentObjectResponse, DatabaseObjectResponse, PageObjectResponse, PartialBlockObjectResponse, PartialCommentObjectResponse, PartialDatabaseObjectResponse, PartialPageObjectResponse, PartialUserObjectResponse, UserObjectResponse } from "./api-endpoints";
|
|
1
|
+
import { BlockObjectResponse, CommentObjectResponse, DatabaseObjectResponse, EquationRichTextItemResponse, PageObjectResponse, PartialBlockObjectResponse, PartialCommentObjectResponse, PartialDatabaseObjectResponse, PartialPageObjectResponse, PartialUserObjectResponse, RichTextItemResponse, TextRichTextItemResponse, UserObjectResponse } from "./api-endpoints";
|
|
2
2
|
interface PaginatedArgs {
|
|
3
3
|
start_cursor?: string;
|
|
4
4
|
}
|
|
@@ -50,20 +50,20 @@ export declare function collectPaginatedAPI<Args extends PaginatedArgs, Item>(li
|
|
|
50
50
|
/**
|
|
51
51
|
* @returns `true` if `response` is a full `BlockObjectResponse`.
|
|
52
52
|
*/
|
|
53
|
-
export declare function isFullBlock(response: BlockObjectResponse | PartialBlockObjectResponse): response is BlockObjectResponse;
|
|
53
|
+
export declare function isFullBlock(response: PageObjectResponse | PartialPageObjectResponse | DatabaseObjectResponse | PartialDatabaseObjectResponse | BlockObjectResponse | PartialBlockObjectResponse): response is BlockObjectResponse;
|
|
54
54
|
/**
|
|
55
55
|
* @returns `true` if `response` is a full `PageObjectResponse`.
|
|
56
56
|
*/
|
|
57
|
-
export declare function isFullPage(response: PageObjectResponse | PartialPageObjectResponse): response is PageObjectResponse;
|
|
57
|
+
export declare function isFullPage(response: PageObjectResponse | PartialPageObjectResponse | DatabaseObjectResponse | PartialDatabaseObjectResponse | BlockObjectResponse | PartialBlockObjectResponse): response is PageObjectResponse;
|
|
58
58
|
/**
|
|
59
59
|
* @returns `true` if `response` is a full `DatabaseObjectResponse`.
|
|
60
60
|
*/
|
|
61
|
-
export declare function isFullDatabase(response: DatabaseObjectResponse | PartialDatabaseObjectResponse): response is DatabaseObjectResponse;
|
|
61
|
+
export declare function isFullDatabase(response: PageObjectResponse | PartialPageObjectResponse | DatabaseObjectResponse | PartialDatabaseObjectResponse | BlockObjectResponse | PartialBlockObjectResponse): response is DatabaseObjectResponse;
|
|
62
62
|
/**
|
|
63
63
|
* @returns `true` if `response` is a full `DatabaseObjectResponse` or a full
|
|
64
64
|
* `PageObjectResponse`.
|
|
65
65
|
*/
|
|
66
|
-
export declare function isFullPageOrDatabase(response: DatabaseObjectResponse | PartialDatabaseObjectResponse |
|
|
66
|
+
export declare function isFullPageOrDatabase(response: PageObjectResponse | PartialPageObjectResponse | DatabaseObjectResponse | PartialDatabaseObjectResponse | BlockObjectResponse | PartialBlockObjectResponse): response is DatabaseObjectResponse | PageObjectResponse;
|
|
67
67
|
/**
|
|
68
68
|
* @returns `true` if `response` is a full `UserObjectResponse`.
|
|
69
69
|
*/
|
|
@@ -72,5 +72,17 @@ export declare function isFullUser(response: UserObjectResponse | PartialUserObj
|
|
|
72
72
|
* @returns `true` if `response` is a full `CommentObjectResponse`.
|
|
73
73
|
*/
|
|
74
74
|
export declare function isFullComment(response: CommentObjectResponse | PartialCommentObjectResponse): response is CommentObjectResponse;
|
|
75
|
+
/**
|
|
76
|
+
* @returns `true` if `richText` is a `TextRichTextItemResponse`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function isTextRichTextItemResponse(richText: RichTextItemResponse): richText is TextRichTextItemResponse;
|
|
79
|
+
/**
|
|
80
|
+
* @returns `true` if `richText` is an `EquationRichTextItemResponse`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isEquationRichTextItemResponse(richText: RichTextItemResponse): richText is EquationRichTextItemResponse;
|
|
83
|
+
/**
|
|
84
|
+
* @returns `true` if `richText` is an `MentionRichTextItemResponse`.
|
|
85
|
+
*/
|
|
86
|
+
export declare function isMentionRichTextItemResponse(richText: RichTextItemResponse): richText is EquationRichTextItemResponse;
|
|
75
87
|
export {};
|
|
76
88
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,EAC1B,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,iBAAiB,CAAA;AAExB,UAAU,aAAa;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,UAAU,aAAa,CAAC,CAAC;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,CAAC,EAAE,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAuB,mBAAmB,CAAC,IAAI,SAAS,aAAa,EAAE,IAAI,EACzE,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,EACpD,aAAa,EAAE,IAAI,GAClB,qBAAqB,CAAC,IAAI,CAAC,CAU7B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,SAAS,aAAa,EAAE,IAAI,EACxE,MAAM,EAAE,CAAC,IAAI,EAAE,IA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
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isFullComment = exports.isFullUser = exports.isFullPageOrDatabase = exports.isFullDatabase = exports.isFullPage = exports.isFullBlock = exports.collectPaginatedAPI = exports.iteratePaginatedAPI = void 0;
|
|
3
|
+
exports.isMentionRichTextItemResponse = exports.isEquationRichTextItemResponse = exports.isTextRichTextItemResponse = exports.isFullComment = exports.isFullUser = exports.isFullPageOrDatabase = exports.isFullDatabase = exports.isFullPage = exports.isFullBlock = exports.collectPaginatedAPI = exports.iteratePaginatedAPI = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Returns an async iterator over the results of any paginated Notion API.
|
|
6
6
|
*
|
|
@@ -62,21 +62,21 @@ exports.collectPaginatedAPI = collectPaginatedAPI;
|
|
|
62
62
|
* @returns `true` if `response` is a full `BlockObjectResponse`.
|
|
63
63
|
*/
|
|
64
64
|
function isFullBlock(response) {
|
|
65
|
-
return "type" in response;
|
|
65
|
+
return response.object === "block" && "type" in response;
|
|
66
66
|
}
|
|
67
67
|
exports.isFullBlock = isFullBlock;
|
|
68
68
|
/**
|
|
69
69
|
* @returns `true` if `response` is a full `PageObjectResponse`.
|
|
70
70
|
*/
|
|
71
71
|
function isFullPage(response) {
|
|
72
|
-
return "url" in response;
|
|
72
|
+
return response.object === "page" && "url" in response;
|
|
73
73
|
}
|
|
74
74
|
exports.isFullPage = isFullPage;
|
|
75
75
|
/**
|
|
76
76
|
* @returns `true` if `response` is a full `DatabaseObjectResponse`.
|
|
77
77
|
*/
|
|
78
78
|
function isFullDatabase(response) {
|
|
79
|
-
return "title" in response;
|
|
79
|
+
return response.object === "database" && "title" in response;
|
|
80
80
|
}
|
|
81
81
|
exports.isFullDatabase = isFullDatabase;
|
|
82
82
|
/**
|
|
@@ -106,4 +106,25 @@ function isFullComment(response) {
|
|
|
106
106
|
return "created_by" in response;
|
|
107
107
|
}
|
|
108
108
|
exports.isFullComment = isFullComment;
|
|
109
|
+
/**
|
|
110
|
+
* @returns `true` if `richText` is a `TextRichTextItemResponse`.
|
|
111
|
+
*/
|
|
112
|
+
function isTextRichTextItemResponse(richText) {
|
|
113
|
+
return richText.type === "text";
|
|
114
|
+
}
|
|
115
|
+
exports.isTextRichTextItemResponse = isTextRichTextItemResponse;
|
|
116
|
+
/**
|
|
117
|
+
* @returns `true` if `richText` is an `EquationRichTextItemResponse`.
|
|
118
|
+
*/
|
|
119
|
+
function isEquationRichTextItemResponse(richText) {
|
|
120
|
+
return richText.type === "equation";
|
|
121
|
+
}
|
|
122
|
+
exports.isEquationRichTextItemResponse = isEquationRichTextItemResponse;
|
|
123
|
+
/**
|
|
124
|
+
* @returns `true` if `richText` is an `MentionRichTextItemResponse`.
|
|
125
|
+
*/
|
|
126
|
+
function isMentionRichTextItemResponse(richText) {
|
|
127
|
+
return richText.type === "mention";
|
|
128
|
+
}
|
|
129
|
+
exports.isMentionRichTextItemResponse = isMentionRichTextItemResponse;
|
|
109
130
|
//# sourceMappingURL=helpers.js.map
|
package/build/src/helpers.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";;;AA2BA;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,SAAS,CAAC,CAAC,mBAAmB,CACxC,MAAoD,EACpD,aAAmB;IAEnB,IAAI,UAAU,GAA8B,aAAa,CAAC,YAAY,CAAA;IACtE,GAAG;QACD,MAAM,QAAQ,GAAwB,MAAM,MAAM,CAAC;YACjD,GAAG,aAAa;YAChB,YAAY,EAAE,UAAU;SACzB,CAAC,CAAA;QACF,KAAK,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAA;QACvB,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAA;KAClC,QAAQ,UAAU,EAAC;AACtB,CAAC;AAbD,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QAA8B;IAE9B,OAAO,QAAQ,CAAC,IAAI,KAAK,MAAM,CAAA;AACjC,CAAC;AAJD,gEAIC;AAED;;GAEG;AACH,SAAgB,8BAA8B,CAC5C,QAA8B;IAE9B,OAAO,QAAQ,CAAC,IAAI,KAAK,UAAU,CAAA;AACrC,CAAC;AAJD,wEAIC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAC3C,QAA8B;IAE9B,OAAO,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAA;AACpC,CAAC;AAJD,sEAIC","sourcesContent":["import {\n BlockObjectResponse,\n CommentObjectResponse,\n DatabaseObjectResponse,\n EquationRichTextItemResponse,\n PageObjectResponse,\n PartialBlockObjectResponse,\n PartialCommentObjectResponse,\n PartialDatabaseObjectResponse,\n PartialPageObjectResponse,\n PartialUserObjectResponse,\n RichTextItemResponse,\n TextRichTextItemResponse,\n UserObjectResponse,\n} from \"./api-endpoints\"\n\ninterface PaginatedArgs {\n start_cursor?: string\n}\n\ninterface PaginatedList<T> {\n object: \"list\"\n results: T[]\n next_cursor: string | null\n has_more: boolean\n}\n\n/**\n * Returns an async iterator over the results of any paginated Notion API.\n *\n * Example (given a notion Client called `notion`):\n *\n * ```\n * for await (const block of iteratePaginatedAPI(notion.blocks.children.list, {\n * block_id: parentBlockId,\n * })) {\n * // Do something with block.\n * }\n * ```\n *\n * @param listFn A bound function on the Notion client that represents a conforming paginated\n * API. Example: `notion.blocks.children.list`.\n * @param firstPageArgs Arguments that should be passed to the API on the first and subsequent\n * calls to the API. Any necessary `next_cursor` will be automatically populated by\n * this function. Example: `{ block_id: \"<my block id>\" }`\n */\nexport async function* iteratePaginatedAPI<Args extends PaginatedArgs, Item>(\n listFn: (args: Args) => Promise<PaginatedList<Item>>,\n firstPageArgs: Args\n): AsyncIterableIterator<Item> {\n let nextCursor: string | null | undefined = firstPageArgs.start_cursor\n do {\n const response: PaginatedList<Item> = await listFn({\n ...firstPageArgs,\n start_cursor: nextCursor,\n })\n yield* response.results\n nextCursor = response.next_cursor\n } while (nextCursor)\n}\n\n/**\n * Collect all of the results of paginating an API into an in-memory array.\n *\n * Example (given a notion Client called `notion`):\n *\n * ```\n * const blocks = await collectPaginatedAPI(notion.blocks.children.list, {\n * block_id: parentBlockId,\n * })\n * // Do something with blocks.\n * ```\n *\n * @param listFn A bound function on the Notion client that represents a conforming paginated\n * API. Example: `notion.blocks.children.list`.\n * @param firstPageArgs Arguments that should be passed to the API on the first and subsequent\n * calls to the API. Any necessary `next_cursor` will be automatically populated by\n * this function. Example: `{ block_id: \"<my block id>\" }`\n */\nexport async function collectPaginatedAPI<Args extends PaginatedArgs, Item>(\n listFn: (args: Args) => Promise<PaginatedList<Item>>,\n firstPageArgs: Args\n): Promise<Item[]> {\n const results: Item[] = []\n for await (const item of iteratePaginatedAPI(listFn, firstPageArgs)) {\n results.push(item)\n }\n return results\n}\n\n/**\n * @returns `true` if `response` is a full `BlockObjectResponse`.\n */\nexport function isFullBlock(\n response:\n | PageObjectResponse\n | PartialPageObjectResponse\n | DatabaseObjectResponse\n | PartialDatabaseObjectResponse\n | BlockObjectResponse\n | PartialBlockObjectResponse\n): response is BlockObjectResponse {\n return response.object === \"block\" && \"type\" in response\n}\n\n/**\n * @returns `true` if `response` is a full `PageObjectResponse`.\n */\nexport function isFullPage(\n response:\n | PageObjectResponse\n | PartialPageObjectResponse\n | DatabaseObjectResponse\n | PartialDatabaseObjectResponse\n | BlockObjectResponse\n | PartialBlockObjectResponse\n): response is PageObjectResponse {\n return response.object === \"page\" && \"url\" in response\n}\n\n/**\n * @returns `true` if `response` is a full `DatabaseObjectResponse`.\n */\nexport function isFullDatabase(\n response:\n | PageObjectResponse\n | PartialPageObjectResponse\n | DatabaseObjectResponse\n | PartialDatabaseObjectResponse\n | BlockObjectResponse\n | PartialBlockObjectResponse\n): response is DatabaseObjectResponse {\n return response.object === \"database\" && \"title\" in response\n}\n\n/**\n * @returns `true` if `response` is a full `DatabaseObjectResponse` or a full\n * `PageObjectResponse`.\n */\nexport function isFullPageOrDatabase(\n response:\n | PageObjectResponse\n | PartialPageObjectResponse\n | DatabaseObjectResponse\n | PartialDatabaseObjectResponse\n | BlockObjectResponse\n | PartialBlockObjectResponse\n): response is DatabaseObjectResponse | PageObjectResponse {\n if (response.object === \"database\") {\n return isFullDatabase(response)\n } else {\n return isFullPage(response)\n }\n}\n\n/**\n * @returns `true` if `response` is a full `UserObjectResponse`.\n */\nexport function isFullUser(\n response: UserObjectResponse | PartialUserObjectResponse\n): response is UserObjectResponse {\n return \"type\" in response\n}\n\n/**\n * @returns `true` if `response` is a full `CommentObjectResponse`.\n */\nexport function isFullComment(\n response: CommentObjectResponse | PartialCommentObjectResponse\n): response is CommentObjectResponse {\n return \"created_by\" in response\n}\n\n/**\n * @returns `true` if `richText` is a `TextRichTextItemResponse`.\n */\nexport function isTextRichTextItemResponse(\n richText: RichTextItemResponse\n): richText is TextRichTextItemResponse {\n return richText.type === \"text\"\n}\n\n/**\n * @returns `true` if `richText` is an `EquationRichTextItemResponse`.\n */\nexport function isEquationRichTextItemResponse(\n richText: RichTextItemResponse\n): richText is EquationRichTextItemResponse {\n return richText.type === \"equation\"\n}\n\n/**\n * @returns `true` if `richText` is an `MentionRichTextItemResponse`.\n */\nexport function isMentionRichTextItemResponse(\n richText: RichTextItemResponse\n): richText is EquationRichTextItemResponse {\n return richText.type === \"mention\"\n}\n"]}
|