katanakit-js 3.1.3 → 3.2.1
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/README.md +559 -0
- package/dist/adapters/index.d.ts +2 -0
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +2 -0
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/notion/index.d.ts +3 -0
- package/dist/adapters/notion/index.d.ts.map +1 -0
- package/dist/adapters/notion/index.js +2 -0
- package/dist/adapters/notion/index.js.map +1 -0
- package/dist/adapters/notion/notion.service.d.ts +397 -0
- package/dist/adapters/notion/notion.service.d.ts.map +1 -0
- package/dist/adapters/notion/notion.service.js +604 -0
- package/dist/adapters/notion/notion.service.js.map +1 -0
- package/dist/adapters/wordpress/index.d.ts +3 -0
- package/dist/adapters/wordpress/index.d.ts.map +1 -0
- package/dist/adapters/wordpress/index.js +2 -0
- package/dist/adapters/wordpress/index.js.map +1 -0
- package/dist/adapters/wordpress/wordpress.service.d.ts +685 -0
- package/dist/adapters/wordpress/wordpress.service.d.ts.map +1 -0
- package/dist/adapters/wordpress/wordpress.service.js +1100 -0
- package/dist/adapters/wordpress/wordpress.service.js.map +1 -0
- package/dist/types/index.d.ts +767 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +14 -2
|
@@ -0,0 +1,604 @@
|
|
|
1
|
+
/** Default Notion API base URL. */
|
|
2
|
+
const NOTION_API_BASE = "https://api.notion.com/v1";
|
|
3
|
+
/** Default Notion API version. */
|
|
4
|
+
const NOTION_API_VERSION = "2022-06-28";
|
|
5
|
+
/** Module-level Notion configuration. */
|
|
6
|
+
let config = null;
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the registered Notion config or throws.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
function getConfig() {
|
|
12
|
+
if (!config) {
|
|
13
|
+
throw new Error("[Notion] Not configured. Call useInitNotion() first.");
|
|
14
|
+
}
|
|
15
|
+
return config;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Internal helper to make authenticated requests to the Notion API.
|
|
19
|
+
* Handles Authorization header, Notion-Version, and JSON serialization.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
async function notionFetch(endpoint, options = {}) {
|
|
23
|
+
const { token, apiVersion, apiBaseUrl } = getConfig();
|
|
24
|
+
const base = apiBaseUrl ?? NOTION_API_BASE;
|
|
25
|
+
const version = apiVersion ?? NOTION_API_VERSION;
|
|
26
|
+
const url = `${base}${endpoint}`;
|
|
27
|
+
try {
|
|
28
|
+
const response = await fetch(url, {
|
|
29
|
+
...options,
|
|
30
|
+
headers: {
|
|
31
|
+
Authorization: `Bearer ${token}`,
|
|
32
|
+
"Notion-Version": version,
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
...options.headers,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
const errorBody = await response.text().catch(() => null);
|
|
39
|
+
return {
|
|
40
|
+
data: null,
|
|
41
|
+
error: {
|
|
42
|
+
message: `Notion API Error: ${response.statusText}`,
|
|
43
|
+
status: response.status,
|
|
44
|
+
details: errorBody,
|
|
45
|
+
},
|
|
46
|
+
url,
|
|
47
|
+
status: response.status,
|
|
48
|
+
ok: false,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (response.status === 204) {
|
|
52
|
+
return {
|
|
53
|
+
data: null,
|
|
54
|
+
error: null,
|
|
55
|
+
url,
|
|
56
|
+
status: 204,
|
|
57
|
+
ok: true,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const data = (await response.json());
|
|
61
|
+
return { data, error: null, url, status: response.status, ok: true };
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
65
|
+
return {
|
|
66
|
+
data: null,
|
|
67
|
+
error: { message: `Network Error: ${message}`, status: 0 },
|
|
68
|
+
url,
|
|
69
|
+
status: 0,
|
|
70
|
+
ok: false,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/* -------------------------------------------------------------------------- */
|
|
75
|
+
/* Initialization */
|
|
76
|
+
/* -------------------------------------------------------------------------- */
|
|
77
|
+
/**
|
|
78
|
+
* Registers the Notion API configuration. Call this once before any other
|
|
79
|
+
* Notion function.
|
|
80
|
+
*
|
|
81
|
+
* @param cfg - Integration token (starts with "ntn_" or "secret_"), optional
|
|
82
|
+
* API version and base URL.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* import { useInitNotion } from "katanakit-js/adapters/notion";
|
|
87
|
+
*
|
|
88
|
+
* useInitNotion({ token: process.env.NOTION_TOKEN });
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
export function useInitNotion(cfg) {
|
|
92
|
+
config = { ...cfg };
|
|
93
|
+
}
|
|
94
|
+
/* -------------------------------------------------------------------------- */
|
|
95
|
+
/* Pages */
|
|
96
|
+
/* -------------------------------------------------------------------------- */
|
|
97
|
+
/**
|
|
98
|
+
* Retrieves a single Notion page by its ID.
|
|
99
|
+
*
|
|
100
|
+
* Use when you need the full page object including all its properties
|
|
101
|
+
* (title, status, dates, relations, etc.).
|
|
102
|
+
*
|
|
103
|
+
* @param pageId - The page UUID.
|
|
104
|
+
* @returns The page object with all its properties.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const result = await useNotionGetPage("page-id");
|
|
109
|
+
* if (result.ok) console.log(result.data.properties);
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export async function useNotionGetPage(pageId) {
|
|
113
|
+
return notionFetch(`/pages/${pageId}`);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Creates a new Notion page inside a database or as a child of another page.
|
|
117
|
+
*
|
|
118
|
+
* Use to add new entries to a database (tasks, notes, CRM records) or to
|
|
119
|
+
* create nested page structures.
|
|
120
|
+
*
|
|
121
|
+
* @param parent - Where to create the page: `{ type: "database_id", database_id }`
|
|
122
|
+
* for database entries, or `{ type: "page_id", page_id }` for child pages.
|
|
123
|
+
* @param properties - Page properties matching the parent database schema.
|
|
124
|
+
* @param children - Optional block children to populate the page content.
|
|
125
|
+
* @returns The created page.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* // Add a task to a database
|
|
130
|
+
* const result = await useNotionCreatePage(
|
|
131
|
+
* { type: "database_id", database_id: "db-id" },
|
|
132
|
+
* { Name: { title: [{ type: "text", text: { content: "My Task" } }] } },
|
|
133
|
+
* );
|
|
134
|
+
*
|
|
135
|
+
* // Create a child page with content
|
|
136
|
+
* const result = await useNotionCreatePage(
|
|
137
|
+
* { type: "page_id", page_id: "parent-id" },
|
|
138
|
+
* { title: { title: [{ type: "text", text: { content: "Child Page" } }] } },
|
|
139
|
+
* [{ type: "paragraph", paragraph: { rich_text: [{ type: "text", text: { content: "Hello!" } }] } }],
|
|
140
|
+
* );
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
export async function useNotionCreatePage(parent, properties, children) {
|
|
144
|
+
return notionFetch("/pages", {
|
|
145
|
+
method: "POST",
|
|
146
|
+
body: JSON.stringify({ parent, properties, children }),
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Updates properties of an existing Notion page.
|
|
151
|
+
*
|
|
152
|
+
* Use to change a page's status, dates, relations, or any other property
|
|
153
|
+
* without touching the page content (blocks).
|
|
154
|
+
*
|
|
155
|
+
* @param pageId - The page UUID to update.
|
|
156
|
+
* @param properties - Properties to update (only changed properties).
|
|
157
|
+
* @returns The updated page.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* // Mark a task as done
|
|
162
|
+
* await useNotionUpdatePage("page-id", {
|
|
163
|
+
* Status: { select: { name: "Done" } },
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* // Update multiple properties
|
|
167
|
+
* await useNotionUpdatePage("page-id", {
|
|
168
|
+
* Priority: { select: { name: "High" } },
|
|
169
|
+
* DueDate: { date: { start: "2025-12-31" } },
|
|
170
|
+
* });
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
export async function useNotionUpdatePage(pageId, properties) {
|
|
174
|
+
return notionFetch(`/pages/${pageId}`, {
|
|
175
|
+
method: "PATCH",
|
|
176
|
+
body: JSON.stringify({ properties }),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Archives (soft-deletes) a Notion page. The page becomes hidden but
|
|
181
|
+
* can be restored from Notion's trash.
|
|
182
|
+
*
|
|
183
|
+
* @param pageId - The page UUID to archive.
|
|
184
|
+
* @returns The archived page.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```ts
|
|
188
|
+
* await useNotionArchivePage("page-id");
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
export async function useNotionArchivePage(pageId) {
|
|
192
|
+
return notionFetch(`/pages/${pageId}`, {
|
|
193
|
+
method: "PATCH",
|
|
194
|
+
body: JSON.stringify({ archived: true }),
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/* -------------------------------------------------------------------------- */
|
|
198
|
+
/* Blocks */
|
|
199
|
+
/* -------------------------------------------------------------------------- */
|
|
200
|
+
/**
|
|
201
|
+
* Retrieves a single Notion block by its ID.
|
|
202
|
+
*
|
|
203
|
+
* A block is any content element: paragraph, heading, list item, image,
|
|
204
|
+
* table, callout, etc. Use to inspect a specific block's type and content.
|
|
205
|
+
*
|
|
206
|
+
* @param blockId - The block UUID.
|
|
207
|
+
* @returns The block object with its type-specific content.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* const result = await useNotionGetBlock("block-id");
|
|
212
|
+
* if (result.ok) console.log(result.data.type); // "paragraph", "heading_1", etc.
|
|
213
|
+
* ```
|
|
214
|
+
*/
|
|
215
|
+
export async function useNotionGetBlock(blockId) {
|
|
216
|
+
return notionFetch(`/blocks/${blockId}`);
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Retrieves the direct children blocks of a block (single page).
|
|
220
|
+
*
|
|
221
|
+
* Use for manual pagination when you need fine-grained control over
|
|
222
|
+
* cursor-based pagination. For most cases, prefer
|
|
223
|
+
* {@link useNotionListAllBlockChildren} which handles pagination automatically.
|
|
224
|
+
*
|
|
225
|
+
* @param blockId - The parent block ID (usually a page ID).
|
|
226
|
+
* @param options - Pagination: `start_cursor` for next page, `page_size` (max 100).
|
|
227
|
+
* @returns Paginated list of child blocks with `has_more` and `next_cursor`.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* const result = await useNotionGetBlockChildren("page-id");
|
|
232
|
+
* if (result.ok) {
|
|
233
|
+
* console.log(result.data.results); // First page of blocks
|
|
234
|
+
* if (result.data.has_more) {
|
|
235
|
+
* // Fetch next page with result.data.next_cursor
|
|
236
|
+
* }
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
*/
|
|
240
|
+
export async function useNotionGetBlockChildren(blockId, options) {
|
|
241
|
+
const params = new URLSearchParams();
|
|
242
|
+
if (options?.start_cursor)
|
|
243
|
+
params.set("start_cursor", options.start_cursor);
|
|
244
|
+
if (options?.page_size)
|
|
245
|
+
params.set("page_size", String(options.page_size));
|
|
246
|
+
const qs = params.toString();
|
|
247
|
+
return notionFetch(`/blocks/${blockId}/children${qs ? `?${qs}` : ""}`);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Appends new child blocks to a parent block.
|
|
251
|
+
*
|
|
252
|
+
* Use to add content to a page: paragraphs, headings, lists, toggles,
|
|
253
|
+
* code blocks, etc. Blocks are appended at the end.
|
|
254
|
+
*
|
|
255
|
+
* @param blockId - The parent block ID (usually a page ID).
|
|
256
|
+
* @param children - Array of block objects to append.
|
|
257
|
+
* @returns The parent block.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* await useNotionAppendBlocks("page-id", [
|
|
262
|
+
* {
|
|
263
|
+
* type: "heading_2",
|
|
264
|
+
* heading_2: { rich_text: [{ type: "text", text: { content: "Section Title" } }] },
|
|
265
|
+
* },
|
|
266
|
+
* {
|
|
267
|
+
* type: "paragraph",
|
|
268
|
+
* paragraph: { rich_text: [{ type: "text", text: { content: "Body text here." } }] },
|
|
269
|
+
* },
|
|
270
|
+
* ]);
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
export async function useNotionAppendBlocks(blockId, children) {
|
|
274
|
+
return notionFetch(`/blocks/${blockId}/children`, {
|
|
275
|
+
method: "PATCH",
|
|
276
|
+
body: JSON.stringify({ children }),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Updates the content of an existing block.
|
|
281
|
+
*
|
|
282
|
+
* Use to modify text, toggle content, code blocks, etc. without
|
|
283
|
+
* deleting and recreating the block.
|
|
284
|
+
*
|
|
285
|
+
* @param blockId - The block UUID to update.
|
|
286
|
+
* @param content - The new content for the block type (e.g. `{ paragraph: { rich_text: [...] } }`).
|
|
287
|
+
* @returns The updated block.
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```ts
|
|
291
|
+
* await useNotionUpdateBlock("block-id", {
|
|
292
|
+
* paragraph: { rich_text: [{ type: "text", text: { content: "Updated text" } }] },
|
|
293
|
+
* });
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export async function useNotionUpdateBlock(blockId, content) {
|
|
297
|
+
return notionFetch(`/blocks/${blockId}`, {
|
|
298
|
+
method: "PATCH",
|
|
299
|
+
body: JSON.stringify(content),
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Deletes (archives) a Notion block. The block is soft-deleted and
|
|
304
|
+
* can be restored.
|
|
305
|
+
*
|
|
306
|
+
* @param blockId - The block UUID to delete.
|
|
307
|
+
* @returns The deleted block.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* await useNotionDeleteBlock("block-id");
|
|
312
|
+
* ```
|
|
313
|
+
*/
|
|
314
|
+
export async function useNotionDeleteBlock(blockId) {
|
|
315
|
+
return notionFetch(`/blocks/${blockId}`, {
|
|
316
|
+
method: "DELETE",
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
/* -------------------------------------------------------------------------- */
|
|
320
|
+
/* Databases */
|
|
321
|
+
/* -------------------------------------------------------------------------- */
|
|
322
|
+
/**
|
|
323
|
+
* Retrieves a Notion database schema by its ID.
|
|
324
|
+
*
|
|
325
|
+
* Use to inspect the database structure: property names, types, and
|
|
326
|
+
* configuration (select options, formula definitions, etc.).
|
|
327
|
+
*
|
|
328
|
+
* @param databaseId - The database UUID.
|
|
329
|
+
* @returns The database object with its full property schema.
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```ts
|
|
333
|
+
* const result = await useNotionGetDatabase("db-id");
|
|
334
|
+
* if (result.ok) {
|
|
335
|
+
* // See all available properties
|
|
336
|
+
* Object.entries(result.data.properties).forEach(([name, prop]) => {
|
|
337
|
+
* console.log(`${name}: ${prop.type}`);
|
|
338
|
+
* });
|
|
339
|
+
* }
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
export async function useNotionGetDatabase(databaseId) {
|
|
343
|
+
return notionFetch(`/databases/${databaseId}`);
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Queries a Notion database with filters and sorts (single page).
|
|
347
|
+
*
|
|
348
|
+
* Use for manual pagination or when you only need the first page of
|
|
349
|
+
* results. For most cases, prefer {@link useNotionListAllDatabasePages}
|
|
350
|
+
* which handles pagination automatically.
|
|
351
|
+
*
|
|
352
|
+
* @param databaseId - The database UUID to query.
|
|
353
|
+
* @param query - Filter, sort, and pagination options.
|
|
354
|
+
* @returns Paginated list of pages matching the query.
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```ts
|
|
358
|
+
* // Get first page of all entries
|
|
359
|
+
* const all = await useNotionQueryDatabase("db-id");
|
|
360
|
+
*
|
|
361
|
+
* // With filter and sort
|
|
362
|
+
* const filtered = await useNotionQueryDatabase("db-id", {
|
|
363
|
+
* filter: { property: "Status", select: { equals: "Done" } },
|
|
364
|
+
* sorts: [{ property: "Date", direction: "descending" }],
|
|
365
|
+
* page_size: 10,
|
|
366
|
+
* });
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
export async function useNotionQueryDatabase(databaseId, query) {
|
|
370
|
+
return notionFetch(`/databases/${databaseId}/query`, {
|
|
371
|
+
method: "POST",
|
|
372
|
+
body: JSON.stringify(query ?? {}),
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Creates a new Notion database inside a page.
|
|
377
|
+
*
|
|
378
|
+
* Use to programmatically create structured databases with custom
|
|
379
|
+
* property schemas (select options, formulas, relations, etc.).
|
|
380
|
+
*
|
|
381
|
+
* @param parent - The parent page (`{ type: "page_id", page_id }`).
|
|
382
|
+
* @param title - Database title as rich text array.
|
|
383
|
+
* @param properties - Property schema definitions (Name, Status, Date, etc.).
|
|
384
|
+
* @returns The created database.
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* ```ts
|
|
388
|
+
* await useNotionCreateDatabase(
|
|
389
|
+
* { type: "page_id", page_id: "parent-id" },
|
|
390
|
+
* [{ type: "text", text: { content: "My Tasks" } }],
|
|
391
|
+
* {
|
|
392
|
+
* Name: { title: {} },
|
|
393
|
+
* Status: { select: { options: [{ name: "To Do" }, { name: "Done" }] } },
|
|
394
|
+
* Priority: { select: { options: [{ name: "Low" }, { name: "High" }] } },
|
|
395
|
+
* },
|
|
396
|
+
* );
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
export async function useNotionCreateDatabase(parent, title, properties) {
|
|
400
|
+
return notionFetch("/databases", {
|
|
401
|
+
method: "POST",
|
|
402
|
+
body: JSON.stringify({ parent, title, properties }),
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Updates a Notion database title and/or property schemas.
|
|
407
|
+
*
|
|
408
|
+
* Use to rename a database or add/modify property definitions.
|
|
409
|
+
*
|
|
410
|
+
* @param databaseId - The database UUID to update.
|
|
411
|
+
* @param title - New title as rich text array.
|
|
412
|
+
* @param properties - Optional property schema updates to merge.
|
|
413
|
+
* @returns The updated database.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```ts
|
|
417
|
+
* await useNotionUpdateDatabase("db-id", [
|
|
418
|
+
* { type: "text", text: { content: "Renamed Database" } },
|
|
419
|
+
* ]);
|
|
420
|
+
* ```
|
|
421
|
+
*/
|
|
422
|
+
export async function useNotionUpdateDatabase(databaseId, title, properties) {
|
|
423
|
+
const body = { title };
|
|
424
|
+
if (properties)
|
|
425
|
+
body.properties = properties;
|
|
426
|
+
return notionFetch(`/databases/${databaseId}`, {
|
|
427
|
+
method: "PATCH",
|
|
428
|
+
body: JSON.stringify(body),
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
/* -------------------------------------------------------------------------- */
|
|
432
|
+
/* Users */
|
|
433
|
+
/* -------------------------------------------------------------------------- */
|
|
434
|
+
/**
|
|
435
|
+
* Retrieves a Notion workspace member or bot by their user ID.
|
|
436
|
+
*
|
|
437
|
+
* Use to get display name, avatar, or email of the person who created
|
|
438
|
+
* or last edited a page.
|
|
439
|
+
*
|
|
440
|
+
* @param userId - The user UUID (from page.created_by.id or page.last_edited_by.id).
|
|
441
|
+
* @returns The user object.
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* ```ts
|
|
445
|
+
* const result = await useNotionGetUser("user-id");
|
|
446
|
+
* if (result.ok) console.log(result.data.name);
|
|
447
|
+
* ```
|
|
448
|
+
*/
|
|
449
|
+
export async function useNotionGetUser(userId) {
|
|
450
|
+
return notionFetch(`/users/${userId}`);
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Lists all users (members + bots) in the workspace (paginated).
|
|
454
|
+
*
|
|
455
|
+
* Use to enumerate workspace members for assignment, mention, or
|
|
456
|
+
* permission checks.
|
|
457
|
+
*
|
|
458
|
+
* @param options - Pagination: `start_cursor`, `page_size` (max 100).
|
|
459
|
+
* @returns Paginated list of users.
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```ts
|
|
463
|
+
* const result = await useNotionListUsers();
|
|
464
|
+
* if (result.ok) result.data.results.forEach(u => console.log(u.name));
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
export async function useNotionListUsers(options) {
|
|
468
|
+
const params = new URLSearchParams();
|
|
469
|
+
if (options?.start_cursor)
|
|
470
|
+
params.set("start_cursor", options.start_cursor);
|
|
471
|
+
if (options?.page_size)
|
|
472
|
+
params.set("page_size", String(options.page_size));
|
|
473
|
+
const qs = params.toString();
|
|
474
|
+
return notionFetch(`/users${qs ? `?${qs}` : ""}`);
|
|
475
|
+
}
|
|
476
|
+
/* -------------------------------------------------------------------------- */
|
|
477
|
+
/* Search */
|
|
478
|
+
/* -------------------------------------------------------------------------- */
|
|
479
|
+
/**
|
|
480
|
+
* Searches across all pages and databases the integration has access to.
|
|
481
|
+
*
|
|
482
|
+
* Use to find content by keyword when you don't have the page/database ID.
|
|
483
|
+
* Supports filtering by object type (page or database) and sorting by
|
|
484
|
+
* last edit time.
|
|
485
|
+
*
|
|
486
|
+
* @param query - Search options: text query, object type filter, sort direction.
|
|
487
|
+
* @returns Paginated search results (mixed pages and databases).
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts
|
|
491
|
+
* // Search everything for a keyword
|
|
492
|
+
* const result = await useNotionSearchContent({ query: "meeting notes" });
|
|
493
|
+
*
|
|
494
|
+
* // Search only databases
|
|
495
|
+
* const dbs = await useNotionSearchContent({
|
|
496
|
+
* query: "tasks",
|
|
497
|
+
* filter: { value: "database", property: "object" },
|
|
498
|
+
* });
|
|
499
|
+
*
|
|
500
|
+
* // Search only pages, sorted by recent
|
|
501
|
+
* const pages = await useNotionSearchContent({
|
|
502
|
+
* filter: { value: "page", property: "object" },
|
|
503
|
+
* sort: { direction: "descending", timestamp: "last_edited_time" },
|
|
504
|
+
* });
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
export async function useNotionSearchContent(query) {
|
|
508
|
+
return notionFetch("/search", {
|
|
509
|
+
method: "POST",
|
|
510
|
+
body: JSON.stringify(query),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
/* -------------------------------------------------------------------------- */
|
|
514
|
+
/* Pagination Helpers */
|
|
515
|
+
/* -------------------------------------------------------------------------- */
|
|
516
|
+
/**
|
|
517
|
+
* Fetches ALL child blocks of a block, automatically handling cursor pagination.
|
|
518
|
+
*
|
|
519
|
+
* Use when you need the complete content of a page without worrying about
|
|
520
|
+
* pagination cursors. Loops through all pages until `has_more` is false.
|
|
521
|
+
*
|
|
522
|
+
* @param blockId - The parent block ID (usually a page ID).
|
|
523
|
+
* @returns All child blocks as a flat array.
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```ts
|
|
527
|
+
* const result = await useNotionListAllBlockChildren("page-id");
|
|
528
|
+
* if (result.ok) {
|
|
529
|
+
* console.log(`Total blocks: ${result.data.length}`);
|
|
530
|
+
* result.data.forEach(block => console.log(block.type));
|
|
531
|
+
* }
|
|
532
|
+
* ```
|
|
533
|
+
*/
|
|
534
|
+
export async function useNotionListAllBlockChildren(blockId) {
|
|
535
|
+
const allBlocks = [];
|
|
536
|
+
let cursor;
|
|
537
|
+
do {
|
|
538
|
+
const result = await useNotionGetBlockChildren(blockId, {
|
|
539
|
+
start_cursor: cursor,
|
|
540
|
+
page_size: 100,
|
|
541
|
+
});
|
|
542
|
+
if (!result.ok)
|
|
543
|
+
return result;
|
|
544
|
+
allBlocks.push(...result.data.results);
|
|
545
|
+
cursor = result.data.has_more ? (result.data.next_cursor ?? undefined) : undefined;
|
|
546
|
+
} while (cursor);
|
|
547
|
+
return {
|
|
548
|
+
data: allBlocks,
|
|
549
|
+
error: null,
|
|
550
|
+
url: "",
|
|
551
|
+
status: 200,
|
|
552
|
+
ok: true,
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Fetches ALL pages in a database, automatically handling cursor pagination.
|
|
557
|
+
*
|
|
558
|
+
* Use when you need every entry from a database without worrying about
|
|
559
|
+
* pagination. Supports optional filters and sorts. Loops through all
|
|
560
|
+
* pages until `has_more` is false.
|
|
561
|
+
*
|
|
562
|
+
* @param databaseId - The database UUID.
|
|
563
|
+
* @param filter - Optional filter to apply (same syntax as Notion API).
|
|
564
|
+
* @param sorts - Optional sort options.
|
|
565
|
+
* @returns All pages matching the filter as a flat array.
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* ```ts
|
|
569
|
+
* // Get ALL pages in a database
|
|
570
|
+
* const result = await useNotionListAllDatabasePages("db-id");
|
|
571
|
+
* if (result.ok) console.log(`Total entries: ${result.data.length}`);
|
|
572
|
+
*
|
|
573
|
+
* // Get only published pages, sorted by date
|
|
574
|
+
* const published = await useNotionListAllDatabasePages(
|
|
575
|
+
* "db-id",
|
|
576
|
+
* { property: "Status", select: { equals: "Published" } },
|
|
577
|
+
* [{ property: "Date", direction: "descending" }],
|
|
578
|
+
* );
|
|
579
|
+
* ```
|
|
580
|
+
*/
|
|
581
|
+
export async function useNotionListAllDatabasePages(databaseId, filter, sorts) {
|
|
582
|
+
const allPages = [];
|
|
583
|
+
let cursor;
|
|
584
|
+
do {
|
|
585
|
+
const result = await useNotionQueryDatabase(databaseId, {
|
|
586
|
+
filter,
|
|
587
|
+
sorts,
|
|
588
|
+
start_cursor: cursor,
|
|
589
|
+
page_size: 100,
|
|
590
|
+
});
|
|
591
|
+
if (!result.ok)
|
|
592
|
+
return result;
|
|
593
|
+
allPages.push(...result.data.results);
|
|
594
|
+
cursor = result.data.has_more ? (result.data.next_cursor ?? undefined) : undefined;
|
|
595
|
+
} while (cursor);
|
|
596
|
+
return {
|
|
597
|
+
data: allPages,
|
|
598
|
+
error: null,
|
|
599
|
+
url: "",
|
|
600
|
+
status: 200,
|
|
601
|
+
ok: true,
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
//# sourceMappingURL=notion.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion.service.js","sourceRoot":"","sources":["../../../src/adapters/notion/notion.service.ts"],"names":[],"mappings":"AAoBA,mCAAmC;AACnC,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAEpD,kCAAkC;AAClC,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAExC,yCAAyC;AACzC,IAAI,MAAM,GAAwB,IAAI,CAAC;AAEvC;;;GAGG;AACH,SAAS,SAAS;IACjB,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,WAAW,CACzB,QAAgB,EAChB,UAAuB,EAAE;IAEzB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;IACtD,MAAM,IAAI,GAAG,UAAU,IAAI,eAAe,CAAC;IAC3C,MAAM,OAAO,GAAG,UAAU,IAAI,kBAAkB,CAAC;IACjD,MAAM,GAAG,GAAG,GAAG,IAAI,GAAG,QAAQ,EAAE,CAAC;IAEjC,IAAI,CAAC;QACJ,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YACjC,GAAG,OAAO;YACV,OAAO,EAAE;gBACR,aAAa,EAAE,UAAU,KAAK,EAAE;gBAChC,gBAAgB,E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G,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpF,CAAC,QAAQ,MAAM,EAAE;IAEjB,OAAO;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,EAAE;QACP,MAAM,EAAE,GAAG;QACX,EAAE,EAAE,IAAI;KACR,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { WordPressAuth, WordPressConfig, WpAcfFields, WpBatchOperation, WpBatchResult, WpCategory, WpCategoryCreate, WpCategoryUpdate, WpComment, WpCommentCreate, WpCommentUpdate, WpEmbedded, WpMedia, WpMediaMeta, WpMediaUpdate, WpPage, WpPageCreate, WpPageUpdate, WpPost, WpPostCreate, WpPostUpdate, WpQueryParams, WpTag, WpTagCreate, WpTagUpdate, WpUser, WpUserCreate, WpUserUpdate, } from "../../types/index.js";
|
|
2
|
+
export { useInitWordPress, useWpBatch, useWpCreateCategory, useWpCreateComment, useWpCreateCustomPost, useWpCreatePage, useWpCreatePost, useWpCreateTag, useWpCreateUser, useWpDeleteCategory, useWpDeleteComment, useWpDeleteCustomPost, useWpDeleteMedia, useWpDeletePage, useWpDeletePost, useWpDeleteTag, useWpDeleteUser, useWpFindPostBySlug, useWpGetCategories, useWpGetCategory, useWpGetComment, useWpGetComments, useWpGetCurrentUser, useWpGetCustomPost, useWpGetCustomPosts, useWpGetMedia, useWpGetMediaItem, useWpGetPage, useWpGetPages, useWpGetPost, useWpGetPosts, useWpGetTag, useWpGetTags, useWpGetUser, useWpGetUsers, useWpListAllPosts, useWpSearchAllPosts, useWpUpdateCategory, useWpUpdateComment, useWpUpdateCustomPost, useWpUpdateMedia, useWpUpdatePage, useWpUpdatePost, useWpUpdateTag, useWpUpdateUser, useWpUploadMedia, } from "./wordpress.service.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/wordpress/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACX,aAAa,EACb,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,eAAe,EACf,UAAU,EACV,OAAO,EACP,WAAW,EACX,aAAa,EACb,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,KAAK,EACL,WAAW,EACX,WAAW,EACX,MAAM,EACN,YAAY,EACZ,YAAY,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,GAChB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { useInitWordPress, useWpBatch, useWpCreateCategory, useWpCreateComment, useWpCreateCustomPost, useWpCreatePage, useWpCreatePost, useWpCreateTag, useWpCreateUser, useWpDeleteCategory, useWpDeleteComment, useWpDeleteCustomPost, useWpDeleteMedia, useWpDeletePage, useWpDeletePost, useWpDeleteTag, useWpDeleteUser, useWpFindPostBySlug, useWpGetCategories, useWpGetCategory, useWpGetComment, useWpGetComments, useWpGetCurrentUser, useWpGetCustomPost, useWpGetCustomPosts, useWpGetMedia, useWpGetMediaItem, useWpGetPage, useWpGetPages, useWpGetPost, useWpGetPosts, useWpGetTag, useWpGetTags, useWpGetUser, useWpGetUsers, useWpListAllPosts, useWpSearchAllPosts, useWpUpdateCategory, useWpUpdateComment, useWpUpdateCustomPost, useWpUpdateMedia, useWpUpdatePage, useWpUpdatePost, useWpUpdateTag, useWpUpdateUser, useWpUploadMedia, } from "./wordpress.service.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/wordpress/index.ts"],"names":[],"mappings":"AA8BA,OAAO,EACN,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,GAChB,MAAM,wBAAwB,CAAC"}
|