@notionhq/apps 0.0.20 → 0.0.22
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 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/notion-as-code/custom-agent.d.ts +75 -1
- package/dist/notion-as-code/custom-agent.d.ts.map +1 -1
- package/dist/notion-as-code/custom-agent.js +11 -0
- package/dist/notion-as-code/custom-agent.test.d.ts +2 -0
- package/dist/notion-as-code/custom-agent.test.d.ts.map +1 -0
- package/dist/notion-as-code/database.d.ts +5 -1
- package/dist/notion-as-code/database.d.ts.map +1 -1
- package/dist/notion-as-code/database.js +3 -1
- package/dist/notion-as-code/index.d.ts +2 -2
- package/dist/notion-as-code/index.d.ts.map +1 -1
- package/dist/notion-as-code/intents.d.ts +133 -11
- package/dist/notion-as-code/intents.d.ts.map +1 -1
- package/dist/notion-as-code/notion-as-code-types.test.d.ts +2 -0
- package/dist/notion-as-code/notion-as-code-types.test.d.ts.map +1 -0
- package/dist/notion-as-code/page.d.ts +2 -2
- package/dist/notion-as-code/page.d.ts.map +1 -1
- package/dist/workflow-access.d.ts +29 -0
- package/dist/workflow-access.d.ts.map +1 -1
- package/dist/workflow-access.js +23 -0
- package/dist/workflow.d.ts +1 -0
- package/dist/workflow.d.ts.map +1 -1
- package/dist/workflow.js +2 -0
- package/docs/BUILD.md +1 -1
- package/package.json +1 -1
- package/skills/notion-as-code/SKILL.md +13 -7
- package/skills/workflow/SKILL.md +5 -5
- package/src/cli/build.test.ts +5 -0
- package/src/index.ts +1 -0
- package/src/notion-as-code/custom-agent.test.ts +79 -0
- package/src/notion-as-code/custom-agent.ts +111 -2
- package/src/notion-as-code/database.test.ts +38 -0
- package/src/notion-as-code/database.ts +7 -0
- package/src/notion-as-code/index.ts +39 -1
- package/src/notion-as-code/intents.ts +219 -24
- package/src/notion-as-code/notion-as-code-types.test.ts +167 -0
- package/src/notion-as-code/page.test.ts +24 -0
- package/src/notion-as-code/page.ts +2 -2
- package/src/workflow-access-types.test.ts +8 -4
- package/src/workflow-access.ts +41 -0
- package/src/workflow.test.ts +5 -4
- package/src/workflow.ts +1 -0
package/dist/workflow.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ type WorkflowHandlerResult = {
|
|
|
39
39
|
status: "success";
|
|
40
40
|
} | WorkflowWaitUntilResult;
|
|
41
41
|
export type { WorkflowAccess, WorkflowAccessAgentLevel, WorkflowAccessBindings, WorkflowAccessDeclaration, WorkflowAccessDeclarations, WorkflowAccessLevel, WorkflowAccessLevelFor, WorkflowAccessResource, WorkflowAccessResourceLevel, WorkflowAccessResourceType, WorkflowAccessRequirement, WorkflowAccessRequirements, WorkflowAccessValue, } from "./workflow-access.js";
|
|
42
|
+
export { access } from "./workflow-access.js";
|
|
42
43
|
export type WorkflowEvent = WorkflowEventMap[keyof WorkflowEventMap];
|
|
43
44
|
export type WorkflowEventForTrigger<T extends WorkflowTrigger> = WorkflowEventMap[T["type"]];
|
|
44
45
|
export type WorkflowEventForTriggers<T extends readonly WorkflowTrigger[]> = WorkflowEventForTrigger<T[number]>;
|
package/dist/workflow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../src/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,KAAK,8BAA8B,EACnC,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGN,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,MAAM,sBAAsB,CAAC;AAK9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAKtD,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE1E,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClF,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AC,GAAG,OAAO,CAAC,CAAC,CAAC,GAC1C,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC;AAEF,KAAK,YAAY,GAAG;IACnB;;;OAGG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,eAAe,CAC1B,YAAY,SAAS,8BAA8B,GAAG,8BAA8B,EACpF,OAAO,SAAS,0BAA0B,GAAG,0BAA0B,IACpE,iBAAiB,GAAG;IACvB,0FAA0F;IAC1F,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACzC,WAAW,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC/C,GAAG,WAAW,GAAG;IAChB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,EAAE,YAAY,CAAC;IACnB,iEAAiE;IACjE,IAAI,EAAE,YAAY,CAAC;CACnB,CAAC"}
|
package/dist/workflow.js
CHANGED
|
@@ -18,6 +18,7 @@ import { readRunMetadata } from "./runtime-metadata.js";
|
|
|
18
18
|
import { createWorkflowTriggers } from "./triggers.generated.js";
|
|
19
19
|
import { createWorkflowStepState } from "./workflow-state.js";
|
|
20
20
|
const MAX_WORKFLOW_WAIT_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
21
|
+
import { access } from "./workflow-access.js";
|
|
21
22
|
import {
|
|
22
23
|
connections
|
|
23
24
|
} from "./connections.js";
|
|
@@ -341,6 +342,7 @@ function isNodeError(error) {
|
|
|
341
342
|
return error instanceof Error && "code" in error;
|
|
342
343
|
}
|
|
343
344
|
export {
|
|
345
|
+
access,
|
|
344
346
|
connections,
|
|
345
347
|
workflow
|
|
346
348
|
};
|
package/docs/BUILD.md
CHANGED
|
@@ -209,7 +209,7 @@ resources may already have changed when a deployment fails.
|
|
|
209
209
|
|
|
210
210
|
## Workflow access
|
|
211
211
|
|
|
212
|
-
`workflow({ access: { handbook:
|
|
212
|
+
`workflow({ access: { handbook: access.view(handbook) }, ... })`
|
|
213
213
|
declares access to a NaC resource and a named runtime binding. The manifest
|
|
214
214
|
contains only the alias and its symbolic `{ type, resourceId, level }`
|
|
215
215
|
requirement; live IDs are not build output.
|
package/package.json
CHANGED
|
@@ -25,7 +25,8 @@ are shared across capabilities or do not have a natural capability owner. Module
|
|
|
25
25
|
evaluation must work without credentials or network access.
|
|
26
26
|
|
|
27
27
|
To configure a workflow's access to a declared page, database, data source, or
|
|
28
|
-
custom agent,
|
|
28
|
+
custom agent, use the matching helper, such as
|
|
29
|
+
`access: { guide: access.view(guide), analyst: access.call(analyst) }`.
|
|
29
30
|
The handler receives the live identity as `context.access.alias.id`; importing
|
|
30
31
|
a declaration alone does not request access. See the
|
|
31
32
|
[workflow skill](../workflow/SKILL.md#resources-created-with-the-app) for levels
|
|
@@ -124,12 +125,17 @@ use `{ type: "resourceId", resourceId: parent.resourceId }`; child helpers set
|
|
|
124
125
|
this reference for you. Pages and databases without a parent default to private
|
|
125
126
|
top-level resources in the Apps workspace.
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
Page and database covers accept `{ type: "url", url, position? }`. Custom-agent
|
|
129
|
+
triggers are discriminated unions for recurrence, page-added, and
|
|
130
|
+
property-updated triggers. Weekly recurrences require at least one weekday, and
|
|
131
|
+
property-updated triggers require property conditions or
|
|
132
|
+
`triggerWhenPageContentEdited: true`.
|
|
133
|
+
|
|
134
|
+
Database page layouts are typed against their keyed data-source schema. Reference
|
|
135
|
+
property resource IDs, not schema keys. The SDK restricts relation groups to
|
|
136
|
+
relation properties and narrows standalone property styles by property type.
|
|
137
|
+
Database views are typed with `ViewSchema`; standalone declarations accept
|
|
138
|
+
`ViewArgs`, which adds the owning `databaseResourceId`.
|
|
133
139
|
|
|
134
140
|
The Apps SDK exposes a subset of Notion as Code. Data sources are nested inside
|
|
135
141
|
`database(resourceId, { datasources: { ... } })`, not declared by a separate
|
package/skills/workflow/SKILL.md
CHANGED
|
@@ -132,7 +132,7 @@ export const guide = page({
|
|
|
132
132
|
Import the handle into the workflow and declare the named binding it needs:
|
|
133
133
|
|
|
134
134
|
```ts
|
|
135
|
-
import { workflow } from "@notionhq/apps";
|
|
135
|
+
import { access, workflow } from "@notionhq/apps";
|
|
136
136
|
import { triggers } from "@notionhq/apps/triggers";
|
|
137
137
|
|
|
138
138
|
import { guide } from "./sayHello/lib/notion.js";
|
|
@@ -141,7 +141,7 @@ export default workflow({
|
|
|
141
141
|
name: "Read guide",
|
|
142
142
|
description: "Reads the App's guide on a recurring schedule.",
|
|
143
143
|
triggers: [triggers.scheduled()],
|
|
144
|
-
access: { guide:
|
|
144
|
+
access: { guide: access.view(guide) },
|
|
145
145
|
handler: async (_event, context) => {
|
|
146
146
|
await context.step("Read guide", () =>
|
|
147
147
|
context.notion.pages.retrieve({ page_id: context.access.guide.id }),
|
|
@@ -155,9 +155,9 @@ declarations in `access` work too. Importing a declaration alone provisions the
|
|
|
155
155
|
resource but does not create a `context.access` alias. An `access` entry declares
|
|
156
156
|
the needed permission level and a named binding for that NaC resource.
|
|
157
157
|
|
|
158
|
-
`access`
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
`access.view()`, `access.comment()`, `access.edit()`, and `access.fullAccess()`
|
|
159
|
+
accept page, database, and data-source handles. `access.call()` accepts custom-agent
|
|
160
|
+
handles. Keys are workflow-local aliases. The handler's
|
|
161
161
|
typed `context.access` exposes each declared alias as a readonly `{ type, id }`,
|
|
162
162
|
not the declaration handle or a permission-management API. UI-granted resources
|
|
163
163
|
are permissions only: they do not create `context.access` aliases.
|
package/src/cli/build.test.ts
CHANGED
|
@@ -217,6 +217,11 @@ describe("buildApp", () => {
|
|
|
217
217
|
access: {
|
|
218
218
|
home: { type: "page", resourceId: "home", level: "view" },
|
|
219
219
|
records: { type: "database", resourceId: "records", level: "edit" },
|
|
220
|
+
fullRecords: {
|
|
221
|
+
type: "database",
|
|
222
|
+
resourceId: "records",
|
|
223
|
+
level: "fullAccess",
|
|
224
|
+
},
|
|
220
225
|
source: {
|
|
221
226
|
type: "dataSource",
|
|
222
227
|
resourceId: "records-source",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { notion } from "./index.js";
|
|
4
|
+
import { finishMetadataRecording, startMetadataRecording } from "./recorder.js";
|
|
5
|
+
|
|
6
|
+
describe("Notion-as-Code custom agent declarations", () => {
|
|
7
|
+
it("records typed recurrence and database triggers", () => {
|
|
8
|
+
const recorder = startMetadataRecording();
|
|
9
|
+
|
|
10
|
+
notion.customAgent({
|
|
11
|
+
resourceId: "triage-agent",
|
|
12
|
+
name: "Triage agent",
|
|
13
|
+
triggers: [
|
|
14
|
+
{
|
|
15
|
+
type: "recurrence",
|
|
16
|
+
resourceId: "weekday-trigger",
|
|
17
|
+
frequency: "week",
|
|
18
|
+
interval: 1,
|
|
19
|
+
start: "2026-09-21T09:00:00",
|
|
20
|
+
timeZone: "America/Los_Angeles",
|
|
21
|
+
weekdays: { MO: true, FR: true },
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: "property_updated",
|
|
25
|
+
resourceId: "task-update-trigger",
|
|
26
|
+
dataSourceResourceId: "tasks",
|
|
27
|
+
propertyConditions: {
|
|
28
|
+
status: { type: "property_edited" },
|
|
29
|
+
},
|
|
30
|
+
triggerWhenPageContentEdited: true,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
expect(finishMetadataRecording(recorder).intents).toEqual([
|
|
36
|
+
{
|
|
37
|
+
type: "custom_agent",
|
|
38
|
+
resourceId: "triage-agent",
|
|
39
|
+
name: "Triage agent",
|
|
40
|
+
triggers: [
|
|
41
|
+
{
|
|
42
|
+
type: "recurrence",
|
|
43
|
+
resourceId: "weekday-trigger",
|
|
44
|
+
frequency: "week",
|
|
45
|
+
interval: 1,
|
|
46
|
+
start: "2026-09-21T09:00:00",
|
|
47
|
+
timeZone: "America/Los_Angeles",
|
|
48
|
+
weekdays: { MO: true, FR: true },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "property_updated",
|
|
52
|
+
resourceId: "task-update-trigger",
|
|
53
|
+
dataSourceResourceId: "tasks",
|
|
54
|
+
propertyConditions: {
|
|
55
|
+
status: { type: "property_edited" },
|
|
56
|
+
},
|
|
57
|
+
triggerWhenPageContentEdited: true,
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
]);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("rejects reserved resource IDs inside triggers", () => {
|
|
65
|
+
expect(() =>
|
|
66
|
+
notion.customAgent({
|
|
67
|
+
resourceId: "triage-agent",
|
|
68
|
+
name: "Triage agent",
|
|
69
|
+
triggers: [
|
|
70
|
+
{
|
|
71
|
+
type: "page_added",
|
|
72
|
+
resourceId: "__notion_apps_trigger",
|
|
73
|
+
dataSourceResourceId: "tasks",
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
}),
|
|
77
|
+
).toThrow("reserved");
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -2,6 +2,105 @@ import type { CustomAgentIntent, NotionAsCodeIcon, ResourceId } from "./intents.
|
|
|
2
2
|
import { recordIntent } from "./recorder.js";
|
|
3
3
|
import { assertUserResourceId } from "./resource.js";
|
|
4
4
|
|
|
5
|
+
type RecurrenceWeekday = "MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU";
|
|
6
|
+
|
|
7
|
+
/** A nonempty selection of weekdays for a weekly recurrence. */
|
|
8
|
+
export type RecurrenceWeekdays = {
|
|
9
|
+
[Day in RecurrenceWeekday]?: true;
|
|
10
|
+
} & {
|
|
11
|
+
[Day in RecurrenceWeekday]: Required<Pick<Record<RecurrenceWeekday, true>, Day>>;
|
|
12
|
+
}[RecurrenceWeekday];
|
|
13
|
+
|
|
14
|
+
export type MonthlyWeekdayOccurrence = "1st" | "2nd" | "3rd" | "4th" | "last";
|
|
15
|
+
|
|
16
|
+
export type MonthlyRecurrenceRestriction =
|
|
17
|
+
| { type: "day_of_month"; day: number }
|
|
18
|
+
| {
|
|
19
|
+
type: "weekday_of_month";
|
|
20
|
+
weekday: RecurrenceWeekday;
|
|
21
|
+
occurrence: MonthlyWeekdayOccurrence;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type RecurrenceScheduleEnd =
|
|
25
|
+
| { type: "date"; endsAt: string }
|
|
26
|
+
| { type: "occurrences"; count: number };
|
|
27
|
+
|
|
28
|
+
type RecurrenceScheduleBase = {
|
|
29
|
+
interval: number;
|
|
30
|
+
start: string;
|
|
31
|
+
timeZone: string;
|
|
32
|
+
end?: RecurrenceScheduleEnd;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type HourlyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
36
|
+
frequency: "hour";
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type DailyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
40
|
+
frequency: "day";
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type WeeklyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
44
|
+
frequency: "week";
|
|
45
|
+
weekdays: RecurrenceWeekdays;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type MonthlyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
49
|
+
frequency: "month";
|
|
50
|
+
monthlyRestriction: MonthlyRecurrenceRestriction;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type YearlyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
54
|
+
frequency: "year";
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type CustomAgentRecurrenceSchedule = (
|
|
58
|
+
| HourlyRecurrenceSchedule
|
|
59
|
+
| DailyRecurrenceSchedule
|
|
60
|
+
| WeeklyRecurrenceSchedule
|
|
61
|
+
| MonthlyRecurrenceSchedule
|
|
62
|
+
| YearlyRecurrenceSchedule
|
|
63
|
+
) & {
|
|
64
|
+
type: "recurrence";
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type CustomAgentTriggerBase = {
|
|
68
|
+
resourceId: ResourceId;
|
|
69
|
+
enabled?: boolean;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export type CustomAgentRecurrenceTrigger = CustomAgentTriggerBase & CustomAgentRecurrenceSchedule;
|
|
73
|
+
|
|
74
|
+
export type PropertyTriggerCondition = {
|
|
75
|
+
type: "property_edited";
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export type CustomAgentPageAddedTrigger = CustomAgentTriggerBase & {
|
|
79
|
+
type: "page_added";
|
|
80
|
+
dataSourceResourceId: ResourceId;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type PropertyUpdatedTriggerTarget =
|
|
84
|
+
| {
|
|
85
|
+
propertyConditions: Readonly<Record<ResourceId, PropertyTriggerCondition>>;
|
|
86
|
+
triggerWhenPageContentEdited?: boolean;
|
|
87
|
+
}
|
|
88
|
+
| {
|
|
89
|
+
propertyConditions?: never;
|
|
90
|
+
triggerWhenPageContentEdited: true;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type CustomAgentPropertyUpdatedTrigger = CustomAgentTriggerBase &
|
|
94
|
+
PropertyUpdatedTriggerTarget & {
|
|
95
|
+
type: "property_updated";
|
|
96
|
+
dataSourceResourceId: ResourceId;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type CustomAgentTrigger =
|
|
100
|
+
| CustomAgentRecurrenceTrigger
|
|
101
|
+
| CustomAgentPageAddedTrigger
|
|
102
|
+
| CustomAgentPropertyUpdatedTrigger;
|
|
103
|
+
|
|
5
104
|
export type CustomAgentArgs = {
|
|
6
105
|
resourceId: ResourceId;
|
|
7
106
|
name: string;
|
|
@@ -9,8 +108,7 @@ export type CustomAgentArgs = {
|
|
|
9
108
|
instructions?: string;
|
|
10
109
|
model?: "ambrosia-tart-high" | "opal-quince-medium" | "almond-croissant-low";
|
|
11
110
|
sharedResources?: readonly ResourceId[];
|
|
12
|
-
|
|
13
|
-
triggers?: readonly unknown[];
|
|
111
|
+
triggers?: readonly CustomAgentTrigger[];
|
|
14
112
|
};
|
|
15
113
|
|
|
16
114
|
export type CustomAgentHandle = {
|
|
@@ -24,6 +122,17 @@ export function customAgent(args: CustomAgentArgs): CustomAgentHandle {
|
|
|
24
122
|
for (const resourceId of args.sharedResources ?? []) {
|
|
25
123
|
assertUserResourceId(resourceId);
|
|
26
124
|
}
|
|
125
|
+
for (const trigger of args.triggers ?? []) {
|
|
126
|
+
assertUserResourceId(trigger.resourceId);
|
|
127
|
+
if (trigger.type === "page_added" || trigger.type === "property_updated") {
|
|
128
|
+
assertUserResourceId(trigger.dataSourceResourceId);
|
|
129
|
+
}
|
|
130
|
+
if (trigger.type === "property_updated") {
|
|
131
|
+
for (const propertyResourceId of Object.keys(trigger.propertyConditions ?? {})) {
|
|
132
|
+
assertUserResourceId(propertyResourceId);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
27
136
|
recordIntent({ type: "custom_agent", ...args } satisfies {
|
|
28
137
|
type: "custom_agent";
|
|
29
138
|
} & CustomAgentIntent);
|
|
@@ -8,6 +8,44 @@ import { APPS_WORKSPACE_RESOURCE_ID } from "./intents.js";
|
|
|
8
8
|
import { finishMetadataRecording, startMetadataRecording } from "./recorder.js";
|
|
9
9
|
|
|
10
10
|
describe("Notion-as-Code database declarations", () => {
|
|
11
|
+
it("records a single-source page layout on the data source", () => {
|
|
12
|
+
const recorder = startMetadataRecording();
|
|
13
|
+
|
|
14
|
+
notion.database("layout-database", {
|
|
15
|
+
dataSourceResourceId: "layout-source",
|
|
16
|
+
name: "Tasks",
|
|
17
|
+
schema: {
|
|
18
|
+
Name: { type: "title", resourceId: "name" },
|
|
19
|
+
Estimate: { type: "number", resourceId: "estimate" },
|
|
20
|
+
},
|
|
21
|
+
pageLayout: {
|
|
22
|
+
main: [
|
|
23
|
+
{ type: "properties", properties: [{ property: "name" }] },
|
|
24
|
+
{ type: "property", property: "estimate", style: "large" },
|
|
25
|
+
],
|
|
26
|
+
pinnedProperties: ["estimate"],
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
expect(finishMetadataRecording(recorder).intents).toEqual([
|
|
31
|
+
expect.objectContaining({
|
|
32
|
+
resourceId: "layout-database",
|
|
33
|
+
dataSources: [
|
|
34
|
+
expect.objectContaining({
|
|
35
|
+
resourceId: "layout-source",
|
|
36
|
+
pageLayout: {
|
|
37
|
+
main: [
|
|
38
|
+
{ type: "properties", properties: [{ property: "name" }] },
|
|
39
|
+
{ type: "property", property: "estimate", style: "large" },
|
|
40
|
+
],
|
|
41
|
+
pinnedProperties: ["estimate"],
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
}),
|
|
46
|
+
]);
|
|
47
|
+
});
|
|
48
|
+
|
|
11
49
|
it("converts the single-source form with keyed schemas and resolved property names", () => {
|
|
12
50
|
const recorder = startMetadataRecording();
|
|
13
51
|
const schema = {
|
|
@@ -2,6 +2,7 @@ import type { Database } from "../database.js";
|
|
|
2
2
|
import {
|
|
3
3
|
APPS_WORKSPACE_RESOURCE_ID,
|
|
4
4
|
type DatabaseIntent,
|
|
5
|
+
type DatabasePageLayout,
|
|
5
6
|
type DataSourceDefinition,
|
|
6
7
|
type NotionAsCodeIcon,
|
|
7
8
|
type NotionAsCodeProperty,
|
|
@@ -26,6 +27,7 @@ export type DataSourceArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchem
|
|
|
26
27
|
name?: never;
|
|
27
28
|
schema: Schema;
|
|
28
29
|
icon?: NotionAsCodeIcon;
|
|
30
|
+
pageLayout?: DatabasePageLayout<Schema>;
|
|
29
31
|
};
|
|
30
32
|
|
|
31
33
|
/** Data sources keyed by the names used to access their handles. */
|
|
@@ -42,6 +44,7 @@ type SingleSourceDatabaseOptions<Schema extends NotionAsCodeSchema = NotionAsCod
|
|
|
42
44
|
dataSourceResourceId: ResourceId;
|
|
43
45
|
name: string;
|
|
44
46
|
schema: Schema;
|
|
47
|
+
pageLayout?: DatabasePageLayout<Schema>;
|
|
45
48
|
datasources?: never;
|
|
46
49
|
};
|
|
47
50
|
|
|
@@ -61,6 +64,7 @@ type MultiSourceDatabaseOptions<DataSources extends DataSourceMap = DataSourceMa
|
|
|
61
64
|
datasources: DataSources;
|
|
62
65
|
dataSourceResourceId?: never;
|
|
63
66
|
schema?: never;
|
|
67
|
+
pageLayout?: never;
|
|
64
68
|
} & (keyof NoInfer<DataSources> extends never
|
|
65
69
|
? { views: NonEmptyViewSchemas }
|
|
66
70
|
: { views?: readonly ViewSchema[] });
|
|
@@ -76,6 +80,7 @@ type ViewOnlyDatabaseOptions = DatabaseMetadata & {
|
|
|
76
80
|
datasources?: never;
|
|
77
81
|
dataSourceResourceId?: never;
|
|
78
82
|
schema?: never;
|
|
83
|
+
pageLayout?: never;
|
|
79
84
|
views: NonEmptyViewSchemas;
|
|
80
85
|
};
|
|
81
86
|
|
|
@@ -255,6 +260,7 @@ function buildDatabaseHandle(
|
|
|
255
260
|
resourceId: args.dataSourceResourceId,
|
|
256
261
|
name: args.name,
|
|
257
262
|
properties: normalizeProperties(args.schema),
|
|
263
|
+
...(args.pageLayout === undefined ? {} : { pageLayout: args.pageLayout }),
|
|
258
264
|
};
|
|
259
265
|
const handle = recordDatabase(databaseResourceId, args, parent, [
|
|
260
266
|
{ key: "dataSource", schema: args.schema, definition: source },
|
|
@@ -295,6 +301,7 @@ function normalizeDatabaseMetadata(args: DatabaseArgs): DatabaseMetadata {
|
|
|
295
301
|
schema: _schema,
|
|
296
302
|
datasources: _datasources,
|
|
297
303
|
dataSourceResourceId: _dataSourceResourceId,
|
|
304
|
+
pageLayout: _pageLayout,
|
|
298
305
|
...metadata
|
|
299
306
|
} = args;
|
|
300
307
|
return metadata;
|
|
@@ -2,6 +2,9 @@ import { createNotion } from "./handles.js";
|
|
|
2
2
|
|
|
3
3
|
export { APPS_RESERVED_RESOURCE_ID_PREFIX, APPS_WORKSPACE_RESOURCE_ID } from "./intents.js";
|
|
4
4
|
export type {
|
|
5
|
+
ContentPageLayoutTab,
|
|
6
|
+
DatabasePageLayout,
|
|
7
|
+
DatabasePageLayoutTab,
|
|
5
8
|
DatabaseIntent,
|
|
6
9
|
DataSourceDefinition,
|
|
7
10
|
NotionAsCodeIcon,
|
|
@@ -10,10 +13,45 @@ export type {
|
|
|
10
13
|
NotionAsCodeSchema,
|
|
11
14
|
NotionAsCodeSelectOption,
|
|
12
15
|
NotionAsCodeStatusOption,
|
|
16
|
+
PageCoverReference,
|
|
17
|
+
PageLayoutMainModule,
|
|
18
|
+
PageLayoutNumberAndFormulaStyle,
|
|
19
|
+
PageLayoutPersonStyle,
|
|
20
|
+
PageLayoutPropertiesModule,
|
|
21
|
+
PageLayoutPropertyConfig,
|
|
22
|
+
PageLayoutPropertyModule,
|
|
23
|
+
PageLayoutPropertySection,
|
|
24
|
+
PageLayoutRelationConfig,
|
|
25
|
+
PageLayoutRelationsGroupModule,
|
|
26
|
+
PageLayoutSidebarModule,
|
|
13
27
|
Parent,
|
|
14
28
|
ResourceId,
|
|
29
|
+
RollupBaseAggregationType,
|
|
30
|
+
RollupDateAggregationType,
|
|
31
|
+
RollupNumberAggregationType,
|
|
32
|
+
RollupTargetPropertyType,
|
|
33
|
+
ViewPageLayoutTab,
|
|
15
34
|
} from "./intents.js";
|
|
16
|
-
export type {
|
|
35
|
+
export type {
|
|
36
|
+
CustomAgentArgs,
|
|
37
|
+
CustomAgentHandle,
|
|
38
|
+
CustomAgentPageAddedTrigger,
|
|
39
|
+
CustomAgentPropertyUpdatedTrigger,
|
|
40
|
+
CustomAgentRecurrenceSchedule,
|
|
41
|
+
CustomAgentRecurrenceTrigger,
|
|
42
|
+
CustomAgentTrigger,
|
|
43
|
+
CustomAgentTriggerBase,
|
|
44
|
+
DailyRecurrenceSchedule,
|
|
45
|
+
HourlyRecurrenceSchedule,
|
|
46
|
+
MonthlyRecurrenceRestriction,
|
|
47
|
+
MonthlyRecurrenceSchedule,
|
|
48
|
+
MonthlyWeekdayOccurrence,
|
|
49
|
+
PropertyTriggerCondition,
|
|
50
|
+
RecurrenceScheduleEnd,
|
|
51
|
+
RecurrenceWeekdays,
|
|
52
|
+
WeeklyRecurrenceSchedule,
|
|
53
|
+
YearlyRecurrenceSchedule,
|
|
54
|
+
} from "./custom-agent.js";
|
|
17
55
|
export type {
|
|
18
56
|
ChildDatabaseArgs,
|
|
19
57
|
ChildDatabaseFactory,
|