@haustle/notion-orm 0.0.48 → 0.0.49
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 +183 -122
- package/build/src/ast/agents/generate-agents-cli.d.ts.map +1 -1
- package/build/src/ast/agents/generate-agents-cli.js +1 -3
- package/build/src/ast/agents/generate-agents-cli.js.map +1 -1
- package/build/src/ast/database/generate-databases-cli.d.ts.map +1 -1
- package/build/src/ast/database/generate-databases-cli.js +2 -0
- package/build/src/ast/database/generate-databases-cli.js.map +1 -1
- package/build/src/ast/demo/demo-entry-builders.d.ts +2 -0
- package/build/src/ast/demo/demo-entry-builders.d.ts.map +1 -1
- package/build/src/ast/demo/demo-entry-builders.js +15 -11
- package/build/src/ast/demo/demo-entry-builders.js.map +1 -1
- package/build/src/ast/demo/demo-playground-spec.d.ts.map +1 -1
- package/build/src/ast/demo/demo-playground-spec.js +0 -26
- package/build/src/ast/demo/demo-playground-spec.js.map +1 -1
- package/build/src/ast/demo/demo-workspace-builder.d.ts.map +1 -1
- package/build/src/ast/demo/demo-workspace-builder.js +26 -5
- package/build/src/ast/demo/demo-workspace-builder.js.map +1 -1
- package/build/src/ast/shared/constants.d.ts +10 -0
- package/build/src/ast/shared/constants.d.ts.map +1 -1
- package/build/src/ast/shared/constants.js +9 -0
- package/build/src/ast/shared/constants.js.map +1 -1
- package/build/src/ast/shared/emit/orm-index-emitter.d.ts.map +1 -1
- package/build/src/ast/shared/emit/orm-index-emitter.js +65 -27
- package/build/src/ast/shared/emit/orm-index-emitter.js.map +1 -1
- package/build/src/base.d.ts +3 -2
- package/build/src/base.d.ts.map +1 -1
- package/build/src/base.js +2 -1
- package/build/src/base.js.map +1 -1
- package/build/src/cli/index.js +2 -0
- package/build/src/cli/index.js.map +1 -1
- package/build/src/client/database/DatabaseClient.d.ts +4 -5
- package/build/src/client/database/DatabaseClient.d.ts.map +1 -1
- package/build/src/client/database/DatabaseClient.js +6 -2
- package/build/src/client/database/DatabaseClient.js.map +1 -1
- package/build/src/client/database/create-page-result.d.ts +8 -0
- package/build/src/client/database/create-page-result.d.ts.map +1 -0
- package/build/src/client/database/create-page-result.js +31 -0
- package/build/src/client/database/create-page-result.js.map +1 -0
- package/build/src/client/database/types/crud.d.ts +16 -1
- package/build/src/client/database/types/crud.d.ts.map +1 -1
- package/build/src/client/database/types/crud.js +15 -1
- package/build/src/client/database/types/crud.js.map +1 -1
- package/build/src/config/notionHqRestEnv.d.ts +15 -0
- package/build/src/config/notionHqRestEnv.d.ts.map +1 -0
- package/build/src/config/notionHqRestEnv.js +30 -0
- package/build/src/config/notionHqRestEnv.js.map +1 -0
- package/build/src/index.d.ts +2 -2
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +1 -1
- package/build/src/index.js.map +1 -1
- package/build/src/runtime-constants.d.ts +3 -0
- package/build/src/runtime-constants.d.ts.map +1 -1
- package/build/src/runtime-constants.js +3 -0
- package/build/src/runtime-constants.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,36 +1,30 @@
|
|
|
1
1
|
# Notion ORM
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An unofficial [Notion API](https://developers.notion.com/) TypeScript wrapper that leverages static types to deliver a better database (and custom agents) experience
|
|
4
4
|
|
|
5
5
|
## Key Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
7
|
+
- Full type inference when interacting with databases, including `findMany`, `create`, `update`, `delete`, and more
|
|
8
|
+
- Manage databases and agents in Notion
|
|
9
|
+
- Sync remote schema changes in a single command
|
|
9
10
|
- Quickly start/resume chat streams with your agents
|
|
10
|
-
- Access exported property values, schemas, and types
|
|
11
|
-
- Logs console warnings when local vs remote schema drift is detected
|
|
11
|
+
- Access exported property values, schemas, and types from generated modules
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Setup
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
bun add @haustle/notion-orm
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
# Quick start
|
|
19
|
+
You can use npm, pnpm, or yarn to install the package. For CLI commands, `bunx notion …` and `npx notion …` work the same as `bun notion …` if you are not using Bun as your runtime.
|
|
22
20
|
|
|
23
21
|
Initialize config from your project root (recommended):
|
|
24
22
|
|
|
25
23
|
```bash
|
|
26
|
-
|
|
24
|
+
bun notion init
|
|
27
25
|
```
|
|
28
26
|
|
|
29
|
-
Generated config shape:
|
|
30
|
-
|
|
31
27
|
```ts
|
|
32
|
-
// notion.config.ts
|
|
33
|
-
|
|
34
28
|
// If you don't have an API key, sign up for free
|
|
35
29
|
// [here](https://developers.notion.com)
|
|
36
30
|
|
|
@@ -53,15 +47,15 @@ export default NotionConfig;
|
|
|
53
47
|
Add new database to track and generate static types (ex. how to find ID [here](https://developers.notion.com/guides/data-apis/working-with-databases#adding-pages-to-a-database) )
|
|
54
48
|
|
|
55
49
|
```bash
|
|
56
|
-
|
|
50
|
+
bun notion add <database-id>
|
|
57
51
|
```
|
|
58
52
|
|
|
59
53
|
### Adding Custom Agents
|
|
60
54
|
|
|
61
|
-
Agent support requires the [Notion Agents SDK](https://github.com/makenotion/notion-agents-sdk-js), which is **currently in alpha** and not
|
|
55
|
+
Agent support requires the [Notion Agents SDK](https://github.com/makenotion/notion-agents-sdk-js), which is **currently in alpha** and not published to npm. Because of this, a one-command setup handles the entire download-and-install flow for you:
|
|
62
56
|
|
|
63
57
|
```bash
|
|
64
|
-
|
|
58
|
+
bun notion setup-agents-sdk
|
|
65
59
|
```
|
|
66
60
|
|
|
67
61
|
**What this does:**
|
|
@@ -75,110 +69,237 @@ After setup, run `notion sync` to generate agent types. Agents linked to your in
|
|
|
75
69
|
**Updating:** When the upstream SDK receives changes, rerun the same command. It pulls the latest from the cached clone, rebuilds, and reinstalls:
|
|
76
70
|
|
|
77
71
|
```bash
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
bun notion setup-agents-sdk
|
|
73
|
+
bun notion sync
|
|
80
74
|
```
|
|
81
75
|
|
|
82
|
-
If you have not run the setup command, `notion sync` will skip agent generation and only produce database types. Once the SDK is published
|
|
76
|
+
If you have not run the setup command, `notion sync` will skip agent generation and only produce database types. Once the SDK is published to npm, this step will no longer be necessary.
|
|
83
77
|
|
|
84
78
|
Learn more about [Custom Agents](https://www.notion.com/help/custom-agents) in the Notion documentation.
|
|
85
79
|
|
|
86
80
|
### Full sync command (`notion sync`)
|
|
87
81
|
|
|
88
|
-
Fetch/refresh database schemas. If the agents SDK is installed, also syncs custom agents.
|
|
82
|
+
- Fetch/refresh database schemas. If the agents SDK is installed, also syncs custom agents.
|
|
89
83
|
|
|
90
84
|
```bash
|
|
91
|
-
|
|
85
|
+
bun notion sync
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Where sync writes files (`notion/`)
|
|
89
|
+
|
|
90
|
+
`notion sync` writes generated modules under `notion/` at your project root—your synced database schemas, registries, and agent factories. A full sync replaces the entire `notion/` tree so removed databases or agents do not linger.
|
|
91
|
+
|
|
92
|
+
```txt
|
|
93
|
+
notion/
|
|
94
|
+
├── index.ts # NotionORM entry + re-exports
|
|
95
|
+
├── index.js
|
|
96
|
+
├── index.d.ts
|
|
97
|
+
├── databases/
|
|
98
|
+
│ ├── index.ts # `databases` registry barrel
|
|
99
|
+
│ ├── <Database>.ts # one factory module per tracked database (PascalCase stem)
|
|
100
|
+
│ └── metadata.json # sync cache (ids + display names)
|
|
101
|
+
└── agents/
|
|
102
|
+
├── index.ts # `agents` registry barrel
|
|
103
|
+
├── <Agent>.ts # one factory module per agent (PascalCase stem)
|
|
104
|
+
└── metadata.json
|
|
92
105
|
```
|
|
93
106
|
|
|
94
|
-
#
|
|
107
|
+
For the full tree (including declaration maps), how **camelCase** registry keys map to **PascalCase** files, and project-relative import paths, see [Generated exports](#generated-exports) below.
|
|
95
108
|
|
|
96
|
-
###
|
|
109
|
+
### Initialization
|
|
97
110
|
|
|
98
|
-
Create a single ORM instance with your Notion integration key
|
|
111
|
+
Create a single ORM instance with your Notion integration key:
|
|
99
112
|
|
|
100
113
|
```ts
|
|
101
|
-
import { NotionORM } from "./notion
|
|
114
|
+
import { NotionORM } from "./notion";
|
|
102
115
|
|
|
103
116
|
const notion = new NotionORM({
|
|
104
117
|
auth: process.env.NOTION_KEY!,
|
|
105
118
|
});
|
|
106
119
|
|
|
107
120
|
const db = notion.databases.yourDatabaseName; // DatabaseClient
|
|
108
|
-
const agent = notion.agents.yourAgentName; // AgentClient
|
|
121
|
+
const agent = notion.agents.yourAgentName; // AgentClient (after setup-agents-sdk)
|
|
109
122
|
```
|
|
110
123
|
|
|
124
|
+
Optional: set `NOTION_BASE_URL` when you need a different REST API host (e.g. a mock or proxy). Use the origin only, such as `https://api.notion.com`, and do not add `/v1`—the client appends that for you. Applies to database and data-source flows that use `@notionhq/client` (including matching CLI steps); `@notionhq/agents-client` does not use this env variable in this package.
|
|
125
|
+
|
|
111
126
|
Generated database and agent names are camelCased and exposed on an instance of `NotionORM`.
|
|
112
127
|
|
|
113
|
-
- Use `notion.databases.<camelCaseDatabaseName>` for
|
|
114
|
-
- Use `notion.agents.<camelCaseAgentName>` for `chat()`, `chatStream()`, thread helpers, and history APIs.
|
|
115
|
-
|
|
128
|
+
- Use `notion.databases.<camelCaseDatabaseName>` for database operations (`findMany`, `create`, `update`, `delete`, …).
|
|
129
|
+
- Use `notion.agents.<camelCaseAgentName>` for `chat()`, `chatStream()`, thread helpers, and history APIs (requires `notion setup-agents-sdk`).
|
|
130
|
+
|
|
131
|
+
## Databases
|
|
116
132
|
|
|
117
|
-
#
|
|
133
|
+
Every generated database exposes a Prisma-style API with full type inference from your schema. Here are a few highlights—see the [API Reference](#api-reference) for `findFirst`, `findUnique`, `count`, `createMany`, `updateMany`, `upsert`, `deleteMany`, and more.
|
|
118
134
|
|
|
119
|
-
### Create
|
|
135
|
+
### Create a page
|
|
120
136
|
|
|
121
137
|
```ts
|
|
122
138
|
await notion.databases.books.create({
|
|
123
|
-
icon: {
|
|
124
|
-
type: "emoji",
|
|
125
|
-
emoji: "📕",
|
|
126
|
-
},
|
|
127
|
-
// Expected <key,value> is constrained to `books` database schema
|
|
128
139
|
properties: {
|
|
129
140
|
bookName: "Creativity, Inc.",
|
|
141
|
+
author: "Ed Catmull",
|
|
130
142
|
genre: ["Non-fiction"],
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
143
|
+
numberOfPages: 368,
|
|
144
|
+
publishDate: { start: "2014-04-08" },
|
|
134
145
|
},
|
|
146
|
+
icon: { type: "emoji", emoji: "📕" },
|
|
135
147
|
});
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Create a page with markdown content
|
|
151
|
+
|
|
152
|
+
Add body content to a page using Notion's [enhanced markdown format](https://developers.notion.com/guides/data-apis/working-with-markdown-content#block-type-support). Headings, lists, code blocks, quotes, and checklists are all supported.
|
|
136
153
|
|
|
154
|
+
```ts
|
|
155
|
+
await notion.databases.books.create({
|
|
156
|
+
properties: {
|
|
157
|
+
bookName: "Reading Notes",
|
|
158
|
+
},
|
|
159
|
+
markdown: "# Key Takeaways\n\n- Creativity requires candor\n- Protect the new\n\n> \"Quality is the best business plan.\"",
|
|
160
|
+
});
|
|
137
161
|
```
|
|
138
162
|
|
|
139
|
-
|
|
163
|
+
`markdown` is mutually exclusive with `children` / `content`—use one or the other. When `properties.title` is provided, the `# h1` heading is treated as body content; when omitted, Notion extracts it as the page title.
|
|
164
|
+
|
|
165
|
+
### Find many with filters
|
|
140
166
|
|
|
141
167
|
```ts
|
|
142
168
|
const books = await notion.databases.books.findMany({
|
|
143
169
|
where: {
|
|
144
170
|
and: [
|
|
145
171
|
{ genre: { contains: "Non-fiction" } },
|
|
146
|
-
{ publishDate: { on_or_after: "
|
|
147
|
-
{
|
|
148
|
-
or: [
|
|
149
|
-
{ bookName: { contains: "Creativity" } },
|
|
150
|
-
{ bookName: { contains: "Innovation" } },
|
|
151
|
-
],
|
|
152
|
-
},
|
|
172
|
+
{ publishDate: { on_or_after: "2024-01-01" } },
|
|
153
173
|
],
|
|
154
174
|
},
|
|
155
175
|
sortBy: [{ property: "bookName", direction: "ascending" }],
|
|
156
176
|
select: ["bookName", "genre"],
|
|
157
177
|
});
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Update by ID
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
await notion.databases.books.update({
|
|
184
|
+
where: { id: "page-id" },
|
|
185
|
+
properties: { status: "Done", numberOfPages: 460 },
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Delete by filter
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
await notion.databases.books.deleteMany({
|
|
193
|
+
where: { status: { equals: "Archived" } },
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Stream large result sets
|
|
198
|
+
|
|
199
|
+
`size` limits a single request. With `stream: n`, each Notion call returns up to n rows, cursors advance automatically, and `for await` walks the full result one row at a time without buffering everything or hand-rolling `nextCursor` (see [Cursor pagination](#cursor-pagination) and `[findMany](#database-client-methods)` in the API reference).
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
// Notion is queried in chunks of 50; the loop runs once per matching row, not just the first chunk
|
|
203
|
+
for await (const book of notion.databases.books.findMany({ stream: 50 })) {
|
|
204
|
+
console.log(book.bookName);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Cursor pagination
|
|
158
209
|
|
|
210
|
+
```ts
|
|
211
|
+
// First page (after: null); next pages use prev.nextCursor
|
|
212
|
+
const first = await notion.databases.books.findMany({ after: null, size: 10 });
|
|
213
|
+
const next = await notion.databases.books.findMany({
|
|
214
|
+
after: first.nextCursor,
|
|
215
|
+
size: 10,
|
|
216
|
+
});
|
|
217
|
+
// first.data, first.hasMore, next.data
|
|
159
218
|
```
|
|
160
219
|
|
|
161
|
-
|
|
220
|
+
## Agents
|
|
221
|
+
|
|
222
|
+
Agents require the Notion Agents SDK. Run `notion setup-agents-sdk` first, then `notion sync` to generate agent types.
|
|
223
|
+
|
|
224
|
+
Once set up, agents shared with your integration are exposed at `notion.agents.*`.
|
|
225
|
+
|
|
226
|
+
See [Agent methods](#agent-methods) and [Thread response shapes](#thread-response-shapes) for full method signatures, thread helpers, and message APIs.
|
|
227
|
+
|
|
228
|
+
#### Chat and read messages
|
|
162
229
|
|
|
163
230
|
```ts
|
|
164
|
-
const chat = await notion.agents.helpBot.chat({
|
|
165
|
-
|
|
231
|
+
const chat = await notion.agents.helpBot.chat({
|
|
232
|
+
message: "Is the company closed today",
|
|
233
|
+
});
|
|
234
|
+
await notion.agents.helpBot.pollThread(chat.threadId);
|
|
166
235
|
const messages = await notion.agents.helpBot.getMessages(chat.threadId, {
|
|
167
236
|
role: "agent",
|
|
168
237
|
});
|
|
169
238
|
```
|
|
170
239
|
|
|
171
|
-
|
|
240
|
+
#### Stream chat
|
|
172
241
|
|
|
173
242
|
```ts
|
|
174
243
|
const thread = await notion.agents.helpBot.chatStream({
|
|
175
244
|
message: "How can I update my shipping address?",
|
|
176
|
-
onMessage: (
|
|
245
|
+
onMessage: (msg) => {
|
|
246
|
+
if (msg.role === "agent") process.stdout.write(msg.content);
|
|
247
|
+
},
|
|
248
|
+
});
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Basic chat (non-streaming)
|
|
252
|
+
|
|
253
|
+
- Useful when you want a straightforward request/response flow.
|
|
254
|
+
- Helpful when you plan to fetch message history after completion.
|
|
255
|
+
|
|
256
|
+
```ts
|
|
257
|
+
const chat = await notion.agents.yourAgentName.chat({
|
|
258
|
+
message: "Give me a summary of this month",
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
await notion.agents.yourAgentName.pollThread(chat.threadId);
|
|
262
|
+
|
|
263
|
+
const messages = await notion.agents.yourAgentName.getMessages(chat.threadId, {
|
|
264
|
+
role: "agent",
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
#### Continue an existing thread
|
|
269
|
+
|
|
270
|
+
- Useful when you want to preserve context across follow-up prompts.
|
|
271
|
+
- Helpful for chat UIs where users continue the same conversation.
|
|
272
|
+
|
|
273
|
+
```ts
|
|
274
|
+
const nextTurn = await notion.agents.yourAgentName.chat({
|
|
275
|
+
threadId: chat.threadId,
|
|
276
|
+
message: "Now turn that into a grocery list.",
|
|
277
|
+
});
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Streaming patterns
|
|
281
|
+
|
|
282
|
+
How to start a new chat stream (pass `threadId` to resume):
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
import { AgentClient } from "@haustle/notion-orm";
|
|
286
|
+
|
|
287
|
+
const thread = await notion.agents.yourAgentName.chatStream({
|
|
288
|
+
message: "Generate a prep list for that plan.",
|
|
289
|
+
|
|
290
|
+
onMessage: (msg) => {
|
|
291
|
+
if (msg.role === "agent") process.stdout.write(msg.content);
|
|
292
|
+
},
|
|
177
293
|
});
|
|
178
294
|
|
|
295
|
+
const finalResponse = AgentClient.getAgentResponse(thread);
|
|
296
|
+
console.log("Thread ID:", thread.threadId);
|
|
297
|
+
console.log("Final:", finalResponse);
|
|
179
298
|
```
|
|
180
299
|
|
|
181
|
-
#
|
|
300
|
+
# Additional database operations
|
|
301
|
+
|
|
302
|
+
The sections below expand on [Databases](#databases) with more examples. Query filters are typed by your generated schema, including nested compound filters. Find Notion filter operators [here](https://developers.notion.com/reference/post-database-query-filter).
|
|
182
303
|
|
|
183
304
|
## Adding
|
|
184
305
|
|
|
@@ -214,12 +335,8 @@ await notion.databases.books.create({
|
|
|
214
335
|
});
|
|
215
336
|
```
|
|
216
337
|
|
|
217
|
-
`markdown` is mutually exclusive with `children` / `content` — use one or the other. When `properties.title` is provided, the `# h1` heading is treated as body content; when omitted, Notion extracts it as the page title.
|
|
218
|
-
|
|
219
338
|
## Querying
|
|
220
339
|
|
|
221
|
-
Query filters are typed by your generated schema, including nested compound filters. Find Notion filter operators [here](https://developers.notion.com/reference/post-database-query-filter).
|
|
222
|
-
|
|
223
340
|
Example single filter:
|
|
224
341
|
|
|
225
342
|
```ts
|
|
@@ -278,62 +395,6 @@ Successful response shape:
|
|
|
278
395
|
]
|
|
279
396
|
```
|
|
280
397
|
|
|
281
|
-
### Agents
|
|
282
|
-
|
|
283
|
-
Agents are generated from those shared with your integration and exposed at `notion.agents.*`.
|
|
284
|
-
|
|
285
|
-
#### Basic chat (non-streaming)
|
|
286
|
-
|
|
287
|
-
- Useful when you want a straightforward request/response flow.
|
|
288
|
-
- Helpful when you plan to fetch message history after completion.
|
|
289
|
-
|
|
290
|
-
```ts
|
|
291
|
-
const chat = await notion.agents.yourAgentName.chat({
|
|
292
|
-
message: "Give me a summary of this month",
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
await notion.agents.yourAgentName.pollThread(chat.threadId);
|
|
296
|
-
|
|
297
|
-
const messages = await notion.agents.yourAgentName.getMessages(chat.threadId, {
|
|
298
|
-
role: "agent",
|
|
299
|
-
});
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
#### Continue an existing thread
|
|
303
|
-
|
|
304
|
-
- Useful when you want to preserve context across follow-up prompts.
|
|
305
|
-
- Helpful for chat UIs where users continue the same conversation.
|
|
306
|
-
|
|
307
|
-
```ts
|
|
308
|
-
const nextTurn = await notion.agents.yourAgentName.chat({
|
|
309
|
-
threadId: chat.threadId,
|
|
310
|
-
message: "Now turn that into a grocery list.",
|
|
311
|
-
});
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
#### Streaming patterns
|
|
315
|
-
|
|
316
|
-
How to start a new chat stream (pass `threadId` to resume):
|
|
317
|
-
|
|
318
|
-
```ts
|
|
319
|
-
import { AgentClient } from "@haustle/notion-orm";
|
|
320
|
-
|
|
321
|
-
const thread = await notion.agents.yourAgentName.chatStream({
|
|
322
|
-
message: "Generate a prep list for that plan.",
|
|
323
|
-
|
|
324
|
-
onMessage: (msg) => {
|
|
325
|
-
if (msg.role === "agent") process.stdout.write(msg.content);
|
|
326
|
-
},
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const finalResponse = AgentClient.getAgentResponse(thread);
|
|
331
|
-
console.log("Thread ID:", thread.threadId);
|
|
332
|
-
console.log("Final:", finalResponse);
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
See [API Reference](#api-reference) for full method signatures, `ThreadInfo` shape, and message schemas.
|
|
336
|
-
|
|
337
398
|
# API Reference
|
|
338
399
|
|
|
339
400
|
## Runtime access (detailed)
|
|
@@ -379,13 +440,13 @@ See [API Reference](#api-reference) for full method signatures, `ThreadInfo` sha
|
|
|
379
440
|
## Generated exports
|
|
380
441
|
|
|
381
442
|
|
|
382
|
-
| import path | what you get
|
|
383
|
-
| -------------------------------------- |
|
|
384
|
-
| `./notion/` (relative) | `NotionORM` class (generated entry; same as `./notion/index` but shorter)
|
|
385
|
-
| `./notion/databases/<DatabaseName>.js` | `<DatabaseName>(auth)` factory, `PageSchema`, `CreateSchema`, `QuerySchema`,
|
|
386
|
-
| `./notion/agents/<AgentName>.js` | `<AgentName>(auth)` factory that returns an `AgentClient` (PascalCase export; registry keys on `notion.agents` stay camelCase)
|
|
387
|
-
| `./notion/databases/index.js` | `databases` barrel object (all database factories)
|
|
388
|
-
| `./notion/agents/index.js` | `agents` barrel object (all agent factories)
|
|
443
|
+
| import path | what you get | when to use |
|
|
444
|
+
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
445
|
+
| `./notion/` (relative) | `NotionORM` class (generated entry; same as `./notion/index` but shorter) | Typical app code after `notion sync` |
|
|
446
|
+
| `./notion/databases/<DatabaseName>.js` | `<DatabaseName>(auth)` factory, `PageSchema`, `CreateSchema`, `QuerySchema`, `columns` metadata, option tuples (select/status/multi-select), type aliases | Script-level direct DB usage without the `NotionORM` wrapper |
|
|
447
|
+
| `./notion/agents/<AgentName>.js` | `<AgentName>(auth)` factory that returns an `AgentClient` (PascalCase export; registry keys on `notion.agents` stay camelCase) | Script-level direct agent usage |
|
|
448
|
+
| `./notion/databases/index.js` | `databases` barrel object (all database factories) | Dynamic database selection or custom registry wiring |
|
|
449
|
+
| `./notion/agents/index.js` | `agents` barrel object (all agent factories) | Dynamic agent selection or custom registry wiring |
|
|
389
450
|
|
|
390
451
|
|
|
391
452
|
## Thread response shapes
|
|
@@ -460,7 +521,7 @@ All supported properties can be used in typed filters. Formula properties are no
|
|
|
460
521
|
│ └── types # local type bridges
|
|
461
522
|
├── plugins # lint/tooling helpers
|
|
462
523
|
└── notion # generated output (after notion sync)
|
|
463
|
-
├── index.* # import as ./notion/
|
|
524
|
+
├── index.* # import as ./notion/ or ./notion
|
|
464
525
|
├── databases
|
|
465
526
|
└── agents
|
|
466
527
|
```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-agents-cli.d.ts","sourceRoot":"","sources":["../../../../src/ast/agents/generate-agents-cli.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AA0B3E,KAAK,kBAAkB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,KAAK,uBAAuB,GAAG;IAC9B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACpD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACrC,CAAC;AAkCF,MAAM,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kEAAkE;IAClE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,sBAAsB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,GAC5B,UAAU,uBAAuB,KAC/B,OAAO,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"generate-agents-cli.d.ts","sourceRoot":"","sources":["../../../../src/ast/agents/generate-agents-cli.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AA0B3E,KAAK,kBAAkB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,KAAK,uBAAuB,GAAG;IAC9B,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACpD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACrC,CAAC;AAkCF,MAAM,MAAM,sBAAsB,GAAG;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kEAAkE;IAClE,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,sEAAsE;IACtE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oEAAoE;IACpE,sBAAsB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,GAC5B,UAAU,uBAAuB,KAC/B,OAAO,CAAC,sBAAsB,CA2FhC,CAAC"}
|
|
@@ -53,9 +53,7 @@ export const createAgentTypes = async (options) => {
|
|
|
53
53
|
}
|
|
54
54
|
const sdk = await loadAgentsSdk();
|
|
55
55
|
const config = await getNotionConfig();
|
|
56
|
-
const client = new sdk.NotionAgentsClient({
|
|
57
|
-
auth: config.auth,
|
|
58
|
-
});
|
|
56
|
+
const client = new sdk.NotionAgentsClient({ auth: config.auth });
|
|
59
57
|
const configFile = findConfigFile();
|
|
60
58
|
const environment = resolveCodegenEnvironment({ configRuntime: configFile });
|
|
61
59
|
const agentsList = await listAllAgentsForSync(client);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-agents-cli.js","sourceRoot":"","sources":["../../../../src/ast/agents/generate-agents-cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAE3E,OAAO,EAEN,oBAAoB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,uBAAuB,EACvB,yBAAyB,GAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEnE,SAAS,kBAAkB,CAAC,QAA+B;IAC1D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,EAAE,CAAC,aAAa,CACf,YAAY,CAAC,iBAAiB,EAC9B,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CACjC,CAAC;AACH,CAAC;AAgBD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|
|
|
1
|
-
{"version":3,"file":"generate-databases-cli.d.ts","sourceRoot":"","sources":["../../../../src/ast/database/generate-databases-cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generate-databases-cli.d.ts","sourceRoot":"","sources":["../../../../src/ast/database/generate-databases-cli.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAe3E,KAAK,0BAA0B,GAC5B;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,GACf;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AACvC,KAAK,kBAAkB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,KAAK,uBAAuB,GAAG,0BAA0B,GAAG;IAC3D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACpD,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC/B,SAAS,uBAAuB,KAC9B,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAmF7D,CAAC;AA0EF,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAC/C,UAAU,CAAC,OAAO,mBAAmB,CAAC,CACtC,CAAC"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { Client } from "@notionhq/client";
|
|
7
7
|
import fs from "fs";
|
|
8
8
|
import { getNotionConfig } from "../../config/loadConfig.js";
|
|
9
|
+
import { resolveNotionApiBaseUrl } from "../../config/notionHqRestEnv.js";
|
|
9
10
|
import { toUndashedNotionId } from "../../helpers.js";
|
|
10
11
|
import { toPascalCase } from "../shared/ast-builders.js";
|
|
11
12
|
import { readAgentMetadataFromDisk, readDatabaseMetadata, } from "../shared/cached-metadata.js";
|
|
@@ -31,6 +32,7 @@ export const createDatabaseTypes = async (options) => {
|
|
|
31
32
|
const client = new Client({
|
|
32
33
|
auth: config.auth,
|
|
33
34
|
notionVersion: AST_RUNTIME_CONSTANTS.NOTION_API_VERSION,
|
|
35
|
+
baseUrl: resolveNotionApiBaseUrl(),
|
|
34
36
|
});
|
|
35
37
|
const isFullGenerate = options.type === "all";
|
|
36
38
|
const targetIds = isFullGenerate ? config.databases : [options.id];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-databases-cli.js","sourceRoot":"","sources":["../../../../src/ast/database/generate-databases-cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAEN,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,uBAAuB,EACvB,yBAAyB,GAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,qBAAqB,CAAC,QAAgC;IAC9D,MAAM,YAAY,GAAG,YAAY,CAAC,aAAa,CAAC;IAChD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAClC,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,EAAE,CAAC,aAAa,CACf,YAAY,CAAC,YAAY,EACzB,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CACjC,CAAC;AACH,CAAC;AAYD;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,KAAK,EACvC,OAAgC,EAC+B,EAAE;IACjE,MAAM,MAAM,GAAG,MAAM,eAAe,EAAE,CAAC;IACvC,MAAM,WAAW,GAAG,yBAAyB,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,aAAa,EAAE,qBAAqB,CAAC,kBAAkB;
|
|
1
|
+
{"version":3,"file":"generate-databases-cli.js","sourceRoot":"","sources":["../../../../src/ast/database/generate-databases-cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAEN,yBAAyB,EACzB,oBAAoB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,uBAAuB,EACvB,yBAAyB,GAEzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,sBAAsB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,2BA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CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;YACrC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC5C,CAAC;IACF,CAAC;IAED,OAAO,WAAW,CAAC;AACpB,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { DemoPlaygroundSpec } from "./demo-playground-spec";
|
|
2
|
+
/** Shown as the first line in each CodeMirror tab on /demo. */
|
|
3
|
+
export declare const PLAYGROUND_ENTRY_TOP_HINT = "// Edit and try here!\n\n";
|
|
2
4
|
interface ResolvedDatabaseModule {
|
|
3
5
|
moduleName: string;
|
|
4
6
|
databaseTitle: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"demo-entry-builders.d.ts","sourceRoot":"","sources":["../../../../src/ast/demo/demo-entry-builders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"demo-entry-builders.d.ts","sourceRoot":"","sources":["../../../../src/ast/demo/demo-entry-builders.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AAErE,UAAU,sBAAsB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,mBAAmB;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CAClB;AAyBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC5C,IAAI,EAAE,kBAAkB,CAAC;IACzB,eAAe,EAAE,sBAAsB,EAAE,CAAC;CAC1C,GAAG,MAAM,CAsFT;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACzC,IAAI,EAAE,kBAAkB,CAAC;IACzB,YAAY,EAAE,mBAAmB,EAAE,CAAC;CACpC,GAAG,MAAM,CAyCT"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { camelize } from "../../helpers.js";
|
|
2
|
+
import { objectEntries } from "../../typeUtils.js";
|
|
2
3
|
import { toPascalCase } from "../shared/ast-builders.js";
|
|
3
4
|
import { AST_TYPE_NAMES, PLAYGROUND_PATHS } from "../shared/constants.js";
|
|
5
|
+
/** Shown as the first line in each CodeMirror tab on /demo. */
|
|
6
|
+
export const PLAYGROUND_ENTRY_TOP_HINT = "// Edit and try here!\n\n";
|
|
4
7
|
function resolvePropertyValueExportName(propertyName) {
|
|
5
8
|
return `${toPascalCase(camelize(propertyName))}${AST_TYPE_NAMES.PROPERTY_VALUES_SUFFIX}`;
|
|
6
9
|
}
|
|
@@ -9,10 +12,11 @@ function findSelectLikeProperties(spec, databaseTitle) {
|
|
|
9
12
|
if (!db) {
|
|
10
13
|
return [];
|
|
11
14
|
}
|
|
12
|
-
return
|
|
13
|
-
.filter(([, prop]) => prop
|
|
14
|
-
prop.type === "
|
|
15
|
-
|
|
15
|
+
return objectEntries(db.properties)
|
|
16
|
+
.filter(([, prop]) => prop !== undefined &&
|
|
17
|
+
(prop.type === "select" ||
|
|
18
|
+
prop.type === "multi_select" ||
|
|
19
|
+
prop.type === "status"))
|
|
16
20
|
.map(([name]) => name);
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
@@ -34,12 +38,12 @@ export function buildDemoDatabaseEntry(args) {
|
|
|
34
38
|
...enumImports.map((name) => `\t${name},`),
|
|
35
39
|
`\ttype CreateSchema,`,
|
|
36
40
|
].join("\n");
|
|
37
|
-
const schemaEntries =
|
|
41
|
+
const schemaEntries = objectEntries(scenario.create.schemaLiteral)
|
|
38
42
|
.map(([key, value]) => `\t${key}: ${value},`)
|
|
39
43
|
.join("\n");
|
|
40
|
-
const whereEntries =
|
|
44
|
+
const whereEntries = objectEntries(scenario.findMany.where)
|
|
41
45
|
.map(([key, filter]) => {
|
|
42
|
-
const filterEntries =
|
|
46
|
+
const filterEntries = objectEntries(filter)
|
|
43
47
|
.map(([op, val]) => `${op}: ${val}`)
|
|
44
48
|
.join(", ");
|
|
45
49
|
return `\t\t${key}: { ${filterEntries} },`;
|
|
@@ -48,9 +52,9 @@ export function buildDemoDatabaseEntry(args) {
|
|
|
48
52
|
const sortEntries = scenario.findMany.sortBy
|
|
49
53
|
.map((s) => `{ property: "${s.property}", direction: "${s.direction}" }`)
|
|
50
54
|
.join(", ");
|
|
51
|
-
const countWhereEntries =
|
|
55
|
+
const countWhereEntries = objectEntries(scenario.count.where)
|
|
52
56
|
.map(([key, filter]) => {
|
|
53
|
-
const filterEntries =
|
|
57
|
+
const filterEntries = objectEntries(filter)
|
|
54
58
|
.map(([op, val]) => `${op}: ${val}`)
|
|
55
59
|
.join(", ");
|
|
56
60
|
return `\t\t${key}: { ${filterEntries} },`;
|
|
@@ -59,7 +63,7 @@ export function buildDemoDatabaseEntry(args) {
|
|
|
59
63
|
const iconLiteral = scenario.create.icon
|
|
60
64
|
? `\ticon: { type: "emoji", emoji: "${scenario.create.icon.emoji}" },\n`
|
|
61
65
|
: "";
|
|
62
|
-
return
|
|
66
|
+
return `${PLAYGROUND_ENTRY_TOP_HINT}import { NotionORM } from "./${PLAYGROUND_PATHS.BUILD_INDEX_DATABASES}";
|
|
63
67
|
|
|
64
68
|
import {
|
|
65
69
|
${namedImports}
|
|
@@ -104,7 +108,7 @@ export function buildDemoAgentEntry(args) {
|
|
|
104
108
|
if (!chatModule || !streamModule) {
|
|
105
109
|
throw new Error(`Demo agent scenario references agents not found in spec: chat="${scenario.chatAgent}", stream="${scenario.streamAgent}"`);
|
|
106
110
|
}
|
|
107
|
-
return
|
|
111
|
+
return `${PLAYGROUND_ENTRY_TOP_HINT}import { NotionORM } from "./${PLAYGROUND_PATHS.BUILD_INDEX_AGENTS}";
|
|
108
112
|
|
|
109
113
|
const notion = new NotionORM({ auth: "${PLAYGROUND_PATHS.DEMO_AUTH_PLACEHOLDER}" });
|
|
110
114
|
|