@notionhq/apps 0.0.20 → 0.0.21
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/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/package.json +1 -1
- package/skills/notion-as-code/SKILL.md +11 -6
- 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
|
@@ -1,4 +1,77 @@
|
|
|
1
1
|
import type { NotionAsCodeIcon, ResourceId } from "./intents.js";
|
|
2
|
+
type RecurrenceWeekday = "MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU";
|
|
3
|
+
/** A nonempty selection of weekdays for a weekly recurrence. */
|
|
4
|
+
export type RecurrenceWeekdays = {
|
|
5
|
+
[Day in RecurrenceWeekday]?: true;
|
|
6
|
+
} & {
|
|
7
|
+
[Day in RecurrenceWeekday]: Required<Pick<Record<RecurrenceWeekday, true>, Day>>;
|
|
8
|
+
}[RecurrenceWeekday];
|
|
9
|
+
export type MonthlyWeekdayOccurrence = "1st" | "2nd" | "3rd" | "4th" | "last";
|
|
10
|
+
export type MonthlyRecurrenceRestriction = {
|
|
11
|
+
type: "day_of_month";
|
|
12
|
+
day: number;
|
|
13
|
+
} | {
|
|
14
|
+
type: "weekday_of_month";
|
|
15
|
+
weekday: RecurrenceWeekday;
|
|
16
|
+
occurrence: MonthlyWeekdayOccurrence;
|
|
17
|
+
};
|
|
18
|
+
export type RecurrenceScheduleEnd = {
|
|
19
|
+
type: "date";
|
|
20
|
+
endsAt: string;
|
|
21
|
+
} | {
|
|
22
|
+
type: "occurrences";
|
|
23
|
+
count: number;
|
|
24
|
+
};
|
|
25
|
+
type RecurrenceScheduleBase = {
|
|
26
|
+
interval: number;
|
|
27
|
+
start: string;
|
|
28
|
+
timeZone: string;
|
|
29
|
+
end?: RecurrenceScheduleEnd;
|
|
30
|
+
};
|
|
31
|
+
export type HourlyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
32
|
+
frequency: "hour";
|
|
33
|
+
};
|
|
34
|
+
export type DailyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
35
|
+
frequency: "day";
|
|
36
|
+
};
|
|
37
|
+
export type WeeklyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
38
|
+
frequency: "week";
|
|
39
|
+
weekdays: RecurrenceWeekdays;
|
|
40
|
+
};
|
|
41
|
+
export type MonthlyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
42
|
+
frequency: "month";
|
|
43
|
+
monthlyRestriction: MonthlyRecurrenceRestriction;
|
|
44
|
+
};
|
|
45
|
+
export type YearlyRecurrenceSchedule = RecurrenceScheduleBase & {
|
|
46
|
+
frequency: "year";
|
|
47
|
+
};
|
|
48
|
+
export type CustomAgentRecurrenceSchedule = (HourlyRecurrenceSchedule | DailyRecurrenceSchedule | WeeklyRecurrenceSchedule | MonthlyRecurrenceSchedule | YearlyRecurrenceSchedule) & {
|
|
49
|
+
type: "recurrence";
|
|
50
|
+
};
|
|
51
|
+
export type CustomAgentTriggerBase = {
|
|
52
|
+
resourceId: ResourceId;
|
|
53
|
+
enabled?: boolean;
|
|
54
|
+
};
|
|
55
|
+
export type CustomAgentRecurrenceTrigger = CustomAgentTriggerBase & CustomAgentRecurrenceSchedule;
|
|
56
|
+
export type PropertyTriggerCondition = {
|
|
57
|
+
type: "property_edited";
|
|
58
|
+
};
|
|
59
|
+
export type CustomAgentPageAddedTrigger = CustomAgentTriggerBase & {
|
|
60
|
+
type: "page_added";
|
|
61
|
+
dataSourceResourceId: ResourceId;
|
|
62
|
+
};
|
|
63
|
+
type PropertyUpdatedTriggerTarget = {
|
|
64
|
+
propertyConditions: Readonly<Record<ResourceId, PropertyTriggerCondition>>;
|
|
65
|
+
triggerWhenPageContentEdited?: boolean;
|
|
66
|
+
} | {
|
|
67
|
+
propertyConditions?: never;
|
|
68
|
+
triggerWhenPageContentEdited: true;
|
|
69
|
+
};
|
|
70
|
+
export type CustomAgentPropertyUpdatedTrigger = CustomAgentTriggerBase & PropertyUpdatedTriggerTarget & {
|
|
71
|
+
type: "property_updated";
|
|
72
|
+
dataSourceResourceId: ResourceId;
|
|
73
|
+
};
|
|
74
|
+
export type CustomAgentTrigger = CustomAgentRecurrenceTrigger | CustomAgentPageAddedTrigger | CustomAgentPropertyUpdatedTrigger;
|
|
2
75
|
export type CustomAgentArgs = {
|
|
3
76
|
resourceId: ResourceId;
|
|
4
77
|
name: string;
|
|
@@ -8,7 +81,7 @@ export type CustomAgentArgs = {
|
|
|
8
81
|
instructions?: string;
|
|
9
82
|
model?: "ambrosia-tart-high" | "opal-quince-medium" | "almond-croissant-low";
|
|
10
83
|
sharedResources?: readonly ResourceId[];
|
|
11
|
-
triggers?: readonly
|
|
84
|
+
triggers?: readonly CustomAgentTrigger[];
|
|
12
85
|
};
|
|
13
86
|
export type CustomAgentHandle = {
|
|
14
87
|
readonly resourceType: "customAgent";
|
|
@@ -16,4 +89,5 @@ export type CustomAgentHandle = {
|
|
|
16
89
|
};
|
|
17
90
|
/** Declare a custom agent and validate every shared resource reference. */
|
|
18
91
|
export declare function customAgent(args: CustomAgentArgs): CustomAgentHandle;
|
|
92
|
+
export {};
|
|
19
93
|
//# sourceMappingURL=custom-agent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-agent.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/custom-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIpF,MAAM,MAAM,eAAe,GAAG;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;IAC7E,eAAe,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"custom-agent.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/custom-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAIpF,KAAK,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAExE,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG;KAC/B,GAAG,IAAI,iBAAiB,CAAC,CAAC,EAAE,IAAI;CACjC,GAAG;KACF,GAAG,IAAI,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAA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AAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,oBAAoB,GAAG,oBAAoB,GAAG,sBAAsB,CAAC;IAC7E,eAAe,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC/B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,GAAG,iBAAiB,CAoBpE"}
|
|
@@ -5,6 +5,17 @@ function customAgent(args) {
|
|
|
5
5
|
for (const resourceId of args.sharedResources ?? []) {
|
|
6
6
|
assertUserResourceId(resourceId);
|
|
7
7
|
}
|
|
8
|
+
for (const trigger of args.triggers ?? []) {
|
|
9
|
+
assertUserResourceId(trigger.resourceId);
|
|
10
|
+
if (trigger.type === "page_added" || trigger.type === "property_updated") {
|
|
11
|
+
assertUserResourceId(trigger.dataSourceResourceId);
|
|
12
|
+
}
|
|
13
|
+
if (trigger.type === "property_updated") {
|
|
14
|
+
for (const propertyResourceId of Object.keys(trigger.propertyConditions ?? {})) {
|
|
15
|
+
assertUserResourceId(propertyResourceId);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
8
19
|
recordIntent({ type: "custom_agent", ...args });
|
|
9
20
|
return { resourceType: "customAgent", resourceId: args.resourceId };
|
|
10
21
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-agent.test.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/custom-agent.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Database } from "../database.js";
|
|
2
|
-
import { type DatabaseIntent, type NotionAsCodeIcon, type NotionAsCodeSchema, type Parent, type ResourceId } from "./intents.js";
|
|
2
|
+
import { type DatabaseIntent, type DatabasePageLayout, type NotionAsCodeIcon, type NotionAsCodeSchema, type Parent, type ResourceId } from "./intents.js";
|
|
3
3
|
import { type ChildPageArgs, type PageHandle } from "./page.js";
|
|
4
4
|
import { type AppsSchemaForSchema } from "./schema.js";
|
|
5
5
|
import type { ViewSchema } from "./views.js";
|
|
@@ -12,6 +12,7 @@ export type DataSourceArgs<Schema extends NotionAsCodeSchema = NotionAsCodeSchem
|
|
|
12
12
|
name?: never;
|
|
13
13
|
schema: Schema;
|
|
14
14
|
icon?: NotionAsCodeIcon;
|
|
15
|
+
pageLayout?: DatabasePageLayout<Schema>;
|
|
15
16
|
};
|
|
16
17
|
/** Data sources keyed by the names used to access their handles. */
|
|
17
18
|
export type DataSourceMap = Record<string, DataSourceArgs>;
|
|
@@ -23,6 +24,7 @@ type SingleSourceDatabaseOptions<Schema extends NotionAsCodeSchema = NotionAsCod
|
|
|
23
24
|
dataSourceResourceId: ResourceId;
|
|
24
25
|
name: string;
|
|
25
26
|
schema: Schema;
|
|
27
|
+
pageLayout?: DatabasePageLayout<Schema>;
|
|
26
28
|
datasources?: never;
|
|
27
29
|
};
|
|
28
30
|
/** Top-level single-source inputs may choose a parent; page.addDatabase/teamspace.addDatabase bind it instead. */
|
|
@@ -38,6 +40,7 @@ type MultiSourceDatabaseOptions<DataSources extends DataSourceMap = DataSourceMa
|
|
|
38
40
|
datasources: DataSources;
|
|
39
41
|
dataSourceResourceId?: never;
|
|
40
42
|
schema?: never;
|
|
43
|
+
pageLayout?: never;
|
|
41
44
|
} & (keyof NoInfer<DataSources> extends never ? {
|
|
42
45
|
views: NonEmptyViewSchemas;
|
|
43
46
|
} : {
|
|
@@ -52,6 +55,7 @@ type ViewOnlyDatabaseOptions = DatabaseMetadata & {
|
|
|
52
55
|
datasources?: never;
|
|
53
56
|
dataSourceResourceId?: never;
|
|
54
57
|
schema?: never;
|
|
58
|
+
pageLayout?: never;
|
|
55
59
|
views: NonEmptyViewSchemas;
|
|
56
60
|
};
|
|
57
61
|
type ViewOnlyDatabaseArgs = ViewOnlyDatabaseOptions & {
|
|
@@ -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,cAAc,
|
|
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,cAAc,EACnB,KAAK,kBAAkB,EAEvB,KAAK,gBAAgB,EAErB,KAAK,kBAAkB,EACvB,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,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,0FAA0F;AAC1F,KAAK,gBAAgB,GAAG,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,QAAQ,GAAG,aAAa,CAAC,CAAC;AAEtF,KAAK,mBAAmB,GAAG,SAAS,CAAC,UAAU,EAAE,GAAG,UAAU,EAAE,CAAC,CAAC;AAElE,mGAAmG;AACnG,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,kBAAkB,GAAG,kBAAkB,IAAI;IACpF,UAAU,EAAE,UAAU,CAAC;IACvB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,UAAU,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;CACxC,CAAC;AAEF,oEAAoE;A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AC;CACtB,CAAC;AAEF,4DAA4D;AAC5D,wBAAgB,QAAQ,CAAC,KAAK,CAAC,MAAM,SAAS,kBAAkB,EAC/D,kBAAkB,EAAE,UAAU,EAC9B,IAAI,EAAE,wBAAwB,CAAC,MAAM,CAAC,GACpC,0BAA0B,CAAC,MAAM,CAAC,CAAC;AACtC,wBAAgB,QAAQ,CAAC,KAAK,CAAC,WAAW,SAAS,aAAa,EAC/D,kBAAkB,EAAE,UAAU,EAC9B,IAAI,EAAE,uBAAuB,CAAC,WAAW,CAAC,GACxC,cAAc,CAAC,WAAW,CAAC,CAAC;AAC/B,wBAAgB,QAAQ,CACvB,kBAAkB,EAAE,UAAU,EAC9B,IAAI,EAAE,oBAAoB,GACxB,cAAc,CAAC,EAAE,CAAC,CAAC;AAmBtB,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAuBxE"}
|
|
@@ -43,7 +43,8 @@ function buildDatabaseHandle(databaseResourceId, args, parent) {
|
|
|
43
43
|
const source = {
|
|
44
44
|
resourceId: args.dataSourceResourceId,
|
|
45
45
|
name: args.name,
|
|
46
|
-
properties: normalizeProperties(args.schema)
|
|
46
|
+
properties: normalizeProperties(args.schema),
|
|
47
|
+
...args.pageLayout === void 0 ? {} : { pageLayout: args.pageLayout }
|
|
47
48
|
};
|
|
48
49
|
const handle = recordDatabase(databaseResourceId, args, parent, [
|
|
49
50
|
{ key: "dataSource", schema: args.schema, definition: source }
|
|
@@ -76,6 +77,7 @@ function normalizeDatabaseMetadata(args) {
|
|
|
76
77
|
schema: _schema,
|
|
77
78
|
datasources: _datasources,
|
|
78
79
|
dataSourceResourceId: _dataSourceResourceId,
|
|
80
|
+
pageLayout: _pageLayout,
|
|
79
81
|
...metadata
|
|
80
82
|
} = args;
|
|
81
83
|
return metadata;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { APPS_RESERVED_RESOURCE_ID_PREFIX, APPS_WORKSPACE_RESOURCE_ID } from "./intents.js";
|
|
2
|
-
export type { DatabaseIntent, DataSourceDefinition, NotionAsCodeIcon, NotionAsCodeProperty, NotionAsCodePropertyConfig, NotionAsCodeSchema, NotionAsCodeSelectOption, NotionAsCodeStatusOption, Parent, ResourceId, } from "./intents.js";
|
|
3
|
-
export type { CustomAgentArgs, CustomAgentHandle } from "./custom-agent.js";
|
|
2
|
+
export type { ContentPageLayoutTab, DatabasePageLayout, DatabasePageLayoutTab, DatabaseIntent, DataSourceDefinition, NotionAsCodeIcon, NotionAsCodeProperty, NotionAsCodePropertyConfig, NotionAsCodeSchema, NotionAsCodeSelectOption, NotionAsCodeStatusOption, PageCoverReference, PageLayoutMainModule, PageLayoutNumberAndFormulaStyle, PageLayoutPersonStyle, PageLayoutPropertiesModule, PageLayoutPropertyConfig, PageLayoutPropertyModule, PageLayoutPropertySection, PageLayoutRelationConfig, PageLayoutRelationsGroupModule, PageLayoutSidebarModule, Parent, ResourceId, RollupBaseAggregationType, RollupDateAggregationType, RollupNumberAggregationType, RollupTargetPropertyType, ViewPageLayoutTab, } from "./intents.js";
|
|
3
|
+
export type { CustomAgentArgs, CustomAgentHandle, CustomAgentPageAddedTrigger, CustomAgentPropertyUpdatedTrigger, CustomAgentRecurrenceSchedule, CustomAgentRecurrenceTrigger, CustomAgentTrigger, CustomAgentTriggerBase, DailyRecurrenceSchedule, HourlyRecurrenceSchedule, MonthlyRecurrenceRestriction, MonthlyRecurrenceSchedule, MonthlyWeekdayOccurrence, PropertyTriggerCondition, RecurrenceScheduleEnd, RecurrenceWeekdays, WeeklyRecurrenceSchedule, YearlyRecurrenceSchedule, } from "./custom-agent.js";
|
|
4
4
|
export type { ChildDatabaseArgs, ChildDatabaseFactory, ChildMultiSourceDatabaseArgs, ChildSingleSourceDatabaseArgs, DataSourceArgs, DataSourceHandle, DataSourceMap, DatabaseArgs, DatabaseHandle, MultiSourceDatabaseArgs, SingleSourceDatabaseArgs, SingleSourceDatabaseHandle, } from "./database.js";
|
|
5
5
|
export type { ChildPageArgs, PageArgs, PageHandle, PropertyValue, SimpleTextToken, TextValue, VerificationInput, VerificationPropertyValue, } from "./page.js";
|
|
6
6
|
export type { TeamspaceArgs, TeamspaceHandle } from "./teamspace.js";
|
|
@@ -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,EACX,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,MAAM,EACN,UAAU,
|
|
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,EACX,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,0BAA0B,EAC1B,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,+BAA+B,EAC/B,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,EACvB,MAAM,EACN,UAAU,EACV,yBAAyB,EACzB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,GACjB,MAAM,cAAc,CAAC;AACtB,YAAY,EACX,eAAe,EACf,iBAAiB,EACjB,2BAA2B,EAC3B,iCAAiC,EACjC,6BAA6B,EAC7B,4BAA4B,EAC5B,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,4BAA4B,EAC5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,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,UAAU,EACV,QAAQ,GACR,MAAM,YAAY,CAAC;AAEpB,wEAAwE;AACxE,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;CAAiB,CAAC"}
|
|
@@ -23,6 +23,13 @@ export type NotionAsCodeIcon = {
|
|
|
23
23
|
type: "file";
|
|
24
24
|
resourceId: ResourceId;
|
|
25
25
|
};
|
|
26
|
+
/** A URL reference used as a page or database cover. */
|
|
27
|
+
export type PageCoverReference = {
|
|
28
|
+
type: "url";
|
|
29
|
+
url: string;
|
|
30
|
+
/** Vertical position from the top, where 0 is the top and 1 is the bottom. */
|
|
31
|
+
position?: number;
|
|
32
|
+
};
|
|
26
33
|
export type NotionAsCodeSelectColor = "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red";
|
|
27
34
|
export type NotionAsCodeSelectOption = {
|
|
28
35
|
name: string;
|
|
@@ -39,9 +46,49 @@ type PropertyBase = {
|
|
|
39
46
|
}>;
|
|
40
47
|
description?: string;
|
|
41
48
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
/** Rollup aggregations supported for every target property type. */
|
|
50
|
+
export type RollupBaseAggregationType = "count" | "count_values" | "unique" | "empty" | "not_empty" | "percent_empty" | "percent_not_empty" | "show_unique";
|
|
51
|
+
/** Numeric-only rollup aggregations. */
|
|
52
|
+
export type RollupNumberAggregationType = RollupBaseAggregationType | "sum" | "average" | "median" | "min" | "max" | "range";
|
|
53
|
+
/** Date-only rollup aggregations. */
|
|
54
|
+
export type RollupDateAggregationType = RollupBaseAggregationType | "earliest_date" | "latest_date" | "date_range";
|
|
55
|
+
export type RollupTargetPropertyType = "title" | "text" | "number" | "select" | "multi_select" | "status" | "date" | "checkbox" | "url" | "email" | "phone_number" | "relation" | "person" | "created_time" | "last_edited_time" | "created_by" | "last_edited_by";
|
|
56
|
+
type RollupTarget = {
|
|
57
|
+
targetPropertyType: "number";
|
|
58
|
+
aggregation?: RollupNumberAggregationType;
|
|
59
|
+
} | {
|
|
60
|
+
targetPropertyType: "date" | "created_time" | "last_edited_time";
|
|
61
|
+
aggregation?: RollupDateAggregationType;
|
|
62
|
+
} | {
|
|
63
|
+
targetPropertyType: Exclude<RollupTargetPropertyType, "number" | "date" | "created_time" | "last_edited_time">;
|
|
64
|
+
aggregation?: RollupBaseAggregationType;
|
|
65
|
+
};
|
|
66
|
+
type RelationProperty = PropertyBase & {
|
|
67
|
+
type: "relation";
|
|
68
|
+
targetDataSourceResourceId: ResourceId;
|
|
69
|
+
targetDataSourcePropertyResourceId?: ResourceId;
|
|
70
|
+
limit?: 1;
|
|
71
|
+
};
|
|
72
|
+
type FormulaProperty = PropertyBase & {
|
|
73
|
+
type: "formula";
|
|
74
|
+
expression?: string;
|
|
75
|
+
};
|
|
76
|
+
type RollupProperty = PropertyBase & RollupTarget & {
|
|
77
|
+
type: "rollup";
|
|
78
|
+
relationPropertyResourceId: ResourceId;
|
|
79
|
+
targetPropertyResourceId: ResourceId;
|
|
80
|
+
};
|
|
81
|
+
type AutoIncrementIdProperty = PropertyBase & {
|
|
82
|
+
type: "auto_increment_id";
|
|
83
|
+
prefix?: string;
|
|
84
|
+
};
|
|
85
|
+
type PersonProperty = PropertyBase & {
|
|
86
|
+
type: "person";
|
|
87
|
+
limit?: 1;
|
|
88
|
+
};
|
|
89
|
+
type VerificationProperty = PropertyBase & {
|
|
90
|
+
type: "verification";
|
|
91
|
+
verifierPropertyResourceId: ResourceId;
|
|
45
92
|
};
|
|
46
93
|
/** A normalized Notion-as-Code property with its resolved display name. */
|
|
47
94
|
export type NotionAsCodeProperty = (PropertyBase & {
|
|
@@ -81,31 +128,106 @@ export type NotionAsCodeProperty = (PropertyBase & {
|
|
|
81
128
|
type: "phone_number";
|
|
82
129
|
}) | (PropertyBase & {
|
|
83
130
|
type: "file";
|
|
84
|
-
}) |
|
|
131
|
+
}) | RelationProperty | FormulaProperty | RollupProperty | (PropertyBase & {
|
|
132
|
+
type: "created_time";
|
|
133
|
+
}) | (PropertyBase & {
|
|
134
|
+
type: "last_edited_time";
|
|
135
|
+
}) | (PropertyBase & {
|
|
136
|
+
type: "created_by";
|
|
137
|
+
}) | (PropertyBase & {
|
|
138
|
+
type: "last_edited_by";
|
|
139
|
+
}) | AutoIncrementIdProperty | PersonProperty | VerificationProperty;
|
|
85
140
|
/**
|
|
86
141
|
* `T extends unknown` applies Omit to each property variant separately, preserving
|
|
87
142
|
* variant-specific fields such as required status options. Plain Omit on the union
|
|
88
|
-
* would retain only shared keys.
|
|
89
|
-
* unsupported variant, whose string index signature would otherwise erase them.
|
|
143
|
+
* would retain only shared keys.
|
|
90
144
|
*/
|
|
91
|
-
type DistributivePropertyConfig<T extends NotionAsCodeProperty> = T extends unknown ? Omit<T, "name">
|
|
145
|
+
type DistributivePropertyConfig<T extends NotionAsCodeProperty> = T extends unknown ? Omit<T, "name"> : never;
|
|
92
146
|
/**
|
|
93
147
|
* Authoring properties are keyed by their schema object name. A property-level
|
|
94
|
-
* `name` override would make the key and serialized property diverge
|
|
95
|
-
* explicitly rejected even for the string-indexed unsupported-property variant.
|
|
148
|
+
* `name` override would make the key and serialized property diverge.
|
|
96
149
|
*/
|
|
97
150
|
export type NotionAsCodePropertyConfig = DistributivePropertyConfig<NotionAsCodeProperty> & {
|
|
98
151
|
name?: never;
|
|
99
152
|
};
|
|
100
153
|
/** A keyed property schema, with object keys supplying serialized property names. */
|
|
101
154
|
export type NotionAsCodeSchema = Record<string, NotionAsCodePropertyConfig>;
|
|
155
|
+
type SchemaProperty<Schema extends NotionAsCodeSchema> = Schema[keyof Schema & string];
|
|
156
|
+
type PropertyType = NotionAsCodePropertyConfig["type"];
|
|
157
|
+
type PropertyResourceIdFor<Schema extends NotionAsCodeSchema, Types extends PropertyType = PropertyType> = Extract<SchemaProperty<Schema>, {
|
|
158
|
+
type: Types;
|
|
159
|
+
}>["resourceId"];
|
|
160
|
+
export type PageLayoutPropertyConfig<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
|
|
161
|
+
property: PropertyResourceIdFor<Schema>;
|
|
162
|
+
visibility?: "show" | "hide_if_empty" | "hide";
|
|
163
|
+
};
|
|
164
|
+
export type PageLayoutPropertySection<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
|
|
165
|
+
name: string;
|
|
166
|
+
properties: readonly PageLayoutPropertyConfig<Schema>[];
|
|
167
|
+
};
|
|
168
|
+
export type PageLayoutPropertiesModule<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
|
|
169
|
+
type: "properties";
|
|
170
|
+
} & ({
|
|
171
|
+
properties?: readonly PageLayoutPropertyConfig<Schema>[];
|
|
172
|
+
sections?: never;
|
|
173
|
+
} | {
|
|
174
|
+
sections: readonly PageLayoutPropertySection<Schema>[];
|
|
175
|
+
properties?: never;
|
|
176
|
+
});
|
|
177
|
+
export type PageLayoutPersonStyle = "compact" | "large";
|
|
178
|
+
export type PageLayoutNumberAndFormulaStyle = "large" | "small";
|
|
179
|
+
type PageLayoutStyleFor<Property extends NotionAsCodePropertyConfig> = Property["type"] extends "person" | "created_by" | "last_edited_by" ? {
|
|
180
|
+
style?: PageLayoutPersonStyle;
|
|
181
|
+
} : Property["type"] extends "number" | "formula" ? {
|
|
182
|
+
style?: PageLayoutNumberAndFormulaStyle;
|
|
183
|
+
} : {
|
|
184
|
+
style?: never;
|
|
185
|
+
};
|
|
186
|
+
type PageLayoutPropertyModuleFor<Property extends NotionAsCodePropertyConfig> = Property extends unknown ? {
|
|
187
|
+
type: "property";
|
|
188
|
+
property: Property["resourceId"];
|
|
189
|
+
} & PageLayoutStyleFor<Property> : never;
|
|
190
|
+
/**
|
|
191
|
+
* A standalone property module. Its available style is inferred from the
|
|
192
|
+
* referenced property's type when the layout is declared with a literal schema.
|
|
193
|
+
*/
|
|
194
|
+
export type PageLayoutPropertyModule<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = PageLayoutPropertyModuleFor<SchemaProperty<Schema>>;
|
|
195
|
+
export type PageLayoutRelationConfig<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
|
|
196
|
+
property: PropertyResourceIdFor<Schema, "relation">;
|
|
197
|
+
display: "pageSection" | "minimal";
|
|
198
|
+
};
|
|
199
|
+
export type PageLayoutRelationsGroupModule<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
|
|
200
|
+
type: "relations";
|
|
201
|
+
relations: readonly PageLayoutRelationConfig<Schema>[];
|
|
202
|
+
};
|
|
203
|
+
export type PageLayoutMainModule<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = PageLayoutPropertiesModule<Schema> | PageLayoutPropertyModule<Schema> | PageLayoutRelationsGroupModule<Schema>;
|
|
204
|
+
export type PageLayoutSidebarModule<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = PageLayoutPropertiesModule<Schema> | PageLayoutPropertyModule<Schema>;
|
|
205
|
+
export type ContentPageLayoutTab = {
|
|
206
|
+
type: "content";
|
|
207
|
+
name?: string;
|
|
208
|
+
};
|
|
209
|
+
export type ViewPageLayoutTab = {
|
|
210
|
+
type: "view";
|
|
211
|
+
resourceId: ResourceId;
|
|
212
|
+
};
|
|
213
|
+
export type DatabasePageLayoutTab = ContentPageLayoutTab | ViewPageLayoutTab;
|
|
214
|
+
export type DatabasePageLayout<Schema extends NotionAsCodeSchema = NotionAsCodeSchema> = {
|
|
215
|
+
main: readonly PageLayoutMainModule<Schema>[];
|
|
216
|
+
sidebar?: readonly PageLayoutSidebarModule<Schema>[];
|
|
217
|
+
pinnedProperties?: readonly PropertyResourceIdFor<Schema>[];
|
|
218
|
+
discussions?: "top" | "bottom" | "hidden";
|
|
219
|
+
tabs?: readonly DatabasePageLayoutTab[];
|
|
220
|
+
fullWidth?: boolean;
|
|
221
|
+
showPropertyIcons?: boolean;
|
|
222
|
+
showTemplates?: boolean;
|
|
223
|
+
};
|
|
102
224
|
/** The normalized data-source shape emitted in provisioning artifacts. */
|
|
103
225
|
export type DataSourceDefinition<Properties extends readonly NotionAsCodeProperty[] = readonly NotionAsCodeProperty[]> = {
|
|
104
226
|
resourceId: ResourceId;
|
|
105
227
|
name: string;
|
|
106
228
|
properties: Properties;
|
|
107
229
|
icon?: NotionAsCodeIcon;
|
|
108
|
-
pageLayout?:
|
|
230
|
+
pageLayout?: DatabasePageLayout;
|
|
109
231
|
};
|
|
110
232
|
export type TeamspaceIntent = TeamspaceArgs & {
|
|
111
233
|
parent: Parent;
|
|
@@ -122,7 +244,7 @@ export type DatabaseIntent = {
|
|
|
122
244
|
dataSources: readonly DataSourceDefinition[];
|
|
123
245
|
views?: readonly ViewSchema[];
|
|
124
246
|
icon?: NotionAsCodeIcon;
|
|
125
|
-
cover?:
|
|
247
|
+
cover?: PageCoverReference;
|
|
126
248
|
hideDataSourceTitle?: boolean;
|
|
127
249
|
hideDatabaseTitleIfEmpty?: boolean;
|
|
128
250
|
name?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/intents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,+EAA+E;AAC/E,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,8BAA8B,CAAC;AACtE,kEAAkE;AAClE,eAAO,MAAM,gCAAgC,mBAAmB,CAAC;AAEjE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC,MAAM,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACzB;IAAE,IAAI,EAAE,OAA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/notion-as-code-types.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Parent, type ResourceId } from "./intents.js";
|
|
1
|
+
import { type PageCoverReference, type Parent, type ResourceId } from "./intents.js";
|
|
2
2
|
import { type ChildDatabaseFactory } from "./database.js";
|
|
3
3
|
/**
|
|
4
4
|
* A single text token: plain text as `[string]`, or text with annotations as
|
|
@@ -37,7 +37,7 @@ export type PageArgs = {
|
|
|
37
37
|
resourceId: ResourceId;
|
|
38
38
|
/** Omit to create a private top-level page in the Apps workspace. */
|
|
39
39
|
parent?: Parent;
|
|
40
|
-
cover?:
|
|
40
|
+
cover?: PageCoverReference;
|
|
41
41
|
/**
|
|
42
42
|
* Page properties, including the page title.
|
|
43
43
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/notion-as-code/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,MAAM,EACX,KAAK,UAAU,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAI/E;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAC1B;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,SAAS,CAAC;CACpB,GACD;IAAE,KAAK,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3B,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG;IAC3D,IAAI,EAAE,cAAc,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACtB,MAAM,GACN,MAAM,GACN,SAAS,GACT,MAAM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;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,oBAAoB,CAAC;IAClC,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,UAAU,CAAC;CAC7C,CAAC;AAEF,oFAAoF;AACpF,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,CAS/C;AAED,6DAA6D;AAC7D,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAgBrF"}
|
package/package.json
CHANGED
|
@@ -124,12 +124,17 @@ use `{ type: "resourceId", resourceId: parent.resourceId }`; child helpers set
|
|
|
124
124
|
this reference for you. Pages and databases without a parent default to private
|
|
125
125
|
top-level resources in the Apps workspace.
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
Page and database covers accept `{ type: "url", url, position? }`. Custom-agent
|
|
128
|
+
triggers are discriminated unions for recurrence, page-added, and
|
|
129
|
+
property-updated triggers. Weekly recurrences require at least one weekday, and
|
|
130
|
+
property-updated triggers require property conditions or
|
|
131
|
+
`triggerWhenPageContentEdited: true`.
|
|
132
|
+
|
|
133
|
+
Database page layouts are typed against their keyed data-source schema. Reference
|
|
134
|
+
property resource IDs, not schema keys. The SDK restricts relation groups to
|
|
135
|
+
relation properties and narrows standalone property styles by property type.
|
|
136
|
+
Database views are typed with `ViewSchema`; standalone declarations accept
|
|
137
|
+
`ViewArgs`, which adds the owning `databaseResourceId`.
|
|
133
138
|
|
|
134
139
|
The Apps SDK exposes a subset of Notion as Code. Data sources are nested inside
|
|
135
140
|
`database(resourceId, { datasources: { ... } })`, not declared by a separate
|
|
@@ -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
|
+
});
|