@notionhq/apps 0.0.6 → 0.0.7
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 +6 -0
- package/dist/context.js +2 -2
- package/package.json +1 -1
- package/src/context.ts +6 -6
package/README.md
CHANGED
|
@@ -14,6 +14,12 @@ import { triggers } from "@notionhq/apps/triggers";
|
|
|
14
14
|
import { createWorkflow } from "@notionhq/apps/workflow";
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Notion API access
|
|
18
|
+
|
|
19
|
+
Use `context.notion` for Notion API calls. Deployed apps receive Notion API
|
|
20
|
+
credentials automatically, so do not configure or push `NOTION_API_TOKEN`.
|
|
21
|
+
Local execution needs the token in `.env` before making a Notion API request.
|
|
22
|
+
|
|
17
23
|
## Database syncs
|
|
18
24
|
|
|
19
25
|
Apps declare a database schema, and users attach a real Notion database to it. Apps SDK
|
package/dist/context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Client } from "@notionhq/client";
|
|
2
|
-
const
|
|
2
|
+
const LOCAL_FIX_STEPS = "\n\nFor local execution:\n1. Create a personal access token at https://app.notion.com/developers/tokens\n2. Add NOTION_API_TOKEN=<your-token> to your .env file\n\nDeployed apps receive Notion API credentials automatically. Do not push NOTION_API_TOKEN.";
|
|
3
3
|
function missingTokenMessage() {
|
|
4
|
-
return "NOTION_API_TOKEN is not set. context.notion requires an API token
|
|
4
|
+
return "NOTION_API_TOKEN is not set. context.notion requires an API token when an app capability runs locally." + LOCAL_FIX_STEPS;
|
|
5
5
|
}
|
|
6
6
|
function createUnauthenticatedNotionProxy() {
|
|
7
7
|
return new Proxy({}, {
|
package/package.json
CHANGED
package/src/context.ts
CHANGED
|
@@ -6,17 +6,17 @@ export type CapabilityContext = {
|
|
|
6
6
|
notion: Client;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
"\n\
|
|
9
|
+
const LOCAL_FIX_STEPS =
|
|
10
|
+
"\n\nFor local execution:\n" +
|
|
11
11
|
"1. Create a personal access token at https://app.notion.com/developers/tokens\n" +
|
|
12
|
-
"2. Add NOTION_API_TOKEN=<your-token> to your .env file\n" +
|
|
13
|
-
"
|
|
12
|
+
"2. Add NOTION_API_TOKEN=<your-token> to your .env file\n\n" +
|
|
13
|
+
"Deployed apps receive Notion API credentials automatically. Do not push NOTION_API_TOKEN.";
|
|
14
14
|
|
|
15
15
|
function missingTokenMessage(): string {
|
|
16
16
|
return (
|
|
17
17
|
"NOTION_API_TOKEN is not set. " +
|
|
18
|
-
"context.notion requires an API token
|
|
19
|
-
|
|
18
|
+
"context.notion requires an API token when an app capability runs locally." +
|
|
19
|
+
LOCAL_FIX_STEPS
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|