@stoneforge/quarry 1.12.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/api/quarry-api.d.ts +9 -1
- package/dist/api/quarry-api.d.ts.map +1 -1
- package/dist/api/quarry-api.js +21 -2
- package/dist/api/quarry-api.js.map +1 -1
- package/dist/api/types.d.ts +8 -1
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js.map +1 -1
- package/dist/cli/commands/auto-link-helper.d.ts +33 -0
- package/dist/cli/commands/auto-link-helper.d.ts.map +1 -0
- package/dist/cli/commands/auto-link-helper.js +74 -0
- package/dist/cli/commands/auto-link-helper.js.map +1 -0
- package/dist/cli/commands/crud.d.ts +3 -0
- package/dist/cli/commands/crud.d.ts.map +1 -1
- package/dist/cli/commands/crud.js +144 -15
- package/dist/cli/commands/crud.js.map +1 -1
- package/dist/cli/commands/docs.js +2 -2
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/document.js +1 -1
- package/dist/cli/commands/document.js.map +1 -1
- package/dist/cli/commands/entity.js +1 -1
- package/dist/cli/commands/entity.js.map +1 -1
- package/dist/cli/commands/external-sync.d.ts +18 -0
- package/dist/cli/commands/external-sync.d.ts.map +1 -0
- package/dist/cli/commands/external-sync.js +2499 -0
- package/dist/cli/commands/external-sync.js.map +1 -0
- package/dist/cli/commands/library.js +1 -1
- package/dist/cli/commands/library.js.map +1 -1
- package/dist/cli/commands/message.js +2 -2
- package/dist/cli/commands/message.js.map +1 -1
- package/dist/cli/commands/serve.d.ts.map +1 -1
- package/dist/cli/commands/serve.js +2 -0
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/task.d.ts.map +1 -1
- package/dist/cli/commands/task.js +7 -4
- package/dist/cli/commands/task.js.map +1 -1
- package/dist/cli/commands/team.js +1 -1
- package/dist/cli/commands/team.js.map +1 -1
- package/dist/cli/commands/workflow.js +1 -1
- package/dist/cli/commands/workflow.js.map +1 -1
- package/dist/cli/runner.d.ts.map +1 -1
- package/dist/cli/runner.js +3 -0
- package/dist/cli/runner.js.map +1 -1
- package/dist/cli/utils/progress.d.ts +30 -0
- package/dist/cli/utils/progress.d.ts.map +1 -0
- package/dist/cli/utils/progress.js +47 -0
- package/dist/cli/utils/progress.js.map +1 -0
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +34 -0
- package/dist/config/config.js.map +1 -1
- package/dist/config/defaults.d.ts +13 -1
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +22 -0
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/file.d.ts.map +1 -1
- package/dist/config/file.js +71 -0
- package/dist/config/file.js.map +1 -1
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -2
- package/dist/config/index.js.map +1 -1
- package/dist/config/merge.d.ts.map +1 -1
- package/dist/config/merge.js +52 -1
- package/dist/config/merge.js.map +1 -1
- package/dist/config/types.d.ts +68 -1
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +33 -0
- package/dist/config/types.js.map +1 -1
- package/dist/config/validation.d.ts.map +1 -1
- package/dist/config/validation.js +64 -1
- package/dist/config/validation.js.map +1 -1
- package/dist/external-sync/adapters/document-sync-adapter.d.ts +150 -0
- package/dist/external-sync/adapters/document-sync-adapter.d.ts.map +1 -0
- package/dist/external-sync/adapters/document-sync-adapter.js +325 -0
- package/dist/external-sync/adapters/document-sync-adapter.js.map +1 -0
- package/dist/external-sync/adapters/task-sync-adapter.d.ts +177 -0
- package/dist/external-sync/adapters/task-sync-adapter.d.ts.map +1 -0
- package/dist/external-sync/adapters/task-sync-adapter.js +353 -0
- package/dist/external-sync/adapters/task-sync-adapter.js.map +1 -0
- package/dist/external-sync/auto-link.d.ts +66 -0
- package/dist/external-sync/auto-link.d.ts.map +1 -0
- package/dist/external-sync/auto-link.js +98 -0
- package/dist/external-sync/auto-link.js.map +1 -0
- package/dist/external-sync/conflict-resolver.d.ts +170 -0
- package/dist/external-sync/conflict-resolver.d.ts.map +1 -0
- package/dist/external-sync/conflict-resolver.js +580 -0
- package/dist/external-sync/conflict-resolver.js.map +1 -0
- package/dist/external-sync/index.d.ts +23 -0
- package/dist/external-sync/index.d.ts.map +1 -0
- package/dist/external-sync/index.js +24 -0
- package/dist/external-sync/index.js.map +1 -0
- package/dist/external-sync/provider-registry.d.ts +113 -0
- package/dist/external-sync/provider-registry.d.ts.map +1 -0
- package/dist/external-sync/provider-registry.js +205 -0
- package/dist/external-sync/provider-registry.js.map +1 -0
- package/dist/external-sync/providers/folder/folder-document-adapter.d.ts +97 -0
- package/dist/external-sync/providers/folder/folder-document-adapter.d.ts.map +1 -0
- package/dist/external-sync/providers/folder/folder-document-adapter.js +261 -0
- package/dist/external-sync/providers/folder/folder-document-adapter.js.map +1 -0
- package/dist/external-sync/providers/folder/folder-fs.d.ts +146 -0
- package/dist/external-sync/providers/folder/folder-fs.d.ts.map +1 -0
- package/dist/external-sync/providers/folder/folder-fs.js +300 -0
- package/dist/external-sync/providers/folder/folder-fs.js.map +1 -0
- package/dist/external-sync/providers/folder/folder-provider.d.ts +28 -0
- package/dist/external-sync/providers/folder/folder-provider.d.ts.map +1 -0
- package/dist/external-sync/providers/folder/folder-provider.js +87 -0
- package/dist/external-sync/providers/folder/folder-provider.js.map +1 -0
- package/dist/external-sync/providers/folder/index.d.ts +11 -0
- package/dist/external-sync/providers/folder/index.d.ts.map +1 -0
- package/dist/external-sync/providers/folder/index.js +13 -0
- package/dist/external-sync/providers/folder/index.js.map +1 -0
- package/dist/external-sync/providers/github/github-api.d.ts +271 -0
- package/dist/external-sync/providers/github/github-api.d.ts.map +1 -0
- package/dist/external-sync/providers/github/github-api.js +366 -0
- package/dist/external-sync/providers/github/github-api.js.map +1 -0
- package/dist/external-sync/providers/github/github-field-map.d.ts +76 -0
- package/dist/external-sync/providers/github/github-field-map.d.ts.map +1 -0
- package/dist/external-sync/providers/github/github-field-map.js +157 -0
- package/dist/external-sync/providers/github/github-field-map.js.map +1 -0
- package/dist/external-sync/providers/github/github-provider.d.ts +36 -0
- package/dist/external-sync/providers/github/github-provider.d.ts.map +1 -0
- package/dist/external-sync/providers/github/github-provider.js +212 -0
- package/dist/external-sync/providers/github/github-provider.js.map +1 -0
- package/dist/external-sync/providers/github/github-task-adapter.d.ts +135 -0
- package/dist/external-sync/providers/github/github-task-adapter.d.ts.map +1 -0
- package/dist/external-sync/providers/github/github-task-adapter.js +374 -0
- package/dist/external-sync/providers/github/github-task-adapter.js.map +1 -0
- package/dist/external-sync/providers/github/index.d.ts +12 -0
- package/dist/external-sync/providers/github/index.d.ts.map +1 -0
- package/dist/external-sync/providers/github/index.js +15 -0
- package/dist/external-sync/providers/github/index.js.map +1 -0
- package/dist/external-sync/providers/index.d.ts +13 -0
- package/dist/external-sync/providers/index.d.ts.map +1 -0
- package/dist/external-sync/providers/index.js +15 -0
- package/dist/external-sync/providers/index.js.map +1 -0
- package/dist/external-sync/providers/linear/index.d.ts +19 -0
- package/dist/external-sync/providers/linear/index.d.ts.map +1 -0
- package/dist/external-sync/providers/linear/index.js +19 -0
- package/dist/external-sync/providers/linear/index.js.map +1 -0
- package/dist/external-sync/providers/linear/linear-api.d.ts +252 -0
- package/dist/external-sync/providers/linear/linear-api.d.ts.map +1 -0
- package/dist/external-sync/providers/linear/linear-api.js +522 -0
- package/dist/external-sync/providers/linear/linear-api.js.map +1 -0
- package/dist/external-sync/providers/linear/linear-field-map.d.ts +135 -0
- package/dist/external-sync/providers/linear/linear-field-map.d.ts.map +1 -0
- package/dist/external-sync/providers/linear/linear-field-map.js +338 -0
- package/dist/external-sync/providers/linear/linear-field-map.js.map +1 -0
- package/dist/external-sync/providers/linear/linear-provider.d.ts +52 -0
- package/dist/external-sync/providers/linear/linear-provider.d.ts.map +1 -0
- package/dist/external-sync/providers/linear/linear-provider.js +169 -0
- package/dist/external-sync/providers/linear/linear-provider.js.map +1 -0
- package/dist/external-sync/providers/linear/linear-task-adapter.d.ts +190 -0
- package/dist/external-sync/providers/linear/linear-task-adapter.d.ts.map +1 -0
- package/dist/external-sync/providers/linear/linear-task-adapter.js +521 -0
- package/dist/external-sync/providers/linear/linear-task-adapter.js.map +1 -0
- package/dist/external-sync/providers/linear/linear-types.d.ts +114 -0
- package/dist/external-sync/providers/linear/linear-types.d.ts.map +1 -0
- package/dist/external-sync/providers/linear/linear-types.js +10 -0
- package/dist/external-sync/providers/linear/linear-types.js.map +1 -0
- package/dist/external-sync/providers/notion/index.d.ts +19 -0
- package/dist/external-sync/providers/notion/index.d.ts.map +1 -0
- package/dist/external-sync/providers/notion/index.js +20 -0
- package/dist/external-sync/providers/notion/index.js.map +1 -0
- package/dist/external-sync/providers/notion/notion-api.d.ts +253 -0
- package/dist/external-sync/providers/notion/notion-api.d.ts.map +1 -0
- package/dist/external-sync/providers/notion/notion-api.js +492 -0
- package/dist/external-sync/providers/notion/notion-api.js.map +1 -0
- package/dist/external-sync/providers/notion/notion-blocks.d.ts +93 -0
- package/dist/external-sync/providers/notion/notion-blocks.d.ts.map +1 -0
- package/dist/external-sync/providers/notion/notion-blocks.js +773 -0
- package/dist/external-sync/providers/notion/notion-blocks.js.map +1 -0
- package/dist/external-sync/providers/notion/notion-document-adapter.d.ts +176 -0
- package/dist/external-sync/providers/notion/notion-document-adapter.d.ts.map +1 -0
- package/dist/external-sync/providers/notion/notion-document-adapter.js +413 -0
- package/dist/external-sync/providers/notion/notion-document-adapter.js.map +1 -0
- package/dist/external-sync/providers/notion/notion-provider.d.ts +57 -0
- package/dist/external-sync/providers/notion/notion-provider.d.ts.map +1 -0
- package/dist/external-sync/providers/notion/notion-provider.js +159 -0
- package/dist/external-sync/providers/notion/notion-provider.js.map +1 -0
- package/dist/external-sync/providers/notion/notion-types.d.ts +388 -0
- package/dist/external-sync/providers/notion/notion-types.d.ts.map +1 -0
- package/dist/external-sync/providers/notion/notion-types.js +47 -0
- package/dist/external-sync/providers/notion/notion-types.js.map +1 -0
- package/dist/external-sync/sync-engine.d.ts +364 -0
- package/dist/external-sync/sync-engine.d.ts.map +1 -0
- package/dist/external-sync/sync-engine.js +1154 -0
- package/dist/external-sync/sync-engine.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/server/index.js +8 -8
- package/dist/server/index.js.map +1 -1
- package/dist/services/inbox.js +1 -1
- package/dist/sync/hash.d.ts +5 -0
- package/dist/sync/hash.d.ts.map +1 -1
- package/dist/sync/hash.js +21 -2
- package/dist/sync/hash.js.map +1 -1
- package/package.json +10 -12
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion External Provider
|
|
3
|
+
*
|
|
4
|
+
* Implements the ExternalProvider interface for Notion.
|
|
5
|
+
* Handles connection testing via the Notion API and provides a
|
|
6
|
+
* DocumentSyncAdapter for bidirectional page synchronization.
|
|
7
|
+
*
|
|
8
|
+
* The provider uses a NotionApiClient for all API interactions.
|
|
9
|
+
* Connection testing calls GET /users/me to verify the token.
|
|
10
|
+
*
|
|
11
|
+
* Configuration:
|
|
12
|
+
* - Token: set via `sf external-sync config set-token notion ntn_xxxxx`
|
|
13
|
+
* - Project (database ID): set via `sf external-sync config set-project notion <database-id>`
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const provider = createNotionProvider({ token: 'ntn_...' });
|
|
18
|
+
* const registry = createProviderRegistry();
|
|
19
|
+
* registry.register(provider);
|
|
20
|
+
*
|
|
21
|
+
* // Test connection
|
|
22
|
+
* const connected = await provider.testConnection({ provider: 'notion', token: 'ntn_...' });
|
|
23
|
+
*
|
|
24
|
+
* // Get document adapter
|
|
25
|
+
* const adapter = provider.getDocumentAdapter();
|
|
26
|
+
* const page = await adapter.getPage('database-id', 'page-id');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
import type { ExternalProvider } from '@stoneforge/core';
|
|
30
|
+
/**
|
|
31
|
+
* Options for creating a Notion provider.
|
|
32
|
+
*/
|
|
33
|
+
export interface CreateNotionProviderOptions {
|
|
34
|
+
/** Notion integration token */
|
|
35
|
+
token: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a configured Notion provider.
|
|
39
|
+
*
|
|
40
|
+
* The provider is fully configured with the given token and ready
|
|
41
|
+
* for registration in the provider registry.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Configuration including the integration token
|
|
44
|
+
* @returns A configured Notion ExternalProvider
|
|
45
|
+
*/
|
|
46
|
+
export declare function createNotionProvider(options: CreateNotionProviderOptions): ExternalProvider;
|
|
47
|
+
/**
|
|
48
|
+
* Create a placeholder Notion provider for registry registration.
|
|
49
|
+
*
|
|
50
|
+
* Similar to the GitHub and Linear placeholders — registers the provider
|
|
51
|
+
* shape so the registry knows Notion is available. Connection testing
|
|
52
|
+
* always returns false. All adapter methods throw descriptive errors.
|
|
53
|
+
*
|
|
54
|
+
* @returns A placeholder Notion ExternalProvider
|
|
55
|
+
*/
|
|
56
|
+
export declare function createNotionPlaceholderProvider(): ExternalProvider;
|
|
57
|
+
//# sourceMappingURL=notion-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-provider.d.ts","sourceRoot":"","sources":["../../../../src/external-sync/providers/notion/notion-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAMjB,MAAM,kBAAkB,CAAC;AA4I1B;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,gBAAgB,CAGlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,IAAI,gBAAgB,CAElE"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion External Provider
|
|
3
|
+
*
|
|
4
|
+
* Implements the ExternalProvider interface for Notion.
|
|
5
|
+
* Handles connection testing via the Notion API and provides a
|
|
6
|
+
* DocumentSyncAdapter for bidirectional page synchronization.
|
|
7
|
+
*
|
|
8
|
+
* The provider uses a NotionApiClient for all API interactions.
|
|
9
|
+
* Connection testing calls GET /users/me to verify the token.
|
|
10
|
+
*
|
|
11
|
+
* Configuration:
|
|
12
|
+
* - Token: set via `sf external-sync config set-token notion ntn_xxxxx`
|
|
13
|
+
* - Project (database ID): set via `sf external-sync config set-project notion <database-id>`
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const provider = createNotionProvider({ token: 'ntn_...' });
|
|
18
|
+
* const registry = createProviderRegistry();
|
|
19
|
+
* registry.register(provider);
|
|
20
|
+
*
|
|
21
|
+
* // Test connection
|
|
22
|
+
* const connected = await provider.testConnection({ provider: 'notion', token: 'ntn_...' });
|
|
23
|
+
*
|
|
24
|
+
* // Get document adapter
|
|
25
|
+
* const adapter = provider.getDocumentAdapter();
|
|
26
|
+
* const page = await adapter.getPage('database-id', 'page-id');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
import { NotionApiClient } from './notion-api.js';
|
|
30
|
+
import { NotionDocumentAdapter } from './notion-document-adapter.js';
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// Constants
|
|
33
|
+
// ============================================================================
|
|
34
|
+
/** Notion API base URL for connection testing */
|
|
35
|
+
const NOTION_API_BASE = 'https://api.notion.com/v1';
|
|
36
|
+
/** Default Notion API version header */
|
|
37
|
+
const DEFAULT_NOTION_VERSION = '2022-06-28';
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// NotionProvider
|
|
40
|
+
// ============================================================================
|
|
41
|
+
/**
|
|
42
|
+
* ExternalProvider implementation for Notion.
|
|
43
|
+
*
|
|
44
|
+
* Supports document sync only. Connection testing calls GET /users/me
|
|
45
|
+
* to verify the integration token is valid.
|
|
46
|
+
*/
|
|
47
|
+
class NotionProvider {
|
|
48
|
+
name = 'notion';
|
|
49
|
+
displayName = 'Notion';
|
|
50
|
+
supportedAdapters = ['document'];
|
|
51
|
+
documentAdapter;
|
|
52
|
+
constructor(api) {
|
|
53
|
+
this.documentAdapter = new NotionDocumentAdapter(api);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Test whether the Notion connection is valid.
|
|
57
|
+
*
|
|
58
|
+
* Calls GET /users/me to verify the integration token has valid
|
|
59
|
+
* permissions. Uses a raw fetch call (like the GitHub provider)
|
|
60
|
+
* since the API client doesn't expose a user endpoint.
|
|
61
|
+
*
|
|
62
|
+
* @param config - Provider configuration with token to test
|
|
63
|
+
* @returns true if the connection is valid, false otherwise
|
|
64
|
+
*/
|
|
65
|
+
async testConnection(config) {
|
|
66
|
+
if (!config.token) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
const response = await fetch(`${NOTION_API_BASE}/users/me`, {
|
|
71
|
+
method: 'GET',
|
|
72
|
+
headers: {
|
|
73
|
+
Authorization: `Bearer ${config.token}`,
|
|
74
|
+
'Notion-Version': DEFAULT_NOTION_VERSION,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
return response.ok;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Network errors, DNS failures, etc.
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Returns the Notion document sync adapter.
|
|
86
|
+
*
|
|
87
|
+
* @returns NotionDocumentAdapter for Notion page sync
|
|
88
|
+
*/
|
|
89
|
+
getDocumentAdapter() {
|
|
90
|
+
return this.documentAdapter;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// ============================================================================
|
|
94
|
+
// Placeholder Provider
|
|
95
|
+
// ============================================================================
|
|
96
|
+
const PLACEHOLDER_MESSAGE = 'Notion document sync adapter is not configured. Set a token via `sf external-sync config set-token notion <token>` to enable sync.';
|
|
97
|
+
/**
|
|
98
|
+
* Placeholder DocumentSyncAdapter for Notion.
|
|
99
|
+
* All methods throw to indicate they are not yet configured.
|
|
100
|
+
*/
|
|
101
|
+
class NotionPlaceholderDocumentAdapter {
|
|
102
|
+
async getPage(_project, _externalId) {
|
|
103
|
+
throw new Error(PLACEHOLDER_MESSAGE);
|
|
104
|
+
}
|
|
105
|
+
async listPagesSince(_project, _since) {
|
|
106
|
+
throw new Error(PLACEHOLDER_MESSAGE);
|
|
107
|
+
}
|
|
108
|
+
async createPage(_project, _page) {
|
|
109
|
+
throw new Error(PLACEHOLDER_MESSAGE);
|
|
110
|
+
}
|
|
111
|
+
async updatePage(_project, _externalId, _updates) {
|
|
112
|
+
throw new Error(PLACEHOLDER_MESSAGE);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Placeholder Notion ExternalProvider.
|
|
117
|
+
*
|
|
118
|
+
* Declares Notion as a known provider that supports document sync.
|
|
119
|
+
* Connection testing always returns false (not configured).
|
|
120
|
+
* The actual provider is created with createNotionProvider() when configured.
|
|
121
|
+
*/
|
|
122
|
+
class NotionPlaceholderProvider {
|
|
123
|
+
name = 'notion';
|
|
124
|
+
displayName = 'Notion';
|
|
125
|
+
supportedAdapters = ['document'];
|
|
126
|
+
documentAdapter = new NotionPlaceholderDocumentAdapter();
|
|
127
|
+
async testConnection(_config) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
getDocumentAdapter() {
|
|
131
|
+
return this.documentAdapter;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Create a configured Notion provider.
|
|
136
|
+
*
|
|
137
|
+
* The provider is fully configured with the given token and ready
|
|
138
|
+
* for registration in the provider registry.
|
|
139
|
+
*
|
|
140
|
+
* @param options - Configuration including the integration token
|
|
141
|
+
* @returns A configured Notion ExternalProvider
|
|
142
|
+
*/
|
|
143
|
+
export function createNotionProvider(options) {
|
|
144
|
+
const api = new NotionApiClient({ token: options.token });
|
|
145
|
+
return new NotionProvider(api);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Create a placeholder Notion provider for registry registration.
|
|
149
|
+
*
|
|
150
|
+
* Similar to the GitHub and Linear placeholders — registers the provider
|
|
151
|
+
* shape so the registry knows Notion is available. Connection testing
|
|
152
|
+
* always returns false. All adapter methods throw descriptive errors.
|
|
153
|
+
*
|
|
154
|
+
* @returns A placeholder Notion ExternalProvider
|
|
155
|
+
*/
|
|
156
|
+
export function createNotionPlaceholderProvider() {
|
|
157
|
+
return new NotionPlaceholderProvider();
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=notion-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-provider.js","sourceRoot":"","sources":["../../../../src/external-sync/providers/notion/notion-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAWH,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,iDAAiD;AACjD,MAAM,eAAe,GAAG,2BAA2B,CAAC;AAEpD,wCAAwC;AACxC,MAAM,sBAAsB,GAAG,YAAY,CAAC;AAE5C,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;;;GAKG;AACH,MAAM,cAAc;IACT,IAAI,GAAG,QAAQ,CAAC;IAChB,WAAW,GAAG,QAAQ,CAAC;IACvB,iBAAiB,GAA+B,CAAC,UAAU,CAAC,CAAC;IAErD,eAAe,CAAwB;IAExD,YAAY,GAAoB;QAC9B,IAAI,CAAC,eAAe,GAAG,IAAI,qBAAqB,CAAC,GAAG,CAAC,CA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QAAQ,CAAC;IAChB,WAAW,GAAG,QAAQ,CAAC;IACvB,iBAAiB,GAA+B,CAAC,UAAU,CAAC,CAAC;IAErD,eAAe,GAAG,IAAI,gCAAgC,EAAE,CAAC;IAE1E,KAAK,CAAC,cAAc,CAAC,OAAuB;QAC1C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF;AAcD;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAoC;IAEpC,MAAM,GAAG,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1D,OAAO,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC;AACjC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,+BAA+B;IAC7C,OAAO,IAAI,yBAAyB,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion API Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Notion's REST API responses and block/rich-text objects.
|
|
5
|
+
* These types represent the subset of Notion's schema used by the document sync
|
|
6
|
+
* provider and the blocks ↔ markdown converter.
|
|
7
|
+
*
|
|
8
|
+
* Only fields needed for document synchronization are included — this is not a
|
|
9
|
+
* comprehensive representation of the full Notion API.
|
|
10
|
+
*
|
|
11
|
+
* @see https://developers.notion.com/reference
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Rich text annotations (formatting) applied to a text span.
|
|
15
|
+
*/
|
|
16
|
+
export interface NotionAnnotations {
|
|
17
|
+
readonly bold: boolean;
|
|
18
|
+
readonly italic: boolean;
|
|
19
|
+
readonly strikethrough: boolean;
|
|
20
|
+
readonly underline: boolean;
|
|
21
|
+
readonly code: boolean;
|
|
22
|
+
readonly color: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Default annotations — no formatting applied.
|
|
26
|
+
*/
|
|
27
|
+
export declare const DEFAULT_ANNOTATIONS: NotionAnnotations;
|
|
28
|
+
/**
|
|
29
|
+
* Notion rich text object — the atomic unit of formatted text.
|
|
30
|
+
*
|
|
31
|
+
* Rich text can be of type "text", "mention", or "equation".
|
|
32
|
+
* We only model "text" in detail since that's what we produce during sync.
|
|
33
|
+
*/
|
|
34
|
+
export interface NotionRichText {
|
|
35
|
+
/** The type of rich text object */
|
|
36
|
+
readonly type: 'text' | 'mention' | 'equation';
|
|
37
|
+
/** Plain text content without formatting */
|
|
38
|
+
readonly plain_text: string;
|
|
39
|
+
/** Text-specific content (present when type === 'text') */
|
|
40
|
+
readonly text?: {
|
|
41
|
+
/** The text content */
|
|
42
|
+
readonly content: string;
|
|
43
|
+
/** Optional link */
|
|
44
|
+
readonly link: {
|
|
45
|
+
readonly url: string;
|
|
46
|
+
} | null;
|
|
47
|
+
};
|
|
48
|
+
/** Inline formatting annotations */
|
|
49
|
+
readonly annotations: NotionAnnotations;
|
|
50
|
+
/** Optional URL for the rich text (e.g. links) */
|
|
51
|
+
readonly href: string | null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Notion page property value.
|
|
55
|
+
*
|
|
56
|
+
* Properties are typed fields on a page. Each property has a type discriminator
|
|
57
|
+
* and corresponding value field. We model the subset needed for document sync.
|
|
58
|
+
*/
|
|
59
|
+
export interface NotionProperty {
|
|
60
|
+
/** Unique property ID */
|
|
61
|
+
readonly id: string;
|
|
62
|
+
/** Property type discriminator */
|
|
63
|
+
readonly type: string;
|
|
64
|
+
/** Title property value (array of rich text) */
|
|
65
|
+
readonly title?: readonly NotionRichText[];
|
|
66
|
+
/** Rich text property value */
|
|
67
|
+
readonly rich_text?: readonly NotionRichText[];
|
|
68
|
+
/** Select property value */
|
|
69
|
+
readonly select?: {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly color: string;
|
|
73
|
+
} | null;
|
|
74
|
+
/** Multi-select property value */
|
|
75
|
+
readonly multi_select?: readonly {
|
|
76
|
+
readonly id: string;
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly color: string;
|
|
79
|
+
}[];
|
|
80
|
+
/** Checkbox property value */
|
|
81
|
+
readonly checkbox?: boolean;
|
|
82
|
+
/** URL property value */
|
|
83
|
+
readonly url?: string | null;
|
|
84
|
+
/** Date property value */
|
|
85
|
+
readonly date?: {
|
|
86
|
+
readonly start: string;
|
|
87
|
+
readonly end: string | null;
|
|
88
|
+
} | null;
|
|
89
|
+
/** Number property value */
|
|
90
|
+
readonly number?: number | null;
|
|
91
|
+
/** Last edited time property value (ISO 8601) */
|
|
92
|
+
readonly last_edited_time?: string;
|
|
93
|
+
/** Created time property value (ISO 8601) */
|
|
94
|
+
readonly created_time?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Notion block object — the content building block of a page.
|
|
98
|
+
*
|
|
99
|
+
* Every block has a type discriminator and a corresponding type-specific object.
|
|
100
|
+
* We model the most common block types used in document content.
|
|
101
|
+
*
|
|
102
|
+
* Metadata fields (id, has_children, etc.) are optional because they are present
|
|
103
|
+
* on blocks read from the API but absent on blocks created locally (e.g. by the
|
|
104
|
+
* markdown → Notion converter).
|
|
105
|
+
*/
|
|
106
|
+
export interface NotionBlock {
|
|
107
|
+
/** Unique block ID (UUID) — present on API responses */
|
|
108
|
+
readonly id?: string;
|
|
109
|
+
/** Block type discriminator */
|
|
110
|
+
readonly type: string;
|
|
111
|
+
/** Whether this block has nested children — present on API responses */
|
|
112
|
+
readonly has_children?: boolean;
|
|
113
|
+
/** Creation timestamp (ISO 8601) — present on API responses */
|
|
114
|
+
readonly created_time?: string;
|
|
115
|
+
/** Last edit timestamp (ISO 8601) — present on API responses */
|
|
116
|
+
readonly last_edited_time?: string;
|
|
117
|
+
/** Whether this block has been archived (deleted) — present on API responses */
|
|
118
|
+
readonly archived?: boolean;
|
|
119
|
+
readonly paragraph?: {
|
|
120
|
+
readonly rich_text: readonly NotionRichText[];
|
|
121
|
+
readonly color?: string;
|
|
122
|
+
};
|
|
123
|
+
readonly heading_1?: {
|
|
124
|
+
readonly rich_text: readonly NotionRichText[];
|
|
125
|
+
readonly color?: string;
|
|
126
|
+
readonly is_toggleable?: boolean;
|
|
127
|
+
};
|
|
128
|
+
readonly heading_2?: {
|
|
129
|
+
readonly rich_text: readonly NotionRichText[];
|
|
130
|
+
readonly color?: string;
|
|
131
|
+
readonly is_toggleable?: boolean;
|
|
132
|
+
};
|
|
133
|
+
readonly heading_3?: {
|
|
134
|
+
readonly rich_text: readonly NotionRichText[];
|
|
135
|
+
readonly color?: string;
|
|
136
|
+
readonly is_toggleable?: boolean;
|
|
137
|
+
};
|
|
138
|
+
readonly bulleted_list_item?: {
|
|
139
|
+
readonly rich_text: readonly NotionRichText[];
|
|
140
|
+
readonly color?: string;
|
|
141
|
+
};
|
|
142
|
+
readonly numbered_list_item?: {
|
|
143
|
+
readonly rich_text: readonly NotionRichText[];
|
|
144
|
+
readonly color?: string;
|
|
145
|
+
};
|
|
146
|
+
readonly to_do?: {
|
|
147
|
+
readonly rich_text: readonly NotionRichText[];
|
|
148
|
+
readonly checked: boolean;
|
|
149
|
+
readonly color?: string;
|
|
150
|
+
};
|
|
151
|
+
readonly toggle?: {
|
|
152
|
+
readonly rich_text: readonly NotionRichText[];
|
|
153
|
+
};
|
|
154
|
+
readonly code?: {
|
|
155
|
+
readonly rich_text: readonly NotionRichText[];
|
|
156
|
+
readonly caption?: readonly NotionRichText[];
|
|
157
|
+
readonly language: string;
|
|
158
|
+
};
|
|
159
|
+
readonly quote?: {
|
|
160
|
+
readonly rich_text: readonly NotionRichText[];
|
|
161
|
+
readonly color?: string;
|
|
162
|
+
};
|
|
163
|
+
readonly callout?: {
|
|
164
|
+
readonly rich_text: readonly NotionRichText[];
|
|
165
|
+
readonly icon?: unknown;
|
|
166
|
+
};
|
|
167
|
+
readonly divider?: Record<string, never>;
|
|
168
|
+
readonly table_of_contents?: Record<string, never>;
|
|
169
|
+
readonly child_page?: {
|
|
170
|
+
readonly title: string;
|
|
171
|
+
};
|
|
172
|
+
readonly child_database?: {
|
|
173
|
+
readonly title: string;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Block types that we support for markdown ↔ Notion conversion.
|
|
178
|
+
*/
|
|
179
|
+
export declare const SUPPORTED_BLOCK_TYPES: readonly ["paragraph", "heading_1", "heading_2", "heading_3", "bulleted_list_item", "numbered_list_item", "code", "quote", "to_do"];
|
|
180
|
+
export type SupportedBlockType = (typeof SUPPORTED_BLOCK_TYPES)[number];
|
|
181
|
+
/**
|
|
182
|
+
* Check if a block type is supported for conversion.
|
|
183
|
+
*/
|
|
184
|
+
export declare function isSupportedBlockType(type: string): type is SupportedBlockType;
|
|
185
|
+
/**
|
|
186
|
+
* Notion page object.
|
|
187
|
+
*
|
|
188
|
+
* Pages are the primary content container in Notion. Each page has properties
|
|
189
|
+
* (metadata fields) and block children (the page content).
|
|
190
|
+
*/
|
|
191
|
+
export interface NotionPage {
|
|
192
|
+
/** Unique page ID (UUID) */
|
|
193
|
+
readonly id: string;
|
|
194
|
+
/** Object type (always "page") */
|
|
195
|
+
readonly object: 'page';
|
|
196
|
+
/** Creation timestamp (ISO 8601) */
|
|
197
|
+
readonly created_time: string;
|
|
198
|
+
/** Last edit timestamp (ISO 8601) */
|
|
199
|
+
readonly last_edited_time: string;
|
|
200
|
+
/** Whether the page has been archived (moved to trash) */
|
|
201
|
+
readonly archived: boolean;
|
|
202
|
+
/** URL to view the page in Notion */
|
|
203
|
+
readonly url: string;
|
|
204
|
+
/** Public URL if the page is published (null otherwise) */
|
|
205
|
+
readonly public_url: string | null;
|
|
206
|
+
/** Page properties keyed by property name */
|
|
207
|
+
readonly properties: Record<string, NotionProperty>;
|
|
208
|
+
/** Parent reference */
|
|
209
|
+
readonly parent: {
|
|
210
|
+
readonly type: 'database_id';
|
|
211
|
+
readonly database_id: string;
|
|
212
|
+
} | {
|
|
213
|
+
readonly type: 'page_id';
|
|
214
|
+
readonly page_id: string;
|
|
215
|
+
} | {
|
|
216
|
+
readonly type: 'workspace';
|
|
217
|
+
readonly workspace: true;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Response from querying a Notion database (POST /databases/{id}/query).
|
|
222
|
+
*
|
|
223
|
+
* Uses cursor-based pagination with `has_more` / `next_cursor`.
|
|
224
|
+
*/
|
|
225
|
+
export interface NotionDatabaseQueryResponse {
|
|
226
|
+
/** Object type (always "list") */
|
|
227
|
+
readonly object: 'list';
|
|
228
|
+
/** Array of page objects matching the query */
|
|
229
|
+
readonly results: readonly NotionPage[];
|
|
230
|
+
/** Whether there are more results beyond this page */
|
|
231
|
+
readonly has_more: boolean;
|
|
232
|
+
/** Cursor for the next page of results (null if no more) */
|
|
233
|
+
readonly next_cursor: string | null;
|
|
234
|
+
/** Type of items in the results */
|
|
235
|
+
readonly type: 'page_or_database';
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Paginated response for block children (GET /blocks/{id}/children).
|
|
239
|
+
*/
|
|
240
|
+
export interface NotionBlockChildrenResponse {
|
|
241
|
+
/** Object type (always "list") */
|
|
242
|
+
readonly object: 'list';
|
|
243
|
+
/** Array of block objects */
|
|
244
|
+
readonly results: readonly NotionBlock[];
|
|
245
|
+
/** Whether there are more results beyond this page */
|
|
246
|
+
readonly has_more: boolean;
|
|
247
|
+
/** Cursor for the next page of results (null if no more) */
|
|
248
|
+
readonly next_cursor: string | null;
|
|
249
|
+
/** Type of items in the results */
|
|
250
|
+
readonly type: 'block';
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Input for creating a new block.
|
|
254
|
+
*
|
|
255
|
+
* When creating blocks, we provide the type and corresponding content object.
|
|
256
|
+
* This is a simplified version — only the block types we produce are included.
|
|
257
|
+
*/
|
|
258
|
+
export interface NotionBlockInput {
|
|
259
|
+
/** Block type */
|
|
260
|
+
readonly type: string;
|
|
261
|
+
/** Object key matching the type (e.g., 'paragraph', 'heading_1', etc.) */
|
|
262
|
+
readonly [key: string]: unknown;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Input for creating a page in a database.
|
|
266
|
+
*/
|
|
267
|
+
export interface NotionCreatePageInput {
|
|
268
|
+
/** Parent database or page reference */
|
|
269
|
+
readonly parent: {
|
|
270
|
+
readonly database_id: string;
|
|
271
|
+
} | {
|
|
272
|
+
readonly page_id: string;
|
|
273
|
+
};
|
|
274
|
+
/** Page properties */
|
|
275
|
+
readonly properties: Record<string, unknown>;
|
|
276
|
+
/** Optional block children (page content) */
|
|
277
|
+
readonly children?: readonly NotionBlockInput[];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Input for updating page properties.
|
|
281
|
+
*/
|
|
282
|
+
export interface NotionUpdatePageInput {
|
|
283
|
+
/** Properties to update */
|
|
284
|
+
readonly properties?: Record<string, unknown>;
|
|
285
|
+
/** Whether to archive (trash) the page */
|
|
286
|
+
readonly archived?: boolean;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Schema definition for a database property.
|
|
290
|
+
*
|
|
291
|
+
* This represents the database-level schema (from GET /databases/{id}),
|
|
292
|
+
* not the page-level property values. Each property has a type and
|
|
293
|
+
* type-specific configuration (e.g., select options, formula expression).
|
|
294
|
+
*/
|
|
295
|
+
export interface NotionDatabaseProperty {
|
|
296
|
+
/** Unique property ID */
|
|
297
|
+
readonly id: string;
|
|
298
|
+
/** Property type (e.g., 'title', 'select', 'multi_select', 'rich_text') */
|
|
299
|
+
readonly type: string;
|
|
300
|
+
/** Property name */
|
|
301
|
+
readonly name: string;
|
|
302
|
+
/** Select options (present when type === 'select') */
|
|
303
|
+
readonly select?: {
|
|
304
|
+
readonly options: readonly {
|
|
305
|
+
readonly id: string;
|
|
306
|
+
readonly name: string;
|
|
307
|
+
readonly color: string;
|
|
308
|
+
}[];
|
|
309
|
+
};
|
|
310
|
+
/** Multi-select options (present when type === 'multi_select') */
|
|
311
|
+
readonly multi_select?: {
|
|
312
|
+
readonly options: readonly {
|
|
313
|
+
readonly id: string;
|
|
314
|
+
readonly name: string;
|
|
315
|
+
readonly color: string;
|
|
316
|
+
}[];
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Notion database object.
|
|
321
|
+
*
|
|
322
|
+
* Represents a database schema retrieved via GET /databases/{id}.
|
|
323
|
+
* Contains the database properties (schema definitions) which describe
|
|
324
|
+
* the structure of pages within the database.
|
|
325
|
+
*
|
|
326
|
+
* @see https://developers.notion.com/reference/retrieve-a-database
|
|
327
|
+
*/
|
|
328
|
+
export interface NotionDatabase {
|
|
329
|
+
/** Unique database ID (UUID) */
|
|
330
|
+
readonly id: string;
|
|
331
|
+
/** Object type (always "database") */
|
|
332
|
+
readonly object: 'database';
|
|
333
|
+
/** Creation timestamp (ISO 8601) */
|
|
334
|
+
readonly created_time: string;
|
|
335
|
+
/** Last edit timestamp (ISO 8601) */
|
|
336
|
+
readonly last_edited_time: string;
|
|
337
|
+
/** Database title */
|
|
338
|
+
readonly title: readonly NotionRichText[];
|
|
339
|
+
/** Database properties schema, keyed by property name */
|
|
340
|
+
readonly properties: Record<string, NotionDatabaseProperty>;
|
|
341
|
+
/** Whether the database has been archived */
|
|
342
|
+
readonly archived: boolean;
|
|
343
|
+
/** URL to view the database in Notion */
|
|
344
|
+
readonly url: string;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Input for updating a database schema.
|
|
348
|
+
*
|
|
349
|
+
* Used with PATCH /databases/{id} to add or modify properties.
|
|
350
|
+
*
|
|
351
|
+
* @see https://developers.notion.com/reference/update-a-database
|
|
352
|
+
*/
|
|
353
|
+
export interface NotionUpdateDatabaseInput {
|
|
354
|
+
/** Properties to add or update in the database schema */
|
|
355
|
+
readonly properties?: Record<string, unknown>;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Cached database schema information used by the document adapter.
|
|
359
|
+
*
|
|
360
|
+
* Contains the discovered property names for title, category, and tags,
|
|
361
|
+
* so the adapter doesn't need to query the database schema on every operation.
|
|
362
|
+
*/
|
|
363
|
+
export interface NotionDatabaseSchema {
|
|
364
|
+
/** The name of the title property (every database has exactly one) */
|
|
365
|
+
readonly titlePropertyName: string;
|
|
366
|
+
/** Whether a 'Category' select property exists in the database */
|
|
367
|
+
readonly hasCategoryProperty: boolean;
|
|
368
|
+
/** Whether a 'Tags' multi_select property exists in the database */
|
|
369
|
+
readonly hasTagsProperty: boolean;
|
|
370
|
+
/** Whether a 'Library' select property exists in the database */
|
|
371
|
+
readonly hasLibraryProperty: boolean;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Notion API error response body.
|
|
375
|
+
*
|
|
376
|
+
* @see https://developers.notion.com/reference/errors
|
|
377
|
+
*/
|
|
378
|
+
export interface NotionErrorResponse {
|
|
379
|
+
/** Object type (always "error") */
|
|
380
|
+
readonly object: 'error';
|
|
381
|
+
/** HTTP status code */
|
|
382
|
+
readonly status: number;
|
|
383
|
+
/** Notion-specific error code (e.g., "validation_error", "object_not_found") */
|
|
384
|
+
readonly code: string;
|
|
385
|
+
/** Human-readable error message */
|
|
386
|
+
readonly message: string;
|
|
387
|
+
}
|
|
388
|
+
//# sourceMappingURL=notion-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-types.d.ts","sourceRoot":"","sources":["../../../../src/external-sync/providers/notion/notion-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,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AAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/C;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,kEAAkE;IAClE,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC;IACtC,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;CACtC;AAMD;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,uBAAuB;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion API Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for Notion's REST API responses and block/rich-text objects.
|
|
5
|
+
* These types represent the subset of Notion's schema used by the document sync
|
|
6
|
+
* provider and the blocks ↔ markdown converter.
|
|
7
|
+
*
|
|
8
|
+
* Only fields needed for document synchronization are included — this is not a
|
|
9
|
+
* comprehensive representation of the full Notion API.
|
|
10
|
+
*
|
|
11
|
+
* @see https://developers.notion.com/reference
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Default annotations — no formatting applied.
|
|
15
|
+
*/
|
|
16
|
+
export const DEFAULT_ANNOTATIONS = {
|
|
17
|
+
bold: false,
|
|
18
|
+
italic: false,
|
|
19
|
+
strikethrough: false,
|
|
20
|
+
underline: false,
|
|
21
|
+
code: false,
|
|
22
|
+
color: 'default',
|
|
23
|
+
};
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Supported Block Type Constants
|
|
26
|
+
// ============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Block types that we support for markdown ↔ Notion conversion.
|
|
29
|
+
*/
|
|
30
|
+
export const SUPPORTED_BLOCK_TYPES = [
|
|
31
|
+
'paragraph',
|
|
32
|
+
'heading_1',
|
|
33
|
+
'heading_2',
|
|
34
|
+
'heading_3',
|
|
35
|
+
'bulleted_list_item',
|
|
36
|
+
'numbered_list_item',
|
|
37
|
+
'code',
|
|
38
|
+
'quote',
|
|
39
|
+
'to_do',
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* Check if a block type is supported for conversion.
|
|
43
|
+
*/
|
|
44
|
+
export function isSupportedBlockType(type) {
|
|
45
|
+
return SUPPORTED_BLOCK_TYPES.includes(type);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=notion-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notion-types.js","sourceRoot":"","sources":["../../../../src/external-sync/providers/notion/notion-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkBH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACpD,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,aAAa,EAAE,KAAK;IACpB,SAAS,EAAE,KAAK;IAChB,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,SAAS;CACjB,CAAC;AA6GF,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAAW;IACX,oBAAoB;IACpB,oBAAoB;IACpB,MAAM;IACN,OAAO;IACP,OAAO;CACC,CAAC;AAIX;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,OAAQ,qBAA2C,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AACrE,CAAC"}
|