@notionhq/apps 0.0.16 → 0.0.17
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 +27 -2
- package/dist/connections.d.ts +39 -11
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +85 -21
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/notion-as-code/database.d.ts +3 -2
- package/dist/notion-as-code/database.d.ts.map +1 -1
- package/dist/notion-as-code/handles.d.ts +2 -0
- package/dist/notion-as-code/handles.d.ts.map +1 -1
- package/dist/notion-as-code/handles.js +2 -0
- package/dist/notion-as-code/index.d.ts +3 -0
- package/dist/notion-as-code/index.d.ts.map +1 -1
- package/dist/notion-as-code/intents.d.ts +2 -1
- package/dist/notion-as-code/intents.d.ts.map +1 -1
- package/dist/notion-as-code/view.d.ts +12 -0
- package/dist/notion-as-code/view.d.ts.map +1 -0
- package/dist/notion-as-code/view.js +13 -0
- package/dist/notion-as-code/views-types.test.d.ts +2 -0
- package/dist/notion-as-code/views-types.test.d.ts.map +1 -0
- package/dist/notion-as-code/views.d.ts +469 -0
- package/dist/notion-as-code/views.d.ts.map +1 -0
- package/dist/notion-as-code/views.js +0 -0
- package/dist/oauth.d.ts +11 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +26 -0
- package/dist/providers.generated.d.ts +26 -86
- package/dist/providers.generated.d.ts.map +1 -1
- package/dist/providers.generated.js +54 -66
- package/dist/triggers.generated.d.ts +3 -3
- package/dist/triggers.generated.d.ts.map +1 -1
- package/dist/workflow.d.ts +8 -8
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +12 -6
- package/docs/CONNECTIONS.md +70 -22
- package/package.json +1 -1
- package/skills/connections/SKILL.md +7 -8
- package/skills/notion-as-code/SKILL.md +8 -2
- package/src/connections.test.ts +205 -41
- package/src/connections.ts +144 -38
- package/src/index.ts +1 -0
- package/src/notion-as-code/database.ts +3 -3
- package/src/notion-as-code/handles.ts +2 -0
- package/src/notion-as-code/index.ts +55 -0
- package/src/notion-as-code/intents.ts +2 -2
- package/src/notion-as-code/view.ts +23 -0
- package/src/notion-as-code/views-types.test.ts +59 -0
- package/src/notion-as-code/views.ts +554 -0
- package/src/oauth.ts +40 -0
- package/src/providers.generated.ts +68 -163
- package/src/triggers.generated.ts +4 -4
- package/src/workflow-connections-types.test.ts +16 -10
- package/src/workflow-types.test.ts +88 -16
- package/src/workflow.test.ts +45 -17
- package/src/workflow.ts +31 -17
package/README.md
CHANGED
|
@@ -95,12 +95,12 @@ export default workflow({
|
|
|
95
95
|
name: "Schedule follow-up",
|
|
96
96
|
description: "Schedules a follow-up after a page is created",
|
|
97
97
|
triggers: [triggers.notionPageCreated()],
|
|
98
|
-
connections:
|
|
98
|
+
connections: { calendar: connections.calendar() },
|
|
99
99
|
handler: async () => {},
|
|
100
100
|
});
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
The property name is the connection key. Access its typed client with `context.connections.calendar`; use separate keys for separate connections to the same provider.
|
|
104
104
|
|
|
105
105
|
## Notion API access
|
|
106
106
|
|
|
@@ -181,6 +181,31 @@ When converting an existing explicit declaration, use the shorthand only if its
|
|
|
181
181
|
source already has that ID; changing the source ID creates a different resource.
|
|
182
182
|
No top-level `properties` field is added to the database intent.
|
|
183
183
|
|
|
184
|
+
Declare database views with `views` or `addView`, or use the top-level `view`
|
|
185
|
+
function from `@notionhq/apps` (`notion.view` is also available). The standalone
|
|
186
|
+
function accepts `ViewArgs`: a `ViewSchema` plus the owning `databaseResourceId`,
|
|
187
|
+
and returns a handle with `resourceId`. Both types are exported from
|
|
188
|
+
`@notionhq/apps/notion-as-code`, with table, board, calendar, list, gallery, feed,
|
|
189
|
+
and timeline variants. View types include sorting, nested filters, grouping,
|
|
190
|
+
property visibility, and layout-specific options.
|
|
191
|
+
|
|
192
|
+
```ts
|
|
193
|
+
import { view } from "@notionhq/apps";
|
|
194
|
+
|
|
195
|
+
view({
|
|
196
|
+
databaseResourceId: issues.resourceId,
|
|
197
|
+
resourceId: "issues-table",
|
|
198
|
+
type: "table",
|
|
199
|
+
dataSourceResourceId: issues.dataSource.resourceId,
|
|
200
|
+
properties: [{ property: "issue-title", visible: true }],
|
|
201
|
+
sorts: [{ propertyId: "issue-title", direction: "ascending" }],
|
|
202
|
+
});
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Each view requires a `dataSourceResourceId`. Property references use property
|
|
206
|
+
resource IDs, not display names. Calendar views require `calendarBy`; timeline
|
|
207
|
+
views require `timelineBy`.
|
|
208
|
+
|
|
184
209
|
## Custom blocks
|
|
185
210
|
|
|
186
211
|
Declare browser blocks in `src/customBlocks/<key>.ts`:
|
package/dist/connections.d.ts
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type OAuthConfiguration } from "./oauth.js";
|
|
2
|
+
import { type ConnectionClients } from "./providers.generated.js";
|
|
3
|
+
/** A setup requirement. The property name in a workflow supplies its key. */
|
|
4
|
+
export type WorkflowConnection<TProvider extends string = string> = {
|
|
4
5
|
type: TProvider;
|
|
5
|
-
|
|
6
|
+
oauth?: OAuthConfiguration;
|
|
6
7
|
};
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export type WorkflowConnectionDeclarations = Readonly<Record<string, WorkflowConnection>>;
|
|
9
|
+
/** Serialized connection requirement sent in the workflow manifest. */
|
|
10
|
+
export type WorkflowConnectionRequirement = WorkflowConnection & {
|
|
11
|
+
key: string;
|
|
12
|
+
};
|
|
13
|
+
/** Declared property names belonging to one provider. */
|
|
14
|
+
export type WorkflowConnectionKeys<TConnections extends WorkflowConnectionDeclarations, TProvider extends string> = Extract<{
|
|
15
|
+
[TKey in keyof TConnections]: TConnections[TKey]["type"] extends TProvider ? TKey : never;
|
|
16
|
+
}[keyof TConnections], string>;
|
|
12
17
|
/** Requirements are declarations, not credentials or permission grants. */
|
|
13
|
-
export
|
|
14
|
-
|
|
18
|
+
export declare const connections: {
|
|
19
|
+
oauth(options: OAuthConfiguration): WorkflowConnection<"oauth">;
|
|
20
|
+
calendar: () => WorkflowConnection<"calendar">;
|
|
21
|
+
slack: () => WorkflowConnection<"slack">;
|
|
22
|
+
googleDriveOauth: () => WorkflowConnection<"googleDriveOauth">;
|
|
23
|
+
discord: () => WorkflowConnection<"discord">;
|
|
24
|
+
cursor: () => WorkflowConnection<"cursor">;
|
|
25
|
+
box: () => WorkflowConnection<"box">;
|
|
26
|
+
confluence: () => WorkflowConnection<"confluence">;
|
|
27
|
+
gmail: () => WorkflowConnection<"gmail">;
|
|
28
|
+
googleCalendar: () => WorkflowConnection<"googleCalendar">;
|
|
29
|
+
googleDrive: () => WorkflowConnection<"googleDrive">;
|
|
30
|
+
outlook: () => WorkflowConnection<"outlook">;
|
|
31
|
+
salesforce: () => WorkflowConnection<"salesforce">;
|
|
32
|
+
};
|
|
33
|
+
export type { OAuthConfiguration } from "./oauth.js";
|
|
34
|
+
export type OAuthConnection = {
|
|
35
|
+
accessToken(): Promise<string>;
|
|
36
|
+
};
|
|
37
|
+
type WorkflowConnectionClients = ConnectionClients & {
|
|
38
|
+
oauth: OAuthConnection;
|
|
39
|
+
};
|
|
40
|
+
export type WorkflowConnections<TConnections extends WorkflowConnectionDeclarations = WorkflowConnectionDeclarations> = {
|
|
41
|
+
readonly [TKey in keyof TConnections]: WorkflowConnectionClients[Extract<keyof WorkflowConnectionClients, TConnections[TKey]["type"]>];
|
|
42
|
+
};
|
|
15
43
|
//# sourceMappingURL=connections.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../src/connections.ts"],"names":[],"mappings":"AAAA,OAAO,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CACvE,MAAM,yBAAyB,EAC/B,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAC1B,CAAC;CACF,CAAC"}
|
package/dist/connections.js
CHANGED
|
@@ -1,25 +1,60 @@
|
|
|
1
|
+
import { validateOAuthConfiguration } from "./oauth.js";
|
|
1
2
|
import { connectionTriggerDefinitions } from "./connection-trigger-definitions.generated.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import {
|
|
4
|
+
connections as providerConnections,
|
|
5
|
+
createConnectionClient
|
|
6
|
+
} from "./providers.generated.js";
|
|
7
|
+
const connections = {
|
|
8
|
+
...providerConnections,
|
|
9
|
+
oauth(options) {
|
|
10
|
+
validateOAuthConfiguration(options);
|
|
11
|
+
return { type: "oauth", oauth: structuredClone(options) };
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function normalizeConnectionRequirements(declarations) {
|
|
15
|
+
if (typeof declarations !== "object" || declarations === null || Array.isArray(declarations)) {
|
|
16
|
+
throw new Error("Workflow connections must be an object keyed by connection name.");
|
|
17
|
+
}
|
|
18
|
+
const prototype = Object.getPrototypeOf(declarations);
|
|
19
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
20
|
+
throw new Error("Workflow connections must contain only own connection declarations.");
|
|
21
|
+
}
|
|
22
|
+
const keys = Object.keys(declarations);
|
|
23
|
+
if (Reflect.ownKeys(declarations).length !== keys.length) {
|
|
24
|
+
throw new Error("Workflow connection keys must be enumerable strings.");
|
|
25
|
+
}
|
|
26
|
+
if (keys.length > 100) throw new Error("Workflows support at most 100 connections.");
|
|
27
|
+
return Object.entries(declarations).map(([key, requirement]) => {
|
|
28
|
+
if (!/^[a-zA-Z][a-zA-Z0-9_-]{0,127}$/.test(key) || ["__proto__", "prototype", "constructor"].includes(key)) {
|
|
11
29
|
throw new Error("Invalid workflow connection key: " + key);
|
|
12
30
|
}
|
|
13
|
-
if (
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
if (typeof requirement !== "object" || requirement === null || typeof requirement.type !== "string" || !requirement.type || !Object.hasOwn(requirement, "type")) {
|
|
32
|
+
throw new Error("A workflow connection needs a provider type.");
|
|
33
|
+
}
|
|
34
|
+
if ("key" in requirement)
|
|
35
|
+
throw new Error(
|
|
36
|
+
"Declare a connection key as its workflow object property, not in the provider options."
|
|
37
|
+
);
|
|
38
|
+
if (requirement.type === "oauth") {
|
|
39
|
+
if (!requirement.oauth)
|
|
40
|
+
throw new Error("OAuth connections require provider configuration.");
|
|
41
|
+
validateOAuthConfiguration(requirement.oauth);
|
|
42
|
+
} else if (requirement.oauth !== void 0) {
|
|
43
|
+
throw new Error("OAuth configuration is only valid on OAuth connections.");
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
type: requirement.type,
|
|
47
|
+
key,
|
|
48
|
+
...requirement.oauth === void 0 ? {} : { oauth: structuredClone(requirement.oauth) }
|
|
49
|
+
};
|
|
50
|
+
});
|
|
16
51
|
}
|
|
17
52
|
function validateTriggerConnections(triggers, requirements) {
|
|
18
53
|
const seen = /* @__PURE__ */ new Set();
|
|
19
54
|
for (const trigger of triggers) {
|
|
20
55
|
if (!("connectionKey" in trigger) || trigger.connectionKey === void 0) continue;
|
|
21
56
|
const requirement = requirements.find(
|
|
22
|
-
(connection) =>
|
|
57
|
+
(connection) => connection.key === trigger.connectionKey
|
|
23
58
|
);
|
|
24
59
|
const definition = connectionTriggerDefinitions.find(
|
|
25
60
|
(definition2) => definition2.type === trigger.type
|
|
@@ -37,8 +72,29 @@ function validateTriggerConnections(triggers, requirements) {
|
|
|
37
72
|
seen.add(identity);
|
|
38
73
|
}
|
|
39
74
|
}
|
|
40
|
-
function createWorkflowConnections(notion) {
|
|
75
|
+
function createWorkflowConnections(notion, declarations) {
|
|
76
|
+
const requirements = normalizeConnectionRequirements(declarations ?? {});
|
|
41
77
|
const rawBindings = process.env.NOTION_CONNECTION_BINDINGS;
|
|
78
|
+
const clients = {};
|
|
79
|
+
Object.setPrototypeOf(clients, null);
|
|
80
|
+
for (const requirement of requirements) {
|
|
81
|
+
let client;
|
|
82
|
+
Object.defineProperty(clients, requirement.key, {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get() {
|
|
85
|
+
if (client) return client;
|
|
86
|
+
const binding = resolveBinding(requirement.key);
|
|
87
|
+
if (binding.type !== requirement.type) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`Workflow connection "${requirement.key}" is ${binding.type}, not ${requirement.type}.`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
client = requirement.type === "oauth" ? createOAuthConnection(binding) : createConnectionClient(requirement.type, invoker(binding));
|
|
93
|
+
return client;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return Object.freeze(clients);
|
|
42
98
|
function resolveBinding(key) {
|
|
43
99
|
const bindings = JSON.parse(rawBindings ?? "[]");
|
|
44
100
|
if (!Array.isArray(bindings) || !bindings.every(isConnectionBinding)) {
|
|
@@ -52,11 +108,7 @@ function createWorkflowConnections(notion) {
|
|
|
52
108
|
}
|
|
53
109
|
return { ...matches[0] };
|
|
54
110
|
}
|
|
55
|
-
function invoker(
|
|
56
|
-
const binding = resolveBinding(key);
|
|
57
|
-
if (binding.type !== provider) {
|
|
58
|
-
throw new Error(`Workflow connection "${key}" is ${binding.type}, not ${provider}.`);
|
|
59
|
-
}
|
|
111
|
+
function invoker(binding) {
|
|
60
112
|
return async (action, args) => {
|
|
61
113
|
const response = await notion.request({
|
|
62
114
|
path: "tools/run/internal",
|
|
@@ -66,7 +118,19 @@ function createWorkflowConnections(notion) {
|
|
|
66
118
|
return response.result;
|
|
67
119
|
};
|
|
68
120
|
}
|
|
69
|
-
|
|
121
|
+
}
|
|
122
|
+
function createOAuthConnection(binding) {
|
|
123
|
+
const envKey = `NOTION_OAUTH_CONNECTION_${binding.id.replaceAll("-", "").toUpperCase()}`;
|
|
124
|
+
const token = process.env[envKey];
|
|
125
|
+
return {
|
|
126
|
+
async accessToken() {
|
|
127
|
+
if (!token)
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Workflow OAuth connection "${binding.key}" requires authorization.`
|
|
130
|
+
);
|
|
131
|
+
return token;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
70
134
|
}
|
|
71
135
|
function isConnectionBinding(value) {
|
|
72
136
|
return typeof value === "object" && value !== null && "key" in value && typeof value.key === "string" && value.key.length > 0 && "type" in value && typeof value.type === "string" && value.type.length > 0 && "id" in value && typeof value.id === "string" && value.id.length > 0;
|
|
@@ -74,6 +138,6 @@ function isConnectionBinding(value) {
|
|
|
74
138
|
export {
|
|
75
139
|
connections,
|
|
76
140
|
createWorkflowConnections,
|
|
77
|
-
|
|
141
|
+
normalizeConnectionRequirements,
|
|
78
142
|
validateTriggerConnections
|
|
79
143
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { customAgent } from "./notion-as-code/custom-agent.js";
|
|
|
3
3
|
export { database } from "./notion-as-code/database.js";
|
|
4
4
|
export { page } from "./notion-as-code/page.js";
|
|
5
5
|
export { teamspace } from "./notion-as-code/teamspace.js";
|
|
6
|
+
export { view } from "./notion-as-code/view.js";
|
|
6
7
|
export { sync } from "./sync.js";
|
|
7
8
|
export { workflow } from "./workflow.js";
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { customAgent } from "./notion-as-code/custom-agent.js";
|
|
|
3
3
|
import { database } from "./notion-as-code/database.js";
|
|
4
4
|
import { page } from "./notion-as-code/page.js";
|
|
5
5
|
import { teamspace } from "./notion-as-code/teamspace.js";
|
|
6
|
+
import { view } from "./notion-as-code/view.js";
|
|
6
7
|
import { sync } from "./sync.js";
|
|
7
8
|
import { workflow } from "./workflow.js";
|
|
8
9
|
export {
|
|
@@ -12,5 +13,6 @@ export {
|
|
|
12
13
|
page,
|
|
13
14
|
sync,
|
|
14
15
|
teamspace,
|
|
16
|
+
view,
|
|
15
17
|
workflow
|
|
16
18
|
};
|
|
@@ -2,13 +2,14 @@ import type { Database } from "../database.js";
|
|
|
2
2
|
import { type DataSourceDefinition, type NotionAsCodeIcon, type NotionAsCodeProperty, type Parent, type ResourceId } from "./intents.js";
|
|
3
3
|
import { type ChildPageArgs, type PageHandle } from "./page.js";
|
|
4
4
|
import { type AppsSchemaForProperties } from "./schema.js";
|
|
5
|
+
import type { ViewSchema } from "./views.js";
|
|
5
6
|
/** Input for declaring a database and its optional data sources. */
|
|
6
7
|
export type DatabaseArgs<DataSources extends readonly DataSourceDefinition[] = readonly DataSourceDefinition[]> = {
|
|
7
8
|
resourceId: ResourceId;
|
|
8
9
|
/** Omit to create a private top-level database in the Apps workspace. */
|
|
9
10
|
parent?: Parent;
|
|
10
11
|
dataSources?: DataSources;
|
|
11
|
-
views?: readonly
|
|
12
|
+
views?: readonly ViewSchema[];
|
|
12
13
|
icon?: NotionAsCodeIcon;
|
|
13
14
|
cover?: unknown;
|
|
14
15
|
hideDataSourceTitle?: boolean;
|
|
@@ -42,7 +43,7 @@ export type DatabaseHandle<DataSources extends readonly DataSourceDefinition[] =
|
|
|
42
43
|
readonly dataSources: {
|
|
43
44
|
readonly [ResourceId in DataSources[number]["resourceId"]]: DataSourceHandle<DataSourcePropertiesForResourceId<DataSources, ResourceId>>;
|
|
44
45
|
};
|
|
45
|
-
addView: (view:
|
|
46
|
+
addView: (view: ViewSchema) => void;
|
|
46
47
|
};
|
|
47
48
|
/** A database whose sole data source is available without an ID lookup. */
|
|
48
49
|
export type SingleSourceDatabaseHandle<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = DatabaseHandle<readonly DataSourceDefinition<Properties>[]> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAEN,KAAK,oBAAoB,EAEzB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACX,KAAK,UAAU,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAc,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAG5E,OAAO,EAAsB,KAAK,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AAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAgBxE;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CA+BjF"}
|
|
@@ -3,11 +3,13 @@ import { database } from "./database.js";
|
|
|
3
3
|
import { date, datetime } from "./date.js";
|
|
4
4
|
import { page } from "./page.js";
|
|
5
5
|
import { teamspace } from "./teamspace.js";
|
|
6
|
+
import { view } from "./view.js";
|
|
6
7
|
declare const notionAsCodeFacade: {
|
|
7
8
|
teamspace: typeof teamspace;
|
|
8
9
|
database: typeof database;
|
|
9
10
|
page: typeof page;
|
|
10
11
|
customAgent: typeof customAgent;
|
|
12
|
+
view: typeof view;
|
|
11
13
|
text: (value: string) => string[][];
|
|
12
14
|
number: (value: number) => string[][];
|
|
13
15
|
date: typeof date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/handles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/handles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,QAAA,MAAM,kBAAkB;;;;;;kBAMT,MAAM;oBACJ,MAAM;;;oBAGN,MAAM;oBACN,MAAM;0BACA,SAAS,MAAM,EAAE;sBACrB,OAAO;iBACZ,MAAM;mBACJ,MAAM;mBACN,MAAM;sBACH,MAAM,GAAG,SAAS,MAAM,EAAE;uBACzB,MAAM;;;;CAIzB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC;AAE3D,iFAAiF;AACjF,wBAAgB,YAAY,IAAI,kBAAkB,CAEjD"}
|
|
@@ -4,11 +4,13 @@ import { date, datetime } from "./date.js";
|
|
|
4
4
|
import { page } from "./page.js";
|
|
5
5
|
import { assertUserResourceId } from "./resource.js";
|
|
6
6
|
import { teamspace } from "./teamspace.js";
|
|
7
|
+
import { view } from "./view.js";
|
|
7
8
|
const notionAsCodeFacade = {
|
|
8
9
|
teamspace,
|
|
9
10
|
database,
|
|
10
11
|
page,
|
|
11
12
|
customAgent,
|
|
13
|
+
view,
|
|
12
14
|
text: (value) => [[value]],
|
|
13
15
|
number: (value) => [[String(value)]],
|
|
14
16
|
date,
|
|
@@ -4,12 +4,15 @@ export type { CustomAgentArgs, CustomAgentHandle } from "./custom-agent.js";
|
|
|
4
4
|
export type { ChildDatabaseArgs, ChildDatabaseFactory, ChildSingleSourceDatabaseArgs, DataSourceHandle, DatabaseArgs, DatabaseHandle, SingleSourceDatabaseArgs, SingleSourceDatabaseHandle, } from "./database.js";
|
|
5
5
|
export type { ChildPageArgs, PageArgs, PageHandle } from "./page.js";
|
|
6
6
|
export type { TeamspaceArgs, TeamspaceHandle } from "./teamspace.js";
|
|
7
|
+
export type { ViewArgs, ViewHandle } from "./view.js";
|
|
8
|
+
export type { AdvancedFilterSchema, BasePropertyFilter, BaseViewSchema, BoardViewSchema, CalendarViewSchema, CheckboxGroupByFormat, CheckboxPropertyFilter, CoverAspectFormat, CoverFormat, CoverSizeFormat, DatabaseViewSortDirection, DateFilterMode, DateGroupByFormat, DatePropertyFilter, DatePropertyFilterValue, DatePropertyTypes, ExactDatePropertyFilterValue, ExactRangeDatePropertyFilterValue, FeedViewSchema, FilterSchema, FormulaGroupByFormat, GalleryViewSchema, GroupByFormat, GroupByFormatBase, GroupFormat, ListViewSchema, LocationGroupByFormat, MultiSelectPropertyFilter, NumberGroupByFormat, NumberPropertyFilter, PersonGroupByFormat, PersonPropertyFilter, PropertyFilterSchema, PropertyFormat, PropertyViewSortSchema, PropertyVisibility, RelationGroupByFormat, RelationPropertyFilter, RelativeDatePreset, RelativeDatePropertyFilterValue, RelativeDateRangeUnit, RelativeToTodayDatePropertyFilterValue, SelectGroupByFormat, SelectPropertyFilter, StatusGroupByFormat, StatusPropertyFilter, TableViewSchema, TextGroupByFormat, TextPropertyFilter, TimelineViewSchema, ViewSchema, ViewType, } from "./views.js";
|
|
7
9
|
/** Experimental Notion-as-Code facade for Apps SDK project metadata. */
|
|
8
10
|
export declare const notion: {
|
|
9
11
|
teamspace: typeof import("./teamspace.js").teamspace;
|
|
10
12
|
database: typeof import("./database.js").database;
|
|
11
13
|
page: typeof import("./page.js").page;
|
|
12
14
|
customAgent: typeof import("./custom-agent.js").customAgent;
|
|
15
|
+
view: typeof import("./view.js").view;
|
|
13
16
|
text: (value: string) => string[][];
|
|
14
17
|
number: (value: number) => string[][];
|
|
15
18
|
date: typeof import("./date.js").date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC5F,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACvF,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAA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B,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,+BAA+B,EAC/B,qBAAqB,EACrB,sCAAsC,EACtC,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,QAAQ,GACR,MAAM,YAAY,CAAC;AAEpB,wEAAwE;AACxE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;CAAiB,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { CustomAgentArgs } from "./custom-agent.js";
|
|
|
2
2
|
import type { DatabaseArgs } from "./database.js";
|
|
3
3
|
import type { PageArgs } from "./page.js";
|
|
4
4
|
import type { TeamspaceArgs } from "./teamspace.js";
|
|
5
|
+
import type { ViewSchema } from "./views.js";
|
|
5
6
|
/** Apps-specific resource IDs used while declaring Notion-as-Code metadata. */
|
|
6
7
|
/** Synthetic workspace parent for teamspaces declared by an Apps project. */
|
|
7
8
|
export declare const APPS_WORKSPACE_RESOURCE_ID = "__notion_apps_workspace__";
|
|
@@ -101,7 +102,7 @@ export type PageIntent = PageArgs & {
|
|
|
101
102
|
export type CustomAgentIntent = CustomAgentArgs;
|
|
102
103
|
export type ViewIntent = {
|
|
103
104
|
databaseResourceId: ResourceId;
|
|
104
|
-
view:
|
|
105
|
+
view: ViewSchema;
|
|
105
106
|
};
|
|
106
107
|
export type InfraAsCodeIntent = ({
|
|
107
108
|
type: "teamspace";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/intents.ts"],"names":[],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AAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AACvD,MAAM,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAEhD,MAAM,MAAM,UAAU,GAAG;IACxB,kBAAkB,EAAE,UAAU,CAAC;IAC/B,IAAI,EAAE,UAAU,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAC1B,CAAC;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAAG,eAAe,CAAC,GACzC,CAAC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,cAAc,CAAC,GACvC,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,GAC/B,CAAC;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GAAG,iBAAiB,CAAC,GAC9C,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResourceId } from "./intents.js";
|
|
2
|
+
import type { ViewSchema } from "./views.js";
|
|
3
|
+
/** Declare a view attached to a database resource. */
|
|
4
|
+
export type ViewArgs = ViewSchema & {
|
|
5
|
+
databaseResourceId: ResourceId;
|
|
6
|
+
};
|
|
7
|
+
export type ViewHandle = {
|
|
8
|
+
readonly resourceId: string;
|
|
9
|
+
};
|
|
10
|
+
/** Record a database view for provisioning without making a Notion API request. */
|
|
11
|
+
export declare function view(args: ViewArgs): ViewHandle;
|
|
12
|
+
//# sourceMappingURL=view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/view.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,sDAAsD;AACtD,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG;IACnC,kBAAkB,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAO/C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { recordIntent } from "./recorder.js";
|
|
2
|
+
import { assertUserResourceId } from "./resource.js";
|
|
3
|
+
function view(args) {
|
|
4
|
+
assertUserResourceId(args.resourceId);
|
|
5
|
+
assertUserResourceId(args.databaseResourceId);
|
|
6
|
+
assertUserResourceId(args.dataSourceResourceId);
|
|
7
|
+
const { databaseResourceId, ...schema } = args;
|
|
8
|
+
recordIntent({ type: "view", databaseResourceId, view: schema });
|
|
9
|
+
return { resourceId: args.resourceId };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
view
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views-types.test.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/views-types.test.ts"],"names":[],"mappings":""}
|