@notionhq/custom-blocks 0.2.24 → 0.3.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 +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 +4 -1
- package/dist/bridge/dataSources/subscribe.d.ts.map +1 -1
- package/dist/bridge/dataSources/subscribe.js +14 -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 +104 -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 +19 -4
- package/dist/types.d.ts +59 -97
- 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 +170 -133
- package/docs/errors.md +13 -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 +32 -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 +138 -0
- package/src/index.ts +8 -19
- package/src/react/useDataSource.ts +20 -4
- package/src/types.ts +65 -110
package/dist/types.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import type { NotionCollectionSchema } from "./protocol/dataSources/dataSource.js";
|
|
2
|
-
import type { NotionDataSourceValue } from "./protocol/dataSources/dataSourceValue.js";
|
|
3
|
-
import type { NotionPropertySchema } from "./protocol/dataSources/propertySchema.js";
|
|
4
1
|
import type { NotionSortDirection } from "./protocol/dataSources/sortDirection.js";
|
|
5
2
|
import type { NotionDataSourceId, NotionPageId } from "./protocol/ids.js";
|
|
6
3
|
import type { NotionCreatePagePosition } from "./protocol/messages/createPage.js";
|
|
7
|
-
import type {
|
|
8
|
-
import type { CustomBlockGetPageErrorInfo
|
|
4
|
+
import type { CustomBlockCreatePageErrorInfo } from "./protocol/messages/createPageResult.js";
|
|
5
|
+
import type { CustomBlockGetPageErrorInfo } from "./protocol/messages/getPage.js";
|
|
9
6
|
import type { CustomBlockGetUserErrorInfo, GetUserResultMessage } from "./protocol/messages/getUser.js";
|
|
10
7
|
import type { CustomBlockListUsersErrorInfo, ListUsersMessage, ListUsersResultMessage } from "./protocol/messages/listUsers.js";
|
|
11
8
|
import type { BridgeMessagePayload } from "./protocol/messages/messagePayload.js";
|
|
9
|
+
import type { CustomBlockOpenExternalUrlErrorInfo, OpenExternalUrlResultMessage } from "./protocol/messages/openExternalUrl.js";
|
|
12
10
|
import type { CustomBlockOpenPageErrorInfo, OpenPageMode, OpenPageResultMessage } from "./protocol/messages/openPage.js";
|
|
13
11
|
import type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockRelationFilterOperator, CustomBlockStatusFilterOperator, CustomBlockTextFilterOperator } from "./protocol/messages/queryDataSource.js";
|
|
14
12
|
import type { CustomBlockQueryDataSourceErrorInfo } from "./protocol/messages/queryDataSourceResult.js";
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
13
|
+
import type { CustomBlockUpdatePageErrorInfo } from "./protocol/messages/updatePageResult.js";
|
|
14
|
+
import type { NotionPageCover, NotionPageIcon, NotionPagePropertyValue, NotionPagePropertyWriteMap, notionPageDataSchema } from "./protocol/pages/page.js";
|
|
15
|
+
import type { InferOutput } from "valibot";
|
|
18
16
|
import type { ExclusiveUnion } from "./typeUtils.js";
|
|
19
17
|
export type { CustomBlockErrorInfo } from "./protocol/errors.js";
|
|
20
18
|
export type { NotionDataSourceId, NotionSpaceId, } from "./protocol/ids.js";
|
|
21
19
|
export type { NotionUser, NotionUserId, NotionUserList, } from "./protocol/users/user.js";
|
|
22
|
-
export type { CustomBlockCreatePageErrorInfo, CustomBlockGetPageErrorInfo, CustomBlockGetUserErrorInfo, CustomBlockListUsersErrorInfo, CustomBlockOpenPageErrorInfo, CustomBlockQueryDataSourceErrorInfo, CustomBlockUpdatePageErrorInfo, };
|
|
20
|
+
export type { CustomBlockCreatePageErrorInfo, CustomBlockGetPageErrorInfo, CustomBlockGetUserErrorInfo, CustomBlockListUsersErrorInfo, CustomBlockOpenExternalUrlErrorInfo, CustomBlockOpenPageErrorInfo, CustomBlockQueryDataSourceErrorInfo, CustomBlockUpdatePageErrorInfo, };
|
|
23
21
|
/**
|
|
24
22
|
* Public SDK page property write input. Keys may be raw property IDs or data source
|
|
25
23
|
* property keys. `id` is optional because the SDK resolves the final raw property ID
|
|
26
24
|
* from the map key before sending the bridge message.
|
|
27
25
|
*/
|
|
28
|
-
export type NotionPagePropertyInputValue = NotionPagePropertyWriteMap[string]
|
|
26
|
+
export type NotionPagePropertyInputValue = Exclude<NotionPagePropertyWriteMap[string], {
|
|
27
|
+
type: "created_time" | "last_edited_time" | "created_by" | "last_edited_by" | "last_visited_time";
|
|
28
|
+
}> extends infer PropertyValue ? PropertyValue extends {
|
|
29
29
|
id: string;
|
|
30
30
|
} ? Omit<PropertyValue, "id"> & {
|
|
31
31
|
id?: string;
|
|
@@ -33,48 +33,49 @@ export type NotionPagePropertyInputValue = NotionPagePropertyWriteMap[string] ex
|
|
|
33
33
|
export type NotionPagePropertyInputMap = {
|
|
34
34
|
[propertyIdOrKey: string]: NotionPagePropertyInputValue;
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/** Whether the page or an ancestor is archived. */
|
|
43
|
-
is_archived: boolean;
|
|
44
|
-
/** Whether the page or an ancestor is in Trash. */
|
|
45
|
-
in_trash: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Keyed mapping of raw property IDs to their value. Includes all properties on the data source,
|
|
48
|
-
* including the four built-ins (`created_time`, `last_edited_time`, `created_by`,
|
|
49
|
-
* `last_edited_by`).
|
|
50
|
-
*/
|
|
51
|
-
propertiesById: {
|
|
52
|
-
[propertyId: string]: NotionDataSourceValue | undefined;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* Keyed mapping of user-defined keys to their value. Only includes properties that are mapped
|
|
56
|
-
* to a raw property ID in the data source's `propertyIdsByKey`.
|
|
57
|
-
*/
|
|
58
|
-
propertiesByKey: {
|
|
59
|
-
[key: string]: NotionDataSourceValue | undefined;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Updates this page using the data source's property-key bindings. The SDK resolves property
|
|
63
|
-
* keys to raw property IDs before sending the bridge message to the host.
|
|
64
|
-
*/
|
|
65
|
-
update: (args: NotionDataSourcePageUpdateArgs) => Promise<UpdatePageResult>;
|
|
66
|
-
/** Archives this page. Shorthand for update({ is_archived: true }). */
|
|
36
|
+
export type NotionPage = InferOutput<typeof notionPageDataSchema> & {
|
|
37
|
+
dataSourceKey: string | null;
|
|
38
|
+
getPropertyById: (propertyId: string) => NotionPagePropertyValue | null;
|
|
39
|
+
getPropertyByKey: (propertyKey: string) => NotionPagePropertyValue | null;
|
|
40
|
+
updateById: (payload: PageUpdatePayload) => Promise<UpdatePageResult>;
|
|
41
|
+
updateByKey: (payload: PageUpdatePayload) => Promise<UpdatePageResult>;
|
|
67
42
|
archive: () => Promise<UpdatePageResult>;
|
|
68
|
-
/** Unarchives this page. Shorthand for update({ is_archived: false }). */
|
|
69
43
|
unarchive: () => Promise<UpdatePageResult>;
|
|
70
44
|
};
|
|
71
|
-
export type
|
|
45
|
+
export type PageUpdatePayload = {
|
|
72
46
|
properties?: NotionPagePropertyInputMap;
|
|
73
47
|
icon?: NotionPageIcon;
|
|
74
48
|
cover?: NotionPageCover;
|
|
75
|
-
/** Whether to archive this page. */
|
|
76
49
|
is_archived?: boolean;
|
|
77
50
|
};
|
|
51
|
+
export type GetPageResult = {
|
|
52
|
+
status: "success";
|
|
53
|
+
page: NotionPage;
|
|
54
|
+
} | {
|
|
55
|
+
status: "error";
|
|
56
|
+
error: CustomBlockGetPageErrorInfo;
|
|
57
|
+
};
|
|
58
|
+
export type CreatePageResult = {
|
|
59
|
+
status: "success";
|
|
60
|
+
page: NotionPage;
|
|
61
|
+
} | {
|
|
62
|
+
status: "error";
|
|
63
|
+
error: CustomBlockCreatePageErrorInfo;
|
|
64
|
+
};
|
|
65
|
+
export type DataSourcesPageResult = {
|
|
66
|
+
status: "success";
|
|
67
|
+
page: NotionPage;
|
|
68
|
+
propertyIdsByKey: Record<string, string | undefined>;
|
|
69
|
+
} | {
|
|
70
|
+
status: "error";
|
|
71
|
+
error: CustomBlockGetPageErrorInfo | CustomBlockCreatePageErrorInfo;
|
|
72
|
+
};
|
|
73
|
+
export type DataSourcesQueryResult = ({
|
|
74
|
+
status: "success";
|
|
75
|
+
} & DataSourceSnapshot) | {
|
|
76
|
+
status: "error";
|
|
77
|
+
error: CustomBlockQueryDataSourceErrorInfo;
|
|
78
|
+
};
|
|
78
79
|
export type NotionDataSourceTextFilterOperator = ExclusiveUnion<CustomBlockTextFilterOperator>;
|
|
79
80
|
export type NotionDataSourceNumberFilterOperator = ExclusiveUnion<CustomBlockNumberFilterOperator>;
|
|
80
81
|
export type NotionDataSourceCheckboxFilterOperator = ExclusiveUnion<CustomBlockCheckboxFilterOperator>;
|
|
@@ -128,48 +129,14 @@ export type NotionDataSourceSort = NotionDataSourcePropertyAddress & {
|
|
|
128
129
|
export type NotionDataSourceFilter = ExclusiveUnion<NotionDataSourcePropertyFilter | {
|
|
129
130
|
and: NotionDataSourcePropertyFilter[];
|
|
130
131
|
}>;
|
|
131
|
-
/**
|
|
132
|
-
* Latest live snapshot of a data source query.
|
|
133
|
-
*
|
|
134
|
-
* - `items` — the rows the host has returned so far. Empty until the first response arrives.
|
|
135
|
-
* - `isLoading` — `true` while a query is in flight.
|
|
136
|
-
* - `hasMore` — `true` if the host indicated more rows are available beyond the requested prefix.
|
|
137
|
-
* - `error` — structured error information if the most recent query failed.
|
|
138
|
-
*/
|
|
132
|
+
/** Latest live snapshot of a data source query. */
|
|
139
133
|
export type DataSourceSnapshot = {
|
|
140
|
-
items:
|
|
141
|
-
/**
|
|
142
|
-
* Contains only properties in the database schema.
|
|
143
|
-
* Use this map to resolve property bindings and validate filter and sort references.
|
|
144
|
-
* Undefined when the host does not provide a schema.
|
|
145
|
-
*/
|
|
146
|
-
collectionSchema?: NotionCollectionSchema;
|
|
147
|
-
/**
|
|
148
|
-
* Contains database properties and four synthetic metadata fields.
|
|
149
|
-
* Use this map to describe values in query snapshots.
|
|
150
|
-
* Synthetic entries do not establish filter or sort support.
|
|
151
|
-
*/
|
|
152
|
-
propertySchemasById: {
|
|
153
|
-
[propertyId: string]: NotionPropertySchema;
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Maps user-defined property keys from the manifest to raw Notion property IDs.
|
|
157
|
-
* Keys mapped to `undefined` indicate a declared-but-unbound slot.
|
|
158
|
-
*/
|
|
134
|
+
items: NotionPage[];
|
|
159
135
|
propertyIdsByKey: {
|
|
160
136
|
[key: string]: string | undefined;
|
|
161
137
|
};
|
|
162
|
-
/**
|
|
163
|
-
* Per-property schemas keyed by user-defined keys from the data source's `propertyIdsByKey`.
|
|
164
|
-
* Built-ins are NOT included here. Keys mapped to `undefined` indicate a declared-but-unbound
|
|
165
|
-
* slot.
|
|
166
|
-
*/
|
|
167
|
-
propertySchemasByKey: {
|
|
168
|
-
[key: string]: NotionPropertySchema | undefined;
|
|
169
|
-
};
|
|
170
138
|
isLoading: boolean;
|
|
171
139
|
hasMore: boolean;
|
|
172
|
-
error?: CustomBlockQueryDataSourceErrorInfo;
|
|
173
140
|
};
|
|
174
141
|
export type DataSourceQueryOptions = {
|
|
175
142
|
/** Maximum number of rows to request from the host. Defaults to 20. */
|
|
@@ -182,9 +149,12 @@ export type DataSourceQueryOptions = {
|
|
|
182
149
|
export type SubscribeToDataSourceArgs = {
|
|
183
150
|
key: string;
|
|
184
151
|
onSnapshot: (snapshot: DataSourceSnapshot) => void;
|
|
152
|
+
onError?: (error: CustomBlockQueryDataSourceErrorInfo) => void;
|
|
185
153
|
options?: DataSourceQueryOptions;
|
|
186
154
|
};
|
|
187
|
-
export type UseDataSourceResult = DataSourceSnapshot
|
|
155
|
+
export type UseDataSourceResult = DataSourceSnapshot & {
|
|
156
|
+
error: CustomBlockQueryDataSourceErrorInfo | undefined;
|
|
157
|
+
};
|
|
188
158
|
export type UseDataSourceOptions = DataSourceQueryOptions;
|
|
189
159
|
/**
|
|
190
160
|
* Parent reference accepted by `sdk.pages.create`. Mirrors Notion's public `POST /v1/pages`
|
|
@@ -216,26 +186,18 @@ export type CreatePageArgs = {
|
|
|
216
186
|
properties: NotionPagePropertyInputMap;
|
|
217
187
|
position?: NotionCreatePagePosition;
|
|
218
188
|
};
|
|
219
|
-
/**
|
|
220
|
-
* The result of a `sdk.pages.create` API call.
|
|
221
|
-
*/
|
|
222
|
-
export type CreatePageResult = BridgeMessagePayload<CreatePageResultMessage, CustomBlockCreatePageErrorInfo>;
|
|
223
|
-
export type UpdatePageArgs = Omit<UpdatePageMessage, "type" | "requestId" | "archived"> & {
|
|
224
|
-
/** Whether to archive this page. */
|
|
225
|
-
is_archived?: boolean;
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Result of `sdk.pages.get`.
|
|
229
|
-
*/
|
|
230
|
-
export type GetPageResult = BridgeMessagePayload<GetPageResultMessage, CustomBlockGetPageErrorInfo>;
|
|
231
189
|
export type OpenPageOptions = {
|
|
232
190
|
mode: OpenPageMode;
|
|
233
191
|
};
|
|
234
192
|
export type OpenPageResult = BridgeMessagePayload<OpenPageResultMessage, CustomBlockOpenPageErrorInfo>;
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
193
|
+
export type OpenExternalUrlResult = BridgeMessagePayload<OpenExternalUrlResultMessage, CustomBlockOpenExternalUrlErrorInfo>;
|
|
194
|
+
export type UpdatePageResult = {
|
|
195
|
+
status: "success";
|
|
196
|
+
page: NotionPage;
|
|
197
|
+
} | {
|
|
198
|
+
status: "error";
|
|
199
|
+
error: CustomBlockUpdatePageErrorInfo;
|
|
200
|
+
};
|
|
239
201
|
export type ListUsersArgs = Omit<ListUsersMessage, "type" | "requestId">;
|
|
240
202
|
export type ListUsersResult = BridgeMessagePayload<ListUsersResultMessage, CustomBlockListUsersErrorInfo>;
|
|
241
203
|
export type GetUserResult = BridgeMessagePayload<GetUserResultMessage, CustomBlockGetUserErrorInfo>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAA;AACxG,OAAO,KAAK,EACX,kBAAkB,EAClB,YAAY,EACZ,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yDAAyD,CAAA;AACvG,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAA;AACnH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sDAAsD,CAAA;AACvG,OAAO,KAAK,EACX,2BAA2B,EAC3B,oBAAoB,EACpB,MAAM,sDAAsD,CAAA;AAC7D,OAAO,KAAK,EACX,6BAA6B,EAC7B,gBAAgB,EAChB,sBAAsB,EACtB,MAAM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AE,0BAA0B,CAAA;IACtC,QAAQ,CAAC,EAAE,wBAAwB,CAAA;CACnC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,YAAY,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,oBAAoB,CAChD,qBAAqB,EACrB,4BAA4B,CAC5B,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,CACvD,4BAA4B,EAC5B,mCAAmC,CACnC,CAAA;AAED,MAAM,MAAM,gBAAgB,GACzB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACvC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,8BAA8B,CAAA;CAAE,CAAA;AAE7D,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,gBAAgB,EAAE,MAAM,GAAG,WAAW,CAAC,CAAA;AAExE,MAAM,MAAM,eAAe,GAAG,oBAAoB,CACjD,sBAAsB,EACtB,6BAA6B,CAC7B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAC/C,oBAAoB,EACpB,2BAA2B,CAC3B,CAAA"}
|
package/dist/version.js
CHANGED
package/docs/block-location.md
CHANGED
|
@@ -119,9 +119,9 @@ For anything beyond location — title, icon, properties — fetch an accessible
|
|
|
119
119
|
API: `if (page.type === "page") pages.get(page.id)`. When the containing page itself is
|
|
120
120
|
inaccessible, `customBlock.getPage()` and `usePage()` return `{ type: "unavailable" }` without an
|
|
121
121
|
ID. These location APIs read host-provided context; they do not fetch page content. In contrast,
|
|
122
|
-
`pages.get(pageId)`
|
|
123
|
-
error
|
|
124
|
-
accessible data sources.
|
|
122
|
+
`pages.get(pageId)` fetches a specific page and returns `{ status: "success", page }`. Failures
|
|
123
|
+
return `{ status: "error", error }`. An unavailable containing page does not prevent the custom
|
|
124
|
+
block from using its accessible data sources.
|
|
125
125
|
|
|
126
126
|
When the viewer cannot access the parent resource, the host returns `{ type: "unavailable" }`,
|
|
127
127
|
including on `page.parent` when `page.type === "page"`. This applies to every parent kind, including
|