@vibesdotdev/integrations-notion 0.0.0-stage → 1.0.0-rc.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/LICENSE +126 -0
- package/README.md +142 -2
- package/dist/client/helper.d.ts +16 -0
- package/dist/client/helper.d.ts.map +1 -0
- package/dist/client/helper.js +17 -0
- package/dist/client/helper.js.map +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +3 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/runtime-client.d.ts +89 -0
- package/dist/client/runtime-client.d.ts.map +1 -0
- package/dist/client/runtime-client.js +130 -0
- package/dist/client/runtime-client.js.map +1 -0
- package/dist/docs/integrations-notion.docs.descriptor.d.ts +19 -0
- package/dist/docs/integrations-notion.docs.descriptor.d.ts.map +1 -0
- package/dist/docs/integrations-notion.docs.descriptor.js +62 -0
- package/dist/docs/integrations-notion.docs.descriptor.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations-notion.plugin.d.ts +19 -0
- package/dist/integrations-notion.plugin.d.ts.map +1 -0
- package/dist/integrations-notion.plugin.js +37 -0
- package/dist/integrations-notion.plugin.js.map +1 -0
- package/dist/notion/index.d.ts +12 -0
- package/dist/notion/index.d.ts.map +1 -0
- package/dist/notion/index.js +13 -0
- package/dist/notion/index.js.map +1 -0
- package/dist/notion/notion-client.d.ts +119 -0
- package/dist/notion/notion-client.d.ts.map +1 -0
- package/dist/notion/notion-client.js +438 -0
- package/dist/notion/notion-client.js.map +1 -0
- package/dist/notion/notion-implementation.d.ts +72 -0
- package/dist/notion/notion-implementation.d.ts.map +1 -0
- package/dist/notion/notion-implementation.js +222 -0
- package/dist/notion/notion-implementation.js.map +1 -0
- package/dist/notion/notion-schemas.d.ts +2 -0
- package/dist/notion/notion-schemas.d.ts.map +1 -0
- package/dist/notion/notion-schemas.js +2 -0
- package/dist/notion/notion-schemas.js.map +1 -0
- package/dist/notion/system.integration.notion.descriptor.d.ts +69 -0
- package/dist/notion/system.integration.notion.descriptor.d.ts.map +1 -0
- package/dist/notion/system.integration.notion.descriptor.js +109 -0
- package/dist/notion/system.integration.notion.descriptor.js.map +1 -0
- package/dist/notion.catalog.plugin.d.ts +78 -0
- package/dist/notion.catalog.plugin.d.ts.map +1 -0
- package/dist/notion.catalog.plugin.js +21 -0
- package/dist/notion.catalog.plugin.js.map +1 -0
- package/dist/notion.client.plugin.d.ts +3 -0
- package/dist/notion.client.plugin.d.ts.map +1 -0
- package/dist/notion.client.plugin.js +49 -0
- package/dist/notion.client.plugin.js.map +1 -0
- package/dist/schemas/json.d.ts +6 -0
- package/dist/schemas/json.d.ts.map +1 -0
- package/dist/schemas/json.js +4 -0
- package/dist/schemas/json.js.map +1 -0
- package/dist/schemas/notion.d.ts +221 -0
- package/dist/schemas/notion.d.ts.map +1 -0
- package/dist/schemas/notion.js +130 -0
- package/dist/schemas/notion.js.map +1 -0
- package/dist/schemas/oauth.d.ts +63 -0
- package/dist/schemas/oauth.d.ts.map +1 -0
- package/dist/schemas/oauth.js +15 -0
- package/dist/schemas/oauth.js.map +1 -0
- package/dist/schemas/operations.d.ts +556 -0
- package/dist/schemas/operations.d.ts.map +1 -0
- package/dist/schemas/operations.js +39 -0
- package/dist/schemas/operations.js.map +1 -0
- package/dist/schemas/sync.d.ts +32 -0
- package/dist/schemas/sync.d.ts.map +1 -0
- package/dist/schemas/sync.js +12 -0
- package/dist/schemas/sync.js.map +1 -0
- package/dist/schemas/tools.d.ts +239 -0
- package/dist/schemas/tools.d.ts.map +1 -0
- package/dist/schemas/tools.js +93 -0
- package/dist/schemas/tools.js.map +1 -0
- package/dist/schemas/vendor.d.ts +150 -0
- package/dist/schemas/vendor.d.ts.map +1 -0
- package/dist/schemas/vendor.js +31 -0
- package/dist/schemas/vendor.js.map +1 -0
- package/dist/server/oauth.d.ts +17 -0
- package/dist/server/oauth.d.ts.map +1 -0
- package/dist/server/oauth.js +64 -0
- package/dist/server/oauth.js.map +1 -0
- package/dist/sync/knowledge.notion.sync-mapping.descriptor.d.ts +15 -0
- package/dist/sync/knowledge.notion.sync-mapping.descriptor.d.ts.map +1 -0
- package/dist/sync/knowledge.notion.sync-mapping.descriptor.js +15 -0
- package/dist/sync/knowledge.notion.sync-mapping.descriptor.js.map +1 -0
- package/dist/sync/knowledge.notion.sync-mapping.impl.d.ts +13 -0
- package/dist/sync/knowledge.notion.sync-mapping.impl.d.ts.map +1 -0
- package/dist/sync/knowledge.notion.sync-mapping.impl.js +27 -0
- package/dist/sync/knowledge.notion.sync-mapping.impl.js.map +1 -0
- package/dist/sync/notion-record-projection.d.ts +16 -0
- package/dist/sync/notion-record-projection.d.ts.map +1 -0
- package/dist/sync/notion-record-projection.js +50 -0
- package/dist/sync/notion-record-projection.js.map +1 -0
- package/dist/sync/notion.sync-endpoint.descriptor.d.ts +14 -0
- package/dist/sync/notion.sync-endpoint.descriptor.d.ts.map +1 -0
- package/dist/sync/notion.sync-endpoint.descriptor.js +10 -0
- package/dist/sync/notion.sync-endpoint.descriptor.js.map +1 -0
- package/dist/sync/notion.sync-endpoint.impl.d.ts +55 -0
- package/dist/sync/notion.sync-endpoint.impl.d.ts.map +1 -0
- package/dist/sync/notion.sync-endpoint.impl.js +557 -0
- package/dist/sync/notion.sync-endpoint.impl.js.map +1 -0
- package/dist/sync/projects.notion.sync-mapping.descriptor.d.ts +15 -0
- package/dist/sync/projects.notion.sync-mapping.descriptor.d.ts.map +1 -0
- package/dist/sync/projects.notion.sync-mapping.descriptor.js +15 -0
- package/dist/sync/projects.notion.sync-mapping.descriptor.js.map +1 -0
- package/dist/sync/projects.notion.sync-mapping.impl.d.ts +13 -0
- package/dist/sync/projects.notion.sync-mapping.impl.d.ts.map +1 -0
- package/dist/sync/projects.notion.sync-mapping.impl.js +26 -0
- package/dist/sync/projects.notion.sync-mapping.impl.js.map +1 -0
- package/dist/sync/work.notion.sync-mapping.descriptor.d.ts +15 -0
- package/dist/sync/work.notion.sync-mapping.descriptor.d.ts.map +1 -0
- package/dist/sync/work.notion.sync-mapping.descriptor.js +15 -0
- package/dist/sync/work.notion.sync-mapping.descriptor.js.map +1 -0
- package/dist/sync/work.notion.sync-mapping.impl.d.ts +13 -0
- package/dist/sync/work.notion.sync-mapping.impl.d.ts.map +1 -0
- package/dist/sync/work.notion.sync-mapping.impl.js +63 -0
- package/dist/sync/work.notion.sync-mapping.impl.js.map +1 -0
- package/dist/tools/descriptors.d.ts +781 -0
- package/dist/tools/descriptors.d.ts.map +1 -0
- package/dist/tools/descriptors.js +129 -0
- package/dist/tools/descriptors.js.map +1 -0
- package/dist/tools/impl.d.ts +12 -0
- package/dist/tools/impl.d.ts.map +1 -0
- package/dist/tools/impl.js +61 -0
- package/dist/tools/impl.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/schemas.d.ts +2 -0
- package/dist/tools/schemas.d.ts.map +1 -0
- package/dist/tools/schemas.js +2 -0
- package/dist/tools/schemas.js.map +1 -0
- package/package.json +105 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: VIBES DEV LLC
|
|
6
|
+
Licensed Work: @vibesdotdev/integrations-notion
|
|
7
|
+
The Licensed Work is (c) 2026 VIBES DEV LLC.
|
|
8
|
+
Additional Use Grant: In this grant, "Vibes Platform" means the hosted services VIBES DEV LLC
|
|
9
|
+
operates at vibes.dev and its subdomains.
|
|
10
|
+
|
|
11
|
+
You may make production use of the Licensed Work, including commercial
|
|
12
|
+
use, subject to the limits below. Permitted production use includes:
|
|
13
|
+
building, operating and selling your own applications, agents and services
|
|
14
|
+
on or with the Vibes Platform; self-hosting the Licensed Work for use inside
|
|
15
|
+
your own organization; and providing consulting, integration or development
|
|
16
|
+
services to clients who build on the Vibes Platform.
|
|
17
|
+
|
|
18
|
+
The production use permitted above does not include use that:
|
|
19
|
+
|
|
20
|
+
(a) offers third parties a hosted, managed or embedded service that
|
|
21
|
+
substitutes for the Vibes Platform or a material part of it (including
|
|
22
|
+
agent hosting; fleet, sandbox or container provisioning; package
|
|
23
|
+
registry; source hosting and continuous integration; and managed AI,
|
|
24
|
+
storage, secrets or messaging), where the Licensed Work provides a
|
|
25
|
+
material part of that service's value and that service earns more than
|
|
26
|
+
US$1,000,000 in gross revenue in any twelve-month period;
|
|
27
|
+
(b) sells, rents, sublicenses or white-labels the Licensed Work, or access
|
|
28
|
+
to Vibes Platform functionality, as a product in its own right;
|
|
29
|
+
(c) removes, disables or works around entitlement checks, usage metering,
|
|
30
|
+
quotas or plan limits, or reaches Vibes Platform features the user's
|
|
31
|
+
account is not entitled to;
|
|
32
|
+
(d) scrapes, bulk-exports or harvests data or content from the Vibes
|
|
33
|
+
Platform or its users other than through documented interfaces and
|
|
34
|
+
within their terms, or uses outputs or data obtained from the Vibes
|
|
35
|
+
Platform to train or improve a product that competes with it;
|
|
36
|
+
(e) violates applicable law, infringes anyone's rights, commits fraud or
|
|
37
|
+
deception, conducts unlawful surveillance or harassment, distributes
|
|
38
|
+
malware, or accesses systems without authorization; or
|
|
39
|
+
(f) violates applicable antitrust or competition law.
|
|
40
|
+
|
|
41
|
+
A written permission from the Licensor extends this grant.
|
|
42
|
+
Change Date: Four years from the date the Licensed Work is published.
|
|
43
|
+
Change License: MIT
|
|
44
|
+
|
|
45
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
46
|
+
contact VIBES DEV LLC through https://vibes.dev.
|
|
47
|
+
|
|
48
|
+
Notice
|
|
49
|
+
|
|
50
|
+
The Business Source License (this document, or the "License") is not an Open
|
|
51
|
+
Source license. However, the Licensed Work will eventually be made available
|
|
52
|
+
under an Open Source License, as stated in this License.
|
|
53
|
+
|
|
54
|
+
-----------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
Business Source License 1.1
|
|
57
|
+
|
|
58
|
+
License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
|
|
59
|
+
"Business Source License" is a trademark of MariaDB Corporation Ab.
|
|
60
|
+
|
|
61
|
+
Terms
|
|
62
|
+
|
|
63
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
64
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
65
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
66
|
+
production use.
|
|
67
|
+
|
|
68
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
69
|
+
available distribution of a specific version of the Licensed Work under this
|
|
70
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
71
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
72
|
+
above terminate.
|
|
73
|
+
|
|
74
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
75
|
+
currently in effect as described in this License, you must purchase a
|
|
76
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
77
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
78
|
+
|
|
79
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
80
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
81
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
82
|
+
for each version of the Licensed Work released by Licensor.
|
|
83
|
+
|
|
84
|
+
You must conspicuously display this License on each original or modified copy
|
|
85
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
86
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
87
|
+
License apply to your use of that work.
|
|
88
|
+
|
|
89
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
90
|
+
terminate your rights under this License for the current and all other
|
|
91
|
+
versions of the Licensed Work.
|
|
92
|
+
|
|
93
|
+
This License does not grant you any right in any trademark or logo of
|
|
94
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
95
|
+
Licensor as expressly required by this License).
|
|
96
|
+
|
|
97
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
98
|
+
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
99
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
100
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
101
|
+
TITLE.
|
|
102
|
+
|
|
103
|
+
MariaDB hereby grants you permission to use this License’s text to license
|
|
104
|
+
your works, and to refer to it using the trademark “Business Source License”,
|
|
105
|
+
as long as you comply with the Covenants of Licensor below.
|
|
106
|
+
|
|
107
|
+
Covenants of Licensor
|
|
108
|
+
|
|
109
|
+
In consideration of the right to use this License’s text and the “Business
|
|
110
|
+
Source License” name and trademark, Licensor covenants to MariaDB, and to all
|
|
111
|
+
other recipients of the licensed work to be provided by Licensor:
|
|
112
|
+
|
|
113
|
+
1. To specify as the Change License the GPL Version 2.0 or any later version,
|
|
114
|
+
or a license that is compatible with GPL Version 2.0 or a later version,
|
|
115
|
+
where “compatible” means that software provided under the Change License can
|
|
116
|
+
be included in a program with software provided under GPL Version 2.0 or a
|
|
117
|
+
later version. Licensor may specify additional Change Licenses without
|
|
118
|
+
limitation.
|
|
119
|
+
|
|
120
|
+
2. To either: (a) specify an additional grant of rights to use that does not
|
|
121
|
+
impose any additional restriction on the right granted in this License, as
|
|
122
|
+
the Additional Use Grant; or (b) insert the text “None”.
|
|
123
|
+
|
|
124
|
+
3. To specify a Change Date.
|
|
125
|
+
|
|
126
|
+
4. Not to modify this License in any other way.
|
package/README.md
CHANGED
|
@@ -1,3 +1,143 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @vibesdotdev/integrations-notion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Canonical Notion API `2026-03-11` connector for Vibes.
|
|
4
|
+
|
|
5
|
+
## Hosting model
|
|
6
|
+
|
|
7
|
+
Platform-web registers the integrations kind owner, then the sync plugin, then
|
|
8
|
+
the host plugin. The host also supplies integration/store with its backing storage, system/settings-reader, Logging, and Storage. It owns credential resolution and all Notion REST transport. Org-scoped credentials additionally need a live request org id (runtime context `orgId`); without it the core resolver refuses `PERMISSION_DENIED` `integration-organization-required` before any transport.
|
|
9
|
+
The Vibes CLI composes this order in its app-owned integration host. Other apps
|
|
10
|
+
register only the providers their scope supports. With the standard core runtime
|
|
11
|
+
already composed, direct registration must be explicit:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import integrationsPlugin from '@vibesdotdev/integrations/plugin';
|
|
15
|
+
import syncPlugin from '@vibesdotdev/sync/plugin';
|
|
16
|
+
import notionHostPlugin from '@vibesdotdev/integrations-notion/plugin';
|
|
17
|
+
|
|
18
|
+
await runtime.registerPlugin(integrationsPlugin);
|
|
19
|
+
await runtime.registerPlugin(syncPlugin);
|
|
20
|
+
await runtime.registerPlugin(notionHostPlugin);
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Consumer apps never register the server host plugin. They register sync before
|
|
24
|
+
the client plugin and resolve the typed runtime client. They never receive or
|
|
25
|
+
read a Notion token:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import notionClientPlugin from '@vibesdotdev/integrations-notion/client-plugin';
|
|
29
|
+
import { getVibesNotionClient } from '@vibesdotdev/integrations-notion/client';
|
|
30
|
+
import syncPlugin from '@vibesdotdev/sync/plugin';
|
|
31
|
+
|
|
32
|
+
await runtime.registerPlugin(syncPlugin);
|
|
33
|
+
await runtime.registerPlugin(notionClientPlugin);
|
|
34
|
+
const notion = await getVibesNotionClient(runtime);
|
|
35
|
+
const { pages, nextCursor } = await notion.pull({ pageSize: 50 });
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The four namespaces are users, databases, dataSources, and pages. Database,
|
|
39
|
+
data-source, and page getters return null for confirmed absence; malformed or
|
|
40
|
+
missing results raise typed failures. Consumers declare the platform infra/service
|
|
41
|
+
origin and internal service credential.
|
|
42
|
+
|
|
43
|
+
The same client plugin projects the canonical agent surface. Compose the
|
|
44
|
+
tools/tool kind owner before resolving tools:
|
|
45
|
+
|
|
46
|
+
- `notion.search`, `notion.data-sources.get/query`, and `notion.pages.get`
|
|
47
|
+
perform one bounded read.
|
|
48
|
+
- `notion.pages.create/update` perform explicit approval-gated writes; update
|
|
49
|
+
cannot trash or archive a page.
|
|
50
|
+
|
|
51
|
+
Tools take caller identity only from trusted execution metadata and never accept
|
|
52
|
+
OAuth tokens or other credentials in model-authored input.
|
|
53
|
+
|
|
54
|
+
## API vocabulary
|
|
55
|
+
|
|
56
|
+
Notion databases are containers. Their child data sources own property schemas
|
|
57
|
+
and rows:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
const database = await notion.databases.get(databaseId);
|
|
61
|
+
const dataSourceId = database?.dataSources[0]?.id;
|
|
62
|
+
if (dataSourceId) {
|
|
63
|
+
const { pages } = await notion.dataSources.query({ dataSourceId, pageSize: 50 });
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- Configure `dataSourceId`. If an existing value names a database container,
|
|
68
|
+
the canonical data-source flow resolves its sole child and refuses when the
|
|
69
|
+
container has multiple data sources.
|
|
70
|
+
- Query `/data_sources/:id/query`, never `/databases/:id/query`.
|
|
71
|
+
- Create pages with `parentDataSourceId`.
|
|
72
|
+
- Search filters are `page` and `data_source`.
|
|
73
|
+
- Trash state is `inTrash` (`in_trash` on the wire).
|
|
74
|
+
|
|
75
|
+
`pull()` and `sync.endpoint.notion.pages` are intentionally one cursor page.
|
|
76
|
+
The endpoint preserves stable page identity across the pages of one scan,
|
|
77
|
+
accepts destination identity carried by a completed core scan, validates the
|
|
78
|
+
target title/key schema, and fails destructive writes that have no observed
|
|
79
|
+
target. Pulled
|
|
80
|
+
records can expose provider-neutral `title`, `contentText`, `contentType`,
|
|
81
|
+
`projectId`, `status`, and `priority` envelope fields; hashes exclude Notion ids,
|
|
82
|
+
timestamps, URLs, raw property envelopes, and the sync key. `Title` + `Content`
|
|
83
|
+
work by default for knowledge data sources. Projects and work-item bindings can
|
|
84
|
+
name their existing properties with `titleProperty`, `contentProperty`,
|
|
85
|
+
`contentTypeProperty`, `projectIdProperty`, `statusProperty`, and
|
|
86
|
+
`priorityProperty`. This package owns the versioned `knowledge.notion@1`,
|
|
87
|
+
`projects.notion@1`, and `work.notion@1` mappings. Those profiles deliberately
|
|
88
|
+
project only each domain's canonical surface: Knowledge requires title/content,
|
|
89
|
+
Projects permits title/optional content, and Work requires validated
|
|
90
|
+
status/priority alongside title/optional content (with project identity carried
|
|
91
|
+
by binding scope). Work bindings explicitly name the Notion status and priority
|
|
92
|
+
properties; absent configuration or blank/unknown values fail closed.
|
|
93
|
+
An omitted Notion content field explicitly clears a staged non-empty destination
|
|
94
|
+
description, while omission against an already-empty destination remains omitted;
|
|
95
|
+
the Projects and Work endpoints preserve that absent-versus-clear distinction.
|
|
96
|
+
Product features may register additional mapping profiles and remain
|
|
97
|
+
responsible for cursor persistence, conflict policy, and bindings.
|
|
98
|
+
|
|
99
|
+
## OAuth and failures
|
|
100
|
+
|
|
101
|
+
Use ./server/oauth for code exchange, refresh, and token storage. Responses are
|
|
102
|
+
schema validated. The host secret service provides list/create/update;
|
|
103
|
+
replacement never deletes recoverable credentials, and an omitted refresh token
|
|
104
|
+
preserves the previous refresh credential.
|
|
105
|
+
|
|
106
|
+
Failures use CapabilityError codes and value-free reasons. Vendor bodies,
|
|
107
|
+
remote messages, record contents, and credentials never appear in failure text.
|
|
108
|
+
Mutations make one attempt; ambiguous outcomes remain unknown for reconciliation.
|
|
109
|
+
Concrete provider implementations remain available through ./notion.
|
|
110
|
+
|
|
111
|
+
## Verification
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cd integrations/notion
|
|
115
|
+
bun run test
|
|
116
|
+
bun run check
|
|
117
|
+
bun run build
|
|
118
|
+
node ../../node_modules/@vibesdotdev/internal-oxlint-toolchain/ratchet.mjs
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Also run workspace-rules for this package. Tests include OAuth, check includes
|
|
122
|
+
tests, and build emits production sources only.
|
|
123
|
+
|
|
124
|
+
See [SPEC.md](./SPEC.md) for ownership and migration details.
|
|
125
|
+
|
|
126
|
+
## Replacing temporary database-query aliases
|
|
127
|
+
|
|
128
|
+
The temporary database-query aliases are removed from the public client and
|
|
129
|
+
operation schemas. Migrate `config.databaseId` to `config.dataSourceId`,
|
|
130
|
+
`client.databases.query({databaseId})` to
|
|
131
|
+
`client.dataSources.query({dataSourceId})`, `queryDatabase` to
|
|
132
|
+
`queryDataSource`, and `pull-database` to `pull-data-source`.
|
|
133
|
+
For low-level callers, replace `NotionAPIClient.queryDatabase({databaseId})`
|
|
134
|
+
with `queryDataSource({dataSourceId})`, and provider `pullDatabase(options)`
|
|
135
|
+
with `pullDataSource(options)`. Replace
|
|
136
|
+
`resolveLegacyDatabaseDataSourceId(databaseId)` with `getDatabase(databaseId)`
|
|
137
|
+
and explicitly select an id from its `dataSources`; query callers may instead
|
|
138
|
+
pass the container id to `queryDataSource` for the same sole-child discovery;
|
|
139
|
+
its result's `dataSourceId` is the resolved child id.
|
|
140
|
+
Replace `QueryNotionDatabaseSchema/Input` imports with
|
|
141
|
+
`QueryNotionDataSourceSchema/Input`. Database-container retrieval remains
|
|
142
|
+
`databases.get`; a configured container id still resolves through the explicit
|
|
143
|
+
sole-child discovery flow described below.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { VibesRuntime } from '@vibesdotdev/kernel';
|
|
2
|
+
import type { NotionClient } from './runtime-client.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the canonical `NotionClient`.
|
|
5
|
+
*
|
|
6
|
+
* Equivalent to `runtime.query('runtime/client').withId('notion').resolve()`.
|
|
7
|
+
* Requires the integrations-notion plugin to be composed into the runtime.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { getVibesNotionClient } from '@vibesdotdev/integrations-notion/client';
|
|
11
|
+
* const notion = await getVibesNotionClient(runtime);
|
|
12
|
+
* const me = await notion.users.me();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function getVibesNotionClient(runtime: VibesRuntime): Promise<NotionClient>;
|
|
16
|
+
//# sourceMappingURL=helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../../src/client/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAEvF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getVibesClient } from '@vibesdotdev/kernel/client';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the canonical `NotionClient`.
|
|
4
|
+
*
|
|
5
|
+
* Equivalent to `runtime.query('runtime/client').withId('notion').resolve()`.
|
|
6
|
+
* Requires the integrations-notion plugin to be composed into the runtime.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { getVibesNotionClient } from '@vibesdotdev/integrations-notion/client';
|
|
10
|
+
* const notion = await getVibesNotionClient(runtime);
|
|
11
|
+
* const me = await notion.users.me();
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export async function getVibesNotionClient(runtime) {
|
|
15
|
+
return getVibesClient('notion', runtime);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../src/client/helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAqB;IAC/D,OAAO,cAAc,CAAe,QAAQ,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6B,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { NotionOperationInput } from '../schemas/operations.ts';
|
|
2
|
+
import type { KindContext } from '@vibesdotdev/kernel';
|
|
3
|
+
import { type VibesRuntime } from '@vibesdotdev/kernel';
|
|
4
|
+
import { BaseRuntimeClient, type RuntimeClientDescriptor } from '@vibesdotdev/kernel/client';
|
|
5
|
+
import type { CreateNotionPageInput, NotionDataSource, NotionDatabase, NotionPage, NotionPullOptions, NotionPullResult, NotionUser, QueryNotionDataSourceInput, UpdateNotionPageInput } from '../notion/notion-schemas.ts';
|
|
6
|
+
export type { NotionInvokeIdentity } from '../schemas/operations.ts';
|
|
7
|
+
import { type NotionInvokeIdentity } from '../schemas/operations.ts';
|
|
8
|
+
/**
|
|
9
|
+
* Canonical Notion runtime client.
|
|
10
|
+
*
|
|
11
|
+
* Thin typed shim over platform-web's
|
|
12
|
+
* `/api/internal/integrations/integration.notion/operations/[op]`
|
|
13
|
+
* dispatch. Apps consume `notion.pages.*`, `notion.dataSources.*`,
|
|
14
|
+
* `notion.databases.get()`, `notion.users.*`, `notion.search()`; platform-web hosts the
|
|
15
|
+
* integration provider impl, owns the API token, and runs all Notion
|
|
16
|
+
* REST API calls in its worker.
|
|
17
|
+
*
|
|
18
|
+
* Resolved via `getVibesNotionClient(runtime)` or
|
|
19
|
+
* `runtime.query('runtime/client').withId('notion').resolve()`.
|
|
20
|
+
*
|
|
21
|
+
* Requires `VIBES_INTERNAL_SERVICE_TOKEN` on the consuming worker so
|
|
22
|
+
* service-to-service calls authenticate.
|
|
23
|
+
*/
|
|
24
|
+
export declare class NotionClient extends BaseRuntimeClient {
|
|
25
|
+
readonly users: UsersNamespace;
|
|
26
|
+
readonly databases: DatabasesNamespace;
|
|
27
|
+
readonly dataSources: DataSourcesNamespace;
|
|
28
|
+
readonly pages: PagesNamespace;
|
|
29
|
+
constructor(descriptor?: RuntimeClientDescriptor, context?: KindContext, runtime?: VibesRuntime);
|
|
30
|
+
/** Integration descriptor id this client dispatches to. */
|
|
31
|
+
get integrationId(): string;
|
|
32
|
+
/** Pull one cursor page for a domain-owned sync endpoint to process. */
|
|
33
|
+
pull(args?: NotionPullOptions, identity?: NotionInvokeIdentity): Promise<NotionPullResult>;
|
|
34
|
+
/** Workspace-wide search across pages + data sources. */
|
|
35
|
+
search(query?: string, options?: {
|
|
36
|
+
filter?: 'data_source' | 'page';
|
|
37
|
+
pageSize?: number;
|
|
38
|
+
startCursor?: string;
|
|
39
|
+
}, identity?: NotionInvokeIdentity): Promise<{
|
|
40
|
+
dataSources: NotionDataSource[];
|
|
41
|
+
pages: NotionPage[];
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
nextCursor?: string;
|
|
44
|
+
}>;
|
|
45
|
+
/**
|
|
46
|
+
* Invoke an arbitrary declared operation. Internal escape hatch for
|
|
47
|
+
* ops without a typed wrapper; apps should prefer the namespaces.
|
|
48
|
+
*/
|
|
49
|
+
invoke<T = unknown>(operationId: string, args?: NotionOperationInput, identity?: NotionInvokeIdentity): Promise<T>;
|
|
50
|
+
}
|
|
51
|
+
type Invoke = <T = unknown>(opId: string, args?: NotionOperationInput, identity?: NotionInvokeIdentity) => Promise<T>;
|
|
52
|
+
declare class UsersNamespace {
|
|
53
|
+
private readonly invoke;
|
|
54
|
+
constructor(invoke: Invoke);
|
|
55
|
+
/** Fetch the authenticated bot user. */
|
|
56
|
+
me(): Promise<NotionUser>;
|
|
57
|
+
/** List users in the workspace. */
|
|
58
|
+
list(): Promise<NotionUser[]>;
|
|
59
|
+
}
|
|
60
|
+
declare class DatabasesNamespace {
|
|
61
|
+
private readonly invoke;
|
|
62
|
+
constructor(invoke: Invoke);
|
|
63
|
+
/** Fetch a database by id. Returns null if not found. */
|
|
64
|
+
get(databaseId: string): Promise<NotionDatabase | null>;
|
|
65
|
+
}
|
|
66
|
+
declare class DataSourcesNamespace {
|
|
67
|
+
private readonly invoke;
|
|
68
|
+
constructor(invoke: Invoke);
|
|
69
|
+
/** Fetch a data source schema by id. Returns null if not found. */
|
|
70
|
+
get(dataSourceId: string, identity?: NotionInvokeIdentity): Promise<NotionDataSource | null>;
|
|
71
|
+
/** Query rows of a data source with optional filter/sorts. */
|
|
72
|
+
query(input: QueryNotionDataSourceInput, identity?: NotionInvokeIdentity): Promise<{
|
|
73
|
+
dataSourceId: string;
|
|
74
|
+
pages: NotionPage[];
|
|
75
|
+
hasMore: boolean;
|
|
76
|
+
nextCursor?: string;
|
|
77
|
+
}>;
|
|
78
|
+
}
|
|
79
|
+
declare class PagesNamespace {
|
|
80
|
+
private readonly invoke;
|
|
81
|
+
constructor(invoke: Invoke);
|
|
82
|
+
/** Fetch a page by id. Returns null if not found. */
|
|
83
|
+
get(pageId: string, identity?: NotionInvokeIdentity): Promise<NotionPage | null>;
|
|
84
|
+
/** Create a new page. */
|
|
85
|
+
create(input: CreateNotionPageInput, identity?: NotionInvokeIdentity): Promise<NotionPage>;
|
|
86
|
+
/** Update an existing page. */
|
|
87
|
+
update(pageId: string, input: UpdateNotionPageInput, identity?: NotionInvokeIdentity): Promise<NotionPage>;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=runtime-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-client.d.ts","sourceRoot":"","sources":["../../src/client/runtime-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAyB,MAAM,0BAA0B,CAAC;AAC5F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE7F,OAAO,KAAK,EACX,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,MAAM,6BAA6B,CAAC;AAIrC,YAAY,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAA8F,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEjK;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAa,SAAQ,iBAAiB;IAClD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,oBAAoB,CAAC;IAC3C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;gBAG9B,UAAU,GAAE,uBAAkE,EAC9E,OAAO,CAAC,EAAE,WAAW,EACrB,OAAO,CAAC,EAAE,YAAY;IAavB,2DAA2D;IAC3D,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,wEAAwE;IAClE,IAAI,CACT,IAAI,GAAE,iBAAsB,EAC5B,QAAQ,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAA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BAAN,MAAM,EAAE,MAAM;IAE3C,mEAAmE;IAC7D,GAAG,CACR,YAAY,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAInC,8DAA8D;IACxD,KAAK,CACV,KAAK,EAAE,0BAA0B,EACjC,QAAQ,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC;QACV,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,UAAU,EAAE,CAAC;QACpB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CAOF;AAED,cAAM,cAAc;IACP,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C,qDAAqD;IAC/C,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAItF,yBAAyB;IACnB,MAAM,CAAC,KAAK,EAAE,qBAAqB,EAAE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhG,+BAA+B;IACzB,MAAM,CACX,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,qBAAqB,EAC5B,QAAQ,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,UAAU,CAAC;CAGtB"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { CapabilityError } from '@vibesdotdev/kernel';
|
|
2
|
+
import { BaseRuntimeClient } from '@vibesdotdev/kernel/client';
|
|
3
|
+
import { getVibesPlatformInternalClient } from '@vibesdotdev/platform/internal-api';
|
|
4
|
+
const NOTION_INTEGRATION_ID = 'integration.notion';
|
|
5
|
+
import { NotionInvokeIdentitySchema, OperationIdSchema, OperationInputs, OperationResults, contract } from "../schemas/operations.js";
|
|
6
|
+
import * as z from 'zod/v4';
|
|
7
|
+
/**
|
|
8
|
+
* Canonical Notion runtime client.
|
|
9
|
+
*
|
|
10
|
+
* Thin typed shim over platform-web's
|
|
11
|
+
* `/api/internal/integrations/integration.notion/operations/[op]`
|
|
12
|
+
* dispatch. Apps consume `notion.pages.*`, `notion.dataSources.*`,
|
|
13
|
+
* `notion.databases.get()`, `notion.users.*`, `notion.search()`; platform-web hosts the
|
|
14
|
+
* integration provider impl, owns the API token, and runs all Notion
|
|
15
|
+
* REST API calls in its worker.
|
|
16
|
+
*
|
|
17
|
+
* Resolved via `getVibesNotionClient(runtime)` or
|
|
18
|
+
* `runtime.query('runtime/client').withId('notion').resolve()`.
|
|
19
|
+
*
|
|
20
|
+
* Requires `VIBES_INTERNAL_SERVICE_TOKEN` on the consuming worker so
|
|
21
|
+
* service-to-service calls authenticate.
|
|
22
|
+
*/
|
|
23
|
+
export class NotionClient extends BaseRuntimeClient {
|
|
24
|
+
users;
|
|
25
|
+
databases;
|
|
26
|
+
dataSources;
|
|
27
|
+
pages;
|
|
28
|
+
constructor(descriptor = { id: 'notion', kind: 'runtime/client' }, context, runtime) {
|
|
29
|
+
super(descriptor, context, runtime);
|
|
30
|
+
this.users = new UsersNamespace((opId, args, identity) => this.invoke(opId, args, identity));
|
|
31
|
+
this.databases = new DatabasesNamespace((opId, args, identity) => this.invoke(opId, args, identity));
|
|
32
|
+
this.dataSources = new DataSourcesNamespace((opId, args, identity) => this.invoke(opId, args, identity));
|
|
33
|
+
this.pages = new PagesNamespace((opId, args, identity) => this.invoke(opId, args, identity));
|
|
34
|
+
}
|
|
35
|
+
/** Integration descriptor id this client dispatches to. */
|
|
36
|
+
get integrationId() {
|
|
37
|
+
return NOTION_INTEGRATION_ID;
|
|
38
|
+
}
|
|
39
|
+
/** Pull one cursor page for a domain-owned sync endpoint to process. */
|
|
40
|
+
async pull(args = {}, identity) {
|
|
41
|
+
return this.invoke('pull-data-source', args, identity);
|
|
42
|
+
}
|
|
43
|
+
/** Workspace-wide search across pages + data sources. */
|
|
44
|
+
async search(query, options, identity) {
|
|
45
|
+
return this.invoke('search', {
|
|
46
|
+
query,
|
|
47
|
+
...options
|
|
48
|
+
}, identity);
|
|
49
|
+
}
|
|
50
|
+
async invoke(operationId, args, identity) {
|
|
51
|
+
const op = contract(OperationIdSchema).parse(operationId);
|
|
52
|
+
const input = contract(OperationInputs[op]).parse(args ?? {});
|
|
53
|
+
const explicit = contract(NotionInvokeIdentitySchema).parse(identity ?? {});
|
|
54
|
+
const userId = contract(z.string().min(1)).parse(explicit.userId ?? await this.runtime.context('userId'));
|
|
55
|
+
let org = explicit.orgId;
|
|
56
|
+
if (org === undefined) {
|
|
57
|
+
try {
|
|
58
|
+
org = contract(z.string().min(1).optional()).parse(await this.runtime.context('orgId'));
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (!(error instanceof Error && CapabilityError.isAbsenceOf(error, 'context', 'orgId')))
|
|
62
|
+
throw error;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const client = await getVibesPlatformInternalClient(this.runtime);
|
|
66
|
+
const result = await client.integrations.invoke({
|
|
67
|
+
userId, organizationId: org, integrationId: NOTION_INTEGRATION_ID, operationId: op, args: input
|
|
68
|
+
});
|
|
69
|
+
if (!result.ok)
|
|
70
|
+
throw new CapabilityError('Notion operation failed.', 'INTERNAL', { reason: 'notion-operation-failed' });
|
|
71
|
+
return contract(OperationResults[op]).parse(result.data);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class UsersNamespace {
|
|
75
|
+
invoke;
|
|
76
|
+
constructor(invoke) {
|
|
77
|
+
this.invoke = invoke;
|
|
78
|
+
}
|
|
79
|
+
/** Fetch the authenticated bot user. */
|
|
80
|
+
async me() {
|
|
81
|
+
return this.invoke('getMe');
|
|
82
|
+
}
|
|
83
|
+
/** List users in the workspace. */
|
|
84
|
+
async list() {
|
|
85
|
+
return this.invoke('listUsers');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
class DatabasesNamespace {
|
|
89
|
+
invoke;
|
|
90
|
+
constructor(invoke) {
|
|
91
|
+
this.invoke = invoke;
|
|
92
|
+
}
|
|
93
|
+
/** Fetch a database by id. Returns null if not found. */
|
|
94
|
+
async get(databaseId) {
|
|
95
|
+
return this.invoke('getDatabase', { databaseId });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
class DataSourcesNamespace {
|
|
99
|
+
invoke;
|
|
100
|
+
constructor(invoke) {
|
|
101
|
+
this.invoke = invoke;
|
|
102
|
+
}
|
|
103
|
+
/** Fetch a data source schema by id. Returns null if not found. */
|
|
104
|
+
async get(dataSourceId, identity) {
|
|
105
|
+
return this.invoke('getDataSource', { dataSourceId }, identity);
|
|
106
|
+
}
|
|
107
|
+
/** Query rows of a data source with optional filter/sorts. */
|
|
108
|
+
async query(input, identity) {
|
|
109
|
+
return this.invoke('queryDataSource', input, identity);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
class PagesNamespace {
|
|
113
|
+
invoke;
|
|
114
|
+
constructor(invoke) {
|
|
115
|
+
this.invoke = invoke;
|
|
116
|
+
}
|
|
117
|
+
/** Fetch a page by id. Returns null if not found. */
|
|
118
|
+
async get(pageId, identity) {
|
|
119
|
+
return this.invoke('getPage', { pageId }, identity);
|
|
120
|
+
}
|
|
121
|
+
/** Create a new page. */
|
|
122
|
+
async create(input, identity) {
|
|
123
|
+
return this.invoke('createPage', input, identity);
|
|
124
|
+
}
|
|
125
|
+
/** Update an existing page. */
|
|
126
|
+
async update(pageId, input, identity) {
|
|
127
|
+
return this.invoke('updatePage', { pageId, input }, identity);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=runtime-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-client.js","sourceRoot":"","sources":["../../src/client/runtime-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAqB,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAgC,M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
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const descriptor: {
|
|
2
|
+
readonly kind: "docs/topic";
|
|
3
|
+
readonly id: "integrations.notion";
|
|
4
|
+
readonly title: "Notion Integration";
|
|
5
|
+
readonly summary: "Cursor-based Notion transport for domain-owned projections.";
|
|
6
|
+
readonly body: {
|
|
7
|
+
readonly type: "markdown";
|
|
8
|
+
readonly sourceType: "raw";
|
|
9
|
+
readonly source: "---\ntitle: Notion Integration\nsummary: Cursor-based Notion transport for domain-owned projections.\nparent: integrations\norder: 3\n---\n\n# Notion integration\n\nThe Notion package owns authenticated Notion API 2026-03-11 transport and a canonical runtime client. It does not decide whether a page becomes a knowledge item, project, or document.\n\n## Runtime surface\n\n- `notion.users.*`, `notion.dataSources.*`, `notion.databases.get`, and `notion.pages.*` expose typed operations.\n- `notion.search()` searches the connected workspace.\n- `notion.pull()` returns one cursor page, optionally filtered by `last_edited_time`.\n- `sync.endpoint.notion.pages` projects one bounded data-source page into `title`, `contentText`, `contentType`, `projectId`, `status`, and `priority`; it derives stable keys from an explicit rich-text property and returns provider page ids after apply.\n- Agent tools `notion.search`, `notion.data-sources.get/query`, and `notion.pages.get` expose bounded reads. `notion.pages.create/update` are approval-gated explicit writes through the canonical runtime client; there is no archive or delete tool.\n\nDatabase objects are containers. Retrieve one to discover its child data-source IDs, then query `notion.dataSources`. Search filters are `page` and `data_source`; page parents use `data_source_id`; trash state is `inTrash`.\n\nThe pull result reports only what Notion returned. This package owns versioned `knowledge.notion@1`, `projects.notion@1`, and `work.notion@1` mappings; product features may register additional mappings and own direction, authority, deletion policy, and trigger before changes are applied. The endpoint validates every mapped target property before writing. `Title` plus an existing rich-text `Content` property work by default; bindings can select existing properties with `titleProperty`, `contentProperty`, `contentTypeProperty`, `projectIdProperty`, `statusProperty`, and `priorityProperty`.\n\n## Contracts and OAuth\n\nAll four namespaces validate operation inputs and results. Database, data-source,\nand page getters return null for confirmed absence. Missing or malformed data\nraises a typed contract refusal. Explicit JSON contracts preserve extensible\nproperties and blocks. Generic invocation retains result validation.\n\nThe explicit server/oauth entrypoint validates token responses, replaces secrets\nthrough the host owner's list/create/update API, and preserves the previous\nrefresh token when no replacement is returned. Public failures contain no vendor\nbodies, remote messages, record contents, or credentials. Mutations make one\ntransport attempt; ambiguous writes remain unknown for sync reconciliation.\nRetry pacing and scheduling belong to lifecycle and Workers.\n\nHosts supply integration/store, system/settings-reader, storage backing, Logging,\nStorage, and the integrations owner. Consumers declare the platform infra/service\norigin and internal service credential. Tool resolution requires the tools/tool\nowner and trusted user identity. Concrete providers live at the explicit notion\nentrypoint.\n\n## Safety\n\nCredentials stay in the hosted integration provider. Direct hosts register `integrations`, then `sync`, then the host plugin; consumers register `sync` before the client plugin and never register the host provider. Agent writes reject credential fields and oversized payloads, and identity comes only from surface-asserted metadata projected by the runtime. Cursor state and synchronized anchors belong to the owning sync feature. Provider ids are scoped by data source. Content hashes cover semantic fields only—not Notion ids, timestamps, URLs, raw property envelopes, or sync keys. Trashed pages are explicit Notion tombstones; absence from a cursor page is never deletion evidence, and archive/delete without an observed page fails visibly.\n";
|
|
10
|
+
};
|
|
11
|
+
readonly parent: "integrations";
|
|
12
|
+
readonly order: 3;
|
|
13
|
+
readonly tags: readonly ["integrations", "notion", "sync"];
|
|
14
|
+
readonly surfaces: readonly ["web", "in-app"];
|
|
15
|
+
readonly hardware: readonly ["consumer", "cloud"];
|
|
16
|
+
readonly enabled: true;
|
|
17
|
+
};
|
|
18
|
+
export default descriptor;
|
|
19
|
+
//# sourceMappingURL=integrations-notion.docs.descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integrations-notion.docs.descriptor.d.ts","sourceRoot":"","sources":["../../src/docs/integrations-notion.docs.descriptor.ts"],"names":[],"mappings":"AAgDA,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;;CAYN,CAAC;AAEX,eAAe,UAAU,CAAC"}
|