@notionhq/apps 0.0.13 → 0.0.14

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 (89) hide show
  1. package/README.md +32 -28
  2. package/dist/box.generated.d.ts +164 -0
  3. package/dist/box.generated.d.ts.map +1 -0
  4. package/dist/box.generated.js +24 -0
  5. package/dist/calendar.generated.d.ts +1036 -0
  6. package/dist/calendar.generated.d.ts.map +1 -0
  7. package/dist/calendar.generated.js +42 -0
  8. package/dist/cli/build.js +7 -6
  9. package/dist/confluence.generated.d.ts +98 -0
  10. package/dist/confluence.generated.d.ts.map +1 -0
  11. package/dist/confluence.generated.js +18 -0
  12. package/dist/connection-actions.d.ts +2 -0
  13. package/dist/connection-actions.d.ts.map +1 -0
  14. package/dist/connection-actions.js +0 -0
  15. package/dist/connection-trigger-definitions.generated.d.ts +34 -0
  16. package/dist/connection-trigger-definitions.generated.d.ts.map +1 -0
  17. package/dist/connection-trigger-definitions.generated.js +45 -0
  18. package/dist/connections.d.ts +15 -0
  19. package/dist/connections.d.ts.map +1 -0
  20. package/dist/connections.js +79 -0
  21. package/dist/connections.test.d.ts +2 -0
  22. package/dist/connections.test.d.ts.map +1 -0
  23. package/dist/cursor.generated.d.ts +154 -0
  24. package/dist/cursor.generated.d.ts.map +1 -0
  25. package/dist/cursor.generated.js +18 -0
  26. package/dist/discord.generated.d.ts +279 -0
  27. package/dist/discord.generated.d.ts.map +1 -0
  28. package/dist/discord.generated.js +33 -0
  29. package/dist/gmail.generated.d.ts +184 -0
  30. package/dist/gmail.generated.d.ts.map +1 -0
  31. package/dist/gmail.generated.js +21 -0
  32. package/dist/googleCalendar.generated.d.ts +83 -0
  33. package/dist/googleCalendar.generated.d.ts.map +1 -0
  34. package/dist/googleCalendar.generated.js +15 -0
  35. package/dist/googleDrive.generated.d.ts +210 -0
  36. package/dist/googleDrive.generated.d.ts.map +1 -0
  37. package/dist/googleDrive.generated.js +27 -0
  38. package/dist/googleDriveOauth.generated.d.ts +851 -0
  39. package/dist/googleDriveOauth.generated.d.ts.map +1 -0
  40. package/dist/googleDriveOauth.generated.js +84 -0
  41. package/dist/outlook.generated.d.ts +224 -0
  42. package/dist/outlook.generated.d.ts.map +1 -0
  43. package/dist/outlook.generated.js +24 -0
  44. package/dist/providers.generated.d.ts +117 -0
  45. package/dist/providers.generated.d.ts.map +1 -0
  46. package/dist/providers.generated.js +108 -0
  47. package/dist/salesforce.generated.d.ts +151 -0
  48. package/dist/salesforce.generated.d.ts.map +1 -0
  49. package/dist/salesforce.generated.js +24 -0
  50. package/dist/slack.generated.d.ts +290 -0
  51. package/dist/slack.generated.d.ts.map +1 -0
  52. package/dist/slack.generated.js +30 -0
  53. package/dist/triggers.generated.d.ts +107 -32
  54. package/dist/triggers.generated.d.ts.map +1 -1
  55. package/dist/triggers.generated.js +36 -24
  56. package/dist/workflow-connections-types.test.d.ts +2 -0
  57. package/dist/workflow-connections-types.test.d.ts.map +1 -0
  58. package/dist/workflow-types.test.d.ts +2 -0
  59. package/dist/workflow-types.test.d.ts.map +1 -0
  60. package/dist/workflow.d.ts +20 -16
  61. package/dist/workflow.d.ts.map +1 -1
  62. package/dist/workflow.js +14 -17
  63. package/docs/BUILD.md +83 -14
  64. package/docs/CONNECTIONS.md +129 -0
  65. package/package.json +1 -1
  66. package/src/box.generated.ts +187 -0
  67. package/src/calendar.generated.ts +1117 -0
  68. package/src/cli/build.test.ts +33 -0
  69. package/src/cli/build.ts +6 -5
  70. package/src/confluence.generated.ts +109 -0
  71. package/src/connection-actions.ts +2 -0
  72. package/src/connection-trigger-definitions.generated.ts +48 -0
  73. package/src/connections.test.ts +157 -0
  74. package/src/connections.ts +126 -0
  75. package/src/cursor.generated.ts +167 -0
  76. package/src/discord.generated.ts +318 -0
  77. package/src/gmail.generated.ts +205 -0
  78. package/src/googleCalendar.generated.ts +95 -0
  79. package/src/googleDrive.generated.ts +235 -0
  80. package/src/googleDriveOauth.generated.ts +980 -0
  81. package/src/outlook.generated.ts +249 -0
  82. package/src/providers.generated.ts +207 -0
  83. package/src/salesforce.generated.ts +170 -0
  84. package/src/slack.generated.ts +330 -0
  85. package/src/triggers.generated.ts +112 -32
  86. package/src/workflow-connections-types.test.ts +59 -0
  87. package/src/workflow-types.test.ts +144 -0
  88. package/src/workflow.test.ts +112 -2
  89. package/src/workflow.ts +58 -29
package/README.md CHANGED
@@ -74,6 +74,26 @@ Put each default-exported sync directly in `src/syncs/`. A primary key must be a
74
74
  or rich-text property. Do not include that property in an upsert: the SDK fills it from
75
75
  the change's `key`.
76
76
 
77
+ ## Custom blocks
78
+
79
+ Declare browser blocks in `src/customBlocks/<key>.ts`:
80
+
81
+ ```ts
82
+ import { createCustomBlock } from "@notionhq/apps/custom-block";
83
+
84
+ export default createCustomBlock({
85
+ path: "./blocks/hello",
86
+ slashCommand: "hello",
87
+ dataSources: {},
88
+ });
89
+ ```
90
+
91
+ `path` is relative to the project root. Keep frontend project code out of `src/` to avoid hitting upload caps.
92
+ `notion-apps build-blocks` and `notion-apps upload-blocks` are used for local builds.
93
+
94
+ See [the build and deployment guide](docs/BUILD.md) for provisioning artifacts,
95
+ cloud builds with server coordination, and local builds with CLI coordination.
96
+
77
97
  ### Moving from the Workers alpha SDK
78
98
 
79
99
  - Remove `type` and `primaryKey` from `createDatabase`.
@@ -82,6 +102,18 @@ the change's `key`.
82
102
  - Remove the primary-key property from each upsert's `properties` object.
83
103
  - Change imports from `@notionhq/workers/alpha/*` to `@notionhq/apps/*`.
84
104
 
105
+ ## Local / Boxy end to end testing
106
+
107
+ To build and deploy the app template against a running local Notion server:
108
+
109
+ ```sh
110
+ # Installed ntn and the notion-cookbook template from main
111
+ scripts/smoketest.sh
112
+
113
+ # CLI binary and template from sibling checkouts
114
+ CLI=local TEMPLATE=local scripts/smoketest.sh
115
+ ```
116
+
85
117
  ## Publishing New Versions
86
118
 
87
119
  Publishing is initiated only from the GitHub Actions UI:
@@ -92,31 +124,3 @@ Publishing is initiated only from the GitHub Actions UI:
92
124
  The workflow always increments the patch version. It builds, checks, and tests the
93
125
  SDK before committing the new version, creating a `v*` GitHub release,
94
126
  and publishing `@notionhq/apps` to npm.
95
-
96
- ## Custom blocks
97
-
98
- Declare browser blocks in `src/customBlocks/<key>.ts`:
99
-
100
- ```ts
101
- import { createCustomBlock } from "@notionhq/apps/custom-block";
102
-
103
- export default createCustomBlock({
104
- path: "./blocks/hello",
105
- slashCommand: "hello",
106
- dataSources: {},
107
- });
108
- ```
109
-
110
- The filename supplies the block key. `path` is required and relative to the app
111
- root. Browser source belongs in the directory it names, with `index.html` and a
112
- Vite config. The project root supplies React, React DOM, Vite, and the React Vite
113
- plugin. `command` defaults to `npx vite build`, and `output` defaults to `dist`.
114
- Use `static: true` for an already-built directory. `slashCommand` accepts one
115
- optional leading `/`, then 1–64 lowercase letters, numbers, hyphens or underscores,
116
- starting with a letter or number. `dataSources` describes the block's schemas.
117
-
118
- `notion-apps build` reads declarations in a separate temporary bundle and emits
119
- `custom_block` capabilities into the manifest. Blocks never enter `worker.js`.
120
-
121
- `notion-apps build-blocks` and `notion-apps upload-blocks` are invoked by the CLI
122
- during `ntn apps deploy` for local builds.
@@ -0,0 +1,164 @@
1
+ import type { ConnectionActionInvoker } from "./connection-actions.js";
2
+ /**
3
+ * Script input for the "Find shared Box item" effect (`box.findSharedItem`),
4
+ * derived from its Tool Core definition's call_function input projection.
5
+ *
6
+ * Resolve a Box shared link to an item ID and type.
7
+ */
8
+ export type FindSharedItemScriptInput = {
9
+ /**
10
+ * The full Box shared link URL.
11
+ */
12
+ sharedLink: string;
13
+ };
14
+ /**
15
+ * Canonical Tool Core output for the "Find shared Box item" effect (`box.findSharedItem`).
16
+ * This is the definition's output schema; the effect's script surface may
17
+ * re-encode it before returning.
18
+ */
19
+ export type FindSharedItemScriptOutput = {
20
+ itemId: string;
21
+ /**
22
+ * One of: `file`, `folder`
23
+ */
24
+ itemType: "file" | "folder";
25
+ name: string;
26
+ size: number;
27
+ modifiedAt: string;
28
+ owner: string;
29
+ };
30
+ /**
31
+ * Script input for the "Load Box file" effect (`box.loadFile`),
32
+ * derived from its Tool Core definition's call_function input projection.
33
+ *
34
+ * Load a Box file by its file ID.
35
+ */
36
+ export type LoadFileScriptInput = {
37
+ /**
38
+ * The Box file ID.
39
+ */
40
+ fileId: string;
41
+ };
42
+ /**
43
+ * Canonical Tool Core output for the "Load Box file" effect (`box.loadFile`).
44
+ * This is the definition's output schema; the effect's script surface may
45
+ * re-encode it before returning.
46
+ */
47
+ export type LoadFileScriptOutput = {
48
+ /**
49
+ * Always `box-file`
50
+ */
51
+ type: "box-file";
52
+ title: string;
53
+ blocks: Array<string>;
54
+ fileId: string;
55
+ };
56
+ /**
57
+ * Script input for the "List Box folder" effect (`box.lsFolder`),
58
+ * derived from its Tool Core definition's call_function input projection.
59
+ *
60
+ * List files and subfolders in a Box folder.
61
+ */
62
+ export type LsFolderScriptInput = {
63
+ /**
64
+ * The Box folder ID to list contents of.
65
+ */
66
+ folderId: string;
67
+ };
68
+ /**
69
+ * Canonical Tool Core output for the "List Box folder" effect (`box.lsFolder`).
70
+ * This is the definition's output schema; the effect's script surface may
71
+ * re-encode it before returning.
72
+ */
73
+ export type LsFolderScriptOutput = {
74
+ items: Array<{
75
+ id: string;
76
+ /**
77
+ * One of: `file`, `folder`
78
+ */
79
+ type: "file" | "folder";
80
+ name: string;
81
+ size: number;
82
+ modifiedAt: string;
83
+ }>;
84
+ };
85
+ /**
86
+ * Script input for the "Search Box" effect (`box.search`),
87
+ * derived from its Tool Core definition's call_function input projection.
88
+ *
89
+ * Search Box via the configured connector.
90
+ */
91
+ export type SearchScriptInput = {
92
+ /**
93
+ * A single, focused question to search for.
94
+ */
95
+ question: string;
96
+ /**
97
+ * Brief keywords capturing the core entities.
98
+ */
99
+ keywords?: string;
100
+ /**
101
+ * Optional time window. Use only "default", "all_time", a duration matching /^\d+[dwmy]$/ (for example, "7d", "2w", "3m", or "1y"), or a date in "YYYY-MM-DD" format. Do not use natural-language durations or combine units.
102
+ */
103
+ lookback?: string;
104
+ /**
105
+ * Optional list of Box folder IDs to scope the search to. Use findSharedItem or searchFolders to get folder IDs.
106
+ */
107
+ folderIds?: Array<string>;
108
+ };
109
+ /**
110
+ * Canonical Tool Core output for the "Search Box" effect (`box.search`).
111
+ * This is the definition's output schema; the effect's script surface may
112
+ * re-encode it before returning.
113
+ */
114
+ export type SearchScriptOutput = {
115
+ results: Array<{
116
+ id: string;
117
+ title: string;
118
+ path: string;
119
+ text: string;
120
+ lastEdited: string;
121
+ isPrivate: boolean;
122
+ pageId: string;
123
+ fileType: string;
124
+ fileId: string;
125
+ }>;
126
+ };
127
+ /**
128
+ * Script input for the "Search Box folders" effect (`box.searchFolders`),
129
+ * derived from its Tool Core definition's call_function input projection.
130
+ *
131
+ * Search Box folders by name.
132
+ */
133
+ export type SearchFoldersScriptInput = {
134
+ /**
135
+ * The search query for finding folders.
136
+ */
137
+ question: string;
138
+ /**
139
+ * Optional additional keywords to refine the folder search.
140
+ */
141
+ keywords?: string;
142
+ };
143
+ /**
144
+ * Canonical Tool Core output for the "Search Box folders" effect (`box.searchFolders`).
145
+ * This is the definition's output schema; the effect's script surface may
146
+ * re-encode it before returning.
147
+ */
148
+ export type SearchFoldersScriptOutput = {
149
+ results: Array<{
150
+ id: string;
151
+ name: string;
152
+ folderId: string;
153
+ }>;
154
+ };
155
+ export declare class BoxConnectionClient {
156
+ private readonly invoke;
157
+ constructor(invoke: ConnectionActionInvoker);
158
+ findSharedItem(args: FindSharedItemScriptInput): Promise<FindSharedItemScriptOutput>;
159
+ loadFile(args: LoadFileScriptInput): Promise<LoadFileScriptOutput>;
160
+ lsFolder(args: LsFolderScriptInput): Promise<LsFolderScriptOutput>;
161
+ search(args: SearchScriptInput): Promise<SearchScriptOutput>;
162
+ searchFolders(args: SearchFoldersScriptInput): Promise<SearchFoldersScriptOutput>;
163
+ }
164
+ //# sourceMappingURL=box.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3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lE,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAG5D,aAAa,CACZ,IAAI,EAAE,wBAAwB,GAC5B,OAAO,CAAC,yBAAyB,CAAC;CAGrC"}
@@ -0,0 +1,24 @@
1
+ class BoxConnectionClient {
2
+ constructor(invoke) {
3
+ this.invoke = invoke;
4
+ }
5
+ invoke;
6
+ findSharedItem(args) {
7
+ return this.invoke("findSharedItem", args);
8
+ }
9
+ loadFile(args) {
10
+ return this.invoke("loadFile", args);
11
+ }
12
+ lsFolder(args) {
13
+ return this.invoke("lsFolder", args);
14
+ }
15
+ search(args) {
16
+ return this.invoke("search", args);
17
+ }
18
+ searchFolders(args) {
19
+ return this.invoke("searchFolders", args);
20
+ }
21
+ }
22
+ export {
23
+ BoxConnectionClient
24
+ };