@notionhq/custom-blocks 0.3.5 → 0.5.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 +2 -2
- package/dist/bridge/SandboxBridge.d.ts +4 -39
- package/dist/bridge/SandboxBridge.d.ts.map +1 -1
- package/dist/bridge/SandboxBridge.js +36 -142
- package/dist/bridge/requests.d.ts +35 -0
- package/dist/bridge/requests.d.ts.map +1 -0
- package/dist/bridge/requests.js +97 -0
- package/dist/dataSources/bridge/resolveDataSourceQuery.d.ts.map +1 -1
- package/dist/dataSources/bridge/resolveDataSourceQuery.js +18 -4
- package/dist/dataSources/bridge/resolveDataSources.js +4 -4
- package/dist/dataSources/createDataSourcePage.d.ts.map +1 -1
- package/dist/dataSources/createDataSourcePage.js +5 -1
- package/dist/dataSources/filters/resolveFilter.d.ts.map +1 -1
- package/dist/dataSources/filters/resolveFilter.js +13 -3
- package/dist/dataSources/filters/types.d.ts +9 -3
- package/dist/dataSources/filters/types.d.ts.map +1 -1
- package/dist/dataSources/properties/resolvePropertyAddress.js +1 -1
- package/dist/dataSources/properties/resolvePropertyWriteMapForDataSource.js +1 -1
- package/dist/dataSources/resolvePageDataSource.js +2 -2
- package/dist/dataSources/subscribeToDataSource.d.ts +1 -4
- package/dist/dataSources/subscribeToDataSource.d.ts.map +1 -1
- package/dist/dataSources/subscribeToDataSource.js +2 -3
- package/dist/dataSources/types.d.ts +2 -0
- package/dist/dataSources/types.d.ts.map +1 -1
- package/dist/files/files.d.ts +2 -0
- package/dist/files/files.d.ts.map +1 -0
- package/dist/files/files.js +1 -0
- package/dist/files/icons.d.ts +2 -0
- package/dist/files/icons.d.ts.map +1 -0
- package/dist/files/icons.js +1 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/initialization/getInitBindingError.js +2 -2
- package/dist/manifest/types.d.ts +5 -4
- package/dist/manifest/types.d.ts.map +1 -1
- package/dist/navigation/openExternalUrl.d.ts.map +1 -1
- package/dist/navigation/openExternalUrl.js +2 -1
- package/dist/pages/bridge/getPageForDataSource.d.ts.map +1 -1
- package/dist/pages/bridge/getPageForDataSource.js +3 -2
- package/dist/pages/bridge/sendCreatePageRequest.d.ts.map +1 -1
- package/dist/pages/bridge/sendCreatePageRequest.js +2 -1
- package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts +14 -2
- package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.d.ts.map +1 -1
- package/dist/pages/bridge/toNotionPageFieldsFromBridgePage.js +0 -1
- package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.d.ts.map +1 -1
- package/dist/pages/bridge/toNotionPagePropertyFromBridgeProperty.js +0 -8
- package/dist/pages/bridge/updatePage.d.ts.map +1 -1
- package/dist/pages/bridge/updatePage.js +20 -5
- package/dist/pages/createPage.d.ts.map +1 -1
- package/dist/pages/createPage.js +5 -1
- package/dist/pages/openPage.d.ts.map +1 -1
- package/dist/pages/openPage.js +2 -1
- package/dist/pages/properties/getPropertyByKey.js +2 -2
- package/dist/pages/types.d.ts +10 -14
- package/dist/pages/types.d.ts.map +1 -1
- package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.d.ts +530 -0
- package/dist/protocol/compatibility/protocol3To10/dataSourceBindings.js +25 -0
- package/dist/protocol/compatibility/protocol3To5/bridgePage.d.ts +12 -11
- package/dist/protocol/compatibility/protocol3To5/bridgePage.js +3 -3
- package/dist/protocol/context/containingPage.d.ts +3 -0
- package/dist/protocol/context/messages/pageChanged.d.ts +3 -0
- package/dist/protocol/context/messages/parentChanged.d.ts +3 -0
- package/dist/protocol/context/parent.d.ts +5 -0
- package/dist/protocol/context/parent.js +6 -1
- package/dist/protocol/dataSources/bridgeArchiveStatus.d.ts +3 -0
- package/dist/protocol/dataSources/bridgeArchiveStatus.js +6 -0
- package/dist/protocol/dataSources/bridgeDataSourceBinding.d.ts +3 -11
- package/dist/protocol/dataSources/bridgeDataSourceBinding.js +5 -5
- package/dist/protocol/dataSources/bridgeDataSourceBindings.d.ts +2 -10
- package/dist/protocol/dataSources/{collectionPointer.d.ts → dataSourcePointer.d.ts} +2 -2
- package/dist/protocol/dataSources/{collectionPointer.js → dataSourcePointer.js} +1 -1
- package/dist/protocol/dataSources/{collectionSchema.d.ts → dataSourceSchema.d.ts} +2 -10
- package/dist/protocol/dataSources/{collectionSchema.js → dataSourceSchema.js} +1 -1
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilter.d.ts +1458 -12
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.d.ts +729 -6
- package/dist/protocol/dataSources/filters/bridgeDataSourceFilterCondition.js +14 -2
- package/dist/protocol/dataSources/filters/peopleFilterOperator.d.ts +3 -3
- package/dist/protocol/dataSources/filters/peopleFilterOperator.js +1 -1
- package/dist/protocol/dataSources/filters/timestampFilterOperator.d.ts +354 -0
- package/dist/protocol/dataSources/filters/timestampFilterOperator.js +4 -0
- package/dist/protocol/dataSources/messages/dataSourcesChanged.d.ts +2 -10
- package/dist/protocol/dataSources/messages/queryDataSource.d.ts +1485 -38
- package/dist/protocol/dataSources/messages/queryDataSource.js +2 -0
- package/dist/protocol/dataSources/notionDataSource.d.ts +3 -19
- package/dist/protocol/dataSources/notionDataSource.js +5 -5
- package/dist/protocol/dataSources/properties/propertySchema.d.ts +4 -13
- package/dist/protocol/dataSources/properties/propertySchema.js +2 -6
- package/dist/protocol/dataSources/resolveDataSourceBinding.d.ts +4 -4
- package/dist/protocol/dataSources/resolveDataSourceBinding.js +2 -2
- package/dist/protocol/files.d.ts +32 -0
- package/dist/protocol/files.js +17 -0
- package/dist/protocol/handshake/connect.d.ts +15 -4
- package/dist/protocol/handshake/init.d.ts +23 -14
- package/dist/protocol/icons.d.ts +32 -0
- package/dist/protocol/icons.js +39 -0
- package/dist/protocol/index.d.ts +25 -19
- package/dist/protocol/index.js +15 -9
- package/dist/protocol/manifest/grants.d.ts +48 -0
- package/dist/protocol/manifest/grants.js +19 -0
- package/dist/protocol/manifest/manifest.d.ts +39 -16
- package/dist/protocol/manifest/manifest.js +17 -11
- package/dist/protocol/messages/hostToSandbox.d.ts +196 -177
- package/dist/protocol/messages/invalidHostMessage.d.ts +2 -0
- package/dist/protocol/messages/invalidHostMessage.js +2 -0
- package/dist/protocol/messages/invalidSandboxMessage.d.ts +2 -0
- package/dist/protocol/messages/invalidSandboxMessage.js +2 -0
- package/dist/protocol/messages/sandboxToHost.d.ts +1571 -50
- package/dist/protocol/navigation/openExternalUrl.d.ts +2 -2
- package/dist/protocol/pages/bridgePage.d.ts +12 -12
- package/dist/protocol/pages/bridgePage.js +3 -4
- package/dist/protocol/pages/makeBridgePage.d.ts +3 -1
- package/dist/protocol/pages/messages/createPage.d.ts +645 -62
- package/dist/protocol/pages/messages/createPage.js +27 -13
- package/dist/protocol/pages/messages/getPage.d.ts +38 -37
- package/dist/protocol/pages/messages/openPage.d.ts +2 -2
- package/dist/protocol/pages/messages/updatePage.d.ts +47 -48
- package/dist/protocol/pages/messages/updatePage.js +3 -3
- package/dist/protocol/pages/pageAppearance.d.ts +9 -28
- package/dist/protocol/pages/pageAppearance.js +11 -31
- package/dist/protocol/pages/properties/bridgePagePropertyMaps.d.ts +4 -20
- package/dist/protocol/pages/properties/bridgePagePropertyValue.d.ts +2 -10
- package/dist/protocol/pages/properties/bridgePagePropertyValue.js +2 -12
- package/dist/protocol/users/makeBridgeUser.d.ts +3 -1
- package/dist/protocol/users/messages/getUser.d.ts +2 -2
- package/dist/protocol/users/messages/listUsers.d.ts +2 -2
- package/dist/protocol/utils/errors.d.ts +6 -4
- package/dist/protocol/utils/errors.js +3 -3
- package/dist/protocol/utils/ids.d.ts +2 -0
- package/dist/protocol/utils/ids.js +1 -0
- package/dist/protocol/utils/protocolVersion.d.ts +3 -1
- package/dist/protocol/utils/protocolVersion.js +5 -1
- package/dist/protocol/utils/readRequestId.d.ts +2 -0
- package/dist/protocol/utils/readRequestId.js +7 -0
- package/dist/react/NotionCustomBlock.d.ts.map +1 -1
- package/dist/react/NotionCustomBlock.js +1 -15
- package/dist/users/getUser.d.ts.map +1 -1
- package/dist/users/getUser.js +2 -1
- package/dist/users/listUsers.d.ts.map +1 -1
- package/dist/users/listUsers.js +4 -2
- package/dist/utils/version.js +1 -1
- package/docs/data-sources.md +85 -83
- package/docs/deployment.md +4 -5
- package/docs/errors.md +47 -5
- package/docs/grants.md +127 -0
- package/docs/pages.md +105 -56
- package/docs/users.md +2 -2
- package/package.json +1 -1
- package/src/bridge/SandboxBridge.ts +44 -243
- package/src/bridge/requests.ts +138 -0
- package/src/dataSources/bridge/resolveDataSourceQuery.ts +24 -4
- package/src/dataSources/bridge/resolveDataSources.ts +4 -4
- package/src/dataSources/createDataSourcePage.ts +5 -1
- package/src/dataSources/filters/resolveFilter.ts +12 -3
- package/src/dataSources/filters/types.ts +7 -4
- package/src/dataSources/properties/resolvePropertyAddress.ts +1 -1
- package/src/dataSources/properties/resolvePropertyWriteMapForDataSource.ts +1 -1
- package/src/dataSources/resolvePageDataSource.ts +2 -2
- package/src/dataSources/subscribeToDataSource.ts +7 -19
- package/src/dataSources/types.ts +3 -0
- package/src/files/files.ts +5 -0
- package/src/files/icons.ts +9 -0
- package/src/index.ts +10 -11
- package/src/initialization/getInitBindingError.ts +2 -2
- package/src/manifest/types.ts +10 -4
- package/src/navigation/openExternalUrl.ts +5 -1
- package/src/pages/bridge/getPageForDataSource.ts +6 -2
- package/src/pages/bridge/sendCreatePageRequest.ts +5 -1
- package/src/pages/bridge/toNotionPageFieldsFromBridgePage.ts +0 -1
- package/src/pages/bridge/toNotionPagePropertyFromBridgeProperty.ts +0 -8
- package/src/pages/bridge/updatePage.ts +29 -9
- package/src/pages/createPage.ts +5 -1
- package/src/pages/openPage.ts +5 -1
- package/src/pages/properties/getPropertyByKey.ts +2 -2
- package/src/pages/types.ts +14 -16
- package/src/react/NotionCustomBlock.tsx +1 -16
- package/src/users/getUser.ts +5 -1
- package/src/users/listUsers.ts +9 -4
- package/dist/bridge/pendingRequests.d.ts +0 -14
- package/dist/bridge/pendingRequests.d.ts.map +0 -1
- package/dist/bridge/pendingRequests.js +0 -28
- package/dist/protocol/dataSources/filters/createdByFilterOperator.d.ts +0 -17
- package/dist/protocol/dataSources/filters/createdByFilterOperator.js +0 -11
- package/dist/protocol/manifest/capabilities.d.ts +0 -37
- package/dist/protocol/manifest/capabilities.js +0 -13
- package/dist/protocol/pages/properties/fileInput.d.ts +0 -16
- package/dist/protocol/pages/properties/fileInput.js +0 -16
- package/dist/react/DebugMessageLog.d.ts +0 -2
- package/dist/react/DebugMessageLog.d.ts.map +0 -1
- package/dist/react/DebugMessageLog.js +0 -23
- package/docs/capabilities.md +0 -111
- package/src/bridge/pendingRequests.ts +0 -28
- package/src/react/DebugMessageLog.tsx +0 -34
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { notionParentSchema } from "../../context/parent.js";
|
|
3
|
-
import {
|
|
3
|
+
import { bridgePageCoverSchema, bridgePageIconSchema, } from "../../pages/pageAppearance.js";
|
|
4
4
|
import { bridgePagePropertyWriteMapSchema } from "../../pages/properties/bridgePagePropertyMaps.js";
|
|
5
5
|
import { notionPageIdSchema } from "../../utils/ids.js";
|
|
6
6
|
export const bridgePageForProtocol3To5Schema = v.object({
|
|
@@ -10,8 +10,8 @@ export const bridgePageForProtocol3To5Schema = v.object({
|
|
|
10
10
|
properties: bridgePagePropertyWriteMapSchema,
|
|
11
11
|
created_time: v.optional(v.string()),
|
|
12
12
|
last_edited_time: v.optional(v.string()),
|
|
13
|
-
icon: v.optional(
|
|
14
|
-
cover: v.optional(
|
|
13
|
+
icon: v.optional(bridgePageIconSchema),
|
|
14
|
+
cover: v.optional(bridgePageCoverSchema),
|
|
15
15
|
url: v.optional(v.string()),
|
|
16
16
|
public_url: v.optional(v.string()),
|
|
17
17
|
/** Whether the page or an ancestor is archived. */
|
|
@@ -24,6 +24,9 @@ export declare const customBlockPageSchema: v.VariantSchema<"type", [v.ObjectSch
|
|
|
24
24
|
}, undefined>, v.ObjectSchema<{
|
|
25
25
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
26
26
|
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
27
|
+
}, undefined>, v.ObjectSchema<{
|
|
28
|
+
readonly type: v.LiteralSchema<"app_installation_id", undefined>;
|
|
29
|
+
readonly app_installation_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAppInstallationId">]>;
|
|
27
30
|
}, undefined>, v.ObjectSchema<{
|
|
28
31
|
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
29
32
|
}, undefined>], undefined>;
|
|
@@ -24,6 +24,9 @@ export declare const pageChangedMessageSchema: v.ObjectSchema<{
|
|
|
24
24
|
}, undefined>, v.ObjectSchema<{
|
|
25
25
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
26
26
|
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
27
|
+
}, undefined>, v.ObjectSchema<{
|
|
28
|
+
readonly type: v.LiteralSchema<"app_installation_id", undefined>;
|
|
29
|
+
readonly app_installation_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAppInstallationId">]>;
|
|
27
30
|
}, undefined>, v.ObjectSchema<{
|
|
28
31
|
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
29
32
|
}, undefined>], undefined>;
|
|
@@ -19,6 +19,9 @@ export declare const parentChangedMessageSchema: v.ObjectSchema<{
|
|
|
19
19
|
}, undefined>, v.ObjectSchema<{
|
|
20
20
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
21
21
|
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
22
|
+
}, undefined>, v.ObjectSchema<{
|
|
23
|
+
readonly type: v.LiteralSchema<"app_installation_id", undefined>;
|
|
24
|
+
readonly app_installation_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAppInstallationId">]>;
|
|
22
25
|
}, undefined>, v.ObjectSchema<{
|
|
23
26
|
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
24
27
|
}, undefined>], undefined>;
|
|
@@ -24,6 +24,9 @@ export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema
|
|
|
24
24
|
}, undefined>, v.ObjectSchema<{
|
|
25
25
|
readonly type: v.LiteralSchema<"agent_id", undefined>;
|
|
26
26
|
readonly agent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAgentId">]>;
|
|
27
|
+
}, undefined>, v.ObjectSchema<{
|
|
28
|
+
readonly type: v.LiteralSchema<"app_installation_id", undefined>;
|
|
29
|
+
readonly app_installation_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionAppInstallationId">]>;
|
|
27
30
|
}, undefined>, v.ObjectSchema<{
|
|
28
31
|
readonly type: v.LiteralSchema<"unavailable", undefined>;
|
|
29
32
|
}, undefined>], undefined>;
|
|
@@ -40,3 +43,5 @@ export declare const notionParentSchema: v.VariantSchema<"type", [v.ObjectSchema
|
|
|
40
43
|
* is exposed, including when a readable child identifies the parent as a data source.
|
|
41
44
|
*/
|
|
42
45
|
export type NotionParent = v.InferOutput<typeof notionParentSchema>;
|
|
46
|
+
/** A parent reference constructed from application records with plain string IDs. */
|
|
47
|
+
export type BridgeParent = v.InferInput<typeof notionParentSchema>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { notionAgentIdSchema, notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, } from "../utils/ids.js";
|
|
2
|
+
import { notionAgentIdSchema, notionAppInstallationIdSchema, notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, } from "../utils/ids.js";
|
|
3
3
|
export const pageParentSchema = v.object({
|
|
4
4
|
type: v.literal("page_id"),
|
|
5
5
|
page_id: notionPageIdSchema,
|
|
@@ -20,6 +20,10 @@ const agentParentSchema = v.object({
|
|
|
20
20
|
type: v.literal("agent_id"),
|
|
21
21
|
agent_id: notionAgentIdSchema,
|
|
22
22
|
});
|
|
23
|
+
const appInstallationParentSchema = v.object({
|
|
24
|
+
type: v.literal("app_installation_id"),
|
|
25
|
+
app_installation_id: notionAppInstallationIdSchema,
|
|
26
|
+
});
|
|
23
27
|
const unavailableParentSchema = v.object({ type: v.literal("unavailable") });
|
|
24
28
|
export const notionParentSchema = v.variant("type", [
|
|
25
29
|
pageParentSchema,
|
|
@@ -27,5 +31,6 @@ export const notionParentSchema = v.variant("type", [
|
|
|
27
31
|
workspaceParentSchema,
|
|
28
32
|
blockParentSchema,
|
|
29
33
|
agentParentSchema,
|
|
34
|
+
appInstallationParentSchema,
|
|
30
35
|
unavailableParentSchema,
|
|
31
36
|
]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
export declare const bridgeDataSourceBindingSchema: v.ObjectSchema<{
|
|
3
|
-
readonly
|
|
3
|
+
readonly dataSourcePointer: v.OptionalSchema<v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
5
5
|
readonly table: v.StringSchema<undefined>;
|
|
6
6
|
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
@@ -10,7 +10,7 @@ export declare const bridgeDataSourceBindingSchema: v.ObjectSchema<{
|
|
|
10
10
|
* schema to validate filter and sort references. Undefined when the host does not provide a
|
|
11
11
|
* database schema.
|
|
12
12
|
*/
|
|
13
|
-
readonly
|
|
13
|
+
readonly dataSourceSchema: v.OptionalSchema<v.ObjectSchema<{
|
|
14
14
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
15
15
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
16
16
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -121,14 +121,6 @@ export declare const bridgeDataSourceBindingSchema: v.ObjectSchema<{
|
|
|
121
121
|
readonly name: v.StringSchema<undefined>;
|
|
122
122
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
123
123
|
readonly type: v.LiteralSchema<"verification", undefined>;
|
|
124
|
-
}, undefined>, v.ObjectSchema<{
|
|
125
|
-
readonly name: v.StringSchema<undefined>;
|
|
126
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
127
|
-
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
128
|
-
}, undefined>, v.ObjectSchema<{
|
|
129
|
-
readonly name: v.StringSchema<undefined>;
|
|
130
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
131
|
-
readonly type: v.LiteralSchema<"location", undefined>;
|
|
132
124
|
}, undefined>, v.ObjectSchema<{
|
|
133
125
|
readonly name: v.StringSchema<undefined>;
|
|
134
126
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -156,7 +148,7 @@ export declare const bridgeDataSourceBindingSchema: v.ObjectSchema<{
|
|
|
156
148
|
readonly propertyIdsByKey: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.OptionalSchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
|
|
157
149
|
/**
|
|
158
150
|
* `true` when the data source is bound but the viewer can't read it. The host omits
|
|
159
|
-
* `
|
|
151
|
+
* `dataSourcePointer`, `dataSourceSchema`, and `propertyIdsByKey`, so the binding reveals
|
|
160
152
|
* nothing about the data source. The block still initializes.
|
|
161
153
|
*/
|
|
162
154
|
readonly inaccessible: v.OptionalSchema<v.LiteralSchema<true, undefined>, undefined>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { dataSourcePointerValidator } from "./dataSourcePointer.js";
|
|
3
|
+
import { notionDataSourceSchemaValidator } from "./dataSourceSchema.js";
|
|
4
4
|
export const bridgeDataSourceBindingSchema = v.object({
|
|
5
|
-
|
|
5
|
+
dataSourcePointer: v.optional(dataSourcePointerValidator),
|
|
6
6
|
/**
|
|
7
7
|
* Describes database properties. Use this schema to resolve property bindings. Use this
|
|
8
8
|
* schema to validate filter and sort references. Undefined when the host does not provide a
|
|
9
9
|
* database schema.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
dataSourceSchema: v.optional(notionDataSourceSchemaValidator),
|
|
12
12
|
/**
|
|
13
13
|
* Maps user-defined property keys to database property IDs. Use this map to resolve a key
|
|
14
14
|
* such as `name` to its database property ID. A value of `undefined` marks a declared
|
|
@@ -18,7 +18,7 @@ export const bridgeDataSourceBindingSchema = v.object({
|
|
|
18
18
|
propertyIdsByKey: v.optional(v.record(v.string(), v.optional(v.string()))),
|
|
19
19
|
/**
|
|
20
20
|
* `true` when the data source is bound but the viewer can't read it. The host omits
|
|
21
|
-
* `
|
|
21
|
+
* `dataSourcePointer`, `dataSourceSchema`, and `propertyIdsByKey`, so the binding reveals
|
|
22
22
|
* nothing about the data source. The block still initializes.
|
|
23
23
|
*/
|
|
24
24
|
inaccessible: v.optional(v.literal(true)),
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
export declare const bridgeDataSourceBindingsSchema: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
3
|
-
readonly
|
|
3
|
+
readonly dataSourcePointer: v.OptionalSchema<v.ObjectSchema<{
|
|
4
4
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
5
5
|
readonly table: v.StringSchema<undefined>;
|
|
6
6
|
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
7
7
|
}, undefined>, undefined>;
|
|
8
|
-
readonly
|
|
8
|
+
readonly dataSourceSchema: v.OptionalSchema<v.ObjectSchema<{
|
|
9
9
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
10
10
|
readonly propertiesById: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
|
|
11
11
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -116,14 +116,6 @@ export declare const bridgeDataSourceBindingsSchema: v.RecordSchema<v.StringSche
|
|
|
116
116
|
readonly name: v.StringSchema<undefined>;
|
|
117
117
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
118
118
|
readonly type: v.LiteralSchema<"verification", undefined>;
|
|
119
|
-
}, undefined>, v.ObjectSchema<{
|
|
120
|
-
readonly name: v.StringSchema<undefined>;
|
|
121
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
122
|
-
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
123
|
-
}, undefined>, v.ObjectSchema<{
|
|
124
|
-
readonly name: v.StringSchema<undefined>;
|
|
125
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
126
|
-
readonly type: v.LiteralSchema<"location", undefined>;
|
|
127
119
|
}, undefined>, v.ObjectSchema<{
|
|
128
120
|
readonly name: v.StringSchema<undefined>;
|
|
129
121
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const dataSourcePointerValidator: v.ObjectSchema<{
|
|
3
3
|
readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>;
|
|
4
4
|
readonly table: v.StringSchema<undefined>;
|
|
5
5
|
readonly spaceId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionSpaceId">]>, undefined>;
|
|
6
6
|
}, undefined>;
|
|
7
|
-
export type
|
|
7
|
+
export type NotionDataSourcePointer = v.InferOutput<typeof dataSourcePointerValidator>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { notionDataSourceIdSchema, notionSpaceIdSchema } from "../utils/ids.js";
|
|
3
|
-
export const
|
|
3
|
+
export const dataSourcePointerValidator = v.object({
|
|
4
4
|
id: notionDataSourceIdSchema,
|
|
5
5
|
table: v.string(),
|
|
6
6
|
spaceId: v.optional(notionSpaceIdSchema),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const notionDataSourceSchemaValidator: v.ObjectSchema<{
|
|
3
3
|
readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.BrandAction<string, "NotionDataSourceId">]>, undefined>;
|
|
4
4
|
/**
|
|
5
5
|
* Describes actual database properties in protocol 5. Protocol 3/4 payloads can also include
|
|
@@ -115,14 +115,6 @@ export declare const notionCollectionSchemaValidator: v.ObjectSchema<{
|
|
|
115
115
|
readonly name: v.StringSchema<undefined>;
|
|
116
116
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
117
117
|
readonly type: v.LiteralSchema<"verification", undefined>;
|
|
118
|
-
}, undefined>, v.ObjectSchema<{
|
|
119
|
-
readonly name: v.StringSchema<undefined>;
|
|
120
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
121
|
-
readonly type: v.LiteralSchema<"last_visited_time", undefined>;
|
|
122
|
-
}, undefined>, v.ObjectSchema<{
|
|
123
|
-
readonly name: v.StringSchema<undefined>;
|
|
124
|
-
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
125
|
-
readonly type: v.LiteralSchema<"location", undefined>;
|
|
126
118
|
}, undefined>, v.ObjectSchema<{
|
|
127
119
|
readonly name: v.StringSchema<undefined>;
|
|
128
120
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -141,4 +133,4 @@ export declare const notionCollectionSchemaValidator: v.ObjectSchema<{
|
|
|
141
133
|
readonly type: v.LiteralSchema<"last_edited_by", undefined>;
|
|
142
134
|
}, undefined>], undefined>, undefined>;
|
|
143
135
|
}, undefined>;
|
|
144
|
-
export type
|
|
136
|
+
export type NotionDataSourceSchema = v.InferOutput<typeof notionDataSourceSchemaValidator>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
import { notionDataSourceIdSchema } from "../utils/ids.js";
|
|
3
3
|
import { notionPropertySchemaSchema } from "./properties/propertySchema.js";
|
|
4
|
-
export const
|
|
4
|
+
export const notionDataSourceSchemaValidator = v.object({
|
|
5
5
|
id: v.optional(notionDataSourceIdSchema),
|
|
6
6
|
/**
|
|
7
7
|
* Describes actual database properties in protocol 5. Protocol 3/4 payloads can also include
|