ncblock 0.0.2 → 0.0.4

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.
Files changed (54) hide show
  1. package/README.md +15 -242
  2. package/dist/bridge/SandboxBridge.d.ts +64 -0
  3. package/dist/bridge/SandboxBridge.d.ts.map +1 -0
  4. package/dist/{notion.js → bridge/SandboxBridge.js} +80 -337
  5. package/dist/bridge/dataSources/resolve.d.ts +22 -0
  6. package/dist/bridge/dataSources/resolve.d.ts.map +1 -0
  7. package/dist/bridge/dataSources/resolve.js +65 -0
  8. package/dist/bridge/dataSources/resolveProperty.d.ts +36 -0
  9. package/dist/bridge/dataSources/resolveProperty.d.ts.map +1 -0
  10. package/dist/bridge/dataSources/resolveProperty.js +67 -0
  11. package/dist/bridge/hostState.d.ts +57 -0
  12. package/dist/bridge/hostState.d.ts.map +1 -0
  13. package/dist/bridge/hostState.js +65 -0
  14. package/dist/bridge/loadManifest.d.ts +9 -0
  15. package/dist/bridge/loadManifest.d.ts.map +1 -0
  16. package/dist/bridge/loadManifest.js +41 -0
  17. package/dist/bridge/messages/getUser.d.ts +32 -0
  18. package/dist/bridge/messages/getUser.d.ts.map +1 -0
  19. package/dist/bridge/messages/getUser.js +24 -0
  20. package/dist/bridge/messages/hostToSandbox.d.ts +45 -0
  21. package/dist/bridge/messages/hostToSandbox.d.ts.map +1 -1
  22. package/dist/bridge/messages/hostToSandbox.js +4 -0
  23. package/dist/bridge/messages/listUsers.d.ts +40 -0
  24. package/dist/bridge/messages/listUsers.d.ts.map +1 -0
  25. package/dist/bridge/messages/listUsers.js +25 -0
  26. package/dist/bridge/messages/sandboxToHost.d.ts +9 -0
  27. package/dist/bridge/messages/sandboxToHost.d.ts.map +1 -1
  28. package/dist/bridge/messages/sandboxToHost.js +4 -0
  29. package/dist/bridge/sandboxClient.d.ts +46 -0
  30. package/dist/bridge/sandboxClient.d.ts.map +1 -0
  31. package/dist/bridge/sandboxClient.js +72 -0
  32. package/dist/bridge/users/user.d.ts +36 -0
  33. package/dist/bridge/users/user.d.ts.map +1 -0
  34. package/dist/bridge/users/user.js +19 -0
  35. package/dist/index.d.ts +3 -2
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +3 -2
  38. package/dist/init.d.ts +44 -0
  39. package/dist/init.d.ts.map +1 -0
  40. package/dist/init.js +49 -0
  41. package/dist/react.d.ts +1 -1
  42. package/dist/react.d.ts.map +1 -1
  43. package/dist/react.js +2 -1
  44. package/dist/types.d.ts +20 -0
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/users.d.ts +15 -0
  47. package/dist/users.d.ts.map +1 -0
  48. package/dist/users.js +18 -0
  49. package/package.json +1 -1
  50. package/dist/notion.d.ts +0 -113
  51. package/dist/notion.d.ts.map +0 -1
  52. package/dist/pages.d.ts +0 -23
  53. package/dist/pages.d.ts.map +0 -1
  54. package/dist/pages.js +0 -30
@@ -0,0 +1,57 @@
1
+ import type { NotionCustomBlockContext } from "./context";
2
+ import type { NotionDataSource } from "./dataSources/dataSource";
3
+ import type { NotionDataSourcePage, NotionDataSourcePageBridge, NotionDataSourcePageUpdateInput, NotionDataSourcePageUpdateResult } from "./dataSources/dataSourcePage";
4
+ import type { NotionPropertySchema } from "./dataSources/propertySchema";
5
+ import type { NotionPageId } from "./pages/page";
6
+ import type { NotionTheme } from "./theme";
7
+ export type CustomBlockHostState = UninitializedHostState | InitializedHostState;
8
+ export type UninitializedHostState = {
9
+ status: "uninitialized";
10
+ theme: NotionTheme;
11
+ };
12
+ export type InitializedHostState = {
13
+ status: "initialized";
14
+ theme: NotionTheme;
15
+ context: NotionCustomBlockContext;
16
+ dataSources: NotionDataSource[];
17
+ dataSourceState: Record<string, DataSourceQueryState>;
18
+ };
19
+ export type DataSourceQueryState = {
20
+ /** Latest pages from the host as parsed from the bridge. `propertiesByKey` is derived lazily. */
21
+ items: NotionDataSourcePageBridge[];
22
+ isLoading: boolean;
23
+ hasMore: boolean;
24
+ error?: string;
25
+ latestRequestId?: string;
26
+ };
27
+ export declare function createEmptyDataSourceQueryState(): DataSourceQueryState;
28
+ /**
29
+ * Resolved page + schema views for a single data source, keyed by raw property
30
+ * ID and by user-defined key. Re-derived from `propertyIdsByKey` on every read so
31
+ * renames don't require a re-query.
32
+ */
33
+ export type DataSourceQueryView = {
34
+ items: NotionDataSourcePage[];
35
+ collectionSchema?: NotionDataSource["collectionSchema"];
36
+ propertySchemasById: {
37
+ [propertyId: string]: NotionPropertySchema;
38
+ };
39
+ propertySchemasByKey: {
40
+ [key: string]: NotionPropertySchema | undefined;
41
+ };
42
+ isLoading: boolean;
43
+ hasMore: boolean;
44
+ error?: string;
45
+ };
46
+ /**
47
+ * Per-row callback that resolves property keys against the data source and forwards the
48
+ * resulting write to the bridge. Injected by callers (typically the SDK singleton in `init.ts`)
49
+ * so this module stays free of bridge-instance dependencies.
50
+ */
51
+ export type UpdateDataSourcePageFn = (args: {
52
+ dataSource: NotionDataSource;
53
+ pageId: NotionPageId;
54
+ input: NotionDataSourcePageUpdateInput;
55
+ }) => Promise<NotionDataSourcePageUpdateResult>;
56
+ export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string, updateDataSourcePage: UpdateDataSourcePageFn): DataSourceQueryView;
57
+ //# sourceMappingURL=hostState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hostState.d.ts","sourceRoot":"","sources":["../../bridge/hostState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAChE,OAAO,KAAK,EACX,oBAAoB,EACpB,0BAA0B,EAC1B,+BAA+B,EAC/B,gCAAgC,EAChC,MAAM,8BAA8B,CAAA;AAErC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GAAG,oBAAoB,CAAA;AAEhF,MAAM,MAAM,sBAAsB,GAAG;IACpC,MAAM,EAAE,eAAe,CAAA;IACvB,KAAK,EAAE,WAAW,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAClC,MAAM,EAAE,aAAa,CAAA;IACrB,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,wBAAwB,CAAA;IACjC,WAAW,EAAE,gBAAgB,EAAE,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CACrD,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IAClC,iGAAiG;IACjG,KAAK,EAAE,0BAA0B,EAAE,CAAA;IACnC,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,wBAAgB,+BAA+B,IAAI,oBAAoB,CAMtE;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,oBAAoB,EAAE,CAAA;IAC7B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IACvD,mBAAmB,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAE,CAAA;IACnE,oBAAoB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAA;KAAE,CAAA;IACzE,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAUD;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,EAAE;IAC3C,UAAU,EAAE,gBAAgB,CAAA;IAC5B,MAAM,EAAE,YAAY,CAAA;IACpB,KAAK,EAAE,+BAA+B,CAAA;CACtC,KAAK,OAAO,CAAC,gCAAgC,CAAC,CAAA;AAE/C,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,MAAM,EACX,oBAAoB,EAAE,sBAAsB,GAC1C,mBAAmB,CA8DrB"}
@@ -0,0 +1,65 @@
1
+ export function createEmptyDataSourceQueryState() {
2
+ return {
3
+ items: [],
4
+ isLoading: false,
5
+ hasMore: false,
6
+ };
7
+ }
8
+ const EMPTY_QUERY_VIEW = {
9
+ items: [],
10
+ propertySchemasById: {},
11
+ propertySchemasByKey: {},
12
+ isLoading: false,
13
+ hasMore: false,
14
+ };
15
+ export function getDataSourceQueryView(hostState, key, updateDataSourcePage) {
16
+ if (hostState.status !== "initialized") {
17
+ return EMPTY_QUERY_VIEW;
18
+ }
19
+ const dataSource = hostState.dataSources.find(entry => entry.key === key);
20
+ const queryState = hostState.dataSourceState[key] ?? createEmptyDataSourceQueryState();
21
+ if (dataSource === undefined) {
22
+ return {
23
+ items: [],
24
+ collectionSchema: undefined,
25
+ propertySchemasById: {},
26
+ propertySchemasByKey: {},
27
+ isLoading: queryState.isLoading,
28
+ hasMore: queryState.hasMore,
29
+ error: queryState.error,
30
+ };
31
+ }
32
+ const propertyIdsByKey = dataSource.propertyIdsByKey;
33
+ const propertySchemasById = dataSource.propertySchemasById;
34
+ const resolvedItems = queryState.items.map(entry => {
35
+ const propertiesByKey = {};
36
+ for (const [key, propertyId] of Object.entries(propertyIdsByKey)) {
37
+ propertiesByKey[key] =
38
+ propertyId === undefined ? undefined : entry.propertiesById[propertyId];
39
+ }
40
+ return {
41
+ id: entry.id,
42
+ propertiesById: entry.propertiesById,
43
+ propertiesByKey,
44
+ update: input => updateDataSourcePage({
45
+ dataSource,
46
+ pageId: entry.id,
47
+ input,
48
+ }),
49
+ };
50
+ });
51
+ const propertySchemasByKey = {};
52
+ for (const [key, propertyId] of Object.entries(propertyIdsByKey)) {
53
+ propertySchemasByKey[key] =
54
+ propertyId === undefined ? undefined : propertySchemasById[propertyId];
55
+ }
56
+ return {
57
+ items: resolvedItems,
58
+ collectionSchema: dataSource.collectionSchema,
59
+ propertySchemasById,
60
+ propertySchemasByKey,
61
+ isLoading: queryState.isLoading,
62
+ hasMore: queryState.hasMore,
63
+ error: queryState.error,
64
+ };
65
+ }
@@ -0,0 +1,9 @@
1
+ import { type CustomBlockManifest } from "./manifest";
2
+ /**
3
+ * Attempts to load a `custom_blocks.json` manifest co-located with the bundle. Treats
4
+ * any non-200 response as "no manifest". Warns on every failure path —
5
+ * templates are expected to ship a manifest, so a missing one is worth
6
+ * surfacing.
7
+ */
8
+ export declare function loadManifest(): Promise<CustomBlockManifest | null>;
9
+ //# sourceMappingURL=loadManifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadManifest.d.ts","sourceRoot":"","sources":["../../bridge/loadManifest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,YAAY,CAAA;AAIrE;;;;;GAKG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CA0CxE"}
@@ -0,0 +1,41 @@
1
+ import * as v from "valibot";
2
+ import { manifestSchema } from "./manifest";
3
+ const MANIFEST_URL = "custom_blocks.json";
4
+ /**
5
+ * Attempts to load a `custom_blocks.json` manifest co-located with the bundle. Treats
6
+ * any non-200 response as "no manifest". Warns on every failure path —
7
+ * templates are expected to ship a manifest, so a missing one is worth
8
+ * surfacing.
9
+ */
10
+ export async function loadManifest() {
11
+ if (typeof fetch !== "function") {
12
+ console.warn(`[notion-custom-sdk] no \`fetch\` available; cannot load ${MANIFEST_URL}`);
13
+ return null;
14
+ }
15
+ let response;
16
+ try {
17
+ response = await fetch(MANIFEST_URL, { credentials: "omit" });
18
+ }
19
+ catch (error) {
20
+ console.warn(`[notion-custom-sdk] no manifest fetched from ${MANIFEST_URL}`, error);
21
+ return null;
22
+ }
23
+ if (!response.ok) {
24
+ console.warn(`[notion-custom-sdk] no manifest at ${MANIFEST_URL} (status ${response.status})`);
25
+ return null;
26
+ }
27
+ let json;
28
+ try {
29
+ json = await response.json();
30
+ }
31
+ catch (error) {
32
+ console.warn(`[notion-custom-sdk] manifest at ${MANIFEST_URL} was not valid JSON`, error);
33
+ return null;
34
+ }
35
+ const parsed = v.safeParse(manifestSchema, json);
36
+ if (!parsed.success) {
37
+ console.warn(`[notion-custom-sdk] manifest at ${MANIFEST_URL} did not match schema`, parsed.issues);
38
+ return null;
39
+ }
40
+ return parsed.output;
41
+ }
@@ -0,0 +1,32 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Sandbox -> host: fetch a user by ID.
4
+ */
5
+ export declare const getUserMessageSchema: v.ObjectSchema<{
6
+ readonly type: v.LiteralSchema<"getUser", undefined>;
7
+ readonly requestId: v.StringSchema<undefined>;
8
+ readonly userId: v.StringSchema<undefined>;
9
+ }, undefined>;
10
+ export type GetUserMessage = v.InferOutput<typeof getUserMessageSchema>;
11
+ export declare const getUserResultMessageSchema: v.VariantSchema<"status", [v.ObjectSchema<{
12
+ readonly type: v.LiteralSchema<"getUserResult", undefined>;
13
+ readonly requestId: v.StringSchema<undefined>;
14
+ readonly status: v.LiteralSchema<"success", undefined>;
15
+ readonly user: v.ObjectSchema<{
16
+ readonly object: v.LiteralSchema<"user", undefined>;
17
+ readonly id: v.StringSchema<undefined>;
18
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
19
+ readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
20
+ readonly type: v.LiteralSchema<"person", undefined>;
21
+ readonly person: v.ObjectSchema<{
22
+ readonly email: v.StringSchema<undefined>;
23
+ }, undefined>;
24
+ }, undefined>;
25
+ }, undefined>, v.ObjectSchema<{
26
+ readonly type: v.LiteralSchema<"getUserResult", undefined>;
27
+ readonly requestId: v.StringSchema<undefined>;
28
+ readonly status: v.LiteralSchema<"error", undefined>;
29
+ readonly error: v.StringSchema<undefined>;
30
+ }, undefined>], undefined>;
31
+ export type GetUserResultMessage = v.InferOutput<typeof getUserResultMessageSchema>;
32
+ //# sourceMappingURL=getUser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUser.d.ts","sourceRoot":"","sources":["../../../bridge/messages/getUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;aAI/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;0BAarC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
@@ -0,0 +1,24 @@
1
+ import * as v from "valibot";
2
+ import { notionUserSchema } from "../users/user";
3
+ /**
4
+ * Sandbox -> host: fetch a user by ID.
5
+ */
6
+ export const getUserMessageSchema = v.object({
7
+ type: v.literal("getUser"),
8
+ requestId: v.string(),
9
+ userId: v.string(),
10
+ });
11
+ export const getUserResultMessageSchema = v.variant("status", [
12
+ v.object({
13
+ type: v.literal("getUserResult"),
14
+ requestId: v.string(),
15
+ status: v.literal("success"),
16
+ user: notionUserSchema,
17
+ }),
18
+ v.object({
19
+ type: v.literal("getUserResult"),
20
+ requestId: v.string(),
21
+ status: v.literal("error"),
22
+ error: v.string(),
23
+ }),
24
+ ]);
@@ -776,6 +776,51 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Obje
776
776
  readonly requestId: v.StringSchema<undefined>;
777
777
  readonly status: v.LiteralSchema<"error", undefined>;
778
778
  readonly error: v.StringSchema<undefined>;
779
+ }, undefined>], undefined>, v.VariantSchema<"status", [v.ObjectSchema<{
780
+ readonly type: v.LiteralSchema<"getUserResult", undefined>;
781
+ readonly requestId: v.StringSchema<undefined>;
782
+ readonly status: v.LiteralSchema<"success", undefined>;
783
+ readonly user: v.ObjectSchema<{
784
+ readonly object: v.LiteralSchema<"user", undefined>;
785
+ readonly id: v.StringSchema<undefined>;
786
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
787
+ readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
788
+ readonly type: v.LiteralSchema<"person", undefined>;
789
+ readonly person: v.ObjectSchema<{
790
+ readonly email: v.StringSchema<undefined>;
791
+ }, undefined>;
792
+ }, undefined>;
793
+ }, undefined>, v.ObjectSchema<{
794
+ readonly type: v.LiteralSchema<"getUserResult", undefined>;
795
+ readonly requestId: v.StringSchema<undefined>;
796
+ readonly status: v.LiteralSchema<"error", undefined>;
797
+ readonly error: v.StringSchema<undefined>;
798
+ }, undefined>], undefined>, v.VariantSchema<"status", [v.ObjectSchema<{
799
+ readonly type: v.LiteralSchema<"listUsersResult", undefined>;
800
+ readonly requestId: v.StringSchema<undefined>;
801
+ readonly status: v.LiteralSchema<"success", undefined>;
802
+ readonly list: v.ObjectSchema<{
803
+ readonly object: v.LiteralSchema<"list", undefined>;
804
+ readonly results: v.ArraySchema<v.ObjectSchema<{
805
+ readonly object: v.LiteralSchema<"user", undefined>;
806
+ readonly id: v.StringSchema<undefined>;
807
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
808
+ readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
809
+ readonly type: v.LiteralSchema<"person", undefined>;
810
+ readonly person: v.ObjectSchema<{
811
+ readonly email: v.StringSchema<undefined>;
812
+ }, undefined>;
813
+ }, undefined>, undefined>;
814
+ readonly next_cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
815
+ readonly has_more: v.BooleanSchema<undefined>;
816
+ readonly type: v.LiteralSchema<"user", undefined>;
817
+ readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
818
+ }, undefined>;
819
+ }, undefined>, v.ObjectSchema<{
820
+ readonly type: v.LiteralSchema<"listUsersResult", undefined>;
821
+ readonly requestId: v.StringSchema<undefined>;
822
+ readonly status: v.LiteralSchema<"error", undefined>;
823
+ readonly error: v.StringSchema<undefined>;
779
824
  }, undefined>], undefined>, v.VariantSchema<"status", [v.ObjectSchema<{
780
825
  readonly type: v.LiteralSchema<"updatePageResult", undefined>;
781
826
  readonly requestId: v.StringSchema<undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"hostToSandbox.d.ts","sourceRoot":"","sources":["../../../bridge/messages/hostToSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAUrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
1
+ {"version":3,"file":"hostToSandbox.d.ts","sourceRoot":"","sources":["../../../bridge/messages/hostToSandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAa5B;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAYrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
@@ -3,8 +3,10 @@ import { contextChangedMessageSchema } from "./contextChanged";
3
3
  import { createPageResultMessageSchema } from "./createPageResult";
4
4
  import { dataSourcesChangedMessageSchema } from "./dataSourcesChanged";
5
5
  import { getPageResultMessageSchema } from "./getPage";
6
+ import { getUserResultMessageSchema } from "./getUser";
6
7
  import { initMessageSchema } from "./init";
7
8
  import { invalidSandboxMessageSchema } from "./invalidSandboxMessage";
9
+ import { listUsersResultMessageSchema } from "./listUsers";
8
10
  import { queryDataSourceResultMessageSchema } from "./queryDataSourceResult";
9
11
  import { themeChangedMessageSchema } from "./themeChanged";
10
12
  import { updatePageResultMessageSchema } from "./updatePageResult";
@@ -19,6 +21,8 @@ export const hostToSandboxMessageSchema = v.variant("type", [
19
21
  queryDataSourceResultMessageSchema,
20
22
  createPageResultMessageSchema,
21
23
  getPageResultMessageSchema,
24
+ getUserResultMessageSchema,
25
+ listUsersResultMessageSchema,
22
26
  updatePageResultMessageSchema,
23
27
  invalidSandboxMessageSchema,
24
28
  ]);
@@ -0,0 +1,40 @@
1
+ import * as v from "valibot";
2
+ /**
3
+ * Sandbox -> host: list users visible in the custom block's workspace.
4
+ */
5
+ export declare const listUsersMessageSchema: v.ObjectSchema<{
6
+ readonly type: v.LiteralSchema<"listUsers", undefined>;
7
+ readonly requestId: v.StringSchema<undefined>;
8
+ readonly startCursor: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
9
+ readonly pageSize: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
10
+ }, undefined>;
11
+ export type ListUsersMessage = v.InferOutput<typeof listUsersMessageSchema>;
12
+ export declare const listUsersResultMessageSchema: v.VariantSchema<"status", [v.ObjectSchema<{
13
+ readonly type: v.LiteralSchema<"listUsersResult", undefined>;
14
+ readonly requestId: v.StringSchema<undefined>;
15
+ readonly status: v.LiteralSchema<"success", undefined>;
16
+ readonly list: v.ObjectSchema<{
17
+ readonly object: v.LiteralSchema<"list", undefined>;
18
+ readonly results: v.ArraySchema<v.ObjectSchema<{
19
+ readonly object: v.LiteralSchema<"user", undefined>;
20
+ readonly id: v.StringSchema<undefined>;
21
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
22
+ readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
23
+ readonly type: v.LiteralSchema<"person", undefined>;
24
+ readonly person: v.ObjectSchema<{
25
+ readonly email: v.StringSchema<undefined>;
26
+ }, undefined>;
27
+ }, undefined>, undefined>;
28
+ readonly next_cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
29
+ readonly has_more: v.BooleanSchema<undefined>;
30
+ readonly type: v.LiteralSchema<"user", undefined>;
31
+ readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
32
+ }, undefined>;
33
+ }, undefined>, v.ObjectSchema<{
34
+ readonly type: v.LiteralSchema<"listUsersResult", undefined>;
35
+ readonly requestId: v.StringSchema<undefined>;
36
+ readonly status: v.LiteralSchema<"error", undefined>;
37
+ readonly error: v.StringSchema<undefined>;
38
+ }, undefined>], undefined>;
39
+ export type ListUsersResultMessage = v.InferOutput<typeof listUsersResultMessageSchema>;
40
+ //# sourceMappingURL=listUsers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listUsers.d.ts","sourceRoot":"","sources":["../../../bridge/messages/listUsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAG5B;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;aAKjC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;0BAavC,CAAA;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CACjD,OAAO,4BAA4B,CACnC,CAAA"}
@@ -0,0 +1,25 @@
1
+ import * as v from "valibot";
2
+ import { notionUserListSchema } from "../users/user";
3
+ /**
4
+ * Sandbox -> host: list users visible in the custom block's workspace.
5
+ */
6
+ export const listUsersMessageSchema = v.object({
7
+ type: v.literal("listUsers"),
8
+ requestId: v.string(),
9
+ startCursor: v.optional(v.string()),
10
+ pageSize: v.optional(v.number()),
11
+ });
12
+ export const listUsersResultMessageSchema = v.variant("status", [
13
+ v.object({
14
+ type: v.literal("listUsersResult"),
15
+ requestId: v.string(),
16
+ status: v.literal("success"),
17
+ list: notionUserListSchema,
18
+ }),
19
+ v.object({
20
+ type: v.literal("listUsersResult"),
21
+ requestId: v.string(),
22
+ status: v.literal("error"),
23
+ error: v.string(),
24
+ }),
25
+ ]);
@@ -214,6 +214,15 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Obje
214
214
  readonly type: v.LiteralSchema<"getPage", undefined>;
215
215
  readonly requestId: v.StringSchema<undefined>;
216
216
  readonly pageId: v.StringSchema<undefined>;
217
+ }, undefined>, v.ObjectSchema<{
218
+ readonly type: v.LiteralSchema<"getUser", undefined>;
219
+ readonly requestId: v.StringSchema<undefined>;
220
+ readonly userId: v.StringSchema<undefined>;
221
+ }, undefined>, v.ObjectSchema<{
222
+ readonly type: v.LiteralSchema<"listUsers", undefined>;
223
+ readonly requestId: v.StringSchema<undefined>;
224
+ readonly startCursor: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
225
+ readonly pageSize: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
217
226
  }, undefined>, v.ObjectSchema<{
218
227
  readonly type: v.LiteralSchema<"updatePage", undefined>;
219
228
  readonly requestId: v.StringSchema<undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"sandboxToHost.d.ts","sourceRoot":"","sources":["../../../bridge/messages/sandboxToHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAS5B;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAQrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
1
+ {"version":3,"file":"sandboxToHost.d.ts","sourceRoot":"","sources":["../../../bridge/messages/sandboxToHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;;GAGG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAUrC,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAC/C,OAAO,0BAA0B,CACjC,CAAA"}
@@ -1,7 +1,9 @@
1
1
  import * as v from "valibot";
2
2
  import { createPageMessageSchema } from "./createPage";
3
3
  import { getPageMessageSchema } from "./getPage";
4
+ import { getUserMessageSchema } from "./getUser";
4
5
  import { invalidHostMessageSchema } from "./invalidHostMessage";
6
+ import { listUsersMessageSchema } from "./listUsers";
5
7
  import { queryDataSourceMessageSchema } from "./queryDataSource";
6
8
  import { readyMessageSchema } from "./ready";
7
9
  import { resizeMessageSchema } from "./resize";
@@ -15,6 +17,8 @@ export const sandboxToHostMessageSchema = v.variant("type", [
15
17
  queryDataSourceMessageSchema,
16
18
  createPageMessageSchema,
17
19
  getPageMessageSchema,
20
+ getUserMessageSchema,
21
+ listUsersMessageSchema,
18
22
  updatePageMessageSchema,
19
23
  resizeMessageSchema,
20
24
  invalidHostMessageSchema,
@@ -0,0 +1,46 @@
1
+ import type { CreatePageInput, CreatePageResult, GetPageResult, GetUserResult, ListUsersInput, ListUsersResult, NotionPageId, NotionUserId, UpdatePageInput, UpdatePageResult } from "../types";
2
+ import { type CustomBlockHostState, type DataSourceQueryView } from "./hostState";
3
+ import type { CustomBlockManifest } from "./manifest";
4
+ import type { InitMessage } from "./messages/init";
5
+ export declare function sendCustomBlockReady(manifest: CustomBlockManifest | null): void;
6
+ export declare function awaitCustomBlockInit(signal?: AbortSignal): Promise<InitMessage>;
7
+ export declare function subscribeToCustomBlockHost(listener: () => void): () => boolean;
8
+ export declare function getCustomBlockHostState(): CustomBlockHostState;
9
+ export declare function queryCustomBlockDataSource(key: string, limit: number): void;
10
+ /**
11
+ * Apply an `init` payload to the bridge directly, bypassing the postMessage
12
+ * handshake. Used by the React provider when it needs to seed placeholder
13
+ * state (e.g. the standalone preview fallback when not embedded in Notion).
14
+ * The bridge applies the payload through the same code path as a real host.
15
+ */
16
+ export declare function setMockCustomBlockState(message: InitMessage): void;
17
+ export declare function postCustomBlockResize(height: number): void;
18
+ export declare function getUser(userId: NotionUserId): Promise<GetUserResult>;
19
+ export declare function listUsers(input?: ListUsersInput): Promise<ListUsersResult>;
20
+ /**
21
+ * Resolves the host state for a given data-source key into the public {@link DataSourceQueryView},
22
+ * baking in the singleton bridge so per-row `update` calls flow through it.
23
+ */
24
+ export declare function getDataSourceQueryView(hostState: CustomBlockHostState, key: string): DataSourceQueryView;
25
+ /**
26
+ * Page-related SDK APIs exposed under `sdk.pages.*`.
27
+ */
28
+ export declare const pages: {
29
+ /**
30
+ * Creates a new Notion page.
31
+ */
32
+ create(input: CreatePageInput): Promise<CreatePageResult>;
33
+ /**
34
+ * Fetches a page by id.
35
+ */
36
+ get(pageId: NotionPageId): Promise<GetPageResult>;
37
+ /**
38
+ * Updates an existing page.
39
+ */
40
+ update(input: UpdatePageInput): Promise<UpdatePageResult>;
41
+ /**
42
+ * Soft-delete a page by archiving it.
43
+ */
44
+ delete(pageId: NotionPageId): Promise<UpdatePageResult>;
45
+ };
46
+ //# sourceMappingURL=sandboxClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandboxClient.d.ts","sourceRoot":"","sources":["../../bridge/sandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,MAAM,UAAU,CAAA;AACjB,OAAO,EACN,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,MAAM,aAAa,CAAA;AACpB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAKlD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,QAExE;AAED,wBAAgB,oBAAoB,CACnC,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,IAAI,iBAE9D;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,CAE9D;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAEpE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,QAE3D;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,QAEnD;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAEpE;AAED,wBAAgB,SAAS,CAAC,KAAK,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CAE1E;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,MAAM,GACT,mBAAmB,CAIrB;AAED;;GAEG;AACH,eAAO,MAAM,KAAK;IACjB;;OAEG;kBACW,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIzD;;OAEG;gBACS,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjD;;OAEG;kBACW,eAAe,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIzD;;OAEG;mBACY,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAGvD,CAAA"}
@@ -0,0 +1,72 @@
1
+ import { getDataSourceQueryView as getDataSourceQueryViewWithBridge, } from "./hostState";
2
+ import { SandboxBridge } from "./SandboxBridge";
3
+ const bridge = new SandboxBridge();
4
+ export function sendCustomBlockReady(manifest) {
5
+ bridge.sendReady(manifest);
6
+ }
7
+ export function awaitCustomBlockInit(signal) {
8
+ return bridge.awaitInit(signal);
9
+ }
10
+ export function subscribeToCustomBlockHost(listener) {
11
+ return bridge.subscribe(listener);
12
+ }
13
+ export function getCustomBlockHostState() {
14
+ return bridge.getHostState();
15
+ }
16
+ export function queryCustomBlockDataSource(key, limit) {
17
+ bridge.queryDataSource(key, limit);
18
+ }
19
+ /**
20
+ * Apply an `init` payload to the bridge directly, bypassing the postMessage
21
+ * handshake. Used by the React provider when it needs to seed placeholder
22
+ * state (e.g. the standalone preview fallback when not embedded in Notion).
23
+ * The bridge applies the payload through the same code path as a real host.
24
+ */
25
+ export function setMockCustomBlockState(message) {
26
+ bridge.setMockState(message);
27
+ }
28
+ export function postCustomBlockResize(height) {
29
+ bridge.postResize(height);
30
+ }
31
+ export function getUser(userId) {
32
+ return bridge.getUser(userId);
33
+ }
34
+ export function listUsers(input) {
35
+ return bridge.listUsers(input);
36
+ }
37
+ /**
38
+ * Resolves the host state for a given data-source key into the public {@link DataSourceQueryView},
39
+ * baking in the singleton bridge so per-row `update` calls flow through it.
40
+ */
41
+ export function getDataSourceQueryView(hostState, key) {
42
+ return getDataSourceQueryViewWithBridge(hostState, key, args => bridge.updateDataSourcePage(args));
43
+ }
44
+ /**
45
+ * Page-related SDK APIs exposed under `sdk.pages.*`.
46
+ */
47
+ export const pages = {
48
+ /**
49
+ * Creates a new Notion page.
50
+ */
51
+ create(input) {
52
+ return bridge.createPage(input);
53
+ },
54
+ /**
55
+ * Fetches a page by id.
56
+ */
57
+ get(pageId) {
58
+ return bridge.getPage(pageId);
59
+ },
60
+ /**
61
+ * Updates an existing page.
62
+ */
63
+ update(input) {
64
+ return bridge.updatePage(input);
65
+ },
66
+ /**
67
+ * Soft-delete a page by archiving it.
68
+ */
69
+ delete(pageId) {
70
+ return bridge.updatePage({ pageId, archived: true });
71
+ },
72
+ };
@@ -0,0 +1,36 @@
1
+ import * as v from "valibot";
2
+ declare const notionUserIdBrand: unique symbol;
3
+ export type NotionUserId = string & {
4
+ readonly [notionUserIdBrand]: "NotionUserId";
5
+ };
6
+ export declare const notionUserSchema: v.ObjectSchema<{
7
+ readonly object: v.LiteralSchema<"user", undefined>;
8
+ readonly id: v.StringSchema<undefined>;
9
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
10
+ readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
11
+ readonly type: v.LiteralSchema<"person", undefined>;
12
+ readonly person: v.ObjectSchema<{
13
+ readonly email: v.StringSchema<undefined>;
14
+ }, undefined>;
15
+ }, undefined>;
16
+ export type NotionUser = v.InferOutput<typeof notionUserSchema>;
17
+ export declare const notionUserListSchema: v.ObjectSchema<{
18
+ readonly object: v.LiteralSchema<"list", undefined>;
19
+ readonly results: v.ArraySchema<v.ObjectSchema<{
20
+ readonly object: v.LiteralSchema<"user", undefined>;
21
+ readonly id: v.StringSchema<undefined>;
22
+ readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
23
+ readonly avatar_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
24
+ readonly type: v.LiteralSchema<"person", undefined>;
25
+ readonly person: v.ObjectSchema<{
26
+ readonly email: v.StringSchema<undefined>;
27
+ }, undefined>;
28
+ }, undefined>, undefined>;
29
+ readonly next_cursor: v.NullableSchema<v.StringSchema<undefined>, undefined>;
30
+ readonly has_more: v.BooleanSchema<undefined>;
31
+ readonly type: v.LiteralSchema<"user", undefined>;
32
+ readonly user: v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>;
33
+ }, undefined>;
34
+ export type NotionUserList = v.InferOutput<typeof notionUserListSchema>;
35
+ export {};
36
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../bridge/users/user.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,OAAO,CAAC,MAAM,iBAAiB,EAAE,OAAO,MAAM,CAAA;AAE9C,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IACnC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,EAAE,cAAc,CAAA;CAC5C,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;aAS3B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE/D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;aAO/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ import * as v from "valibot";
2
+ export const notionUserSchema = v.object({
3
+ object: v.literal("user"),
4
+ id: v.string(),
5
+ name: v.optional(v.string()),
6
+ avatar_url: v.nullable(v.string()),
7
+ type: v.literal("person"),
8
+ person: v.object({
9
+ email: v.string(),
10
+ }),
11
+ });
12
+ export const notionUserListSchema = v.object({
13
+ object: v.literal("list"),
14
+ results: v.array(notionUserSchema),
15
+ next_cursor: v.nullable(v.string()),
16
+ has_more: v.boolean(),
17
+ type: v.literal("user"),
18
+ user: v.record(v.string(), v.unknown()),
19
+ });
package/dist/index.d.ts CHANGED
@@ -19,9 +19,10 @@ export type { NotionDataSourceId, NotionSpaceId } from "./bridge/ids";
19
19
  export type { CustomBlockManifest, ManifestDataSource, ManifestIcon, ManifestProperty, } from "./bridge/manifest";
20
20
  export type { NotionCreatePagePosition } from "./bridge/messages/createPage";
21
21
  export type { NotionPage, NotionPageCover, NotionPageIcon, NotionPageId, NotionPageParent, NotionPagePropertyInputMap, NotionPagePropertyInputValue, NotionPagePropertyValue, NotionPagePropertyWriteMap, } from "./bridge/pages/page";
22
+ export { pages } from "./bridge/sandboxClient";
22
23
  export type { NotionTheme } from "./bridge/theme";
23
- export { type CustomBlockInitial, type InitCustomBlockOptions, initCustomBlock, NotInIframeError, } from "./notion";
24
- export { pages } from "./pages";
24
+ export { type CustomBlockInitial, type InitCustomBlockOptions, initCustomBlock, NotInIframeError, } from "./init";
25
25
  export { NotionCustomBlock, type NotionCustomBlockProps, type UseCustomBlockInitResult, useCustomBlockAutoResize, useCustomBlockContext, useCustomBlockInit, useDataSource, useDataSourceDefinitions, useTheme, } from "./react";
26
26
  export * from "./types";
27
+ export { users } from "./users";
27
28
  //# sourceMappingURL=index.d.ts.map