@notionhq/custom-blocks 0.2.24 → 0.3.0
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 +8 -5
- package/dist/bridge/SandboxBridge.d.ts +15 -14
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +117 -35
- package/dist/bridge/dataSources/resolve.d.ts +1 -3
- package/dist/bridge/dataSources/resolve.d.ts.map +1 -1
- package/dist/bridge/dataSources/resolve.js +1 -11
- package/dist/bridge/dataSources/subscribe.d.ts +2 -1
- package/dist/bridge/dataSources/subscribe.d.ts.map +1 -1
- package/dist/bridge/dataSources/subscribe.js +6 -1
- package/dist/bridge/hostState.d.ts +11 -39
- package/dist/bridge/hostState.d.ts.map +1 -1
- package/dist/bridge/hostState.js +5 -50
- package/dist/bridge/page.d.ts +14 -0
- package/dist/bridge/page.d.ts.map +1 -0
- package/dist/bridge/page.js +59 -0
- package/dist/bridge/sandboxClient.d.ts +8 -14
- package/dist/bridge/sandboxClient.d.ts.map +1 -1
- package/dist/bridge/sandboxClient.js +13 -21
- package/dist/dataSources.d.ts +8 -0
- package/dist/dataSources.d.ts.map +1 -0
- package/dist/dataSources.js +103 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/protocol/dataSources/dataSourcePage.d.ts +3 -5
- package/dist/protocol/dataSources/dataSourcePage.js +2 -3
- package/dist/protocol/dataSources/propertySchema.d.ts +1 -0
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/messages/createPage.js +2 -2
- package/dist/protocol/messages/createPageResult.d.ts +468 -1
- package/dist/protocol/messages/createPageResult.js +17 -2
- package/dist/protocol/messages/getPage.d.ts +468 -1
- package/dist/protocol/messages/getPage.js +18 -3
- package/dist/protocol/messages/hostToSandbox.d.ts +2587 -178
- package/dist/protocol/messages/hostToSandbox.js +24 -12
- package/dist/protocol/messages/openExternalUrl.d.ts +32 -0
- package/dist/protocol/messages/openExternalUrl.js +26 -0
- package/dist/protocol/messages/queryDataSourceResult.d.ts +468 -1
- package/dist/protocol/messages/queryDataSourceResult.js +18 -2
- package/dist/protocol/messages/sandboxToHost.d.ts +6 -0
- package/dist/protocol/messages/sandboxToHost.js +2 -0
- package/dist/protocol/messages/updatePage.d.ts +1 -0
- package/dist/protocol/messages/updatePage.js +4 -3
- package/dist/protocol/messages/updatePageResult.d.ts +467 -1
- package/dist/protocol/messages/updatePageResult.js +16 -2
- package/dist/protocol/pages/page.d.ts +386 -6
- package/dist/protocol/pages/page.js +23 -2
- package/dist/protocol/protocolVersion.d.ts +2 -1
- package/dist/protocol/protocolVersion.js +4 -1
- package/dist/react/useDataSource.d.ts +1 -1
- package/dist/react/useDataSource.d.ts.map +1 -1
- package/dist/react/useDataSource.js +1 -3
- package/dist/types.d.ts +55 -96
- package/dist/types.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/docs/block-location.md +3 -3
- package/docs/data-sources.md +167 -133
- package/docs/errors.md +9 -9
- package/docs/links.md +44 -0
- package/docs/pages.md +113 -182
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +189 -62
- package/src/bridge/dataSources/resolve.ts +1 -20
- package/src/bridge/dataSources/subscribe.ts +10 -5
- package/src/bridge/hostState.ts +21 -100
- package/src/bridge/page.ts +90 -0
- package/src/bridge/sandboxClient.ts +15 -25
- package/src/dataSources.ts +140 -0
- package/src/index.ts +8 -19
- package/src/react/useDataSource.ts +1 -3
- package/src/types.ts +61 -109
package/docs/pages.md
CHANGED
|
@@ -1,201 +1,119 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pages and unified page objects
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
`pages.get` and `pages.create` return `{ status: "success", page: NotionPage }` on success. Failures
|
|
4
|
+
return `{ status: "error", error }`. Data source methods use the same status envelopes and page
|
|
5
|
+
type.
|
|
5
6
|
|
|
6
7
|
```ts
|
|
7
|
-
import { pages } from "@notionhq/custom-blocks"
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Every helper follows the SDK's [error-handling contract](./errors.md). Check `result.status` before
|
|
11
|
-
reading the success payload.
|
|
12
|
-
|
|
13
|
-
## Creating pages
|
|
14
|
-
|
|
15
|
-
`pages.create` accepts a parent, a property map, and an optional position. Setting an icon or cover
|
|
16
|
-
at creation time is not supported yet; create the page first, then use `pages.update`.
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
const result = await pages.create({
|
|
20
|
-
parent: { type: "data_source_key", key: "tasks" },
|
|
21
|
-
properties: {
|
|
22
|
-
title: {
|
|
23
|
-
type: "title",
|
|
24
|
-
title: [{ type: "text", text: { content: "New task" } }],
|
|
25
|
-
},
|
|
26
|
-
dueDate: { type: "date", date: { start: "2026-06-01" } },
|
|
27
|
-
},
|
|
28
|
-
})
|
|
8
|
+
import { pages, dataSources } from "@notionhq/custom-blocks"
|
|
29
9
|
|
|
10
|
+
const result = await pages.get(pageId)
|
|
30
11
|
if (result.status === "success") {
|
|
31
|
-
|
|
12
|
+
const score = result.page.getPropertyById("score-id")
|
|
13
|
+
await result.page.updateById({ properties: { "score-id": { type: "number", number: 10 } } })
|
|
32
14
|
}
|
|
33
15
|
```
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
location.
|
|
39
|
-
|
|
40
|
-
- A data source parent creates a new row in that data source.
|
|
41
|
-
- A page parent creates a child page (subpage) inside that page.
|
|
42
|
-
|
|
43
|
-
The accepted shape is `CreatePageParent`:
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
type CreatePageParent =
|
|
47
|
-
| { type: "page_id"; page_id: NotionPageId }
|
|
48
|
-
| { type: "data_source_id"; data_source_id: NotionDataSourceId }
|
|
49
|
-
| { type: "data_source_key"; key: string }
|
|
50
|
-
```
|
|
17
|
+
`NotionPageData` contains serializable page fields. The SDK constructs `NotionPage` by adding
|
|
18
|
+
property getters and mutation methods. These methods send bridge messages and are never serialized.
|
|
19
|
+
Both namespaces use this same page type.
|
|
51
20
|
|
|
52
|
-
|
|
53
|
-
is configured, that slot is bound to an actual Notion data source. The SDK resolves the binding and
|
|
54
|
-
creates a row there.
|
|
21
|
+
## Page fields
|
|
55
22
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
23
|
+
`properties` maps property display names to typed values or `null`. Each typed value retains its raw
|
|
24
|
+
property ID. `getPropertyById` scans loaded values and returns the matching value or `null`. Neither
|
|
25
|
+
getter fetches data.
|
|
59
26
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
27
|
+
All pages contain `created_time`, `last_edited_time`, `created_by`, `last_edited_by`, and
|
|
28
|
+
`last_visited_time`. Unavailable metadata uses `null`. These fields are separate from schema
|
|
29
|
+
properties.
|
|
63
30
|
|
|
64
|
-
|
|
31
|
+
Parent, icon, cover, URLs, timestamps, and archive states remain page metadata. Absent icons,
|
|
32
|
+
covers, URLs, and timestamps use explicit `null` values. `is_archived` and `in_trash` include
|
|
33
|
+
inherited state. The SDK does not support trash mutations.
|
|
65
34
|
|
|
66
|
-
|
|
67
|
-
parent resolves to a configured data source:
|
|
68
|
-
|
|
69
|
-
- **Keys** can be either raw Notion property IDs _or_ the data source property keys you declared in
|
|
70
|
-
the manifest. The SDK resolves keys → IDs before forwarding the request. Semantic keys work for
|
|
71
|
-
`parent.type: "data_source_key"` and for `parent.type: "data_source_id"` when that ID matches a
|
|
72
|
-
data source delivered by `init` / `dataSourcesChanged`; use raw property IDs for `page_id` parents
|
|
73
|
-
or unmapped data sources.
|
|
74
|
-
- **Values** (`NotionPagePropertyInputValue`) may omit `id` — the SDK fills in the final raw ID for
|
|
75
|
-
you.
|
|
76
|
-
|
|
77
|
-
So if your manifest declares `title` and `dueDate`, you can write them by name (as in the example
|
|
78
|
-
above) instead of looking up the raw IDs.
|
|
79
|
-
|
|
80
|
-
### Where the new page lands
|
|
81
|
-
|
|
82
|
-
For a `page_id` parent, `position` is a `NotionCreatePagePosition` and controls placement inside the
|
|
83
|
-
parent:
|
|
84
|
-
|
|
85
|
-
- `{ type: "start" }` / `{ type: "end" }` — prepend or append (default).
|
|
86
|
-
- `{ type: "before", blockId }` / `{ type: "after", blockId }` — insert as a sibling of the given
|
|
87
|
-
block (which can be nested anywhere under the parent).
|
|
88
|
-
|
|
89
|
-
Do not pass `position` with a `data_source_id` or `data_source_key` parent. Data source rows are
|
|
90
|
-
ordered by the view rather than by sibling anchors.
|
|
91
|
-
|
|
92
|
-
## Reading pages
|
|
93
|
-
|
|
94
|
-
`pages.get(pageId)` fetches a single page by ID:
|
|
35
|
+
## Data source context
|
|
95
36
|
|
|
96
37
|
```ts
|
|
97
|
-
const result = await
|
|
98
|
-
if (result.status === "
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
38
|
+
const result = await dataSources.getPage("tasks", pageId)
|
|
39
|
+
if (result.status === "success") {
|
|
40
|
+
const { page, propertyIdsByKey } = result
|
|
41
|
+
const score = page.getPropertyByKey("score")
|
|
42
|
+
await page.updateByKey({ properties: { score: { type: "number", number: 10 } } })
|
|
43
|
+
}
|
|
102
44
|
```
|
|
103
45
|
|
|
104
|
-
`
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Archiving keeps content you no longer actively use without deleting it.
|
|
110
|
-
[Learn about Archive](https://www.notion.com/help/archive-pages).
|
|
46
|
+
`dataSourceKey` identifies the retained manifest data source context. It is `null` for pages
|
|
47
|
+
returned by the Pages namespace. `getPropertyByKey` returns `null` without context or for invalid,
|
|
48
|
+
unbound, or missing properties. The shared `propertyIdsByKey` map converts manifest keys to raw
|
|
49
|
+
property IDs. Unbound keys map to `undefined`. Pages contain no binding maps.
|
|
111
50
|
|
|
112
|
-
|
|
113
|
-
archived.
|
|
51
|
+
## Create pages
|
|
114
52
|
|
|
115
|
-
|
|
53
|
+
`pages.create` retains `CreatePageArgs` and all `CreatePageParent` variants:
|
|
116
54
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
[Learn about Trash retention](https://www.notion.com/help/custom-data-retention-settings).
|
|
55
|
+
- `{ type: "page_id", page_id }` creates a child page.
|
|
56
|
+
- `{ type: "data_source_id", data_source_id }` creates a data source row.
|
|
57
|
+
- `{ type: "data_source_key", key }` creates a row using a manifest binding.
|
|
121
58
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## Updating pages
|
|
125
|
-
|
|
126
|
-
`pages.update` writes back to a page. The optional fields (`properties`, `icon`, `cover`,
|
|
127
|
-
`is_archived`) are independent — supply only what you want to change:
|
|
59
|
+
Only page parents accept `NotionCreatePagePosition`. Its variants are `start`, `end`, `before`, and
|
|
60
|
+
`after`. Before and after positions require a `blockId`.
|
|
128
61
|
|
|
129
62
|
```ts
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
properties: {
|
|
133
|
-
"%5C%3FX%3D": {
|
|
134
|
-
id: "%5C%3FX%3D",
|
|
135
|
-
type: "checkbox",
|
|
136
|
-
checkbox: true,
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
icon: { type: "emoji", emoji: "✅" },
|
|
63
|
+
const page = await pages.create({
|
|
64
|
+
parent: { type: "page_id", page_id: parentPageId },
|
|
65
|
+
properties: { title: { type: "title", title: [{ text: { content: "New page" } }] } },
|
|
140
66
|
})
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
The `properties` map (a `NotionPagePropertyWriteMap`) is keyed by **raw Notion property ID**, and
|
|
144
|
-
each value must repeat that ID as its own `id` field — semantic data source keys aren't accepted
|
|
145
|
-
here. To update a row by configured custom-block key without writing out the raw IDs, use the
|
|
146
|
-
`update` helper on the row returned from `useDataSource` instead; the SDK handles the key → ID
|
|
147
|
-
resolution for you.
|
|
148
|
-
|
|
149
|
-
If you call `pages.update` with no fields to change, it short-circuits and resolves with
|
|
150
|
-
`{ status: "error", error: { code: "invalid_page_update", message: "updatePage requires at least one property.", isRetryable: false } }`
|
|
151
|
-
— no request is sent.
|
|
152
|
-
|
|
153
|
-
## Archiving and unarchiving pages
|
|
154
|
-
|
|
155
|
-
`pages.archive(pageId)` archives a page. `pages.unarchive(pageId)` removes its archive state.
|
|
156
67
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const restored = await pages.unarchive(pageId)
|
|
164
|
-
if (restored.status === "error") {
|
|
165
|
-
console.error(restored.error.message)
|
|
166
|
-
}
|
|
68
|
+
const row = await pages.create({
|
|
69
|
+
parent: { type: "data_source_key", key: "tasks" },
|
|
70
|
+
properties: { title: { type: "title", title: [{ text: { content: "New task" } }] } },
|
|
71
|
+
})
|
|
167
72
|
```
|
|
168
73
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
`UpdatePageResult`.
|
|
74
|
+
Create payloads retain existing property formats and semantic key resolution. Create does not accept
|
|
75
|
+
icons or covers.
|
|
172
76
|
|
|
173
|
-
##
|
|
77
|
+
## Mutate pages
|
|
174
78
|
|
|
175
|
-
|
|
79
|
+
`PageUpdatePayload` accepts properties, icon, cover, and `is_archived`. Each method retains the page
|
|
80
|
+
ID and data source context. Mutation methods return `UpdatePageResult` with the updated page or a
|
|
81
|
+
structured error. Successful writes refresh the same page object.
|
|
176
82
|
|
|
177
|
-
|
|
83
|
+
- `page.updateById` interprets property keys as raw property IDs.
|
|
84
|
+
- `page.updateByKey` interprets property keys as manifest keys.
|
|
85
|
+
- `page.archive()` sets `is_archived` to `true`.
|
|
86
|
+
- `page.unarchive()` sets `is_archived` to `false`.
|
|
178
87
|
|
|
179
|
-
|
|
180
|
-
|
|
88
|
+
ID writes accept `NotionPagePropertyInputMap` and fill omitted value IDs. Mismatched value IDs and
|
|
89
|
+
duplicate properties fail before sending a request. Keyed writes require valid bindings and loaded
|
|
90
|
+
properties. The SDK validates every key before sending any write. A missing context, invalid key,
|
|
91
|
+
unbound key, or missing property produces a local error. An empty update also produces a local
|
|
92
|
+
error.
|
|
181
93
|
|
|
182
|
-
|
|
183
|
-
|
|
94
|
+
Icons use `NotionPageIcon` and covers use `NotionPageCover`. Use emoji, external URLs, or existing
|
|
95
|
+
hosted file URLs. File upload references remain unsupported.
|
|
184
96
|
|
|
185
|
-
|
|
186
|
-
- An external URL — `{ type: "external", external: { url: "https://example.com/cover.png" } }`
|
|
187
|
-
- An existing hosted file URL returned by Notion — `{ type: "file", file: { url: existingUrl } }`
|
|
97
|
+
## Types
|
|
188
98
|
|
|
189
|
-
|
|
99
|
+
- `NotionPage`, `NotionPageId`, and `NotionParent` describe a page and its location.
|
|
100
|
+
- `NotionPagePropertyValue` describes a typed property read.
|
|
101
|
+
- `NotionPagePropertyReadMap` describes the bridge property map.
|
|
102
|
+
- `NotionPagePropertyWriteMap` describes resolved writes with raw IDs.
|
|
103
|
+
- `NotionPagePropertyInputValue` and `NotionPagePropertyInputMap` describe SDK writes.
|
|
104
|
+
- `CreatePageArgs` and `CreatePageParent` describe page creation inputs.
|
|
105
|
+
- `GetPageResult` and `CreatePageResult` contain a successful `NotionPage` or a structured error.
|
|
106
|
+
- `PageUpdatePayload` and `UpdatePageResult` describe page instance updates.
|
|
107
|
+
- `OpenPageOptions`, `OpenPageResult`, and `OpenPageMode` describe navigation.
|
|
190
108
|
|
|
191
109
|
## Property support
|
|
192
110
|
|
|
193
111
|
This table shows property support for custom blocks running in Notion.
|
|
194
112
|
|
|
195
|
-
- **Read value** shows `page.properties`
|
|
196
|
-
|
|
113
|
+
- **Read value** shows `page.properties` after reads, creates, and successful instance writes.
|
|
114
|
+
Unsupported properties return `null`.
|
|
197
115
|
- **Create** covers property writes through `pages.create`.
|
|
198
|
-
- **Update** covers property writes through `
|
|
116
|
+
- **Update** covers property writes through `page.updateById`.
|
|
199
117
|
|
|
200
118
|
Pages outside a data source support only `title`. Other property writes require a data source row
|
|
201
119
|
and a property in its schema.
|
|
@@ -205,7 +123,7 @@ and a property in its schema.
|
|
|
205
123
|
- 🔴 **Unavailable:** The SDK does not expose this operation.
|
|
206
124
|
- ⚫ **Not supported in Notion:** Notion itself does not support this operation in the stated case.
|
|
207
125
|
|
|
208
|
-
| Property type | Read value (`pages.get`) | Create (`pages.create`) | Update (`
|
|
126
|
+
| Property type | Read value (`pages.get`) | Create (`pages.create`) | Update (`page.updateById`) |
|
|
209
127
|
| ------------------- | ---------------------------------------------------- | -------------------------------------------- | -------------------------------------------- |
|
|
210
128
|
| `title` | 🟡 Text array with plain text only | 🟡 Plain text only | 🟡 Plain text only |
|
|
211
129
|
| `rich_text` | 🟡 Text array with plain text only | 🟡 Plain text only | 🟡 Plain text only |
|
|
@@ -251,31 +169,9 @@ and a property in its schema.
|
|
|
251
169
|
properties.
|
|
252
170
|
- Formula, rollup, unique ID, and other omitted types do not return structured page values.
|
|
253
171
|
|
|
254
|
-
For
|
|
172
|
+
For query properties, filters, and sorts, see
|
|
255
173
|
[Data source property support](./data-sources.md#property-support).
|
|
256
174
|
|
|
257
|
-
## Types
|
|
258
|
-
|
|
259
|
-
- `NotionPage` — the page record returned by every successful call.
|
|
260
|
-
- `NotionPageId` — branded string ID for a page.
|
|
261
|
-
- `NotionPageIcon` / `NotionPageCover` — icon and cover variants Notion supports.
|
|
262
|
-
- `NotionParent` — a block's parent reference (`page_id` / `block_id` / `data_source_id` /
|
|
263
|
-
`workspace` / `agent_id` / `unavailable`), as returned on `NotionPage.parent` and by
|
|
264
|
-
`useParent()`.
|
|
265
|
-
- `NotionPagePropertyValue` — a single property value as returned on a `NotionPage`.
|
|
266
|
-
- `NotionPagePropertyInputValue` — a single property value as accepted by `pages.create` /
|
|
267
|
-
`pages.update` (may omit `id` for `create`).
|
|
268
|
-
- `NotionPagePropertyInputMap` — input map for `pages.create` (keys can be raw property IDs, or
|
|
269
|
-
semantic keys when creating into a mapped data source).
|
|
270
|
-
- `NotionPagePropertyReadMap`: maps property IDs to returned property values.
|
|
271
|
-
- `NotionPagePropertyWriteMap` — input map for `pages.update` (raw property IDs only).
|
|
272
|
-
- `NotionCreatePagePosition` — `start` / `end` / `before` / `after` insertion variants.
|
|
273
|
-
- `OpenPageMode` — `"side_peek"` / `"center_peek"`.
|
|
274
|
-
- `OpenPageOptions` / `OpenPageResult`.
|
|
275
|
-
- `CreatePageArgs` / `CreatePageParent` / `CreatePageResult`.
|
|
276
|
-
- `GetPageResult`.
|
|
277
|
-
- `UpdatePageArgs` / `UpdatePageResult`.
|
|
278
|
-
|
|
279
175
|
## Opening pages
|
|
280
176
|
|
|
281
177
|
`pages.open(pageId, { mode })` asks Notion to open a readable page using host-owned navigation:
|
|
@@ -307,3 +203,38 @@ be missing on older hosts.
|
|
|
307
203
|
An empty Files value returns `[]`. If the host can't resolve an entry (for example, you can't read
|
|
308
204
|
the referenced file, or it points to a folder), `pages.get` fails with an error instead of returning
|
|
309
205
|
a partial list.
|
|
206
|
+
|
|
207
|
+
## Mutation results
|
|
208
|
+
|
|
209
|
+
Page instance methods return `UpdatePageResult`: the updated page or a structured error. Successful
|
|
210
|
+
methods refresh the same page object before resolving. Use `updateById` for raw property IDs and
|
|
211
|
+
`updateByKey` for manifest keys.
|
|
212
|
+
|
|
213
|
+
## Namespace methods
|
|
214
|
+
|
|
215
|
+
| Method | Successful return |
|
|
216
|
+
| ---------------------------------- | -------------------------------------------------------------------- |
|
|
217
|
+
| `pages.get(pageId)` | `{ status: "success", page }` |
|
|
218
|
+
| `pages.create(args)` | `{ status: "success", page }` |
|
|
219
|
+
| `pages.open(pageId, options)` | Existing `OpenPageResult` |
|
|
220
|
+
| `dataSources.query(key, options?)` | `{ status: "success", items, propertyIdsByKey, isLoading, hasMore }` |
|
|
221
|
+
| `dataSources.getPage(key, pageId)` | `{ status: "success", page, propertyIdsByKey }` |
|
|
222
|
+
| `dataSources.create(key, payload)` | `{ status: "success", page, propertyIdsByKey }` |
|
|
223
|
+
|
|
224
|
+
The Pages namespace exposes `get`, `create`, and `open`. Use page instance methods for all writes
|
|
225
|
+
and archive changes.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
const fetched = await pages.get(pageId)
|
|
229
|
+
if (fetched.status === "success") {
|
|
230
|
+
const page = fetched.page
|
|
231
|
+
console.log(page.properties.Score)
|
|
232
|
+
const result = await page.updateById({
|
|
233
|
+
properties: { "score-id": { type: "number", number: 10 } },
|
|
234
|
+
})
|
|
235
|
+
if (result.status === "success") console.log(page.properties.Score)
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The successful write refreshes this page before the promise resolves. Separately fetched pages
|
|
240
|
+
remain independent objects.
|